CDA Export Template JSON example
{
"id": "default-ccd-template",
"script": "function generateCdaExchangeComposition(inputMap) { /* create the composition for our document */ let composition = ResourceBuilder.build('Composition'); /* currently CCD is the document type with the most support. There is limited support for 'TransferSummary' as well. */ composition.setType('ContinuityOfCareDocument'); let patient = inputMap['patient']; composition.setSubject(patient); /* get current timeStamp for use in auto-generated IDs and timestamps */ let currentDate = Date.now(); composition.setDate(currentDate); /* boilerplate fields for this document-generation template */ composition.language = 'en-US'; composition.identifier.system = '1.23.456.7.890123.4.5678'; let splitSubject = patient.split('/'); if (splitSubject.length > 1) { composition.identifier.value = patient.split('/')[1] + currentDate; } else { composition.identifier.value = patient + currentDate; } composition.title = 'Continuity of Care Document'; let problemSection = composition.addSection('problem'); let problemList = Fhir .search() .forResource('Condition') .where('subject', patient) .asList(); problemSection.populate(problemList); let medicationSection = composition.addSection('medication'); let medicationList = Fhir .search() .forResource('MedicationRequest') .where('subject', patient) .asList(); let medicationList2 = Fhir .search() .forResource('MedicationAdministration') .where('subject', patient) .asList(); medicationSection .populate(medicationList) .populate(medicationList2); let resultSection = composition.addSection('result'); let resultList = Fhir .search() .forResource('DiagnosticReport') .where('subject', patient) .asList(); resultSection.populate(resultList); let vitalSection = composition.addSection('vitalsign'); let vitalList = Fhir .search() .forResource('Observation') .where('subject', patient) .where('category', 'vital-signs') .asList(); vitalSection.populate(vitalList); let allergySection = composition.addSection('allergyIntolerance'); let allergyList = Fhir .search() .forResource('AllergyIntolerance') .where('patient', patient) .asList(); allergySection.populate(allergyList); let socialHistorySection = composition.addSection('socialHistory'); let historyList = Fhir .search() .forResource('Observation') .where('subject', patient) .where('category', 'social-history') .asList(); socialHistorySection.populate(historyList); /* let immunizationSection = composition.addSection('immunization'); let immunizationList = Fhir .search() .forResource('Immunization') .where('patient', patient) .asList(); immunizationSection.populate(immunizationList); */ /* let proceduresSection = composition.addSection('procedures'); let proceduresList = Fhir .search() .forResource('Procedure') .where('subject', patient) .asList(); proceduresSection.populate(proceduresList); */ let medicalEquipmentSection = composition.addSection('medicalequipment'); let deviceList = Fhir .search() .forResource('DeviceUseStatement') .where('subject', patient) .asList();medicalEquipmentSection.populate(deviceList); return composition;}",
"params": ["Patient"],
"description": "Aggregate CCD Template"
}
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.