private void addPrescriptionDrug(PatientMedicationLiteVo patientMedication, DynamicGridRow row, boolean readOnly, boolean newRecord)// WDEV-13584 { if (form.dyngrdPrescription().getSelectedRow() != null) { if (row == null) { row = form.dyngrdPrescription().getSelectedRow(); } // WDEV-14054 if (row != null) { if (row.getIdentifier() != null && (row.getIdentifier().equals(NewPrescriptionRecord) || row.getIdentifier().equals(PrescriptionRecord))) { addPrescriptionDrugRow(row.getRows().newRow(), patientMedication, readOnly, newRecord);// WDEV-13584 } else if (row.getIdentifier() != null && row.getIdentifier().equals(PrescriptionDrug)) { addPrescriptionDrugRow(newRecord ? row.getParent().getRows().newRow() : row, patientMedication, readOnly, newRecord);// WDEV-13584 } row.setExpanded(true); } } }
private PatientMedicationLiteVoCollection getMedications() { PatientMedicationLiteVoCollection medications = new PatientMedicationLiteVoCollection(); for(int x = 0; x < form.grdMedication().getRows().size(); x++) { PatientMedicationLiteVo medication = form.grdMedication().getRows().get(x).getValue(); medication.setCommencedDate(form.grdMedication().getRows().get(x).getcolDate()); medication.setFrequency(form.grdMedication().getRows().get(x).getcolFrequency()); medication.setOtherMedicationText(medication.getMedication() == null ? "" : medication.getMedication().getMedicationName()); medication.setSourceofInformation(SourceofInformation.CORRESPONDENCE); medication.setPatient(form.getGlobalContext().Core.getPatientShort()); medications.add(medication); } return medications; }
private void addRowToMedication(PatientMedicationLiteVo patientMedic) { if (patientMedic == null) return; DynamicGridColumnCollection columns = form.lyrMain().tabDetails().dyngrdMedication().getColumns(); DynamicGridRow nRow = form.lyrMain().tabDetails().dyngrdMedication().getRows().newRow(); DynamicGridCell cell = nRow.getCells().newCell(columns.getByIdentifier(COLUMN_MEDICATION), DynamicCellType.ENUMERATION); if (patientMedic != null && patientMedic.getMedicationIsNotNull()) nRow.setValue(patientMedic); DynamicGridCellItem item = cell.getItems().newItem(patientMedic.getMedication().getMedicationName()); item.setValue(patientMedic.getMedication()); cell.setValue(patientMedic.getMedication()); cell.setAutoPostBack(true); cell = nRow.getCells().newCell(columns.getByIdentifier(COLUMN_BATCHNO), DynamicCellType.STRING); cell.setValue(patientMedic.getBatchNo()); cell.setStringMaxLength(20); cell = nRow.getCells().newCell(columns.getByIdentifier(COLUMN_EXPIRYDATE), DynamicCellType.DATE); cell.setValue(patientMedic.getExpiryDate()); }
private void addMedication(PatientMedicationLiteVo patientMedication, DynamicGridRow row, boolean readOnly, boolean newRecord)// WDEV-13584 { if (row == null) { row = form.dynGridPrescriptions().getSelectedRow(); } if (row.getIdentifier() != null) { if (row.getIdentifier().equals(NewPrescriptionRecord) || row.getIdentifier().equals(PrescriptionRecord)) { addMedicationRow(patientMedication,row.getRows().newRow(), readOnly, newRecord);// WDEV-13584 } else if (row.getIdentifier().equals(PrescriptionMeds)) { addMedicationRow(patientMedication, newRecord ? row.getParent().getRows().newRow() : row,readOnly, newRecord);// WDEV-13584 } } row.setExpanded(true); }
private void populateScreenFromData(PatientMedicationLiteVo medication) { clearScreen(); if(medication == null) return; if (medication.getMedication() != null) { form.qmbMedication().newRow(medication.getMedication(),medication.getMedication().getMedicationName()); form.qmbMedication().setValue(medication.getMedication()); } else { addGenericMedicationRow(true); } form.txtOtherMed().setValue(medication.getMedication() != null ? null: medication.getOtherMedicationText()); form.cmbFrequency().setValue(medication.getFrequency()); form.intNoOfDaysSupply().setValue(medication.getNoDaysSupply()); }
private boolean save() { PatientMedicationLiteVo medicationData = populateInstanceData(); String[] errors = medicationData.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } form.getGlobalContext().Emergency.setPrescriptionDrug(medicationData); form.getGlobalContext().RefMan.setPrescriptionMedication(medicationData); return true; }
private String getDrugsFromPrescription() { if(!(form.dyngrdPrescription().getValue() instanceof PrescriptionsVo)) return null; StringBuilder sb = new StringBuilder(); String comma = ""; for(int i=0; i<form.dyngrdPrescription().getSelectedRow().getRows().size(); i++) { if(!(form.dyngrdPrescription().getSelectedRow().getRows().get(i).getValue() instanceof PatientMedicationLiteVo)) continue; PatientMedicationLiteVo drug = (PatientMedicationLiteVo) form.dyngrdPrescription().getSelectedRow().getRows().get(i).getValue(); sb.append(comma); comma=", "; sb.append(drug.getMedication().getID_Medication().intValue()); } String result = sb.toString(); if (result == null || result.trim().length() == 0) return null; return result; }
private void markDrugAsRIE() { if(!(form.dyngrdPrescription().getValue() instanceof PatientMedicationLiteVo)) return; form.getLocalContext().setMedicationToBeRIE((PatientMedicationLiteVo) form.dyngrdPrescription().getValue()); engine.open(form.getForms().Core.RieConfirmationDialog); }
private void editNewPrescriptionDrug() { if(!(form.dyngrdPrescription().getValue() instanceof PatientMedicationLiteVo)) return; form.getGlobalContext().RefMan.setPrescriptionMedication((PatientMedicationLiteVo) form.dyngrdPrescription().getValue()); engine.open(form.getForms().Clinical.PrescriptionDialog); }
private void removePrescriptionDrug() { if (form.dyngrdPrescription().getValue() instanceof PatientMedicationLiteVo && form.getMode().equals(FormMode.EDIT)) { form.dyngrdPrescription().getRows().remove(form.dyngrdPrescription().getSelectedRow()); } }
private void addPrescriptionDrugRow(DynamicGridRow row, PatientMedicationLiteVo patientMedication, boolean readOnly, boolean newRecord) { DynamicGridColumn coll; DynamicGridCell cell; if (patientMedication == null) return; row.setIdentifier(PrescriptionDrug); row.setReadOnly(readOnly); if(newRecord) row.setBackColor(Color.Beige); coll = form.dyngrdPrescription().getColumns().getByIdentifier(COL_USER); cell = row.getCells().newCell(coll, DynamicCellType.HTMLVIEW); cell.setReadOnly(true); cell.setWidth(200); cell.setValue("<b><i>" + patientMedication.getMedication().getMedicationName() + "</i></b>"); coll = form.dyngrdPrescription().getColumns().getByIdentifier(COL_DRUG); coll.setCaption("Frequency"); cell = row.getCells().newCell(coll, DynamicCellType.STRING); cell.setReadOnly(true); cell.setWidth(100); cell.setValue(patientMedication != null ? (patientMedication.getFrequencyIsNotNull() ? patientMedication.getFrequency().getIItemText() : null) : null); coll = form.dyngrdPrescription().getColumns().getByIdentifier(COL_FREQUENCY); coll.setCaption("NoDaysSupply"); cell = row.getCells().newCell(coll, DynamicCellType.INT); cell.setReadOnly(true); cell.setWidth(60); cell.setValue(patientMedication != null ? (patientMedication.getNoDaysSupplyIsNotNull() ? patientMedication.getNoDaysSupply() : null) : null); row.setValue(patientMedication); }
private void addPrescriptionDrug(MedicationLiteVo medicationLiteVo, PatientMedicationLiteVo patientMedication, DynamicGridRow row, boolean readOnly, boolean newRecord) { if (form.dyngrdPrescription().getSelectedRow() != null) { if(row == null) row = form.dyngrdPrescription().getSelectedRow(); if (row != null) { if (newRecord) { if (row.getIdentifier() != null && row.getIdentifier().equals(NewPrescriptionRecord)) { addPrescriptionDrugRow(row.getRows().newRow(), medicationLiteVo, patientMedication, readOnly); } } else { if (row.getIdentifier() != null && row.getIdentifier().equals(PrescriptionRecord)) { addPrescriptionDrugRow(row.getRows().newRow(), medicationLiteVo, patientMedication, readOnly); } } if (row.getIdentifier() != null && row.getIdentifier().equals(PrescriptionDrug)) { addPrescriptionDrugRow(row.getParent().getRows().newRow(), medicationLiteVo, patientMedication, readOnly); } row.setExpanded(true); } } }
private void addMedication(MedicationVo selectedMedication) { if(selectedMedication == null) return; Date date = new Date(); GenForm.grdMedicationRow row = form.grdMedication().getRows().newRow(); row.setcolDrug(selectedMedication.getMedicationName()); row.setcolDate(date); PatientMedicationLiteVo value = new PatientMedicationLiteVo(); value.setMedication(selectedMedication); row.setValue(value); }
private void populateMedsGridFromData(PatientMedicationLiteVoCollection medicationOnReferral) { if(medicationOnReferral == null) return; for(int x = 0; x < medicationOnReferral.size(); x++) { PatientMedicationLiteVo medication = medicationOnReferral.get(x); if(medication != null) { GenForm.grdMedicationRow row = form.grdMedication().getRows().newRow(); if(medication.getMedication() != null) { row.setcolDrug(medication.getMedication().getMedicationName()); row.setTooltip(medication.getMedication().getMedicationName()); } row.setcolDate(medication.getCommencedDate()); row.setcolFrequency(medication.getFrequency()); row.setValue(medication); } } }
private boolean save() { PatientMedicationLiteVo medicationData = populateInstanceData(); String[] errors = medicationData.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } form.getGlobalContext().RefMan.setPrescriptionMedication(medicationData); return true; }
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { form.getLocalContext().setSelectedEvent(EdAssessment_CustomControlsEvents.SAVE); form.fireCustomControlValueChanged(); boolean isRecordEdited = form.dynGridPrescriptions().getValue() instanceof EDPrescriptionVo ? ((EDPrescriptionVo)form.dynGridPrescriptions().getValue()).getID_EDPrescription() != null : form.dynGridPrescriptions().getValue() instanceof PatientMedicationLiteVo ? ((EDPrescriptionVo)form.dynGridPrescriptions().getSelectedRow().getParent().getValue()).getID_EDPrescription() != null : false; if (save(isRecordEdited, false)) open(false); }
protected void onContextMenuItemClick(int menuItemID, ims.framework.Control sender) throws ims.framework.exceptions.PresentationLogicException { switch (menuItemID) { case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.NEW_PRES: addNewPrescriptionRecord(); addNewMedication(); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.EDIT_PRES: editPrescription(); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.NEW_MEDICATION: addNewMedication(); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.EDIT_MED: editMedication(); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.REMOVE_MED: removeMedication(); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.RIE_MED: markMedicationAsRIE((PatientMedicationLiteVo)form.dynGridPrescriptions().getSelectedRow().getValue()); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.RIE_PRESC: markPrescriptionAsRie((EDPrescriptionVo)form.dynGridPrescriptions().getSelectedRow().getValue()); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.PRINT: form.getLocalContext().setbReprintActionSelected(false); printPrescription((EDPrescriptionVo)form.dynGridPrescriptions().getSelectedRow().getValue()); break; case GenForm.ContextMenus.EmergencyNamespace.PrescriptionMenu.REPRINT: form.getLocalContext().setbReprintActionSelected(true); rePrintPrescription((EDPrescriptionVo)form.dynGridPrescriptions().getSelectedRow().getValue()); break; } updateControlsState(); }
private void markMedicationAsRIE(PatientMedicationLiteVo value) { if (value == null) return; form.getLocalContext().setMedicationToBeRIEd(value); form.getLocalContext().setPrescriptionToBeRIEd(null); engine.open(form.getForms().Core.RieConfirmationDialog); }
private void removeMedication() { if (form.dynGridPrescriptions().getValue() instanceof PatientMedicationLiteVo && form.getMode().equals(FormMode.EDIT)) { DynamicGridRow row = form.dynGridPrescriptions().getSelectedRow(); form.dynGridPrescriptions().getRows().remove(row); form.dynGridPrescriptions().setSelectedRow(row.getParent()); } }
private void updateControlsState() { boolean isHCPUser = domain.getHcpLiteUser() != null; boolean canPrescribe = engine.hasRight(AppRight.ED_CAN_PRESCRIBE); Object selectedGridRecord = form.dynGridPrescriptions().getValue(); DynamicGridRow selectedGridRowParent = form.dynGridPrescriptions().getSelectedRow() != null ? form.dynGridPrescriptions().getSelectedRow().getParent() : null; boolean isSavedPrescription = selectedGridRecord instanceof EDPrescriptionVo && ((EDPrescriptionVo) selectedGridRecord).getID_EDPrescriptionIsNotNull(); boolean isSavedMedication = selectedGridRecord instanceof PatientMedicationLiteVo && ((PatientMedicationLiteVo) selectedGridRecord).getID_PatientMedicationIsNotNull(); boolean isUnsavedMedication = selectedGridRecord instanceof PatientMedicationLiteVo && ((PatientMedicationLiteVo) selectedGridRecord).getID_PatientMedication() == null; boolean isCompletePrescription = isSavedPrescription && Boolean.TRUE.equals(((EDPrescriptionVo) selectedGridRecord).getIsCompleted()); boolean isPrintedPrescription = isCompletePrescription && Boolean.TRUE.equals(((EDPrescriptionVo) selectedGridRecord).getIsPrinted()); boolean isParentPrescriptionComplete = selectedGridRecord instanceof PatientMedicationLiteVo && selectedGridRowParent != null && Boolean.TRUE.equals(((EDPrescriptionVo) selectedGridRowParent.getValue()).getIsCompleted()); boolean isParentPrescriptionPrinted = selectedGridRecord instanceof PatientMedicationLiteVo && selectedGridRowParent != null && Boolean.TRUE.equals(((EDPrescriptionVo) selectedGridRowParent.getValue()).getIsPrinted()); if (!isHCPUser || Boolean.TRUE.equals(form.getLocalContext().getReadOnly())) { form.getContextMenus().Emergency.hideAllPrescriptionMenuMenuItems(); return; } form.getContextMenus().Emergency.getPrescriptionMenuNEW_PRESItem().setVisible(FormMode.VIEW.equals(form.getMode()) && isHCPUser && (selectedGridRecord == null || selectedGridRecord instanceof EDPrescriptionVo)); form.getContextMenus().Emergency.getPrescriptionMenuEDIT_PRESItem().setVisible(FormMode.VIEW.equals(form.getMode()) && isHCPUser && selectedGridRecord instanceof EDPrescriptionVo && !isCompletePrescription); form.getContextMenus().Emergency.getPrescriptionMenuNEW_MEDICATIONItem().setVisible(isHCPUser && (selectedGridRecord instanceof EDPrescriptionVo && !isCompletePrescription) || (FormMode.VIEW.equals(form.getMode()) && selectedGridRecord instanceof PatientMedicationLiteVo && selectedGridRowParent.getIdentifier().equals(PrescriptionRecord) && !isParentPrescriptionComplete)); form.getContextMenus().Emergency.getPrescriptionMenuEDIT_MEDItem().setVisible(isHCPUser && isSavedMedication && !isParentPrescriptionComplete); form.getContextMenus().Emergency.getPrescriptionMenuREMOVE_MEDItem().setVisible(FormMode.EDIT.equals(form.getMode())&& isHCPUser && isUnsavedMedication); form.getContextMenus().Emergency.getPrescriptionMenuRIE_MEDItem().setVisible(FormMode.VIEW.equals(form.getMode())&& isHCPUser && isSavedMedication && !isParentPrescriptionPrinted); form.getContextMenus().Emergency.getPrescriptionMenuRIE_PRESCItem().setVisible(FormMode.VIEW.equals(form.getMode())&& isHCPUser && isSavedPrescription); form.getContextMenus().Emergency.getPrescriptionMenuPRINTItem().setVisible(FormMode.VIEW.equals(form.getMode()) && isHCPUser && canPrescribe && isCompletePrescription && !isPrintedPrescription); form.getContextMenus().Emergency.getPrescriptionMenuREPRINTItem().setVisible(FormMode.VIEW.equals(form.getMode()) && isHCPUser && canPrescribe && isPrintedPrescription); }
private void editMedication() { if(!(form.dynGridPrescriptions().getValue() instanceof PatientMedicationLiteVo)) return; form.dynGridPrescriptions().getSelectedRow().getParent().getCells().get(getColumn(COL_AUTH_DATE)).setReadOnly(false); engine.open(form.getForms().Clinical.PrescriptionDialog, new Object[]{(PatientMedicationLiteVo) form.dynGridPrescriptions().getValue()}); }
private ArrayList<Integer> getDrugsFromPrescription() { DynamicGridRow prescRow = null; if (form.dynGridPrescriptions().getSelectedRow().getIdentifier().equals(PrescriptionRecord) || form.dynGridPrescriptions().getSelectedRow().getIdentifier().equals(NewPrescriptionRecord)) prescRow = form.dynGridPrescriptions().getSelectedRow(); if (form.dynGridPrescriptions().getSelectedRow().getIdentifier().equals(PrescriptionMeds)) prescRow = form.dynGridPrescriptions().getSelectedRow().getParent(); if (prescRow == null) return null; ArrayList<Integer> existingValues = new ArrayList<Integer>(); for(int i=0; i<prescRow.getRows().size(); i++) { if(!(prescRow.getRows().get(i).getValue() instanceof PatientMedicationLiteVo)) continue; PatientMedicationLiteVo drug = (PatientMedicationLiteVo) prescRow.getRows().get(i).getValue(); if(drug.getMedication() != null) existingValues.add(drug.getMedication().getID_Medication()); } if (existingValues == null || existingValues.size() == 0) return null; return existingValues; }
private void initialize(Object[] args) { form.getLocalContext().setPrescribedMedication(null); if (args != null && args.length > 0)//WDEV-18980 { if (args.length >= 1 && args[0] != null && args[0] instanceof PatientMedicationLiteVo) form.getLocalContext().setPrescribedMedication((PatientMedicationLiteVo) args[0]); form.getGlobalContext().RefMan.setPrescriptionMedication(null); } form.qmbMedication().setFocus(); form.getLocalContext().setbAllowFreeTextMedication(ConfigFlag.GEN.PRESCRIPTION_ALLOW_FREETEXT_MEDICATION.getValue()); //WDEV-18980 }