private void initialize() throws PresentationLogicException { // Hide all context menu options form.getContextMenus().hideAllGenericGridMenuItems(); // Set text to context menu option VIEW form.getContextMenus().getGenericGridViewItem().setText("View eDischarge"); // Remove DRAFT value from Pharmacy status form.cmbPharmacyStatus().removeRow(TTAStatus.DRAFT); form.cmbPharmacyStatus().removeRow(TTAStatus.NOT_REQUIRED); // Set auto-refresh false form.getLocalContext().setAutoRefresh(Boolean.FALSE); // Set timer interval form.getTimers().getSearchTimer().setInterval(TIMER_INTERVAL); // Clear sort order form.getLocalContext().setColumnDOBSortOrder(SortOrder.NONE); }
protected void onBtnEditClick() throws PresentationLogicException { setEditMode(); if (form.getLocalContext().getEditedRecordIsNotNull() && form.getLocalContext().getEditedRecord().getCurrentTTAStatusIsNotNull() && form.getLocalContext().getEditedRecord().getCurrentTTAStatus().getStatus().equals(TTAStatus.NOT_REQUIRED)) { form.getContextMenus().Clinical.getEDischargeMedsSthkMenuViewPreviousItem().setVisible(false);//WDEV-11849 form.getContextMenus().Clinical.getEDischargeMedsSthkMenuNewItem().setVisible(false); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuEditItem().setVisible(false); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuRemoveItem().setVisible(false); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuViewItem().setVisible(form.grdOrderDischMedication().getSelectedRow() != null ? true : false); return; } //WDEV-12538 form.txtRejectionReason().setValue(null); updateStatus(TTAStatus.DRAFT); updateContextMenuStatus(); enableControls(true); }
private void manageButtons(TTAStatus status) { if (status != null) { if (status.equals(TTAStatus.SUSPENDED)) { form.btnApprove().setEnabled(false); form.btnSuspended().setEnabled(false); form.btnPrintRequest().setEnabled(false); form.btnJAC().setEnabled(false); form.btnTTADispensed().setEnabled(false); form.btnFinalChecks().setEnabled(false); } else if (status.equals(TTAStatus.APPROVED)) { form.btnApprove().setEnabled(true); form.btnSuspended().setEnabled(canSuspend()); form.btnPrintRequest().setEnabled(true); form.btnJAC().setEnabled(true); form.btnTTADispensed().setEnabled(true); form.btnFinalChecks().setEnabled(false); } else { form.btnApprove().setEnabled(true); form.btnSuspended().setEnabled(canSuspend()); form.btnPrintRequest().setEnabled(true); form.btnJAC().setEnabled(true); form.btnTTADispensed().setEnabled(true); form.btnFinalChecks().setEnabled(true); } } }
@Override protected void onBtnFinalChecksClick() throws PresentationLogicException { updateStatus(TTAStatus.COMPLETED); if (save()) { form.btnEdit().setVisible(false); } setViewMode(); manageStatus(form.getLocalContext().getEditedRecord()); }
private void doApprove() { updateStatus(TTAStatus.APPROVED); if (save()) { form.btnEdit().setVisible(false); manageButtons(TTAStatus.APPROVED); form.btnApprove().setText(UNAPPROVE); } }
@Override protected void onBtnSaveClick() throws PresentationLogicException { if(!validateUIRules())// WDEV-13691 return; TTAStatusVo newStatus = new TTAStatusVo(); newStatus.setStatusDateTime(form.dtim1().getValue()); // WDEV-13691 newStatus.setAuthoringUser(form.cc1().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.cc1().getValue() : null);// WDEV-13691 newStatus.setStatus(TTAStatus.AWAITING_DISPENSING); form.getGlobalContext().Clinical.seteDischargePharmacyApprovalTTAPharmacySystemDetails(newStatus); engine.close(DialogResult.OK); }
@Override protected void onBtnSubmitTTAClick() throws PresentationLogicException { engine.showMessage("Please complete a green CD TTO sheet for any controlled drugs to enable a legal supply to be made by Pharmacy"); if (form.getLocalContext().getEditedRecordIsNotNull()) { if(form.getLocalContext().getEditedRecord().getTTAStatusHistoryIsNotNull()) { boolean foundSubmittedStatus = false; for (int i = 0; i < form.getLocalContext().getEditedRecord().getTTAStatusHistory().size(); i++) { if (form.getLocalContext().getEditedRecord().getTTAStatusHistory().get(i).getStatus().equals(TTAStatus.SUBMITTED)) { foundSubmittedStatus = true; break; } } if (foundSubmittedStatus) updateStatus(TTAStatus.RESUBMITTED); else updateStatus(TTAStatus.SUBMITTED); } else { updateStatus(TTAStatus.SUBMITTED); } if (save()) { open(); form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.EDITABLE); } } }
@Override protected void onBtnSaveClick() throws PresentationLogicException { if(!validateUIRules())// WDEV-13691 return; TTAStatusVo newStatus = new TTAStatusVo(); newStatus.setStatusDateTime(form.dtim1().getValue()); // WDEV-13691 newStatus.setAuthoringUser(form.cc1().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.cc1().getValue() : null);// WDEV-13691 newStatus.setStatus(TTAStatus.AWAITING_FINAL_CHECKS); form.getGlobalContext().Clinical.seteDischargePharmacyApprovalTTADispense(newStatus); engine.close(DialogResult.OK); }
private void updateSummary(SummaryRefVo summary, TTAStatus status) throws ims.domain.exceptions.StaleObjectException { if(summary == null || status == null) return; DomainFactory factory = getDomainFactory(); Summary doSummary = (Summary)factory.getDomainObject(summary); if (getDomLookup(DischargeLetterStatus.GENERATED).equals(doSummary.getDischargeLetterStatus())) throw new StaleObjectException(null); doSummary.setTTAStatus(getDomLookup(status)); factory.save(doSummary); }
@Override protected void onBtnApproveClick() throws PresentationLogicException { form.getContextMenus().Clinical.hideAllEDischargeMedsSthkMenuMenuItems(); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuViewItem().setVisible((form.getMode().equals(FormMode.VIEW) ? true: false) && form.dyngrdMedication().getSelectedRow() != null ? true : false); if (form.btnApprove().getText().equals(APPROVE)) { if (form.dyngrdMedication().getRows().size() == 0) { form.getLocalContext().setPharmApproveConfirmMsgBoxId(engine.showMessage("The medication grid doesn't contain any records!\nAre you sure you want to approve?", "Please confirm", MessageButtons.YESNO, MessageIcon.QUESTION)); return; } // Update the 'Last Updating Pharmacist' field // - will only be updated if the current user is a HCP updateLastUpdatingPharmacist(); doApprove(); } else if (form.btnApprove().getText().equals(UNAPPROVE)) { TTAMedicationAndPharmacyVo currentRecord = form.getLocalContext().getEditedRecord(); TTAStatusVoCollection statusHistory = currentRecord.getTTAStatusHistory().sort(SortOrder.DESCENDING); TTAStatusVo newStatus = null; for (int i = 0; i < statusHistory.size(); i++) { if (statusHistory.get(i).equals(currentRecord.getCurrentTTAStatus())) { continue; } else { if (statusHistory.get(i).getStatus().equals(TTAStatus.SUBMITTED) || statusHistory.get(i).getStatus().equals(TTAStatus.RESUBMITTED)) { newStatus = statusHistory.get(i); updateStatus(newStatus.getStatus()); // Update the 'Last Updating Pharmacist' field // - will only be updated if the current user is a HCP updateLastUpdatingPharmacist(); if (save()) { form.btnApprove().setText(APPROVE); manageStatus(form.getLocalContext().getEditedRecord()); } break; } } } } }
@Override protected void onBtnPrintClick() throws PresentationLogicException { if(!validateUIRules())// WDEV-13691 return; if (form.ccPrint().getSelectedPrinter() == null) { engine.showMessage("No printer selected"); return; } String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); Object[] obj = domain.getSystemReportAndTemplate(new Integer(248)); QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId()); client.addSeed(new SeedValue("CARE_CONTEXT", form.getGlobalContext().Core.getCurrentCareContext().getID_CareContext(), Integer.class)); if(obj == null || obj.length < 2) { engine.showMessage("I could not get the report and template !"); return; } if(obj[0] == null || obj[1] == null) { engine.showMessage("The report has not been deployed !"); return; } try { boolean printSuccess = client.printReport((String)obj[0], (String)obj[1], urlReportServer, form.ccPrint().getSelectedPrinter().getIPrinterName(), 1); if (printSuccess) { TTAStatusVo newStatus = new TTAStatusVo(); newStatus.setStatusDateTime(form.dtim1().getValue()); // WDEV-13691 newStatus.setAuthoringUser(form.cc1().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.cc1().getValue() : null);// WDEV-13691 newStatus.setStatus(TTAStatus.TTA_DOCKET_PRINTED); form.getGlobalContext().Clinical.seteDischargePharmacyApprovalTTADockedPrinted(newStatus); engine.close(DialogResult.OK); } } catch (QueryBuilderClientException ex) { engine.showMessage("Error creating report: " + ex.getMessage()); return; } }
private void manageStatus(TTAMedicationAndPharmacyVo currentRecord) { if (currentRecord != null) { if (currentRecord.getCurrentTTAStatusIsNotNull()) { //TTAStatus = Draft : users can edit TTA tab if (currentRecord.getCurrentTTAStatus().getStatus().equals(TTAStatus.DRAFT)) { if (currentRecord.getTTAStatusHistoryIsNotNull()) { boolean found = false; for (int i = 0; i < currentRecord.getTTAStatusHistory().size(); i++) { if (currentRecord.getTTAStatusHistory().get(i).getStatusIsNotNull() && (currentRecord.getTTAStatusHistory().get(i).getStatus().equals(TTAStatus.DRAFT) || currentRecord.getTTAStatusHistory().get(i).getStatus().equals(TTAStatus.NOT_REQUIRED))) { continue; } else { found = true; form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.READONLY); form.fireCustomControlValueChanged(); break; } } if (!found) { form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.HIDDEN); } } else form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.HIDDEN); } //TTAStatus = Rejected : users can edit TTA tab else if (currentRecord.getCurrentTTAStatus().getStatus().equals(TTAStatus.REJECTED)) { form.btnEdit().setVisible(true); form.btnEdit().setEnabled(form.getLocalContext().getIsHcpIsNotNull() && form.getLocalContext().getIsHcp());//wdev-13536 form.btnSubmitTTA().setEnabled(currentRecord != null && currentRecord.getTTAMedicationsIsNotNull() && currentRecord.getTTAMedications().size() > 0 && form.getLocalContext().getIsHcpIsNotNull() && form.getLocalContext().getIsHcp());//WDEV-12730, wdev-13536 form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.READONLY); } else if (currentRecord.getCurrentTTAStatus().getStatus().equals(TTAStatus.NOT_REQUIRED)) { form.btnEdit().setVisible(true); form.btnEdit().setEnabled(form.getLocalContext().getIsHcpIsNotNull() && form.getLocalContext().getIsHcp());//wdev-13536 form.btnSubmitTTA().setEnabled(false); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuViewPreviousItem().setVisible(false);//WDEV-11849 form.getContextMenus().Clinical.getEDischargeMedsSthkMenuNewItem().setVisible(false); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuEditItem().setVisible(false); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuRemoveItem().setVisible(false); form.getContextMenus().Clinical.getEDischargeMedsSthkMenuViewItem().setVisible(form.grdOrderDischMedication().getSelectedRow() != null ? true : false); form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.HIDDEN); } else { form.btnEdit().setVisible(false); form.btnSubmitTTA().setEnabled(false); form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.EDITABLE); } } else { form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.HIDDEN); } } else { form.getLocalContext().setPharmacyStatusToBeSet(EDischargeComponentStatus.HIDDEN); } form.fireCustomControlValueChanged(); }
private String[] validateUI(TTAMedicationAndPharmacyVo currentRecord) { ArrayList<String> errors = new ArrayList<String>(); if (form.Group1().getValue().equals(Group1Enumeration.None)) { errors.add("TTA Required is mandatory!"); } else { if(currentRecord != null && currentRecord.getCurrentTTAStatusIsNotNull()) { TTAStatusVo tta = currentRecord.getCurrentTTAStatus(); if (!tta.getStatus().equals(TTAStatus.NOT_REQUIRED)) { if (form.ccOrderingClinician().getValue() == null) { errors.add("Ordering Clinician is mandatory"); } if (form.dtimOrderingDateTime().getValue() == null) { errors.add("Ordering DateTime is mandatory"); } else { if (form.dtimOrderingDateTime().getValue().isGreaterThan(new DateTime())) { errors.add("Ordering DateTime can not be in the future"); } } if (form.txtClinicianBleepNo().getValue() == null) { errors.add("Clinician Bleep No. is mandatory"); } //WDEV-11849 - Start for (int i = 0 ; currentRecord.getTTAMedicationsIsNotNull() && i < currentRecord.getTTAMedications().size(); i++) { TTAMedicationDetailVo detail = currentRecord.getTTAMedications().get(i); if (detail != null) { Float dose = detail.getDoseValue(); MedicationDoseUnit doseUnit = detail.getDoseUnit(); String unitText = detail.getUnitText(); DoseFormIndicator formm = detail.getForm(); MedicationRoute route = detail.getRoute(); //WDEV-11894Integer frequency = detail.getFrequencyValue(); MedicationFrequency frequencyUnit = detail.getFrequencyUnit(); //WDEV-11894Integer duration = detail.getDurationValue(); //WDEV-11894MedicationDuration durationUnit = detail.getDurationUnit(); String clinicianComments = detail.getClinicalCommentsForPharmacy(); if ((dose == null || (doseUnit == null && unitText==null) || formm == null || route == null || frequencyUnit == null ) && clinicianComments == null)//WDEV-11894 { errors.add("Medication: "+(i+1)+" If Dose, Form, Route or Frequency are empty, Additional Prescribing Instructions field become mandatory");//WDEV-11894 } } } //WDEV-11849 - End } } } if (errors.size() > 0) { String[] searchErrors = new String[errors.size()]; errors.toArray(searchErrors); engine.showErrors("Invalid TTA Medication Record", searchErrors); return searchErrors; } return null; }