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; }
public MedicationLiteVoCollection listMedications(String filter, String ignored, Specialty specialty, Boolean excludeControlledDrugs) { if(filter == null) return null; filter = filter.trim().toUpperCase(); if(filter == null || filter.length() == 0) return null; DomainFactory factory = getDomainFactory(); Connection conection = factory.getJdbcConnection(); StringBuffer sql = new StringBuffer(); sql.append("select a.id, a.medication, a.noofdayssu, l.id, l.text from shcl_medicationhotl s1 LEFT OUTER JOIN shcl_medicationhot2 s2 ON s1.id = s2.shcl_medicationhotl_hotlistite LEFT OUTER JOIN core_medication2 a ON s2.medication = a.id LEFT OUTER JOIN core_medication2_keywords k ON a.id = k.id LEFT OUTER JOIN applookup_instance l ON a.lkp_frequencyd = l.id where (k.keyword like ? or a.medication like ?) and a.isactive = 1 "); if(specialty != null) { sql.append(" and s1.lkp_specialty = ? "); } if (ignored != null && ignored.trim().length() > 0) { sql.append(" and a.id not in ("+ignored+")"); } if (Boolean.TRUE.equals(excludeControlledDrugs)) //WDEV-18980 { sql.append(" and (a.iscontroll is null OR a.iscontroll = 0)"); } sql.append(" order by upper(a.medication)"); MedicationLiteVoCollection medicationColl = new MedicationLiteVoCollection(); PreparedStatement ps; try { ps = conection.prepareCall(sql.toString()); ps.setString(1, filter + "%"); ps.setString(2, filter + "%"); if(specialty != null) { ps.setInt(3, specialty.getID()); } //ps.setMaxRows(10); ResultSet rs = ps.executeQuery(); while( rs.next() ) { MedicationLiteVo vo = new MedicationLiteVo(); vo.setID_Medication(Integer.valueOf(rs.getString(1))); vo.setMedicationName(rs.getString(2)); vo.setNoOfDaysSupplyDefault(rs.getString(3) != null ? Integer.valueOf(rs.getString(3)) : null); vo.setFrequencyDefault((rs.getString(4) != null && rs.getString(5) != null) ? new MedicationFrequency(Integer.valueOf(rs.getString(4)), rs.getString(5), true) : null); medicationColl.add(vo); } } catch (SQLException e) { e.printStackTrace(); } return medicationColl; }