public MemberOfStaffVo getMemberOfStaffByTaxonomyType(String extId, TaxonomyType taxonomyType) { MemberOfStaff domMos = getDomMosByTaxonomyType(extId, taxonomyType); if (domMos == null) return null; MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(domMos); ims.core.vo.Hcp hcp = null; if (domMos.getHcp() instanceof Medic) { hcp = MedicVoAssembler.create((Medic)domMos.getHcp()); } else if (domMos.getHcp() instanceof Nurse) { hcp = NurseVoAssembler.create((Nurse)domMos.getHcp()); } else if (domMos.getHcp() instanceof Therapist) { hcp = TherapistVoAssembler.create((Therapist)domMos.getHcp()); } mosVo.setHcp(hcp); return mosVo; }
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); }
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; }
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 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); }
public MemberOfStaffVo saveMosVo(MemberOfStaffVo voMos) throws StaleObjectException, DomainInterfaceException, UniqueKeyViolationException { if (!voMos.isValidated()) throw new DomainRuntimeException("Member of staff has not been validated"); DomainFactory factory = getDomainFactory(); Hcp doHcp = null; voMos.getName().setUppers(); if (voMos.getHcpIsNotNull()) { //Ensure the HCP is pointing back to the same MOS, ie the 1-1 bidirectional must be correct. voMos.getHcp().setMos(voMos); //WDEV-3653 added checks for getHcpTypeIsNotNull if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.MEDICAL)) doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) voMos.getHcp()); else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.NURSING)) doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) voMos.getHcp()); else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.THERAPY)) doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) voMos.getHcp()); else doHcp = HcpAssembler.extractHcp(factory, voMos.getHcp()); //If we're adding a new MemberOfStaff, but the Associated hcp already exists if (null == voMos.getID_MemberOfStaff() && doHcp.getId() != null) { throw new DomainInterfaceException("Hcp is already associated with another Member Of Staff"); } if (null == doHcp.isIsActive() && doHcp.isIsActive() == null) // wdev-3819 doHcp.setIsActive(Boolean.TRUE); } if (null == voMos.getID_MemberOfStaff() && !voMos.getIsActiveIsNotNull()) // wdev-3819 voMos.setIsActive(Boolean.TRUE); MemberOfStaff domMemberOfStaff = MemberOfStaffVoAssembler.extractMemberOfStaff(factory, voMos); domMemberOfStaff.setHcp(doHcp); domMemberOfStaff.getCodeMappings().clear(); List mappings = TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMos.getCodeMappings()); domMemberOfStaff.setCodeMappings(mappings); domMemberOfStaff.getCommChannels().clear(); List commChannels = CommChannelVoAssembler.extractCommunicationChannelList(factory,voMos.getCommChannels()); domMemberOfStaff.setCommChannels(commChannels); try { //clearMosTaxonomyMaps(voMos,factory); factory.save(domMemberOfStaff); } catch (UnqViolationUncheckedException e) { String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMemberOfStaff, "codeMappings", voMos.getCodeMappings(), "getName"); if(dupMessage != null) throw new UniqueKeyViolationException(dupMessage); throw(e); } /*catch (ForeignKeyViolationException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ //JME: 20060814 : WDEV-1231 this.clearMosAndHcp(); return MemberOfStaffVoAssembler.create(domMemberOfStaff); }
public MemberOfStaffVo saveMosVo(MemberOfStaffVo voMos) throws StaleObjectException, DomainInterfaceException, UniqueKeyViolationException { if (!voMos.isValidated()) throw new DomainRuntimeException("Member of staff has not been validated"); DomainFactory factory = getDomainFactory(); Hcp doHcp = null; voMos.getName().setUppers(); if (voMos.getHcpIsNotNull()) { //Ensure the HCP is pointing back to the same MOS, ie the 1-1 bidirectional must be correct. voMos.getHcp().setMos(voMos); //WDEV-3653 added checks for getHcpTypeIsNotNull if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.MEDICAL)) doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) voMos.getHcp()); else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.NURSING)) doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) voMos.getHcp()); else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.THERAPY)) doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) voMos.getHcp()); else doHcp = HcpAssembler.extractHcp(factory, voMos.getHcp()); //If we're adding a new MemberOfStaff, but the Associated hcp already exists if (null == voMos.getID_MemberOfStaff() && doHcp.getId() != null) { throw new DomainInterfaceException("Hcp is already associated with another Member Of Staff"); } if (null == doHcp.isIsActive() && doHcp.isIsActive() == null) // wdev-3819 doHcp.setIsActive(Boolean.TRUE); } if (null == voMos.getID_MemberOfStaff() && !voMos.getIsActiveIsNotNull()) // wdev-3819 voMos.setIsActive(Boolean.TRUE); MemberOfStaff domMemberOfStaff = MemberOfStaffVoAssembler.extractMemberOfStaff(factory, voMos); domMemberOfStaff.setHcp(doHcp); domMemberOfStaff.getCodeMappings().clear(); List mappings = TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMos.getCodeMappings()); domMemberOfStaff.setCodeMappings(mappings); domMemberOfStaff.getCommChannels().clear(); List commChannels = CommChannelVoAssembler.extractCommunicationChannelList(factory,voMos.getCommChannels()); domMemberOfStaff.setCommChannels(commChannels); try { //clearMosTaxonomyMaps(voMos,factory); factory.save(domMemberOfStaff); } catch (UnqViolationUncheckedException e) { String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMemberOfStaff, "codeMappings", voMos.getCodeMappings(), "getName"); if(dupMessage != null) throw new UniqueKeyViolationException(dupMessage); throw(e); } /*catch (ForeignKeyViolationException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ //JME: 20060814 : WDEV-1231 this.clearMosAndHcp(); //WDEV-19576 MOS Master File HL7 message MemberOfStaffVo assembledMos = MemberOfStaffVoAssembler.create(domMemberOfStaff); triggerMOSMasterFileEvent(assembledMos); return assembledMos; }