public TrackingForClinicianWorklistAndTriageVo saveTrackingSeenByHcp(TrackingForClinicianWorklistAndTriageVo 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()); 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 TrackingForClinicianWorklistAndTriageVoAssembler.create(doTracking); }
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); }