{
  "resourceType": "StructureDefinition",
  "id": "Mxx-HealthHub-ProposeMedicationBundle",
  "url": "https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_ProposeMedicationBundle",
  "version": "1.5.0",
  "name": "Mxx_HealthHub_ProposeMedicationBundle",
  "title": "Mxx_HealthHub_ProposeMedicationBundle",
  "status": "active",
  "publisher": "medatixx GmbH & Co. KG",
  "copyright": "medatixx GmbH & Co. KG",
  "description": "Collection Bundle for the batch medication proposal. Contains 1-20 medication proposals (Mxx_HealthHub_MedicationRequest). Bundle.identifier identifies this single transmission/batch as a whole. The prescription membership of the individual proposals is expressed independently via MedicationRequest.groupIdentifier and may differ per entry. As a FHIR collection Bundle it has no transactional FHIR semantics; processing is nevertheless all-or-nothing: if one entry is rejected (e.g. a PZN is not in the article master data), the entire batch is rejected with 422 and nothing is stored. All entries must refer to the same patient (subject) and the same partner system (requester). Response 204 No Content on success.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Bundle",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Bundle",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Bundle",
        "path": "Bundle",
        "constraint": [
          {
            "key": "bundle-same-subject-requester",
            "severity": "error",
            "human": "Alle MedicationRequest-Einträge eines Batches müssen denselben subject (Patient) und denselben requester (Partnersystem) haben.",
            "expression": "entry.resource.ofType(MedicationRequest).subject.reference.distinct().count() <= 1 and entry.resource.ofType(MedicationRequest).subject.identifier.value.distinct().count() <= 1 and entry.resource.ofType(MedicationRequest).requester.reference.distinct().count() <= 1"
          }
        ]
      },
      {
        "id": "Bundle.identifier",
        "path": "Bundle.identifier",
        "short": "Übertragungs-/Batch-Identifikator",
        "definition": "Identifiziert diese eine Übermittlung/den Batch als Ganzes. Empfohlen wird eine UUID (urn:uuid:...); das Format wird serverseitig nicht erzwungen.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.identifier.value",
        "path": "Bundle.identifier.value",
        "min": 1
      },
      {
        "id": "Bundle.type",
        "path": "Bundle.type",
        "short": "Typ des Bundles",
        "definition": "Fester Wert 'collection'. Als collection-Bundle hat es keine transaktionale FHIR-Semantik; die Verarbeitung durch die Praxissoftware erfolgt jedoch all-or-nothing (siehe Bundle-Beschreibung).",
        "fixedCode": "collection"
      },
      {
        "id": "Bundle.entry",
        "path": "Bundle.entry",
        "short": "Medikationsvorschläge (1-20)",
        "definition": "Liste der einzelnen Medikationsvorschläge. Jeder Eintrag muss konform zum Profil Mxx_HealthHub_MedicationRequest sein.",
        "min": 1,
        "max": "20"
      },
      {
        "id": "Bundle.entry.resource",
        "path": "Bundle.entry.resource",
        "short": "Einzelner Medikationsvorschlag",
        "definition": "Ein MedicationRequest-Vorschlag, konform zum Profil Mxx_HealthHub_MedicationRequest.",
        "min": 1,
        "type": [
          {
            "code": "Resource",
            "profile": [
              "https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_MedicationRequest"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry.response",
        "path": "Bundle.entry.response",
        "max": "0"
      }
    ]
  }
}