Trouble with NTE when creating new OBX

samedi 28 mars 2015

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?





Trouble with NTE when creating new OBX

0 commentaires:

Enregistrer un commentaire