public MedicLiteVoCollection listConsultants(String textTyped) { if(textTyped == null) throw new CodingRuntimeException("Cannot search on null text!"); MedicLiteVoCollection voCollMedicsLite = new MedicLiteVoCollection(); List lstMedics = listActiveMedics(textTyped); if (lstMedics != null) { for (int i = 0; i < lstMedics.size(); i++) { Hcp hcp = (Hcp) lstMedics.get(i); if (Medic.class.isAssignableFrom(hcp.getClass())) voCollMedicsLite.add(MedicLiteVoAssembler.create((Medic) hcp)); } } return voCollMedicsLite; }
private MedicLiteVoCollection listMedicsLite(String textToSearch) { MedicLiteVoCollection voCollMedicsLite = new MedicLiteVoCollection(); List lstMedics = listActiveMedics(textToSearch); if (lstMedics != null) { for (int i = 0; i < lstMedics.size(); i++) { Hcp hcp = (Hcp) lstMedics.get(i); if (Medic.class.isAssignableFrom(hcp.getClass())) voCollMedicsLite.add(MedicLiteVoAssembler.create((Medic) hcp)); } } return voCollMedicsLite; }
public MedicLiteVo getMedicLiteByExternalCode(TaxonomyType taxType, String codeVal) { if (taxType == null || codeVal == null) throw new DomainRuntimeException("External Code and type not supplied for Medic"); List hcpList = getDomHcpByExternalCode(taxType, codeVal); if (hcpList != null && hcpList.size() > 0) { Hcp hcp = (Hcp)hcpList.get(0); if (hcp instanceof Medic) { return MedicLiteVoAssembler.create((Medic)hcp); } } return null; }
public MedicLiteVoCollection listMedicsLite() { MedicLiteVoCollection voCollMedicsLite = new MedicLiteVoCollection(); List lstMedics = listActiveMedics(); if (lstMedics != null) { for (int i = 0; i < lstMedics.size(); i++) { Hcp hcp = (Hcp) lstMedics.get(i); if (Medic.class.isAssignableFrom(hcp.getClass())) voCollMedicsLite.add(MedicLiteVoAssembler.create((Medic) hcp)); } } return voCollMedicsLite; }
public MedicLiteVo getMedicLiteVo(HcpRefVo hcp) { if( hcp == null ) return null; DomainFactory factory = getDomainFactory(); List medics = factory.find("select m1_1 from Medic as m1_1 left join m1_1.mos as m2_1 left join m2_1.hcp as h1_1 where (h1_1.id = :hcpId)", new String[] {"hcpId"}, new Object[] {hcp.getID_Hcp()}); if( medics != null && medics.size() > 0) { MedicLiteVoCollection tempColl = MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(medics); if( tempColl != null && tempColl.size() > 0) return tempColl.get(0); } return null; }
public MedicLiteVoCollection listReferringConsultants(String name) { ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); StringBuilder query = new StringBuilder("SELECT medic FROM Medic AS medic "); query.append(" LEFT JOIN medic.mos AS mos "); query.append(" LEFT JOIN medic.grade AS medicGrade "); query.append(" WHERE "); query.append(" medicGrade.id = :CONSULTANT "); paramNames.add("CONSULTANT"); paramValues.add(MedicGrade.CONS.getID()); if (name != null && name.length() > 0) { query.append(" AND mos.name.upperSurname LIKE :SURNAME AND mos.name.upperForename LIKE :FORENAME " ); paramNames.add("SURNAME"); paramValues.add(name.toUpperCase() + "%"); paramNames.add("FORENAME"); paramValues.add(name.toUpperCase() + "%"); } query.append(" ORDER BY mos.name.upperSurname, mos.name.upperForename "); return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
public MedicLiteVo getMedic(MemberOfStaffRefVo memberOfStaff) { if (memberOfStaff == null || memberOfStaff.getID_MemberOfStaff() == null) return null; StringBuilder query = new StringBuilder("SELECT medic FROM Medic AS medic "); query.append(" LEFT JOIN medic.mos AS mos "); query.append(" WHERE "); query.append(" mos.id = :MOS_ID "); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("MOS_ID"); paramValues.add(memberOfStaff.getID_MemberOfStaff()); return MedicLiteVoAssembler.create((Medic) getDomainFactory().findFirst(query.toString(), paramNames, paramValues)); }
public MedicLiteVoCollection listActiveMedics(String strMedicName) { HcpFilter filter = new HcpFilter(); PersonName name = new PersonName(); name.setSurname(strMedicName); filter.setQueryName(name); filter.setHcpType(HcpDisType.MEDICAL); List hcps = listHCPList(filter,null,-1); //WDEV-11656 return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(hcps); }
public MedicLiteVoCollection listMedics(String name) { if (name == null || name.length() == 0) throw new DomainRuntimeException("Name not supplied"); DomainFactory factory = getDomainFactory(); String hql; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); PersonName medicName = new PersonName(); medicName.setSurname(name); hql = " from Medic med "; StringBuffer condStr = new StringBuffer(); String andStr = " "; condStr.append(" med.mos.name.upperSurname like :name or med.mos.name.upperForename like :name"); markers.add("name"); values.add(medicName.getSurname().toUpperCase() + "%"); andStr = " and "; condStr.append(andStr + "med.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); andStr = " and "; if (andStr.equals(" and ")) { hql += " where "; } hql += condStr.toString(); return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(factory.find(hql, markers, values)); }
public MedicLiteVoCollection listConsultants(ServiceRefVo service, String name) { if (service == null || service.getID_Service() == null) return null; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); StringBuilder query = new StringBuilder("SELECT medic FROM Medic AS medic "); query.append(" LEFT JOIN medic.mos AS mos "); query.append(" LEFT JOIN medic.grade AS medicGrade "); query.append(" LEFT JOIN medic.serviceFunction AS servFunction "); query.append(" LEFT JOIN servFunction.service AS service "); query.append(" WHERE "); query.append(" service.id = :SERVICE_ID AND medicGrade.id = :CONSULTANT "); paramNames.add("SERVICE_ID"); paramValues.add(service.getID_Service()); paramNames.add("CONSULTANT"); paramValues.add(MedicGrade.CONS.getID()); if (name != null && name.length() > 0) { query.append(" AND (mos.name.upperSurname LIKE :SURNAME OR mos.name.upperForename LIKE :FORENAME) "); paramNames.add("SURNAME"); paramValues.add(name.toUpperCase() + "%"); paramNames.add("FORENAME"); paramValues.add(name.toUpperCase() + "%"); } query.append(" ORDER BY mos.name.upperSurname, mos.name.upperForename "); return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
public IMos getMedic(HcpRefVo hcp, ServiceRefVo service) { if(service == null || service.getID_Service() == null || hcp == null || hcp.getID_Hcp() == null) return null; StringBuffer hqlConditions = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String hql = "select medic from Medic as medic left join medic.serviceFunction as servFunc left join servFunc.service as serv where medic.isActive = 1 and servFunc.isActive = 1 and medic.isHCPaResponsibleHCP = 1 "; if (hcp != null) { hqlConditions.append(" and medic.id = :medicID"); markers.add("medicID"); values.add(hcp.getID_Hcp()); } if( service != null) { hqlConditions.append(" and serv.id = :serviceID"); markers.add("serviceID"); values.add(service.getID_Service()); } DomainFactory factory = getDomainFactory(); List<?> list = factory.find((hql + hqlConditions.toString()).toString(), markers, values,400); if (list != null && list.size() > 0) return (MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(list)).toIMosArray()[0]; return null; }
public MedicLiteVoCollection listConsultants(MedicLiteVo filterVo) throws DomainInterfaceException { if (filterVo == null) throw new DomainInterfaceException("Can not search on null medic filter"); if (filterVo.getName() == null || (filterVo.getName().getSurname() == null && filterVo.getName().getForename() == null) || (filterVo.getName().getSurname().length() == 0 && filterVo.getName().getForename().length() == 0)) throw new DomainInterfaceException("Can not search on null or zero length consultant name"); String[] names; if (filterVo.getName().getSurnameIsNotNull() && filterVo.getName().getSurname().length() > 0) names = filterVo.getName().getSurname().split(" "); else names = filterVo.getName().getForename().split(" "); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = " from Medic md "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); // Build search criteria { if (markers.size() > 0) hql.append(" AND ("); else hql.append("("); for (int i = 0; i < names.length; i++) { hql.append("md.mos.name.upperSurname like :SURNAME" + i); markers.add("SURNAME" + i); values.add("%" + names[i].toUpperCase() + "%"); hql.append(" OR "); hql.append("md.mos.name.upperForename like :FORENAME" + i); markers.add("FORENAME" + i); values.add("%" + names[i].toUpperCase() + "%"); if (i != names.length - 1) hql.append(" OR "); } hql.append(")"); } if (markers.size() > 0) query += " where "; query += hql.toString(); try { List<DomainObject> listMedics; listMedics = factory.find(query, markers, values); return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(listMedics); } catch (RuntimeException e) { e.printStackTrace(); return null; } }
public MedicLiteVoCollection listConsultants(MedicLiteVo filterVo) throws DomainInterfaceException { if (filterVo == null) throw new DomainInterfaceException("Can not search on null medic filter"); if (filterVo.getName() == null || (filterVo.getName().getSurname() == null && filterVo.getName().getForename() == null) || (filterVo.getName().getSurname().length() == 00 && filterVo.getName().getForename().length() == 0)) throw new DomainInterfaceException("Can not search on null or zero length consultant name"); String[] names; if (filterVo.getName().getSurnameIsNotNull() && filterVo.getName().getSurname().length() > 0) names = filterVo.getName().getSurname().split(" "); else names = filterVo.getName().getForename().split(" "); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = " from Medic md "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); // Build search criteria { if (markers.size() > 0) hql.append(" AND ("); else hql.append("("); for (int i = 0; i < names.length; i++) { hql.append("md.mos.name.upperSurname like :SURNAME" + i); markers.add("SURNAME" + i); values.add("%" + names[i].toUpperCase() + "%"); hql.append(" OR "); hql.append("md.mos.name.upperForename like :FORENAME" + i); markers.add("FORENAME" + i); values.add("%" + names[i].toUpperCase() + "%"); if (i != names.length - 1) hql.append(" OR "); } hql.append(")"); } if (markers.size() > 0) query += " where "; query += hql.toString(); try { List<DomainObject> listMedics; listMedics = factory.find(query, markers, values); return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(listMedics); } catch (RuntimeException e) { e.printStackTrace(); return null; } }
public IMos[] listMedics(String name,HcpDisType medicType, MedicGrade medicGrade, Boolean isResponsibleHcp) { if(name == null || (name != null && name.length() == 0)) throw new DomainRuntimeException("Can not search on null name."); StringBuffer hqlConditions = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String andStr = ""; String hql = "select medic from Medic as medic where medic.isActive = 1 and (medic.mos.name.upperSurname like :hcpSname or medic.mos.name.upperForename like :hcpFname)"; markers.add("hcpSname"); values.add(name.toUpperCase() + "%"); markers.add("hcpFname"); values.add(name.toUpperCase() + "%"); andStr = " and "; if (medicGrade!=null) { hqlConditions.append(andStr+ " medic.grade.id =:idMedicGrade"); markers.add("idMedicGrade"); values.add(getDomLookup(medicGrade).getId()); andStr = " and "; } if( medicType != null) { hqlConditions.append(andStr + " medic.medicType.id =:idMedicType"); markers.add("idMedicType"); values.add(getDomLookup(medicType).getId()); andStr = " and "; } //WDEV-17096 if(isResponsibleHcp != null) { if(isResponsibleHcp) { hqlConditions.append(" and medic.isHCPaResponsibleHCP = :isRespHcp"); } else { hqlConditions.append(" and (medic.isHCPaResponsibleHCP is null or medic.isHCPaResponsibleHCP = :isRespHcp)"); } markers.add("isRespHcp"); values.add(isResponsibleHcp); } DomainFactory factory = getDomainFactory(); List<?> list = factory.find((hql + hqlConditions.toString() + " order by medic.mos.name.upperSurname , medic.mos.name.upperForename asc").toString(), markers, values,400); if (list != null && list.size() > 0) return (MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(list)).toIMosArray(); //wdev-15687 return null; }
public MedicLiteVoCollection listConsultants() { DomainFactory factory = getDomainFactory(); List lstMedics = factory.find("from Medic m where m.isActive = :bActive and m.grade = :medicGrade", new String[]{"medicGrade", "bActive"}, new Object[]{getDomLookup(MedicGrade.CONS), Boolean.TRUE}); return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(lstMedics); }
public MedicLiteVoCollection listMedics() { DomainFactory factory = getDomainFactory(); return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(factory.listDomainObjects(Medic.class)).sort(); }
public MedicLiteVoCollection getMedics(LocationRefVo locRef,HcpDisType hcpType, HcpDisType medicType, MedicGrade medicGrade) //WDEV-15691 { if( (locRef == null || locRef.getID_Location() == null) && hcpType == null) return null; DomainFactory factory = getDomainFactory(); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); String prepend = " where "; StringBuffer hql = new StringBuffer("select m1_1 from Medic as m1_1 left join m1_1.mos as m2_1 left join m2_1.locations as h1_1 left join h1_1.location as l1_1 left join m1_1.hcpType as l2_1 left join m1_1.medicType as l3_1 "); if (locRef != null) { hql.append(prepend + " l1_1.id= :idLocation "); names.add("idLocation"); values.add(locRef.getID_Location()); prepend = " and "; } if (hcpType != null ) { hql.append(prepend + " m1_1.hcpType.id =:idHcpType"); names.add("idHcpType"); values.add(getDomLookup(hcpType).getId()); prepend = " and "; } if( medicType != null) { hql.append(prepend + " m1_1.medicType.id =:idMedicType"); names.add("idMedicType"); values.add(getDomLookup(medicType).getId()); } //WDEV-15691 if( medicGrade != null) { hql.append(prepend + " m1_1.grade.id =:idMedicGrade"); names.add("idMedicGrade"); values.add(getDomLookup(medicGrade).getId()); } hql.append(" and m1_1.isActive = 1"); List medics = factory.find(hql.toString(), names, values); if (medics != null && medics.size() > 0) return MedicLiteVoAssembler.createMedicLiteVoCollectionFromMedic(medics); return null; }