{% if bundle.id %} id: {{ bundle.id }}{% endif %}
{% assign compositionResource = bundle.entry | where: "resource.resourceType", "Composition" | first %} {% assign composition = compositionResource.resource %} {% if composition.status %} Composition status: {{ composition.status }}{% endif %}
{% if composition.type %} Composition Type: {{ composition.type.coding[0].display }}{% endif %}
Subject:
{% assign subr = bundle.entry | where: "resource.resourceType", "Patient" | first %} {% assign pat = subr.resource %} {% if pat.identifier %} identifier: {{ pat.identifier[0].value }}
{% endif %} {% if pat.name %} Name: {{ pat.name[0].given[0] }} {{ pat.name[0].family }}
{% endif %} {% if pat.active %} active: {{ pat.active }}
{% endif %} {% if pat.gender %} gender: {{ pat.gender }}
{% endif %} {% if pat.birthDate %} Birth Date: {{ pat.birthDate }}
{% endif %}

Sections:


{% for sec in composition.section %}

{{ sec.title }}

{% if sec.title == "Allergies and Intolerances" %} {% assign allergies = bundle.entry | where: "resource.resourceType", "AllergyIntolerance" %}
{% for allergyr in allergies %} {% assign allergy = allergyr.resource %}
{% if allergy.code %} Allergy: {{ allergy.code.coding[0].display }} ({{ allergy.code.coding[0].code }})
{% endif %} {% if allergy.clinicalStatus %} clinicalStatus: {{ allergy.clinicalStatus.coding[0].code }}
{% endif %} {% if allergy.verificationStatus %} verificationStatus: {{ allergy.verificationStatus.coding[0].code }}
{% endif %} {% if allergy.reaction %} Reaction: {{ allergy.reaction[0].manifestation[0].coding[0].display }} ({{ allergy.reaction[0].manifestation[0].coding[0].code }})
{% endif %}
{% endfor %}
{% endif %} {% if sec.title == "Problem List" %} {% assign conds = bundle.entry | where: "resource.resourceType", "Condition" %}
{% for condr in conds %} {% assign cond = condr.resource %}
{% if cond.code %} Condition: {{ cond.code.text }} ({{ cond.code.coding[0].code }})
{% endif %} {% if cond.clinicalStatus %} clinicalStatus: {{ cond.clinicalStatus.coding[0].code }}
{% endif %} {% if cond.asserter %} asserter: {{ cond.asserter.display }}
{% endif %} {% if cond.onsetDateTime %} onsetDateTime: {{ cond.onsetDateTime }}
{% endif %}
{% endfor %}
{% endif %} {% if sec.title == "Medication Summary" %} {% assign medstats = bundle.entry | where: "resource.resourceType", "MedicationStatement" %}
{% for medstatr in medstats %}
{% assign medstat = medstatr.resource %} {% if medstat.medicationReference %} Medication: {{ medstat.medicationReference.display }}
{% endif %} {% if medstat.status %} status: {{ medstat.status }}
{% endif %} {% assign med_id = medstat.medicationReference.reference | replace: 'Medication/', '' %} {% assign medicationr = bundle.entry | where: "resource.id", med_id | first %} {% assign medication = medicationr.resource %} {% if medication %} Medication Detail:
{% if medication.code %} {% for medcodes in medication.code.coding %}
  • System {{ medcodes.system }} Code: {{ medcodes.code }} [{{ medcodes.display }}]
{% endfor %} {% endif %} {% if medication.form %} Dose Form: {{ medication.form.coding[0].display }}
{% endif %} {% for ingrs in medication.ingredient %} Ingredient: {{ ingrs.itemCodeableConcept.coding[0].display }} ({{ ingrs.itemCodeableConcept.coding[0].system }}#{{ ingrs.itemCodeableConcept.coding[0].code }})
{% if ingrs.strength %} strength: {{ ingrs.strength.numerator.value }} {{ ingrs.strength.numerator.code }}/{{ ingrs.strength.denominator.value }} {{ ingrs.strength.denominator.unit }}
{% endif %} {% endfor %}
{% endif %} {% if medstat.dosage[0].route %} Route: {{ medstat.dosage[0].route.coding[0].display }}
{% endif %}
{% endfor %}
{% endif %} {% endfor %}