{{#if (contains (toString (toJsonString msg)) '2.16.840.1.113883.10.20.22.2.22.1')}} {{#with (getFirstCdaSectionsByTemplateId msg '2.16.840.1.113883.10.20.22.2.22.1')}} {{#each (toArray 2_16_840_1_113883_10_20_22_2_22_1.entry) as |encounterEntry|}} {{>Resources/Encounter.hbs encounter=encounterEntry.encounter ID=(generateUUID (toJsonString encounterEntry))}}, {{#with (evaluate 'Utils/GeneratePatientId.hbs' obj=../../msg.ClinicalDocument.recordTarget.patientRole) as |patientId|}} {{>References/Encounter/subject.hbs ID=(generateUUID (toJsonString encounterEntry)) REF=(concat 'Patient/' patientId.Id)}}, {{/with}} {{#if encounterEntry.encounter.performer.assignedEntity}} {{#with (evaluate 'Utils/GeneratePractitionerId.hbs' obj=encounterEntry.encounter.performer.assignedEntity) as |practitionerId|}} {{>Resources/Practitioner.hbs practitioner=encounterEntry.encounter.performer.assignedEntity ID=practitionerId.Id}}, {{>References/Encounter/participant.individual.hbs ID=(generateUUID (toJsonString encounterEntry)) REF=(concat 'Practitioner/' practitionerId.Id)}}, {{/with}} {{/if}} {{#each (toArray encounterEntry.encounter.participant)}} {{#if (eq this.typeCode 'LOC')}} {{#if (contains (toJsonString this.participantRole.templateId) '"2.16.840.1.113883.10.20.22.4.32"')}} {{>Resources/Location.hbs location=this.participantRole ID=(generateUUID (toJsonString this.participantRole))}}, {{>References/Encounter/location.location.hbs ID=(generateUUID (toJsonString encounterEntry)) REF=(concat 'Location/' (generateUUID (toJsonString this.participantRole)))}}, {{/if}} {{/if}} {{/each}} {{#each (toArray encounterEntry.encounter.entryRelationship)}} {{#each (toArray this.act.entryRelationship) as |condEntry|}} {{#if condEntry.observation}} {{>Resources/Condition.hbs conditionEntry=condEntry.observation ID=(generateUUID (toJsonString condEntry.observation))}}, {{#with (evaluate 'Utils/GeneratePatientId.hbs' obj=../../../../msg.ClinicalDocument.recordTarget.patientRole) as |patientId|}} {{>References/Condition/subject.hbs ID=(generateUUID (toJsonString condEntry.observation)) REF=(concat 'Patient/' patientId.Id)}}, {{/with}} {{>References/Encounter/diagnosis.condition.hbs ID=(generateUUID (toJsonString encounterEntry)) REF=(concat 'Condition/' (generateUUID (toJsonString condEntry.observation)))}}, {{/if}} {{/each}} {{/each}} {{/each}} {{/with}} {{/if}}