private void listOrderingHospitals() { LocSiteLiteMappingsVoCollection orderingHospitals = domain.listLocSites(); PatientShort ps = form.getGlobalContext().Core.getPatientShort(); if (ps==null) return; PatientIdCollection ids= ps.getIdentifiers(); if (ids==null) return; for (LocSiteLiteMappingsVo locationLiteMappingsVo : orderingHospitals) { for (PatientId patientId : ids) { if (patientId.getType().equals(PatIdType.PASID)&&patientId.getValue().startsWith(locationLiteMappingsVo.getPathMapping())) { form.cmbOrderingHosp().newRow(locationLiteMappingsVo.getProviderHospital(), locationLiteMappingsVo.getProviderHospital().getName()); continue; } } } }
public LocSiteLiteMappingsVoCollection listLocSites() { String locationName="%"; String location = locationName != null ? locationName.toUpperCase() + "%" : "%%"; StringBuffer hql = new StringBuffer(); hql.append("select ls, t.taxonomyCode"); hql.append(" from LocSite as ls"); hql.append(" left join ls.codeMappings as t left join t.taxonomyName as tn where tn =:taxonomyType"); hql.append(" and"); hql.append(" ls.upperName like :locationName"); hql.append(" and ls.isActive =:active"); hql.append(" and ls.type !=:SurgeryType"); hql.append(" and ls.isRIE is null"); hql.append(" and ls.isVirtual =:virtual");//wdev-2730 LocSiteLiteMappingsVoCollection locSitesWithMappings = new LocSiteLiteMappingsVoCollection(); List list = getDomainFactory().find(hql.toString(), new String[]{"locationName", "active", "SurgeryType","virtual","taxonomyType"}, new Object[]{location, Boolean.TRUE, getDomLookup(LocationType.SURGERY),Boolean.FALSE,getDomLookup(TaxonomyType.PATH)}); for (Object obj : list) { Object[]array = (Object[]) obj; LocSiteLiteVo lslVo = LocSiteLiteVoAssembler.create((LocSite)array[0]); LocSiteLiteMappingsVo llm= new LocSiteLiteMappingsVo(); llm.setProviderHospital(lslVo); llm.setPathMapping((String)array[1]); locSitesWithMappings.add(llm); } return locSitesWithMappings.sort(); }
private LocSiteRefVo getProviderHospital(PID pid,ProviderSystemVo providerSystem) throws HL7Exception { //Get PASID from message should be only one CX[] idList=pid.getPatientIdentifierList(); String pasidValue=null; for(int i = 0; i < idList.length; i++) { String idType; if (providerSystem.getIdtypeComponent().intValue() == 4) { idType = idList[i].getAssigningAuthority().getNamespaceID().getValue(); } else { idType = idList[i].getIdentifierTypeCode().getValue(); } if (idType == null) { throw new HL7Exception("Identifier type code must be sent in the configured component C" + providerSystem.getIdtypeComponent() + " for all repetitions of CX."); } // If the value is null then move to the next in the list String idVal = idList[i].getID().getValue(); if (idVal == null) continue; PatIdType providedType = (PatIdType) getDemog().getLookupService().getLocalLookup(PatIdType.class, PatIdType.TYPE_ID, providerSystem.getCodeSystem().getText(), idType); if (PatIdType.PASID.equals( providedType)) { pasidValue=idVal; break; } } // Now try and match the location LocSiteLiteMappingsVoCollection locSiteMappings= careContextSelectDialog.listLocSites(); for (LocSiteLiteMappingsVo locSiteLiteMappingsVo : locSiteMappings) { if(pasidValue!=null&&pasidValue.startsWith(locSiteLiteMappingsVo.getPathMapping())) { return(locSiteLiteMappingsVo.getProviderHospital()); } } return null; // Could not find it }