@Override protected void onGrdDisplaySelectionChanged() throws PresentationLogicException { if (form.grdDisplay().getSelectedRow().getValue() != null && form.grdDisplay().getSelectedRow().getValue() instanceof EpisodeDetailsVo) { AttendanceDetailsVoCollection voCollAttendanceDetails = domain.listAttendanceByEpisodeDetails((EpisodeDetailsVo) form.grdDisplay().getSelectedRow().getValue()); if (voCollAttendanceDetails != null) { form.grdDisplay().getSelectedRow().setExpanded(true); for (int j = 0; j < voCollAttendanceDetails.size(); j++) { AttendanceDetailsVo voEmergencyAttendances = voCollAttendanceDetails.get(j); grdDisplayRow episodeDetailsRow = form.grdDisplay().getSelectedRow().getRows().newRow(); episodeDetailsRow.setcolDateTime(voEmergencyAttendances.getArrivalDateTime()); episodeDetailsRow.setcolPatCategory(voEmergencyAttendances.getOutcome() != null ? voEmergencyAttendances.getOutcome().getText() : null); episodeDetailsRow.setcolEpisodeNo(voEmergencyAttendances.getID_EmergencyAttendance().toString()); } } } }
public AttendanceDetailsVo getLastAttendance(PatientRefVo patientRef) { if(patientRef == null) throw new CodingRuntimeException("Patient not provided"); DomainFactory factory = getDomainFactory(); String hsql = "select e3_1 from EmergencyEpisode as e1_1 left join e1_1.episodeOfCare as e2_1 left join e2_1.careSpell as c1_1 left join c1_1.patient as p1_1 left join e1_1.emergencyAttendances as e3_1 where (e3_1.arrivalDateTime = " + "(select max (xe3_1.arrivalDateTime) from EmergencyEpisode as xe1_1 left join xe1_1.episodeOfCare as xe2_1 left join xe2_1.careSpell as xc1_1 left join xc1_1.patient as xp1_1 left join xe1_1.emergencyAttendances as xe3_1 " + "where (xc1_1.patient.id =:idPatient )) and c1_1.patient.id =:idPatient1 )"; List attendances = factory.find(hsql, new String[] {"idPatient","idPatient1"}, new Object[] {patientRef.getID_Patient(),patientRef.getID_Patient()}); if(attendances != null && attendances.size() > 0) { AttendanceDetailsVoCollection attColl = AttendanceDetailsVoAssembler.createAttendanceDetailsVoCollectionFromEmergencyAttendance(attendances); if( attColl != null && attColl.size() > 0) return attColl.get(0); } return null; }
public AttendanceDetailsVoCollection listAttendanceByEpisodeDetails(EmergencyEpisodeRefVo voRef) { if(voRef == null || voRef.getID_EmergencyEpisode() == null) throw new CodingRuntimeException("EmergencyEpisode not provided"); DomainFactory factory = getDomainFactory(); String hsql = " select e1_1 from EmergencyAttendance as e1_1 "; hsql += " left join e1_1.emergencyEpisode as e2_1 "; hsql += " where e1_1.isRIE is null and e2_1.id = :idEpisode"; hsql += " order by e1_1.registrationDateTime desc"; List attendances = factory.find(hsql, new String[] {"idEpisode"}, new Object[] {voRef.getID_EmergencyEpisode()}); if (attendances != null && attendances.size() > 0) return AttendanceDetailsVoAssembler.createAttendanceDetailsVoCollectionFromEmergencyAttendance(attendances).sort(SortOrder.DESCENDING); return null; }