@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; } } } }
public void setStatus(EDischargeComponentStatus status) { if (status.equals(EDischargeComponentStatus.EDITABLE)) { form.btnEdit().setVisible(true); } else if (status.equals(EDischargeComponentStatus.READONLY)) { form.btnEdit().setVisible(false); } form.btnEdit().setEnabled(form.getLocalContext().getIsHcpIsNotNull() && form.getLocalContext().getIsHcp());//wdev-13536 }
@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); } } }
public EDischargeComponentStatus getStatus() { // TODO Auto-generated method stub return null; }
public EDischargeComponentStatus getMedicationStatusToBeSet() { return form.getLocalContext().getMedicationStatusToBeSet(); }
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(); }
public EDischargeComponentStatus getPharmacyStatusToBeSet() { //If no record return HIDDEN status for Pharmacy tab return form.getLocalContext().getPharmacyStatusToBeSet(); }
public EDischargeComponentStatus getStatus() { return null; }