web stats
HL7V2 - NTE issue - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-19-2019, 01:01 PM
ASIFM786 ASIFM786 is offline
What's HL7?
 
Join Date: Oct 2008
Posts: 5
ASIFM786
Default HL7V2 - NTE issue

hello,
i am a newbie here and wondered if i can get some help, i have managed to get NTE to appear in a list now using the following code :-

var DocumentText = "";

for each (documentLine in msg['NTE']['NTE.3']['NTE.3.1'])

{
DocumentText += "<br/>" + documentLine;
}
connectorMap.put('DocumentText', DocumentText);

but the problem i am having the PDF writer is crashjing out when there is special characters eg.g = <> signs

i have tried to ignore these in the preprocessor, but instead of ignoring it is stripping out the special characters?

does anyone have a HTML format for a Lab report as an example which has some example scripts?

thanks in advance
Reply With Quote
  #2  
Old 06-20-2019, 05:41 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,228
cory_cole is on a distinguished road
Default

If you don't want them removed, instead of ignoring them, escape them.
i.e.
xml.replace('*'/g,'\*');
Reply With Quote
  #3  
Old 06-20-2019, 10:14 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 802
agermano is on a distinguished road
Default

Try this:
Code:
DocumentText += "<br/>" + org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(documentLine);
Reply With Quote
  #4  
Old 06-20-2019, 10:55 PM
ASIFM786 ASIFM786 is offline
What's HL7?
 
Join Date: Oct 2008
Posts: 5
ASIFM786
Default

thanks for your help guys, i have sorted it by using this scroipt below :-

var reportTxt = "";

for each (seg in msg.children())
{

if (seg.name().toString() == "NTE")
{
reportTxt += "<tr>" + ['NTE.3']['NTE.3.1'].toString().replace("<", "&lt;") + "</tr>";

}
}
channelMap.put('text', reportTxt);

is there a way of just reading the specific NTE below instead of all NTE

NTE|1|EC|Specific IgE
NTE|2|EC|Grade 0=<0.35 Grade 1=0.35 - 0.70 Grade 2=0.70 - 3.50
NTE|3|EC|Grade 3=3.50 - 17.5 Grade 4=17.5 - 50.0 Grade 5=50.0 - 100.0
NTE|4|EC|Grade 6=>100.0
Reply With Quote
  #5  
Old 07-05-2019, 04:56 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 802
agermano is on a distinguished road
Default

Not sure if I understand your requirement.

If you only want the first NTE segment, you can access it without a loop like:

Code:
msg['NTE'][0]['NTE.3']['NTE.3.1'].toString()
If you build your output as xml it will be automatically escaped for you.

msg['NTE'] (or msg.NTE) will give you only the children which have names equal to 'NTE', so you don't need to check that either.

Code:
var reportTxt = <></>; // creates empty XMLList
var specific = 'Specific';
for each (var nte in msg.NTE) {
    var line = nte['NTE.3']['NTE.3.1'].toString();
    // add to text if line starts with specific
    if (line.slice(0,specific.length) == specific) {
        reportTxt =+ <tr>{line}</tr>;
    }
}
channelMap.put('text', reportTxt.toXMLString());
Reply With Quote
Reply

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 06:22 PM.


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