Announcement

Collapse
No announcement yet.

HL7V2 - NTE issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    If you don't want them removed, instead of ignoring them, escape them.
    i.e.
    xml.replace('*'/g,'\*');

    Comment


    • #3
      Try this:
      Code:
      DocumentText += "<br/>" + org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(documentLine);

      Comment


      • #4
        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

        Comment


        • #5
          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());

          Comment

          Working...
          X