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.
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 loops and counter also for developing output.It says as undefined or error.
I expect output in this format.
<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"/>
Would be great If I could get some answer on this
I happen to come across this question after a long time. From whatever I have learned so far is constructing the XML messages via Mirth Interface in the way I have posted is not good.
This is because of one major reason: - Performance will be greatly affected as it is Javascript with multiple number of lines and codes will be processed one by one.
Best Practice: The best way is to construct the JAVA .jar library with section-wise functions (i.e Allergies,Medications,Vitals etc) in separate class files as per the business needs and call them via Mirth (Rhino Engine).
please put your thoughts as well..