web stats
Trouble with NTE when creating new OBX - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2015, 09:39 AM
rnewland rnewland is offline
What's HL7?
 
Join Date: Oct 2013
Posts: 4
rnewland is on a distinguished road
Default Trouble with NTE when creating new OBX

I am having trouble with the NTE segments associated with the OBX when I add a new OBX. I thought I found the solution with this code:

//Add Sample Type to Parameters
for each (obr in msg.OBR) {
var obxGroup = getSegmentsAfter(msg,obr,'OBX');
var newOBX = createSegmentAfter('OBX', obxGroup.length ? obxGroup[obxGroup.length-1] : obr);
newOBX['OBX.1']['OBX.1.1'] = obxGroup.length+1;
newOBX['OBX.2']['OBX.2.1'] = "ST";
newOBX['OBX.3']['OBX.3.4'] = "Sample type";
newOBX['OBX.5']['OBX.5.1'] = msg['OBR']['OBR.15']['OBR.15.1'].toString();
newOBX['OBX.11']['OBX.11.1'] = "F";
}

Which worked great until the last OBX had a NTE. Then it placed the new OBX in between the last OBX and the NTE

original:

OBX|19|ST|^^^Na+| ...
NTE|1|L| Sample error

after adding new OBX

OBX|19|ST|^^^Na+| ...
OBX|20|ST|^^^Sample type ...
NTE|1|L| Sample error

What is the best way to add OBX without affecting the NTE segments?
Reply With Quote
Reply

Tags
nte, obx

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:54 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation