private void addDosage(ChemoDosageDetailsVo vo, grdDetailsRow row) { if(row == null || vo == null) return; row.setColMedication(vo.getPatientMedication().getOtherMedicationText()); if(vo.getPatientMedication().getPrescribedDoses().size() > 0) { String doseUnitandValue = ""; if(vo.getPatientMedication().getPrescribedDoses().get(0).getDoseIsNotNull()) doseUnitandValue += vo.getPatientMedication().getPrescribedDoses().get(0).getDose(); if(vo.getPatientMedication().getPrescribedDoses().get(0).getDoseUnitIsNotNull()) doseUnitandValue += " " + vo.getPatientMedication().getPrescribedDoses().get(0).getDoseUnit().getText(); row.setColDose(doseUnitandValue); MedicationRoute route = vo.getPatientMedication().getPrescribedDoses().get(0).getAdminRoute(); row.setColAdmin(route != null?route.toString():null); } row.setColNumberOfDoses(vo.getNumberDosesIsNotNull()?vo.getNumberDoses().toString():null); row.setValue(vo); }
private MedicationDose getDoseRowValue(DynamicGridRow row) { if (row == null) throw new CodingRuntimeException("Major Logical Error - Can not read a value from null row"); if (row.getValue() == null || !(row.getValue() instanceof MedicationDose)) { row.setValue(new MedicationDose()); } MedicationDose dose = (MedicationDose) row.getValue(); DynamicGridCell cell = row.getCells().get(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME)); dose.setDose(cell.getValue() != null ? cell.getValue().toString() : null); cell = row.getCells().get(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE)); dose.setAdminRoute(cell.getValue() != null ? (MedicationRoute) (cell.getValue()) : null); cell = row.getCells().get(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY)); dose.setDoseStartHcp(cell.getIdentifier()!= null ? (Hcp) (cell.getIdentifier()) : null); cell = row.getCells().get(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE)); dose.setDoseStartDate(cell.getValue() != null ? (Date) (cell.getValue()) : null); return dose; }
public MedicationDoseUnitCollection getUnits(MedicationRefVo medication, DoseFormIndicator form, MedicationRoute route) { if (!medication.getID_MedicationIsNotNull()) throw new DomainRuntimeException("Medication with null as id"); String hql = "select routes from Medication as medication left join medication.forms as forms left join forms.formRoutes as routes " + "left join routes.route as route left join forms.form as form where " + "(medication.id = :medId and form.id = :formId and route.id = :routeId) "; List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId","routeId"},new Object[]{medication.getID_Medication(),new Integer(form.getID()),new Integer(route.getID())}); if (dos == null || dos.size() == 0) return null; MedicationRouteVo routeVo = MedicationRouteVoAssembler.create((ims.core.clinical.domain.objects.MedicationRoute) dos.get(0)); if (routeVo==null || !routeVo.getRouteUnitsIsNotNull() ) return null; MedicationDoseUnitCollection result = new MedicationDoseUnitCollection(); for (int i = 0 ; i < routeVo.getRouteUnits().size() ; i++) { if( routeVo.getRouteUnits().get(i)!=null && routeVo.getRouteUnits().get(i).getDoseUnitIsNotNull()) result.add(routeVo.getRouteUnits().get(i).getDoseUnit()); } return result; }
private void populateCmbRoute(MedicationRouteCollection routes) { form.cmbRoute().clear(); if (routes == null) return; for (int i = 0 ; i < routes.size() ; i++) { MedicationRoute route = routes.get(i); if (route != null) { form.cmbRoute().newRow(route, route.getText()); } } }
private void openCmbRoute() { if (form.cmbRoute().getValues().size() == 0) return; if (form.cmbRoute().getValues().size()==1) { form.cmbRoute().setValue((MedicationRoute) form.cmbRoute().getValues().get(0)); cmbRouteValueChanged(); openCmbUnits(); } else form.cmbRoute().showOpened(); }
private void setDoseRowValue(DynamicGridRow row, MedicationDose dose) { if (row == null) throw new CodingRuntimeException("Major Logical Error - Can not set a dose to null row"); row.setValue(dose); if (dose == null) return; DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING); cell.setValidationMessage("Dose length is restricted to 255 characters."); cell.setValue(dose.getDose()); cell.setWidth(120); cell.setReadOnly(true); cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION); // bind to lookup cell.getItems().clear(); MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService()); for (int i = 0; i < medicationRouteCollection.size(); i++) { MedicationRoute route = medicationRouteCollection.get(i); cell.getItems().newItem(route, route.getText()); } cell.setValue(dose.getAdminRoute()); cell.setWidth(120); cell.setReadOnly(true); cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING); cell.setIdentifier(dose.getDoseStartHcp()); cell.setValue(dose.getDoseStartHcp() != null ? dose.getDoseStartHcp().toString() : ""); cell.setWidth(200); cell.setReadOnly(true); cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE); cell.setValue(dose.getDoseStartDate()); cell.setWidth(-1); cell.setReadOnly(true); row.setIdentifier(ROW_STATE_NOT_EDITABLE); }
private void newDose() { DynamicGridRow row = form.dyngrdDoses().getRows().newRow(); DynamicGridCell cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSENAME), DynamicCellType.STRING); cell.setReadOnly(false); cell.setStringMaxLength(255); cell.setValidationMessage("Dose length is restricted to 255 characters."); cell.setWidth(120); cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION); cell.setReadOnly(false); // bind to lookup cell.getItems().clear(); MedicationRouteCollection medicationRouteCollection = LookupHelper.getMedicationRoute(domain.getLookupService()); for (int i = 0; i < medicationRouteCollection.size(); i++) { MedicationRoute route = medicationRouteCollection.get(i); cell.getItems().newItem(route, route.getText()); } cell.setWidth(120); cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.STRING); cell.setReadOnly(true); cell.setIdentifier(domain.getHcpUser()); cell.setValue(domain.getHcpUser() != null ? domain.getHcpUser().toString() : ""); cell.setWidth(200); cell = row.getCells().newCell(form.dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE); cell.setReadOnly(true); cell.setValue(new Date()); cell.setWidth(-1); row.setValue(new MedicationDose()); row.setIdentifier(ROW_STATE_EDITABLE); // Update grid selection form.dyngrdDoses().setSelectedRow(row); }
private void newMedicationDoseInstance() { DynamicGridRow doseRow = form.ctnDetails().dyngrdDoses().getRows().newRow(); DynamicGridCell cell1 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSE), DynamicCellType.STRING); cell1.setStringMaxLength(255); cell1.setValidationMessage("This text is restricted to 255 characters"); cell1.setReadOnly(false); cell1.setTooltip("Please select a Dose"); cell1.setWidth(120); DynamicGridCell cell2= doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION); cell2.setReadOnly(false); bindCellToLookup(cell2, MedicationRoute.class); cell2.setTooltip("Please select a Route"); cell2.setWidth(120); DynamicGridCell cell3 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_TIMES), DynamicCellType.MULTISELECT); cell3.setReadOnly(false); bindCellToLookup(cell3, MedicationTimesOfAdministration.class); cell3.setTooltip("Please select Times"); cell3.setWidth(140); DynamicGridCell cell6= doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY_TYPE), DynamicCellType.ENUMERATION); cell6.setReadOnly(false); bindCellToLookup(cell6, MedciationCommencedDiscontinuedType.class); cell6.setValue(MedciationCommencedDiscontinuedType.MOS); cell6.setTooltip("Please select a Commenced by Type"); cell6.setAutoPostBack(true); cell6.setWidth(140); DynamicGridCell cell4 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.QUERYCOMBOBOX); Hcp hcp = (Hcp) domain.getHcpUser(); if(hcp != null) { cell4.getItems().newItem(hcp); cell4.setValue(hcp); } cell4.setReadOnly(false); cell4.setAutoPostBack(true); cell4.setTooltip("Please select a HCP"); cell4.setWidth(160); DynamicGridCell cell5 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE); cell5.setValue(new Date()); cell5.setReadOnly(false); cell5.setTooltip("Please select a Date"); cell5.setWidth(-1); doseRow.setExpanded(true); MedicationDose voNewDose = new MedicationDose(); voNewDose.setIsCopied(new Boolean(false)); doseRow.setValue(voNewDose); //wdev-1873 form.ctnDetails().dyngrdDoses().setSelectedRow(doseRow); //added for WDEV-7307 if (!engine.isDialog()){ form.ctnDetails().dyngrdDoses().resetScrollPosition(); form.ctnDetails().dyngrdDoses().setSelectedRow(doseRow); } updateControlsState(); }
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 newMedicationDoseInstance() { DynamicGridRow doseRow = form.ctnDetails().dyngrdDoses().getRows().newRow(); DynamicGridCell cell1 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSE), DynamicCellType.STRING); cell1.setStringMaxLength(255); cell1.setValidationMessage("This text is restricted to 255 characters"); cell1.setReadOnly(false); cell1.setTooltip("Please select a Dose"); cell1.setWidth(120); DynamicGridCell cell2= doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION); cell2.setReadOnly(false); bindCellToLookup(cell2, MedicationRoute.class); cell2.setTooltip("Please select a Route"); cell2.setWidth(120); DynamicGridCell cell3 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_TIMES), DynamicCellType.MULTISELECT); cell3.setReadOnly(false); bindCellToLookup(cell3, MedicationTimesOfAdministration.class); cell3.setTooltip("Please select Times"); cell3.setWidth(140); DynamicGridCell cell6= doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY_TYPE), DynamicCellType.ENUMERATION); cell6.setReadOnly(false); bindCellToLookup(cell6, MedicationCommencedDiscontinuedType.class); cell6.setValue(MedicationCommencedDiscontinuedType.MOS); cell6.setTooltip("Please select a Commenced by Type"); cell6.setAutoPostBack(true); cell6.setWidth(140); DynamicGridCell cell4 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.QUERYCOMBOBOX); Hcp hcp = (Hcp) domain.getHcpUser(); if(hcp != null) { cell4.getItems().newItem(hcp); cell4.setValue(hcp); } cell4.setReadOnly(false); cell4.setAutoPostBack(true); cell4.setTooltip("Please select a HCP"); cell4.setWidth(160); DynamicGridCell cell5 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE); cell5.setValue(new Date()); cell5.setReadOnly(false); cell5.setTooltip("Please select a Date"); //WDEV-20591 // cell5.setWidth(-1); cell5.setWidth(80); //WDEV-20591 DynamicGridCell cell7 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENT), DynamicCellType.STRING); cell7.setStringMaxLength(255); cell7.setValidationMessage("This text is restricted to 255 characters"); cell7.setReadOnly(false); cell7.setTooltip("Please enter a Comment"); cell7.setWidth(-1); doseRow.setExpanded(true); MedicationDose voNewDose = new MedicationDose(); voNewDose.setIsCopied(new Boolean(false)); doseRow.setValue(voNewDose); //wdev-1873 form.ctnDetails().dyngrdDoses().setSelectedRow(doseRow); //added for WDEV-7307 if (!engine.isDialog()){ form.ctnDetails().dyngrdDoses().resetScrollPosition(); form.ctnDetails().dyngrdDoses().setSelectedRow(doseRow); } updateControlsState(); }
private void newMedicationDoseInstance() { DynamicGridRow doseRow = form.ctnDetails().dyngrdDoses().getRows().newRow(); DynamicGridCell cell1 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_DOSE), DynamicCellType.STRING); cell1.setStringMaxLength(255); cell1.setValidationMessage("This text is restricted to 255 characters"); cell1.setReadOnly(false); cell1.setTooltip("Please select a Dose"); // cell1.setWidth(120); cell1.setWidth(60); //WDEV-21114 DynamicGridCell cell2= doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_ROUTE), DynamicCellType.ENUMERATION); cell2.setReadOnly(false); bindCellToLookup(cell2, MedicationRoute.class); cell2.setTooltip("Please select a Route"); // cell2.setWidth(120); cell2.setWidth(100); //WDEV-21114 DynamicGridCell cell3 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_TIMES), DynamicCellType.MULTISELECT); cell3.setReadOnly(false); bindCellToLookup(cell3, MedicationTimesOfAdministration.class); cell3.setTooltip("Please select Times"); cell3.setWidth(140); DynamicGridCell cell6= doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY_TYPE), DynamicCellType.ENUMERATION); cell6.setReadOnly(false); bindCellToLookup(cell6, MedicationCommencedDiscontinuedType.class); cell6.setValue(MedicationCommencedDiscontinuedType.MOS); cell6.setTooltip("Please select a Commenced by Type"); cell6.setAutoPostBack(true); cell6.setWidth(140); DynamicGridCell cell4 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_BY), DynamicCellType.QUERYCOMBOBOX); Hcp hcp = (Hcp) domain.getHcpUser(); if(hcp != null) { cell4.getItems().newItem(hcp); cell4.setValue(hcp); } cell4.setReadOnly(false); cell4.setAutoPostBack(true); cell4.setTooltip("Please select a HCP"); cell4.setWidth(160); DynamicGridCell cell5 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENCED_DATE), DynamicCellType.DATE); cell5.setValue(new Date()); cell5.setReadOnly(false); cell5.setTooltip("Please select a Date"); cell5.setWidth(80); DynamicGridCell cell7 = doseRow.getCells().newCell(form.ctnDetails().dyngrdDoses().getColumns().getByIdentifier(COL_DOSE_COMMENT), DynamicCellType.STRING); cell7.setStringMaxLength(255); cell7.setValidationMessage("This text is restricted to 255 characters"); cell7.setReadOnly(false); cell7.setTooltip("Please enter a Comment"); cell7.setWidth(-1); doseRow.setExpanded(true); MedicationDose voNewDose = new MedicationDose(); voNewDose.setIsCopied(new Boolean(false)); doseRow.setValue(voNewDose); if (!engine.isDialog()){ form.ctnDetails().dyngrdDoses().resetScrollPosition(); form.ctnDetails().dyngrdDoses().setSelectedRow(doseRow); } updateControlsState(); }
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; }