Sidebar

Custom OBR4-2 based on value of original message OBX2-5

0 votes
292 views
asked Feb 20, 2018 by (120 points)
edited Feb 20, 2018 by
Original message OBX2-5 value will be either: Colonoscopy or Upper GI endoscopy.

I need the code to write to identify if original message obx2-5  value is colonoscopy then write destination OBR-4-2 value: Colonoscopy

or if original OBX2-5 value is Upper GI endoscopy then write destination message ORB4-2 value  of : UGI ENDOSCOP

1 Answer

0 votes
This code will look for the values in the 5th field of the 2nd OBX segment ('OBX[2]-5') and make the change to  OBR-4.2 if the value is found:

if (StringUtils.equalsIgnoreCase(source.getNode('OBX[2]-5'), 'colonoscopy')) {
   message.setNode('OBR-4.2', 'Colonoscopy');
} else {
   if (StringUtils.equalsIgnoreCase(source.getNode('OBX[2]-5'), 'Upper GI endoscopy')) {
      message.setNode('OBR-4.2', 'UGI ENDOSCOP');
      
   }
}
answered Feb 20, 2018 by terrie-g-7436 (3,950 points)
commented Feb 20, 2018 by (120 points)
reshown Feb 20, 2018 by terrie-g-7436
Hi Terrie, Ohh I believe you developed one of our interfaces.   

one question: this is what i currently have in my code? should i remove the | var obr42 ='Colonoscopy ';
message.setNode("OBR-4.2", obr42);|  line and replace with the code above?"

//OBR|1|LR|FX||userId||||||||||||AU|U||||userID^^^^^^^^^^^^^^20100607113000|

// OBR:1 SetID
var Obrseg = qie.parseHL7String('OBR|0001');


var obr01 ='0001';
message.setNode("OBR-1", obr01);

var obr42 ='Colonoscopy ';
message.setNode("OBR-4.2", obr42);

message.setNode('OBR-6', source.getNode('TXA-22.15'));

message.setNode('OBR-7', source.getNode('TXA-22.15'));
message.setNode('OBR-14', source.getNode('TXA-22.15'));
message.setNode('OBR-16', source.getNode('TXA-5'));

var obr18 ='CM';
message.setNode('OBR-18', obr18 );

message.setNode('OBR-22', source.getNode('TXA-22.15'));

var obr25 ='F';
message.setNode('OBR-25', obr25 );


message.setNode('OBR-27.4', source.getNode('TXA-22.15'));
commented Feb 20, 2018 by terrie-g-7436 (3,950 points)
Since OBR-4.2 is conditional, based on what is in  OBX[2]-5, you should delete it from here.  This code doesn't look like it is looking at the OBX-5 value.
...