@SuppressWarnings("unchecked") public ims.core.vo.MedicationLiteVoCollection getMedications(String text) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from "); hql.append("Medication x "); hql.append(" join x.keywords as kw"); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where x.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); List resultsList = Keywords.searchByKeywords(factory, text, hql.toString(), names, values); if (resultsList.size() > 0) return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(resultsList).sort(); else return null; }
public MedicationLiteVoCollection listMedicationHotlist(String text, HcpRefVo hcp) throws DomainInterfaceException//WDEV-11888//WDEV-11979 { // WDEV-11979 - Start String hql = "select distinct med from MedicationFavourtiesForHCP as medFav left join medFav.hCP as hcp " + "left join medFav.medication as med left join med.keywords as kw where " + "(hcp.id = :hcpId and med.isActive = 1 and medFav.isRIE is null)"; ArrayList<String> names = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); names.add("hcpId"); values.add(hcp.getID_Hcp()); return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(getDomainFactory(), text, hql, names, values)); //WDEV-11979 - End /*WDEV-11979 String hql = "select distinct med from MedicationHotlist as medhot left join medhot.user as usr " + "left join medhot.hotListItem as hli left join hli.medication as med left join med.keywords as kw where" + "(medhot.user.id = :medicId and med.isActive = :active)" ; ArrayList<String> names = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); names.add("medicId"); values.add(hcp.getID_Hcp()); names.add("active"); values.add(true); return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(getDomainFactory(), text, hql, names, values)); */ }
public MedicationLiteVoCollection listFrequentMedications(Integer count, HcpRefVo hcp)//WDEV-11979 { if (hcp == null || !hcp.getID_HcpIsNotNull()) throw new DomainRuntimeException("Provided Hcp is invalid"); if (count == null || count < 1) throw new DomainRuntimeException("Count must be 1 or greater"); String hql = "select medcation from MedicationFavourtiesForHCP as medFav" + " left join medFav.hCP as hcp left join medFav.medication as medcation where " + "(hcp.id = :hcpId and medFav.isRIE is null and medcation.isActive = 1) order by medFav.count desc, upper(medcation.medicationName) asc "; List dos = getDomainFactory().find(hql,"hcpId",(Object)hcp.getID_Hcp()); if (dos == null || dos.size() == 0) return null; int i = 0 ; MedicationLiteVoCollection coll = new MedicationLiteVoCollection(); while (coll.size() < count && i < dos.size()) { coll.add(MedicationLiteVoAssembler.create((Medication) dos.get(i))); i++; } return coll; }
public MedicationLiteVoCollection listMedications(String filterMedication, String ignoredListMedications) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select distinct m from Medication m join m.keywords as kw "); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where m.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); //WDEV-20283 if (ignoredListMedications != null && ignoredListMedications.trim().length() > 0) { hql.append(" and m.id not in ("+ignoredListMedications+")"); } return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(factory, filterMedication, hql.toString(), names, values)); }
public MedicationLiteVoCollection listHotlistMedication(String name, Specialty specialty) throws DomainInterfaceException { if(name == null) throw new DomainRuntimeException("Invalid Search criteria. Medication name filter must be supplied."); if(specialty == null) throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied."); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select distinct medHotListItem from MedicationHotlist as medHotList left join medHotList.hotListItem as medHotListItem left join medHotListItem.medication as med left join med.keywords as kw "); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where med.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); hql.append(" and medHotList.specialty = :spec"); names.add("spec"); values.add(getDomLookup(specialty)); List hits = Keywords.searchByKeywords(factory, name, hql.toString(), names, values); List meds = new ArrayList(); for (int i = 0; i < hits.size(); i++) { meds.add(((MedicationHotlistItem)hits.get(i)).getMedication()); } return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(meds); }
public MedicationLiteVoCollection listMedications(String filterMedication) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select distinct m from Medication m join m.keywords as kw "); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where m.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(Keywords.searchByKeywords(factory, filterMedication, hql.toString(), names, values)); }
public MedicationLiteVoCollection listMedicationsForSpeciality( Specialty speciality) { if (speciality == null) return null; DomainFactory factory = getDomainFactory(); String condStr = "select m3_1 from MedicationHotlist as m1_1 left"; condStr += " join m1_1.hotListItem as m2_1 left join " ; condStr += "m2_1.medication as m3_1 left join m1_1.specialty "; condStr +="as l1_1 where (m3_1.isActive = 1 and m1_1.specialty.id = :speciality)"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); markers.add("speciality"); values.add(speciality.getID()); return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(factory.find(condStr,markers,values)); }
public MedicationLiteVo getMedicationLiteVo(MedicationRefVo voRef) { if(voRef == null) { throw new DomainRuntimeException("Invalid Medication record to get"); } return MedicationLiteVoAssembler.create((Medication)getDomainFactory().getDomainObject(Medication.class, voRef.getID_Medication())); }
public MedicationLiteVoCollection listHotlistMedication(String name, Specialty specialty, String ignoredListMedications) throws DomainInterfaceException { if(name == null) throw new DomainRuntimeException("Invalid Search criteria. Medication name filter must be supplied."); if(specialty == null) throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied."); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select distinct medHotListItem from MedicationHotlist as medHotList left join medHotList.hotListItem as medHotListItem left join medHotListItem.medication as med left join med.keywords as kw "); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where med.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); hql.append(" and medHotList.specialty = :spec"); names.add("spec"); values.add(getDomLookup(specialty)); //WDEV-20283 if (ignoredListMedications != null && ignoredListMedications.trim().length() > 0) { hql.append(" and med.id not in ("+ignoredListMedications+")"); } List hits = Keywords.searchByKeywords(factory, name, hql.toString(), names, values); List meds = new ArrayList(); for (int i = 0; i < hits.size(); i++) { meds.add(((MedicationHotlistItem)hits.get(i)).getMedication()); } return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(meds); }
private MedicationLiteVoCollection listMedications(String filter, boolean activeOnly) throws DomainInterfaceException { return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(listDomMedications(filter, activeOnly)).sort(); }
public IGenericItem[] listIGenericItems(String filter, CciType cciType, Boolean activeOnly) { List resultsList; try { resultsList = listDomIGenericItemInfo(filter, cciType, activeOnly.booleanValue()); } catch (DomainInterfaceException e) { return null; } if (resultsList.size() > 0) { if (cciType.equals(CciType.ALLERGEN)) { return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(resultsList).toIGenericItemArray(); } else if (cciType.equals(CciType.MEDICATION)) { return MedicationLiteVoAssembler.createMedicationLiteVoCollectionFromMedication(resultsList).toIGenericItemArray(); } else if (cciType.equals(CciType.DIAGNOSIS)) { return DiagLiteVoAssembler.createDiagLiteVoCollectionFromDiagnosis(resultsList).toIGenericItemArray(); } else if (cciType.equals(CciType.PROBLEM)) { return ClinicalProblemShortVoAssembler.createClinicalProblemShortVoCollectionFromClinicalProblem(resultsList).toIGenericItemArray(); } else if (cciType.equals(CciType.PROCEDURE)) { return ProcedureLiteVoAssembler.createProcedureLiteVoCollectionFromProcedure(resultsList).toIGenericItemArray(); } else if (cciType.equals(CciType.CANCERIMAGE)) { return CancerImagingEventLiteVoAssembler.createCancerImagingEventLiteVoCollectionFromCancerImagingEvent(resultsList).toIGenericItemArray(); } else if (cciType.equals(CciType.VACCINE)) { return VaccineLiteVoAssembler.createVaccineLiteVoCollectionFromVaccine(resultsList).toIGenericItemArray(); } else if(cciType.equals(CciType.PRESENTING_ISSUE)) { return PresentingComplaintVoAssembler.createPresentingComplaintVoCollectionFromPresentingComplaint(resultsList).toICciFullArray(); } else if(cciType.equals(CciType.TREATMENT_INTERVENTION))//WDEV-17060 { return TreatmentInterventionVoAssembler.createTreatmentInterventionVoCollectionFromTreatmentIntervention(resultsList).toICciFullArray(); } else { throw new DomainRuntimeException("Unknown CCI Type in 'listCciLite' = " + cciType.toString()); } } return null; }
public MedicationLiteVo saveMedication(MedicationLiteVo medication) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { DomainFactory factory = getDomainFactory(); Medication domMedication = MedicationLiteVoAssembler.extractMedication(factory, medication); if (domMedication.getKeywords() == null || domMedication.getKeywords().size() == 0) domMedication.setKeywords(Keywords.setupKeyWords(domMedication.getKeywords(), domMedication.getMedicationName())); if (domMedication.getKeywords().size() <= 0) throw new DomainInterfaceException("No keywords were created. Please amend Medication name."); factory.save(domMedication); return MedicationLiteVoAssembler.create(domMedication); }