public MedicationRouteCollection getRoutes(MedicationRefVo medication, DoseFormIndicator form) { 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 forms.form as form where (medication.id = :medId and form.id = :formId)"; List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId"},new Object[]{medication.getID_Medication(),form.getID()}); if (dos == null || dos.size() == 0) return null; MedicationRouteLiteVoCollection routes = MedicationRouteLiteVoAssembler.createMedicationRouteLiteVoCollectionFromMedicationRoute(dos); MedicationRouteCollection result = new MedicationRouteCollection(); for (int i = 0 ; i < routes.size() ; i++) { if( routes.get(i)!=null && routes.get(i).getRouteIsNotNull()) result.add(routes.get(i).getRoute()); } return result; }
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 populateCmbForm(DoseFormIndicatorCollection forms) { form.cmbForm().clear(); if (forms==null) return; for (int i = 0 ; i < forms.size() ; i++) { DoseFormIndicator tForm = forms.get(i); if (tForm == null) continue; form.cmbForm().newRow(tForm, tForm.getIItemText()); } }
private void openCmbForm() { if (form.cmbForm().getValues().size() == 0) return; if (form.cmbForm().getValues().size()==1) { form.cmbForm().setValue((DoseFormIndicator) form.cmbForm().getValues().get(0)); cmbFormValueChanged(); openCmbRoute(); } else form.cmbForm().showOpened(); }
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 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; }