public MedicWithLocationsVoCollection listMedicsForLocation(LocationRefVo location) { DomainFactory factory = getDomainFactory(); java.util.List medics = null; ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); String hql = "select distinct mos, hcpLoc.accreditationStatus " + " from MemberOfStaff as mos left join mos.hcp as hcp left join mos.locations as hcpLoc " + " where (hcpLoc.location.id = :idLocation and mos.isActive = :isActive and hcp.hcpType = :medical)"; medics = factory.find(hql, new String[]{"idLocation","isActive", "medical"}, new Object[]{location.getID_Location(), Boolean.TRUE, getDomLookup(HcpDisType.MEDICAL)}); MedicWithLocationsVoCollection voCollMedic = new MedicWithLocationsVoCollection(); Iterator it = medics.iterator(); while(it.hasNext()) { MedicWithLocationsVo voMedicWithLoc = new MedicWithLocationsVo(); Object[] lstItem = (Object[]) it.next(); MemberOfStaff doMos = (MemberOfStaff) lstItem[0]; MemberOfStaffVo voMos = new MemberOfStaffVo(); MedicVo voMedic = new MedicVo(); voMos.setID_MemberOfStaff(doMos.getId()); voMedic.setID_Hcp(doMos.getHcp().getId()); ims.core.vo.PersonName pn = new ims.core.vo.PersonName(); pn.setForename(doMos.getName().getForename()); pn.setSurname(doMos.getName().getSurname()); pn.setMiddleName(doMos.getName().getMiddleName()); if (doMos.getName().getTitle() != null) pn.setTitle(LookupHelper.getPersonTitleInstance(getLookupService(),doMos.getName().getTitle().getId())); voMos.setName(pn); voMedic.setMos(voMos); voMedicWithLoc.setMedicVo(voMedic); voMedicWithLoc.setAccreditationStatus(createAccreditationLookupInstance((LookupInstance)lstItem[1])); voCollMedic.add(voMedicWithLoc); } return voCollMedic.sort(); }
public MedicWithLocationsVoCollection listMedicsForLocation(LocationRefVo location, CaseType caseType) { DomainFactory factory = getDomainFactory(); java.util.List medics = null; ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); String hql = "select distinct mos, hcpLoc.accreditationStatus " + " from MemberOfStaff as mos left join mos.hcp as hcp left join mos.locations as hcpLoc "; if (caseType != null) hql += " left join hcpLoc.caseTypes as casTyp "; hql += " where (hcpLoc.location.id = :idLocation and mos.isActive = :isActive and hcp.hcpType = :medical "; if (caseType != null) hql += " and ( hcpLoc.accreditationStatus in (:id1, :id4, :id5, :id6) or (casTyp.instance = :caseType and hcpLoc.accreditationStatus in (:id2, :id3) ) )"; else hql += "and hcpLoc.accreditationStatus in (:accredStat, :id4, :id5, :id6)"; hql += ")"; if (caseType != null) medics = factory.find(hql, new String[]{"idLocation","isActive", "medical", "caseType", "id1", "id2", "id3", "id4", "id5", "id6"}, new Object[]{location.getID_Location(), Boolean.TRUE, getDomLookup(HcpDisType.MEDICAL), getDomLookup(caseType), getDomLookup(AccreditationLocationStatus.ACCREDITED), getDomLookup(AccreditationLocationStatus.RESTICT_ACCRED), getDomLookup(AccreditationLocationStatus.RESTRICT_ACCRED_REFERRING), getDomLookup(AccreditationLocationStatus.ACCREDITATIONSUSPENDED), getDomLookup(AccreditationLocationStatus.NOTACCREDITED), getDomLookup(AccreditationLocationStatus.REFERRINGCONSULTANT)}); else medics = factory.find(hql, new String[]{"idLocation","isActive", "medical", "accredStat", "id4", "id5", "id6" }, new Object[]{location.getID_Location(), Boolean.TRUE, getDomLookup(HcpDisType.MEDICAL), getDomLookup(AccreditationLocationStatus.ACCREDITED), getDomLookup(AccreditationLocationStatus.ACCREDITATIONSUSPENDED), getDomLookup(AccreditationLocationStatus.NOTACCREDITED), getDomLookup(AccreditationLocationStatus.REFERRINGCONSULTANT)}); MedicWithLocationsVoCollection voCollMedic = new MedicWithLocationsVoCollection(); Iterator it = medics.iterator(); while(it.hasNext()) { MedicWithLocationsVo voMedicWithLoc = new MedicWithLocationsVo(); Object[] lstItem = (Object[]) it.next(); MemberOfStaff doMos = (MemberOfStaff) lstItem[0]; MemberOfStaffVo voMos = new MemberOfStaffVo(); MedicVo voMedic = new MedicVo(); voMos.setID_MemberOfStaff(doMos.getId()); voMedic.setID_Hcp(doMos.getHcp().getId()); ims.core.vo.PersonName pn = new ims.core.vo.PersonName(); pn.setForename(doMos.getName().getForename()); pn.setSurname(doMos.getName().getSurname()); pn.setMiddleName(doMos.getName().getMiddleName()); if (doMos.getName().getTitle() != null) pn.setTitle(LookupHelper.getPersonTitleInstance(getLookupService(),doMos.getName().getTitle().getId())); voMos.setName(pn); voMedic.setMos(voMos); voMedicWithLoc.setMedicVo(voMedic); voMedicWithLoc.setAccreditationStatus(createAccreditationLookupInstance((LookupInstance)lstItem[1])); voCollMedic.add(voMedicWithLoc); } return voCollMedic.sort(); }
public MedicWithLocationsVoCollection listReferringMedicsForLocation(LocationRefVo location) { DomainFactory factory = getDomainFactory(); java.util.List medics = null; ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); String hql = "select distinct mos, hcpLoc.accreditationStatus " + " from MemberOfStaff as mos left join mos.hcp as hcp left join mos.locations as hcpLoc "; hql += " where (hcpLoc.location.id = :idLocation and mos.isActive = :isActive and hcp.hcpType = :medical "; hql += " and ( hcpLoc.accreditationStatus in (:id1, :id2, :id3) ) )"; medics = factory.find(hql, new String[]{"idLocation","isActive", "medical", "id1", "id2", "id3"}, new Object[]{location.getID_Location(), Boolean.TRUE, getDomLookup(HcpDisType.MEDICAL), getDomLookup(AccreditationLocationStatus.ACCREDITED), getDomLookup(AccreditationLocationStatus.REFERRINGCONSULTANT), getDomLookup(AccreditationLocationStatus.RESTRICT_ACCRED_REFERRING)}); MedicWithLocationsVoCollection voCollMedic = new MedicWithLocationsVoCollection(); Iterator it = medics.iterator(); while(it.hasNext()) { MedicWithLocationsVo voMedicWithLoc = new MedicWithLocationsVo(); Object[] lstItem = (Object[]) it.next(); MemberOfStaff doMos = (MemberOfStaff) lstItem[0]; MemberOfStaffVo voMos = new MemberOfStaffVo(); MedicVo voMedic = new MedicVo(); voMos.setID_MemberOfStaff(doMos.getId()); voMedic.setID_Hcp(doMos.getHcp().getId()); ims.core.vo.PersonName pn = new ims.core.vo.PersonName(); pn.setForename(doMos.getName().getForename()); pn.setSurname(doMos.getName().getSurname()); pn.setMiddleName(doMos.getName().getMiddleName()); if (doMos.getName().getTitle() != null) pn.setTitle(LookupHelper.getPersonTitleInstance(getLookupService(),doMos.getName().getTitle().getId())); voMos.setName(pn); voMedic.setMos(voMos); voMedicWithLoc.setMedicVo(voMedic); voMedicWithLoc.setAccreditationStatus(createAccreditationLookupInstance((LookupInstance)lstItem[1])); voCollMedic.add(voMedicWithLoc); } return voCollMedic.sort(); }