<< Click to Display Table of Contents >> Navigation: Designing Templates > Template HTML > HL7 Tag Shorthand > The ##HL7## Tag |
The ##HL7....## Tag
The ##HL7...## tags are for inserting specific values from your HL7 messages into your Templates. In HTML terms you can think of them like any single function closed HTML tag (like <br /> or <img src="image" />).
Examples:
•##HL7## Inserts the entire HL7 message into the document. NOTE: You may want to apply a "no-wrap" style before doing this.
•##HL7.MSH## Inserts the entire MSH segment into the document.
•##HL7.MSH.9## Inserts the entire raw value MSH segment Field #9 into the document. NOTE: ##HL7.MSH.9.0## is identical.
•##HL7.MSH.10.1## Inserts the value of MSH segment Field #10 Component #1 (The Message Control ID) into the document.
•##HL7.MSH.7.1.datetime## Inserts the value of MSH segment Field #7 Component #1 (The Message Date) into the document and attempts to format the value as a date and time (See the Tag Attribute Reference for a list of special formatting values you can use).
You can use the ##HL7...## tag to access repeating field values, sub-component values and sub-component values within a repeating field instance with a simple variation of the example code shown above.
Repeating Fields
Example HL7: XYZ|1|12345^TextValue1~54321^TextValue2|||...
In the example snippet above field #2 of the XYZ segment is a repeating field with 2 instances and you need to show the 2nd instance in your HL7 document.
##HL7.XYZ.2.1## Inserts the value of MSH segment Field #2 Component #1.
To display the 2nd instance just alter your ##HL7...## tag code like so:
##HL7.XYZ.2R2.1## Inserts the value of MSH segment Field #2 (2nd instance) Component #1.
The R2 in the field notation indicates that you want the 2nd repeating instance of Field #2. If there is no 2nd instance it will be blank. You CAN specify that you want instance #1 but you don't have to, IE ##HL7.XY2.2R1.1## and ##HL7.XY2.2.1## function exactly the same.
Sub-Component Data
Example HL7: XYZ|1|254-549-0825&123^TextValue2|||...
In the example snippet above field #2 component #1 of the XYZ segment contains sub-component data and you need to show the 2nd sub-component (123) in your document.
##HL7.XYZ.2.1## Inserts the value of MSH segment Field #2 Component #1 (Sub-Component 1).
To display the 2nd sub-component instance just alter your ##HL7...## tag code like so:
##HL7.XYZ.2.1S2## Inserts the value of MSH segment Field #2 Component #1 (Sub-Component 2).
The S2 in the field notation indicates that you want the 2nd sub-component instance of Field #2.1. If there is no 2nd instance it will be blank. You CAN specify that you want instance #1 but you don't have to, IE ##HL7.XY2.2.1S1## and ##HL7.XY2.2.1## function exactly the same.
Both Repeats and Sub-Components
Example HL7: XYZ|1|254-555-1212^Home~254-549-0825&123^Work|||...
In the example snippet above field #2 of the XYZ segment both repeats AND contains sub-component data. In this example field #2 contains telephone contact numbers for an entity (like a patient) where component 1 contains a telephone number and component #2 contains a TEXT describing the phone number. Component 1 can also contain an extra sub-component indicating a telephone extension. You need to show the 2nd sub-component (123) of field repeating instance #2 component #1 in your document. As you can surmise by the sections above all that you have to do is alter your ##HL7...## tag code like so:
##HL7.XYZ.2R2.1S2## Inserts the value of MSH segment Field #2 (2nd instance) Component #1 (Sub-Component 2).
|
Common Examples You Might Use:
Patient Name: ##HL7.PID.5.2## ##HL7.PID.5.3## ##HL7.PID.5.1##
If field 5 of the PID segment is |Smth^John^J| would render as shown below
Patient Name: John J Smith
OR with a formatting option
Patient DOB: ##HL7.PID.7.1.date##
If field 7 of the PID segment (date of birth) is |19581225000000-07:00^| it would render as shown below on a computer using standard USA regional date settings
Patient DOB: 12/25/1958
(see the Formatting Reference for more special formatting abilities like the .date modifier)
OR with a Default value option.
You can place any value you wish to show up in your document IF the HL7 value is blank by adding the value preceded by a question mark (?) to the end of the HL7 tag as shown below
Patient SSN: ##HL7.PID.19.1.?Unknown##
If field 19 of the PID segment (social security number) is empty || it would render as shown below
Patient SSN: Unknown
IMPORTANT: Using the default value shorthand (like ?Unknown above) will only work IF the HL7 segment exists in the HL7 message. If the segment does not exist then the shorthand tag will always evaluate to blank. See below.
Insured's SSN: ##HL7.IN2.2.1.?Unknown##
If the HL7 message contains an IN2 segment and field 2 component 1 was not blank (IN2||999-55-8888|) it would render as shown below
Insured's SSN: 999-55-8888
If the HL7 message contains an IN2 segment and it was blank it would render like so
Insured's SSN: Unknown
If the HL7 message does not contain an IN2 segment at all it would render like so
Insured's SSN: