CH ORF (R4)
3.0.0-ci-build - ci-build
CH ORF (R4), published by HL7 Switzerland. This guide is not an authorized publication; it is the continuous build for version 3.0.0-ci-build built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/hl7ch/ch-orf/ and changes regularly. See the Directory of published versions
Draft as of 2024-10-03 |
{
"resourceType" : "StructureMap",
"id" : "OrfQrToBundle",
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap OrfQrToBundle</b></p><a name=\"OrfQrToBundle\"> </a><a name=\"hcOrfQrToBundle\"> </a><a name=\"OrfQrToBundle-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> "</span>http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle<span style=\"color: navy\">" = "</span>OrfQrToBundle<span style=\"color: navy\">"\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">ORF QuestionnaireResponse to Bundle</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">2021-01-11 Oliver Egger</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Bundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">" </span><b>alias </b>QuestionnaireResponseSource <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">" </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/composition.html\" title=\"Composition\">http://hl7.org/fhir/StructureDefinition/Composition</a><span style=\"color: navy\">" </span><b>alias </b>Composition <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">" </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/relatedperson.html\" title=\"RelatedPerson\">http://hl7.org/fhir/StructureDefinition/RelatedPerson</a><span style=\"color: navy\">" </span><b>alias </b>RelatedPerson <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/organization.html\" title=\"Organization\">http://hl7.org/fhir/StructureDefinition/Organization</a><span style=\"color: navy\">" </span><b>alias </b>Organization <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/practitioner.html\" title=\"Practitioner\">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style=\"color: navy\">" </span><b>alias </b>Practitioner <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/practitionerrole.html\" title=\"PractitionerRole\">http://hl7.org/fhir/StructureDefinition/PractitionerRole</a><span style=\"color: navy\">" </span><b>alias </b>PractitionerRole <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/servicerequest.html\" title=\"ServiceRequest\">http://hl7.org/fhir/StructureDefinition/ServiceRequest</a><span style=\"color: navy\">" </span><b>alias </b>ServiceRequest <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/extensibility.html#Extension\" title=\"Extension\">http://hl7.org/fhir/StructureDefinition/Extension</a><span style=\"color: navy\">" </span><b>alias </b>Extension <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/episodeofcare.html\" title=\"EpisodeOfCare\">http://hl7.org/fhir/StructureDefinition/EpisodeOfCare</a><span style=\"color: navy\">" </span><b>alias </b>EpisodeOfCare <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">" </span><b>alias </b>QuestionnaireResponse <b>as </b><b>target</b>\r\n\r\n<b>group </b>OrfQrToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span> bundle.identifier<b> as </b><span style=\"color: maroon\">documentIdentifier</span><span style=\"color: navy\">, </span> documentIdentifier.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">, </span> documentIdentifier.value = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">)</span> <i>"documentIdentifier"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span> composition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> bundle.timestamp = <span style=\"color: navy\">(</span>now()<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> bundle.type = <span style=\"color: blue\">'document'</span><span style=\"color: navy\">, </span> composition.date = <span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> composition.title = <span style=\"color: blue\">'Order and Referral by Form'</span><span style=\"color: navy\">, </span> composition.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'419891008'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> composition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'721963009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span> patient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'QuestionnaireResponse'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">questionnaireresp</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<b> then </b>QuestionnaireResponseMap<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">)</span> <i>"questionnaireresp"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> questionnaireresp.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ServiceRequest'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span> servicerequest.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><b> then </b>QrToBundle<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>"orfbundle"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"OrfQrToBundle"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>QuestionnaireResponseMap<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>QuestionnaireResponse<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.identifier = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.basedOn<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.basedOn = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.partOf<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.partOf = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.questionnaire<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.questionnaire = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.status<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.status = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.subject<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.subject = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.encounter<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.encounter = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.authored<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.authored = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.author<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.author = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.source<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.source = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -> </b></span>tgt.item = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>QrToGroups<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'order'<b> then </b>OrderItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"grporder"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'receiver'<b> then </b>ReceiverInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"receiver"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'initiator'<b> then </b>InitiatorInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"grpinitiator"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'patient'<b> then </b>PatientItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"grppatient"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'requestedEncounter'<b> then </b>RequestedEncounterItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"grprequestedencounter"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'coverage'<b> then </b>Coverage<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"grprequestedencounter"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'sender'<b> then </b>SenderAuthorInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"grpsender"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'receiverCopy'<b> then </b>ReceiverCopy<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"receiverCopy"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'appointment'<b> then </b>Appointment<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"appointment"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'antecedentEpisodeOfCare'<b> then </b>AntecedentEpisodeOfCareInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">)</span> <i>"AntecedentEpisodeOfCareInit"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'consent'<b> then </b>Consent<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">)</span> <i>"consent"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'note'<b> then </b>Note<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"note"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>OrderItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.precedentDocumentIdentifier') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-precedentdocument'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>'urn:uuid:' + %item.answer.value<span style=\"color: navy\">)</span> <i>"orderPrecedentDocumentIdentifier"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.placerOrderIdentifier') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>placer</b><span style=\"color: navy\">, </span> value.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'PLAC'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"orderPlacerOrderIdentifier"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.placerOrderIdentifierDomain') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>placer</b><span style=\"color: navy\">, </span> value.system = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"orderPlacerOrderIdentifierDomain"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.fillerOrderIdentifier') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>filler</b><span style=\"color: navy\">, </span> value.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'FILL'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"orderFillerOrderIdentifier"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.fillerOrderIdentifierDomain') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> serviceRequest.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>filler</b><span style=\"color: navy\">, </span> value.system = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"orderFillerOrderIdentifierDomain"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.authoredOn') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>serviceRequest.authoredOn = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.priority') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>serviceRequest.priority = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocument')<b> then</b><span style=\"color: navy\"> {\r\n</span> item<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span> practitionerDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>UrgentNotificationContactForRequestItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">)</span> <i>"data"</i><span style=\"color: navy\">;</span>\r\n item<b> then </b>ExtOrfUrgentNotificationContactForRequest<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>"extension"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"orderNotificationContactDocumentItems"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"ordeNnotificationContactDocument"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocumentResponse')<b> then</b><span style=\"color: navy\"> {\r\n</span> item<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span> practitionerDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>UrgentNotificationContactForResponseItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">)</span> <i>"data"</i><span style=\"color: navy\">;</span>\r\n item<b> then </b>ExtOrfUrgentNotificationContactForResponse<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>"extension"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"orderNotificationContactDocumentResponseItems"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"orderNotificationContactDocumentResponse"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForRequestPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>"senderAuthorPractitionerTitle"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocument.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForRequestItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocument.practitioner')<b> then </b>UrgentNotificationContactForRequestPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfUrgentNotificationContactForRequest<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactforthisdocument'</span> <i>"url"</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -> </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitionerRole.id<span style=\"color: navy\">)</span> <i>"practitionerRole"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForResponsePractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>"senderAuthorPractitionerTitle"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'order.notificationContactDocumentResponse.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>UrgentNotificationContactForResponseItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'order.notificationContactDocumentResponse.practitioner')<b> then </b>UrgentNotificationContactForResponsePractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfUrgentNotificationContactForResponse<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactfortheresponsetothisdocument'</span> <i>"url"</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -> </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitionerRole.id<span style=\"color: navy\">)</span> <i>"practitionerRole"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>"receiverPractitionerTitle"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverPractitionerGln"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverPractitionerZsr"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverPractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverPractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.gln') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverOrganizationGln"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.zsr') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverOrganizationZsr"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"receiverOrganizationStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverOrganizationPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverOrganizationCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiver.organization.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverOrganizationCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiver.practitioner')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>ReceiverPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiver.organization')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>ReceiverOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Consent<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'consent.statement') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Consent'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">consent</span><span style=\"color: navy\">, </span> consent.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> consent.scope<b> as </b><span style=\"color: maroon\">scope</span><span style=\"color: navy\">, </span> scope.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'treatment'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/consentscope'</span><span style=\"color: navy\">, </span> consent.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'59284-0'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> consent.policyRule<b> as </b><span style=\"color: maroon\">policyRule</span><span style=\"color: navy\">, </span> policyRule.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'385432009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> consent.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-patientconsent'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> consent.extension<b> as </b><span style=\"color: maroon\">extcode</span><span style=\"color: navy\">, </span> extcode.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentcode'</span><span style=\"color: navy\">, </span> extcode.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'consent.statement.note') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> consent.extension<b> as </b><span style=\"color: maroon\">extnote</span><span style=\"color: navy\">, </span> extnote.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentnote'</span><span style=\"color: navy\">, </span> extnote.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"consentStatementNote"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"consentStatement"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span> practitionerRole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-receiver'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><b> then </b>ReceiverItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">)</span> <i>"receiver"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.personalrelation') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-personalrelation'</span><span style=\"color: navy\">, </span> extension.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"Initiatorpersonalrelation"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.legalrelation') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-legalrelation'</span><span style=\"color: navy\">, </span> extension.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"Initiatorlegalrelation"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'initiator.practitionerRole')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">, </span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> practitionerrole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-personorganization'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>InitiatorPractitionerRoleItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">)</span> <i>"data"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"InitiatorPractitionerRoleItems"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'initiator.relatedPerson')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'RelatedPerson'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span> ext.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'ch-orf-personorganization'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> relatedPerson.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> relatedPerson.patient<b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>InitiatorRelatedPersonItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">)</span> <i>"data"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"InitiatorelatedPerson"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorRelatedPersonItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\"> : </span>RelatedPerson<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"InitiatorelatedPersonPhone"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"Phone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorelatedPersonEmail"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"InitiatorelatedPersonStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorelatedPersonPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorelatedPersonCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.relatedPerson.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorelatedPersonCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorPractitionerRoleItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'initiator.practitionerRole.practitioner')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>InitiatorPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'initiator.practitionerRole.organization')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>InitiatorOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>"InitiatorractitionerRolePractitionerTitle"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorractitionerRolePractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorractitionerRolePractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverPractitionerGln"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverPractitionerZsr"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"InitiatorractitionerRoleOrganizationStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorractitionerRoleOrganizationPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorractitionerRoleOrganizationCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'initiator.practitionerRole.organization.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"InitiatorractitionerRoleOrganizationCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>FamilyDoctorInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span> practitionerRole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> patient.generalPractitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">gp</span><span style=\"color: navy\">, </span> gp.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'familydoctor.practitioner')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>FamilyDoctorPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'familydoctor.organization')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>FamilyDoctorOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"FamilyDoctorInit"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>FamilyDoctorPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorPractitionerGln"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorPractitionerZsr"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>"familydoctorPractitionerTitle"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorPractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorPractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>FamilyDoctorOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"familydoctorOrganizationStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorOrganizationPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorOrganizationCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorOrganizationCountry"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.gln') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorOrganizationGln"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'familydoctor.organization.zsr') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"familydoctorOrganizationZsr"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>AntecedentEpisodeOfCareInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-antecedentepisodeofcare'</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'EpisodeOfCare'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">episodeofcare</span><span style=\"color: navy\">, </span> episodeofcare.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> episodeofcare.status = <span style=\"color: blue\">'finished'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><span style=\"color: navy\">, </span> ref.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %episodeofcare.id<span style=\"color: navy\">)</span><b> then </b>AntecedentEpisodeOfCareItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">episodeofcare</span><span style=\"color: navy\">)</span> <i>"AntecedentEpisodeOfCareItems"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>AntecedentEpisodeOfCareItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">episodeofcare</span><span style=\"color: navy\"> : </span>EpisodeOfCare<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.start') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> episodeofcare.statusHistory<b> as </b><span style=\"color: maroon\">statusHistory</span><span style=\"color: navy\">, </span> statusHistory.status = <span style=\"color: blue\">'finished'</span><span style=\"color: navy\">, </span> statusHistory.period<b> as </b><span style=\"color: maroon\">period</span><span style=\"color: navy\">, </span> period.start = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> period.end = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">iteme</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.end') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>period.end = <span style=\"color: navy\">(</span>%iteme.answer.value<span style=\"color: navy\">)</span> <i>"antecedentEpisodeOfCareEndNotSameAsStart"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"antecedentEpisodeOfCareRequestedPeriodStart"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'antecedentEpisodeOfCare.managingOrganization')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> episodeofcare.patient = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %tgt.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> episodeofcare.managingOrganization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>AntecedentEpisodeOfCareOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>"antecedentEpisodeOfCareManagingOrganization"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>AntecedentEpisodeOfCareOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"antecedentEpisodeOfCareorganizationStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>InitiatorInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span> composition.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-initiator'</span><b> then </b>InitiatorItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ext</span><span style=\"color: navy\">)</span> <i>"receiver"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PatientItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'familydoctor'<b> then </b>FamilyDoctorInit<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>"grpfamily"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> then </b>PatientItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>patientName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.maidenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.name<b> as </b><span style=\"color: maroon\">name</span><span style=\"color: navy\">, </span> name.use = <span style=\"color: blue\">'maiden'</span><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>patientName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.localPid') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>localpid</b><span style=\"color: navy\">, </span> value.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'MR'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientLocalPid"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.localPidDomain') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.identifier<b> as </b><span style=\"color: maroon\">value</span> <b>share</b> <b>localpid</b><span style=\"color: navy\">, </span> value.system = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientLocalPidDomain"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.birthDate') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>tgt.birthDate = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.gender') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>tgt.gender = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.maritalStatus') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> tgt.maritalStatus<b> as </b><span style=\"color: maroon\">maritalStatus</span><span style=\"color: navy\">, </span> maritalStatus.coding = <span style=\"color: maroon\">coding</span> <i>"maritalStatus"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"patientMaritalStatus"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span> tgt.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"PatientPhone"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"PatientPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientEmail"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"PatientStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> tgt.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientCountry"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.languageOfCorrespondence') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -> </b></span> tgt.communication<b> as </b><span style=\"color: maroon\">communication</span><span style=\"color: navy\">, </span> communication.preferred = <span style=\"color: blue\">true</span><span style=\"color: navy\">, </span> communication.language<b> as </b><span style=\"color: maroon\">language</span><span style=\"color: navy\">, </span> language.coding = <span style=\"color: maroon\">coding</span> <i>"languageOfCorrespondence"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"PatientLanguageOfCorrespondence"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'patient.contactperson')<span style=\"color: navy\"><b> -> </b></span>tgt.contact<b> as </b><span style=\"color: maroon\">contact</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> contact.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>contactName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> contact.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>contactName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span> tgt.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"PatientPhone"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"PatientContactpersonPhone"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> contact.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientEmail"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'patient.contactperson.relationship') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> contact.relationship<b> as </b><span style=\"color: maroon\">relationship</span><span style=\"color: navy\">, </span> relationship.text = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"PatientContactpersonRelationship"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"contact"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>RequestedEncounterItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Encounter'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">encounter</span><span style=\"color: navy\">, </span> encounter.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> encounter.status = <span style=\"color: blue\">'planned'</span><span style=\"color: navy\">, </span> serviceRequest.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> encounter.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-requestedencounterdetails'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'requestedEncounter.class') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>encounter.class = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"requestedEncounterClass"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'requestedEncounter.desiredAccommodation') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> encounter.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-desiredaccommodation'</span><span style=\"color: navy\">, </span> extension.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"requestedEncounterDesiredAccommodation"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"RequestedEncounterItems"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Coverage<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.beneficiary</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.beneficiary.ahvn13</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.beneficiary')<b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.beneficiary.ahvn13') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> patient.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.32'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageBeneficiaryAhvn13"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coverageBeneficiary"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.kvg</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.kvg.name</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.kvg.insuranceCardNumber</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.kvg')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'KVG'</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.kvg.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageKvgName"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.kvg.insuranceCardNumber') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'VeKa'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageKvgInsuranceCardNumber"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coveragekvg"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.uvg\tUnfallversicherung (nach UVG)\t0..1\tgroup\t\tDefinition: Coverage.type</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.uvg.name\tName der Versicherung\t0..1\tstring\t\tDefinition: Coverage.payor</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.uvg.claimNumber\tSchadennummer\t0..1\tstring\t\tDefinition: Coverage.identifier</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.uvg')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'UVG'</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.uvg.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageUvgName"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.uvg.claimNumber') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'Claim'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageUvgClaimNumber"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coverageuvg"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.vvg\tZusatzversicherung (nach VVG)\t0..1\tgroup\t\tDefinition: Coverage.type</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.vvg.name\tName der Versicherung\t0..1\tstring\t\tDefinition: Coverage.payor</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.vvg.insuranceCardNumber\tKennnummer der Versichertenkarte\t0..1\tstring\t\tDefinition: Coverage.identifier</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.vvg')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'VVG'</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.vvg.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageVvgName"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.vvg.insuranceCardNumber') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'VeKa'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageVvgInsuranceCardNumber"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coveragevvg"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.iv\tInvalidenversicherung (IV)\t0..1\tgroup\t\tDefinition: Coverage.type</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.iv.verfuegungsnummer</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.iv')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'IVG'</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.iv.verfuegungsnummer') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'IV'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: blue\">'IV'</span> <i>"coverageivverfuegungsnummer"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coverageiv"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.mv\tMilitärversicherung (MV)\t0..1\tgroup\t\tDefinition: Coverage.type</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.mv.versichertennummer</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.mv')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'MVG'</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.mv.versichertennummer') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.type<b> as </b><span style=\"color: maroon\">typeid</span><span style=\"color: navy\">, </span> typeid.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'MV'</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: blue\">'MV'</span> <i>"coveragemvversichertennummer"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coveragemv"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.self\tSelbstzahler\t0..1\tgroup\t\tDefinition: Coverage.type</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.self.familyName\tName\t0..1\tstring\t\tDefinition: Coverage.payor</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.self.givenName\tVorname\t0..1\tstring\t\tDefinition: Coverage.payor</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.self')<b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.patient') and answer.exists() and answer.value)<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'Self'</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"payor"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item2</span><b> where </b>((linkId.value = 'coverage.self.patientRelatedPerson') and answer.exists() and answer.value)<b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'coverage.self.relatedPerson')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e5.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'Self'</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e6</span><span style=\"color: navy\">, </span> e6.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'RelatedPerson'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span> relatedPerson.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid6</span><span style=\"color: navy\">, </span> e6.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid6</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.payor<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %relatedPerson.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> relatedPerson.patient<b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then </b>CoverageRelatedPersonItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">)</span> <i>"coverageselfrelatedPerson"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coverageselfpatientrelated"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"self"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other\tAnderer Kostenträger\t0..1\tgroup\t\tDefinition: Coverage.type</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other.name\tName des Kostenträgers\t0..1\tstring\t\tDefinition: Coverage.payor</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other.id\tBeliebige ID\t0..1\tstring\t\tDefinition: Coverage.identifier</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">coverage.other.id.note TODO</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>where(linkId.value = 'coverage.other')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coverage'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coverage</span><span style=\"color: navy\">, </span> coverage.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.insurance<b> as </b><span style=\"color: maroon\">insurance</span><span style=\"color: navy\">, </span> insurance.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> coverage.beneficiary = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> coverage.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'Other'</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.other.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.payor<b> as </b><span style=\"color: maroon\">payor</span><span style=\"color: navy\">, </span> payor.reference<b> as </b><span style=\"color: maroon\">refcontained</span><span style=\"color: navy\">, </span> refcontained.value = <span style=\"color: blue\">'#org'</span><span style=\"color: navy\">, </span> coverage.contained = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <span style=\"color: blue\">'org'</span><span style=\"color: navy\">, </span> organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageOtherName"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.other.id') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> coverage.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\">, </span> identifier.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageOtherId"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"coveragevvg"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>CoverageRelatedPersonItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\"> : </span>RelatedPerson<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"coverageSelfRelatedPersonPhone"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"Phone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageSelfRelatedPersonEmail"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"coverageSelfRelatedPersonStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageSelfRelatedPersonPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageSelfRelatedPersonCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'coverage.self.relatedPerson.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"coverageSelfRelatedPersonCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>"senderAuthorPractitionerTitle"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.gln') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerGln"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.zsr') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerZsr"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.gln') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.51.1.3'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationGln"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.zsr') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.identifier<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.123.100.2.1.1'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationZsr"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.author.organization.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorOrganizationCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.author.practitioner')<b> then </b>SenderAuthorPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.author.organization')<b> then </b>SenderAuthorOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderDataEntererPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'sender.dataenterer.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"senderAuthorPractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderDataEntererItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.dataenterer.practitioner')<b> then </b>SenderDataEntererPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ChExtEprDataEnterer<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer'</span> <i>"url"</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -> </b></span> ext.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'enterer'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %practitionerRole.id<span style=\"color: navy\">)</span> <i>"practitionerRole"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SenderAuthorInit<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span> practitionerRole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.author = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.requester = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.author')<b> then </b>SenderAuthorItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>"senderAuthor"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'sender.dataenterer')<b> then</b><span style=\"color: navy\"> {\r\n</span> item<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span> practitionerDataEnterer.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> practitionerRoleDataEnterer.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>SenderDataEntererItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span> <i>"data"</i><span style=\"color: navy\">;</span>\r\n item<b> then </b>ChExtEprDataEnterer<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerRoleDataEnterer</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>"extension"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"senderDataentererItems"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"senderDataenterer"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"sender"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyRelatedPersonItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\"> : </span>RelatedPerson<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.phone') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyRelatedPersonPhone"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"Phone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyRelatedPersonEmail"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyRelatedPersonStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyRelatedPersonPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyRelatedPersonCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.relatedPerson.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> relatedPerson.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyRelatedPersonCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyPractitionerItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">practitioner</span><span style=\"color: navy\"> : </span>Practitioner<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.familyName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.givenName') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.title') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>practitionerName</b><span style=\"color: navy\">, </span> name.prefix = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">prefix</span><span style=\"color: navy\">, </span> prefix.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: blue\">'AC'</span> <i>"receiverCopyPractitionerRolePractitionerTitle"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyPractitionerRolePractitionerPhone"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.practitioner.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> practitioner.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyPractitionerRolePractitionerEmail"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyOrganizationItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">organization</span><span style=\"color: navy\"> : </span>Organization<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.name = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyPractitionerRoleOrganizationStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"itemAnswer"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyPractitionerRoleOrganizationPostalCode"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyPractitionerRoleOrganizationCity"</i><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'receiverCopy.practitionerRole.organization.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> organization.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"receiverCopyPractitionerRoleOrganizationCountry"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopyPractitionerRoleItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">practitionerRole</span><span style=\"color: navy\"> : </span>PractitionerRole<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiverCopy.practitionerRole.practitioner')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> practitionerRole.practitioner = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e2.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">)</span><b> then </b>ReceiverCopyPractitionerItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'receiverCopy.practitionerRole.organization')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e3</span><span style=\"color: navy\">, </span> e3.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">organization</span><span style=\"color: navy\">, </span> organization.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">, </span> practitionerRole.organization = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e3.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid3</span><span style=\"color: navy\">)</span><b> then </b>ReceiverCopyOrganizationItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">organization</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfCopyReceiverPatient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver'</span> <i>"url"</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -> </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"patient"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfCopyReceiverPractitionerRole<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">res</span><span style=\"color: navy\"> : </span>PractitionerRole, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver'</span> <i>"url"</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -> </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %res.id<span style=\"color: navy\">)</span> <i>"organization"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ExtOrfCopyReceiverRelatedPerson<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">res</span><span style=\"color: navy\"> : </span>RelatedPerson, <b>target</b> <span style=\"color: maroon\">ext</span><span style=\"color: navy\"> : </span>Extension<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> src<span style=\"color: navy\"><b> -> </b></span>ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver'</span> <i>"url"</i><span style=\"color: navy\">;</span>\r\n src<span style=\"color: navy\"><b> -> </b></span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %res.id<span style=\"color: navy\">)</span> <i>"organization"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReceiverCopy<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">grp</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'receiverCopy.practitionerRole')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'PractitionerRole'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> practitionerrole.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>ReceiverCopyPractitionerRoleItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">)</span> <i>"data"</i><span style=\"color: navy\">;</span>\r\n item<b> then </b>ExtOrfCopyReceiverPractitionerRole<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">practitionerrole</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>"extension"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"receiverCopyPractitionerRole1"</i><span style=\"color: navy\">;</span>\r\n grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'receiverCopy.patient')<span style=\"color: navy\"><b> -> </b></span>composition.extension<b> as </b><span style=\"color: maroon\">extension</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>ExtOrfCopyReceiverPatient<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>"extension"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"receiverCopyPatient"</i><span style=\"color: navy\">;</span>\r\n grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = 'receiverCopy.relatedPerson')<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'RelatedPerson'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span> composition.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> relatedPerson.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> relatedPerson.patient<b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item<b> then </b>ReceiverCopyRelatedPersonItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">)</span> <i>"data"</i><span style=\"color: navy\">;</span>\r\n item<b> then </b>ExtOrfCopyReceiverRelatedPerson<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">relatedPerson</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">extension</span><span style=\"color: navy\">)</span> <i>"extension"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"receiverCopyRelatedPerson"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Appointment<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">grp</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> grp<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Appointment'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">appointment</span><span style=\"color: navy\">, </span> appointment.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.extension<b> as </b><span style=\"color: maroon\">extension</span><span style=\"color: navy\">, </span> extension.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-locationandtime'</span><span style=\"color: navy\">, </span> extension.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid4<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'appointment.status') and (answer.value.code = 'proposed'))<span style=\"color: navy\"><b> -> </b></span>appointment.status = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> grp.item<b> as </b><span style=\"color: maroon\">itemp</span><b> where </b>(linkId.value = 'appointment.requestedPeriod')<b> then</b><span style=\"color: navy\"> {\r\n</span> itemp.item<b> as </b><span style=\"color: maroon\">item2</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> appointment.requestedPeriod<b> as </b><span style=\"color: maroon\">requestedPeriod</span><span style=\"color: navy\">, </span> requestedPeriod.start = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> requestedPeriod.end = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> itemp.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>requestedPeriod.end = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>"appointmentRequestedPeriodendifnotsameasstart"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"appointmentRequestedPeriodStart"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"appointmentRequestedPeriod"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"proposed"</i><span style=\"color: navy\">;</span>\r\n grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'appointment.status') and ((answer.value.code = 'pending') or (answer.value.code = 'booked')))<span style=\"color: navy\"><b> -> </b></span>appointment.status = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> grp.item<b> as </b><span style=\"color: maroon\">itemp</span><b> where </b>(linkId.value = 'appointment.requestedPeriod')<b> then</b><span style=\"color: navy\"> {\r\n</span> itemp.item<b> as </b><span style=\"color: maroon\">item2</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> appointment.start = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> appointment.end = <span style=\"color: navy\">(</span>%item2.answer.value<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> itemp.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>appointment.end = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>"appointmentendifnotsameasstart"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"appointmentStart"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"appointmentStartend"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"pendingorbooked"</i><span style=\"color: navy\">;</span>\r\n grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'appointment.patientInstruction') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>appointment.patientInstruction = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"appointmentPatientInstruction"</i><span style=\"color: navy\">;</span>\r\n grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'appointment.location')<b> then</b><span style=\"color: navy\"> {\r\n</span> item<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Location'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">location</span><span style=\"color: navy\">, </span> location.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid5<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> appointment.participant<b> as </b><span style=\"color: maroon\">participant</span><span style=\"color: navy\">, </span> participant.status = <span style=\"color: blue\">'tentative'</span><span style=\"color: navy\">, </span> participant.actor = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">actor</span><span style=\"color: navy\">, </span> actor.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %location.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.name') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>location.name = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.phone') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> location.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'phone'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>"appointmentLocationPhone"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.email') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> location.telecom<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> value.system = <span style=\"color: blue\">'email'</span><span style=\"color: navy\">, </span> value.value = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>"appointmentLocationEmail"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.streetAddressLine') and answer.exists())<span style=\"color: navy\"><b> -> </b></span>location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><b> then</b><span style=\"color: navy\"> {\r\n</span> item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -> </b></span>address.line = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span> <i>"line"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"appointmentLocationStreetAddressLine"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.postalCode') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.postalCode = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>"appointmentLocationPostalCode"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.city') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.city = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>"appointmentlocationCity"</i><span style=\"color: navy\">;</span>\r\n item.item<b> as </b><span style=\"color: maroon\">item3</span><b> where </b>((linkId.value = 'appointment.location.country') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> location.address<b> as </b><span style=\"color: maroon\">address</span> <b>share</b> <b>orgAddress</b><span style=\"color: navy\">, </span> address.country = <span style=\"color: navy\">(</span>%item3.answer.value<span style=\"color: navy\">)</span> <i>"appointmentLocationCountry"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"location"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"appointmentLocation"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"Appointment"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>Note<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">grp</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> grp.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId = 'note.text') and answer.exists())<span style=\"color: navy\"><b> -> </b></span> serviceRequest.note<b> as </b><span style=\"color: maroon\">note</span><span style=\"color: navy\">, </span> note.text = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>"noteText"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>QrToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> <span style=\"color: navy\">// </span><span style=\"color: green\">group QrToBundle(source qr : QuestionnaireResponseSource, target q: Questionnaire, target patient : Patient, target questionnaireresp: QuestionnaireResponse, target servicerequest: ServiceRequest, target composition : Composition, target bundle : Bundle) {</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>bundle.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>"id"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>bundle.type = <span style=\"color: blue\">'document'</span> <i>"type"</i><span style=\"color: navy\">;</span>\r\n qr<b> then </b>OrfComposition<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>"composition"</i><span style=\"color: navy\">;</span>\r\n qr<b> then </b>QrToGroups<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">)</span> <i>"qrgroups"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">group OrfComposition(source qr : QuestionnaireResponseSource, target q: Questionnaire, target tgt : Composition, target patient: Patient, target questionnaireresp: QuestionnaireResponse, target servicerequest: ServiceRequest, target bundle : Bundle) {</span>\r\n<b>group </b>OrfComposition<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponseSource, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>tgt.status = <span style=\"color: blue\">'final'</span> <i>"status"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> tgt.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"subject"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> tgt.section<b> as </b><span style=\"color: maroon\">tgtSection</span><span style=\"color: navy\">, </span> tgtSection.title = <span style=\"color: blue\">'Order-Referral'</span><span style=\"color: navy\">, </span> tgtSection.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'93037-0'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Portable medical order form'</span><span style=\"color: navy\">, </span> tgtSection.entry = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %questionnaireresp.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> tgtSection.entry = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %servicerequest.id<span style=\"color: navy\">)</span> <i>"sections"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">,</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">tgtSection.entry = create('Reference') as reference, reference.reference = (%q.url) "sections";</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> servicerequest.status = <span style=\"color: blue\">'active'</span><span style=\"color: navy\">, </span> servicerequest.intent = <span style=\"color: blue\">'order'</span><span style=\"color: navy\">, </span> servicerequest.subject = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">reference</span><span style=\"color: navy\">, </span> reference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>"servicerequest"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
},
"url" : "http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle",
"version" : "3.0.0-ci-build",
"name" : "OrfQrToBundle",
"status" : "draft",
"date" : "2024-10-03T07:28:47+00:00",
"publisher" : "HL7 Switzerland",
"contact" : [
{
"name" : "HL7 Switzerland",
"telecom" : [
{
"system" : "url",
"value" : "https://www.hl7.ch/"
}
]
}
],
"description" : "ORF QuestionnaireResponse to Bundle\r\n2021-01-11 Oliver Egger\r\nQRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html\r\nQRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html\r\nBundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html",
"jurisdiction" : [
{
"coding" : [
{
"system" : "urn:iso:std:iso:3166",
"code" : "CH"
}
]
}
],
"copyright" : "CC0-1.0",
"structure" : [
{
"url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
"mode" : "source",
"alias" : "QuestionnaireResponseSource"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
"mode" : "target",
"alias" : "Bundle"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Composition",
"mode" : "target",
"alias" : "Composition"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Patient",
"mode" : "target",
"alias" : "Patient"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
"mode" : "target",
"alias" : "RelatedPerson"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Organization",
"mode" : "target",
"alias" : "Organization"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
"mode" : "target",
"alias" : "Practitioner"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
"mode" : "target",
"alias" : "PractitionerRole"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
"mode" : "target",
"alias" : "ServiceRequest"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Extension",
"mode" : "target",
"alias" : "Extension"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare",
"mode" : "target",
"alias" : "EpisodeOfCare"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
"mode" : "target",
"alias" : "QuestionnaireResponse"
}
],
"group" : [
{
"name" : "OrfQrToBundle",
"typeMode" : "none",
"input" : [
{
"name" : "qr",
"type" : "QuestionnaireResponseSource",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "documentIdentifier",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "identifier",
"variable" : "documentIdentifier"
},
{
"context" : "documentIdentifier",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:ietf:rfc:3986"
}
]
},
{
"contextType" : "variable",
"variable" : "uuidDoc",
"transform" : "uuid"
},
{
"context" : "documentIdentifier",
"contextType" : "variable",
"element" : "value",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuidDoc"
}
]
}
]
},
{
"name" : "OrfQrToBundle",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "composition",
"transform" : "create",
"parameter" : [
{
"valueString" : "Composition"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "timestamp",
"variable" : "timestamp",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "now()"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "document"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "date",
"transform" : "copy",
"parameter" : [
{
"valueId" : "timestamp"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "title",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Order and Referral by Form"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "419891008"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://snomed.info/sct"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "category",
"variable" : "category"
},
{
"context" : "category",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "721963009"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://snomed.info/sct"
}
]
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "patient",
"transform" : "create",
"parameter" : [
{
"valueString" : "Patient"
}
]
},
{
"context" : "patient",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "questionnaireresp",
"transform" : "create",
"parameter" : [
{
"valueString" : "QuestionnaireResponse"
}
]
}
],
"rule" : [
{
"name" : "questionnaireresp",
"source" : [
{
"context" : "qr"
}
],
"dependent" : [
{
"name" : "QuestionnaireResponseMap",
"variable" : [
"qr",
"questionnaireresp"
]
}
]
},
{
"name" : "orfbundle",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "questionnaireresp",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e5"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "resource",
"variable" : "servicerequest",
"transform" : "create",
"parameter" : [
{
"valueString" : "ServiceRequest"
}
]
},
{
"context" : "servicerequest",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid5",
"transform" : "uuid"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid5"
}
]
}
],
"dependent" : [
{
"name" : "QrToBundle",
"variable" : [
"qr",
"patient",
"questionnaireresp",
"servicerequest",
"composition",
"bundle"
]
}
]
}
]
}
]
},
{
"name" : "QuestionnaireResponseMap",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "tgt",
"type" : "QuestionnaireResponse",
"mode" : "target"
}
],
"rule" : [
{
"name" : "identifier",
"source" : [
{
"context" : "src",
"element" : "identifier",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "identifier",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "basedOn",
"source" : [
{
"context" : "src",
"element" : "basedOn",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "basedOn",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "partOf",
"source" : [
{
"context" : "src",
"element" : "partOf",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "partOf",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "questionnaire",
"source" : [
{
"context" : "src",
"element" : "questionnaire",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "questionnaire",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "status",
"source" : [
{
"context" : "src",
"element" : "status",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "subject",
"source" : [
{
"context" : "src",
"element" : "subject",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "subject",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "encounter",
"source" : [
{
"context" : "src",
"element" : "encounter",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "encounter",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "authored",
"source" : [
{
"context" : "src",
"element" : "authored",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "authored",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "author",
"source" : [
{
"context" : "src",
"element" : "author",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "author",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "source",
"source" : [
{
"context" : "src",
"element" : "source",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "source",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "value"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "item",
"transform" : "copy",
"parameter" : [
{
"valueId" : "value"
}
]
}
]
}
]
},
{
"name" : "QrToGroups",
"typeMode" : "none",
"input" : [
{
"name" : "qr",
"type" : "QuestionnaireResponseSource",
"mode" : "source"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "grporder",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'order'"
}
],
"dependent" : [
{
"name" : "OrderItems",
"variable" : [
"grp",
"bundle",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "receiver",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'receiver'"
}
],
"dependent" : [
{
"name" : "ReceiverInit",
"variable" : [
"grp",
"bundle",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "grpinitiator",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'initiator'"
}
],
"dependent" : [
{
"name" : "InitiatorInit",
"variable" : [
"grp",
"bundle",
"patient",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "grppatient",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'patient'"
}
],
"dependent" : [
{
"name" : "PatientItems",
"variable" : [
"grp",
"bundle",
"patient",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "grprequestedencounter",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'requestedEncounter'"
}
],
"dependent" : [
{
"name" : "RequestedEncounterItems",
"variable" : [
"grp",
"bundle",
"patient",
"serviceRequest"
]
}
]
},
{
"name" : "grprequestedencounter",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'coverage'"
}
],
"dependent" : [
{
"name" : "Coverage",
"variable" : [
"grp",
"bundle",
"patient",
"serviceRequest"
]
}
]
},
{
"name" : "grpsender",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'sender'"
}
],
"dependent" : [
{
"name" : "SenderAuthorInit",
"variable" : [
"grp",
"bundle",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "receiverCopy",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'receiverCopy'"
}
],
"dependent" : [
{
"name" : "ReceiverCopy",
"variable" : [
"grp",
"bundle",
"patient",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "appointment",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'appointment'"
}
],
"dependent" : [
{
"name" : "Appointment",
"variable" : [
"grp",
"bundle",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "AntecedentEpisodeOfCareInit",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'antecedentEpisodeOfCare'"
}
],
"dependent" : [
{
"name" : "AntecedentEpisodeOfCareInit",
"variable" : [
"grp",
"bundle",
"patient",
"composition"
]
}
]
},
{
"name" : "consent",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'consent'"
}
],
"dependent" : [
{
"name" : "Consent",
"variable" : [
"grp",
"bundle",
"composition"
]
}
]
},
{
"name" : "note",
"source" : [
{
"context" : "qr",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'note'"
}
],
"dependent" : [
{
"name" : "Note",
"variable" : [
"grp",
"serviceRequest"
]
}
]
}
]
},
{
"name" : "OrderItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "orderPrecedentDocumentIdentifier",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.precedentDocumentIdentifier') and answer.exists())"
}
],
"target" : [
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-precedentdocument"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "Identifier"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:ietf:rfc:3986"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %item.answer.value"
}
]
}
]
},
{
"name" : "orderPlacerOrderIdentifier",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.placerOrderIdentifier') and answer.exists())"
}
],
"target" : [
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value",
"listMode" : [
"share"
],
"listRuleId" : "placer"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://terminology.hl7.org/CodeSystem/v2-0203"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "PLAC"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "orderPlacerOrderIdentifierDomain",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.placerOrderIdentifierDomain') and answer.exists())"
}
],
"target" : [
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value",
"listMode" : [
"share"
],
"listRuleId" : "placer"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "orderFillerOrderIdentifier",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.fillerOrderIdentifier') and answer.exists())"
}
],
"target" : [
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value",
"listMode" : [
"share"
],
"listRuleId" : "filler"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://terminology.hl7.org/CodeSystem/v2-0203"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "FILL"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "orderFillerOrderIdentifierDomain",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.fillerOrderIdentifierDomain') and answer.exists())"
}
],
"target" : [
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value",
"listMode" : [
"share"
],
"listRuleId" : "filler"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.authoredOn') and answer.exists())"
}
],
"target" : [
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "authoredOn",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.priority') and answer.exists())"
}
],
"target" : [
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "priority",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value.code"
}
]
}
]
},
{
"name" : "ordeNnotificationContactDocument",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'order.notificationContactDocument')"
}
],
"rule" : [
{
"name" : "orderNotificationContactDocumentItems",
"source" : [
{
"context" : "item"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerRoleDataEnterer",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "practitionerRoleDataEnterer",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e5"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerDataEnterer",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitionerDataEnterer",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid5",
"transform" : "uuid"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid5"
}
]
},
{
"context" : "practitionerRoleDataEnterer",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid5"
}
]
}
],
"rule" : [
{
"name" : "data",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "UrgentNotificationContactForRequestItems",
"variable" : [
"item",
"practitionerRoleDataEnterer",
"practitionerDataEnterer"
]
}
]
},
{
"name" : "extension",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ExtOrfUrgentNotificationContactForRequest",
"variable" : [
"item",
"practitionerRoleDataEnterer",
"extension"
]
}
]
}
]
}
]
},
{
"name" : "orderNotificationContactDocumentResponse",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'order.notificationContactDocumentResponse')"
}
],
"rule" : [
{
"name" : "orderNotificationContactDocumentResponseItems",
"source" : [
{
"context" : "item"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerRoleDataEnterer",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "practitionerRoleDataEnterer",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e5"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerDataEnterer",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitionerDataEnterer",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid5",
"transform" : "uuid"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid5"
}
]
},
{
"context" : "practitionerRoleDataEnterer",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid5"
}
]
}
],
"rule" : [
{
"name" : "data",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "UrgentNotificationContactForResponseItems",
"variable" : [
"item",
"practitionerRoleDataEnterer",
"practitionerDataEnterer"
]
}
]
},
{
"name" : "extension",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ExtOrfUrgentNotificationContactForResponse",
"variable" : [
"item",
"practitionerRoleDataEnterer",
"extension"
]
}
]
}
]
}
]
}
]
},
{
"name" : "UrgentNotificationContactForRequestPractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerTitle",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.title') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "prefix",
"variable" : "prefix",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "prefix",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "code"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "AC"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocument.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "UrgentNotificationContactForRequestItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'order.notificationContactDocument.practitioner')"
}
],
"dependent" : [
{
"name" : "UrgentNotificationContactForRequestPractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
}
]
},
{
"name" : "ExtOrfUrgentNotificationContactForRequest",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "ext",
"type" : "Extension",
"mode" : "target"
}
],
"rule" : [
{
"name" : "url",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactforthisdocument"
}
]
}
]
},
{
"name" : "practitionerRole",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %practitionerRole.id"
}
]
}
]
}
]
},
{
"name" : "UrgentNotificationContactForResponsePractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerTitle",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.title') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "prefix",
"variable" : "prefix",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "prefix",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "code"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "AC"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'order.notificationContactDocumentResponse.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "UrgentNotificationContactForResponseItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'order.notificationContactDocumentResponse.practitioner')"
}
],
"dependent" : [
{
"name" : "UrgentNotificationContactForResponsePractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
}
]
},
{
"name" : "ExtOrfUrgentNotificationContactForResponse",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "ext",
"type" : "Extension",
"mode" : "target"
}
],
"rule" : [
{
"name" : "url",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-urgentnoficationcontactfortheresponsetothisdocument"
}
]
}
]
},
{
"name" : "practitionerRole",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %practitionerRole.id"
}
]
}
]
}
]
},
{
"name" : "ReceiverPractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverPractitionerTitle",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.practitioner.title') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "prefix",
"variable" : "prefix",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "prefix",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "code"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "AC"
}
]
}
]
},
{
"name" : "receiverPractitionerGln",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.practitioner.gln') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.51.1.3"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverPractitionerZsr",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.practitioner.zsr') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverPractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverPractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "ReceiverOrganizationItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.organization.name') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverOrganizationGln",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.organization.gln') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.51.1.3"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverOrganizationZsr",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.organization.zsr') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.organization.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "receiverOrganizationStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "receiverOrganizationPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.organization.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverOrganizationCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.organization.city') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverOrganizationCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiver.organization.country') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "ReceiverItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'receiver.practitioner')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"dependent" : [
{
"name" : "ReceiverPractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'receiver.organization')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e3"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "organization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"dependent" : [
{
"name" : "ReceiverOrganizationItems",
"variable" : [
"item",
"organization"
]
}
]
}
]
},
{
"name" : "Consent",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
}
],
"rule" : [
{
"name" : "consentStatement",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'consent.statement') and answer.exists())"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "consent",
"transform" : "create",
"parameter" : [
{
"valueString" : "Consent"
}
]
},
{
"context" : "consent",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "consent",
"contextType" : "variable",
"element" : "scope",
"variable" : "scope"
},
{
"context" : "scope",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "treatment"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://terminology.hl7.org/CodeSystem/consentscope"
}
]
},
{
"context" : "consent",
"contextType" : "variable",
"element" : "category",
"variable" : "category"
},
{
"context" : "category",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "59284-0"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://loinc.org"
}
]
},
{
"context" : "consent",
"contextType" : "variable",
"element" : "policyRule",
"variable" : "policyRule"
},
{
"context" : "policyRule",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "385432009"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://snomed.info/sct"
}
]
},
{
"context" : "consent",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-patientconsent"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "consent",
"contextType" : "variable",
"element" : "extension",
"variable" : "extcode"
},
{
"context" : "extcode",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentcode"
}
]
},
{
"context" : "extcode",
"contextType" : "variable",
"element" : "value",
"variable" : "cc",
"transform" : "create",
"parameter" : [
{
"valueString" : "CodeableConcept"
}
]
},
{
"context" : "cc",
"contextType" : "variable",
"element" : "coding",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
}
],
"rule" : [
{
"name" : "itemAnswer",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"rule" : [
{
"name" : "consentStatementNote",
"source" : [
{
"context" : "answer",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'consent.statement.note') and answer.exists())"
}
],
"target" : [
{
"context" : "consent",
"contextType" : "variable",
"element" : "extension",
"variable" : "extnote"
},
{
"context" : "extnote",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-consentnote"
}
]
},
{
"context" : "extnote",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "ReceiverInit",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "receiver",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerRole",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-receiver"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
}
],
"dependent" : [
{
"name" : "ReceiverItems",
"variable" : [
"src",
"bundle",
"practitionerRole"
]
}
]
}
]
},
{
"name" : "InitiatorItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "ext",
"type" : "Extension",
"mode" : "target"
}
],
"rule" : [
{
"name" : "Initiatorpersonalrelation",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.personalrelation') and answer.exists())"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ch-orf-personalrelation"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "Initiatorlegalrelation",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.legalrelation') and answer.exists())"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ch-orf-legalrelation"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "InitiatorPractitionerRoleItems",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId = 'initiator.practitionerRole')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerrole",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "practitionerrole",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ch-orf-personorganization"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
}
],
"rule" : [
{
"name" : "data",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "InitiatorPractitionerRoleItems",
"variable" : [
"item",
"bundle",
"practitionerrole"
]
}
]
}
]
},
{
"name" : "InitiatorelatedPerson",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId = 'initiator.relatedPerson')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "relatedPerson",
"transform" : "create",
"parameter" : [
{
"valueString" : "RelatedPerson"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "ch-orf-personorganization"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "patient",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
}
],
"rule" : [
{
"name" : "data",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "InitiatorRelatedPersonItems",
"variable" : [
"item",
"relatedPerson"
]
}
]
}
]
}
]
},
{
"name" : "InitiatorRelatedPersonItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "relatedPerson",
"type" : "RelatedPerson",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "Phone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.phone') and answer.exists())"
}
],
"rule" : [
{
"name" : "InitiatorelatedPersonPhone",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "InitiatorelatedPersonEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.email') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "InitiatorelatedPersonStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "InitiatorelatedPersonPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "InitiatorelatedPersonCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.city') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "InitiatorelatedPersonCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.relatedPerson.country') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "InitiatorPractitionerRoleItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'initiator.practitionerRole.practitioner')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"dependent" : [
{
"name" : "InitiatorPractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'initiator.practitionerRole.organization')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e3"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "organization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"dependent" : [
{
"name" : "InitiatorOrganizationItems",
"variable" : [
"item",
"organization"
]
}
]
}
]
},
{
"name" : "InitiatorPractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "InitiatorractitionerRolePractitionerTitle",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.title') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "prefix",
"variable" : "prefix",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "prefix",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "code"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "AC"
}
]
}
]
},
{
"name" : "InitiatorractitionerRolePractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "InitiatorractitionerRolePractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverPractitionerGln",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.gln') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.51.1.3"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverPractitionerZsr",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.practitioner.zsr') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "InitiatorOrganizationItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.organization.name') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.organization.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "InitiatorractitionerRoleOrganizationStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "InitiatorractitionerRoleOrganizationPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.organization.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "InitiatorractitionerRoleOrganizationCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.organization.city') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "InitiatorractitionerRoleOrganizationCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'initiator.practitionerRole.organization.country') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "FamilyDoctorInit",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "FamilyDoctorInit",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerRole",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "patient",
"contextType" : "variable",
"element" : "generalPractitioner",
"variable" : "gp",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "gp",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'familydoctor.practitioner')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"dependent" : [
{
"name" : "FamilyDoctorPractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'familydoctor.organization')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e3"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "organization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"dependent" : [
{
"name" : "FamilyDoctorOrganizationItems",
"variable" : [
"item",
"organization"
]
}
]
}
]
}
]
},
{
"name" : "FamilyDoctorPractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorPractitionerGln",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.practitioner.gln') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.51.1.3"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorPractitionerZsr",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.practitioner.zsr') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorPractitionerTitle",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.practitioner.title') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "prefix",
"variable" : "prefix",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "prefix",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "code"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "AC"
}
]
}
]
},
{
"name" : "familydoctorPractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorPractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "FamilyDoctorOrganizationItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.organization.name') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.organization.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "familydoctorOrganizationStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "familydoctorOrganizationPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.organization.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorOrganizationCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.organization.city') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorOrganizationCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.organization.country') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorOrganizationGln",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.organization.gln') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.51.1.3"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "familydoctorOrganizationZsr",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'familydoctor.organization.zsr') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "AntecedentEpisodeOfCareInit",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
}
],
"rule" : [
{
"name" : "AntecedentEpisodeOfCareItems",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-antecedentepisodeofcare"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "episodeofcare",
"transform" : "create",
"parameter" : [
{
"valueString" : "EpisodeOfCare"
}
]
},
{
"context" : "episodeofcare",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "episodeofcare",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "finished"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "ref",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "ref",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %episodeofcare.id"
}
]
}
],
"dependent" : [
{
"name" : "AntecedentEpisodeOfCareItems",
"variable" : [
"src",
"bundle",
"patient",
"episodeofcare"
]
}
]
}
]
},
{
"name" : "AntecedentEpisodeOfCareItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "tgt",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "episodeofcare",
"type" : "EpisodeOfCare",
"mode" : "target"
}
],
"rule" : [
{
"name" : "antecedentEpisodeOfCareRequestedPeriodStart",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'antecedentEpisodeOfCare.start') and answer.exists())"
}
],
"target" : [
{
"context" : "episodeofcare",
"contextType" : "variable",
"element" : "statusHistory",
"variable" : "statusHistory"
},
{
"context" : "statusHistory",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "finished"
}
]
},
{
"context" : "statusHistory",
"contextType" : "variable",
"element" : "period",
"variable" : "period"
},
{
"context" : "period",
"contextType" : "variable",
"element" : "start",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "period",
"contextType" : "variable",
"element" : "end",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
],
"rule" : [
{
"name" : "antecedentEpisodeOfCareEndNotSameAsStart",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "iteme",
"condition" : "((linkId.value = 'antecedentEpisodeOfCare.end') and answer.exists())"
}
],
"target" : [
{
"context" : "period",
"contextType" : "variable",
"element" : "end",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%iteme.answer.value"
}
]
}
]
}
]
},
{
"name" : "antecedentEpisodeOfCareManagingOrganization",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'antecedentEpisodeOfCare.managingOrganization')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e3"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
},
{
"context" : "episodeofcare",
"contextType" : "variable",
"element" : "patient",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %tgt.id"
}
]
},
{
"context" : "episodeofcare",
"contextType" : "variable",
"element" : "managingOrganization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"dependent" : [
{
"name" : "AntecedentEpisodeOfCareOrganizationItems",
"variable" : [
"item",
"organization"
]
}
]
}
]
},
{
"name" : "AntecedentEpisodeOfCareOrganizationItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.name') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "antecedentEpisodeOfCareorganizationStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "senderAuthorOrganizationPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorOrganizationCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.city') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorOrganizationCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'antecedentEpisodeOfCare.managingOrganization.country') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "InitiatorInit",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "receiver",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-initiator"
}
]
}
],
"dependent" : [
{
"name" : "InitiatorItems",
"variable" : [
"src",
"bundle",
"patient",
"ext"
]
}
]
}
]
},
{
"name" : "PatientItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "tgt",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "grpfamily",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "grp",
"condition" : "linkId = 'familydoctor'"
}
],
"dependent" : [
{
"name" : "FamilyDoctorInit",
"variable" : [
"grp",
"bundle",
"tgt",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item"
}
],
"dependent" : [
{
"name" : "PatientItems",
"variable" : [
"item",
"bundle",
"tgt",
"composition",
"serviceRequest"
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "patientName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.maidenName') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "name",
"variable" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "use",
"transform" : "copy",
"parameter" : [
{
"valueString" : "maiden"
}
]
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "patientName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "PatientLocalPid",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.localPid') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value",
"listMode" : [
"share"
],
"listRuleId" : "localpid"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://terminology.hl7.org/CodeSystem/v2-0203"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MR"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "PatientLocalPidDomain",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.localPidDomain') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value",
"listMode" : [
"share"
],
"listRuleId" : "localpid"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.birthDate') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "birthDate",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.gender') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "gender",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value.code"
}
]
}
]
},
{
"name" : "patientMaritalStatus",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.maritalStatus') and answer.exists())"
}
],
"rule" : [
{
"name" : "answer",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"rule" : [
{
"name" : "maritalStatus",
"source" : [
{
"context" : "answer",
"type" : "Coding",
"element" : "value",
"variable" : "coding"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "maritalStatus",
"variable" : "maritalStatus"
},
{
"context" : "maritalStatus",
"contextType" : "variable",
"element" : "coding",
"transform" : "copy",
"parameter" : [
{
"valueId" : "coding"
}
]
}
]
}
]
}
]
},
{
"name" : "PatientPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.phone') and answer.exists())"
}
],
"rule" : [
{
"name" : "PatientPhone",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "PatientEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.email') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "PatientStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "PatientPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "PatientCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.city') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "PatientCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.country') and answer.exists())"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "PatientLanguageOfCorrespondence",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.languageOfCorrespondence') and answer.exists())"
}
],
"rule" : [
{
"name" : "answer",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"rule" : [
{
"name" : "languageOfCorrespondence",
"source" : [
{
"context" : "answer",
"type" : "Coding",
"element" : "value",
"variable" : "coding"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "communication",
"variable" : "communication"
},
{
"context" : "communication",
"contextType" : "variable",
"element" : "preferred",
"transform" : "copy",
"parameter" : [
{
"valueBoolean" : true
}
]
},
{
"context" : "communication",
"contextType" : "variable",
"element" : "language",
"variable" : "language"
},
{
"context" : "language",
"contextType" : "variable",
"element" : "coding",
"transform" : "copy",
"parameter" : [
{
"valueId" : "coding"
}
]
}
]
}
]
}
]
},
{
"name" : "contact",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'patient.contactperson')"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "contact",
"variable" : "contact"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.contactperson.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "contact",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "contactName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.contactperson.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "contact",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "contactName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "PatientContactpersonPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.contactperson.phone') and answer.exists())"
}
],
"rule" : [
{
"name" : "PatientPhone",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "PatientEmail",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.contactperson.email') and answer.exists())"
}
],
"target" : [
{
"context" : "contact",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "PatientContactpersonRelationship",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'patient.contactperson.relationship') and answer.exists())"
}
],
"target" : [
{
"context" : "contact",
"contextType" : "variable",
"element" : "relationship",
"variable" : "relationship"
},
{
"context" : "relationship",
"contextType" : "variable",
"element" : "text",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
}
]
},
{
"name" : "RequestedEncounterItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "RequestedEncounterItems",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "encounter",
"transform" : "create",
"parameter" : [
{
"valueString" : "Encounter"
}
]
},
{
"context" : "encounter",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "encounter",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "planned"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "encounter",
"contextType" : "variable",
"element" : "subject",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-requestedencounterdetails"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
}
],
"rule" : [
{
"name" : "requestedEncounterClass",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'requestedEncounter.class') and answer.exists())"
}
],
"target" : [
{
"context" : "encounter",
"contextType" : "variable",
"element" : "class",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "requestedEncounterDesiredAccommodation",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'requestedEncounter.desiredAccommodation') and answer.exists())"
}
],
"target" : [
{
"context" : "encounter",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-desiredaccommodation"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
}
]
},
{
"name" : "Coverage",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "coverageBeneficiary",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.beneficiary')"
}
],
"rule" : [
{
"name" : "coverageBeneficiaryAhvn13",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.beneficiary.ahvn13') and answer.exists())"
}
],
"target" : [
{
"context" : "patient",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier"
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.32"
}
]
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "coveragekvg",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.kvg')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "KVG"
}
]
}
],
"rule" : [
{
"name" : "coverageKvgName",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.kvg.name') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "payor"
},
{
"context" : "payor",
"contextType" : "variable",
"element" : "reference",
"variable" : "refcontained"
},
{
"context" : "refcontained",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#org"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "contained",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"transform" : "copy",
"parameter" : [
{
"valueString" : "org"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "coverageKvgInsuranceCardNumber",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.kvg.insuranceCardNumber') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier"
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "type",
"variable" : "typeid"
},
{
"context" : "typeid",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "VeKa"
}
]
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "coverageuvg",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.uvg')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "UVG"
}
]
}
],
"rule" : [
{
"name" : "coverageUvgName",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.uvg.name') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "payor"
},
{
"context" : "payor",
"contextType" : "variable",
"element" : "reference",
"variable" : "refcontained"
},
{
"context" : "refcontained",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#org"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "contained",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"transform" : "copy",
"parameter" : [
{
"valueString" : "org"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "coverageUvgClaimNumber",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.uvg.claimNumber') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier"
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "type",
"variable" : "typeid"
},
{
"context" : "typeid",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Claim"
}
]
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "coveragevvg",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.vvg')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "VVG"
}
]
}
],
"rule" : [
{
"name" : "coverageVvgName",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.vvg.name') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "payor"
},
{
"context" : "payor",
"contextType" : "variable",
"element" : "reference",
"variable" : "refcontained"
},
{
"context" : "refcontained",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#org"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "contained",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"transform" : "copy",
"parameter" : [
{
"valueString" : "org"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "coverageVvgInsuranceCardNumber",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.vvg.insuranceCardNumber') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier"
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "type",
"variable" : "typeid"
},
{
"context" : "typeid",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "VeKa"
}
]
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "coverageiv",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.iv')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "IVG"
}
]
}
],
"rule" : [
{
"name" : "coverageivverfuegungsnummer",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.iv.verfuegungsnummer') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier"
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "type",
"variable" : "typeid"
},
{
"context" : "typeid",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "IV"
}
]
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "payor"
},
{
"context" : "payor",
"contextType" : "variable",
"element" : "reference",
"variable" : "refcontained"
},
{
"context" : "refcontained",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#org"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "contained",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"transform" : "copy",
"parameter" : [
{
"valueString" : "org"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "copy",
"parameter" : [
{
"valueString" : "IV"
}
]
}
]
}
]
},
{
"name" : "coveragemv",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.mv')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MVG"
}
]
}
],
"rule" : [
{
"name" : "coveragemvversichertennummer",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.mv.versichertennummer') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier"
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "type",
"variable" : "typeid"
},
{
"context" : "typeid",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coverageidentifiertype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MV"
}
]
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "payor"
},
{
"context" : "payor",
"contextType" : "variable",
"element" : "reference",
"variable" : "refcontained"
},
{
"context" : "refcontained",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#org"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "contained",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"transform" : "copy",
"parameter" : [
{
"valueString" : "org"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "copy",
"parameter" : [
{
"valueString" : "MV"
}
]
}
]
}
]
},
{
"name" : "self",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.self')"
}
],
"rule" : [
{
"name" : "payor",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.patient') and answer.exists() and answer.value)"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Self"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "subject"
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
}
]
},
{
"name" : "coverageselfpatientrelated",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item2",
"condition" : "((linkId.value = 'coverage.self.patientRelatedPerson') and answer.exists() and answer.value)"
}
],
"rule" : [
{
"name" : "coverageselfrelatedPerson",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'coverage.self.relatedPerson')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e5"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Self"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e6"
},
{
"context" : "e6",
"contextType" : "variable",
"element" : "resource",
"variable" : "relatedPerson",
"transform" : "create",
"parameter" : [
{
"valueString" : "RelatedPerson"
}
]
},
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid6",
"transform" : "uuid"
},
{
"context" : "e6",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid6"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "subject"
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %relatedPerson.id"
}
]
},
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "patient",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
}
],
"dependent" : [
{
"name" : "CoverageRelatedPersonItems",
"variable" : [
"item",
"relatedPerson"
]
}
]
}
]
}
]
},
{
"name" : "coveragevvg",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "where(linkId.value = 'coverage.other')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "coverage",
"transform" : "create",
"parameter" : [
{
"valueString" : "Coverage"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "insurance",
"variable" : "insurance"
},
{
"context" : "insurance",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "beneficiary",
"variable" : "subject",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "subject",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "type",
"variable" : "type"
},
{
"context" : "type",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/CodeSystem/ch-orf-cs-coveragetype"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Other"
}
]
}
],
"rule" : [
{
"name" : "coverageOtherName",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.other.name') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "payor",
"variable" : "payor"
},
{
"context" : "payor",
"contextType" : "variable",
"element" : "reference",
"variable" : "refcontained"
},
{
"context" : "refcontained",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "#org"
}
]
},
{
"context" : "coverage",
"contextType" : "variable",
"element" : "contained",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"transform" : "copy",
"parameter" : [
{
"valueString" : "org"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "coverageOtherId",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.other.id') and answer.exists())"
}
],
"target" : [
{
"context" : "coverage",
"contextType" : "variable",
"element" : "identifier",
"variable" : "identifier"
},
{
"context" : "identifier",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
}
]
},
{
"name" : "CoverageRelatedPersonItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "relatedPerson",
"type" : "RelatedPerson",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "Phone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.phone') and answer.exists())"
}
],
"rule" : [
{
"name" : "coverageSelfRelatedPersonPhone",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "coverageSelfRelatedPersonEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.email') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "coverageSelfRelatedPersonStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "coverageSelfRelatedPersonPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "coverageSelfRelatedPersonCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.city') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "coverageSelfRelatedPersonCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'coverage.self.relatedPerson.country') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "SenderAuthorPractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerTitle",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.practitioner.title') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "prefix",
"variable" : "prefix",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "prefix",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "code"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "AC"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerGln",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.practitioner.gln') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.51.1.3"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerZsr",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.practitioner.zsr') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "SenderAuthorOrganizationItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.organization.name') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorOrganizationGln",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.organization.gln') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.51.1.3"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorOrganizationZsr",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.organization.zsr') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "identifier",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "urn:oid:2.16.756.5.30.1.123.100.2.1.1"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.organization.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "senderAuthorOrganizationStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "senderAuthorOrganizationPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.organization.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorOrganizationCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.organization.city') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorOrganizationCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.author.organization.country') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "SenderAuthorItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'sender.author.practitioner')"
}
],
"dependent" : [
{
"name" : "SenderAuthorPractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'sender.author.organization')"
}
],
"dependent" : [
{
"name" : "SenderAuthorOrganizationItems",
"variable" : [
"item",
"organization"
]
}
]
}
]
},
{
"name" : "SenderDataEntererPractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.dataenterer.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.dataenterer.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.dataenterer.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "senderAuthorPractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'sender.dataenterer.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "SenderDataEntererItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'sender.dataenterer.practitioner')"
}
],
"dependent" : [
{
"name" : "SenderDataEntererPractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
}
]
},
{
"name" : "ChExtEprDataEnterer",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "ext",
"type" : "Extension",
"mode" : "target"
}
],
"rule" : [
{
"name" : "url",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-dataenterer"
}
]
}
]
},
{
"name" : "practitionerRole",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "enterer"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %practitionerRole.id"
}
]
}
]
}
]
},
{
"name" : "SenderAuthorInit",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "sender",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerRole",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e3"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "author",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "requester",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "organization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"rule" : [
{
"name" : "senderAuthor",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'sender.author')"
}
],
"dependent" : [
{
"name" : "SenderAuthorItems",
"variable" : [
"item",
"practitionerRole",
"practitioner",
"organization"
]
}
]
},
{
"name" : "senderDataenterer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'sender.dataenterer')"
}
],
"rule" : [
{
"name" : "senderDataentererItems",
"source" : [
{
"context" : "item"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerRoleDataEnterer",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "practitionerRoleDataEnterer",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e5"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerDataEnterer",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitionerDataEnterer",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid5",
"transform" : "uuid"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid5"
}
]
},
{
"context" : "practitionerRoleDataEnterer",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid5"
}
]
},
{
"context" : "practitionerRoleDataEnterer",
"contextType" : "variable",
"element" : "organization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"rule" : [
{
"name" : "data",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "SenderDataEntererItems",
"variable" : [
"item",
"practitionerRoleDataEnterer",
"practitionerDataEnterer",
"organization"
]
}
]
},
{
"name" : "extension",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ChExtEprDataEnterer",
"variable" : [
"item",
"practitionerRoleDataEnterer",
"extension"
]
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "ReceiverCopyRelatedPersonItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "relatedPerson",
"type" : "RelatedPerson",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "name"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "Phone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.phone') and answer.exists())"
}
],
"rule" : [
{
"name" : "receiverCopyRelatedPersonPhone",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "receiverCopyRelatedPersonEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.email') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "receiverCopyRelatedPersonStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "receiverCopyRelatedPersonPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverCopyRelatedPersonCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.city') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverCopyRelatedPersonCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.relatedPerson.country') and answer.exists())"
}
],
"target" : [
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "ReceiverCopyPractitionerItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "practitioner",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.familyName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "family",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.givenName') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "given",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverCopyPractitionerRolePractitionerTitle",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.title') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "name",
"listMode" : [
"share"
],
"listRuleId" : "practitionerName"
},
{
"context" : "name",
"contextType" : "variable",
"element" : "prefix",
"variable" : "prefix",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
},
{
"context" : "prefix",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier"
}
]
},
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "value",
"transform" : "create",
"parameter" : [
{
"valueString" : "code"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "copy",
"parameter" : [
{
"valueString" : "AC"
}
]
}
]
},
{
"name" : "receiverCopyPractitionerRolePractitionerPhone",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverCopyPractitionerRolePractitionerEmail",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.practitioner.email') and answer.exists())"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "ReceiverCopyOrganizationItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "organization",
"type" : "Organization",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.name') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "itemAnswer",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "receiverCopyPractitionerRoleOrganizationStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "receiverCopyPractitionerRoleOrganizationPostalCode",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverCopyPractitionerRoleOrganizationCity",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.city') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "receiverCopyPractitionerRoleOrganizationCountry",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'receiverCopy.practitionerRole.organization.country') and answer.exists())"
}
],
"target" : [
{
"context" : "organization",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "ReceiverCopyPractitionerRoleItems",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "practitionerRole",
"type" : "PractitionerRole",
"mode" : "target"
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'receiverCopy.practitionerRole.practitioner')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "practitioner",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"dependent" : [
{
"name" : "ReceiverCopyPractitionerItems",
"variable" : [
"item",
"practitioner"
]
}
]
},
{
"name" : "item",
"source" : [
{
"context" : "src",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'receiverCopy.practitionerRole.organization')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e3"
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "practitionerRole",
"contextType" : "variable",
"element" : "organization",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
},
{
"context" : "e3",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"dependent" : [
{
"name" : "ReceiverCopyOrganizationItems",
"variable" : [
"item",
"organization"
]
}
]
}
]
},
{
"name" : "ExtOrfCopyReceiverPatient",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "ext",
"type" : "Extension",
"mode" : "target"
}
],
"rule" : [
{
"name" : "url",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver"
}
]
}
]
},
{
"name" : "patient",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
}
]
}
]
},
{
"name" : "ExtOrfCopyReceiverPractitionerRole",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "res",
"type" : "PractitionerRole",
"mode" : "target"
},
{
"name" : "ext",
"type" : "Extension",
"mode" : "target"
}
],
"rule" : [
{
"name" : "url",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver"
}
]
}
]
},
{
"name" : "organization",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %res.id"
}
]
}
]
}
]
},
{
"name" : "ExtOrfCopyReceiverRelatedPerson",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"mode" : "source"
},
{
"name" : "res",
"type" : "RelatedPerson",
"mode" : "target"
},
{
"name" : "ext",
"type" : "Extension",
"mode" : "target"
}
],
"rule" : [
{
"name" : "url",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-copyreceiver"
}
]
}
]
},
{
"name" : "organization",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "ext",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %res.id"
}
]
}
]
}
]
},
{
"name" : "ReceiverCopy",
"typeMode" : "none",
"input" : [
{
"name" : "grp",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "receiverCopyPractitionerRole1",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "(linkId = 'receiverCopy.practitionerRole')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitionerrole",
"transform" : "create",
"parameter" : [
{
"valueString" : "PractitionerRole"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "practitionerrole",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
}
],
"rule" : [
{
"name" : "data",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ReceiverCopyPractitionerRoleItems",
"variable" : [
"item",
"bundle",
"practitionerrole"
]
}
]
},
{
"name" : "extension",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ExtOrfCopyReceiverPractitionerRole",
"variable" : [
"item",
"practitionerrole",
"extension"
]
}
]
}
]
},
{
"name" : "receiverCopyPatient",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "(linkId = 'receiverCopy.patient')"
}
],
"target" : [
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
}
],
"rule" : [
{
"name" : "extension",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ExtOrfCopyReceiverPatient",
"variable" : [
"item",
"patient",
"extension"
]
}
]
}
]
},
{
"name" : "receiverCopyRelatedPerson",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "(linkId = 'receiverCopy.relatedPerson')"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "relatedPerson",
"transform" : "create",
"parameter" : [
{
"valueString" : "RelatedPerson"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "relatedPerson",
"contextType" : "variable",
"element" : "patient",
"variable" : "reference"
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid4"
}
]
}
],
"rule" : [
{
"name" : "data",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ReceiverCopyRelatedPersonItems",
"variable" : [
"item",
"relatedPerson"
]
}
]
},
{
"name" : "extension",
"source" : [
{
"context" : "item"
}
],
"dependent" : [
{
"name" : "ExtOrfCopyReceiverRelatedPerson",
"variable" : [
"item",
"relatedPerson",
"extension"
]
}
]
}
]
}
]
},
{
"name" : "Appointment",
"typeMode" : "none",
"input" : [
{
"name" : "grp",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "Appointment",
"source" : [
{
"context" : "grp"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e4"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "resource",
"variable" : "appointment",
"transform" : "create",
"parameter" : [
{
"valueString" : "Appointment"
}
]
},
{
"context" : "appointment",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid4",
"transform" : "uuid"
},
{
"context" : "e4",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
},
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "extension",
"variable" : "extension"
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "url",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://fhir.ch/ig/ch-orf/StructureDefinition/ch-orf-locationandtime"
}
]
},
{
"context" : "extension",
"contextType" : "variable",
"element" : "value",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid4"
}
]
}
],
"rule" : [
{
"name" : "proposed",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'appointment.status') and (answer.value.code = 'proposed'))"
}
],
"target" : [
{
"context" : "appointment",
"contextType" : "variable",
"element" : "status",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value.code"
}
]
}
],
"rule" : [
{
"name" : "appointmentRequestedPeriod",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "itemp",
"condition" : "(linkId.value = 'appointment.requestedPeriod')"
}
],
"rule" : [
{
"name" : "appointmentRequestedPeriodStart",
"source" : [
{
"context" : "itemp",
"element" : "item",
"variable" : "item2",
"condition" : "((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())"
}
],
"target" : [
{
"context" : "appointment",
"contextType" : "variable",
"element" : "requestedPeriod",
"variable" : "requestedPeriod"
},
{
"context" : "requestedPeriod",
"contextType" : "variable",
"element" : "start",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item2.answer.value"
}
]
},
{
"context" : "requestedPeriod",
"contextType" : "variable",
"element" : "end",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item2.answer.value"
}
]
}
],
"rule" : [
{
"name" : "appointmentRequestedPeriodendifnotsameasstart",
"source" : [
{
"context" : "itemp",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())"
}
],
"target" : [
{
"context" : "requestedPeriod",
"contextType" : "variable",
"element" : "end",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "pendingorbooked",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'appointment.status') and ((answer.value.code = 'pending') or (answer.value.code = 'booked')))"
}
],
"target" : [
{
"context" : "appointment",
"contextType" : "variable",
"element" : "status",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value.code"
}
]
}
],
"rule" : [
{
"name" : "appointmentStartend",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "itemp",
"condition" : "(linkId.value = 'appointment.requestedPeriod')"
}
],
"rule" : [
{
"name" : "appointmentStart",
"source" : [
{
"context" : "itemp",
"element" : "item",
"variable" : "item2",
"condition" : "((linkId.value = 'appointment.requestedPeriod.start') and answer.exists())"
}
],
"target" : [
{
"context" : "appointment",
"contextType" : "variable",
"element" : "start",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item2.answer.value"
}
]
},
{
"context" : "appointment",
"contextType" : "variable",
"element" : "end",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item2.answer.value"
}
]
}
],
"rule" : [
{
"name" : "appointmentendifnotsameasstart",
"source" : [
{
"context" : "itemp",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.requestedPeriod.end') and answer.exists())"
}
],
"target" : [
{
"context" : "appointment",
"contextType" : "variable",
"element" : "end",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "appointmentPatientInstruction",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "((linkId.value = 'appointment.patientInstruction') and answer.exists())"
}
],
"target" : [
{
"context" : "appointment",
"contextType" : "variable",
"element" : "patientInstruction",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
},
{
"name" : "appointmentLocation",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "(linkId.value = 'appointment.location')"
}
],
"rule" : [
{
"name" : "location",
"source" : [
{
"context" : "item"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e5"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "resource",
"variable" : "location",
"transform" : "create",
"parameter" : [
{
"valueString" : "Location"
}
]
},
{
"context" : "location",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid5",
"transform" : "uuid"
},
{
"context" : "e5",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %uuid5"
}
]
},
{
"context" : "appointment",
"contextType" : "variable",
"element" : "participant",
"variable" : "participant"
},
{
"context" : "participant",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "tentative"
}
]
},
{
"context" : "participant",
"contextType" : "variable",
"element" : "actor",
"variable" : "actor",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "actor",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %location.id"
}
]
}
],
"rule" : [
{
"name" : "item",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.location.name') and answer.exists())"
}
],
"target" : [
{
"context" : "location",
"contextType" : "variable",
"element" : "name",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
},
{
"name" : "appointmentLocationPhone",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.location.phone') and answer.exists())"
}
],
"target" : [
{
"context" : "location",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "phone"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
},
{
"name" : "appointmentLocationEmail",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.location.email') and answer.exists())"
}
],
"target" : [
{
"context" : "location",
"contextType" : "variable",
"element" : "telecom",
"variable" : "value"
},
{
"context" : "value",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "email"
}
]
},
{
"context" : "value",
"contextType" : "variable",
"element" : "value",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
},
{
"name" : "appointmentLocationStreetAddressLine",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.location.streetAddressLine') and answer.exists())"
}
],
"target" : [
{
"context" : "location",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
}
],
"rule" : [
{
"name" : "line",
"source" : [
{
"context" : "item",
"element" : "answer",
"variable" : "answer"
}
],
"target" : [
{
"context" : "address",
"contextType" : "variable",
"element" : "line",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%answer.value"
}
]
}
]
}
]
},
{
"name" : "appointmentLocationPostalCode",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.location.postalCode') and answer.exists())"
}
],
"target" : [
{
"context" : "location",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "postalCode",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
},
{
"name" : "appointmentlocationCity",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.location.city') and answer.exists())"
}
],
"target" : [
{
"context" : "location",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "city",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
},
{
"name" : "appointmentLocationCountry",
"source" : [
{
"context" : "item",
"element" : "item",
"variable" : "item3",
"condition" : "((linkId.value = 'appointment.location.country') and answer.exists())"
}
],
"target" : [
{
"context" : "location",
"contextType" : "variable",
"element" : "address",
"variable" : "address",
"listMode" : [
"share"
],
"listRuleId" : "orgAddress"
},
{
"context" : "address",
"contextType" : "variable",
"element" : "country",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item3.answer.value"
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "Note",
"typeMode" : "none",
"input" : [
{
"name" : "grp",
"mode" : "source"
},
{
"name" : "serviceRequest",
"type" : "ServiceRequest",
"mode" : "target"
}
],
"rule" : [
{
"name" : "noteText",
"source" : [
{
"context" : "grp",
"element" : "item",
"variable" : "item",
"condition" : "((linkId = 'note.text') and answer.exists())"
}
],
"target" : [
{
"context" : "serviceRequest",
"contextType" : "variable",
"element" : "note",
"variable" : "note"
},
{
"context" : "note",
"contextType" : "variable",
"element" : "text",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "%item.answer.value"
}
]
}
]
}
]
},
{
"name" : "QrToBundle",
"typeMode" : "none",
"input" : [
{
"name" : "qr",
"type" : "QuestionnaireResponseSource",
"mode" : "source"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "questionnaireresp",
"type" : "QuestionnaireResponse",
"mode" : "target"
},
{
"name" : "servicerequest",
"type" : "ServiceRequest",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "id",
"transform" : "uuid"
}
]
},
{
"name" : "type",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "document"
}
]
}
]
},
{
"name" : "composition",
"source" : [
{
"context" : "qr"
}
],
"dependent" : [
{
"name" : "OrfComposition",
"variable" : [
"qr",
"composition",
"patient",
"questionnaireresp",
"servicerequest",
"bundle"
]
}
]
},
{
"name" : "qrgroups",
"source" : [
{
"context" : "qr"
}
],
"dependent" : [
{
"name" : "QrToGroups",
"variable" : [
"qr",
"patient",
"bundle",
"composition",
"servicerequest"
]
}
]
}
]
},
{
"name" : "OrfComposition",
"typeMode" : "none",
"documentation" : "group OrfComposition(source qr : QuestionnaireResponseSource, target q: Questionnaire, target tgt : Composition, target patient: Patient, target questionnaireresp: QuestionnaireResponse, target servicerequest: ServiceRequest, target bundle : Bundle) {",
"input" : [
{
"name" : "qr",
"type" : "QuestionnaireResponseSource",
"mode" : "source"
},
{
"name" : "tgt",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "questionnaireresp",
"type" : "QuestionnaireResponse",
"mode" : "target"
},
{
"name" : "servicerequest",
"type" : "ServiceRequest",
"mode" : "target"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "status",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "final"
}
]
}
]
},
{
"name" : "subject",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "subject",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
}
]
},
{
"name" : "sections",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "section",
"variable" : "tgtSection"
},
{
"context" : "tgtSection",
"contextType" : "variable",
"element" : "title",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Order-Referral"
}
]
},
{
"context" : "tgtSection",
"contextType" : "variable",
"element" : "code",
"variable" : "code"
},
{
"context" : "code",
"contextType" : "variable",
"element" : "coding",
"variable" : "coding"
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "system",
"transform" : "copy",
"parameter" : [
{
"valueString" : "http://loinc.org"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "code",
"transform" : "copy",
"parameter" : [
{
"valueString" : "93037-0"
}
]
},
{
"context" : "coding",
"contextType" : "variable",
"element" : "display",
"transform" : "copy",
"parameter" : [
{
"valueString" : "Portable medical order form"
}
]
},
{
"context" : "tgtSection",
"contextType" : "variable",
"element" : "entry",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %questionnaireresp.id"
}
]
},
{
"context" : "tgtSection",
"contextType" : "variable",
"element" : "entry",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %servicerequest.id"
}
]
}
]
},
{
"name" : "servicerequest",
"source" : [
{
"context" : "qr"
}
],
"target" : [
{
"context" : "servicerequest",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "active"
}
]
},
{
"context" : "servicerequest",
"contextType" : "variable",
"element" : "intent",
"transform" : "copy",
"parameter" : [
{
"valueString" : "order"
}
]
},
{
"context" : "servicerequest",
"contextType" : "variable",
"element" : "subject",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patient.id"
}
]
}
]
}
]
}
]
}