@Override protected void onCmbOutcomeValueChanged() throws PresentationLogicException { form.getLocalContext().setCustomEvent(null); if (AttendanceOutcome.MORTUARY.equals(form.cmbOutcome().getValue())) { // Display confirmation dialog 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); } } // Update controls state updateControlsState(); }
private boolean isCodingRequiredForDischarge(AttendanceOutcome value) { if (value==null) return false; MandatoryEDOutcomeCodingVo mandatoryEdOutcomeCoding = domain.getMandatoryEDOutcomeCoding(); if (mandatoryEdOutcomeCoding==null || mandatoryEdOutcomeCoding.getCodingOutcomes()==null || mandatoryEdOutcomeCoding.getCodingOutcomes().size()==0 ) { return false; } if (mandatoryEdOutcomeCoding.getCodingOutcomes().contains(value)) return true; return false; }
public Boolean isCodingRequiredForDischarge(AttendanceOutcome lookup) { if (lookup == null ) return false; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select lookInst from LookupInstance as lookInst left join lookInst.mappings as mappings where (lookInst.id = "+lookup.getID() +" and mappings.extSystem = 'MAXIMS' and mappings.extCode like 'CODING%' )"); List<?> list = factory.find(hql.toString()); if (list!=null && list.size()>0) { return true; } return false; }
private void initializeOutcomeMandatoryCoding() { form.lyrED().tabOutcomeMandatoryCoding().grdMandatoryCoding().getRows().clear(); ims.emergency.vo.lookups.AttendanceOutcomeCollection lookupCollection = ims.emergency.vo.lookups.LookupHelper.getAttendanceOutcome(this.domain.getLookupService()); for(int x = 0; x < lookupCollection.size(); x++) { if (AttendanceOutcome.DID_NOT_WAIT.equals(lookupCollection.get(x))) continue; grdMandatoryCodingRow row = form.lyrED().tabOutcomeMandatoryCoding().grdMandatoryCoding().getRows().newRow(); row.setColName(lookupCollection.get(x).getText()); row.setValue(lookupCollection.get(x)); } }
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; }
@Override protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { boolean hasOutcomeDetails = false; if(form.getLocalContext().getRecord() != null && form.getLocalContext().getRecord().getAttendance() != null && form.getLocalContext().getRecord().getAttendance().getOutcome() != null && form.getLocalContext().getRecord().getAttendance().getDischargeDateTime() != null) hasOutcomeDetails = true; if (isPatientNotWeighedForUnderOneYear() && Boolean.TRUE.equals(form.chkEnterDischargeOutcome().getValue()) || isPatientNotWeighedForUnderOneYear() && hasOutcomeDetails) //WDEV-21082 form.getLocalContext().setPatientWeighedConfirm(engine.showMessage("All patients under 1 years of age must be weighed.", "Reminder:", MessageButtons.OK, MessageIcon.INFORMATION)); else { //WDEV-17337 form.getLocalContext().setCustomEvent(DischargeDetails_CustomEvents.SAVE); form.fireCustomControlValueChanged(); // If saving an instance is successful then refresh the screen if (save(null)) { open(); //wdev-19230 if( form.cmbOutcome().getValue() != null && (form.cmbOutcome().getValue().equals(AttendanceOutcome.ED_CLINIC) || form.cmbOutcome().getValue().equals(AttendanceOutcome.ADCC_CLINIC))) { engine.open(form.getForms().Scheduling.BookAppointmentDialog, new Object[] {domain.getTrackingAttendanceOutcomeVo(form.getGlobalContext().Core.getCurrentCareContext()).getAttendance()}); //WDEV-19060 } } } }
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; }
private void populateLabelsFromEmergencyAttendance() { EmergencyAttendanceForEventHistoryVo emergencyAttendance = domain.getEmergencyAttendance(form.getGlobalContext().Core.getCurrentCareContext()); if (emergencyAttendance == null) { engine.showMessage("Patient doesn't have an EmergencyAttendance, fields will not be populated"); return; } for (int i = 0; i < emergencyAttendance.getPatient().getIdentifiers().size(); i++) { if (emergencyAttendance.getPatient().getIdentifiers().get(i).getType().equals(ims.core.vo.lookups.PatIdType.HOSPNUM)) { form.lblHospitalNumber().setValue(emergencyAttendance.getPatient().getIdentifiers().get(i).getValue()); } } //WDEV-17482 form.lblPatientName().setValue(emergencyAttendance.getPatient().getName().getSurname().toUpperCase() + (emergencyAttendance.getPatient().getName().getForename() != null ? ", " + emergencyAttendance.getPatient().getName().getForename() : "")); form.lblAttendanceID().setValue(emergencyAttendance.getID_EmergencyAttendance().toString()); if (emergencyAttendance.getEpisode().getPresentingComplaintIsNotNull()) { form.lblPresentingComplaint().setValue(emergencyAttendance.getEpisode().getPresentingComplaint().getText()); } if (emergencyAttendance.getEpisode().getCategoryIsNotNull()) { form.lblPatientCategory().setValue(emergencyAttendance.getEpisode().getCategory().getText()); } if (emergencyAttendance.getEpisode().getSourceOfReferralIsNotNull()) { form.lblSourceOfReferral().setValue(emergencyAttendance.getEpisode().getSourceOfReferral().getText()); } if (emergencyAttendance.getEpisode().getInjuryDateTimeIsNotNull()) { form.lblInjuryDateTime().setValue(emergencyAttendance.getEpisode().getInjuryDateTime().toString()); } if (emergencyAttendance.getArrivalDateTimeIsNotNull()) { form.lblArrivalDateAndTime().setValue(emergencyAttendance.getArrivalDateTime().toString()); } if (emergencyAttendance.getRegistrationDateTimeIsNotNull()) { form.lblRegistrationDateAndTime().setValue(emergencyAttendance.getRegistrationDateTime().toString()); } if (emergencyAttendance.getDischargeDateTimeIsNotNull()) { form.lblDischargeDateAndTime().setValue(emergencyAttendance.getDischargeDateTime().toString()); } //WDEV-17038 if (emergencyAttendance.getDischargeDateTime()!=null && AttendanceOutcome.ADMISSIONS.equals(emergencyAttendance.getOutcome())) { AdmissionDetailForEventHistoryVo admDetails = domain.getAdmissionDetail(form.getGlobalContext().Core.getPatientShort(), emergencyAttendance.getDischargeDateTime()); form.lblWard().setVisible(admDetails!=null && admDetails.getWardIsNotNull()); form.lblWardValue().setValue(admDetails!=null && admDetails.getWardIsNotNull() ? admDetails.getWard().getName():null); } }
private TrackingAttendanceOutcomeVo populateDataToUndoDischarge(TrackingAttendanceOutcomeVo record) { TrackingAttendanceOutcomeVo recordToSave = (TrackingAttendanceOutcomeVo) record.clone(); //WDEV-17389 if (AttendanceOutcome.MORTUARY.equals(recordToSave.getAttendance().getOutcome()) || AttendanceOutcome.BID.equals(recordToSave.getAttendance().getOutcome()) || AttendanceOutcome.DOA.equals(recordToSave.getAttendance().getOutcome()) || AttendanceOutcome.DID.equals(recordToSave.getAttendance().getOutcome())) { recordToSave.getAttendance().getPatient().setDod(null); } recordToSave.getAttendance().setOutcome(null); recordToSave.getAttendance().setDestination(null); recordToSave.getAttendance().setDischargeDateTime(null); recordToSave.setReasonForBreach(null); recordToSave.getAttendance().getCareContext().setEndDateTime(null); recordToSave.setCurrentArea(form.getLocalContext().getRecord().getCurrentStatus().getPrevTrackingArea()); recordToSave.setIsDischarged(null); recordToSave.getAttendance().setDischargingHCP(null); //WDEV-17247 if (recordToSave.getCurrentDNW() != null && recordToSave.getCurrentDNW().getCurrentStatus() != null && recordToSave.getCurrentDNW().getCurrentStatus().getCalledAmount() != 0 && recordToSave.getCurrentDNW().getCurrentStatus().getCalledAmount() == ConfigFlag.DOM.AUTOMATICALLY_DISCHARGE_PATIENT_FROM_ED_ON_DNA_CALL_NUMBER.getValue()) { recordToSave.getCurrentDNW().getCurrentStatus().setCalledAmount(recordToSave.getCurrentDNW().getCurrentStatus().getCalledAmount() - 1); } recordToSave.setCurrentStatus(populateTrackingAttendanceStatus(form.getGlobalContext().Emergency.getTrackingAttendanceStatus().getStatus()));//WDEV-17408 //WDEV-17407 // if (recordToSave.getAssociatedPendingEmergencyAdmission() != null && (EmergencyAdmissionStatus.DISCHARGED.equals(recordToSave.getAssociatedPendingEmergencyAdmission().getAdmissionStatus()) || (AttendanceOutcome.DID_NOT_WAIT.equals(form.cmbOutcome().getValue()) && EmergencyAdmissionStatus.CANCELLED.equals(recordToSave.getAssociatedPendingEmergencyAdmission().getAdmissionStatus()) && form.cmbBedType().getValue()!=null)))//WDEV-17283 //WDEV-17471 //WDEV-17532 // { // recordToSave.getAssociatedPendingEmergencyAdmission().setAdmissionStatus(EmergencyAdmissionStatus.DTA); // } return recordToSave; }
private AttendanceOutcome assembleOutcomeLookupItem(LookupInstance outcome) { if(outcome == null) return null; ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (outcome.getImage() != null) { img = new ims.framework.utils.ImagePath(outcome.getImage().getImageId(), outcome.getImage().getImagePath()); } color = outcome.getColor(); if (color != null) color.getValue(); ims.emergency.vo.lookups.AttendanceOutcome voLookup = new ims.emergency.vo.lookups.AttendanceOutcome(outcome.getId(),outcome.getText(), outcome.isActive(), null, img, color); ims.emergency.vo.lookups.AttendanceOutcome parentVoLookup = voLookup; ims.domain.lookups.LookupInstance parent = outcome.getParent(); while (parent != null) { if (parent.getImage() != null) { img = new ims.framework.utils.ImagePath(parent.getImage().getImageId(), parent.getImage().getImagePath() ); } else { img = null; } color = parent.getColor(); if (color != null) color.getValue(); parentVoLookup.setParent(new ims.emergency.vo.lookups.AttendanceOutcome(parent.getId(),parent.getText(), parent.isActive(), null, img, color)); parentVoLookup = parentVoLookup.getParent(); parent = parent.getParent(); } return voLookup; }
private void populateLabelsFromEmergencyAttendance() { EmergencyAttendanceForEventHistoryVo emergencyAttendance = domain.getEmergencyAttendance(form.getGlobalContext().Core.getCurrentCareContext()); if (emergencyAttendance == null) { engine.showMessage("Patient doesn't have an EmergencyAttendance, fields will not be populated"); return; } for (int i = 0; i < emergencyAttendance.getPatient().getIdentifiers().size(); i++) { if (emergencyAttendance.getPatient().getIdentifiers().get(i).getType().equals(ims.core.vo.lookups.PatIdType.HOSPNUM)) { form.lblHospitalNumber().setValue(emergencyAttendance.getPatient().getIdentifiers().get(i).getValue()); } } //WDEV-17482 form.lblPatientName().setValue(emergencyAttendance.getPatient().getName().getSurname().toUpperCase() + (emergencyAttendance.getPatient().getName().getForename() != null ? ", " + emergencyAttendance.getPatient().getName().getForename() : "")); String emergencyAttendanceNumber = ConfigFlag.GEN.ED_USE_CUSTOM_ATTENDANCE_ID.getValue() ? emergencyAttendance.getCustomID() : emergencyAttendance.getID_EmergencyAttendance().toString(); form.lblAttendanceID().setValue(emergencyAttendanceNumber); if (emergencyAttendance.getEpisode().getPresentingComplaintIsNotNull()) { //WDEV-19159 -------------starts here String tooltip = null; String text = emergencyAttendance.getEpisode().getPresentingComplaint().getText(); if (emergencyAttendance.getEpisode().getPresentingComplaint().getText().length() > 36) { text = text.substring(0, 33) + "..."; tooltip = emergencyAttendance.getEpisode().getPresentingComplaint().getText(); } form.lblPresentingComplaint().setValue(text); form.lblPresentingComplaint().setTooltip(tooltip); //WDEV-19159 -------------starts here } if (emergencyAttendance.getEpisode().getCategoryIsNotNull()) { form.lblPatientCategory().setValue(emergencyAttendance.getEpisode().getCategory().getText()); } if (emergencyAttendance.getEpisode().getSourceOfReferralIsNotNull()) { form.lblSourceOfReferral().setValue(emergencyAttendance.getEpisode().getSourceOfReferral().getText()); } if (emergencyAttendance.getEpisode().getInjuryDateTimeIsNotNull()) { form.lblInjuryDateTime().setValue(emergencyAttendance.getEpisode().getInjuryDateTime().toString()); } if (emergencyAttendance.getArrivalDateTimeIsNotNull()) { form.lblArrivalDateAndTime().setValue(emergencyAttendance.getArrivalDateTime().toString()); } if (emergencyAttendance.getRegistrationDateTimeIsNotNull()) { form.lblRegistrationDateAndTime().setValue(emergencyAttendance.getRegistrationDateTime().toString()); } if (emergencyAttendance.getDischargeDateTimeIsNotNull()) { form.lblDischargeDateAndTime().setValue(emergencyAttendance.getDischargeDateTime().toString()); } //WDEV-17038 if (emergencyAttendance.getDischargeDateTime()!=null && AttendanceOutcome.ADMISSIONS.equals(emergencyAttendance.getOutcome())) { AdmissionDetailForEventHistoryVo admDetails = domain.getAdmissionDetail(form.getGlobalContext().Core.getPatientShort(), emergencyAttendance.getDischargeDateTime()); form.lblWard().setVisible(admDetails!=null && admDetails.getWardIsNotNull()); form.lblWardValue().setValue(admDetails!=null && admDetails.getWardIsNotNull() ? admDetails.getWard().getName():null); } }
@Override protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if (form.getForms().Emergency.ReasonForBreach.equals(formName) && DialogResult.OK.equals(result)) { if (save(form.getGlobalContext().Emergency.getReasonForBreach())) { open(); //wdev-19230 if( form.cmbOutcome().getValue() != null && (form.cmbOutcome().getValue().equals(AttendanceOutcome.ED_CLINIC) || form.cmbOutcome().getValue().equals(AttendanceOutcome.ADCC_CLINIC))) { engine.open(form.getForms().Scheduling.BookAppointmentDialog, new Object[] {domain.getTrackingAttendanceOutcomeVo(form.getGlobalContext().Core.getCurrentCareContext()).getAttendance()}); //WDEV-19060 } } } else if (form.getForms().Emergency.TrackingStatusDialog.equals(formName) && DialogResult.OK.equals(result)) { //WDEV-17408 if (DischargeDetails_CustomEvents.UNDO.equals(form.getLocalContext().getCustomEvent())) { if (save(null)) { open(); } form.getGlobalContext().Core.setDeathDetails(null); } else if (removeBed(form.getGlobalContext().Emergency.getTrackingAttendanceStatus())) open(); } //WDEV-23005 if (formName.equals(form.getForms().Clinical.DeathDetails) && DialogResult.OK.equals(result)) { if (Boolean.TRUE.equals(form.getGlobalContext().Core.getRefreshParent())) { form.getGlobalContext().Core.setPatientShort(domain.getPatientShort(form.getLocalContext().getRecord().getAttendance().getPatient())); form.dteDateOfDeath().setValue(null); form.timTimeOfDeath().setValue(null); form.getGlobalContext().Core.setRefreshParent(false); } else { form.dteDateOfDeath().setValue(form.getGlobalContext().Core.getPatientShort().getDodIsNotNull() ? form.getGlobalContext().Core.getPatientShort().getDod() : form.getGlobalContext().Core.getDeathDetails().getPatient().getDod()); form.timTimeOfDeath().setValue(form.getGlobalContext().Core.getPatientShort().getTimeOfDeathIsNotNull() ? form.getGlobalContext().Core.getPatientShort().getTimeOfDeath() : form.getGlobalContext().Core.getDeathDetails().getPatient().getTimeOfDeath()); } updateControlsState(); //WDEV-23005 - ends here } //WDEV-17337 if (!formName.equals(form.getForms().Clinical.DeathDetails) && DialogResult.OK.equals(result)) { form.getLocalContext().setCustomEvent(DischargeDetails_CustomEvents.SAVE); form.fireCustomControlValueChanged(); } }
@Override protected void onMessageBoxClosed(int messageBoxId, DialogResult result) throws PresentationLogicException //WDEV-20425 { form.getLocalContext().setCustomEvent(null); if (form.getLocalContext().getMortuaryOutcomeMessageBoxIdIsNotNull() && messageBoxId == form.getLocalContext().getMortuaryOutcomeMessageBoxId()) { if (DialogResult.NO.equals(result)) { form.cmbOutcome().setValue(null); } else { form.getGlobalContext().Core.setParentFormMode(FormMode.EDIT); engine.open(form.getForms().Clinical.DeathDetails); } form.getLocalContext().setMortuaryOutcomeMessageBoxId(null); updateControlsState(); } //WDEV-21082 else if (form.getLocalContext().getPatientWeighedConfirm() != null && messageBoxId == form.getLocalContext().getPatientWeighedConfirm()) { form.getLocalContext().setPatientWeighedConfirm(null); //WDEV-17337 form.getLocalContext().setCustomEvent(DischargeDetails_CustomEvents.SAVE); form.fireCustomControlValueChanged(); // If saving an instance is successful then refresh the screen if (save(null)) { open(); //wdev-19230 if( form.cmbOutcome().getValue() != null && (form.cmbOutcome().getValue().equals(AttendanceOutcome.ED_CLINIC) || form.cmbOutcome().getValue().equals(AttendanceOutcome.ADCC_CLINIC))) { engine.open(form.getForms().Scheduling.BookAppointmentDialog, new Object[] {domain.getTrackingAttendanceOutcomeVo(form.getGlobalContext().Core.getCurrentCareContext()).getAttendance()}); //WDEV-19060 } } } else if (form.getLocalContext().getCancelAppointmentsMessageBoxIdIsNotNull() && messageBoxId == form.getLocalContext().getCancelAppointmentsMessageBoxId()) { if (DialogResult.OK.equals(result)) { form.getLocalContext().setbCancelPatientAppointments(true); form.getLocalContext().setCustomEvent(DischargeDetails_CustomEvents.SAVE); form.fireCustomControlValueChanged(); if (save(form.getGlobalContext().Emergency.getReasonForBreach())) open(); form.getLocalContext().setCancelAppointmentsMessageBoxId(null); form.getLocalContext().setbCancelPatientAppointments(null); } } }
@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 }
private TrackingAttendanceOutcomeVo populateDataToUndoDischarge(TrackingAttendanceOutcomeVo record) { TrackingAttendanceOutcomeVo recordToSave = (TrackingAttendanceOutcomeVo) record.clone(); //WDEV-17389 //WDEV-19682 if (AttendanceOutcome.MORTUARY.equals(recordToSave.getAttendance().getOutcome()) || AttendanceOutcome.BID.equals(recordToSave.getAttendance().getOutcome()) || AttendanceOutcome.DOA.equals(recordToSave.getAttendance().getOutcome()) || AttendanceOutcome.DID.equals(recordToSave.getAttendance().getOutcome())) { recordToSave.getAttendance().getPatient().setDod(null); recordToSave.getAttendance().getPatient().setTimeOfDeath(null); } recordToSave.getAttendance().setOutcome(null); recordToSave.getAttendance().setDestination(null); recordToSave.getAttendance().setDischargeDateTime(null); recordToSave.setReasonForBreach(null); recordToSave.getAttendance().getCareContext().setEndDateTime(null); recordToSave.setCurrentArea(form.getLocalContext().getRecord().getCurrentStatus().getPrevTrackingArea()); recordToSave.setIsDischarged(null); recordToSave.getAttendance().setDischargingHCP(null); //WDEV-17247 if (recordToSave.getCurrentDNW() != null && recordToSave.getCurrentDNW().getCurrentStatus() != null && recordToSave.getCurrentDNW().getCurrentStatus().getCalledAmount() != 0 && recordToSave.getCurrentDNW().getCurrentStatus().getCalledAmount() == ConfigFlag.DOM.AUTOMATICALLY_DISCHARGE_PATIENT_FROM_ED_ON_DNA_CALL_NUMBER.getValue()) { recordToSave.getCurrentDNW().getCurrentStatus().setCalledAmount(recordToSave.getCurrentDNW().getCurrentStatus().getCalledAmount() - 1); } recordToSave.setCurrentStatus(populateTrackingAttendanceStatus(form.getGlobalContext().Emergency.getTrackingAttendanceStatus().getStatus()));//WDEV-17408 //WDEV-17407 // if (recordToSave.getAssociatedPendingEmergencyAdmission() != null && (EmergencyAdmissionStatus.DISCHARGED.equals(recordToSave.getAssociatedPendingEmergencyAdmission().getAdmissionStatus()) || (AttendanceOutcome.DID_NOT_WAIT.equals(form.cmbOutcome().getValue()) && EmergencyAdmissionStatus.CANCELLED.equals(recordToSave.getAssociatedPendingEmergencyAdmission().getAdmissionStatus()) && form.cmbBedType().getValue()!=null)))//WDEV-17283 //WDEV-17471 //WDEV-17532 // { // recordToSave.getAssociatedPendingEmergencyAdmission().setAdmissionStatus(EmergencyAdmissionStatus.DTA); // } //WDEV-19031 recordToSave.setDisplayInED(false); return recordToSave; }
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())); }