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

loop through hl7v3

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

  • loop through hl7v3

    What i need is simple, but the creation seems to be a bit harder.
    I have a HL7 v3 Message in which i need to loop through a certain property to write it to a sql server.

    Here's an example of the hl7 v3 message:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- section='IM' subSection='CO' realm='UV' artifact='MT-deprecated' domain='CT' xmlns:mif='urn:hl7-org:v3/mif' version='01' root='DEFN'-->
    <Patient xmlns="urn:hl7-org:v3" xmlns:«»xsi="[url]http://www.w3.org/2001/XMLSchema-instance"[/url] classCode="PAT">
       <id root="OMRF" displayable="OMRF1" xsi:type="II"/>
       <addr xsi:type="AD">
          <state>Oklahoma</state>
          <country>American</country>
       </addr>
       <statusCode code="OMRF" xsi:type="CS"/>
       <patientPerson classCode="PSN" determinerCode="INSTANCE">
          <id root="OMRF" displayable="OMRF1" xsi:type="II"/>
          <administrativeGenderCode displayName="Female" xsi:type="CE"/>
          <birthTime value="1962" xsi:type="TS"/>
          <deceasedInd value="1" xsi:type="BL"/>
          <deceasedTime value="2007" xsi:type="TS"/>
          <maritalStatusCode displayName="Maried" xsi:type="CE"/>
          <educationLevelCode displayName="High School" xsi:type="CE"/>
          <disabilityCode displayName="Deaf" xsi:type="CE"/>
          <disabilityCode displayName="Mute" xsi:type="CE"/>
          <religiousAffiliationCode displayName="Atheist" xsi:type="CE"/>
          <raceCode displayName="Caucasian" xsi:type="CE"/>
          <ethnicGroupCode displayName="Hispanic - Latino" xsi:type="CE"/>
       </patientPerson>
    </Patient>
    As you see everything is present once except for the disabilityCode. What i need to do is loop through it to write the info in a db.

    I tried:
    Code:
    var msg = channelMap.get('msg');
    ...
    for(var i=0;i<msg['patientPerson']['disabilityCode'].length;i++){
       ...
    }
    I also tried
    Code:
    var msg = channelMap.get('msg');
    ...
    var counter = 0;
    for each(disability in msg..patientPerson..disabilityCode){
       ...
       counter++;
    }
    but the error i get is that i refer to a null value. Now i have my doubts about the channelMap.get part but the previous programmer here said it always worked...
Working...
X