private void saveEmergencyAttendance(DomainFactory factory, EmergencyAttendanceOutcomeVo emergAttendance, Sch_BookingVo voBooking) throws StaleObjectException { if (emergAttendance==null || emergAttendance.getEDClinicDetails()==null) return; Booking_AppointmentVoCollection collAppts = voBooking.getAppointments(); if (collAppts!=null && collAppts.size()>0) { collAppts=collAppts.sort(new ApptDateTimeComparator(SortOrder.ASCENDING)); emergAttendance.getEDClinicDetails().setEDClinicAppt(collAppts.get(0)); EmergencyAttendance doEmergAtt = EmergencyAttendanceOutcomeVoAssembler.extractEmergencyAttendance(factory, emergAttendance); factory.save(doEmergAtt); } }
public EmergencyAttendanceOutcomeVo getLatestEmergencyAttendance(PatientRefVo patientRef) { if(patientRef == null || patientRef.getID_Patient() == null) throw new CodingRuntimeException("Cannot list Emergency Episodes for a null Patient Id."); String query = "select ea from EmergencyAttendance as ea left join ea.careContext as cc left join cc.episodeOfCare as ec left join ec.careSpell as cs left join cs.patient as p where p.id = :PatientId order by ec.startDate desc, ea.arrivalDateTime desc "; //wdev-16070 List list=getDomainFactory().find(query, new String[] {"PatientId"}, new Object[] {patientRef.getID_Patient()}); if (list!=null && list.size()>0) { return EmergencyAttendanceOutcomeVoAssembler.create(((EmergencyAttendance)list.get(0))); } return null; }