public EmergencyAttendanceForEventHistoryVo getEmergencyAttendance(CareContextRefVo careContextRef) { if (careContextRef == null || careContextRef.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get EmergencyAttendanceForEventHistoryVo on null Id for CareContext "); } DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer hql = new StringBuffer(); hql.append(" select Emergency from EmergencyAttendance as Emergency left join Emergency.careContext as contextID where contextID.id = :contextID"); markers.add("contextID"); values.add(careContextRef.getID_CareContext()); EmergencyAttendanceForEventHistoryVoCollection emergencyAttendance = EmergencyAttendanceForEventHistoryVoAssembler.createEmergencyAttendanceForEventHistoryVoCollectionFromEmergencyAttendance(factory.find(hql.toString(), markers, values)); if (emergencyAttendance != null && emergencyAttendance.size() > 0) { return emergencyAttendance.get(0); } else { return null; } }
private void populateLabelsFromEmergencyAttendance() { EmergencyAttendanceForEventHistoryVo emergencyAttendance = domain.getEmergencyAttendance(form.getGlobalContext().Core.getCurrentCareContext()); if (emergencyAttendance == null) { engine.showMessage("Patient doesn't have an EmergencyAttendance, fields will not be populated"); return; } for (int i = 0; i < emergencyAttendance.getPatient().getIdentifiers().size(); i++) { if (emergencyAttendance.getPatient().getIdentifiers().get(i).getType().equals(ims.core.vo.lookups.PatIdType.HOSPNUM)) { form.lblHospitalNumber().setValue(emergencyAttendance.getPatient().getIdentifiers().get(i).getValue()); } } //WDEV-17482 form.lblPatientName().setValue(emergencyAttendance.getPatient().getName().getSurname().toUpperCase() + (emergencyAttendance.getPatient().getName().getForename() != null ? ", " + emergencyAttendance.getPatient().getName().getForename() : "")); form.lblAttendanceID().setValue(emergencyAttendance.getID_EmergencyAttendance().toString()); if (emergencyAttendance.getEpisode().getPresentingComplaintIsNotNull()) { form.lblPresentingComplaint().setValue(emergencyAttendance.getEpisode().getPresentingComplaint().getText()); } if (emergencyAttendance.getEpisode().getCategoryIsNotNull()) { form.lblPatientCategory().setValue(emergencyAttendance.getEpisode().getCategory().getText()); } if (emergencyAttendance.getEpisode().getSourceOfReferralIsNotNull()) { form.lblSourceOfReferral().setValue(emergencyAttendance.getEpisode().getSourceOfReferral().getText()); } if (emergencyAttendance.getEpisode().getInjuryDateTimeIsNotNull()) { form.lblInjuryDateTime().setValue(emergencyAttendance.getEpisode().getInjuryDateTime().toString()); } if (emergencyAttendance.getArrivalDateTimeIsNotNull()) { form.lblArrivalDateAndTime().setValue(emergencyAttendance.getArrivalDateTime().toString()); } if (emergencyAttendance.getRegistrationDateTimeIsNotNull()) { form.lblRegistrationDateAndTime().setValue(emergencyAttendance.getRegistrationDateTime().toString()); } if (emergencyAttendance.getDischargeDateTimeIsNotNull()) { form.lblDischargeDateAndTime().setValue(emergencyAttendance.getDischargeDateTime().toString()); } //WDEV-17038 if (emergencyAttendance.getDischargeDateTime()!=null && AttendanceOutcome.ADMISSIONS.equals(emergencyAttendance.getOutcome())) { AdmissionDetailForEventHistoryVo admDetails = domain.getAdmissionDetail(form.getGlobalContext().Core.getPatientShort(), emergencyAttendance.getDischargeDateTime()); form.lblWard().setVisible(admDetails!=null && admDetails.getWardIsNotNull()); form.lblWardValue().setValue(admDetails!=null && admDetails.getWardIsNotNull() ? admDetails.getWard().getName():null); } }
private void populateLabelsFromEmergencyAttendance() { EmergencyAttendanceForEventHistoryVo emergencyAttendance = domain.getEmergencyAttendance(form.getGlobalContext().Core.getCurrentCareContext()); if (emergencyAttendance == null) { engine.showMessage("Patient doesn't have an EmergencyAttendance, fields will not be populated"); return; } for (int i = 0; i < emergencyAttendance.getPatient().getIdentifiers().size(); i++) { if (emergencyAttendance.getPatient().getIdentifiers().get(i).getType().equals(ims.core.vo.lookups.PatIdType.HOSPNUM)) { form.lblHospitalNumber().setValue(emergencyAttendance.getPatient().getIdentifiers().get(i).getValue()); } } //WDEV-17482 form.lblPatientName().setValue(emergencyAttendance.getPatient().getName().getSurname().toUpperCase() + (emergencyAttendance.getPatient().getName().getForename() != null ? ", " + emergencyAttendance.getPatient().getName().getForename() : "")); String emergencyAttendanceNumber = ConfigFlag.GEN.ED_USE_CUSTOM_ATTENDANCE_ID.getValue() ? emergencyAttendance.getCustomID() : emergencyAttendance.getID_EmergencyAttendance().toString(); form.lblAttendanceID().setValue(emergencyAttendanceNumber); if (emergencyAttendance.getEpisode().getPresentingComplaintIsNotNull()) { //WDEV-19159 -------------starts here String tooltip = null; String text = emergencyAttendance.getEpisode().getPresentingComplaint().getText(); if (emergencyAttendance.getEpisode().getPresentingComplaint().getText().length() > 36) { text = text.substring(0, 33) + "..."; tooltip = emergencyAttendance.getEpisode().getPresentingComplaint().getText(); } form.lblPresentingComplaint().setValue(text); form.lblPresentingComplaint().setTooltip(tooltip); //WDEV-19159 -------------starts here } if (emergencyAttendance.getEpisode().getCategoryIsNotNull()) { form.lblPatientCategory().setValue(emergencyAttendance.getEpisode().getCategory().getText()); } if (emergencyAttendance.getEpisode().getSourceOfReferralIsNotNull()) { form.lblSourceOfReferral().setValue(emergencyAttendance.getEpisode().getSourceOfReferral().getText()); } if (emergencyAttendance.getEpisode().getInjuryDateTimeIsNotNull()) { form.lblInjuryDateTime().setValue(emergencyAttendance.getEpisode().getInjuryDateTime().toString()); } if (emergencyAttendance.getArrivalDateTimeIsNotNull()) { form.lblArrivalDateAndTime().setValue(emergencyAttendance.getArrivalDateTime().toString()); } if (emergencyAttendance.getRegistrationDateTimeIsNotNull()) { form.lblRegistrationDateAndTime().setValue(emergencyAttendance.getRegistrationDateTime().toString()); } if (emergencyAttendance.getDischargeDateTimeIsNotNull()) { form.lblDischargeDateAndTime().setValue(emergencyAttendance.getDischargeDateTime().toString()); } //WDEV-17038 if (emergencyAttendance.getDischargeDateTime()!=null && AttendanceOutcome.ADMISSIONS.equals(emergencyAttendance.getOutcome())) { AdmissionDetailForEventHistoryVo admDetails = domain.getAdmissionDetail(form.getGlobalContext().Core.getPatientShort(), emergencyAttendance.getDischargeDateTime()); form.lblWard().setVisible(admDetails!=null && admDetails.getWardIsNotNull()); form.lblWardValue().setValue(admDetails!=null && admDetails.getWardIsNotNull() ? admDetails.getWard().getName():null); } }