/** * Function used to list HCPs from database */ public HcpCollection listHCP(String hcpName) throws DomainInterfaceException { // Check for a non null, non empty string if (hcpName == null || hcpName.length() == 0) throw new DomainInterfaceException("Can not search HCP with empty name"); // Build HQL Query String hqlQuery = "from Hcp as hcp where hcp.mos.name.surname like :NAME or hcp.mos.name.forename like :NAME"; // Create a parameters table (array of parameters names and array of parameters values) ArrayList<String> params = new ArrayList<String>(); params.add("NAME"); ArrayList<Object> values = new ArrayList<Object>(); values.add("%" + hcpName + "%"); // Return the result of the query (Hcp collection) DomainFactory factory = getDomainFactory(); return HcpAssembler.createHcpCollectionFromHcp(factory.find(hqlQuery, params, values)); }
public Hcp getResponsibleHcpForInpatient(PatientRefVo patient) { if (patient == null || patient.getID_Patient() == null) return null; DomainFactory factory = getDomainFactory(); String hql = " select medic from InpatientEpisode as inpEp left join inpEp.pasEvent as pasEv left join pasEv.patient as pat left join pasEv.consultant as medic " + " where pat.id = :patientID"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); markers.add("patientID"); values.add(patient.getID_Patient()); List <?> list = factory.find(hql, markers, values); if (list == null || list.size() == 0) return null; return HcpAssembler.create((ims.core.resource.people.domain.objects.Hcp)list.get(0)); }
public Hcp getHCP(HcpRefVo hcpRefVo) { DomainFactory factory = getDomainFactory(); ims.core.resource.people.domain.objects.Hcp doHcp = (ims.core.resource.people.domain.objects.Hcp) factory.getDomainObject(ims.core.resource.people.domain.objects.Hcp.class, hcpRefVo.getID_Hcp()); if (Medic.class.isAssignableFrom(doHcp.getClass())) return MedicVoAssembler.create((Medic) doHcp); else if (doHcp instanceof Therapist) return TherapistVoAssembler.create((Therapist)doHcp); else if (doHcp instanceof Nurse) return NurseVoAssembler.create((Nurse) doHcp); return HcpAssembler.create(doHcp); }
public void completeComponent(ims.nursing.vo.AssessmentComponent component, AssessmentHeaderInfo assessment) throws StaleObjectException { DomainFactory factory = getDomainFactory(); // Update the VO with the completed information AssessmentComponent comp = (AssessmentComponent) factory.getDomainObject(AssessmentComponent.class, component.getID_AssessmentComponent()); comp.setIsComplete(new Boolean(true)); try { factory.save(comp); // We need to know whether to complete the actual assessment itself // too at this stage, call the // method in AssessmentComponentImpl to check whether it is required // We need to specify one component explicitly as // AssessmentComponent is not a class in it's own right AdmissionAssessment assmnt = AssessmentHeaderInfoAssembler.extractAdmissionAssessment(factory, assessment); if (assmnt.isAssessmentCompleted()) { assmnt.setDateTimeComplete(new java.util.Date()); assmnt.setHCPComplete(HcpAssembler.extractHcp(factory, (ims.core.vo.Hcp) getHcpUser())); assmnt.setAssessmentStatus(factory.getLookupInstance(AssessmentStatus.TYPE_ID, AssessmentStatus.COMPLETE.getID())); factory.save(assmnt); } } catch (DomainException e) { throw new DomainRuntimeException("DomainException occurred completing assessment component.\r\n" + e.getMessage(), e); } }
private IMos[] listByDiscipline(List hcps, String name, HcpDisType mosDiscipline) { List<IMos> hcpList = new ArrayList<IMos>(); if(hcps != null) { for(int i=0;i<hcps.size();i++) { Hcp hcp = (Hcp) hcps.get(i); if (Medic.class.isAssignableFrom(hcp.getClass())) hcpList.add(MedicVoAssembler.create((Medic)hcp)); else if (Therapist.class.isAssignableFrom(hcp.getClass())) hcpList.add(TherapistVoAssembler.create((Therapist)hcps.get(i))); else if (Nurse.class.isAssignableFrom(hcp.getClass())) hcpList.add(NurseVoAssembler.create((Nurse)hcps.get(i))); else hcpList.add(HcpAssembler.create((Hcp)hcps.get(i))); } } Collections.sort(hcpList, new HcpAdminComparator(SortOrder.ASCENDING)); IMos[] iMosArray = new IMos[hcpList.size()]; for(int i=0; i < hcpList.size(); i++) iMosArray[i] = hcpList.get(i); return iMosArray; }
public HcpDisType getCurrentUserDiscipline() { if(getSession().getUser() != null && getSession().getUser().getHcpId() != null) { DomainFactory factory = getDomainFactory(); Hcp hcp = (Hcp) factory.loadDomainObject(Hcp.class, getSession().getUser().getHcpId()); return HcpAssembler.create(hcp).getHcpType(); } return null; }
private HcpCollection listHCPs(HcpFilter filter, String subClass) { List hcps = listHCPList(filter,subClass,-1); //WDEV-11656 //iterate through domainlist and use each subclasses respective assembler to convert and add to voCollHcps //Using arraylist so can sort it locally. Not sort won't work as collection is mixed type. ArrayList hcpList = new ArrayList(); if(hcps != null) { for(int i=0;i<hcps.size();i++) { Hcp hcp = (Hcp) hcps.get(i); if (Medic.class.isAssignableFrom(hcp.getClass())){ hcpList.add(MedicVoAssembler.create((Medic)hcp)); } else if (Therapist.class.isAssignableFrom(hcp.getClass())) hcpList.add(TherapistVoAssembler.create((Therapist)hcps.get(i))); else if (Nurse.class.isAssignableFrom(hcp.getClass())) hcpList.add(NurseVoAssembler.create((Nurse)hcps.get(i))); else hcpList.add(HcpAssembler.create((Hcp)hcps.get(i))); } } Collections.sort(hcpList, new HcpAdminComparator(SortOrder.ASCENDING)); HcpCollection voCollHcps = new HcpCollection(); for(int i=0; i < hcpList.size(); i++) { voCollHcps.add((ims.core.vo.Hcp)hcpList.get(i)); } return voCollHcps; }
/** * Creates a new HCP or updates if it already exists */ public ims.core.vo.Hcp saveHCP(ims.core.vo.Hcp hcp) throws StaleObjectException { if (!hcp.isValidated()) { throw new DomainRuntimeException("HCP VO has not been validated."); } DomainFactory factory = getDomainFactory(); hcp.getName().setUppers(); Hcp doHcp = null; if (hcp instanceof MedicVo) { doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo)hcp); } else if (hcp instanceof TherapistVo) { doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo)hcp); } else if (hcp instanceof NurseVo) { doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo)hcp); } else { doHcp = HcpAssembler.extractHcp(factory, hcp); } factory.save(doHcp); hcp.setID_Hcp(doHcp.getId()); return hcp; }
public ims.core.vo.Hcp getHcpByExternalCode(TaxonomyType taxType, String codeVal) { if (codeVal == null) return null; List hcpList = getDomHcpByExternalCode(taxType, codeVal); if (hcpList != null && hcpList.size() > 0) { Hcp hcp = (Hcp)hcpList.get(0); if (hcp instanceof Medic) { return MedicVoAssembler.create((Medic)hcp); } else if (hcp instanceof Therapist) { return TherapistVoAssembler.create((Therapist)hcp); } else if (hcp instanceof Nurse) { return NurseVoAssembler.create((Nurse)hcp); } else { return HcpAssembler.create((Hcp)hcpList.get(0)); } } return null; }
public ims.core.vo.Hcp getHcp(HcpFilter filter) { DomainFactory factory = getDomainFactory(); Hcp doHcp = (Hcp) factory.getDomainObject(Hcp.class, filter.getID_Hcp()); if (Medic.class.isAssignableFrom(doHcp.getClass())) return MedicVoAssembler.create((Medic) doHcp); else if (doHcp instanceof Therapist) return TherapistVoAssembler.create((Therapist)doHcp); else if (doHcp instanceof Nurse) return NurseVoAssembler.create((Nurse) doHcp); return HcpAssembler.create(doHcp); }
public ims.core.vo.Hcp saveHcp(ims.core.vo.Hcp hcp) throws ims.domain.exceptions.StaleObjectException { if (!hcp.isValidated()) { throw new DomainRuntimeException("HCP VO has not been validated."); } DomainFactory factory = getDomainFactory(); hcp.getName().setUppers(); Hcp doHcp = null; if (hcp instanceof MedicVo) { doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) hcp); } else if (hcp instanceof TherapistVo) { doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) hcp); } else if (hcp instanceof NurseVo) { doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) hcp); } else { doHcp = HcpAssembler.extractHcp(factory, hcp); } factory.save(doHcp); hcp.setID_Hcp(doHcp.getId()); return hcp; }
public Hcp getHcpByMosId(Integer mosId) { List list = getDomainFactory().find("select m1_1.hcp from MemberOfStaff as m1_1 where (m1_1.id = :ID)", new String[] {"ID"}, new Object[] {mosId}); if(list == null || list.size() == 0) return null; return HcpAssembler.create((ims.core.resource.people.domain.objects.Hcp) list.get(0)); }
/** * Gets HCP from system */ public ims.core.vo.HcpCollection getHcp(String hcpName) throws ims.domain.exceptions.DomainInterfaceException { DomainFactory factory = getDomainFactory(); String hqlQuery = "from Hcp as hcp where (hcp.mos.name.upperSurname like :NAME or hcp.mos.name.upperForename like :NAME)"; ArrayList<String> paramNames = new ArrayList<String>(); paramNames.add("NAME"); ArrayList<Object> paramValues = new ArrayList<Object>(); paramValues.add("%" + hcpName.toUpperCase() + "%"); return HcpAssembler.createHcpCollectionFromHcp(factory.find(hqlQuery, paramNames, paramValues)); }
public Hcp getHcpById(HcpRefVo refId) { if(refId == null) throw new CodingRuntimeException("null refId passed to getHcpById() !"); DomainFactory factory = getDomainFactory(); ims.core.resource.people.domain.objects.Hcp boHcp = (ims.core.resource.people.domain.objects.Hcp)factory.getDomainObject(ims.core.resource.people.domain.objects.Hcp.class, refId.getID_Hcp()); return HcpAssembler.create(boHcp); }
public CatsReferralCurrentStatusVo getCatsReferral(CatsReferralRefVo catsReferral) { if(catsReferral == null || catsReferral.getID_CatsReferral() == null) return null; DomainFactory factory = getDomainFactory(); String query = "select catsReferral,cons from CatsReferral as catsReferral left join catsReferral.referralDetails as refDetails left join refDetails.consultant as cons where catsReferral.id = :CatsReferralId "; List<?> doCatsReferral = factory.find(query, new String[] {"CatsReferralId"}, new Object[] {catsReferral.getID_CatsReferral()}); CatsReferralCurrentStatusVoCollection voList = new CatsReferralCurrentStatusVoCollection(); CatsReferralCurrentStatusVo voCats = null; if(doCatsReferral != null && doCatsReferral.size() > 0) { for (int i = 0; i<doCatsReferral.size();i++) { if (doCatsReferral.get(i) instanceof Object[]) { Object[] ret = (Object[]) doCatsReferral.get(i); if (ret[0] instanceof CatsReferral) { voCats = CatsReferralCurrentStatusVoAssembler.create((CatsReferral) ret[0]); if (ret[1] instanceof ims.core.resource.people.domain.objects.Hcp) voCats.setResponsibleHCP(HcpAssembler.create((ims.core.resource.people.domain.objects.Hcp) ret[1])); } voList.add(voCats); } } return voList.get(0); } return null; }
public Hcp getHCP(IMos hcpRef) { if(hcpRef == null || hcpRef.getIMosHcpId() == null) return null; return HcpAssembler.create((ims.core.resource.people.domain.objects.Hcp) getDomainFactory().getDomainObject(ims.core.resource.people.domain.objects.Hcp.class, hcpRef.getIMosHcpId())); }
public ims.core.vo.Hcp getHCP(ims.core.resource.people.vo.HcpRefVo hcpRefVo) { DomainFactory factory = getDomainFactory(); Hcp doHcp = (Hcp) factory.getDomainObject(Hcp.class, hcpRefVo.getID_Hcp()); if (Medic.class.isAssignableFrom(doHcp.getClass())) return MedicVoAssembler.create((Medic) doHcp); else if (doHcp instanceof Therapist) return TherapistVoAssembler.create((Therapist)doHcp); else if (doHcp instanceof Nurse) return NurseVoAssembler.create((Nurse) doHcp); return HcpAssembler.create(doHcp); }