Replies: 1 comment 5 replies
-
Post a before and after example hl7 message please. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello guys,
i'm having some ORU which contain one OBR and many OBX. For each OBX i need to create one additional OBR segment.
I also need to fill a few things into the new created segment like a timestamp from MSH7
Sample OBX:
OBX|3|ST|^FIO2^I|400063|21.0|%||N|||F|||||||||||
I'm trying it like this:
`var ts = msg['MSH']['MSH.7']['MSH.7.1'].toString();
for each (seg in msg.children()) {
if (seg.name().toString() == "OBX") {
var newSeg = createSegment('OBR');
//Set TIMESTAMP
newSeg['OBR.6']['OBR.6.1'] = ts;
insertSegmentBefore(newSeg, seg);
}
}`
So far that's doing its job. However i need to also add in the value my OBX contains in 4.1.
I was hoping i could the value simply through
`var ts = msg['MSH']['MSH.7']['MSH.7.1'].toString();
for each (seg in msg.children()) {
if (seg.name().toString() == "OBX") {
var newSeg = createSegment('OBR');
// add code from OBX
newSeg['OBR.4']['OBR.4.1'] = seg['OBX.4']['OBX.4.1'].toString();
//Set TIMESTAMP
newSeg['OBR.6']['OBR.6.1'] = ts;
insertSegmentBefore(newSeg, seg);
}
}`
Sadly this doesn't work.
How can i access the value of each OBX in that loop?
Thank you so much for help!
Beta Was this translation helpful? Give feedback.
All reactions