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

Incoming HL7 outgoing XML how to add XML elements

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

  • Incoming HL7 outgoing XML how to add XML elements

    Hi,

    I have XML which I map in the EMR but I can't seem to add a ResultModel element to the XML?
    Here is my setup

    Code:
    / map the patient for now we just map on PID.2 
    tmp['PatientModel']['lastName'] = msg['PID']['PID.5']['PID.5.1'].toString();
    tmp['PatientModel']['firstName'] = msg['PID']['PID.5']['PID.5.2'].toString();
    tmp['PatientModel']['IdentifierModel']['sourceRef']['idvalue'] = "FABLEFACILITY"
    tmp['PatientModel']['IdentifierModel']['idvalue'] = msg['PID']['PID.2']['PID.2.1'].toString();
    
    // loop through all the results and create
    
    i=0;
    logger.error("starting Obx " + msg['OBX'].length);
    
    // OBX
    for (obx in msg..OBX){
         logger.error(msg['OBX'][i]['OBX.5']['OBX.5.1']);
    
        tmp['ResultModel'][i]['resultDt']['datetime'] = msg['OBR'][0]['OBR.7']['OBR.7.1'].toString();
        tmp['ResultModel'][i]['dataTypeRef']['idvalue'] = msg['OBX'][i]['OBX.2']['OBX.2.1'].toString();
        if (msg['OBX'][i]['OBX.2']['OBX.2.1'].toString() == "NM") {
           tmp['ResultModel'][i]['dataTypeRef']['id'] = 56990; // DOUBLE
           tmp['ResultModel'][i]['valueDouble'] = msg['OBX'][i]['OBX.5']['OBX.5.1'].toString();
        } else {
           tmp['ResultModel'][i]['dataTypeRef']['id'] = 79128; // STRING
           tmp['ResultModel'][i]['valueString'] = msg['OBX'][i]['OBX.5']['OBX.5.1'].toString();
        }
    
        i++;
    }
    Incoming
    Code:
    MSH|^~&|LAB|SENDER||POS|200801201000000||ORU^R01|123456|P|2.2
    PID|1|1234455|5544123| |TEST^GREG||19710630|M||U||||||||99887766^^^POS
    OBR|1|34343434|0735321438|0080379^VITAMIN D, 25-HYDROXY||20071219124700|20071219124700|||||||20071220181200||^TESTER^ALIX|||0735300965||^Laboratory Main Floor^100 
    
    Avenue^^MA^02032|200712210129||700^702^73|F||R^^^^^R
    OBX|1|NM|0080379^VITAMIN D, 25-HYDROXY||10|ng/mL|20-57^20^57|L||A~S|F
    OBX|1|NM|21612-7^Reported Patient Age^LN||05|mo^month^ANSI|
    OBX|1|TS|30947-6^Date form completed^LN||20010316|
    OBX|2|FT|30948-4^Vaccination adverse events and treatment, if any^LN|1|fever of 106F, with vomiting, seizures, persistent crying lasting over 3 hours, loss of 
    
    OBX|3|CE|30949-2^Vaccination adverse event outcome^LN|1|E^required emergency room/doctor visit^NIP005|
    OBX|4|CE|30949-2^Vaccination adverse event outcome^LN|1|H^required hospitalization^NIP005|
    OBX|5|NM|30950-0^Number of days hospitalized due to vaccination adverse event^LN|1|02|d^day^ANSI|
    OBX|6|CE|30951-8^Patient recovered^LN||Y^Yes^ HL70239|
    OBX|7|TS|30952-6^Date of vaccination^LN||20010216|
    OBX|8|TS|30953-4^Adverse event onset date and time^LN||200102180900|
    OBX|9|FT|30954-2^Relevant diagnostic tests/lab data^LN||Electrolytes, CBC, Blood culture|
    OBR|2|||30955-9^All vaccines given on date listed in #10^LN|
    OBX|1|CE30955-9&30956-7^Vaccine type^LN|1|08^HepB-Adolescent/pediatric^CVX|
    OBX|2|CE|30955-9&30957-5^Manufacturer^LN|1|MSD^Merck^MVX|
    OBX|3|ST|30955-9&30959-1^Lot number^LN|1|MRK12345|
    OBX|4|CE|30955-9&30958-3^ Route^LN|1|IM^Intramuscular ^HL70162|
    OBX|5|CE|30955-9&31034-2^Site^LN|1|LA^Left arm^ HL70163|
    OBX|6|NM|30955-9&30960-9^Number of previous doses^LN|1|01I
    OBX|7|CE|CE|30955-9&30956-7^Vaccine type^LN|2|50^DTaP-Hib^CVX|
    OBX|8|CE|30955-9&30957-5^ Manufacturer^LN|2|WAL^Wyeth_Ayerst^MVX|
    OBX|9|ST|30955-9&30959-1^Lot number^LN|2|W46932777|S|F
    OBX|10|CE|30955-9&30958-3^ Route^LN|2|IM^Intramuscular^HL70162|
    XML (slimmed down).


    Code:
    <ResultTransaction><PatientModel>
    </PatientModel>
    <ResultModel>
    	<dataTypeRef><id>0</id><display></display><idvalue></idvalue></dataTypeRef>
    	<valueDate><date></date><datetime></datetime></valueDate>
    	<valueUnitRef><id>0</id><display></display><idvalue></idvalue></valueUnitRef>
    	<valueDateOffset>0</valueDateOffset>
    	<resultStatusRef><id>0</id><display></display><idvalue></idvalue></resultStatusRef>
    	<resultId>0</resultId>
    	<resultDtOffset>0</resultDtOffset>
    	<resultDt><date></date><datetime></datetime></resultDt>
    	<activeInd>1</activeInd>
    	<valueDouble>0.0</valueDouble>
    	<valueFlagRef><id>0</id><display></display><idvalue></idvalue></valueFlagRef>
    	<valueInt>0</valueInt>
    	<valueString><![CDATA[]]></valueString>
    	<procedureRef><id>0</id><display></display><idvalue></idvalue></procedureRef>
    	<valueUnit2Ref><id>0</id><display></display><idvalue></idvalue></valueUnit2Ref>
    	<patientId>0</patientId>
    </ResultModel>
    </ResultTransaction>
    Post edited by: caultonpos, at: 01/16/2008 18:54

    Post edited by: caultonpos, at: 01/16/2008 20:30
Working...
X