Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

HL7 ---> SQL Query -- result back out to HL7 ?

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

  • HL7 ---> SQL Query -- result back out to HL7 ?

    Hi All,

    I am trying to see if I can use Mirth to setup a test system where I send it a HL7 query message (QRY^A19), take the patient ID out of this message, then query a back end SQL test server and retrieve the patient details and stuff these back into another HL7 message response (ADR^A19).

    Is this possible? If yes, does anyone have a simple step by step guide on how to achieve this or very similar?

    I am a Mirth newbie so please, be gentle!

    Many thanks!

  • #2
    Re:HL7 ---> SQL Query -- result back out to HL7 ?

    This is the naive way I would follow for a "very basic"
    implementation; more experienced users are very welcome to
    criticize...in this way I will learn something!

    First of all I would prepare two sample messages corresponding to
    the desired input and output messages.

    Then create a new Mirth channel, with incoming data HL7 v2, having
    as source an LLP listener and as destination an LLP sender.

    In the channel tasks choose "edit transformer". Then select
    "message templates" on the right panel. Paste the input (inbound)
    and output (outbound) messages.

    Add a "new step" in the "Transformer Tasks". Change the default
    type "mapper" to "javascript".

    Now extract the patientID from the inbound message and put it as
    a variable in the javascript. It should be something like this in
    the javascript:

    Code:
     var patientID = msg['PID']['PID.3']['PID.3.1'];
    (just drag from the "message tree" view the desired value and drop to the
    area in which the javascript is being written)

    Then it is time to check the DB for the patient infos using his
    PatientID. For example, if we would just like to retrieve the
    patient name:

    Code:
     var driver = "com.mysql.jdbc.Driver";
        var address="jdbc:mysql://localhost:3306/patientIndex";
        var username = "mirth";
        var password = "mirth";
    
        var dbConn =
        DatabaseConnectionFactory.createDatabaseConnection(driver,address,username,password);
        var result;
        result = dbConn.executeCachedQuery("select name  from patient  where patientID='" + $('patientID') + "'"«»);
        result.first();
        var name = result.getString("name"«»);
    At this point, we have to put the retrieved infos in the outbound
    message. Something like this in the javascript:

    Code:
     tmp['PID']['PID.5']['PID.5.2']= name;
    Finally leave the transformer, come back to the channel and tell
    the LLP sender to send the transformed data (i.e. drag & drop
    "Transformed Data" from the left panel to the "Template" area in the
    destination).

    "Save", "deploy all" and start testing!

    davide

    Comment


    • #3
      Re:HL7 ---> SQL Query -- result back out to HL7 ?

      Many thanks for the detailed reply avadoro77, I will give this a go and report back.

      Comment


      • #4
        Hello Reapes

        Did you manage to get this to work? I am working on a very similar project. Would really appreciate your guidance please.

        Thank you.

        Comment

        Working...
        X