Announcement

Collapse
No announcement yet.

Generate repeating XML in Mirth

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

  • Generate repeating XML in Mirth

    Hi Guys,

    I was just developing CCDA xml, where I have to generate multiple template ID tags, I don't like to go by the way of defining structure in the outbound templates, so I decided to go by this method.

    Code:
    function data()
    {
    var clinicalDocument = new XML ("<clinicalDocument></clinicalDocument>");
    clinicalDocument['realmCode']['@code']="US";
    clinicalDocument['typeId']['@extension']="POCD_HD000040";
    clinicalDocument['typeId']['@root']="2.16.840.1.113883.1.3";
    clinicalDocument['templateId'][0]['@root']="2.16.840.1.113883.10.20.22.1.1";
    clinicalDocument['templateId'][1]['@root']="2.16.840.1.113883.10.20.24.1.1";
    clinicalDocument['templateId'][2]['@root']="2.16.840.1.113883.10.20.24.1.2";
    clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@codeSystemName']="Healthcare Provider Taxonomy";
    clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@displayName']="Adult Medicine";
    logger.info("Data : "+clinicalDocument);
    }
    data();
    I cannot develop template id with referring indexes. It says it is undefined. Obviously i cannot loop too, cannot use counter also. for developing output. I expect output in this format.

    Code:
    <templateId root="2.16.840.1.113883.10.20.22.1.1"/>	
        <templateId root="2.16.840.1.113883.10.20.24.1.1"/>
        <templateId root="2.16.840.1.113883.10.20.24.1.2"/>
    kindly help

    Mirth Interface Engineer
    AWS DevOps
Working...
X