Sidebar

How can I add the assignedPerson to a CDA?

0 votes
324 views
asked Sep 17, 2015 by michael-h-5027 (14,350 points)

1 Answer

0 votes

You need to know the PVID of the provider that you want to do a query for and add to the CDA.

Do a query on the usr table to find the firstname and lastname of the provider you want to add.

var queryResult = qie.doQuery(
channelCache.getValue('dbName'),
"SELECT firstname, lastname\n" +
"FROM usr\n" +
"WHERE pvid = {mc:PVID}");
messageCache.setValue("firstName", queryResult.getNode("firstname"));
messageCache.setValue("lastName", queryResult.getNode("lastname"));

 

Create a template of the assignedPerson xml.

var value = qie.evaluateTemplate("<assignedPerson>\n" +
"<name>\n" +
"<given>{mc:firstName}</given>\n" +
"<family>{mc:lastName}</family>\n" +
"</name>\n" +
"</assignedPerson>");

 

Now you can add this xml to your existing xml message.

message.addChildAfter('/ClinicalDocument/author/assignedAuthor/telecom', 'assignedPerson', value);

answered Sep 17, 2015 by michael-h-5027 (14,350 points)
...