Announcement

Collapse
No announcement yet.

“<” (less than) sign in physician summary notes causing error in document writer

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

  • “<” (less than) sign in physician summary notes causing error in document writer

    Hello,
    Mirth Connect 3.4.2.8129
    We have a physician summary note from a hospital that was sent to us as an ORU-T01 message. We are sending the message as a pdf using document writer for destination. We transformed the message in document writer destination using the following javascript to create a variable:

    var reportTxt = "";
    for each (seg in msg.children())
    {
    if (seg.name().toString() == "OBX")
    {
    reportTxt += "<tr>" + seg['OBX.5']['OBX.5.1'].toString() + "</tr>";
    }
    }


    channelMap.put('text', reportTxt);

    and placed it into html template under document writer destination as html format to create the pdf:

    <table>
    ${text}
    </table>

    We get the following error:

    Document Writer error
    ERROR MESSAGE: Error writing document
    org.xml.sax.SAXParseException; lineNumber: 235; columnNumber: 77; The content of elements must consist of well-formed character data or markup.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(U nknown Source)
    at com.mirth.connect.connectors.doc.DocumentDispatche r.createPDF(DocumentDispatcher.java:217)
    at com.mirth.connect.connectors.doc.DocumentDispatche r.writeDocument(DocumentDispatcher.java:175)
    at com.mirth.connect.connectors.doc.DocumentDispatche r.send(DocumentDispatcher.java:118)
    at com.mirth.connect.donkey.server.channel.Destinatio nConnector.handleSend(DestinationConnector.java:82 2)
    at com.mirth.connect.donkey.server.channel.Destinatio nConnector.process(DestinationConnector.java:476)
    at com.mirth.connect.donkey.server.channel.Destinatio nChain.doCall(DestinationChain.java:121)
    at com.mirth.connect.donkey.server.channel.Destinatio nChain.call(DestinationChain.java:63)
    at com.mirth.connect.donkey.server.channel.Channel.pr ocess(Channel.java:1715)
    at com.mirth.connect.donkey.server.channel.Channel.di spatchRawMessage(Channel.java:1198)
    at com.mirth.connect.donkey.server.channel.SourceConn ector.dispatchRawMessage(SourceConnector.java:192)
    at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.dispatchRawMessage(DonkeyEngineControlle r.java:1053)
    at com.mirth.connect.server.api.servlets.MessageServl et$2.run(MessageServlet.java:106)
    at java.lang.Thread.run(Unknown Source)

    We found that it was because the physician note had a "<" symbol in their notes found in line OBX 234 and was causing this error. See below:

    OBX|233|FT|000000000^Progress Note EMR No Cosign||movement yesterday. Electrolytes corrected and patient ambulating. Bilirubin||||||F|||20170729144536||00882^MOUSE^MIC KEY^^MD^^MD^^VBA Doc Number
    OBX|234|FT|000000000^Progress Note EMR No Cosign||and LFT's trending down. Will keep pt in hospital until total bilirubin is <||||||F|||20170729144536||00882^MOUSE^MICKEY^^MD^^ MD^^VBA Doc Number
    OBX|235|FT|000000000^Progress Note EMR No Cosign||10 as per surgery recommedations. Also the patient will be given meds for||||||F|||20170729144536||00882^MOUSE^MICKEY^^M D^^MD^^VBA Doc Number

    When we remove "<" from OBX 234 than the pdf is created and sent as expected to destination. This occurs with the greater than sign ">" in physician notes as well. We understand that these are used as brackets for html but what do we need to do to allow these messages with these symbols in the OBX segments to be sent without error?

    How can we fix this? I appreciate everyones help

    Thank you!

  • #2
    Have you tried adding something like .replace("<", "&lt;") ?
    i.e. reportTxt += "<tr>" + seg['OBX.5']['OBX.5.1'].toString().replace("<", "&lt;") + "</tr>";
    Matt

    http://theunofficialmirthadmin.blogspot.com/

    Comment


    • #3
      Worked perfectly

      Originally posted by tiskinty View Post
      Have you tried adding something like .replace("<", "&lt;") ?
      i.e. reportTxt += "<tr>" + seg['OBX.5']['OBX.5.1'].toString().replace("<", "&lt;") + "</tr>";
      Thank you! That is exactly what I was missing Works like a charm now.

      Comment


      • #4
        Thank you. It works perfect now!

        Comment

        Working...
        X