CH RAD-Order (R4)
2.0.0-ci-build - ci-build
CH RAD-Order (R4), published by HL7 Switzerland. This guide is not an authorized publication; it is the continuous build for version 2.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-rad-order/ and changes regularly. See the Directory of published versions
Official URL: http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle | Version: 2.0.0-ci-build | |||
Draft as of 2024-04-20 | Computable Name: RadOrderQrToBundle | |||
Copyright/Legal: CC0-1.0 |
Radiologoy QuestionnaireResponse to Bundle
map "http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle" = "RadOrderQrToBundle" // Radiologoy QuestionnaireResponse to Bundle uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target uses "http://hl7.org/fhir/StructureDefinition/Organization" alias Organization as target uses "http://hl7.org/fhir/StructureDefinition/Practitioner" alias Practitioner as target uses "http://hl7.org/fhir/StructureDefinition/PractitionerRole" alias PractitionerRole as target uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as target uses "http://hl7.org/fhir/StructureDefinition/BackboneElement" alias BackboneElement as target imports "http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle" group RadOrderQrToBundle(source qr : QuestionnaireResponse, target bundle : Bundle) { qr -> bundle.identifier as documentIdentifier, documentIdentifier.system = 'urn:ietf:rfc:3986', uuid() as uuidDoc, documentIdentifier.value = ('urn:uuid:' + uuidDoc) "documentIdentifier"; qr as qrcp -> bundle.entry as e, e.resource = create('Composition') as composition, composition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), composition.title = 'Radiologieauftrag', composition.type as type, type.coding as coding, coding.code = '2161000195103', coding.system = 'urn:oid:2.16.756.5.30.1.127.3.4', coding.display = 'Imaging order (record artifact)', composition.category as category, category.coding as coding, coding.code = '721963009', coding.system = 'http://snomed.info/sct', coding.display = 'Order (record artifact)', bundle.entry as e2, bundle.timestamp = (now()) as timestamp, composition.date = timestamp, e2.resource = create('Patient') as patient, patient.id = uuid() as uuid2, e2.fullUrl = ('urn:uuid:' + uuid2), bundle.entry as e4, e4.resource = qrcp as questionnaireresp, questionnaireresp.id = uuid() as uuid4, e4.fullUrl = ('urn:uuid:' + uuid4), bundle.entry as e5, e5.resource = create('ServiceRequest') as servicerequest, servicerequest.id = uuid() as uuid5, e5.fullUrl = ('urn:uuid:' + uuid5) then { qr.questionnaire as can -> bundle.entry as e6, e6.resource = (can.resolve()) as q, q.id = uuid() as uuid6, e6.fullUrl = append('urn:uuid:', uuid6) then QrToBundle(qr, q, patient, questionnaireresp, servicerequest, composition, bundle) "orfbundle"; qr then RadOrderQrToServiceRequest(qr, patient, bundle, composition, servicerequest) "servicerequest"; } "orfbundle"; } group RadOrderQrToServiceRequest(source qr : QuestionnaireResponse, target patient : Patient, target bundle : Bundle, target composition : Composition, target serviceRequest : ServiceRequest) { qr.item as grp where linkId = 'requestedService' then RequestedServiceItems(grp, serviceRequest) "requestedService"; qr.item as grp where linkId = 'reason' then ReasonServiceItems(grp, serviceRequest) "reason"; qr.item as grp where linkId = 'imagingService' then ImagingServiceItems(grp, serviceRequest) "imagingService"; qr.item as grp where linkId = 'orderDetail' then OrderDetailServiceItems(grp, serviceRequest) "orderDetail"; qr.item as grp where linkId = 'desiredRadiologist' then DesiredRadiologistServiceItems(grp, bundle, serviceRequest) "desiredRadiologist"; qr.item as grp where linkId = 'diagnosisList' then DiagnosisListServiceItems(grp, patient, bundle, serviceRequest) "diagnosisList"; qr.item as grp where linkId = 'caveat' then CaveatServiceItems(grp, patient, bundle, serviceRequest) "Caveat"; qr.item as grp where linkId = 'attachment' then PreviousImagingStudyResults(grp, bundle, serviceRequest, patient) "attachment"; } group RequestedServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'requestedService.service') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.category as cc, cc.coding = coding "service"; } "valueCoding"; } "answer"; } group ReasonServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'reason.question') and answer.exists()) then { item.answer as answer then { answer.value : string as value -> serviceRequest.reasonCode as reasonCode, reasonCode.text = value "question"; } "valueString"; } "answer"; } group ImagingServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'imagingService.type') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.code as code, code.coding = coding "service"; } "valueCoding"; } "answer"; } group OrderDetailServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'orderDetail.imagingRegion') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'imagingRegion', cc.coding = coding "imagingRegion"; } "valueCoding"; } "answer"; src.item as item where ((linkId.value = 'orderDetail.imagingFocus') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.bodySite as cc, cc.coding = coding "imagingFocus"; } "valueCoding"; } "answer"; src.item as item where ((linkId.value = 'orderDetail.laterality') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'laterality', cc.coding = coding "laterality"; } "valueCoding"; } "answer"; src.item as item where ((linkId.value = 'orderDetail.viewType') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'viewType', cc.coding = coding "viewType"; } "valueCoding"; } "answer"; src.item as item where ((linkId.value = 'orderDetail.maneuverType') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'maneuverType', cc.coding = coding "maneuverType"; } "valueCoding"; } "answer"; src.item as item where ((linkId.value = 'orderDetail.guidanceForAction') and answer.exists()) then { item.answer as answer then { answer.value : Coding as coding -> serviceRequest.orderDetail as cc, cc.extension as ext, ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type', ext.value = create('Coding') as coding, coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type', coding.code = 'guidanceForAction', cc.coding = coding "guidanceForAction"; } "valueCoding"; } "answer"; } group DesiredRadiologistServiceItems(source src : BackboneElement, target bundle : Bundle, target serviceRequest : ServiceRequest) { src -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid, serviceRequest.performer as performer, performer.reference = ('urn:uuid:' + uuid), e.fullUrl = ('urn:uuid:' + uuid) then { src.item as item where ((linkId.value = 'desiredRadiologist.familyName') and answer.exists()) -> practitioner.name as name share name, name.family = (item.answer.value); src.item as item where ((linkId.value = 'desiredRadiologist.givenName') and answer.exists()) -> practitioner.name as name share name, name.given = (item.answer.value); } "performer"; } group DiagnosisListServiceItems(source src : BackboneElement, target patient : Patient, target bundle : Bundle, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'diagnosisList.primaryDiagnosis') and answer.exists()) then { item.answer as answer then { answer.value : string as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.reasonReference as reasonReference, reasonReference.reference = ('urn:uuid:' + uuid), condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.text = value, condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "primaryDiagnosis"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'diagnosisList.secondaryDiagnosis') and answer.exists()) then { item.answer as answer then { answer.value : string as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.text = value, condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "secondaryDiagnosis"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'diagnosisList.bodyHeight') and answer.exists()) then { item.answer as answer then { answer.value : Quantity as value -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), observation.status = 'final', serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), observation.category as category, category.coding as coding, coding.code = 'vital-signs', coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category', observation.value = value, observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '8302-2', observation.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "bodyHeight"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'diagnosisList.bodyWeight') and answer.exists()) then { item.answer as answer then { answer.value : Quantity as value -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, observation.status = 'final', e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), observation.category as category, category.coding as coding, coding.code = 'vital-signs', coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category', observation.value = value, observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '29463-7', observation.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "bodyWeight"; } "valueString"; } "answer"; } group CaveatServiceItems(source src : BackboneElement, target patient : Patient, target bundle : Bundle, target serviceRequest : ServiceRequest) { src.item as item where ((linkId.value = 'caveat.bloodCoagulation') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '64779008', coding.system = 'http://snomed.info/sct', coding.display = 'Blood coagulation disorder (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '64779008', coding2.system = 'http://snomed.info/sct', coding2.display = 'Blood coagulation disorder (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) then { answer.item as subitem where (linkId.value = 'caveat.bloodCoagulation.INR') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.id = uuid() as uuid, observation.status = 'final', e.fullUrl = ('urn:uuid:' + uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '34714-6', observation.subject as subject, subject.reference = ('urn:uuid:' + patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveat.bloodCoagulation.INR.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "value"; } "quantity"; subitem.item as datetimeitem where ((linkId.value = 'caveat.bloodCoagulation.INR.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "value"; } "dateTime"; } "INR"; answer.item as subitem where (linkId.value = 'caveat.bloodCoagulation.platelets') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.id = uuid() as uuid, observation.status = 'final', e.fullUrl = ('urn:uuid:' + uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '26515-7', observation.subject as subject, subject.reference = ('urn:uuid:' + patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveat.bloodCoagulation.platelets.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "value"; } "platelets"; subitem.item as datetimeitem where ((linkId.value = 'caveat.bloodCoagulation.platelets.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "value"; } "platelets"; } "INR"; } "bloodCoagulation"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'caveat.renalInsufficiency') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '723188008', coding.system = 'http://snomed.info/sct', coding.display = 'Renal insufficiency (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '723188008', coding2.system = 'http://snomed.info/sct', coding2.display = 'Renal insufficiency (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) then { answer.item as subitem where (linkId.value = 'caveat.renalInsufficiency.creatinineClearance') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '33558-8', observation.subject as subject, subject.reference = ('urn:uuid:' + patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveat.renalInsufficiency.creatinineClearance.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "value"; } "quantity"; subitem.item as datetimeitem where ((linkId.value = 'caveat.renalInsufficiency.creatinineClearance.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "value"; } "creatinineClearancedateTime"; } "INR"; answer.item as subitem where (linkId.value = 'caveat.renalInsufficiency.creatinine') -> bundle.entry as e, e.resource = create('Observation') as observation, observation.status = 'final', observation.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), condition.evidence as evidence, evidence.detail as detail, detail.reference = ('urn:uuid:' + uuid), observation.code as cc, cc.coding as c, c.system = 'http://loinc.org', c.code = '77140-2', observation.subject as subject, subject.reference = ('urn:uuid:' + patient.id) then { subitem.item as quantityitem where ((linkId.value = 'caveat.renalInsufficiency.creatinine.quantity') and answer.exists()) then { quantityitem.answer as answer then { answer.value : Quantity as value -> observation.value = value; } "value"; } "creatinine"; subitem.item as datetimeitem where ((linkId.value = 'caveat.renalInsufficiency.creatinine.dateTime') and answer.exists()) then { datetimeitem.answer as answer then { answer.value : dateTime as value -> observation.effective = value; } "ue"; } "platelets"; } "creatinine"; } "bloodCoagulation"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'caveat.claustrophobia') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '19887002', coding.system = 'http://snomed.info/sct', coding.display = 'Claustrophobia (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '19887002', coding2.system = 'http://snomed.info/sct', coding2.display = 'Claustrophobia (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "claustrophobia"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'caveat.bodyPiercing') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '879862001', coding.system = 'http://snomed.info/sct', coding.display = 'Body piercing (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '879862001', coding2.system = 'http://snomed.info/sct', coding2.display = 'Body piercing (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "bodyPiercing"; } "valueString"; } "answer"; src.item as item where (linkId.value = 'caveat.device') -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid) then { item.item as subitem where ((linkId.value = 'caveat.device.choice') and answer.exists()) then { subitem.answer as answer then { answer.value : Coding as value -> condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '397578001', coding.system = 'http://snomed.info/sct', coding.display = 'Device in situ (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "device"; } "choise"; item.item as subitem where ((linkId.value = 'caveat.device.specifictype') and answer.exists()) then { subitem.answer as answer then { answer.value : Coding as value -> condition.code as code, code.coding = value "devicespecific"; } "specifictype"; } "devicespecific"; } "device"; } "device"; src.item as item where ((linkId.value = 'caveat.hyperthyroidism') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '34486009', coding.system = 'http://snomed.info/sct', coding.display = 'Hyperthyroidism (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '34486009', coding2.system = 'http://snomed.info/sct', coding2.display = 'Hyperthyroidism (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "hyperthyroidism"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'caveat.diabetes') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '73211009', coding.system = 'http://snomed.info/sct', coding.display = 'Diabetes mellitus (disorder)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '73211009', coding2.system = 'http://snomed.info/sct', coding2.display = 'Diabetes mellitus (disorder)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "diabetes"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'caveat.gravida') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '366321006', coding.system = 'http://snomed.info/sct', coding.display = 'Finding of gravida (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '366321006', coding2.system = 'http://snomed.info/sct', coding2.display = 'Finding of gravida (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "gravida"; } "valueString"; } "answer"; src.item as item where ((linkId.value = 'caveat.contrastMediaAllergy') and answer.exists()) then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '293637006', coding.system = 'http://snomed.info/sct', coding.display = 'Allergy to contrast media (finding)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '293637006', coding2.system = 'http://snomed.info/sct', coding2.display = 'Allergy to contrast media (finding)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "contrastMediaAllergy"; } "valueString"; } "answer"; // "caveat.drugPrescription.metformin" src.item as item where (linkId.value = 'caveat.drugPrescription') then DesiredRadiologistServiceItemsDrugDescription(item, bundle, serviceRequest, patient) "DrugPrescription"; } group DesiredRadiologistServiceItemsDrugDescription(source src : BackboneElement, target bundle : Bundle, target serviceRequest : ServiceRequest, target patient : Patient) { src.item as item where (linkId.value = 'caveat.drugPrescription.metformin') then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '182817000', coding.system = 'http://snomed.info/sct', coding.display = 'Drug prescription (situation)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '372567009', coding2.system = 'http://snomed.info/sct', coding2.display = 'Metformin (substance)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "drugPrescription"; } "valueString"; } "metformin"; src.item as item where (linkId.value = 'caveat.drugPrescription.betaBlocker') then { item.answer as answer then { answer.value : Coding as value -> bundle.entry as e, e.resource = create('Condition') as condition, condition.id = uuid() as uuid, e.fullUrl = ('urn:uuid:' + uuid), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid), condition.extension as ext1, ext1.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type', ext1.value = create('Coding') as coding, coding.code = '182817000', coding.system = 'http://snomed.info/sct', coding.display = 'Drug prescription (situation)', condition.extension as ext2, ext2.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value', ext2.value = value, condition.category as category, category.coding as coding, coding.code = 'problem-list-item', coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category', coding.display = 'Problem List Item', condition.code as code, code.coding as coding2, coding2.code = '373254001', coding2.system = 'http://snomed.info/sct', coding2.display = 'Substance with beta adrenergic receptor antagonist mechanism of action (substance)', condition.subject as subject, subject.reference = ('urn:uuid:' + patient.id) "drugPrescription"; } "valueString"; } "betaBlocker"; } group PreviousImagingStudyResults(source grp : BackboneElement, target bundle : Bundle, target serviceRequest : ServiceRequest, target patient : Patient) { grp.item as item where (linkId.value = 'attachment.imagingStudy') -> bundle.entry as e, e.resource = create('ImagingStudy') as imagingStudy, imagingStudy.id = uuid() as uuid, imagingStudy.status = 'available', imagingStudy.subject as subject, subject.reference = ('urn:uuid:' + patient.id), e.fullUrl = append('urn:uuid:', uuid), serviceRequest.subject as subject, subject.reference = ('urn:uuid:' + patient.id), serviceRequest.supportingInfo as supportingInfo, supportingInfo.reference = ('urn:uuid:' + uuid) then { item.item as dictomitem where ((linkId.value = 'attachment.imagingStudy.StudyInstanceUid') and answer.exists()) -> imagingStudy.identifier as uid, uid.system = 'urn:dicom:uid', uid.use = 'official', uid.value = ('urn:oid:' + dictomitem.answer.value) "uid"; item.item as dictomitem where ((linkId.value = 'attachment.imagingStudy.acsn') and answer.exists()) -> imagingStudy.identifier as acsn, acsn.type as type, type.coding as coding, coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203', coding.code = 'ACSN', acsn.use = 'usual', acsn.value = (dictomitem.answer.value) "acsn"; item.item as dictomitem where ((linkId.value = 'attachment.imagingStudy.SeriesInstanceUid') and answer.exists()) -> imagingStudy.series as series then { dictomitem.answer as answer then { answer.value : string as value -> series.uid = value "uid"; item.item as dictomitem where ((linkId.value = 'attachment.imagingStudy.SopInstanceUid') and answer.exists()) -> series.instance as instance then { dictomitem.answer as answer then { answer.value : string as value -> instance.uid = value "uid"; }; } "answer"; } "series"; } "imagingStudy"; } "previousResult"; }