<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="GEM-ERP-PR-Task" />
  <meta>
    <versionId value="4" />
    <lastUpdated value="2025-02-04T06:28:57.241+00:00" />
  </meta>
  <url value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Task" />
  <version value="1.5" />
  <name value="GEM_ERP_PR_Task" />
  <title value="Task for Management of ePrescription Workflow" />
  <status value="draft" />
  <date value="2025-01-01" />
  <description value="This resource manages the ePrescription workflow" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Task" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Task" />
  <derivation value="constraint" />
  <differential>
    <element id="Task.meta">
      <path value="Task.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Task.meta.profile">
      <path value="Task.meta.profile" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <description value="Slicing for meta profile" />
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Task.meta.profile:workflowProfile">
      <path value="Task.meta.profile" />
      <sliceName value="workflowProfile" />
      <min value="1" />
      <max value="1" />
      <fixedCanonical value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Task|1.5" />
      <mustSupport value="true" />
    </element>
    <element id="Task.extension">
      <path value="Task.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <description value="Extensions are always sliced by (at least) url" />
        <rules value="closed" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Task.extension:flowType">
      <path value="Task.extension" />
      <sliceName value="flowType" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_PrescriptionType" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Task.extension:acceptDate">
      <path value="Task.extension" />
      <sliceName value="acceptDate" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_AcceptDate" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Task.extension:expiryDate">
      <path value="Task.extension" />
      <sliceName value="expiryDate" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_ExpiryDate" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Task.extension:lastMedicationDispense">
      <path value="Task.extension" />
      <sliceName value="lastMedicationDispense" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_LastMedicationDispense" />
      </type>
    </element>
    <element id="Task.extension:eu-isRedeemableByProperties">
      <path value="Task.extension" />
      <sliceName value="eu-isRedeemableByProperties" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_EU_IS_REDEEMABLE_BY_PROPERTIES" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Task.extension:eu-isRedeemableByPatientAuthorization">
      <path value="Task.extension" />
      <sliceName value="eu-isRedeemableByPatientAuthorization" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_EU_IS_REDEEMABLE_BY_PATIENT_AUTHORIZATION" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Task.identifier">
      <path value="Task.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <description value="The task ressource contains three identifier. The first one is the identifier for the ask representing one e-prescription. The other identifier are representing the patient as owner of the prescription. One is the &quot;Krankenversichertennummer&quot; which identify each patient by his health insurance company and the other is &quot;Institutionskennzeichen&quot;." />
        <rules value="closed" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Task.identifier:PrescriptionID">
      <path value="Task.identifier" />
      <sliceName value="PrescriptionID" />
      <short value="Prescription Identifier" />
      <definition value="The prescription identifier is the main identifier for the task ressource and the whole prescription workflow. This identifier is genereted by the &quot;E-Rezept Fachdienst&quot; and should not be changed manually." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Identifier" />
        <profile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_PrescriptionId" />
      </type>
    </element>
    <element id="Task.identifier:AccessCode">
      <path value="Task.identifier" />
      <sliceName value="AccessCode" />
      <short value="AccessCode Identifier" />
      <definition value="Generated by the &quot;E-Rezept Fachdienst&quot;. This identifier is transported in every task request." />
      <min value="0" />
      <max value="1" />
    </element>
    <element id="Task.identifier:AccessCode.system">
      <path value="Task.identifier.system" />
      <min value="1" />
      <fixedUri value="https://gematik.de/fhir/erp/NamingSystem/GEM_ERP_NS_AccessCode" />
    </element>
    <element id="Task.identifier:AccessCode.value">
      <path value="Task.identifier.value" />
      <min value="1" />
    </element>
    <element id="Task.identifier:Secret">
      <path value="Task.identifier" />
      <sliceName value="Secret" />
      <short value="Secret" />
      <min value="0" />
      <max value="1" />
    </element>
    <element id="Task.identifier:Secret.system">
      <path value="Task.identifier.system" />
      <min value="1" />
      <fixedUri value="https://gematik.de/fhir/erp/NamingSystem/GEM_ERP_NS_Secret" />
    </element>
    <element id="Task.identifier:Secret.value">
      <path value="Task.identifier.value" />
      <min value="1" />
    </element>
    <element id="Task.intent">
      <path value="Task.intent" />
      <fixedCode value="order" />
    </element>
    <element id="Task.for">
      <path value="Task.for" />
      <short value="Identifier of Patient (KVID or PKV-Identifier)" />
    </element>
    <element id="Task.for.identifier">
      <path value="Task.for.identifier" />
      <type>
        <code value="Identifier" />
        <profile value="http://fhir.de/StructureDefinition/identifier-kvid-10" />
      </type>
    </element>
    <element id="Task.performerType.coding">
      <path value="Task.performerType.coding" />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://gematik.de/fhir/erp/ValueSet/GEM_ERP_VS_OrganizationType" />
      </binding>
    </element>
    <element id="Task.input">
      <path value="Task.input" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="type.coding.code" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <short value="Input Bundle" />
      <definition value="Reference to ePrescription input and outcome during the process" />
      <mustSupport value="true" />
    </element>
    <element id="Task.input:ePrescription">
      <path value="Task.input" />
      <sliceName value="ePrescription" />
      <short value="QES-Binary of the ePrescription" />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Task.input:ePrescription.type.coding">
      <path value="Task.input.type.coding" />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://gematik.de/fhir/erp/CodeSystem/GEM_ERP_VS_DocumentType" />
      </binding>
    </element>
    <element id="Task.input:ePrescription.type.coding.system">
      <path value="Task.input.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Task.input:ePrescription.type.coding.code">
      <path value="Task.input.type.coding.code" />
      <min value="1" />
      <fixedCode value="1" />
    </element>
    <element id="Task.input:ePrescription.value[x]">
      <path value="Task.input.value[x]" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Binary" />
      </type>
    </element>
    <element id="Task.input:patientReceipt">
      <path value="Task.input" />
      <sliceName value="patientReceipt" />
      <short value="JSON Bundle of the ePrescription to be consumed by the E-Rezept-FdV" />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Task.input:patientReceipt.type.coding">
      <path value="Task.input.type.coding" />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://gematik.de/fhir/erp/CodeSystem/GEM_ERP_VS_DocumentType" />
      </binding>
    </element>
    <element id="Task.input:patientReceipt.type.coding.system">
      <path value="Task.input.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Task.input:patientReceipt.type.coding.code">
      <path value="Task.input.type.coding.code" />
      <min value="1" />
      <fixedCode value="2" />
    </element>
    <element id="Task.input:patientReceipt.value[x]">
      <path value="Task.input.value[x]" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Bundle" />
      </type>
    </element>
    <element id="Task.output">
      <path value="Task.output" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="type.coding.code" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <short value="Output Bundle" />
      <definition value="Reference to the Bundle which represent the receipt." />
      <mustSupport value="true" />
    </element>
    <element id="Task.output:receipt">
      <path value="Task.output" />
      <sliceName value="receipt" />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Task.output:receipt.type.coding">
      <path value="Task.output.type.coding" />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://gematik.de/fhir/erp/CodeSystem/GEM_ERP_VS_DocumentType" />
      </binding>
    </element>
    <element id="Task.output:receipt.type.coding.system">
      <path value="Task.output.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Task.output:receipt.type.coding.code">
      <path value="Task.output.type.coding.code" />
      <min value="1" />
      <fixedCode value="3" />
    </element>
    <element id="Task.output:receipt.value[x]">
      <path value="Task.output.value[x]" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Bundle" />
      </type>
    </element>
  </differential>
</StructureDefinition>