/** * Function used to populate an admission record to instance controls */ private void populateInstanceControls(AdmissionDetailLiteWithInpatientEpisodeVo admission) { // Clear instance controls clearInstanceControls(); // Check admission record for null value if (admission == null) return; // Populate admission record field to instance controls form.ccConsultant().setValue(admission.getConsultant()); form.dtimAdmission().setValue(admission.getAdmissionDateTime()); form.txtBedNo().setValue(admission.getInpatientEpisodeIsNotNull() ? admission.getInpatientEpisode().getBedNo() : null); form.cmbSpecialty().setValue(admission.getSpecialty()); setWardValue(admission.getWard()); form.dteEstimatedDischarge().setValue(admission.getEstDischargeDate()); }
/** * Method used to retrieve Admission Details. */ public AdmissionDetailLiteWithInpatientEpisodeVo getAdmission(AdmissionDetailRefVo admission) { // Check admission record parameter if (admission == null || !admission.getID_AdmissionDetailIsNotNull()) return null; AdmissionDetailLiteWithInpatientEpisodeVo admissionDetails = AdmissionDetailLiteWithInpatientEpisodeVoAssembler.create((AdmissionDetail) getDomainFactory().getDomainObject(AdmissionDetail.class, admission.getID_AdmissionDetail())); // Get Inpatient episode if exists String query = "SELECT inpEp FROM InpatientEpisode AS inpEp LEFT JOIN inpEp.pasEvent AS pas1, AdmissionDetail AS admtDetail LEFT JOIN admtDetail.pasEvent AS pas2 WHERE pas1.id = pas2.id AND admtDetail.id = :ADM_ID AND inpEp.isRIE is null"; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ADM_ID"); paramValues.add(admissionDetails.getID_AdmissionDetail()); InpatientEpisodeBedNumberUpdateVo inpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.create((InpatientEpisode) getDomainFactory().findFirst(query, paramNames, paramValues)); admissionDetails.setInpatientEpisode(inpatientEpisode); return admissionDetails; }
/** * Function used to populate an admission record to instance controls */ private void populateInstanceControls(AdmissionDetailLiteWithInpatientEpisodeVo admission) { // Clear instance controls clearInstanceControls(); // Check admission record for null value if (admission == null) return; // Populate admission record field to instance controls form.ccConsultant().setValue(admission.getConsultant()); form.dtimAdmission().setValue(admission.getAdmissionDateTime()); form.txtBedNo().setValue(admission.getInpatientEpisodeIsNotNull() ? admission.getInpatientEpisode().getBedNo() : null); form.cmbSpecialty().setValue(admission.getSpecialty()); setWardValue(admission.getWard()); form.dteEstimatedDischarge().setValue(admission.getEstDischargeDateIsNotNull() ? admission.getEstDischargeDate().getDate() : null); }
/** * Method used to save Admission Details. */ public AdmissionDetailLiteWithInpatientEpisodeVo saveAdmission(AdmissionDetailLiteWithInpatientEpisodeVo admission) throws StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException { // Check for validated parameter if (admission == null || admission.isValidated() == false) throw new DomainRuntimeException("Logical error - can't save null or not-validated object"); boolean hasInpatient = admission.getInpatientEpisodeIsNotNull(); // Extract domain objects (admission details & inpatient episode for bed number) AdmissionDetail domainAdmissionDetail = AdmissionDetailLiteVoAssembler.extractAdmissionDetail(getDomainFactory(), admission); InpatientEpisode domainInpatientEpisode = null; if (hasInpatient) { domainInpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.extractInpatientEpisode(getDomainFactory(), admission.getInpatientEpisode()); } // Commit to database both domain objects getDomainFactory().save(domainAdmissionDetail); if (hasInpatient) { getDomainFactory().save(domainInpatientEpisode); } AdmissionDetailLiteWithInpatientEpisodeVo admissionDetails = AdmissionDetailLiteWithInpatientEpisodeVoAssembler.create(domainAdmissionDetail); if (hasInpatient) { InpatientEpisodeBedNumberUpdateVo inpatientEpisode = InpatientEpisodeBedNumberUpdateVoAssembler.create(domainInpatientEpisode); admissionDetails.setInpatientEpisode(inpatientEpisode); } // Return saved record return admissionDetails; }
/** * Function used to retrieve instance admission records from screen */ private AdmissionDetailLiteWithInpatientEpisodeVo populateDataFromInstanceControls(AdmissionDetailLiteWithInpatientEpisodeVo admission) { if (admission == null) throw new CodingRuntimeException("This form is used only for editing admission episodes. Admission episode can not be null"); // Get admission data from screen admission.setAdmissionDateTime(form.dtimAdmission().getValue()); // Update admission DateTime in Inpatient episode if needed if (admission.getInpatientEpisodeIsNotNull()) { admission.getInpatientEpisode().setAdmissionDateTime(form.dtimAdmission().getValue()); } // Update Consultant in record and in PasEvent admission.setConsultant(form.ccConsultant().getValue()); admission.getPasEvent().setConsultant(form.ccConsultant().getValue()); // Get bed number if (admission.getInpatientEpisodeIsNotNull()) { admission.getInpatientEpisode().setBedNo(form.txtBedNo().getValue()); } // Update Speciality in record and in PasEvent admission.setSpecialty(form.cmbSpecialty().getValue()); admission.getPasEvent().setSpecialty(form.cmbSpecialty().getValue()); // Update Ward in record and in PasEvent admission.setWard(form.cmbWard().getValue()); admission.getPasEvent().setLocation(form.cmbWard().getValue()); admission.setEstDischargeDate(form.dteEstimatedDischarge().getValue()); // Update estimated discharge date in Inpatient episode if needed if (admission.getInpatientEpisodeIsNotNull()) { admission.getInpatientEpisode().setEstDischargeDate(form.dteEstimatedDischarge().getValue()); } // Return filled admission return admission; }
/** * Function used to retrieve instance admission records from screen */ private AdmissionDetailLiteWithInpatientEpisodeVo populateDataFromInstanceControls(AdmissionDetailLiteWithInpatientEpisodeVo admission) { if (admission == null) throw new CodingRuntimeException("This form is used only for editing admission episodes. Admission episode can not be null"); // Get admission data from screen admission.setAdmissionDateTime(form.dtimAdmission().getValue()); // Update admission DateTime in Inpatient episode if needed if (admission.getInpatientEpisodeIsNotNull()) { admission.getInpatientEpisode().setAdmissionDateTime(form.dtimAdmission().getValue()); } // Update Consultant in record and in PasEvent if (form.ccConsultant().getValue() instanceof MedicVo) { admission.setConsultant(form.ccConsultant().getValue()); admission.getPasEvent().setConsultant((MedicVo)form.ccConsultant().getValue()); } // Get bed number if (admission.getInpatientEpisodeIsNotNull()) { admission.getInpatientEpisode().setBedNo(form.txtBedNo().getValue()); } // Update Speciality in record and in PasEvent admission.setSpecialty(form.cmbSpecialty().getValue()); admission.getPasEvent().setSpecialty(form.cmbSpecialty().getValue()); // Update Ward in record and in PasEvent admission.setWard(form.cmbWard().getValue()); admission.getPasEvent().setLocation(form.cmbWard().getValue()); admission.setEstDischargeDate(new DateTime(form.dteEstimatedDischarge().getValue(), new Time(0,0))); // Update estimated discharge date in Inpatient episode if needed if (admission.getInpatientEpisodeIsNotNull()) { admission.getInpatientEpisode().setEstDischargeDate(form.dteEstimatedDischarge().getValue() != null ? new DateTime(form.dteEstimatedDischarge().getValue(), new Time(0,0)) : null); } // Return filled admission return admission; }