Interface IHl7V2OutboundMapperSvc


public interface IHl7V2OutboundMapperSvc
This service is used to generate and populate HL7 v2.x outbound (from Smile CDR) messages using information from FHIR resources as the source of data.

To create a new HL7 v2.x message to transmit, the first call should be to newTarget(String, String, Class). You can then use methods such as populateMessageAdtA01FromEncounter(IBaseResource, MappingTarget, OutboundMappingInstructions) to populate the entire message according to Smile CDR's mapping rules, or use individual segment methods such as populateSegmentPidFromPatient(Patient, Encounter, PID, MappingTarget, OutboundMappingInstructions) to populate individual segments. You can also simply populate the message yourself.

  • Method Details

    • newTarget

      <T extends ca.uhn.hl7v2.model.Message> MappingTarget<T> newTarget(@Nonnull String theMessageCode, @Nonnull String theMessageTrigger, @Nonnull Class<T> theStructureType) throws IllegalArgumentException
      Create a new MappingTarget with a target Message instance that is appropriate for the given theMessageCode and theMessageTrigger values. The MSH segment in the message is populated with initial values (which may subsequently be modified if needed), but no other segments are populated.
      Parameters:
      theMessageCode - The message code, e.g. ADT
      theMessageTrigger - The message trigger, e.h. A01
      theStructureType - The HAPI-HL7v2 type class corresponding to the given code and trigger. Note that these will often agree (e.g. Code/Type of "ADT"/"A01" should use a structure type of ADT_A01.class) but there are also many cases in the HL7 v2.x specification where a structure type gets used for multiple triggers (e.g. Code/Type of "ADT"/"A31" uses the structure type of ADT_A05.class). At this time, an HL7 v2.5 structure class must be used.
      Throws:
      IllegalArgumentException - If theStructureType is inappropriate for the given theMessageCode and theMessageTrigger values.
    • populateMessageDftP03FromChargeItem

      void populateMessageDftP03FromChargeItem(@Nonnull IBaseResource theFocalChargeItem, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.DFT_P03> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions)
      Populate a complete DFT_P03 structure using a ChargeItem resource as the focal resource. This can be used to create messages of type DFT^P03.

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type DFT_P03
    • populateMessageOruR01FromDiagnosticReport

      void populateMessageOruR01FromDiagnosticReport(@Nonnull IBaseResource theFocalDiagnosticReport, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ORU_R01> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions)
      Populate a complete ORU_R01 structure using a DiagnosticReport resource as the focal resource. This can be used to create messages of type ORU^R01

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type ORU_R01
    • populateMessageAdtA01FromEncounter

      void populateMessageAdtA01FromEncounter(@Nonnull IBaseResource theFocalEncounter, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A01> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions) throws ca.uhn.hl7v2.HL7Exception
      Populate a complete ADT_A01 structure using an Encounter resource as the focal resource. This can be used to create messages of type ADT^A01, ADT^A04

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type ADT_A01
      Throws:
      ca.uhn.hl7v2.HL7Exception
    • populateMessageAdtA02FromEncounter

      void populateMessageAdtA02FromEncounter(@Nonnull IBaseResource theFocalEncounter, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A02> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions) throws ca.uhn.hl7v2.HL7Exception
      Populate a complete ADT_A02 structure using an Encounter resource as the focal resource. This can be used to create messages of type ADT^A02

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type ADT_A02
      Throws:
      ca.uhn.hl7v2.HL7Exception
    • populateMessageAdtA03FromEncounter

      void populateMessageAdtA03FromEncounter(@Nonnull IBaseResource theFocalEncounter, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A03> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions) throws ca.uhn.hl7v2.HL7Exception
      Populate a complete ADT_A03 structure using an Encounter resource as the focal resource. This can be used to create messages of type ADT^A03

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type ADT_A03
      Throws:
      ca.uhn.hl7v2.HL7Exception
    • populateMessageAdtA05FromPatient

      void populateMessageAdtA05FromPatient(@Nonnull IBaseResource theFocalPatient, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A05> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populate a complete ADT_A05 structure using a Patient resource as the focal resource. This can be used to create messages of type ADT^A28, ADT^A31

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theFocalPatient - A Patient resource to use as the focal resource
      theMappingTarget - Should contain message of type ADT_A05
    • populateMessageAdtA05FromEncounter

      void populateMessageAdtA05FromEncounter(@Nonnull IBaseResource theFocalEncounter, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A05> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions) throws ca.uhn.hl7v2.HL7Exception
      Populate a complete ADT_A05 structure using an Encounter resource as the focal resource. This can be used to create messages of type ADT^A05, ADT^A08

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theFocalEncounter - An Encounter resource to use as the focal resource
      theMappingTarget - Should contain message of type ADT_A05
      Throws:
      ca.uhn.hl7v2.HL7Exception
    • populateMessageOmgO19FromServiceRequest

      void populateMessageOmgO19FromServiceRequest(@Nonnull IBaseResource theFocalServiceRequest, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.OMG_O19> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions) throws ca.uhn.hl7v2.HL7Exception
      Populate a complete OMG_O19 structure using a ServiceRequest resource (R4+) or a ProcedureRequest resource (DSTU3) as the focal resource. This can be used to create messages of type OMG^O19.

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type OMG_O19
      Throws:
      ca.uhn.hl7v2.HL7Exception
    • populateMessageOrmO01FromServiceRequest

      void populateMessageOrmO01FromServiceRequest(@Nonnull IBaseResource theFocalServiceRequest, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ORM_O01> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions) throws ca.uhn.hl7v2.HL7Exception
      Populate a complete ORM_O01 structure using a ServiceRequest resource (R4+) or a ProcedureRequest resource (DSTU3) as the focal resource. This can be used to create messages of type ORM^O01.

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type ORM_O01
      Throws:
      ca.uhn.hl7v2.HL7Exception
    • populateMessageOruR01FromServiceRequest

      void populateMessageOruR01FromServiceRequest(@Nonnull IBaseResource theFocalServiceRequest, @Nonnull MappingTarget<ca.uhn.hl7v2.model.v25.message.ORU_R01> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populate a complete ORU_R01 structure using a ServiceRequest resource (R4+) or a ProcedureRequest resource (DSTU3) as the focal resource. This can be used to create messages of type ORU^R01.

      This method attempts to populate the entire message structure using values from the focal resource as well as from other resources that are referenced directly or indirectly from the focal resource.

      Parameters:
      theMappingTarget - Should contain message of type ORU_R01
    • populateSegmentRolFromEncounterParticipant

      void populateSegmentRolFromEncounterParticipant(@Nonnull org.hl7.fhir.r4.model.Encounter theEncounter, int theEncounterParticipantIndex, @Nonnull ca.uhn.hl7v2.model.v25.segment.ROL theRol, @Nonnull MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates an ROL segment using a single Encounter.participant instance. Because Encounter.participant is a repeating field, an index must also be passed in.
      Parameters:
      theEncounter - The source Encounter to draw values from.
      theEncounterParticipantIndex - The index of the Encounter.participant repetition to draw values from (0-indexed).
      theRol - The ROL segment to populate.
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentAl1FromAllergyIntolerance

      void populateSegmentAl1FromAllergyIntolerance(@Nonnull org.hl7.fhir.r4.model.AllergyIntolerance theAllergyIntolerance, @Nullable Integer theSetId, @Nonnull ca.uhn.hl7v2.model.v25.segment.AL1 theAl1, @Nonnull MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates an AL1 segment using values from an AllergyIntolerance resource instance.
      Parameters:
      theAllergyIntolerance - The source Coverage to draw values from.
      theSetId - The set ID to populate in AL1-1, or null.
      theAl1 - The AL1 segment to populate
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentIn1In2FromInsurance

      void populateSegmentIn1In2FromInsurance(org.hl7.fhir.r4.model.Coverage theCoverage, ca.uhn.hl7v2.model.v25.segment.IN1 theIn1, ca.uhn.hl7v2.model.v25.segment.IN2 theIn2, MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates a pair of IN1 and IN2 segments using values from a Coverage resource instance.
      Parameters:
      theCoverage - The source Coverage to draw values from.
      theIn1 - The IN1 segment to populate
      theIn2 - The IN2 segment to populate
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentPr1FromProcedure

      void populateSegmentPr1FromProcedure(org.hl7.fhir.r4.model.Procedure theProcedure, ca.uhn.hl7v2.model.v25.segment.PR1 thePr1, MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates a PR1 segment using values from a Procedure resource instance.
      Parameters:
      theProcedure - The source Procedure to draw values from.
      thePr1 - The PR1 segment to populate
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentDg1FromEncounterCondition

      void populateSegmentDg1FromEncounterCondition(org.hl7.fhir.r4.model.Encounter theEncounter, int theEncounterConditionIndex, ca.uhn.hl7v2.model.v25.segment.DG1 theDg1, MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates an NK1 segment using a single Patient.contact instance. Because Patient.context is a repeating field, an index must also be passed in.
      Parameters:
      theEncounter - The source Encounter to draw values from.
      theEncounterConditionIndex - The index of the Encounter.condition repetition to draw values from (0-indexed).
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
      theDg1 - The DG1 segment to populate.
    • populateSegmentNk1FromPatientContact

      void populateSegmentNk1FromPatientContact(@Nonnull org.hl7.fhir.r4.model.Patient thePatient, int thePatientContactIndex, @Nonnull ca.uhn.hl7v2.model.v25.segment.NK1 theNk1, @Nonnull MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates an NK1 segment using a single Patient.contact instance. Because Patient.context is a repeating field, an index must also be passed in.
      Parameters:
      thePatient - The source Patient to draw values from.
      thePatientContactIndex - The index of the Patient.contact repetition to draw values from (0-indexed).
      theNk1 - The NK1 segment to populate.
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentPidFromPatient

      void populateSegmentPidFromPatient(@Nonnull org.hl7.fhir.r4.model.Patient theSubject, @Nullable org.hl7.fhir.r4.model.Encounter theEncounterOrNull, @Nonnull ca.uhn.hl7v2.model.v25.segment.PID thePid, @Nonnull MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates a PID segment using information from a Patient resource and optionally an Encounter resource.
      Parameters:
      theSubject - The subject patient.
      theEncounterOrNull - The focal encounter, or null.
      thePid - The PID segment to populate.
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentPd1FromPatient

      void populateSegmentPd1FromPatient(@Nonnull org.hl7.fhir.r4.model.Patient theSubject, @Nonnull ca.uhn.hl7v2.model.v25.segment.PD1 thePd1, @Nonnull MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates a PD1 segment using information from a Patient resource.
      Parameters:
      theSubject - The subject patient.
      thePd1 - The PD1 segment to populate.
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentPv1FromEncounter

      void populateSegmentPv1FromEncounter(@Nonnull org.hl7.fhir.r4.model.Encounter theEncounter, @Nonnull ca.uhn.hl7v2.model.v25.segment.PV1 thePv1, @Nonnull MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates a PV1 segment using information from an Encounter resource.
      Parameters:
      theEncounter - The encounter resource.
      thePv1 - The PV1 segment to populate.
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.
    • populateSegmentPv2FromEncounter

      void populateSegmentPv2FromEncounter(@Nonnull org.hl7.fhir.r4.model.Encounter theEncounter, @Nonnull ca.uhn.hl7v2.model.v25.segment.PV2 thePv2, @Nonnull MappingTarget<?> theMappingTarget, @Nonnull OutboundMappingInstructions theOutboundMappingInstructions)
      Populates a PV2 segment using information from an Encounter resource.
      Parameters:
      theEncounter - The source Encounter to draw values from.
      thePv2 - The PV2 segment to populate.
      theMappingTarget - The target object. This is only used to store any warnings or errors generated as a part of the mapping.