Beispiel #1
0
  public Message populateMessage(IHL7OutboundMessageHandler event) throws Exception {
    LOG.debug("A25VoMapper populateMessage: entry");

    ADT_A21 message = new ADT_A21();
    PV1 pv1 = message.getPV1();
    PV2 pv2 = message.getPV2();
    Patient patient = null;

    if (event instanceof InpatientEpisodeQueueVo) {
      a01Vomapper = (A01VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A01);
      if (a01Vomapper == null) {
        throw new HL7Exception(
            "A25 mapper requires A01 mapper. A01 mapper not found in list of registered mappers.");
      }

      InpatientEpisodeQueueVo feedVo = (InpatientEpisodeQueueVo) event;
      ifInpatientEpisodeVo inpatientEpisode = adt.getInpatientEpisodeDetails(feedVo);
      patient = inpatientEpisode.getPatient();
      a01Vomapper.populateBasicEpisodeData(event, inpatientEpisode, pv1, pv2);
    }

    populateMSH(
        event.getProviderSystem(),
        message.getMSH(),
        Long.toString(new java.util.Date().getTime()),
        "ADT",
        "A25");
    message.getEVN().getEventTypeCode().setValue("A25");

    if (patient != null) {
      renderPatientVoToPID(patient, message.getPID(), event.getProviderSystem());
      PD1 pd1 = message.getPD1();
      // WDEV-20993
      //			renderGPDetailsToPD1(patient, pd1);
      renderGPDetailsToPD1(patient, pd1, event.getProviderSystem());
      renderPatientDetailsToPD1(patient, pd1, event.getProviderSystem()); // WDEV-22624
    }

    return message;
  }
Beispiel #2
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;
  }
  public Message populateMessage(IHL7OutboundMessageHandler event) throws Exception {
    LOG.debug("A13VoMapper populateMessage: entry");
    ADT_A01 message = new ADT_A01();
    EDAttendanceFeedVo edAttendance = null;
    Patient patient = null;
    PV1 pv = message.getPV1();

    if (event instanceof EDAttendanceFeedVo) {
      edAttendance = (EDAttendanceFeedVo) event;
      ifEDAttendanceVo attendenceDetails = adt.getEDAttendanceDetails(edAttendance.getAttendance());
      patient = attendenceDetails.getPatient();
      // PV1-3
      renderPatientLocationToPV1(
          attendenceDetails.getRegistrationLocation(), null, null, pv, event.getProviderSystem());

      // PV1-2
      pv.getPatientClass().setValue("E"); // only mandatory item

      // PV1-10
      pv.getHospitalService().setValue("E");

      // PV1-19
      if (attendenceDetails.getBoId() != null) {
        pv.getVisitNumber().getID().setValue(attendenceDetails.getBoId().toString());
      }
      // PV1-13
      if (attendenceDetails.getAttendanceTypeIsNotNull()) {
        pv.getReAdmissionIndicator()
            .setValue(
                svc.getRemoteLookup(
                    attendenceDetails.getAttendanceType().getID(),
                    event.getProviderSystem().getCodeSystem().getText()));
      }
      // PV1-44 EVN-2
      if (attendenceDetails.getRegistrationDateTimeIsNotNull()) {
        renderDateTimeVoToTS(attendenceDetails.getRegistrationDateTime(), pv.getAdmitDateTime());
        renderDateTimeVoToTS(
            attendenceDetails.getRegistrationDateTime(), message.getEVN().getRecordedDateTime());
      }

      // PV1-45
      if (attendenceDetails.getDischargeDateTimeIsNotNull()) {
        renderDateTimeVoToTS(attendenceDetails.getDischargeDateTime(), pv.getDischargeDateTime(0));
      }
      // PV2-3
      PV2 pv2 = message.getPV2();
      if (attendenceDetails.getEmergencyEpisodeIsNotNull()
          && attendenceDetails.getEmergencyEpisode().getPresentingComplaintIsNotNull()) {
        pv2.getAdmitReason()
            .getIdentifier()
            .setValue(
                svc.getRemoteLookup(
                    attendenceDetails.getEmergencyEpisode().getPresentingComplaint().getID(),
                    event.getProviderSystem().getCodeSystem().getText()));
      }
    } else // Other event types
    {

    }

    populateMSH(
        event.getProviderSystem(),
        message.getMSH(),
        Long.toString(new java.util.Date().getTime()),
        "ADT",
        "A13");
    renderPatientVoToPID(patient, message.getPID(), event.getProviderSystem());
    NK1 nk1 = message.getNK1();
    renderNextOfKinVoToNK1(patient.getNok(), nk1, event.getProviderSystem());
    PD1 pd1 = message.getPD1();
    renderGPDetailsToPD1(patient, pd1);
    populateEVN(message.getEVN(), "A13");
    return message;
  }