Interface IHl7V2OutboundMapperSvc
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 Summary
Modifier and TypeMethodDescription<T extends ca.uhn.hl7v2.model.Message>
MappingTarget<T>Create a newMappingTarget
with a targetMessage
instance that is appropriate for the given theMessageCode and theMessageTrigger values.void
populateMessageAdtA01FromEncounter
(IBaseResource theFocalEncounter, MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A01> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete ADT_A01 structure using an Encounter resource as the focal resource.void
populateMessageAdtA02FromEncounter
(IBaseResource theFocalEncounter, MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A02> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete ADT_A02 structure using an Encounter resource as the focal resource.void
populateMessageAdtA03FromEncounter
(IBaseResource theFocalEncounter, MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A03> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete ADT_A03 structure using an Encounter resource as the focal resource.void
populateMessageAdtA05FromEncounter
(IBaseResource theFocalEncounter, MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A05> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete ADT_A05 structure using an Encounter resource as the focal resource.void
populateMessageAdtA05FromPatient
(IBaseResource theFocalPatient, MappingTarget<ca.uhn.hl7v2.model.v25.message.ADT_A05> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete ADT_A05 structure using a Patient resource as the focal resource.void
populateMessageDftP03FromChargeItem
(IBaseResource theFocalChargeItem, 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.void
populateMessageOmgO19FromServiceRequest
(IBaseResource theFocalServiceRequest, MappingTarget<ca.uhn.hl7v2.model.v25.message.OMG_O19> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete OMG_O19 structure using a ServiceRequest resource (R4+) or a ProcedureRequest resource (DSTU3) as the focal resource.void
populateMessageOrmO01FromServiceRequest
(IBaseResource theFocalServiceRequest, MappingTarget<ca.uhn.hl7v2.model.v25.message.ORM_O01> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete ORM_O01 structure using a ServiceRequest resource (R4+) or a ProcedureRequest resource (DSTU3) as the focal resource.void
populateMessageOruR01FromDiagnosticReport
(IBaseResource theFocalDiagnosticReport, 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.void
populateMessageOruR01FromServiceRequest
(IBaseResource theFocalServiceRequest, MappingTarget<ca.uhn.hl7v2.model.v25.message.ORU_R01> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populate a complete ORU_R01 structure using a ServiceRequest resource (R4+) or a ProcedureRequest resource (DSTU3) as the focal resource.void
populateSegmentAl1FromAllergyIntolerance
(org.hl7.fhir.r4.model.AllergyIntolerance theAllergyIntolerance, Integer theSetId, ca.uhn.hl7v2.model.v25.segment.AL1 theAl1, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates an AL1 segment using values from an AllergyIntolerance resource instance.void
populateSegmentDg1FromEncounterCondition
(org.hl7.fhir.r4.model.Encounter theEncounter, int theEncounterConditionIndex, ca.uhn.hl7v2.model.v25.segment.DG1 theDg1, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates an NK1 segment using a single Patient.contact instance.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, OutboundMappingInstructions theOutboundMappingInstructions) Populates a pair of IN1 and IN2 segments using values from a Coverage resource instance.void
populateSegmentNk1FromPatientContact
(org.hl7.fhir.r4.model.Patient thePatient, int thePatientContactIndex, ca.uhn.hl7v2.model.v25.segment.NK1 theNk1, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates an NK1 segment using a single Patient.contact instance.void
populateSegmentPd1FromPatient
(org.hl7.fhir.r4.model.Patient theSubject, ca.uhn.hl7v2.model.v25.segment.PD1 thePd1, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates a PD1 segment using information from a Patient resource.void
populateSegmentPidFromPatient
(org.hl7.fhir.r4.model.Patient theSubject, org.hl7.fhir.r4.model.Encounter theEncounterOrNull, ca.uhn.hl7v2.model.v25.segment.PID thePid, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates a PID segment using information from a Patient resource and optionally an Encounter resource.void
populateSegmentPr1FromProcedure
(org.hl7.fhir.r4.model.Procedure theProcedure, ca.uhn.hl7v2.model.v25.segment.PR1 thePr1, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates a PR1 segment using values from a Procedure resource instance.void
populateSegmentPv1FromEncounter
(org.hl7.fhir.r4.model.Encounter theEncounter, ca.uhn.hl7v2.model.v25.segment.PV1 thePv1, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates a PV1 segment using information from an Encounter resource.void
populateSegmentPv2FromEncounter
(org.hl7.fhir.r4.model.Encounter theEncounter, ca.uhn.hl7v2.model.v25.segment.PV2 thePv2, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates a PV2 segment using information from an Encounter resource.void
populateSegmentRolFromEncounterParticipant
(org.hl7.fhir.r4.model.Encounter theEncounter, int theEncounterParticipantIndex, ca.uhn.hl7v2.model.v25.segment.ROL theRol, MappingTarget<?> theMappingTarget, OutboundMappingInstructions theOutboundMappingInstructions) Populates an ROL segment using a single Encounter.participant instance.
-
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 newMappingTarget
with a targetMessage
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 ofADT_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 ofADT_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 typeDFT_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^R01This 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 typeORU_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^A04This 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 typeADT_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^A02This 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 typeADT_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^A03This 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 typeADT_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^A31This 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 resourcetheMappingTarget
- Should contain message of typeADT_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^A08This 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 resourcetheMappingTarget
- Should contain message of typeADT_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 typeOMG_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 typeORM_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 typeORU_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 populatetheMappingTarget
- 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 populatetheIn2
- The IN2 segment to populatetheMappingTarget
- 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 populatetheMappingTarget
- 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.
-