Пример #1
0
  // WDEV-19576
  public Message populateMessage(IHL7OutboundMessageHandler event) throws Exception {
    LOG.debug("M05VoMapper populateMessage: entry");
    MFN_M05 message = new MFN_M05();
    MFI mfi = message.getMFI();
    MFE mfe = message.getMFN_M05_MFELOCLCHLRLLDPLCHLCC().getMFE();
    LOC loc = message.getMFN_M05_MFELOCLCHLRLLDPLCHLCC().getLOC();
    LDP ldp = message.getMFN_M05_MFELOCLCHLRLLDPLCHLCC().getMFN_M05_LDPLCHLCC().getLDP();

    if (event instanceof WardMessageQueueVo) {
      WardMessageQueueVo feedVo = (WardMessageQueueVo) event;
      ifWardMessageQueueVo wardDetails = adt.getWardMessageQueueDetails(feedVo);

      // MFE-1 Record Level Event Code (ID)
      // [MAD for new record, MUP for updated record]
      mfe.getRecordLevelEventCode().setValue("MAD");
      if (wardDetails.getSystemInformation().getLastupdateDateTime() != null) {
        mfe.getRecordLevelEventCode().setValue("MUP");
      }

      // MFI-4 Entered Date Time (TS)
      if (wardDetails.getSystemInformation().getLastupdateDateTime() != null) {
        mfi.getEnteredDateTime()
            .getTimeOfAnEvent()
            .setValue(
                wardDetails
                    .getSystemInformation()
                    .getLastupdateDateTime()
                    .toString(DateTimeFormat.ISO));
      } else if (wardDetails.getSystemInformation().getCreationDateTime() != null) {
        mfi.getEnteredDateTime()
            .getTimeOfAnEvent()
            .setValue(
                wardDetails
                    .getSystemInformation()
                    .getCreationDateTime()
                    .toString(DateTimeFormat.ISO));
      }

      // LOC-1-1 Point of care (IS)
      // LDP-1-1 Point of care (IS)
      if (wardDetails.getCodeMappings() != null) {
        for (int i = 0; i < wardDetails.getCodeMappings().size(); i++) {
          TaxonomyMap codeMapping = wardDetails.getCodeMappings().get(i);
          if (codeMapping.getTaxonomyCode() != null
              && codeMapping.getTaxonomyCode().length() > 0
              // WDEV-20278
              && codeMapping
                  .getTaxonomyName()
                  .equals(event.getProviderSystem().getCodeSystem())) // WDEV-20278
          {
            loc.getPrimaryKeyValueLOC()
                .getPointOfCare()
                .setValue(codeMapping.getTaxonomyCode().toString());
            ldp.getPrimaryKeyValueLDP()
                .getPointOfCare()
                .setValue(codeMapping.getTaxonomyCode().toString());
          }
        }
      }

      // LOC-1-4 Facility (HD)
      // LDP-1-4 Facility (HD)
      if (wardDetails.getParentLocation() != null
          && wardDetails.getParentLocation().getCodeMappings() != null) {
        for (int i = 0; i < wardDetails.getParentLocation().getCodeMappings().size(); i++) {
          TaxonomyMap codeMapping = wardDetails.getParentLocation().getCodeMappings().get(i);
          if (codeMapping.getTaxonomyCode() != null
              && codeMapping.getTaxonomyCode().length() > 0
              // WDEV-20278
              && codeMapping
                  .getTaxonomyName()
                  .equals(event.getProviderSystem().getCodeSystem())) // WDEV-20278
          {
            loc.getPrimaryKeyValueLOC()
                .getFacility()
                .getNamespaceID()
                .setValue(codeMapping.getTaxonomyCode());
            ldp.getPrimaryKeyValueLDP()
                .getFacility()
                .getNamespaceID()
                .setValue(codeMapping.getTaxonomyCode());
          }
        }
      }

      // LOC-1-9 Location name (ST)
      // LDP-1-9 Location name (ST)
      // LOC-2 Location description (ST)
      // LDP-2 Location description (CE)
      if (wardDetails.getName() != null && wardDetails.getName().length() > 0) {
        loc.getPrimaryKeyValueLOC().getLocationDescription().setValue(wardDetails.getName());
        ldp.getPrimaryKeyValueLDP().getLocationDescription().setValue(wardDetails.getName());
        loc.getLocationDescription().setValue(wardDetails.getName());
        ldp.getLocationDepartment().getIdentifier().setValue(wardDetails.getName());
      }

      // LOC-3 Location type (IS)
      if (wardDetails.getType() != null) {
        loc.getLocationTypeLOC(0)
            .setValue(
                svc.getRemoteLookup(
                    wardDetails.getType().getID(),
                    event.getProviderSystem().getCodeSystem().getText()));
      }

      // LOC-5 Address (XAD)
      if (wardDetails.getAddress() != null) {
        renderAddressVoToXAD(
            wardDetails.getAddress(), loc.getLocationAddress(0), event.getProviderSystem());

        // WDEV-20271 Move code commented out below to here
        // LOC-6 Location Phone (XTN)
        if (wardDetails.getAddress().getPhone() != null
            && wardDetails.getAddress().getPhone().length() > 0) {
          loc.getLocationPhone(0).getTelecommunicationUseCode().setValue("WPN");
          loc.getLocationPhone(0).getTelecommunicationEquipmentType().setValue("PH");
          loc.getLocationPhone(0).getAnyText().setValue(wardDetails.getAddress().getPhone());
        }
        // LOC-6 Location fax
        if (wardDetails.getAddress().getFax() != null
            && wardDetails.getAddress().getFax().length() > 0) {
          if (wardDetails.getAddress().getPhoneIsNotNull()) {
            loc.getLocationPhone(1).getTelecommunicationUseCode().setValue("WPN");
            loc.getLocationPhone(1).getTelecommunicationEquipmentType().setValue("FX");
            loc.getLocationPhone(1).getAnyText().setValue(wardDetails.getAddress().getFax());
          } else {
            loc.getLocationPhone(0).getTelecommunicationUseCode().setValue("WPN");
            loc.getLocationPhone(0).getTelecommunicationEquipmentType().setValue("FX");
            loc.getLocationPhone(0).getAnyText().setValue(wardDetails.getAddress().getFax());
          }
        }
        // LOC-6 Location Phone (XTN)
        if (wardDetails.getAddress().getOtherphone() != null
            && wardDetails.getAddress().getOtherphone().length() > 0) {
          if (wardDetails.getAddress().getPhoneIsNotNull()
              && wardDetails.getAddress().getFaxIsNotNull()) {
            loc.getLocationPhone(2).getTelecommunicationUseCode().setValue("WPN");
            loc.getLocationPhone(2).getTelecommunicationEquipmentType().setValue("PH");
            loc.getLocationPhone(2).getAnyText().setValue(wardDetails.getAddress().getOtherphone());
          } else if (wardDetails.getAddress().getPhoneIsNotNull()
              && wardDetails.getAddress().getFax() == null) {
            loc.getLocationPhone(1).getTelecommunicationUseCode().setValue("WPN");
            loc.getLocationPhone(1).getTelecommunicationEquipmentType().setValue("PH");
            loc.getLocationPhone(1).getAnyText().setValue(wardDetails.getAddress().getOtherphone());
          } else if (wardDetails.getAddress().getPhone() == null
              && wardDetails.getAddress().getFax() == null) {
            loc.getLocationPhone(0).getTelecommunicationUseCode().setValue("WPN");
            loc.getLocationPhone(0).getTelecommunicationEquipmentType().setValue("PH");
            loc.getLocationPhone(0).getAnyText().setValue(wardDetails.getAddress().getOtherphone());
          }
        }
        // WDEV-20271
      }

      //			//LOC-6 Location Phone (XTN)
      //			if(wardDetails.getAddress().getPhone() !=null &&
      // wardDetails.getAddress().getPhone().length() > 0)
      //			{
      //				loc.getLocationPhone(0).getTelecommunicationUseCode().setValue("WPN");
      //				loc.getLocationPhone(0).getTelecommunicationEquipmentType().setValue("PH");
      //				loc.getLocationPhone(0).getAnyText().setValue(wardDetails.getAddress().getPhone());
      //			}
      //			//LOC-6 Location fax
      //			if(wardDetails.getAddress().getFax() != null &&
      // wardDetails.getAddress().getFax().length() > 0)
      //			{
      //				if(wardDetails.getAddress().getPhoneIsNotNull())
      //				{
      //					loc.getLocationPhone(1).getTelecommunicationUseCode().setValue("WPN");
      //					loc.getLocationPhone(1).getTelecommunicationEquipmentType().setValue("FX");
      //					loc.getLocationPhone(1).getAnyText().setValue(wardDetails.getAddress().getFax());
      //				}
      //				else
      //				{
      //					loc.getLocationPhone(0).getTelecommunicationUseCode().setValue("WPN");
      //					loc.getLocationPhone(0).getTelecommunicationEquipmentType().setValue("FX");
      //					loc.getLocationPhone(0).getAnyText().setValue(wardDetails.getAddress().getFax());
      //				}
      //			}
      //			//LOC-6 Location Phone (XTN)
      //			if(wardDetails.getAddress().getOtherphone() != null &&
      // wardDetails.getAddress().getOtherphone().length() > 0)
      //			{
      //				if(wardDetails.getAddress().getPhoneIsNotNull() &&
      // wardDetails.getAddress().getFaxIsNotNull())
      //				{
      //					loc.getLocationPhone(2).getTelecommunicationUseCode().setValue("WPN");
      //					loc.getLocationPhone(2).getTelecommunicationEquipmentType().setValue("PH");
      //
      //	loc.getLocationPhone(2).getAnyText().setValue(wardDetails.getAddress().getOtherphone());
      //				}
      //				else if(wardDetails.getAddress().getPhoneIsNotNull() &&
      // wardDetails.getAddress().getFax()==null)
      //				{
      //					loc.getLocationPhone(1).getTelecommunicationUseCode().setValue("WPN");
      //					loc.getLocationPhone(1).getTelecommunicationEquipmentType().setValue("PH");
      //
      //	loc.getLocationPhone(1).getAnyText().setValue(wardDetails.getAddress().getOtherphone());
      //				}
      //				else if(wardDetails.getAddress().getPhone()==null &&
      // wardDetails.getAddress().getFax()==null)
      //				{
      //					loc.getLocationPhone(0).getTelecommunicationUseCode().setValue("WPN");
      //					loc.getLocationPhone(0).getTelecommunicationEquipmentType().setValue("PH");
      //
      //	loc.getLocationPhone(0).getAnyText().setValue(wardDetails.getAddress().getOtherphone());
      //				}
      //			}

      // LPD-6 Active/Inactive flag (ID)
      if (wardDetails.getIsActive() != null
          && wardDetails.getIsActive().toString().equalsIgnoreCase("TRUE")) {
        ldp.getActiveInactiveFlag().setValue("A");
      } else ldp.getActiveInactiveFlag().setValue("I");

    } else if (event instanceof GPPracticeMessageQueueVo) {
      GPPracticeMessageQueueVo feedVo = (GPPracticeMessageQueueVo) event;
      ifGPPracticeMessageQueueVo gPPracticeDetails = adt.getGPPracticeMessageQueueDetails(feedVo);

      // MFI-4 Entered Date Time (TS)
      if (gPPracticeDetails.getSystemInformation() != null
          && gPPracticeDetails.getSystemInformation().getLastupdateDateTime() != null) {
        mfi.getEnteredDateTime()
            .getTimeOfAnEvent()
            .setValue(
                gPPracticeDetails
                    .getSystemInformation()
                    .getLastupdateDateTime()
                    .toString(DateTimeFormat.ISO));
      } else if (gPPracticeDetails.getSystemInformation() != null
          && gPPracticeDetails.getSystemInformation().getCreationDateTime() != null) {
        mfi.getEnteredDateTime()
            .getTimeOfAnEvent()
            .setValue(
                gPPracticeDetails
                    .getSystemInformation()
                    .getCreationDateTime()
                    .toString(DateTimeFormat.ISO));
      }

      // MFE-1 Record Level Event Code (ID)
      // [MAD for new record, MUP for updated record]
      mfe.getRecordLevelEventCode().setValue("MAD");
      if (gPPracticeDetails.getSystemInformation() != null
          && gPPracticeDetails.getSystemInformation().getLastupdateDateTime() != null) {
        mfe.getRecordLevelEventCode().setValue("MUP");
      }

      // LOC-1-1 Point of care (IS)
      // LDP-1-1 Point of care (IS)
      if (gPPracticeDetails.getCodeMappings() != null) {
        for (int i = 0; i < gPPracticeDetails.getCodeMappings().size(); i++) {
          TaxonomyMap codeMapping = gPPracticeDetails.getCodeMappings().get(i);
          if (codeMapping.getTaxonomyCode() != null
              && codeMapping.getTaxonomyCode().length() > 0
              && codeMapping.getTaxonomyName().equals(TaxonomyType.NAT_LOC_CODE)) {
            loc.getPrimaryKeyValueLOC()
                .getPointOfCare()
                .setValue(codeMapping.getTaxonomyCode().toString());
            ldp.getPrimaryKeyValueLDP()
                .getPointOfCare()
                .setValue(codeMapping.getTaxonomyCode().toString());
            break;
          }
        }
      }

      // LOC-1-4 Facility (HD)
      if (gPPracticeDetails.getPctCode() != null && gPPracticeDetails.getPctCode().length() > 0) {
        loc.getPrimaryKeyValueLOC()
            .getFacility()
            .getNamespaceID()
            .setValue(gPPracticeDetails.getPctCode());
        ldp.getPrimaryKeyValueLDP()
            .getFacility()
            .getNamespaceID()
            .setValue(gPPracticeDetails.getPctCode());
      }

      // LOC-1-9 Location description (ST)
      // LOC-2 Location description (ST)
      // LPD-2 Location department (CE)
      if (gPPracticeDetails.getName() != null && gPPracticeDetails.getName().length() > 0) {
        loc.getPrimaryKeyValueLOC().getLocationDescription().setValue(gPPracticeDetails.getName());
        loc.getLocationDescription().setValue(gPPracticeDetails.getName());
        ldp.getPrimaryKeyValueLDP().getLocationDescription().setValue(gPPracticeDetails.getName());
        ldp.getLocationDepartment().getIdentifier().setValue(gPPracticeDetails.getName());
      }

      // LOC-3 Location type (IS)
      if (gPPracticeDetails.getType() != null) {
        loc.getLocationTypeLOC(0)
            .setValue(
                svc.getRemoteLookup(
                    gPPracticeDetails.getType().getID(),
                    event.getProviderSystem().getCodeSystem().getText()));
      }

      // LOC-5 Address (XAD)
      if (gPPracticeDetails.getAddress() != null) {
        renderOrgAddressVoToXAD(
            gPPracticeDetails.getAddress(), loc.getLocationAddress(0), event.getProviderSystem());
      }

      // LOC-6 Location Phone  (XTN)
      if (gPPracticeDetails.getCommChannelsIsNotNull()) {
        int comChannelCount = 0;

        for (int i = 0; i < gPPracticeDetails.getCommChannels().size(); i++) {
          CommChannelVo commVo = gPPracticeDetails.getCommChannels().get(i);

          if (commVo.getCommValue() != null && commVo.getCommValue().length() > 0) {
            if (commVo.getChannelType().equals(ChannelType.EMAIL)) {
              loc.getLocationPhone(comChannelCount).getTelecommunicationUseCode().setValue("NET");
              loc.getLocationPhone(comChannelCount)
                  .getTelecommunicationEquipmentType()
                  .setValue("Internet");
              loc.getLocationPhone(comChannelCount).getAnyText().setValue(commVo.getCommValue());
              comChannelCount++;
            } else if (commVo.getChannelType().equals(ChannelType.MOBILE)) {
              loc.getLocationPhone(comChannelCount).getTelecommunicationUseCode().setValue("WPN");
              loc.getLocationPhone(comChannelCount)
                  .getTelecommunicationEquipmentType()
                  .setValue("CP");
              loc.getLocationPhone(comChannelCount).getAnyText().setValue(commVo.getCommValue());
              comChannelCount++;
            } else if (commVo.getChannelType().equals(ChannelType.HOME_PHONE)) {
              loc.getLocationPhone(comChannelCount).getTelecommunicationUseCode().setValue("WPN");
              loc.getLocationPhone(comChannelCount)
                  .getTelecommunicationEquipmentType()
                  .setValue("PH");
              loc.getLocationPhone(comChannelCount).getAnyText().setValue(commVo.getCommValue());
              comChannelCount++;
            } else if (commVo.getChannelType().equals(ChannelType.FAX)) {
              loc.getLocationPhone(comChannelCount).getTelecommunicationUseCode().setValue("WPN");
              loc.getLocationPhone(comChannelCount)
                  .getTelecommunicationEquipmentType()
                  .setValue("FX");
              loc.getLocationPhone(comChannelCount).getAnyText().setValue(commVo.getCommValue());
              comChannelCount++;
            } else if (commVo.getChannelType().equals(ChannelType.WORK_PHONE)) {
              loc.getLocationPhone(comChannelCount).getTelecommunicationUseCode().setValue("WPN");
              loc.getLocationPhone(comChannelCount)
                  .getTelecommunicationEquipmentType()
                  .setValue("PH");
              loc.getLocationPhone(comChannelCount).getAnyText().setValue(commVo.getCommValue());
              comChannelCount++;
            } else if (commVo.getChannelType().equals(ChannelType.GEN_PHONE)) {
              loc.getLocationPhone(comChannelCount).getTelecommunicationUseCode().setValue("WPN");
              loc.getLocationPhone(comChannelCount)
                  .getTelecommunicationEquipmentType()
                  .setValue("PH");
              loc.getLocationPhone(comChannelCount).getAnyText().setValue(commVo.getCommValue());
              comChannelCount++;
            } else if (commVo.getChannelType().equals(ChannelType.BLEEP)) {
              loc.getLocationPhone(comChannelCount).getTelecommunicationUseCode().setValue("BPN");
              loc.getLocationPhone(comChannelCount)
                  .getTelecommunicationEquipmentType()
                  .setValue("BP");
              loc.getLocationPhone(comChannelCount).getAnyText().setValue(commVo.getCommValue());
              comChannelCount++;
            }
          }
        }
      }

      // LDP-6 Active/inactive flag  (ID)
      if (gPPracticeDetails.getIsActive() != null
          && gPPracticeDetails.getIsActive().toString().equalsIgnoreCase("TRUE")) {
        ldp.getActiveInactiveFlag().setValue("A");
      } else ldp.getActiveInactiveFlag().setValue("I");
    }

    populateMSH(
        event.getProviderSystem(),
        message.getMSH(),
        Long.toString(new java.util.Date().getTime()),
        "MFN",
        "M05");

    // MFI-1 Master File Identifier (CE)
    mfi.getMasterFileIdentifier().getIdentifier().setValue("LOC");

    // MFI-2 Master File Application Identifier (HD) (same as MSH-3 Sending Application)
    if (message.getMSH().getSendingApplication().getNamespaceID().getValue().length() > 0
        && message.getMSH().getSendingApplication().getNamespaceID() != null) {
      mfi.getMasterFileApplicationIdentifier()
          .getNamespaceID()
          .setValue(message.getMSH().getSendingApplication().getNamespaceID().getValue());
    }

    // MFE-4 Primary key value (PL)
    // [Same as LOC-1]
    if (message.getMFN_M05_MFELOCLCHLRLLDPLCHLCC().getLOC() != null) {
      PL type = new PL();
      type = message.getMFN_M05_MFELOCLCHLRLLDPLCHLCC().getLOC().getPrimaryKeyValueLOC();
      mfe.getPrimaryKeyValueMFE(0).setData(type);
    }

    // MFI-3 File Level Event Code (ID)
    mfi.getFileLevelEventCode().setValue("UPD");

    // MFI-6 Response level code ((ID)
    mfi.getResponseLevelCode().setValue("NE");

    // MFE-5 Primary Key Location Type (ID)
    mfe.getPrimaryKeyValueType(0).setValue("PL");

    return message;
  }
Пример #2
0
 public boolean isClinicType(Message msg) throws HL7Exception {
   MFI mfi = (MFI) msg.get("MFI");
   if (mfi.getMasterFileIdentifier().getIdentifier().getValue().equals("CLN")) return true;
   else return false;
 }