private TrackingSaveVo dischargePatient(TrackingSaveVo trackingWithDNW) { if(trackingWithDNW != null) { if(trackingWithDNW.getAttendance() != null) { trackingWithDNW.getAttendance().setDischargeDateTime(new DateTime()); trackingWithDNW.getAttendance().setOutcome(AttendanceOutcome.DID_NOT_WAIT); if(trackingWithDNW.getAttendance().getCareContext() != null) { trackingWithDNW.getAttendance().getCareContext().setEndDateTime(new DateTime()); } //WDEV-17283 if (trackingWithDNW.getAssociatedPendingEmergencyAdmissionIsNotNull()) { trackingWithDNW.getAssociatedPendingEmergencyAdmission().setAdmissionStatus(EmergencyAdmissionStatus.CANCELLED); } } trackingWithDNW.setCurrentArea(null); trackingWithDNW.setIsDischarged(true); trackingWithDNW.setCurrentStatus(createTrackingStatus(TrackingStatus.DISCHARGED)); } return trackingWithDNW; }
public TrackingSaveVo getTracking(TrackingRefVo trackingId) { if(trackingId == null || trackingId.getID_Tracking() == null) throw new CodingRuntimeException("Cannot get Tracking record on null Tracking Id."); DomainFactory factory = getDomainFactory(); Tracking doTracking = (Tracking) factory.getDomainObject(Tracking.class, trackingId.getID_Tracking()); return TrackingSaveVoAssembler.create(doTracking); }
public TrackingSaveVo saveTracking(TrackingSaveVo tracking) throws StaleObjectException, UniqueKeyViolationException { 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 = TrackingSaveVoAssembler.extractTracking(factory, tracking); factory.save(doTracking); return TrackingSaveVoAssembler.create(doTracking); }
private TrackingSaveVo dischargePatient(TrackingSaveVo trackingWithDNW) { if(trackingWithDNW != null) { if(trackingWithDNW.getAttendance() != null) { Boolean wasSeen = domain.wasSeenByHCP(trackingWithDNW.getAttendance().getCareContext()); trackingWithDNW.getAttendance().setDischargeDateTime(new DateTime()); trackingWithDNW.getAttendance().setOutcome(Boolean.TRUE.equals(wasSeen) ? AttendanceOutcome.AGAINST_MEDICAL_ADVISE : AttendanceOutcome.DID_NOT_WAIT); if(trackingWithDNW.getAttendance().getCareContext() != null) { trackingWithDNW.getAttendance().getCareContext().setEndDateTime(new DateTime()); } //WDEV-17283 if (trackingWithDNW.getAssociatedPendingEmergencyAdmissionIsNotNull()) { trackingWithDNW.getAssociatedPendingEmergencyAdmission().setAdmissionStatus(EmergencyAdmissionStatus.CANCELLED); } } trackingWithDNW.setCurrentArea(null); trackingWithDNW.setIsDischarged(true); trackingWithDNW.setCurrentStatus(createTrackingStatus(TrackingStatus.DISCHARGED)); } return trackingWithDNW; }
public TrackingSaveVo saveTracking(TrackingSaveVo tracking, Boolean sendHL7Discharge) throws StaleObjectException, UniqueKeyViolationException { 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 = TrackingSaveVoAssembler.extractTracking(factory, tracking); //WDEV-20088 if (sendHL7Discharge==null) { //on Move,when setting the status to WAITING_TO_BE_SEEN_BY_A_MEDIC, mark currentSeenByAsCompleted and set SeenBy from Tracking to null Object mos = getHcpUser(); boolean matchLogedUserSeenHCP = false; if( mos instanceof MedicVo) { MedicVo medVo = ((MedicVo) mos); if( tracking.getSeenByIsNotNull()) { if( medVo.equals(tracking.getSeenBy().getAllocatedMedic())) matchLogedUserSeenHCP = true; } } else if( mos instanceof NurseVo) { NurseVo nursVo = ((NurseVo) mos); if( tracking.getSeenByIsNotNull() ) { if( nursVo.equals(tracking.getSeenBy().getAllocatedNurse())) matchLogedUserSeenHCP = true; } } if( matchLogedUserSeenHCP == true ) { SeenByHCP doSeenByHcp = doTracking.getSeenBy(); if (doSeenByHcp!=null) { doSeenByHcp.setCompletedDateTime(new Date()); factory.save(doSeenByHcp); doTracking.setSeenBy(null); } } } factory.save(doTracking); //wdev-19268 if( sendHL7Discharge != null && sendHL7Discharge.equals(Boolean.TRUE)) { EmergencyAttendanceDetailsCc tempImpl = (EmergencyAttendanceDetailsCc)getDomainImpl(EmergencyAttendanceDetailsCcImpl.class); tempImpl.triggerAttendanceDischargeEvent(tracking.getAttendance()); } //--------- return TrackingSaveVoAssembler.create(doTracking); }