public MemberOfStaffShortVoCollection listMembersOfStaffWithPrimaryLocations(MemberOfStaffShortVo filter) { List mosList = listDomMos(filter); MemberOfStaffVoCollection voCollMos = MemberOfStaffVoAssembler.createMemberOfStaffVoCollectionFromMemberOfStaff(mosList); MemberOfStaffShortVoCollection voCollReturn = new MemberOfStaffShortVoCollection(); if (voCollMos != null) { for (int i = 0; i < voCollMos.size(); i++) { MemberOfStaffShortVo voShortMos = new MemberOfStaffShortVo(); voShortMos = voCollMos.get(i); for (int j = 0; j < voCollMos.get(i).getLocations().size(); j++) { if ( voCollMos.get(i).getLocations().get(j).getIsPrimary() != null && voCollMos.get(i).getLocations().get(j).getIsPrimary().equals(Boolean.TRUE)) voShortMos.setPrimaryLocation(voCollMos.get(i).getLocations().get(j).getLocation()); } voCollReturn.add(voShortMos); } } return voCollReturn; }
public MemberOfStaffVo getMemberOfStaff(MemberOfStaffShortVo mos) { MemberOfStaffVo newMosVo = new MemberOfStaffVo(); if (mos.getID_MemberOfStaff() == null) { MemberOfStaffShortVoAssembler.copy(newMosVo, mos); return newMosVo; } DomainFactory factory = getDomainFactory(); MemberOfStaff mosDo = (MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, mos.getID_MemberOfStaff().intValue()); MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(mosDo); if (mosVo.getHcpIsNotNull()) { HcpFilter voFilter = new HcpFilter(); voFilter.setID_Hcp(mosVo.getHcp().getID_Hcp()); ims.core.vo.Hcp vohcp = getHcp(voFilter); mosVo.setHcp(vohcp); } return mosVo; }
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; }
private MemberOfStaffVo getMOSForConfiguredJob(ClinicalNotesForEvolveTaskSettingsVo job) { if ( (job == null) || (job != null && job.getSystemInformation() == null) || (job != null && job.getSystemInformation().getCreationUser() == null) || (job != null && job.getSystemInformation().getCreationUser() == "") ) { trace("MOSForConfiguredJob is null"); return null; } String query = "select m1_1 from MemberOfStaff as m1_1 left join m1_1.appUser as a1_1 where a1_1.username = :userName"; DomainFactoryBridge factory = getDomainFactory(); List<?> results = factory.find(query, new String[] {"userName"}, new Object[] {job.getSystemInformation().getCreationUser()}); if (results != null && results.size() >0) return MemberOfStaffVoAssembler.create((MemberOfStaff)results.get(0)); else return null; }
private MemberOfStaffVo getMOSForConfiguredJob(EDSuppSummaryScheduleVo job) { if ( job == null || job.getSystemInformation() == null || job.getSystemInformation().getCreationUser() == null || job.getSystemInformation().getCreationUser().length() == 0) { trace("Member of Staff for the configured job is null"); return null; } String query = "select mos from MemberOfStaff as mos left join mos.appUser as usr where usr.username = :userName"; DomainFactoryBridge factory = getDomainFactory(); List<?> results = factory.find(query, new String[] {"userName"}, new Object[] {job.getSystemInformation().getCreationUser()}); if (results != null && results.size() >0) return MemberOfStaffVoAssembler.create((MemberOfStaff)results.get(0)); else return null; }
public MemberOfStaffShortVo deactivateMos(MemberOfStaffShortVo mosVo) throws StaleObjectException { if (mosVo.getID_MemberOfStaff() == null) { throw new DomainRuntimeException("Cannot Activate/Deactivate an MOS with NULL id!"); } DomainFactory factory = getDomainFactory(); MemberOfStaff mosBo = MemberOfStaffShortVoAssembler.extractMemberOfStaff(getDomainFactory(), mosVo); mosBo.setIsActive(!(Boolean.TRUE.equals(mosBo.isIsActive()))); if (mosBo.getHcp() != null) { mosBo.getHcp().setIsActive(mosBo.isIsActive()); } factory.save(mosBo); //WDEV-19576 MOS Master File HL7 message MemberOfStaffVo assembledMos = MemberOfStaffVoAssembler.create(mosBo); triggerMOSMasterFileEvent(assembledMos); return assembledMos; // return MemberOfStaffShortVoAssembler.create(mosBo); }
public MemberOfStaffShortVoCollection listMembersOfStaffWithPrimaryLocations(MemberOfStaffShortVo voMemberOfStaffShortVo, HcpDisType hcpSUbtype) { List mosList = null; if(HcpDisType.MEDICAL.equals(voMemberOfStaffShortVo.getHcp().getHcpType())) { mosList = listMedic(voMemberOfStaffShortVo,hcpSUbtype); } else if(HcpDisType.NURSING.equals(voMemberOfStaffShortVo.getHcp().getHcpType())) { mosList = listNurse(voMemberOfStaffShortVo,hcpSUbtype); } else if(HcpDisType.THERAPY.equals(voMemberOfStaffShortVo.getHcp().getHcpType())) { mosList = listTherapist(voMemberOfStaffShortVo,hcpSUbtype); } else mosList = listDomMos(voMemberOfStaffShortVo); MemberOfStaffVoCollection voCollMos = MemberOfStaffVoAssembler.createMemberOfStaffVoCollectionFromMemberOfStaff(mosList); MemberOfStaffShortVoCollection voCollReturn = new MemberOfStaffShortVoCollection(); if (voCollMos != null) { for (int i = 0; i < voCollMos.size(); i++) { MemberOfStaffShortVo voShortMos = new MemberOfStaffShortVo(); voShortMos = voCollMos.get(i); for (int j = 0; j < voCollMos.get(i).getLocations().size(); j++) { if ( voCollMos.get(i).getLocations().get(j).getIsPrimary() != null && voCollMos.get(i).getLocations().get(j).getIsPrimary().equals(Boolean.TRUE)) voShortMos.setPrimaryLocation(voCollMos.get(i).getLocations().get(j).getLocation()); } voCollReturn.add(voShortMos); } } return voCollReturn; }
public MemberOfStaffVo getMos(HcpLiteVo voHCP) { DomainFactory factory = getDomainFactory(); String hql = " from MemberOfStaff m " + " where m.hcp.id = :hcpid"; List mosList = factory.find(hql,new String[]{"hcpid"}, new Object[]{voHCP.getID_Hcp()}); if (mosList == null || mosList.size() == 0) return null; return MemberOfStaffVoAssembler.create((MemberOfStaff)mosList.get(0)); }
private HcpRefVo getHcpForMosRef(MemberOfStaffRefVo mosRef) { DomainFactoryBridge factory = getDomainFactory(); MemberOfStaff mosDo = (MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, mosRef.getID_MemberOfStaff().intValue()); MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(mosDo); if (mosVo.getHcpIsNotNull()) return (HcpRefVo)mosVo.getHcp(); return null; }
@Override public MemberOfStaffVo getMemberOfStaffVoFromImos(IMos iMos) { if(iMos==null) return null; DomainFactory factory = getDomainFactory(); MemberOfStaff mos =(MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, iMos.getIMosId()); return MemberOfStaffVoAssembler.create(mos); }
public ILocation[] listConfiguredUserLocations(IAppUser user) { if (user == null) throw new RuntimeException("Invalid user"); if (user.getMosId() == null) return new ILocation[0]; DomainFactory factory = getDomainFactory(); // Get the member of staff and the location from database MemberOfStaffVo memberOfStaff = MemberOfStaffVoAssembler.create((MemberOfStaff) factory.getDomainObject(MemberOfStaff.class, user.getMosId())); // If the member of staff has no locations - return false if (memberOfStaff.getLocations() == null) return new ILocation[0]; LocationLiteVoCollection locColl = new LocationLiteVoCollection(); // Check for a location for the member of staff for (int i = 0; i < memberOfStaff.getLocations().size(); i++) { HcpLocationVo hcpLocation = memberOfStaff.getLocations().get(i); // Skip to next location if the HCP location is null or HCP location doesn't have a location if (hcpLocation == null) continue; if (hcpLocation.getLocation() == null) continue; if (hcpLocation.getLocation().getIsActiveIsNotNull() && !hcpLocation.getLocation().getIsActive()) continue; if(hcpLocation.getLocation().getIsVirtualIsNotNull() && hcpLocation.getLocation().getIsVirtual()) continue; // The locations match - return true locColl.add(hcpLocation.getLocation()); } return locColl.size() == 0 ? new ILocation[0] : locColl.sort(true).toILocationArray(); }
public MemberOfStaffVo getMos(MemberOfStaffShortVo mosShort) { DomainFactory factory = getDomainFactory(); MemberOfStaff doMOS = (MemberOfStaff) factory.getDomainObject(MemberOfStaff.class, mosShort.getID_MemberOfStaff()); return MemberOfStaffVoAssembler.create(doMOS); }
/** * list member of staff including their primary location */ public MemberOfStaffShortVoCollection listMembersOfStaffWithPrimaryLocations(MemberOfStaffShortVo voMemberOfStaffShortVo,HcpDisType hcpSUbtype) { //wdev-11144 List mosList = null; if(HcpDisType.MEDICAL.equals(voMemberOfStaffShortVo.getHcp().getHcpType())) { mosList = listMedic(voMemberOfStaffShortVo,hcpSUbtype); } else if(HcpDisType.NURSING.equals(voMemberOfStaffShortVo.getHcp().getHcpType())) { mosList = listNurse(voMemberOfStaffShortVo,hcpSUbtype); } else if(HcpDisType.THERAPY.equals(voMemberOfStaffShortVo.getHcp().getHcpType())) { mosList = listTherapist(voMemberOfStaffShortVo,hcpSUbtype); } else mosList = listDomMos(voMemberOfStaffShortVo); MemberOfStaffVoCollection voCollMos = MemberOfStaffVoAssembler.createMemberOfStaffVoCollectionFromMemberOfStaff(mosList); MemberOfStaffShortVoCollection voCollReturn = new MemberOfStaffShortVoCollection(); if (voCollMos != null) { for (int i = 0; i < voCollMos.size(); i++) { MemberOfStaffShortVo voShortMos = new MemberOfStaffShortVo(); voShortMos = voCollMos.get(i); for (int j = 0; j < voCollMos.get(i).getLocations().size(); j++) { if ( voCollMos.get(i).getLocations().get(j).getIsPrimary() != null && voCollMos.get(i).getLocations().get(j).getIsPrimary().equals(Boolean.TRUE)) voShortMos.setPrimaryLocation(voCollMos.get(i).getLocations().get(j).getLocation()); } voCollReturn.add(voShortMos); } } return voCollReturn; //---------- }
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; }