<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="erp-service-request-medication-request" />
  <url value="https://gematik.de/fhir/erp-servicerequest/StructureDefinition/erp-service-request-medication-request" />
  <version value="1.2.0" />
  <name value="ERPServiceRequestMedicationRequest" />
  <title value="ERP Service Request Medikationsanforderung" />
  <status value="active" />
  <experimental value="false" />
  <date value="2025-07-31" />
  <publisher value="gematik GmbH" />
  <description value="Medizinische und pharmazeutische Informationen für die Rezeptanforderung" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="MedicationRequest" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/MedicationRequest" />
  <derivation value="constraint" />
  <differential>
    <element id="MedicationRequest.extension">
      <path value="MedicationRequest.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <comment value="If the previous recipe ID is known, it can be named here" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.extension:PriorPrescriptionID">
      <path value="MedicationRequest.extension" />
      <sliceName value="PriorPrescriptionID" />
      <short value="Provide a previous PrescriptionID that corresponds to the requested medication." />
      <definition value="The MedicationRequest can contain a PrescriptionId of a prescription that has already been issued.&#xA;If a previous prescription ID is known, the writing system MAY indicate this in the medication request.&#xA;If this ID is available, the receiving system MUST be able to search for the previous regulation and give the user the opportunity to display and compare the content." />
      <comment value="Must be given in the form xxx.xxx.xxx.xxx.xxx.xx." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp-servicerequest/StructureDefinition/prescription-id-ex" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.modifierExtension">
      <path value="MedicationRequest.modifierExtension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="MedicationRequest.modifierExtension:requestMVO">
      <path value="MedicationRequest.modifierExtension" />
      <sliceName value="requestMVO" />
      <short value="Multiple prescription order" />
      <definition value="If the prescription is should be a multiple prescription order. Only the 'Kennzeichen' should be stated, indicating that the prescription is requested to be a multiple prescription order." />
      <comment value="When this extension is received by a PVS, the prescriber has to be visually notified about the request for a multiple prescription order." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp-servicerequest/StructureDefinition/request-mvo-ex" />
      </type>
      <mustSupport value="true" />
      <isModifierReason value="When this extension is received by a PVS, the prescriber has to be visually notified about the request for a multiple prescription order." />
    </element>
    <element id="MedicationRequest.medication[x]">
      <path value="MedicationRequest.medication[x]" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Medication_PZN" />
        <targetProfile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Medication_Compounding" />
        <targetProfile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Medication_Ingredient" />
        <targetProfile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Medication_FreeText" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.subject">
      <path value="MedicationRequest.subject" />
      <short value="Patient for whom a dispense is requested on behalf of the patient." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://gematik.de/fhir/erp-servicerequest/StructureDefinition/erp-service-request-patient" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction">
      <path value="MedicationRequest.dosageInstruction" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction.text">
      <path value="MedicationRequest.dosageInstruction.text" />
      <short value="Dosieranweisung" />
      <definition value="Dosieranweisung einer Verordnung" />
      <maxLength value="500" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction.patientInstruction">
      <path value="MedicationRequest.dosageInstruction.patientInstruction" />
      <short value="Gebrauchsanweisung einer Rezeptur" />
      <definition value="Gebrauchsanweisung einer Rezeptur" />
      <maxLength value="500" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dispenseRequest">
      <path value="MedicationRequest.dispenseRequest" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dispenseRequest.quantity">
      <path value="MedicationRequest.dispenseRequest.quantity" />
      <short value="Number of prescribed units" />
      <definition value="The number of units of the medication to be supplied per dispense. Usually value and unit are stated which are free text variants. If a structured code is used it must be from UnitsOfMeasure." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dispenseRequest.quantity.value">
      <path value="MedicationRequest.dispenseRequest.quantity.value" />
      <short value="Number prescribed" />
      <definition value="Number prescribed" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dispenseRequest.quantity.unit">
      <path value="MedicationRequest.dispenseRequest.quantity.unit" />
      <short value="Requested units of the prescription" />
      <definition value="This is a free text field that can be used to specify the units of the prescription." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dispenseRequest.quantity.system">
      <path value="MedicationRequest.dispenseRequest.quantity.system" />
      <fixedUri value="http://unitsofmeasure.org" />
    </element>
    <element id="MedicationRequest.dispenseRequest.quantity.code">
      <path value="MedicationRequest.dispenseRequest.quantity.code" />
      <short value="Code from Unit of measure" />
      <definition value="If a structured code is used it must be from UnitsOfMeasure" />
    </element>
  </differential>
</StructureDefinition>