private void populateScreenFromData(PendingEmergencyAdmissionShortVo pendrec, BedAvailabilityForTrackVo bedAvailability) { clearControls(); if (pendrec == null) return; if (!EmergencyAdmissionStatus.CANCELLED.equals(pendrec.getAdmissionStatus())) //wdev-17254 { if (bedAvailability != null) form.ccRequestedBy().setValue(bedAvailability.getRequestedBy()); form.dtimDecisionToAdmitDate().setValue(pendrec.getDTADateTime()); form.cmbDTABedType().setValue(pendrec.getBedTypeRequested()); if (bedAvailability != null) form.dtimAvailableBedTime().setValue(bedAvailability.getAvailableDateTime()); } }
private PendingEmergencyAdmissionsDataVo populateDataFromScreen() { PendingEmergencyAdmissionsDataVo admission = new PendingEmergencyAdmissionsDataVo(); admission.setIDNumber(form.txtIDNum().getValue()); admission.setIDType(form.cmbIDType().getValue()); //WDEV-13065 -- if (form.txtIDNum().getValue() == null) admission.setHospital(form.cmbHospital().getValue()); admission.setAlert(form.cmbAlert().getValue()); admission.setAllocatedWard(form.qmbWard().getValue()); admission.setAdmissionStatus(form.cmbStatus().getValue()); if (EmergencyAdmissionStatus.ADMITTED.equals(admission.getAdmissionStatus())) admission.setHcp(form.qmbHCP().getValue()); admission.setPatientForename(form.txtForeName().getValue()); admission.setPatientSurname(form.txtSurname().getValue()); admission.setWasTimerOn(form.getLocalContext().getbTimerOn()); return admission; }
private void updateMenuOptions() { form.getContextMenus().Core.hideAllPendingEmergencyMenuItems(); boolean isCancelled = form.grdAdmissions().getValue() != null && form.grdAdmissions().getValue().getAdmissionStatusIsNotNull() && form.grdAdmissions().getValue().getAdmissionStatus().equals(EmergencyAdmissionStatus.CANCELLED); //wdev-17355 form.getContextMenus().Core.getPendingEmergencyASSIGNItem().setVisible(form.grdAdmissions().getValue() != null && !isCancelled); //wdev-17355 if(engine.hasRight(AppRight.ALLOW_ADT_PENDINGEMERGENCY_REMOVAL)) form.getContextMenus().Core.getPendingEmergencyREMOVEPATIENTFROMPENDINGEMERGENCYItem().setVisible(form.grdAdmissions().getValue() != null); }
public PendingEmergencyAdmissionAdmitVoCollection listEmergencyAdmission(LocationRefVo voLocation) { if(voLocation == null) throw new CodingRuntimeException("voLocation is null in method listEmergencyAdmission"); DomainFactory factory = getDomainFactory(); List pendingEmergencies = factory.find("from PendingEmergencyAdmission pea where pea.allocatedWard.id = :idWard and ( pea.admissionStatus = :discharged or pea.admissionStatus = :dta )", new String[]{"idWard", "discharged", "dta"}, new Object[]{voLocation.getID_Location(), getDomLookup(EmergencyAdmissionStatus.DISCHARGED), getDomLookup(EmergencyAdmissionStatus.DTA)}); return PendingEmergencyAdmissionAdmitVoAssembler.createPendingEmergencyAdmissionAdmitVoCollectionFromPendingEmergencyAdmission(pendingEmergencies); }
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; }
private void updateMenuOptions() { form.getContextMenus().Core.hideAllPendingEmergencyMenuItems(); boolean isCancelled = form.grdAdmissions().getValue() != null && form.grdAdmissions().getValue().getAdmissionStatusIsNotNull() && form.grdAdmissions().getValue().getAdmissionStatus().equals(EmergencyAdmissionStatus.CANCELLED); //wdev-17355 form.getContextMenus().Core.getPendingEmergencyASSIGNItem().setVisible(form.grdAdmissions().getValue() != null && !isCancelled); //wdev-17355 form.getContextMenus().Core.getPendingEmergencyBED_READYItem().setVisible(form.grdAdmissions().getValue() != null && !isCancelled && form.grdAdmissions().getValue().getBedTypeRequestedIsNotNull()); if(engine.hasRight(AppRight.ALLOW_ADT_PENDINGEMERGENCY_REMOVAL)) form.getContextMenus().Core.getPendingEmergencyREMOVEPATIENTFROMPENDINGEMERGENCYItem().setVisible(form.grdAdmissions().getValue() != null); }
private void cmbStatusValueChanged() { if (!EmergencyAdmissionStatus.ADMITTED.equals(form.cmbStatus().getValue())) form.qmbHCP().clear(); if (EmergencyAdmissionStatus.ADMITTED.equals(form.cmbStatus().getValue()) && form.getGlobalContext().STHK.getPendingEmergencyAdmissionsFilterIsNotNull() && EmergencyAdmissionStatus.ADMITTED.equals(form.cmbStatus().getValue()) && form.getGlobalContext().STHK.getPendingEmergencyAdmissionsFilter().getHcpIsNotNull()) { form.qmbHCP().newRow(form.getGlobalContext().STHK.getPendingEmergencyAdmissionsFilter().getHcp(),form.getGlobalContext().STHK.getPendingEmergencyAdmissionsFilter().getHcp().getIMosName()); form.qmbHCP().setValue(form.getGlobalContext().STHK.getPendingEmergencyAdmissionsFilter().getHcp()); } updateControlsState(); }
public Integer countPatientsForEDAdmissions(ims.core.resource.place.vo.LocationRefVo ward, ims.core.resource.place.vo.LocationRefVo bay) { if (ward == null || ward.getID_Location() == null) return 0; String query = "SELECT COUNT (pendEmergency.id) FROM PendingEmergencyAdmission AS pendEmergency WHERE pendEmergency.allocatedWard.id = :WARD_ID AND (pendEmergency.admissionStatus.id = :DISCHARGED_STATUS OR pendEmergency.admissionStatus.id = :DTA_STATUS)"; String[] paramNames = new String[] {"WARD_ID", "DISCHARGED_STATUS", "DTA_STATUS"}; Object[] paramValues = new Object[] {ward.getID_Location(), EmergencyAdmissionStatus.DISCHARGED.getID(), EmergencyAdmissionStatus.DTA.getID()}; return (int) getDomainFactory().countWithHQL(query, paramNames, paramValues); }
public TrackingForPendingEmergencyAdmitVoCollection listPendingEDEmergencyAdmission(LocationRefVo ward, LocationRefVo bay) { if (ward == null || ward.getID_Location() == null) return null; StringBuilder query = new StringBuilder("SELECT tracking FROM Tracking AS tracking "); query.append(" LEFT JOIN tracking.associatedPendingEmergencyAdmission AS pendEmergency "); query.append(" LEFT JOIN pendEmergency.pasEvent AS pas LEFT JOIN pas.patient AS patient "); query.append(" WHERE pendEmergency.allocatedWard.id = :WARD_ID "); query.append(" AND (pendEmergency.admissionStatus.id = :DISCHARGE_STATUS OR pendEmergency.admissionStatus.id = :DTA_STATUS)"); query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("WARD_ID"); paramValues.add(ward.getID_Location()); paramNames.add("DISCHARGE_STATUS"); paramValues.add(EmergencyAdmissionStatus.DISCHARGED.getID()); paramNames.add("DTA_STATUS"); paramValues.add(EmergencyAdmissionStatus.DTA.getID()); //WDEV-21119 List<?> results = getDomainFactory().find(query.toString(), paramNames, paramValues); if (results == null || results.isEmpty()) return null; TrackingForPendingEmergencyAdmitVoCollection recordsList = TrackingForPendingEmergencyAdmitVoAssembler.createTrackingForPendingEmergencyAdmitVoCollectionFromTracking(results); for (TrackingForPendingEmergencyAdmitVo item :recordsList) { item.setLOS(item.getIntLengthOfStay()); } //WDEV-21119 -- end of return recordsList; }
public TrackingForPendingEmergencyAdmitVoCollection listEmergencyAdmission(LocationRefVo ward) { if(ward == null) throw new CodingRuntimeException("voLocation is null in method listEmergencyAdmission"); DomainFactory factory = getDomainFactory(); // Old query for comparison // List pendingEmergencies = factory.find("from PendingEmergencyAdmission pea where pea.allocatedWard.id = :idWard and ( pea.admissionStatus = :discharged or pea.admissionStatus = :dta )", new String[]{"idWard", "discharged", "dta"}, new Object[]{voLocation.getID_Location(), getDomLookup(EmergencyAdmissionStatus.DISCHARGED), getDomLookup(EmergencyAdmissionStatus.DTA)}); StringBuilder query = new StringBuilder("SELECT tracking FROM Tracking AS tracking "); query.append(" LEFT JOIN tracking.associatedPendingEmergencyAdmission AS pendEmergency "); query.append(" LEFT JOIN pendEmergency.pasEvent AS pas LEFT JOIN pas.patient AS patient "); query.append(" WHERE pendEmergency.allocatedWard.id = :WARD_ID "); query.append(" AND (pendEmergency.admissionStatus.id = :DISCHARGE_STATUS OR pendEmergency.admissionStatus.id = :DTA_STATUS)"); query.append(" ORDER BY patient.name.upperSurname, patient.name.upperForename"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("WARD_ID"); paramValues.add(ward.getID_Location()); paramNames.add("DISCHARGE_STATUS"); paramValues.add(EmergencyAdmissionStatus.DISCHARGED.getID()); paramNames.add("DTA_STATUS"); paramValues.add(EmergencyAdmissionStatus.DTA.getID()); //WDEV-21119 List<?> results = factory.find(query.toString(), paramNames, paramValues); if (results == null || results.isEmpty()) return null; TrackingForPendingEmergencyAdmitVoCollection recordsList = TrackingForPendingEmergencyAdmitVoAssembler.createTrackingForPendingEmergencyAdmitVoCollectionFromTracking(results); for (TrackingForPendingEmergencyAdmitVo item :recordsList) { item.setLOS(item.getIntLengthOfStay()); } return recordsList; }
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; }
/** * Function used to populate data to instance controls */ private void populateInstanceControls(TrackingAttendanceOutcomeVo record) { // Clear instance controls clearInstanceControls(); // Populate Date of Death from patient form.dteDateOfDeath().setValue(form.getGlobalContext().Core.getPatientShort() != null ? form.getGlobalContext().Core.getPatientShort().getDod() : null); // Check record parameter if (record == null) return; // Populate instance controls with data from record form.cmbCategory().setValue(record.getAttendance().getEmergencyEpisode().getCategory()); // Populate conclusion date time for attendance form.dtimConclusion().setValue(record.getAttendance().getConclusionDateTime()); // Populate Decision to Admit details if (record.getBedAvailability() != null && record.getBedAvailability().getRequestedBy() != null) form.lblRequestedBy().setValue(record.getBedAvailability().getRequestedBy().toString()); if (record.getAssociatedPendingEmergencyAdmission() != null && !EmergencyAdmissionStatus.CANCELLED.equals(record.getAssociatedPendingEmergencyAdmission().getAdmissionStatus())) { if (record.getAssociatedPendingEmergencyAdmission().getDTADateTime() != null) form.lblDecisionToAdmit().setValue(record.getAssociatedPendingEmergencyAdmission().getDTADateTime().toString()); if (record.getAssociatedPendingEmergencyAdmission().getBedTypeRequested() != null) form.lblBedType().setValue(record.getAssociatedPendingEmergencyAdmission().getBedTypeRequested().getText()); } if (record.getBedAvailability() != null && record.getBedAvailability().getAvailableDateTime() != null) form.lblAvailableBedTime().setValue(record.getBedAvailability().getAvailableDateTime().toString()); if (record.getAttendance().getOutcome() != null) { form.cmbOutcome().setValue(record.getAttendance().getOutcome()); form.txtDestination().setValue(record.getAttendance().getDestination()); form.dteDateOfDeath().setValue(record.getAttendance().getPatient().getDod()); form.dtimDischargeTime().setValue(record.getAttendance().getDischargeDateTime()); } form.ccAuthoring().setValue(record.getAttendance().getDischargingHCP()); }
private void updateControlsState() { form.lblConsultant().setVisible(EmergencyAdmissionStatus.ADMITTED.equals(form.cmbStatus().getValue())); form.qmbHCP().setVisible(EmergencyAdmissionStatus.ADMITTED.equals(form.cmbStatus().getValue())); updateMenuOptions(); }
@Override protected void onCmbOutcomeValueChanged() throws PresentationLogicException { form.getLocalContext().setCustomEvent(null); if (AttendanceOutcome.MORTUARY.equals(form.cmbOutcome().getValue())) { // Display confirmation dialog form.getLocalContext().setMortuaryOutcomeMessageBoxId(engine.showMessage("Are you sure you wish to select Mortuary?", "Warning", MessageButtons.YESNO)); return; } if (! (AttendanceOutcome.MORTUARY.equals(form.cmbOutcome().getValue()) || AttendanceOutcome.BID.equals(form.cmbOutcome().getValue()) || AttendanceOutcome.DOA.equals(form.cmbOutcome().getValue()) || AttendanceOutcome.DID.equals(form.cmbOutcome().getValue()))) { if (form.getLocalContext().getRecord().getAttendance().getPatient().getDod() == null) { form.dteDateOfDeath().setValue(null); form.getGlobalContext().Core.getPatientShort().setDod(null); } if (form.getLocalContext().getRecord().getAttendance().getPatient().getTimeOfDeath() == null) { form.timTimeOfDeath().setValue(null); form.getGlobalContext().Core.getPatientShort().setTimeOfDeath(null); } form.getGlobalContext().Core.setDeathDetails(null); } else if (AttendanceOutcome.BID.equals(form.cmbOutcome().getValue()) || AttendanceOutcome.DOA.equals(form.cmbOutcome().getValue()) || AttendanceOutcome.DID.equals(form.cmbOutcome().getValue())) { form.getGlobalContext().Core.setParentFormMode(form.getMode()); engine.open(form.getForms().Clinical.DeathDetails); } //WDEV-19242 TrackingAttendanceOutcomeVo record = form.getLocalContext().getRecord(); boolean showBedRequestMessage = record != null && (!record.getAssociatedPendingEmergencyAdmissionIsNotNull() || ( record.getAssociatedPendingEmergencyAdmissionIsNotNull() && EmergencyAdmissionStatus.CANCELLED.equals(record.getAssociatedPendingEmergencyAdmission().getAdmissionStatus())))&& AttendanceOutcome.ADMISSIONS.equals(form.cmbOutcome().getValue()); boolean pendingDischare = ConfigFlag.GEN.ED_DTA_ADMISSION_FUNCTIONALITY.getValue().equals("PENDING"); if (pendingDischare && showBedRequestMessage) engine.showMessage("This patient cannot be departed until the Bed Request is completed for the attendance."); //WDEV-19060 if (AttendanceOutcome.ADCC_CLINIC.equals(form.cmbOutcome().getValue())) { engine.open(form.getForms().Emergency.EDClinicDetails, new Object[] {form.getMode()}); } // Update controls state updateControlsState(); }
/** * Function used to populate data to instance controls */ private void populateInstanceControls(TrackingAttendanceOutcomeVo record) //WDEV-19375 { // Clear instance controls clearInstanceControls(); // Populate Date of Death from patient form.dteDateOfDeath().setValue(form.getGlobalContext().Core.getPatientShort() != null ? form.getGlobalContext().Core.getPatientShort().getDod() : null); form.timTimeOfDeath().setValue(form.getGlobalContext().Core.getPatientShort() != null ? form.getGlobalContext().Core.getPatientShort().getTimeOfDeath() : null); // Check record parameter if (record == null) return; // Populate instance controls with data from record form.cmbCategory().setValue(record.getAttendance().getEmergencyEpisode().getCategory()); // Populate conclusion date time for attendance form.dtimConclusion().setValue(record.getAttendance().getConclusionDateTime()); // Populate Decision to Admit details //WDEV-19059 if (ConfigFlag.GEN.ED_DTA_ADMISSION_FUNCTIONALITY.getValue().equals("PENDING")) { if (record.getBedAvailability() != null && record.getBedAvailability().getRequestedBy() != null) form.lblRequestedBy().setValue(record.getBedAvailability().getRequestedBy().toString()); if (record.getAssociatedPendingEmergencyAdmission() != null && !EmergencyAdmissionStatus.CANCELLED.equals(record.getAssociatedPendingEmergencyAdmission().getAdmissionStatus())) { if (record.getAssociatedPendingEmergencyAdmission().getDTADateTime() != null) form.lblDecisionToAdmit().setValue(record.getAssociatedPendingEmergencyAdmission().getDTADateTime().toString()); if (record.getAssociatedPendingEmergencyAdmission().getBedTypeRequested() != null) form.lblBedType().setValue(record.getAssociatedPendingEmergencyAdmission().getBedTypeRequested().getText()); } if (record.getBedAvailability() != null && record.getBedAvailability().getAvailableDateTime() != null) form.lblAvailableBedTime().setValue(record.getBedAvailability().getAvailableDateTime().toString()); } else if (ConfigFlag.GEN.ED_DTA_ADMISSION_FUNCTIONALITY.getValue().equals("PARTIAL") && record.getCurrentPartialAdmissionIsNotNull()) { EDPartialAdmissionForDischargeDetailOutcomeVo currentpartialAdmission = record.getCurrentPartialAdmission(); form.lblDecisionToAdmit().setValue(currentpartialAdmission.getDecisionToAdmitDateTime().toString()); form.lblRequestedBy().setValue(currentpartialAdmission.getAuthoringInfo()!=null && currentpartialAdmission.getAuthoringInfo().getAuthoringHcpIsNotNull() ? currentpartialAdmission.getAuthoringInfo().getAuthoringHcp().getIHcpName() : ""); form.lblBedType().setValue(currentpartialAdmission.getAccomodationRequestedTypeIsNotNull() ? currentpartialAdmission.getAccomodationRequestedType().getText() : ""); //WDEV-17661 form.lblAvailableBedTime().setValue(currentpartialAdmission.getAllocatedDateTimeIsNotNull()? currentpartialAdmission.getAllocatedDateTime().toString() : ""); } if (record.getAttendance().getOutcome() != null || record.getAttendance().getDischargeDateTime() != null) //WDEV-19031 { form.cmbOutcome().setValue(record.getAttendance().getOutcome()); form.txtDestination().setValue(record.getAttendance().getDestination()); form.dteDateOfDeath().setValue(record.getAttendance().getPatient().getDod()); form.timTimeOfDeath().setValue(record.getAttendance().getPatient().getTimeOfDeath()); form.dtimDischargeTime().setValue(record.getAttendance().getDischargeDateTime()); //WDEV-19059 form.txtOtherOutcome().setValue(record.getAttendance().getAttendanceOutcomeComment()); form.cmbGPLetterStatus().setValue(record.getAttendance().getGPLetterStatus()); } form.ccAuthoring().setValue(record.getAttendance().getDischargingHCP()); form.getGlobalContext().Emergency.setEDClinicDetails(AttendanceOutcome.ADCC_CLINIC.equals(form.cmbOutcome().getValue()) ? record.getAttendance().getEDClinicDetails() : null); //WDEV-19060 }
public PendingEmergencyAdmissionAdmitVo autoDischargeFromEmergencyTracking(PendingEmergencyAdmissionRefVo pendingEmergencyAdmissionRef, DateTime conclusionDateTime, HcpLiteVo consultant) throws StaleObjectException { if (pendingEmergencyAdmissionRef == null || pendingEmergencyAdmissionRef.getID_PendingEmergencyAdmission() == null) throw new CodingRuntimeException("Invalid parameter: PendingEmergencyAdmission record cannot be null."); DomainFactory factory = getDomainFactory(); // Get Tracking record StringBuilder queryTracking = new StringBuilder("SELECT tracking "); queryTracking.append(" FROM Tracking AS tracking "); queryTracking.append(" LEFT JOIN tracking.associatedPendingEmergencyAdmission AS emergency "); queryTracking.append(" WHERE emergency.id = :ER_ADMISSION_ID "); Tracking doTracking = (Tracking) factory.findFirst(queryTracking.toString(), "ER_ADMISSION_ID", pendingEmergencyAdmissionRef.getID_PendingEmergencyAdmission()); TrackingAttendanceOutcomeVo tracking = TrackingAttendanceOutcomeVoAssembler.create(doTracking); // Set the Conclusion and Outcome details tracking.getAttendance().setConclusionDateTime(conclusionDateTime); tracking.getAttendance().setOutcome(AttendanceOutcome.ADMISSIONS); tracking.getAttendance().setDischargeDateTime(conclusionDateTime); AuthoringInformationVo discharghingAuthoringInformation = new AuthoringInformationVo(); discharghingAuthoringInformation.setAuthoringDateTime(conclusionDateTime); discharghingAuthoringInformation.setAuthoringHcp(consultant); tracking.getAttendance().setDischargingHCP(discharghingAuthoringInformation); // Set tracking status // Create new current status (Decision To Admit) for tracking TrackingAttendanceStatusVo newStatus = new TrackingAttendanceStatusVo(); newStatus.setPatient(new PatientRefVo(doTracking.getPatient().getId(), doTracking.getPatient().getVersion())); newStatus.setEpisode(new EpisodeOfCareRefVo(doTracking.getEpisode().getEpisodeOfCare().getId(), doTracking.getEpisode().getEpisodeOfCare().getVersion())); newStatus.setAttendance(new CareContextRefVo(doTracking.getAttendance().getCareContext().getId(), doTracking.getAttendance().getCareContext().getVersion())); if (doTracking.getCurrentArea() != null) newStatus.setTrackingArea(new TrackingAreaRefVo(doTracking.getCurrentArea().getId(), doTracking.getCurrentArea().getVersion())); newStatus.setStatusDatetime(new DateTime()); newStatus.setCreatedBy((MemberOfStaffRefVo) getMosUser()); newStatus.setStatus(TrackingStatus.DISCHARGED); newStatus.setPrevStatus((tracking != null && tracking.getCurrentStatus() != null) ? tracking.getCurrentStatus().getStatus() : null); newStatus.setPrevTrackingArea((tracking != null && tracking.getCurrentStatus() != null) ? tracking.getCurrentStatus().getTrackingArea() : null); tracking.setCurrentStatus(newStatus); // Set the status of the associated PendingEmergencyAddmision if (tracking.getAssociatedPendingEmergencyAdmission() != null && EmergencyAdmissionStatus.DTA.equals(tracking.getAssociatedPendingEmergencyAdmission().getAdmissionStatus())) { tracking.getAssociatedPendingEmergencyAdmission().setAdmissionStatus(EmergencyAdmissionStatus.DISCHARGED); tracking.getAssociatedPendingEmergencyAdmission().setConclusionDate(conclusionDateTime); } tracking.setRequiringDischargeDocumentationReview(true); // Set Discharging data tracking.setIsDischarged(Boolean.TRUE); tracking.setCurrentArea(null); tracking.getAttendance().getCareContext().setEndDateTime(conclusionDateTime); // Save Tracking record doTracking = TrackingAttendanceOutcomeVoAssembler.extractTracking(getDomainFactory(), tracking); factory.save(doTracking); // Return updated PendingEmergencyAdmission return PendingEmergencyAdmissionAdmitVoAssembler.create((PendingEmergencyAdmission) factory.getDomainObject(PendingEmergencyAdmission.class, pendingEmergencyAdmissionRef.getID_PendingEmergencyAdmission())); }