FHIR Cross-Version Mapping Pack
0.1.0 - Ballot for Release 5.1.0 International flag

FHIR Cross-Version Mapping Pack, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cross-version/ and changes regularly. See the Directory of published versions

StructureMap: MedicationOrder Transforms: R2 to R3

Official URL: http://hl7.org/fhir/StructureMap/MedicationOrder2to3 Version: 0.1.0
Standards status: Draft Maturity Level: 1 Computable Name: MedicationOrder2to3

MedicationOrderTransformsR2toR3

/// url = 'http://hl7.org/fhir/StructureMap/MedicationOrder2to3'
/// name = 'MedicationOrder2to3'
/// title = 'MedicationOrder Transforms: R2 to R3'
/// status = 'active'

uses "http://hl7.org/fhir/1.0/MedicationOrder" alias MedicationOrderR2 as source
uses "http://hl7.org/fhir/3.0/MedicationRequest" alias MedicationRequest as target

imports "http://hl7.org/fhir/StructureMap/*2to3"

group MedicationOrder(source src : MedicationOrderR2, target tgt : MedicationRequest) extends DomainResource <<type+>> {
  src -> tgt.intent = 'order' "MedicationOrder-intent";
  src.identifier -> tgt.identifier "MedicationOrder-identifier";
  src.dateWritten -> tgt.authoredOn "MedicationOrder-dateWritten";
  src.status -> tgt.status "MedicationOrder-status";
  src.patient -> tgt.subject "MedicationOrder-patient";
  src where prescriber.exists() -> tgt.requester as vt then medRequestor(src, vt) "MedicationOrder-prescriber";
  src.encounter -> tgt.context "MedicationOrder-encounter";
  src.reason where $this is CodeableConcept -> tgt.reasonCode "MedicationOrder-reasonCode";
  src.reason where $this is Reference -> tgt.reasonReference "MedicationOrder-reasonCode";
  src.note -> tgt.note "MedicationOrder-note";
  src.medication -> tgt.medication "MedicationOrder-medication";
  src.dosageInstruction as vs -> tgt.dosageInstruction as vt then medDosageInstruction(vs, vt) "MedicationOrder-dosageInstruction";
  src.dispenseRequest as vs check medication.empty() -> tgt.dispenseRequest as vt then medDispenseRequest(vs, vt) "MedicationOrder-dispenseRequest";
  src.substitution as vs -> tgt.substitution as vt then medSubstitution(vs, vt) "MedicationOrder-substitution";
  src.priorPrescription -> tgt.priorPrescription "MedicationOrder-priorPrescription";
}

group medDosageInstruction(source src, target tgt) extends Element {
  src.text -> tgt.text "dosage-text";
  src.additionalInstructions -> tgt.additionalInstruction "dosage-additionalInstructions";
  src.timing -> tgt.timing "dosage-timing";
  src.asNeeded -> tgt.asNeeded "dosage-asNeeded";
  src.site where $this is CodeableConcept -> tgt.site "dosage-site";
  src.route -> tgt.route "dosage-route";
  src.method -> tgt.method "dosage-method";
  src.dose -> tgt.dose "dosage-dose";
  src.rate -> tgt.rate "dosage-rate";
  src.maxDosePerPeriod -> tgt.maxDosePerPeriod "dosage-maxDosePerPeriod";
}

group medDispenseRequest(source src, target tgt) extends BackboneElement {
  src.validityPeriod -> tgt.validityPeriod "dispenseRequest-validityPeriod";
  src.numberOfRepeatsAllowed -> tgt.numberOfRepeatsAllowed "dispenseRequest-numberOfRepeatsAllowed";
  src.quantity -> tgt.quantity "dispenseRequest-quantity";
  src.expectedSupplyDuration as v -> tgt.expectedSupplyDuration as d then QuantityToDuration(v, d) "dispenseRequest-expectedSupplyDuration";
}

group medSubstitution(source src, target tgt) extends BackboneElement {
  src.reason -> tgt.reason "substitution-reason";
}

group medRequestor(source src, target tgt) {
  src.prescriber -> tgt.agent "MedicationOrder-prescriber2";
}