<< Click to Display Table of Contents >> Navigation: Designing Templates > Template HTML > HL7 Tag Shorthand > The $$HL7SECTION$$ Tag |
The $$HL7SECTION$$----$$ENDSECTION$$ Tag
The $$HL7SECTION$$ tags are used to handle repeating segments in an HL7 Message like Insurance (IN1,IN2,IN3 Segments) or Lab Orders and Results (ORC,OBR,OBX Segments).
Syntax: |
$$HL7SECTION segment="IN1" childsegments="IN2,IN3"$$ |
Attributes: |
segment - Required. Must be the 3 character name of the HL7 Segment which the HL7SECTION is for (Like OBX, IN1, etc). Only 1 segment name may be used.
childsegments - Optional. Should indicate any immediate child segments of the parent entered in the segment separated by a comma. |
When you place a $$HL7SECTION$$ tag in your HTML source it will only be included in your final document if the HL7 message contains at least one segment which matches the value in the segment attribute. If the HL7 message does NOT contain that segment then ALL HTML code from the $$HL7SECTION$$ to the $$ENDSECTION$$ is REMOVED and will not be visible.
EXAMPLE HL7 MESSAGE
MSH|^~\&|SOMEAPP|SOMEAPP|YOURAPP|YOURAPP|20150429154904+0000^S||ORU^R01|15368|T|...{Truncated}
EVN|A08|20150429154904+0000^S||00102|....{Truncated}
PID|1|1524321408|1524321408|234166342|Eriksson^Elizabeth^M||19760824|F|...{Truncated}
PV1|1|P|^^^00002|R||00019|06543^HOOPER^DENNIS^L|....{Truncated}
DG1|1|I9||NODX||W|||||||||01|06543^HOOPER^DENNIS^L|....{Truncated}
GT1|1|3322261701|Harris^Dominic^M||...{Truncated}
IN1|1|0000008|0000114|UNITED HEALTH|....{Truncated}
IN2||234166342|0009999^UNKNOWN||I|....{Truncated}
IN1|2|32411|0000114|LIBERTY MUTUAL|....{Truncated}
IN2||386997754|0009999^UNKNOWN||I|....{Truncated}
OBR|1|40157|6441089|DATA1T|||20150429154904|...{Truncated}
OBX|1|ED|Xray Scan|1|Chest XRay (Front)^JPG^^Base64^/9j/4AAQSkZJRgA...{Truncated}
OBX|2|ED|Xray Scan|2|Chest XRay (Side)^JPG^^Base64^/9j/4AAQSkZJRgA...{Truncated}
OBR|2|40158|6441096|DATA2T|||20150429154904|...{Truncated}
OBX|1|ED|Xray Scan|1|Spinal XRay (Front)^JPG^^Base64^/9j/4AAQSkZJRgA...{Truncated}
OBX|2|ED|Xray Scan|2|Spinal XRay (Side)^JPG^^Base64^/9j/4AAQSkZJRgA...{Truncated}
In all scenarios below we'll be using the example HL7 message above as the source.
As you know by now you insert data into your HL7 messages by using the ##HL7...## shorthand tag in your Template HTML. If you want to put the patient's last name (PID 5.1) someplace in your document you do it like so: <b>Patient Last Name:</b> ##HL7.PID.5.1## <br /> Which in your document would look something like this: Patient Last Name: Eriksson
If you wanted to insert the Insurance Company Name (IN1 4.1) into your document you would do the same like so: <b>Insurance Company ##HL7.IN1.1.1##:</b> ##HL7.IN1.4.1## <br /> Which in your document would look something like this: Insurance Company 1: United Health
But what about situations like our example HL7 message above. It contains 2 IN1 segments with 2 different insurance companies. If you just add the code as written above there will be only ONE Insurance Company entry in your published document and it would reflect the FIRST Insurance Company Name (IN1.4.1) present in the source HL7 message which as you can see is United Health. To accommodate all insurance segments you use an HL7SECTION tag like so:
$$HL7SECTION segment="IN1" childsegments="IN2"$$ <b>Insurance Company ##HL7.IN1.1.1##:</b> ##HL7.IN1.4.1## <br /> $$ENDSECTION$$
Which in your document would look something like this: Insurance Company 1: United Health Insurance Company 2: Liberty Mutual
|
Continuing example from Scenario #1. If in addition to the insurance company name you wanted to include the Insured Party's SSN (IN2.2.1) in your document you would just add the extra HTML code. This however is where the childsegments attribute of the $$HL7SECTION$$ tag comes into play. Below are 2 different examples which produce 2 VERY different results.
Example #1: INCORRECT
$$HL7SECTION segment="IN1"$$ <b>Insurance Company ##HL7.IN1.1.1##:</b> ##HL7.IN1.4.1## <b>Insured SSN:</b> ##HL7.IN2.2.1.?Unknown##<br /> $$ENDSECTION$$
Which in your document would look like this:
Insurance Company 1: United Health Insured SSN: 234166342 Insurance Company 2: Liberty Mutual Insured SSN: 234166342
Note that while it inserts the Insurance Company Names correctly it fails to insert the Insured Party's SSN correctly. This is because in our source code we DID NOT include a childsegments attribute telling the HL7 document publisher that the IN2 segment should be included as CHILD segment of the IN1 so that ALL ##HL7.IN2..## shorthand tags inside of the ##HL7SECTION## should be assumed to come from the IN2 segment immediately following the parent segment. Since this was not done the HL7 document publisher resorted to its default behavior which is to retrieve the FIRST matching HL7 value in the source message. Thus the Insured SSN from the FIRST IN2 segment was repeated on both lines.
Correcting the error is simple. Just add the IN2 as a childsegments attribute.
Example #2: CORRECT
$$HL7SECTION segment="IN1" childsegments="IN2"$$ <b>Insurance Company ##HL7.IN1.1.1##:</b> ##HL7.IN1.4.1## <b>Insured SSN:</b> ##HL7.IN2.2.1.?Unknown##<br /> $$ENDSECTION$$
Which in your document would look like this:
Insurance Company 1: United Health Insured SSN: 234166342 Insurance Company 2: Liberty Mutual Insured SSN: 386997754
|
For HL7 messages which contain repeating segments which have childsegments (or even GrandChildren) which are also repeating segments you can "nest" your ##HL7SECTION## tags just like other HTML Tags.
$$HL7SECTION segment="OBR" childsegments="OBX"$$ </p> $$HL7SECTION segment="NTE"$$ <p>This paragraph will ONLY appear if the OBX segment has 1 or more NTE child segments</p> $$ENDSECTION$$
|
|
See Also: Handling Embedded Binary Data