@Override protected void onBtnSuspendedClick() throws PresentationLogicException { if (form.btnSuspended().getText().equals(SUSPENDED)) { engine.open(form.getForms().Clinical.EDischargePharmacyApprovalSuspendedDialog); } else if (form.btnSuspended().getText().equals(UNSUSPENDED)) //wdev-13848 { // Update the 'Last Updating Pharmacist' field // - will only be updated if the current user is a HCP updateLastUpdatingPharmacist(); 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 { newStatus = statusHistory.get(i); updateStatus(newStatus.getStatus()); if (save()) { form.getLocalContext().setMedicationStatusToBeSet(EDischargeComponentStatus.EDITABLE); form.btnSuspended().setText(SUSPENDED); manageStatus(form.getLocalContext().getEditedRecord()); } break; } } } }
private void populateScreenFromData(TTAMedicationAndPharmacyVo currentRecord) { if (currentRecord == null) return; if(form.getGlobalContext().Core.getCurrentCareContextIsNotNull()) form.dteEDD().setValue(form.getGlobalContext().Core.getCurrentCareContext().getEstimatedDischargeDate()); form.ccResponsablePharmacist().setValue(currentRecord.getResponsiblePharmacist()); //WDEV-13479 form.decBodyWeight().setValue(currentRecord.getBodyWeightKg()); form.txtClinicalCommentsToPharmacy().setValue(currentRecord.getClinicalCommentsToPharmacy()); form.ccOrderingClin().setValue(currentRecord.getOrderingClinician()); form.dtim1().setValue(currentRecord.getOrderingDateTime()); form.txt2().setValue(currentRecord.getClinicianBleepNo()); //TTA Status if (currentRecord.getCurrentTTAStatusIsNotNull()) { TTAStatusVo currentStatus = currentRecord.getCurrentTTAStatus(); form.getLocalContext().setCurrentStatus(currentStatus); form.txt1().setValue(currentStatus.getStatus().toString()); form.txtRejectionReason().setValue(currentStatus.getReasonForRejection()); } if (currentRecord.getTTAMedicationsIsNotNull() && currentRecord.getTTAMedications().size() > 0) { currentRecord.getTTAMedications().sort(SortOrder.DESCENDING); for (int i = 0; i < currentRecord.getTTAMedications().size(); i++) { addDynamicGridMedicationRow(currentRecord.getTTAMedications().get(i)); } } }
private void populateDataFromScreen(TTAStatusVoCollection ttaStatusVoCollection) { for (int i = 0; i < ttaStatusVoCollection.size(); i++) { TTAStatusVo status = ttaStatusVoCollection.get(i); grdHistoryRow row = form.grdHistory().getRows().newRow(); row.setColDateTime(status.getStatusDateTimeIsNotNull() ? status.getStatusDateTime().toString() : null); row.setColUser(status.getAuthoringUserIsNotNull() ? status.getAuthoringUser().getName().toString() : null); row.setColStatus(status.getStatusIsNotNull() ? status.getStatus().getText() : null); if (status.getReasonForRejectionIsNotNull()) row.setColReason(status.getReasonForRejection()); else if (status.getReasonForSuspensionIsNotNull()) row.setColReason(status.getReasonForSuspension()); } }
@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 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); }
@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 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; }
private void populateScreenFromData(TTAMedicationAndPharmacyVo currentRecord) { if (currentRecord == null) return; if(currentRecord.getCurrentTTAStatusIsNotNull()) { TTAStatusVo tta = currentRecord.getCurrentTTAStatus(); if (tta.getStatus().equals(TTAStatus.NOT_REQUIRED)) form.Group1().setValue(Group1Enumeration.rdoTTAREquiredNo); else form.Group1().setValue(Group1Enumeration.rdoTTARequiredYes); } form.decBodyW().setValue(currentRecord.getBodyWeightKg()); form.ccOrderingClinician().setValue(currentRecord.getOrderingClinician()); form.dtimOrderingDateTime().setValue(currentRecord.getOrderingDateTime()); form.txtClinicianBleepNo().setValue(currentRecord.getClinicianBleepNo()); form.txtClinicialCOmmentsToPharmacy().setValue(currentRecord.getClinicalCommentsToPharmacy()); //TTA Status if (currentRecord.getCurrentTTAStatusIsNotNull()) { TTAStatusVo currentStatus = currentRecord.getCurrentTTAStatus(); form.txtTTAStatus().setValue(currentStatus.getStatus().toString()); if(currentRecord.getCurrentTTAStatus().getStatus().equals(TTAStatus.REJECTED)) { form.txtRejectionReason().setValue(currentStatus.getReasonForRejection()); } } if (currentRecord.getTTAMedicationsIsNotNull() && currentRecord.getTTAMedications().size() > 0) { currentRecord.getTTAMedications().sort(SortOrder.DESCENDING); for (int i = 0; i < currentRecord.getTTAMedications().size(); i++) { addGrdOrderDischMedicationRow(currentRecord.getTTAMedications().get(i)); } } }
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 Date Time cannot be set to a date in the future."); //WDEV-18762 } } 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; }