1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
531 views
by jeremy-c-6009 (300 points)
We are working with a vendor that is requesting ORU files for specific labs.  They typically receive these directly from the Lab, so their system is coded expecting the ORC record, which is not included by CPS.

ORC should just be static, but needs to be inserted prior to the first OBR record.

I can rebuild the File by rewriting the MSH, PID, PV1, adding the ORC, however am not able to figure out how to write out the repeating OBR/OBX records.

1 Answer

+1 vote

You can do this by specifying the instance in the Hpath of the  message.addChildBefore function. 

// Get OBR segment count
var obrCount = message.getCount('OBR');
// Loop through each OBR and add the ORC segment
for (var i=1 ; i <= obrCount ; i++) {
   message.addChildBefore('OBR[' + i + ']', 'ORC', 'ORC|' + i + '|||12345');
}
by brandon-w-8204 (34.1k points)
...