{
  "resourceType": "StructureDefinition",
  "url": "http://digen.nublar.de/fhir/StructureDefinition/DigenMedicationStatementDispense",
  "name": "DigenMedicationStatementDispense",
  "status": "draft",
  "description": "This is a MedicationDispense that only exists within the context of a MedicationStatement. It is needed to carry the dispensing information (organization, date) derived from claims data or entered by the user.",
  "fhirVersion": "3.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "MedicationDispense",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationDispense",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationDispense.meta.id",
        "path": "MedicationDispense.meta.id",
        "max": "0"
      },
      {
        "id": "MedicationDispense.meta.security",
        "path": "MedicationDispense.meta.security",
        "max": "0"
      },
      {
        "id": "MedicationDispense.meta.tag",
        "path": "MedicationDispense.meta.tag",
        "max": "0"
      },
      {
        "id": "MedicationDispense.implicitRules",
        "path": "MedicationDispense.implicitRules",
        "max": "0"
      },
      {
        "id": "MedicationDispense.language",
        "path": "MedicationDispense.language",
        "max": "0"
      },
      {
        "id": "MedicationDispense.text",
        "path": "MedicationDispense.text",
        "max": "0"
      },
      {
        "id": "MedicationDispense.contained",
        "path": "MedicationDispense.contained",
        "max": "0"
      },
      {
        "id": "MedicationDispense.identifier",
        "path": "MedicationDispense.identifier",
        "max": "0"
      },
      {
        "id": "MedicationDispense.partOf",
        "path": "MedicationDispense.partOf",
        "max": "0"
      },
      {
        "id": "MedicationDispense.status",
        "path": "MedicationDispense.status",
        "max": "0"
      },
      {
        "id": "MedicationDispense.category",
        "path": "MedicationDispense.category",
        "max": "0"
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept",
        "path": "MedicationDispense.medicationCodeableConcept",
        "sliceName": "medicationCodeableConcept",
        "definition": "Identifies the dispensed medication by PZN. This must be identical to the containing MedicationStatement's PZN.",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ]
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.id",
        "path": "MedicationDispense.medicationCodeableConcept.id",
        "max": "0"
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.coding",
        "path": "MedicationDispense.medicationCodeableConcept.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.coding.id",
        "path": "MedicationDispense.medicationCodeableConcept.coding.id",
        "max": "0"
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.coding.system",
        "path": "MedicationDispense.medicationCodeableConcept.coding.system",
        "min": 1,
        "fixedUri": "http://fhir.de/CodeSystem/ifa/pzn"
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.coding.version",
        "path": "MedicationDispense.medicationCodeableConcept.coding.version",
        "max": "0"
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.coding.code",
        "path": "MedicationDispense.medicationCodeableConcept.coding.code",
        "short": "PZN",
        "definition": "The 8-digit PZN of the containing MedicationStatement's Medication. Given our current data sources, this will be identical to the dispensed medication. This may differ from the ordered medication in cases of substitution, which is currently not in-scope.",
        "min": 1
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.coding.userSelected",
        "path": "MedicationDispense.medicationCodeableConcept.coding.userSelected",
        "max": "0"
      },
      {
        "id": "MedicationDispense.medication[x]:medicationCodeableConcept.text",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable",
            "valueBoolean": true
          }
        ],
        "path": "MedicationDispense.medicationCodeableConcept.text",
        "max": "0"
      },
      {
        "id": "MedicationDispense.subject",
        "path": "MedicationDispense.subject",
        "max": "0",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/Patient"
          }
        ]
      },
      {
        "id": "MedicationDispense.subject.id",
        "path": "MedicationDispense.subject.id",
        "max": "0"
      },
      {
        "id": "MedicationDispense.subject.reference",
        "path": "MedicationDispense.subject.reference",
        "min": 1
      },
      {
        "id": "MedicationDispense.subject.identifier",
        "path": "MedicationDispense.subject.identifier",
        "max": "0"
      },
      {
        "id": "MedicationDispense.subject.display",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable",
            "valueBoolean": true
          }
        ],
        "path": "MedicationDispense.subject.display",
        "max": "0"
      },
      {
        "id": "MedicationDispense.context",
        "path": "MedicationDispense.context",
        "max": "0"
      },
      {
        "id": "MedicationDispense.supportingInformation",
        "path": "MedicationDispense.supportingInformation",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer",
        "path": "MedicationDispense.performer",
        "short": "Erworben bei",
        "definition": "Indicates which pharmacy dispensed the medication.",
        "comment": "References the dispensing organization",
        "max": "1"
      },
      {
        "id": "MedicationDispense.performer.id",
        "path": "MedicationDispense.performer.id",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor",
        "path": "MedicationDispense.performer.actor",
        "short": "Pharmacy",
        "definition": "The pharmacy that handed out the medication in question.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/Organization"
          }
        ]
      },
      {
        "id": "MedicationDispense.performer.actor.id",
        "path": "MedicationDispense.performer.actor.id",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor.reference",
        "path": "MedicationDispense.performer.actor.reference",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor.identifier",
        "path": "MedicationDispense.performer.actor.identifier",
        "short": "Apotheke (IK Nummer)",
        "min": 1
      },
      {
        "id": "MedicationDispense.performer.actor.identifier.id",
        "path": "MedicationDispense.performer.actor.identifier.id",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor.identifier.use",
        "path": "MedicationDispense.performer.actor.identifier.use",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor.identifier.type",
        "path": "MedicationDispense.performer.actor.identifier.type",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor.identifier.system",
        "path": "MedicationDispense.performer.actor.identifier.system",
        "short": "Apotheke (IK Nummer)",
        "definition": "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.\r\n(http://fhir.de/NamingSystem/arge-ik/iknr)",
        "min": 1,
        "fixedUri": "urn:oid:1.2.276.0.76.4.5"
      },
      {
        "id": "MedicationDispense.performer.actor.identifier.value",
        "path": "MedicationDispense.performer.actor.identifier.value",
        "min": 1
      },
      {
        "id": "MedicationDispense.performer.actor.identifier.period",
        "path": "MedicationDispense.performer.actor.identifier.period",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor.identifier.assigner",
        "path": "MedicationDispense.performer.actor.identifier.assigner",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.actor.display",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable",
            "valueBoolean": true
          }
        ],
        "path": "MedicationDispense.performer.actor.display",
        "max": "0"
      },
      {
        "id": "MedicationDispense.performer.onBehalfOf",
        "path": "MedicationDispense.performer.onBehalfOf",
        "max": "0"
      },
      {
        "id": "MedicationDispense.authorizingPrescription",
        "path": "MedicationDispense.authorizingPrescription",
        "max": "0"
      },
      {
        "id": "MedicationDispense.type",
        "path": "MedicationDispense.type",
        "max": "0"
      },
      {
        "id": "MedicationDispense.quantity",
        "path": "MedicationDispense.quantity",
        "max": "0"
      },
      {
        "id": "MedicationDispense.daysSupply",
        "path": "MedicationDispense.daysSupply",
        "max": "0"
      },
      {
        "id": "MedicationDispense.whenPrepared",
        "path": "MedicationDispense.whenPrepared",
        "max": "0"
      },
      {
        "id": "MedicationDispense.whenHandedOver",
        "path": "MedicationDispense.whenHandedOver",
        "short": "Erworben am",
        "definition": "The date the dispensed product was provided to the patient or their representative.",
        "comment": "Only the date portion of the dateTime object SHALL be used.",
        "constraint": [
          {
            "key": "pmsd-1",
            "severity": "error",
            "human": "Only the date portion of the dateTime object SHALL be used",
            "expression": "whenHandedOver.toString().matches('-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?')"
          }
        ]
      },
      {
        "id": "MedicationDispense.destination",
        "path": "MedicationDispense.destination",
        "max": "0"
      },
      {
        "id": "MedicationDispense.receiver",
        "path": "MedicationDispense.receiver",
        "max": "0"
      },
      {
        "id": "MedicationDispense.note",
        "path": "MedicationDispense.note",
        "max": "0"
      },
      {
        "id": "MedicationDispense.dosageInstruction",
        "path": "MedicationDispense.dosageInstruction",
        "max": "0"
      },
      {
        "id": "MedicationDispense.substitution",
        "path": "MedicationDispense.substitution",
        "max": "0"
      },
      {
        "id": "MedicationDispense.detectedIssue",
        "path": "MedicationDispense.detectedIssue",
        "max": "0"
      },
      {
        "id": "MedicationDispense.notDone",
        "path": "MedicationDispense.notDone",
        "max": "0"
      },
      {
        "id": "MedicationDispense.notDoneReason[x]",
        "path": "MedicationDispense.notDoneReason[x]",
        "max": "0"
      },
      {
        "id": "MedicationDispense.eventHistory",
        "path": "MedicationDispense.eventHistory",
        "max": "0"
      }
    ]
  }
}