web stats
Store entire HL7 segment in variable as text - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 11-25-2015, 07:09 PM
Baron Baron is offline
Mirth Newb
Join Date: Apr 2009
Posts: 18
Baron is on a distinguished road
Default Store entire HL7 segment in variable as text

I've read dozens of threads that almost get me what I'm trying to do, but nothing is quite right. I fully believe I'm overthinking the problem and this is entirely too easy. It seems that when I store the entire segment in a variable, I end up with XML tags. I just want it as plain text.
Reply With Quote
Old 11-26-2015, 05:17 AM
satheeskumar satheeskumar is offline
OBX.1 Kenobi
Join Date: Aug 2015
Location: UK
Posts: 46
satheeskumar is on a distinguished road


give little bit more details of what you need with example ?

Reply With Quote
Old 11-26-2015, 02:16 PM
Baron Baron is offline
Mirth Newb
Join Date: Apr 2009
Posts: 18
Baron is on a distinguished road

The short version is I'm taking in a DFT from one system and storing it in a databases. I compare ADT from our EHR to the stored DFT and if the ADT matches on Visit, I pull the IN1 and DG1 segments from there. I combine those two segments (usually, multiple segments of each) into the DFT so that I can send it on to a third party biller.

I've tried a number of things. In my test, I have 7 DFT's for one visit.
This sends out all the DFT segments, but then it puts 7 iterations of the DG1 and 7 iterations of the IN1 after the first DFT message (the the next 6 DFT messages follow without any DG1/IN1 information):

If I do something like this and replace the DG1/IN1 with the variables, it works, but then I end up with XML encapsulated segments:
var DG1Seg = msg['DG1'];
var IN1Seg = msg['IN1'];

If I do this, it works fine for the DG1, assuming there is a DRG following the DG1, but there is nothing that consistently follows the IN1, so I'm not sure how to end it:
var input = messageObject.getRawData() + '';
var start = /dg1/gi;
var end = /drg/gi;
var index1 = input.search(start);
var index2 = input.search(end);
var output = input.substring(index1,index2);

Like I said, there is, surely, a straightforward way to store entire segments in variables without the xml tags.
Reply With Quote
Old 11-27-2015, 07:24 AM
mcalKno mcalKno is offline
Join Date: Apr 2015
Location: Pennsylvania
Posts: 247
mcalKno is on a distinguished road

try something like this...

for each(obx in msg.OBX)
	var obxSeg = SerializerFactory.getSerializer('HL7V2').fromXML(obx);
Reply With Quote

entire segment, variable

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 11:36 PM.

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