Announcement

Collapse
No announcement yet.

Database Reader to LLP Sender: Generating multiple OBR segments from database query

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

  • Database Reader to LLP Sender: Generating multiple OBR segments from database query

    Channel Configuration:

    Source: Database Reader
    Destination: LLP Sender

    I have to send Lab order information from a clinic to a Lab. We are using ORM^O01 for the same.

    I'm reading Patient information, visit information, insurance information, observation requests(tests to be performed) and diagnosis information from SQL Server 2005 database.

    In the HL7 document to be sent to the lab, we plan to send single patient and single visit information and multiple observation requests (OBR) for this visit.

    we have written an sql query for the same. Now we've mapped the columns generated from the sql query to the outbound template (using transformer). But how do i map/write script for generating multiple OBR segments from the transformer.

    Any help would be appreciated.

    Thanks,
    Sriram

  • #2
    Hi,

    I am also facing the similar problem as I have to insert drug information corresponding to a patient in a HL7 v3.0 file and everytime I querry database with one of the select statements, it is returning just one record, and not the whole information. can anybody tell me whether how to get more than one record from the database in mirth. Thanks for reading the post and any info. will be highly appreciated.

    Thanks and Regards,
    Dheeraj Bansal
    Thanks and Regards,
    Dheeraj Bansal

    Comment


    • #3
      hi dheeraj, have you figured this out? I am having the same issue and the sql that returns multiple rows when it is run on DB only get one record back in Mirth. Any help will be appreciated!

      Comment


      • #4
        Could you post the SQL query and a [suitably anonymised] database row?

        Comment


        • #5
          @sriram & @dheeraj, we are using e4x for Mirth.
          You can construct a HL7 message by following:
          Code:
          var hl7 = new XML();
          hl7['MSH'] = 
          <MSH>
            <MSH.1>|</MSH.1>
            <MSH.2>&</MSH.2>
          //... rest of MSH
          </MSH>;
          If you want to add multiple OBRs and OBXs, here's what you do:
          Code:
          var obr_cnt = 1;
          var obx_cnt = 1;
          
          // obr_obj is an array of objects from which you want to construct OBR segments
          
          for each (var obj in obr_obj) {
          
            hl7['OBR'][obr_cnt-1] = 
            <OBR>
              <OBR.1>{obr_cnt}</OBR.1>
              <OBR.2>{obj.foo}</OBR.2>
              // ..rest of OBR
            </OBR>;
            
            obr_cnt++;
          }
          
          // **************************
          // do the same for obx
          // **************************
          
          // finally... convert XML to hl7 string
          
          var hl7_str = SerializerFactory.getHL7Serializer(false, false, true).fromXML(hl7);

          Comment

          Working...
          X