Mapping an 837 can appear like a daunting task, especially when dealing with a large schema and the hierarchical looping that is associated with it. However, if you know some XSLT, you are already ahead of the game. In this example we will a proprietary XML format to an 837P and focus on the HL Looping structure.

You will notice the lack of mapping lines in this example. This is due to the fact that we are only mapping the header section with the BizTalk Mapper, and most of the functionality is rolled into custom scripting functoids.

In order to create our HL Looping we need a few things:

  • Variable to hold our counter
  • Function to increment our counter
  • Function to return our counter
  • Variable to hold our billing provider HL01(XSLT)
  • Variable to hold our subscriber HL01(XSLT)

These can all be located in one custom C# scripting functoid:

Billing provider HL01:

The first HL Loop is the billing provider. This is the easiest component.

Then we just call the GetHL01 function and hard code the rest.

Next up is the Subscriber loop:

XSLT breakdown:

  1. Incrementing our HL01 value
  2. Setting the parent ID number which for Subscriber is the Billing HL01
  3. Hard coding the HL03 value, 22 for subscriber
  4. Testing if there is a patient or not.
    1. In our proprietary format there is a patient flag, but if there is not a flag, you can simply test if there is a patient subordinate to the subscriber.
  5. Setting the current HL01 for the subscriber

Last is the Patient Loop:

XSLT breakdown:

  1. Increment the HL01 value
  2. Set the Parent ID which is ‘Subscriber’ for Patient
  3. Hard Code HL03 and HL04 Values

More Recent Blogs