private RTTClockImpactSource getClockImpactSource(PatientElectiveListAddLaterVo record) { if (record == null) throw new CodingRuntimeException("Cannot determine the source of impact."); if (ElectiveAdmissionType.BOOKED_TYPE12.equals(record.getElectiveAdmissionType()) || ElectiveAdmissionType.ELECTIVE_TYPE11.equals(record.getElectiveAdmissionType())) { if (ElectiveListReason.TREATMENT.equals(record.getElectiveListReason())) return RTTClockImpactSource.ADD_WAITING_LIST_TREATMENT; if (ElectiveListReason.DIAGNOSTIC.equals(record.getElectiveListReason())) return RTTClockImpactSource.ADD_WAITING_LIST_DIAGNOSTIC; } else if (ElectiveAdmissionType.PLANNED_TYPE13.equals(record.getElectiveAdmissionType())) { if (ElectiveListReason.TREATMENT.equals(record.getElectiveListReason())) return RTTClockImpactSource.ADD_PLANNED_SURVEILLANCE_LIST_TREATMENT; if (ElectiveListReason.DIAGNOSTIC.equals(record.getElectiveListReason())) return RTTClockImpactSource.ADD_PLANNED_SURVEILLANCE_LIST_DIAGNOSTIC; } throw new CodingRuntimeException("Cannot determine the source of impact."); }
private void bindElectiveListReason(Boolean hasNonDiagnosticPEL) { if(Boolean.TRUE.equals(hasNonDiagnosticPEL) && form.cmbElectiveListReason().getValues().size() > 0) { for(int i = form.cmbElectiveListReason().getValues().size() - 1; i >= 0; i--) { if(!(form.cmbElectiveListReason().getValues().get(i) instanceof ElectiveListReason)) continue; if(ElectiveListReason.DIAGNOSTIC.equals(form.cmbElectiveListReason().getValues().get(i))) continue; form.cmbElectiveListReason().removeRow((ElectiveListReason) form.cmbElectiveListReason().getValues().get(i)); } } if(form.cmbElectiveListReason().getValues().size() == 1) { form.cmbElectiveListReason().setValue((ElectiveListReason) form.cmbElectiveListReason().getValues().get(0)); } }
@Override protected void onCcRespHCPValueChanged() throws PresentationLogicException { if (form.getLocalContext().getPatientElectiveList() == null && form.cmbElectiveListReason().getValue() != null && !ElectiveListReason.DIAGNOSTIC.equals(form.cmbElectiveListReason().getValue())) { populateElectiveListCombo(false); } }
@Override protected void onCmbElectiveListReasonValueChanged() throws PresentationLogicException { form.chkExtendedSearch().setValue(false); if (form.cmbElectiveListReason().getValue() != null) populateElectiveListCombo(ElectiveListReason.DIAGNOSTIC.equals(form.cmbElectiveListReason().getValue()) ? true : false); else form.cmbElectiveList().clear(); updateControlsState(); }
@Override protected void onCmbElectiveListReasonValueChanged() throws PresentationLogicException { if (!Boolean.TRUE.equals(form.getLocalContext().getElectiveListConfigurationWasSelectedFromDialog()) && form.getLocalContext().getPatientElectiveListIsNotNull() && !ElectiveListReason.DIAGNOSTIC.equals(form.getLocalContext().getPatientElectiveList().getElectiveListReason()) && form.cmbElectiveListReason().getValue()!=null && ElectiveListReason.DIAGNOSTIC.equals(form.cmbElectiveListReason().getValue())) { openDialog(); } else if (!Boolean.TRUE.equals(form.getLocalContext().getElectiveListConfigurationWasSelectedFromDialog()) && (form.getLocalContext().getPatientElectiveList()==null || (form.getLocalContext().getPatientElectiveListIsNotNull() && ElectiveListReason.DIAGNOSTIC.equals(form.getLocalContext().getPatientElectiveList().getElectiveListReason()))) && form.cmbElectiveListReason().getValue()!=null && !ElectiveListReason.DIAGNOSTIC.equals(form.cmbElectiveListReason().getValue()) ) { openDialog(); } updateControlState(); }
private ReferralERODDetailsVo populateERODFromScreen(ReferralERODDetailsVo erodDetails) { if(erodDetails == null) { erodDetails = new ReferralERODDetailsVo(); if(form.getLocalContext().getPatientElectiveList() != null) { if (ElectiveListReason.DIAGNOSTIC.equals(form.getLocalContext().getPatientElectiveList().getElectiveListReason())) erodDetails.setERODType(ERODType.DIAGNOSTIC); else erodDetails.setERODType(ERODType.ELECTIVE); } } else { erodDetails = (ReferralERODDetailsVo) erodDetails.clone(); } erodDetails.setERODDate1(form.ctnDetails().dteEarliestDateOffered().getValue()); erodDetails.setERODDate2(form.ctnDetails().dteSecondDateOffered().getValue()); erodDetails.setPatAvailFromDate(form.ctnDetails().dtePatientAvailableFromDate().getValue()); erodDetails.setPathWayClock((form.getLocalContext().getPatientElectiveList() != null && form.getLocalContext().getPatientElectiveList().getReferral() != null && form.getLocalContext().getPatientElectiveList().getReferral().getJourneyIsNotNull()) ? form.getLocalContext().getPatientElectiveList().getReferral().getJourney().getCurrentClock():null); erodDetails.setIsActive(Boolean.TRUE); erodDetails.setERODReason(form.ctnDetails().cmbERODReason().getValue()); erodDetails.setERODReasonComment(form.ctnDetails().txtERODComment().getValue()); erodDetails.setIsExtendedDelay(form.ctnDetails().chkEXTDelay().getValue()); erodDetails.setDateOfOffer(form.ctnDetails().dteERODDateOfOffer().getValue()); return erodDetails; }
public Boolean hasNonDiagnosticPatientElectiveListforReferral(CatsReferralRefVo catsReferral) { if(catsReferral == null || catsReferral.getID_CatsReferral() == null) return false; DomainFactory factory = getDomainFactory(); String query = "select count(pel.id) from PatientElectiveList as pel left join pel.electiveListStatus as els left join els.electiveListStatus as status left join pel.referral as cats left join pel.electiveListReason as pelr where cats.id = :CatsReferral and pelr.id not in (" + ElectiveListReason.DIAGNOSTIC.getID() + ") and status.id not in (" + WaitingListStatus.REMOVED.getID() + ")"; Object[] count = factory.find(query, new String[] {"CatsReferral"}, new Object[] {catsReferral.getID_CatsReferral()}).toArray(); if(count != null && count.length > 0) return ((Long) count[0]).intValue() > 0; return false; }
private void rttControlsInitialise() { form.getLocalContext().setRtpStat(null); form.getLocalContext().setPlBlk(null); if (form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisodeIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEventIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEvent().getPatientIsNotNull()) { //retrieve 2 values from Inpat String[] arrDtoVals = domain.getRtpStatAndPlBlk(form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEvent().getPatient().getDisplayId()); if (arrDtoVals != null) { form.getLocalContext().setRtpStat(arrDtoVals[0] == "" ? null : arrDtoVals[0]); form.getLocalContext().setPlBlk(arrDtoVals[1] == "" ? null : arrDtoVals[1]); } } form.lyrDetail().tabDischarge().lblTreatment().setVisible(false); form.lyrDetail().tabDischarge().grpTreatmentPostponed().setVisible(false); form.lyrDetail().tabDischarge().txtTreatDeferr().setVisible(false); // WDEV-13666 form.lyrDetail().tabDischarge().lblReason().setVisible(false); form.lyrDetail().tabDischarge().cmbReason().setVisible(false); if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) || (form.getLocalContext().getRtpStatIsNotNull() && (form.getLocalContext().getRtpStat().equals(TREATMENT) || form.getLocalContext().getRtpStat().equals(DIAGNOSTIC)))) { form.lyrDetail().tabDischarge().lblTreatment().setVisible(true); // WDEV-18617 if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode() != null) { PatientElectiveListBedAdmissionVo patEle = domain.getPatientElectiveListForDischarge(form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEvent()); if (patEle != null && patEle.getElectiveListReasonIsNotNull() && patEle.getElectiveListReason().getId() == ElectiveListReason.DIAGNOSTIC.getId()) { form.lyrDetail().tabDischarge().lblTreatment().setValue("Was the Patient Treated?"); } else { form.lyrDetail().tabDischarge().lblTreatment().setValue("Was Treatment Deferred?"); } } form.lyrDetail().tabDischarge().grpTreatmentPostponed().setVisible(true); form.lyrDetail().tabDischarge().txtTreatDeferr().setVisible(true); // WDEV-13666 form.lyrDetail().tabDischarge().lblReason().setVisible(true); form.lyrDetail().tabDischarge().cmbReason().setVisible(true); form.lyrDetail().tabDischarge().cmbReason().setEnabled(false); } form.lyrDetail().tabDischarge().lblRunning().setVisible(false); form.lyrDetail().tabDischarge().grp18Running().setVisible(false); form.lyrDetail().tabDischarge().txt18WeekRun().setVisible(false); // WDEV-13666 form.lyrDetail().tabDischarge().lblStopped().setVisible(false); form.lyrDetail().tabDischarge().grp18Stopped().setVisible(false); form.lyrDetail().tabDischarge().txt18WeekStop().setVisible(false); // WDEV-13666 if (form.getLocalContext().getRtpStat() != null) { if (form.getLocalContext().getRtpStat().equals(DIAGNOSTIC)) { form.lyrDetail().tabDischarge().lblRunning().setVisible(true); form.lyrDetail().tabDischarge().grp18Running().setVisible(true); form.lyrDetail().tabDischarge().txt18WeekRun().setVisible(true); // WDEV-13666 } } }
@Override protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { if (form.getGlobalContext().RefMan.getTheatreBookingAppointmentIsNotNull()) { Booking_AppointmentVo voBooking = domain.getBookingAppt(form.getGlobalContext().RefMan.getTheatreBookingAppointment()); form.getLocalContext().setTheatreBooking(voBooking); //WDEV-18008 if(form.getLocalContext().getInpatienEpisode() == null)//WDEV-13307 { if ( ! domain.isNotACurrentInpatient(form.getGlobalContext().Core.getPatientShort()) || (voBooking.getApptStatusIsNotNull() && !voBooking.getApptStatus().equals(Status_Reason.BOOKED)) ) { engine.showMessage("The Patient is already Admitted or the status of the Booking has changed. Close this dialog and refer to the Theatre list again."); return; } } else//WDEV-13307 { if (domain.isNotACurrentInpatient(form.getGlobalContext().Core.getPatientShort()) || (voBooking.getApptStatusIsNotNull() && !voBooking.getApptStatus().equals(Status_Reason.BOOKED)) ) { engine.showMessage("The Patient is no longer an Inpatient or the status of the Booking has changed. Close this dialog and refer to the Theatre list again."); return; } } } PatientElectiveListBedAdmissionVo patientElectiveList = null; if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue())) { // Get current Patient Elective List patientElectiveList = domain.getPatientElectiveListForAppointment(form.getGlobalContext().RefMan.getTheatreBookingAppointment()); if (patientElectiveList != null) { // If there are no other elective list to be cancelled TCIOutcomeForPatientElectiveListVo outcome = new TCIOutcomeForPatientElectiveListVo(); if (ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason())) outcome.setOutcome(AdmissionOfferOutcome.PATIENT_ADMITTED); else outcome.setOutcome(AdmissionOfferOutcome.PATIENT_ADMITTED_COMMENCED_8); outcome.setChangeBy((MemberOfStaffRefVo) domain.getMosUser()); outcome.setStatusDateTime(new DateTime()); outcome.setOutcomeReason(null); patientElectiveList.getTCIDetails().setCurrentOutcome(outcome); patientElectiveList.getTCIDetails().getOutcomeHistory().add(outcome); patientElectiveList.getTCIDetails().setIsActive(Boolean.FALSE); if (!ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason())) { if (patientElectiveList.getPathwayClock() != null) patientElectiveList.getPathwayClock().setStopDate(form.dtimAdm().getValue() != null ? form.dtimAdm().getValue().getDate() : null); } if (Specialty.EMERGENCY.equals(form.cmbSpecialty().getValue())) { // Check for existing Patient Elective list if (Boolean.TRUE.equals(domain.hasPatientElectiveListsToBeCancelled(form.getGlobalContext().Core.getPatientShort(), patientElectiveList, patientElectiveList.getElectiveList().getService()))) { form.getLocalContext().setPatientElectiveList(patientElectiveList); engine.showMessage("Patient has other Patient Elective records for the same service. Cancel these records?", "Warning", MessageButtons.YESNOCANCEL); return; } } } } if (saveAdmission(patientElectiveList, null)) engine.close(DialogResult.OK); }
@Override protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { PatientElectiveListBedAdmissionVo patientElectiveList = null; if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue())) { // Get current Patient Elective List patientElectiveList = domain.getPatientElectiveListForAppointment(form.getGlobalContext().Scheduling.getBookingAppointmentRef()); if (patientElectiveList != null) { if (Specialty.EMERGENCY.equals(form.cmbSpecialty().getValue())) { // If there are no other elective list to be cancelled TCIOutcomeForPatientElectiveListVo outcome = new TCIOutcomeForPatientElectiveListVo(); if (ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason())) outcome.setOutcome(AdmissionOfferOutcome.PATIENT_ADMITTED); else outcome.setOutcome(AdmissionOfferOutcome.PATIENT_ADMITTED_COMMENCED_8); outcome.setChangeBy((MemberOfStaffRefVo) domain.getMosUser()); outcome.setStatusDateTime(new DateTime()); outcome.setOutcomeReason(null); patientElectiveList.getTCIDetails().setCurrentOutcome(outcome); patientElectiveList.getTCIDetails().getOutcomeHistory().add(outcome); patientElectiveList.getTCIDetails().setIsActive(Boolean.FALSE); if (ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason())) { if (patientElectiveList.getPathwayClock() != null) patientElectiveList.getPathwayClock().setStopDate(form.dtimAdmDateTime().getValue() != null ? form.dtimAdmDateTime().getValue().getDate() : null); } // Check for existing Patient Elective list if (Boolean.TRUE.equals(domain.hasPatientElectiveListsToBeCancelled(form.getGlobalContext().Core.getPatientShort(), patientElectiveList, patientElectiveList.getElectiveList().getService()))) { form.getLocalContext().setPatientElectiveList(patientElectiveList); engine.showMessage("Patient has other Patient Elective records for the same service. Cancel these records?", "Warning", MessageButtons.YESNOCANCEL); return; } } } } if (saveAdmission(patientElectiveList, null)) engine.close(DialogResult.OK); }
public PatientElectiveListVo getPatientElectiveListsOnFormOpen(CatsReferralRefVo catsRef, ServiceRefVo serviceRef, String listIdHcp, Boolean nonDiagnosticELE, CatsReferralForNewElectivListEntryVo catsReferralWithPathwayClock) { ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer hqlConditions = new StringBuffer(); String andStr = " and "; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select pEL from PatientElectiveList as pEL left join pEL.electiveList as eL left join eL.service as service left join eL.hCPs as listOwners left join pEL.electiveListStatus as pELStatus left join pELStatus.electiveListStatus as status left join pEL.pathwayClock as pathClock "); if (catsRef!=null) { hqlConditions.append(andStr); hqlConditions.append(" pEL.referral.id = :CatsID "); markers.add("CatsID"); values.add(catsRef.getID_CatsReferral()); andStr = " and "; } if (serviceRef!=null) { hqlConditions.append(andStr); hqlConditions.append(" service.id=:Service "); markers.add("Service"); values.add(serviceRef.getID_Service()); andStr = " and "; } if (listIdHcp!=null && listIdHcp.length()>0) { hqlConditions.append(andStr); hqlConditions.append(" ( listOwners.hCP.id in "+ listIdHcp +" ) "); andStr = " and "; } if (nonDiagnosticELE) { hqlConditions.append(andStr); hqlConditions.append(" pEL.electiveListReason.id not in ("+ ElectiveListReason.DIAGNOSTIC.getID() +" ) "); andStr = " and "; } if (catsReferralWithPathwayClock != null && catsReferralWithPathwayClock.getJourney() != null && catsReferralWithPathwayClock.getJourney().getCurrentClock() != null) { hqlConditions.append(andStr); hqlConditions.append(" pathClock.id = :Clock "); markers.add("Clock"); values.add(catsReferralWithPathwayClock.getJourney().getCurrentClock().getID_PathwayClock()); andStr = " and "; } hqlConditions.insert(0, " where ( status.id not in (" + WaitingListStatus.REMOVED.getID() + ")"); hqlConditions.append(" ) "); List <?> list = factory.find(hql.toString() + hqlConditions.toString(),markers,values); if (list == null || list.size() == 0) return null; return PatientElectiveListVoAssembler.create((PatientElectiveList) (list.get(0))); }
private void rttControlsInitialise() { form.getLocalContext().setRtpStat(null); form.getLocalContext().setPlBlk(null); form.lyrDetail().tabDischarge().grpDeferred().setValue(grpDeferredEnumeration.None); form.lyrDetail().tabDischarge().grpPatientTreated().setValue(grpPatientTreatedEnumeration.None); if ((form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisodeIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEventIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEvent().getPatientIsNotNull()) || (form.getGlobalContext().Core.getSelectedWaitingAreaPatientIsNotNull() && form.getGlobalContext().Core.getSelectedWaitingAreaPatient().getPasEventIsNotNull() && form.getGlobalContext().Core.getSelectedWaitingAreaPatient().getPasEvent().getPatientIsNotNull())) { //retrieve 2 values from Inpat String[] arrDtoVals = domain.getRtpStatAndPlBlk(form.getGlobalContext().Core.getSelectedBedSpaceState() != null ? form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEvent().getPatient().getDisplayId() : form.getGlobalContext().Core.getSelectedWaitingAreaPatient().getPasEvent().getPatient().getDisplayId()); if (arrDtoVals != null) { form.getLocalContext().setRtpStat(arrDtoVals[0] == "" ? null : arrDtoVals[0]); form.getLocalContext().setPlBlk(arrDtoVals[1] == "" ? null : arrDtoVals[1]); } } if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) || (form.getLocalContext().getRtpStatIsNotNull() && (form.getLocalContext().getRtpStat().equals(TREATMENT) || form.getLocalContext().getRtpStat().equals(DIAGNOSTIC)))) { // WDEV-18617 if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && ((form.getGlobalContext().Core.getSelectedBedSpaceStateIsNotNull() && form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode() != null) || form.getGlobalContext().Core.getSelectedWaitingAreaPatientIsNotNull())) { PatientElectiveListBedAdmissionVo patEle = domain.getPatientElectiveListForDischarge(form.getGlobalContext().Core.getSelectedBedSpaceState() != null ? form.getGlobalContext().Core.getSelectedBedSpaceState().getInpatientEpisode().getPasEvent() : form.getGlobalContext().Core.getSelectedWaitingAreaPatient().getPasEvent()); if (patEle != null) //WDEV-21138 { if (patEle.getElectiveListReasonIsNotNull() && patEle.getElectiveListReason().getId() == ElectiveListReason.DIAGNOSTIC.getId()) { // Update local context for patient RTP stat if necessary // Fix for what WDEV-16604 broke - the stop to DTO calls if (form.getLocalContext().getRtpStat() == null) { form.getLocalContext().setRtpStat(DIAGNOSTIC); } form.lyrDetail().tabDischarge().lblDereferred().setValue("Was Diagnostic Deferred?"); } else { // Update local context for patient RTP stat if necessary // Fix for what WDEV-16604 broke - the stop to DTO calls if (form.getLocalContext().getRtpStat() == null) { form.getLocalContext().setRtpStat(TREATMENT); } form.lyrDetail().tabDischarge().lblDereferred().setValue("Was Treatment Deferred?"); } } } } updateControlsState(); }
private PatientElectiveListBedAdmissionVo updatePendingElectiveAdmission(PatientElectiveListBedAdmissionVo patientElectiveList) { if (patientElectiveList == null) throw new CodingRuntimeException("Patient Elective List cannot be null for admission."); // Update Patient Elective List record from data from screen patientElectiveList.setAnticipatedStay(form.intAnticipatedStay().getValue()); //WDEV-22646 Consultant Not to be updated //patientElectiveList.setConsultant(form.qmbConsultant().getValue() != null ? form.qmbConsultant().getValue().toHcpLiteVo() : null); // Set the status for the Patient Elective List record ElectiveListStatusVo admissionStatus = new ElectiveListStatusVo(); admissionStatus.setAuthoringUser((MemberOfStaffLiteVo) domain.getMosUser()); admissionStatus.setStatusDateTime(new DateTime()); admissionStatus.setElectiveListStatus(WaitingListStatus.ADMITTED); patientElectiveList.setElectiveListStatus(admissionStatus); if (patientElectiveList.getElectiveListStatusHistory() == null) patientElectiveList.setElectiveListStatusHistory(new ElectiveListStatusRefVoCollection()); patientElectiveList.getElectiveListStatusHistory().add(admissionStatus); // Update the TCI record from data on screen TCIForPatientElectiveListBedInfoDetailsVo tciDetails = patientElectiveList.getTCIDetails(); tciDetails.setTCIWard(form.cmbWard().getValue()); //WDEV-22646 Consultant Not to be updated //tciDetails.setTCIConsultant(form.qmbConsultant().getValue() != null ? form.qmbConsultant().getValue().toHcpLiteVo() : null); tciDetails.setIsActive(false); DateTime admissionDateTime = form.dtimAdmitDateTime().getValue(); //WDEV-22662 //tciDetails.setTCIDate(admissionDateTime != null ? admissionDateTime.getDate() : null); //tciDetails.setTCITime(admissionDateTime != null ? admissionDateTime.getTime() : null); // Set the outcome for the TCI record TCIOutcomeForPatientElectiveListVo outcome = new TCIOutcomeForPatientElectiveListVo(); outcome.setChangeBy((MemberOfStaffRefVo) domain.getMosUser()); outcome.setStatusDateTime(admissionDateTime); outcome.setOutcomeReason(null); outcome.setOutcome(ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason()) ? AdmissionOfferOutcome.PATIENT_ADMITTED : AdmissionOfferOutcome.PATIENT_ADMITTED_COMMENCED_8); tciDetails.setCurrentOutcome(outcome); if (tciDetails.getOutcomeHistory() == null) tciDetails.setOutcomeHistory(new TCIOutcomeForPatientElectiveListRefVoCollection()); tciDetails.getOutcomeHistory().add(outcome); if (Boolean.TRUE.equals(patientElectiveList.getSubjectTo28DayRule()) && isAdmissionDateInBreachOfRule28Days(form.dtimAdmitDateTime().getValue(), patientElectiveList)) { patientElectiveList.setSubjectTo28DayRule(Boolean.FALSE); patientElectiveList.setRule28DayStatus(Rule28DayStatus.BREACHED); patientElectiveList.setRule28DayPeriodStart(null); if (patientElectiveList.getTCIDetails() != null) { patientElectiveList.getTCIDetails().setRule28DayStatus(Rule28DayStatus.BREACHED); patientElectiveList.getTCIDetails().setRule28DayPeriodStart(null); } } // Update the status for the Theatre Appointment BookingAppointmentTheatreVo theatreAppointment = tciDetails.getAppointment(); if (theatreAppointment != null) { Appointment_StatusVo admittedStatus = new Appointment_StatusVo(); admittedStatus.setStatus(Status_Reason.ADMITTED); admittedStatus.setStatusChangeDateTime(admissionDateTime); theatreAppointment.setApptStatus(Status_Reason.ADMITTED); theatreAppointment.setCurrentStatusRecord(admittedStatus); if (theatreAppointment.getApptStatusHistory() == null) theatreAppointment.setApptStatusHistory(new Appointment_StatusVoCollection()); theatreAppointment.getApptStatusHistory().add(admittedStatus); } // Return updated Patient Elective List return patientElectiveList; }
private PatientElectiveList getPatientElectiveListForAdmission(DomainFactory factory, AdmissionDetail ad) throws StaleObjectException { String pelQuery = "select pel from PatientElectiveList as pel left join pel.admissions as ad where ad.id = " + ad.getId() + " AND (pel.isRIE is null OR pel.isRIE = 0)"; List <PatientElectiveList> pelList = factory.find(pelQuery); PatientElectiveList patientElectiveList = null; if (pelList != null && pelList.size() > 0) { patientElectiveList = (PatientElectiveList) pelList.get(0); } if (patientElectiveList == null) { String pel2Query = "select p1_1 from PatientElectiveList as p1_1 left join p1_1.tCIDetails as t1_1 left join t1_1.admissionDetail as a1_1 where t1_1.admissionDetail.id = " + ad.getId() + " AND (p1_1.isRIE is null OR p1_1.isRIE = 0)"; List <PatientElectiveList> pelList2 = factory.find(pel2Query); if(pelList2 != null && pelList2.size() > 0) { patientElectiveList = (PatientElectiveList) pelList2.get(0); } } if (patientElectiveList != null) { if (patientElectiveList.getElectiveListStatus() != null && patientElectiveList.getElectiveListStatus().getStatusDateTime() != null) { patientElectiveList.getElectiveListStatus().setStatusDateTime(ad.getAdmissionDateTime()); } if (patientElectiveList.getTCIDetails() != null) { if (patientElectiveList.getTCIDetails().getTCITime() != null) { patientElectiveList.getTCIDetails().setTCITime(new DateTime(ad.getAdmissionDateTime()).getTime().toString()); } if (patientElectiveList.getTCIDetails().getCurrentOutcome() != null && patientElectiveList.getTCIDetails().getCurrentOutcome().getStatusDateTime() != null) { patientElectiveList.getTCIDetails().getCurrentOutcome().setStatusDateTime(ad.getAdmissionDateTime()); } } if(patientElectiveList.getElectiveListReason()!=null && patientElectiveList.getElectiveListReason().getId() == ElectiveListReason.TREATMENT.getId()) { if (patientElectiveList.getPathwayClock() != null) { if (patientElectiveList.getPathwayClock().getStopDate() != null) patientElectiveList.getPathwayClock().setStopDate(ad.getAdmissionDateTime()); if (patientElectiveList.getPathwayClock().getCurrentRTTStatus() != null) patientElectiveList.getPathwayClock().getCurrentRTTStatus().setStatusDateTime(ad.getAdmissionDateTime()); } } } return patientElectiveList; }
private void populateMedicalTabFromData(PatientElectiveListDetailsVo patientElectiveList) { if( ElectiveListReason.TREATMENT.equals(patientElectiveList.getElectiveListReason())) form.ctnDetails().lyrWaitingListDetails().tabPageMedical().GroupElectiveListReasonMedical().setValue(GroupElectiveListReasonMedicalEnumeration.rdoTreatmentMedical); else if( ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason())) form.ctnDetails().lyrWaitingListDetails().tabPageMedical().GroupElectiveListReasonMedical().setValue(GroupElectiveListReasonMedicalEnumeration.rdoDiagnosticMedical); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().chkPatientDateGivenToPatientMedical().setValue(patientElectiveList.getWasPossibleDateGiven()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().dteDateGivemToPatientMedical().setValue(patientElectiveList.getDateGivenToPatient()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().intPlanProcedureInMedical().setValue(patientElectiveList.getToBePlannedIn()); if( TimeUnitsSecondsToMonths.DAYS.equals(patientElectiveList.getToBePlannedInUnit())) form.ctnDetails().lyrWaitingListDetails().tabPageMedical().GroupPlanedProceduresMedical().setValue(GroupPlanedProceduresMedicalEnumeration.rdoDaysPlannedMedical); else if( TimeUnitsSecondsToMonths.WEEKS.equals(patientElectiveList.getToBePlannedInUnit())) form.ctnDetails().lyrWaitingListDetails().tabPageMedical().GroupPlanedProceduresMedical().setValue(GroupPlanedProceduresMedicalEnumeration.rdoWeeksPlannedMedical); else if( TimeUnitsSecondsToMonths.MONTHS.equals(patientElectiveList.getToBePlannedInUnit())) form.ctnDetails().lyrWaitingListDetails().tabPageMedical().GroupPlanedProceduresMedical().setValue(GroupPlanedProceduresMedicalEnumeration.rdoMonthPlannedMedical); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().dteRequestedPlannedMedical().setValue(patientElectiveList.getPlannedDate()); if(patientElectiveList.getHospital() != null) { form.ctnDetails().lyrWaitingListDetails().tabPageMedical().cmbHospital().newRow(patientElectiveList.getHospital(), patientElectiveList.getHospital().getName()); } form.ctnDetails().lyrWaitingListDetails().tabPageMedical().cmbHospital().setValue(patientElectiveList.getHospital()); if(patientElectiveList.getWard() != null) { form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbWard().newRow(patientElectiveList.getWard(), patientElectiveList.getWard().getName()); } form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbWard().setValue(patientElectiveList.getWard()); if( patientElectiveList.getPrimaryProcedureIsNotNull() ) { form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbProcedureMedical().newRow(patientElectiveList.getPrimaryProcedure(), patientElectiveList.getPrimaryProcedure().getProcedureName()); } form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbProcedureMedical().setValue(patientElectiveList.getPrimaryProcedure()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().cmbLateralityMedical().setValue(patientElectiveList.getProcLaterality()); form.getLocalContext().setShowSecondMedicalProcedure(patientElectiveList.getSecondaryProcedureIsNotNull() ? Boolean.TRUE:Boolean.FALSE); if( patientElectiveList.getSecondaryProcedureIsNotNull()) { form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbProcedureSecondMedical().newRow(patientElectiveList.getSecondaryProcedure(), patientElectiveList.getSecondaryProcedure().getProcedureName()); } form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbProcedureSecondMedical().setValue(patientElectiveList.getSecondaryProcedure()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().cmbLateralitySecondMedical().setValue(patientElectiveList.getSecondaryProcLaterality()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().txtdetailsMedical().setValue(patientElectiveList.getProcedureDescription()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().cmbPriorityMedical().setValue(patientElectiveList.getPriority()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().chkShortNoticeMedical().setValue(patientElectiveList.getAvailableAtShortNotice()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().intNumberOfDaysOfNoticeReqMedical().setValue(patientElectiveList.getAvailableAtShortNoticePeriod()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().intAnticipatedNightsMedical().setValue(patientElectiveList.getAnticipatedStay()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().ccResponsibleHCP().setValue(patientElectiveList.getResponsibleHCP()); //wdev-22582 if( patientElectiveList.getElectiveListIsNotNull()) { form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbElectiveListMedical().newRow(patientElectiveList.getElectiveList(),patientElectiveList.getElectiveList().getWaitingListName()); } form.ctnDetails().lyrWaitingListDetails().tabPageMedical().qmbElectiveListMedical().setValue(patientElectiveList.getElectiveList()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().chkInterpreterRequiredMedical().setValue(patientElectiveList.getInterpretatorRequired()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().cmbInterpreterRequiredMedical().setValue(patientElectiveList.getLanguage()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().chkTransportRequiredNedical().setValue(patientElectiveList.getTransportRequired()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().cmbTransportRequiredMedical().setValue(patientElectiveList.getTransport()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().chkSpecialRequirementsMedical().setValue(patientElectiveList.getSpecialRequirements()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().txtSpecialRequirementsMedical().setValue(patientElectiveList.getSpecialRequirementsDetails()); form.ctnDetails().lyrWaitingListDetails().tabPageMedical().txtCommentMedical().setValue(patientElectiveList.getComments()); //wdev - 22310 form.ctnDetails().ccAuthoringHCP().setValue(patientElectiveList.getAuthoringInfo()); if( patientElectiveList.getRecordingUserIsNotNull()) { form.ctnDetails().ccRecordingMOS().setValue(patientElectiveList.getRecordingUser().getRecordingUser()); form.ctnDetails().dtimRecordingDateTime().setValue(patientElectiveList.getRecordingUser().getRecordingDateTime()); } //------------ }
public PatientElectiveListVo getPatientElectiveListsOnFormOpen(CatsReferralRefVo catsRef, ServiceRefVo serviceRef, String listIdHcp, Boolean nonDiagnosticELE, CatsReferralForNewElectivListEntryVo catsReferralWithPathwayClock) { ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer hqlConditions = new StringBuffer(); String andStr = " and "; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select pEL from PatientElectiveList as pEL left join pEL.electiveList as eL left join eL.service as service left join eL.hCPs as listOwners left join pEL.electiveListStatus as pELStatus left join pELStatus.electiveListStatus as status left join pEL.pathwayClock as pathClock "); if (catsRef != null) { hqlConditions.append(andStr); hqlConditions.append(" pEL.referral.id = :CatsID "); markers.add("CatsID"); values.add(catsRef.getID_CatsReferral()); andStr = " and "; } if (serviceRef != null) { hqlConditions.append(andStr); hqlConditions.append(" service.id=:Service "); markers.add("Service"); values.add(serviceRef.getID_Service()); andStr = " and "; } if (listIdHcp != null && listIdHcp.length() > 0) { hqlConditions.append(andStr); hqlConditions.append(" ( listOwners.hCP.id in " + listIdHcp + " ) "); andStr = " and "; } if (nonDiagnosticELE) { hqlConditions.append(andStr); hqlConditions.append(" pEL.electiveListReason.id not in (" + ElectiveListReason.DIAGNOSTIC.getID() + " ) "); andStr = " and "; } if (catsReferralWithPathwayClock != null && catsReferralWithPathwayClock.getJourney() != null && catsReferralWithPathwayClock.getJourney().getCurrentClock() != null) { hqlConditions.append(andStr); hqlConditions.append(" pathClock.id = :Clock "); markers.add("Clock"); values.add(catsReferralWithPathwayClock.getJourney().getCurrentClock().getID_PathwayClock()); andStr = " and "; } hqlConditions.insert(0, " where ( status.id not in (" + WaitingListStatus.REMOVED.getID() + ")"); hqlConditions.append(" ) "); List<?> list = factory.find(hql.toString() + hqlConditions.toString(), markers, values); if (list == null || list.size() == 0) return null; return PatientElectiveListVoAssembler.create((PatientElectiveList) (list.get(0))); }
private PathwayRTTStatus createPathwayRTTStatus(CatsReferral domCats, ElectiveListReason electiveListReason, Date eventDateTime) { if(!ConfigFlag.DOM.RTT_STATUS_POINT_FUNCTIONALITY.getValue()) return null; if (domCats == null || electiveListReason == null) return null; RTTStatusPoint rttStatusPoint = null; if (ElectiveListReason.TREATMENT.equals(electiveListReason) || ElectiveListReason.MATERNITY.equals(electiveListReason)) { rttStatusPoint = getRTTStatusPoint(START_OF_FIRST_DEFINITIVE_TREATMENT); } else if (ElectiveListReason.DIAGNOSTIC.equals(electiveListReason)) { rttStatusPoint = getRTTStatusPoint(ACTIVITY_REFERRAL_TREATMENT_PERIOD); } Object mos = getMosUser(); MemberOfStaff doMos = null; if(mos instanceof MemberOfStaffLiteVo) { doMos = MemberOfStaffLiteVoAssembler.extractMemberOfStaff(getDomainFactory(), (MemberOfStaffLiteVo) mos); } PathwayRTTStatus pathwayRTTStatus = new PathwayRTTStatus(); pathwayRTTStatus.setRTTStatus(rttStatusPoint); pathwayRTTStatus.setStatusBy(doMos); pathwayRTTStatus.setStatusDateTime(eventDateTime); if(rttStatusPoint!=null) { pathwayRTTStatus.setSetting("I");//WDEV-23292 } if(domCats.getJourney() != null && domCats.getJourney().getCurrentClock() != null) { domCats.getJourney().getCurrentClock().setCurrentRTTStatus(pathwayRTTStatus); if(domCats.getJourney().getCurrentClock().getRTTStatusHistory() == null) domCats.getJourney().getCurrentClock().setRTTStatusHistory(new java.util.ArrayList()); domCats.getJourney().getCurrentClock().getRTTStatusHistory().add(pathwayRTTStatus); } return pathwayRTTStatus; }