private void saveCatsReferralwithReviewStatus(DomainFactory factory, PatientTheatreBookingVo voAppt, LookupInstance apptStatus) throws StaleObjectException { if(factory == null || voAppt == null || apptStatus == null) throw new CodingRuntimeException("all mandatory params not populated for method saveCatsReferralwithDNAStatus"); List lstCatsRef = factory.find("from CatsReferral catsRef join fetch catsRef.appointments appts where appts.id = '" + voAppt.getID_Booking_Appointment() + "'"); if(lstCatsRef != null && lstCatsRef.size() == 1) { CatsReferral doCatsRef = (CatsReferral) lstCatsRef.get(0); if(apptStatus.equals(getDomLookup(Status_Reason.DNA))) doCatsRef.setHasDNAApptsForReview(true); else if(apptStatus.equals(getDomLookup(Status_Reason.CANCELLED))) doCatsRef.setHasCancelledApptsForReview(true); factory.save(doCatsRef); } }
private void populateApptsGrid(PatientTheatreBookingVoCollection voColl) { form.grdAppts().getRows().clear(); if(voColl != null) { for(int i = 0 ; i < voColl.size() ; i++) { PatientTheatreBookingVo voBooking = voColl.get(i); grdApptsRow row = form.grdAppts().getRows().newRow(); if (voBooking.getTheatreBookingIsNotNull() && voBooking.getTheatreBooking().getTCITimeIsNotNull()) row.setAppointmentTime(voBooking.getTheatreBooking().getTCITime().toString()); if(voBooking.getTheatreBookingIsNotNull() && voBooking.getTheatreBooking().getProcedureIsNotNull()) row.setProcedure(voBooking.getTheatreBooking().getProcedure().getProcedureName()); if(voBooking.getSessionIsNotNull() && voBooking.getSession().getTheatreTypeIsNotNull()) row.setType(voBooking.getSession().getTheatreType().toString()); if(voBooking.getApptStartTimeIsNotNull()) row.setAppointmentTime(voBooking.getApptStartTime().toString()); if(voBooking.getApptStatusIsNotNull()) { row.setStatus(voBooking.getApptStatus().toString()); row.setBooking(voBooking.getApptStatus().getImage()); } if(voBooking.getOutcomeIsNotNull()) row.setTooltip("Outcome : " + voBooking.getOutcome().getText()); row.setValue(voBooking); } } }
private void updateContextMenuState() { form.getContextMenus().Clinical.hideAllPatientTheatreApptManageMenuMenuItems(); if(form.grdPatients().getValue() == null) return; PatientTheatreBookingVo voAppt = form.grdAppts().getValue(); boolean isApptSelected = voAppt != null; Status_Reason currentApptStatus = voAppt != null ? voAppt.getApptStatus() : null; if(currentApptStatus != null && voAppt.getAppointmentDateIsNotNull() && voAppt.getAppointmentDate().isLessOrEqualThan(new Date())) { form.getContextMenus().Clinical.getPatientTheatreApptManageMenuAdmitItem().setVisible(form.getMode().equals(FormMode.VIEW) && isApptSelected && currentApptStatus.equals(Status_Reason.BOOKED) && domain.isReferralAccepted(voAppt)); Boolean showDna = false; if(currentApptStatus.equals(Status_Reason.BOOKED)) { if(voAppt.getAppointmentDateIsNotNull() && voAppt.getAppointmentDate().isLessThan(new Date())) showDna = true; //if day is the same include the time in the check else if(voAppt.getAppointmentDateIsNotNull() && voAppt.getAppointmentDate().equals(new Date())) { if(voAppt.getApptStartTimeIsNotNull() && voAppt.getApptStartTime().isLessThan(new Time())) showDna = true; } } form.getContextMenus().Clinical.getPatientTheatreApptManageMenuDNAItem().setVisible(form.getMode().equals(FormMode.VIEW) && isApptSelected && showDna); } //WDEV-12175 if(currentApptStatus != null) form.getContextMenus().Clinical.getPatientTheatreApptManageMenuCancelledItem().setVisible(form.getMode().equals(FormMode.VIEW) && isApptSelected && currentApptStatus.equals(Status_Reason.BOOKED)); //WDEV-12918 if(ConfigFlag.DOM.THEATRE_SESSION_TYPE.getValue().equals("Fixed")) { if(currentApptStatus != null) form.getContextMenus().Clinical.getPatientTheatreApptManageMenuMOVEItem().setVisible(form.getMode().equals(FormMode.VIEW) && isApptSelected && currentApptStatus.equals(Status_Reason.BOOKED)); } }
private boolean save() { if(form.grdAppts().getValue() == null) throw new CodingRuntimeException("No Appointment selected to manage"); if(form.getLocalContext().getNewStatus() == null) throw new CodingRuntimeException("NewStatus not set in method saveBookingAppointmentWithNewStatus"); PatientTheatreBookingVo voAppt = form.grdAppts().getValue(); //WDEV-9091 SessionTheatreTCISlotLiteVo sessionSlot = null; Status_Reason status = form.getLocalContext().getNewStatus(); if(status.equals(Status_Reason.SEEN)) voAppt.setSeenTime(form.timTime().getValue()); else if(status.equals(Status_Reason.ARRIVAL)) voAppt.setArrivalTime(form.timTime().getValue()); //WDEV-9091 - starts here else if(status.equals(Status_Reason.DNA)) { if(voAppt.getIsCABBooking() == null || Boolean.FALSE.equals(voAppt.getIsCABBooking())) { voAppt.setRequiresRebook(true); if(voAppt.getTheatreSlotIsNotNull()) { sessionSlot = domain.getSessionSlot(voAppt.getTheatreSlot()); sessionSlot.setStatus(Status_Reason.DNA); sessionSlot.setAppointment(null); sessionSlot.validate(); voAppt.setTheatreSlot(null); } } } //WDEV-9091 - ends here voAppt.setApptStatus(status); Appointment_StatusVo voStatus = new Appointment_StatusVo(); voStatus.setApptDate(voAppt.getAppointmentDate()); voStatus.setApptTime(voAppt.getApptStartTime()); voStatus.setStatusChangeDateTime(new DateTime()); voStatus.setStatus(form.getLocalContext().getNewStatus()); Appointment_StatusVoCollection voCollStatusHistory = voAppt.getApptStatusHistory(); if(voCollStatusHistory == null) voCollStatusHistory = new Appointment_StatusVoCollection(); voCollStatusHistory.add(voStatus); voAppt.setCurrentStatusRecord(voStatus); // wdev-6034 voAppt.setApptStatusHistory(voCollStatusHistory); String[] arrErrors = voAppt.validate(); if(arrErrors != null) { engine.showErrors(arrErrors); return false; } try { domain.saveBookingAppt(voAppt, sessionSlot); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); clearGridsAndInstanceControls(); return false; } form.getLocalContext().setDateAppt(form.dteAppt().getValue()); return true; }
private boolean cancelAppt() { PatientTheatreBookingVo voAppt = form.grdAppts().getValue(); if(form.getGlobalContext().Scheduling.getApptCancelStatusIsNotNull()) { //appt status and status history voAppt.setApptStatus(Status_Reason.CANCELLED); voAppt.setApptStatusReas(form.getGlobalContext().Scheduling.getApptCancelStatus().getStatusReason()); Appointment_StatusVo voStatus = new Appointment_StatusVo(); voStatus.setApptDate(voAppt.getAppointmentDate()); voStatus.setApptTime(voAppt.getApptStartTime()); voStatus.setStatusChangeDateTime(new DateTime()); voStatus.setStatus(Status_Reason.CANCELLED); if(form.getGlobalContext().Scheduling.getApptCancelStatusIsNotNull()) { voStatus.setCancellationReason(form.getGlobalContext().Scheduling.getApptCancelStatus().getCancellationReason()); if(form.getGlobalContext().Scheduling.getApptCancelStatus().getRebookSelectedIsNotNull()) voAppt.setRequiresRebook(form.getGlobalContext().Scheduling.getApptCancelStatus().getRebookSelected()); } Appointment_StatusVoCollection voCollStatusHistory = voAppt.getApptStatusHistory(); if(voCollStatusHistory == null) voCollStatusHistory = new Appointment_StatusVoCollection(); voCollStatusHistory.add(voStatus); voAppt.setCurrentStatusRecord(voStatus); // wdev-6034 voAppt.setApptStatusHistory(voCollStatusHistory); } String[] arrErrors = voAppt.validate(); if(arrErrors != null) { engine.showErrors(arrErrors); return false; } Booking_AppointmentVo voApptFull = null; try { voApptFull = domain.saveBookingAppt(voAppt, null); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); clearGridsAndInstanceControls(); return false; } form.getGlobalContext().Scheduling.setBookingAppointment(voApptFull); form.getLocalContext().setDateAppt(form.dteAppt().getValue()); return true; }