I have an inbound ORU message that I need to loop on and generate multiple outbound messages. I’ve been testing several days and apparently my pea brain can’t come up with the proper solution. I’m sure I’m making it more complicated that it really is. A message fragment is below.
MSH|^~&|||||||ORU^R01|20052381448688|P|2.1||||
PID|||0000^^^1||DOE^JOHN^A||19430204|F|
PV1||||||||^||||||||||
ORC|RE||D63718|||||||||
OBR|||D63718|4010762^TYPE AND SCREEN|||
OBX|1|CE|%ABR^ABO/Rh|1|A||||||F|||
OBX|2|CE|%ABR^ABO/Rh|2| NEGATIVE||||
OBX|3|CE|BT^BLOOD TYPE|1|A NEGATIVE|||
OBX|4|CE|%AS^ANTIBODY SCREEN|1|NEGATIVE|||||
OBX|5|CE|COMM^BLOOD BANK COMMENTS|1|BLOOD IS RELEASED AT
OBX|6|FT|COMM^BLOOD BANK COMMENTS|2|CALLED TO AT 0100. MJ|
OBX|7|ST|%UN^UNIT NUMBER|1|A164961838LFR||||||
OBX|8|CE|%CT^COMPONENT TYPE|1|LEUKOCYTE FILTERED RBC’S|
OBX|9|CE|%ST^STATUS OF UNIT|1|ALLOCATED||||||I|||200610280602
OBX|10|CE|%TS^TRANSFUSION STATUS|1|OK TO TRANSFUSE||||||F|||
OBX|11|CE|%XM^CROSSMATCH|1|COMPATIBLE||||||F|||200610280602|
OBX|12|ST|%UN^UNIT NUMBER|1|B164961838LFR|||||||||200610280602
OBX|13|CE|%CT^COMPONENT TYPE|1|LEUKOCYTE RBC’S||||||F|
OBX|14|CE|%ST^STATUS OF UNIT||ALLOCATED||||||I|||200610280602|
OBX|15|CE|%TS^TRANSFUSION STATUS|1|OK TO TRANSFUSE||||||F|||
OBX|16|CE|%XM^CROSSMATCH|1|COMPATIBLE||||||F|||200610280602
I need to loop on the OBX until OBX3.2 = “UNIT NUMBER” and then send the previous message out. Using the above example I need the MSH, PID, OBR and OBX1-6 in message 1.
MSH, PID, OBR and OBX7-11 in message 2.
MSH, PID, OBR and OBX12-16 in message 3 and so on.
I can get it close but can’t seem to get the entire solution.
I have found some great help here and appreciate any assistance given.
Thanks!!
Carl