public AdmissionDetailLiteVo getMothersAdmission(PatientRefVo patient) { if (patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("patient is null or id not provided in method getMothersAdmission"); //get the patient to read ClientParent value Patient doPatient = (Patient) getDomainFactory().getDomainObject(patient); if(doPatient != null && doPatient.getClientParent() != null) { List admissions = getDomainFactory().find("from AdmissionDetail adm left join fetch adm.pasEvent as pe left join fetch pe.patient as pat where pat.id = " + doPatient.getClientParent().getId()); if(admissions != null && admissions.size() > 0) return AdmissionDetailLiteVoAssembler.create((AdmissionDetail) admissions.get(0)); } return null; }
private String createAdmissionTooltip(AdmissionDetailLiteVo voAdmission) { if (voAdmission == null) throw new CodingRuntimeException("voAdmission cannot be null in method createAdmissionTooltip"); StringBuffer strTooltip = new StringBuffer(); String patient = voAdmission.getPatientString(); String admissionDateTime = voAdmission.getAdmissionDateTimeIsNotNull() ? voAdmission.getAdmissionDateTime().toString(true) : ""; String ward = voAdmission.getWardIsNotNull() ? voAdmission.getWard().getName() : "[DISCHARGED]"; String bedNo = voAdmission.getBedIsNotNull() && voAdmission.getBed().getBedNumberIsNotNull() ? voAdmission.getBed().getBedNumber() : ""; String consultant = voAdmission.getConsultantIsNotNull() ? voAdmission.getConsultant().getIMosName() : ""; String specialty = voAdmission.getSpecialtyIsNotNull() ? voAdmission.getSpecialty().getText(): ""; strTooltip.append("<html><head></head><body><p><font color='#FF0000'><strong>Mothers Admission Detail</strong></font>" + "<table width='240' border='0'><tr><td width='84'><font color='#0033FF'>Patient: </font></td><td>" + patient + "</td></tr><tr><td><font color='#0033FF'>Adm. Date/Time :</font></td><td>" + admissionDateTime + "</td></tr><tr><td><font color='#0033FF'>Ward :</font></td><td>" + ward + "</td></tr><tr><td><font color='#0033FF'>Bed No :</font></td><td>" + bedNo + "</td></tr><tr><td><font color='#0033FF'>Consultant :</font></td><td>" + consultant + "</td></tr><tr><td><font color='#0033FF'>Specialty :</font></td><td>" + specialty + "</td></tr></table></p>" + "</body></html>"); return strTooltip.toString(); }
private DateTime getAdmissionDateTimeViaPasevent(PASEvent pasEvent)//wdev-19922 { AdmissionDetailLiteVo admissionDetails = getAdmissionDetailsForPasEvent(pasEvent); if (admissionDetails == null) return null; return admissionDetails.getAdmissionDateTime(); }
private AdmissionDetailLiteVo getAdmissionDetailsForPasEvent(PASEvent pasEvent) { if(pasEvent == null) throw new CodingRuntimeException("Cannot get AdmissionDetails on null PasEvent"); List<?> list = getDomainFactory().find("select admDet from AdmissionDetail as admDet left join admDet.pasEvent as pasEv where (pasEv.id = :pasEventId)", new String[] {"pasEventId"}, new Object[] {pasEvent.getId()}); if (list == null || list.size() == 0) return null; return AdmissionDetailLiteVoAssembler.createAdmissionDetailLiteVoCollectionFromAdmissionDetail(list).get(0); }
/** * Function used to populate admission records to record browser */ private void populateRecordBrowser(AdmissionDetailLiteVoCollection admissionEpisodes) { // Clear record browser form.recbrAdmissions().clear(); // Check collection - if null or empty if (admissionEpisodes == null || admissionEpisodes.size() == 0) { // If the collection is null then the selected admission record will also be null form.getLocalContext().setSelectedAdmission(null); return; } // Add records to record browser for (AdmissionDetailLiteVo admission : admissionEpisodes) { // Build string to be displayed String displayString = createDisplayString(admission); // Add admission record to screen form.recbrAdmissions().newRow(admission, displayString); } // Default to first admission record (the most recent one) form.recbrAdmissions().setValue(admissionEpisodes.get(0)); // Reselect last edited or default to most recent // - if the selected record is null - default to first record in record browser if (!form.getLocalContext().getSelectedAdmissionIsNotNull()) { form.getLocalContext().setSelectedAdmission(domain.getAdmission(admissionEpisodes.get(0))); } else { // - attempt to select the record in the record browser form.recbrAdmissions().setValue(form.getLocalContext().getSelectedAdmission()); // - refresh the selected admission record form.getLocalContext().setSelectedAdmission(domain.getAdmission(form.recbrAdmissions().getValue())); } }
/** * Function used to create the display string for record browser */ private String createDisplayString(AdmissionDetailLiteVo admission) { // Create a string builder StringBuilder displayString = new StringBuilder(); // Add admission date / time if (admission.getAdmissionDateTimeIsNotNull()) { displayString.append(admission.getAdmissionDateTime().toString()); displayString.append(" -"); } else { displayString.append("<No date selected> -"); } // Add ward if (admission.getWardIsNotNull()) { displayString.append(" "); displayString.append(admission.getWard().getName()); displayString.append(" -"); } else { displayString.append(" <No ward selected> -"); } // Add consultant if (admission.getConsultantIsNotNull()) { displayString.append(" "); displayString.append(admission.getConsultant().getIMosName()); displayString.append(" -"); } else { displayString.append(" <No consultant selected> -"); } // Add specialty if (admission.getSpecialtyIsNotNull()) { displayString.append(" "); displayString.append(admission.getSpecialty().getText()); } else { displayString.append(" <No specialty selected>"); } // Return display string return displayString.toString(); }