public PendingEmergencyAdmissionAdmitVo automaticDischarge(PendingEmergencyAdmissionRefVo pendingEmergencyAdmission, DateTime admissionDateTime, HcpLiteVo consultant) throws StaleObjectException { if (pendingEmergencyAdmission == null || pendingEmergencyAdmission.getID_PendingEmergencyAdmission() == null) return null; try { Class<?> emergencyHelper = Class.forName("ims.emergency.helper.EmergencyHelper"); IEmergencyHelper implEmergencyHelper = (IEmergencyHelper) getDomainImpl(emergencyHelper); return implEmergencyHelper.autoDischargeFromEmergencyTracking(pendingEmergencyAdmission, admissionDateTime, consultant); } catch (ClassNotFoundException e) { createSystemLogEntry(SystemLogType.APPLICATION, SystemLogLevel.INFORMATION, "Class 'Emergency Helper' not found when attempting to auto-discharge a PendingEmergencyAdmission form ED. This functionality might not be available in the application"); return PendingEmergencyAdmissionAdmitVoAssembler.create((PendingEmergencyAdmission) getDomainFactory().getDomainObject(PendingEmergencyAdmission.class, pendingEmergencyAdmission.getID_PendingEmergencyAdmission())); } }
private void populateScreenFromEmergencyData(PendingEmergencyAdmissionAdmitVo voPendingEmergencyAdmissionAdmit) { clearScreen(); if(voPendingEmergencyAdmissionAdmit == null) return; BedSpaceStateLiteVo voBedSpaceState = form.getGlobalContext().Core.getSelectedBedSpaceState(); if(voBedSpaceState != null) { if(voBedSpaceState.getWardIsNotNull()) { form.cmbWard().newRow(voBedSpaceState.getWard(), voBedSpaceState.getWard().toString()); form.cmbWard().setValue(voBedSpaceState.getWard()); } if(voBedSpaceState.getBedSpaceIsNotNull()) form.cmbWardType().setValue(voBedSpaceState.getBedSpace().getWardType()); } if(voPendingEmergencyAdmissionAdmit.getPasEventIsNotNull()) { form.ccConsultant().setValue(voPendingEmergencyAdmissionAdmit.getPasEvent().getConsultant()); listSpecialtiesForConsultant(); if(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("CCO")) { if(voPendingEmergencyAdmissionAdmit.getPasEvent().getPASSpecialtyIsNotNull()) { if(!form.cmbCCOSpecialty().getValues().contains(voPendingEmergencyAdmissionAdmit.getPasEvent().getPASSpecialty())) form.cmbCCOSpecialty().newRow(voPendingEmergencyAdmissionAdmit.getPasEvent().getPASSpecialty(), voPendingEmergencyAdmissionAdmit.getPasEvent().getPASSpecialty().getText()); } form.cmbCCOSpecialty().setValue(voPendingEmergencyAdmissionAdmit.getPasEvent().getPASSpecialty()); } //if conspc call did not find specialty (conspc mapping was removed) add it as a value anyway if(voPendingEmergencyAdmissionAdmit.getPasEvent().getSpecialtyIsNotNull()) { if(!form.cmbSpecialty().getValues().contains(voPendingEmergencyAdmissionAdmit.getPasEvent().getSpecialty())) form.cmbSpecialty().newRow(voPendingEmergencyAdmissionAdmit.getPasEvent().getSpecialty(), voPendingEmergencyAdmissionAdmit.getPasEvent().getSpecialty().getText()); } form.cmbSpecialty().setValue(voPendingEmergencyAdmissionAdmit.getPasEvent().getSpecialty()); } //WDEV-10076 form.cmbMethod().setValue(null); form.cmbSource().setValue(SourceOfAdmission.HOMEADDRESS); form.dtimAdmit().setValue(new DateTime()); form.chkChaplain().setValue(false); loadEpisodes(); }
private void populateEmergencyTabFromData() { form.getLocalContext().setRecordSelected(false); form.lyrAdmission().tabEmergency().grdEmergency().getRows().clear(); PendingEmergencyAdmissionAdmitVoCollection voCollEmergencyAdmission = null; BedSpaceStateLiteVo voBed = form.getGlobalContext().Core.getSelectedBedSpaceState(); if(voBed != null) { voCollEmergencyAdmission = domain.listEmergencyAdmission( voBed.getWard() ); if(voCollEmergencyAdmission == null || voCollEmergencyAdmission.size() == 0) return; } for(PendingEmergencyAdmissionAdmitVo voPendingEmergencyAdmission : voCollEmergencyAdmission) { grdEmergencyRow row = form.lyrAdmission().tabEmergency().grdEmergency().getRows().newRow(); PatientShort voPatient = (voPendingEmergencyAdmission.getPasEventIsNotNull() && voPendingEmergencyAdmission.getPasEvent().getPatientIsNotNull()) ? voPendingEmergencyAdmission.getPasEvent().getPatient() : null; if(voPatient != null) { if(voPatient.getNameIsNotNull()) { row.setColForename(voPatient.getName().getForename()); row.setColSurname(voPatient.getName().getSurname()); } PatientId patId = voPatient.getDisplayId(); row.setColDisplayId(patId != null ? patId.getValue() : null); row.setColSex(voPatient.getSexIsNotNull() ? voPatient.getSex().toString() : null); Integer age = voPatient.calculateAge(); if(age != null) row.setColAge(String.valueOf(age)); row.setColDob(voPatient.getDobIsNotNull() ? voPatient.getDob().toString() : null); if(voPatient.getAssociatedPatientIsNotNull()) //wdev-13105 row.setBackColor(ConfigFlag.UI.MERGED_COLOUR.getValue()); if(voPatient.getDodIsNotNull()) //wdev-13105 row.setBackColor(ConfigFlag.UI.RIP_COLOUR.getValue()); } row.setValue(voPendingEmergencyAdmission); } form.fireCustomControlValueChanged(); }
private void populateScreenFrom_ED_EmergencyData(PendingEmergencyAdmissionAdmitVo pendingEDAdmission) { clearScreen(); if (pendingEDAdmission == null) return; // Default ward from Pending ED Admission // Default in current ward if(form.getGlobalContext().Core.getADTWardIsNotNull()) { form.cmbWard().newRow(form.getGlobalContext().Core.getADTWard(), form.getGlobalContext().Core.getADTWard().toString()); form.cmbWard().setValue(form.getGlobalContext().Core.getADTWard()); } // Default Service from PendingEmergencyAdmission if (pendingEDAdmission != null && pendingEDAdmission.getService() != null) { form.qmbService().newRow(pendingEDAdmission.getService(), pendingEDAdmission.getService().getServiceName()); form.qmbService().setValue(pendingEDAdmission.getService()); } // Default Speciality from service of PendingEmergencyAdmission if (pendingEDAdmission != null && pendingEDAdmission.getService() != null && pendingEDAdmission.getService().getSpecialty() != null) { form.cmbSpecialty().newRow(pendingEDAdmission.getService().getSpecialty(), pendingEDAdmission.getService().getSpecialty().getText()); form.cmbSpecialty().setValue(pendingEDAdmission.getService().getSpecialty()); } // Do not default Consultant // Do not default Ward Type // Do not default Source of Admission // Default Method of Admission to 21 (Emergency) form.cmbMethod().setValue(MethodOfAdmission.EMERGENCY); // Default Patient Category to the one from patient form.cmbPatientStatus().setValue(pendingEDAdmission.getPasEvent().getPatient().getPatientCategory()); // Admit Date Time - default to current date time form.dtimAdmit().setValue(new DateTime()); // Do not default Anticipated Stay // Estimated Discharge Date Time will be calculated based on Admit DateTime + Anticipated Stay DateTime estimatedDischargeDateTime = calculateEstimateDischarge(form.dtimAdmit().getValue(), form.intAntStay().getValue()); if (!ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS")) { form.dteEstDischarge().setValue(estimatedDischargeDateTime != null ? estimatedDischargeDateTime.getDate() : null); } else { form.dtimEstDischarge().setValue(estimatedDischargeDateTime); } // Do not default chaplain // Default Source of Emergency Referral to 21 - 'Accident and Emergency' form.cmbSourceOfEmergencyReferral().setValue(SourceOfEmergencyReferral.ACCIDENT_EMERGENCY); // Do not default on Update Case Note Folder Location // Default category from patient record form.cmbPatientStatus().setValue(pendingEDAdmission != null && pendingEDAdmission.getPasEventIsNotNull() && pendingEDAdmission.getPasEvent().getPatientIsNotNull() ? pendingEDAdmission.getPasEvent().getPatient().getPatientCategory() : null); }
public Boolean saveAdmissionAndUpdateList(AdmissionDetailVo admissionDetail, WardStayVo wardStay, ConsultantStayVo consultantStay, CareSpellAdmitVo careSpell, CatsReferralEmergencyAdmissionVo referral, Object selectedAdmissionData, PatientCaseNoteTransferVoCollection caseNoteTransfers) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { // AdmissionDetail domAdmissionDetail = AdmissionDetailShortVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail); // getDomainFactory().save(domAdmissionDetail); // AdmissionDetailVo admissionDetails = AdmissionDetailVoAssembler.create(domAdmissionDetail); // admissionDetails.validate(); PendingElectiveAdmissionAdmitVo pendingBookedElectiveAdmission = selectedAdmissionData instanceof PendingElectiveAdmissionAdmitVo ? (PendingElectiveAdmissionAdmitVo) selectedAdmissionData : null; PendingEmergencyAdmissionAdmitVo pendingEDEmergency = selectedAdmissionData instanceof PendingEmergencyAdmissionAdmitVo ? (PendingEmergencyAdmissionAdmitVo) selectedAdmissionData : null; PendingElectiveAdmissionAdmitVo pendingElectiveAdmission = selectedAdmissionData instanceof PendingElectiveAdmissionAdmitVo ? (PendingElectiveAdmissionAdmitVo) selectedAdmissionData : null; CatsReferralPendingEmergencyNonEDAdmissionListVo pendingEmergencyAdmission = selectedAdmissionData instanceof CatsReferralPendingEmergencyNonEDAdmissionListVo ? (CatsReferralPendingEmergencyNonEDAdmissionListVo) selectedAdmissionData : null; PatientElectiveListBedAdmissionVo patientTCI_ElectiveList = selectedAdmissionData instanceof PatientElectiveListBedAdmissionVo ? (PatientElectiveListBedAdmissionVo) selectedAdmissionData : null; AdmissionType admissionType = AdmissionType.EMERGENCY; BedAdmissionComponent impl = (BedAdmissionComponent) getDomainImpl(BedAdmissionComponentImpl.class); if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && selectedAdmissionData instanceof PatientElectiveListBedAdmissionVo) { PatientElectiveListBedAdmissionVo electiveAdmission = impl.saveTCIAdmissionAndUpdateList(patientTCI_ElectiveList, null, wardStay, consultantStay, null, null, null, caseNoteTransfers); impl.createCaseNoteRequests(electiveAdmission); } // else if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && selectedAdmissionData instanceof PatientLite_IdentifiersVo) // { // CareSpellVo careSpell = createCareSpell((PatientLite_IdentifiersVo) selectedAdmissionData, admissionDetail.getPasEvent(), admissionDetail.getAdmissionDateTime(), admissionDetail.getConsultant(), admissionDetail.getService()); // CatsReferralEmergencyAdmissionVo catsReferral = createCatsReferral((PatientLite_IdentifiersVo) selectedAdmissionData, admissionDetail, careSpell); // // impl.saveEmergencyAdmissionInElectiveCase(admissionDetail, // Admission Detail // careSpell, // Care Spell // catsReferral, // Cats Referral // null, // Bed Space State - null when Admitting to Ward // wardStay, // Ward Stay // consultantStay, // Consultant Stay // null, // Admission Reason // null, // Ward Mixed Sex Breach // null, // Ward Bay Config // caseNoteTransfers); // Patient Case Note Transfer // } else { impl.saveAdmissionAndUpdateList(admissionDetail, // Admission Detail null, // Bed Space State - null when Admitting to Ward careSpell, referral, wardStay, // Ward Stay consultantStay, // Consultant Stay pendingBookedElectiveAdmission, // Pending Elective Admission - Planned (Booked) pendingEDEmergency, // Pending Emergency Admission - ED pendingElectiveAdmission, // Pending Elective Admission - (TCI) pendingEmergencyAdmission, // Pending Emergency Admission - Non ED admissionType, // Admission Type null, // Admission Reason null, // Ward Mixed Sex Breach null, // Ward Bay Config caseNoteTransfers); // Patient Case Note Transfer } //WDEV-21973 make sure patient has a Case Note Folder impl.createCaseNoteFolderIfNone(admissionDetail.getPasEvent().getPatient()); return true; }
public PendingEmergencyAdmissionAdmitVo automaticDischarge(PendingEmergencyAdmissionRefVo pendingEmergencyAdmission, DateTime admissionDateTime, HcpLiteVo consultant) throws StaleObjectException { BedAdmissionComponent impl = (BedAdmissionComponent) getDomainImpl(BedAdmissionComponentImpl.class); return impl.automaticDischarge(pendingEmergencyAdmission, admissionDateTime, consultant); }
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())); }
public PendingEmergencyAdmissionAdmitVo autoDischargeFromEmergencyTracking(PendingEmergencyAdmissionRefVo pendingEmergencyAdmissionRef, DateTime conclusionDateTime, HcpLiteVo consultant) throws StaleObjectException;