Ejemplo n.º 1
0
  private ClinicVo populateClinic(Message msg, ProviderSystemVo prov) throws HL7Exception {
    MFN_M05_MFELOCLCHLRLLDPLCHLCC mfn_m05 =
        (MFN_M05_MFELOCLCHLRLLDPLCHLCC) msg.get("MFN_M05_MFELOCLCHLRLLDPLCHLCC");
    LOC loc = mfn_m05.getLOC();

    String clinicCode = loc.getPrimaryKeyValueLOC().getComponent(0).toString();
    ClinicVo clinic = orgLoc.getClinicByTaxonomyCode(prov.getCodeSystem(), clinicCode);
    if (clinic == null) {
      clinic = new ClinicVo();
      TaxonomyMapCollection taxonomyMapCollection = new TaxonomyMapCollection();
      TaxonomyMap tax = new TaxonomyMap();
      tax.setTaxonomyCode(clinicCode);
      tax.setTaxonomyName(prov.getCodeSystem());
      taxonomyMapCollection.add(tax);
      clinic.setCodeMappings(taxonomyMapCollection); // .setClinicCode(clinicCode);
    }

    // WDEV-7394 - remove bracketed clinic code from clinic name
    String locName = loc.getLocationDescription().getValue();
    if (locName == null)
      throw new HL7Exception("Clinic name cannot be blank: (code is " + clinicCode + ")");

    clinic.setClinicName(locName);
    // Get the clinic's hospital by Pas Code
    // LocSiteShortVo hospitalVo =
    // orgLoc.getLocSiteByPostCode(loc.getLocationAddress(0).getZipOrPostalCode().getValue());

    // WDEV-20278
    //		LocSiteShortVo hospitalVo =
    // orgLoc.getLocSiteShortByTaxonomyType(loc.getPrimaryKeyValueLOC().getFacility().getNamespaceID().getValue(), TaxonomyType.PAS);
    LocSiteShortVo hospitalVo =
        orgLoc.getLocSiteShortByTaxonomyType(
            loc.getPrimaryKeyValueLOC().getFacility().getNamespaceID().getValue(),
            prov.getCodeSystem()); // WDEV-20278
    if (hospitalVo == null)
      throw new HL7Exception(
          "Location not found for Clinic Organisation:"
              + clinicCode
              + " using PAS Code:"
              + loc.getPrimaryKeyValueLOC().getFacility().getNamespaceID().getValue());
    clinic.setClinicLocation(hospitalVo);
    LDP ldp = mfn_m05.getMFN_M05_LDPLCHLCC().getLDP();

    if (ldp != null
        && ldp.getActiveInactiveFlag() != null
        && ldp.getActiveInactiveFlag().getValue() != null) {
      if (ldp.getActiveInactiveFlag().toString().equals("A")) clinic.setIsActive(true);
      else clinic.setIsActive(false);
    } else {
      clinic.setIsActive(true);
    }
    return clinic;
  }
Ejemplo n.º 2
0
  protected IfLocParentVo populateLocation(Message msg, ProviderSystemVo providerSystem)
      throws HL7Exception {
    MFN_M05_MFELOCLCHLRLLDPLCHLCC mfn_m05 =
        (MFN_M05_MFELOCLCHLRLLDPLCHLCC) msg.get("MFN_M05_MFELOCLCHLRLLDPLCHLCC");
    LOC loc = mfn_m05.getLOC();

    String locCode = loc.getPrimaryKeyValueLOC().getComponent(0).toString();
    String parentLocCode = loc.getPrimaryKeyValueLOC().getFacility().getNamespaceID().getValue();
    if (locCode == null) throw new HL7Exception("PAS code for Location cannot be null. - LOC-1");
    if (parentLocCode == null)
      throw new HL7Exception("Parent code for parent Location cannot be null.");
    if (locCode.equals(parentLocCode))
      throw new HL7Exception("Location code and parent Location code cannot be the same.");

    // Get the parent location by pas code
    // WDEV-20278
    //		LocationLiteVo hospitalVo = orgLoc.getLocationLiteByTaxonomyType(parentLocCode,
    // TaxonomyType.PAS);
    LocationLiteVo hospitalVo =
        orgLoc.getLocationLiteByTaxonomyType(
            parentLocCode, providerSystem.getCodeSystem()); // WDEV-20278
    if (hospitalVo == null)
      throw new HL7Exception(
          "Parent Location not found for Location:"
              + locCode
              + " using PAS Code:"
              + loc.getPrimaryKeyValueLOC().getFacility().getNamespaceID().getValue());

    // WDEV-20278
    //		IfLocParentVo locVo = ocsIfInbound.getLocParentByTaxType(locCode, TaxonomyType.PAS);
    IfLocParentVo locVo =
        ocsIfInbound.getLocParentByTaxType(locCode, providerSystem.getCodeSystem()); // WDEV-20278
    if (locVo == null) {
      locVo = new IfLocParentVo();
      locVo.setIsActive(Boolean.TRUE);
      locVo.setType(LocationType.WARD);
      // Add the Code Mappings
      TaxonomyMapCollection coll = new TaxonomyMapCollection();
      TaxonomyMap map = new TaxonomyMap();
      map.setTaxonomyCode(locCode);
      // WDEV-20278
      //			map.setTaxonomyName(TaxonomyType.PAS);
      map.setTaxonomyName(providerSystem.getCodeSystem()); // WDEV-20278
      coll.add(map);
      locVo.setCodeMappings(coll);
      locVo.setIsVirtual(Boolean.FALSE);
    }

    locVo.setAddress(
        populateAddressVoFromXAD(
            locVo.getAddress(), loc.getLocationAddress(0), providerSystem, AddressType.LOCATION));
    locVo.setName(loc.getLocationDescription().getValue());
    locVo.setUpperName(locVo.getName().toUpperCase());
    locVo.setParentLocation(hospitalVo);
    LDP ldp = mfn_m05.getMFN_M05_LDPLCHLCC().getLDP();

    if (ldp != null
        && ldp.getActiveInactiveFlag() != null
        && ldp.getActiveInactiveFlag().getValue() != null) {
      if (ldp.getActiveInactiveFlag().getValue().equals("A")) locVo.setIsActive(true);
      else locVo.setIsActive(false);
    } else {
      locVo.setIsActive(true);
    }

    return locVo;
  }