public TrackingForClinicianWorklistVo getTrackingForTriage(ims.emergency.vo.TrackingRefVo trackingId) { if(trackingId == null || trackingId.getID_Tracking() == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Tracking Id."); return TrackingForClinicianWorklistVoAssembler.create((Tracking) getDomainFactory().getDomainObject(Tracking.class, trackingId.getID_Tracking())); }
public TrackingForClinicianWorklistVo saveMedicStartTime(TrackingForClinicianWorklistVo tracking) throws StaleObjectException { if(tracking == null) throw new CodingRuntimeException("Cannot save a null Tracking record."); if(!tracking.isValidated()) throw new CodingRuntimeException("Tracking record is not validated."); DomainFactory factory = getDomainFactory(); Tracking doTracking = TrackingForClinicianWorklistVoAssembler.extractTracking(factory, tracking); factory.save(doTracking); return TrackingForClinicianWorklistVoAssembler.create(doTracking); }
public TrackingForClinicianWorklistVo getTrackingForClinicianWorklistByCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Care Context Id."); DomainFactory factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.attendance as att left join att.careContext as cc where cc.id = :CareContextId"; List<?> trackingList = factory.find(query, new String[] {"CareContextId"}, new Object[] {careContext.getID_CareContext()}); if(trackingList == null || trackingList.size() == 0) return null; return TrackingForClinicianWorklistVoAssembler.create((Tracking) trackingList.get(0)); }
public TrackingForClinicianWorklistVo geTrackingForTriageByAttendanceId(EmergencyAttendanceRefVo attendanceId) { if(attendanceId == null || attendanceId.getID_EmergencyAttendance() == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Attendance Id."); DomainFactory factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.attendance as att where att.id = :AttendanceId"; List<?> list = factory.find(query, new String[] {"AttendanceId"}, new Object[] {attendanceId.getID_EmergencyAttendance()}); if(list == null || list.size() == 0) return null; return TrackingForClinicianWorklistVoAssembler.create((Tracking) list.get(0)); }
public TrackingForClinicianWorklistVo getTrackingForClinicianByActiveCareContext(PatientRefVo patientRef) { if(patientRef == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Patient Id."); DomainFactory factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.attendance as att left join att.careContext as cc left join cc.episodeOfCare as EOC left join EOC.careSpell as CS left join CS.patient as PAT where cc.endDateTime is null and PAT.id = :PatientId"; List<?> trackingList = factory.find(query, new String[] {"PatientId"}, new Object[] {patientRef.getID_Patient()}); if(trackingList == null || trackingList.size() == 0) return null; return TrackingForClinicianWorklistVoAssembler.create((Tracking) trackingList.get(0)); }
public TrackingForClinicianWorklistVo saveTrackingSeenByHcp(TrackingForClinicianWorklistVo tracking, SeenByHCPVo seenByHcp) throws StaleObjectException { if (tracking == null || tracking.getID_Tracking() == null) throw new CodingRuntimeException("Major logical erros - tracking record can not be null"); DomainFactory factory = getDomainFactory(); // Get latest tracking domain object Tracking doTracking = (Tracking) factory.getDomainObject(Tracking.class, tracking.getID_Tracking()); if (doTracking == null || doTracking.getSeenBy() != null) { throw new StaleObjectException(doTracking); } // Create status for the Tracking bo TrackingAttendanceStatusVo updatedStatus = new TrackingAttendanceStatusVo(); updatedStatus.setPatient(seenByHcp.getPatient()); updatedStatus.setEpisode(seenByHcp.getEpisode()); updatedStatus.setAttendance(seenByHcp.getAttendance()); //updatedStatus.setCreatedBy(allocatedMedic.getAllocatedBy()); if (seenByHcp.getAllocatedMedic()!=null ) { updatedStatus.setCreatedBy(seenByHcp.getAllocatedMedic().getMos()); } else if (seenByHcp.getAllocatedNurse()!=null) { updatedStatus.setCreatedBy(seenByHcp.getAllocatedNurse().getMos()); } updatedStatus.setTrackingArea(seenByHcp.getTrackingArea()); updatedStatus.setStatusDatetime(new DateTime()); updatedStatus.setStatus(TrackingStatus.BEING_ATTENDED_TO); // Extract domain object for Tracking status TrackingAttendanceStatus doStatus = TrackingAttendanceStatusVoAssembler.extractTrackingAttendanceStatus(factory, updatedStatus); // Extract domain object for Current Allocated status SeenByHCP doSeenBy = SeenByHCPVoAssembler.extractSeenByHCP(factory, seenByHcp); doTracking.setCurrentStatus(doStatus); doTracking.setSeenBy(doSeenBy); factory.save(doTracking); return TrackingForClinicianWorklistVoAssembler.create(doTracking); }