{
  "resourceType": "StructureDefinition",
  "id": "BIV-PR-TA6-Rechnung-Bundle",
  "url": "https://fhir.biv-ot.org/eVerordnungAbrechnungsdaten/BIV_PR_TA6_Rechnung_Bundle",
  "version": "0.1",
  "name": "BIV_PR_TA6_Rechnung_Bundle",
  "title": "BIV_PR_TA6_Rechnung_Bundle",
  "status": "draft",
  "date": "2024-05-21",
  "description": "TA6 Rechnung aus Datei - Bundle",
  "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": "dname-1",
            "severity": "error",
            "human": "Der Dateiname der TA6_Rechnung_Bundle muss in der TA6_Rechnung_List enthalten sein.",
            "expression": "identifier.value in entry.where(resource is List).resource.entry.item.identifier.value"
          }
        ]
      },
      {
        "id": "Bundle.id",
        "path": "Bundle.id",
        "min": 1
      },
      {
        "id": "Bundle.meta",
        "path": "Bundle.meta",
        "min": 1
      },
      {
        "id": "Bundle.meta.profile",
        "path": "Bundle.meta.profile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://fhir.biv-ot.org/eVerordnungAbrechnungsdaten/BIV_PR_TA6_Rechnung_Bundle|1.4"
      },
      {
        "id": "Bundle.implicitRules",
        "path": "Bundle.implicitRules",
        "max": "0"
      },
      {
        "id": "Bundle.language",
        "path": "Bundle.language",
        "max": "0"
      },
      {
        "id": "Bundle.identifier",
        "path": "Bundle.identifier",
        "short": "Dateiname und Dateinummer",
        "min": 1
      },
      {
        "id": "Bundle.identifier.extension",
        "path": "Bundle.identifier.extension",
        "slicing": {
          "rules": "closed"
        },
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.identifier.extension:Dateinummer",
        "path": "Bundle.identifier.extension",
        "sliceName": "Dateinummer",
        "short": "Dateinummer",
        "definition": "fortlaufende Nummer innerhalb eines Jahres, beginnend mit 00001",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://fhir.biv-ot.org/eVerordnungAbrechnungsdaten/BIV_EX_ERP_TA6_Dateinummer"
            ]
          }
        ]
      },
      {
        "id": "Bundle.identifier.use",
        "path": "Bundle.identifier.use",
        "max": "0"
      },
      {
        "id": "Bundle.identifier.type",
        "path": "Bundle.identifier.type",
        "max": "0"
      },
      {
        "id": "Bundle.identifier.system",
        "path": "Bundle.identifier.system",
        "short": "Dateiname",
        "min": 1,
        "fixedUri": "https://fhir.gkvsv.de/NamingSystem/BIV_NS_Dateiname"
      },
      {
        "id": "Bundle.identifier.value",
        "path": "Bundle.identifier.value",
        "short": "Dateiname",
        "min": 1,
        "constraint": [
          {
            "key": "Dateiname",
            "severity": "error",
            "human": "Der Dateiname muss den Konventionen der TA6 entsprechen.",
            "expression": "toString().matches('^((ARZ|APO|KKR|KRZ|SON)(FHR|FK[1-9])(\\\\d{2})(\\\\d{3}|[A-Z]\\\\d{2}))|((B|C|D)([0-9]|[A-Z]){2}(FHR|FK[1-9])(\\\\d{2})([0-9]|[A-Z]){3})$') and toString().matches('^((ARZ|APO|KKR|KRZ|SON)(FHR|FK[1-9])(\\\\d{2})(000))|((B|C|D)(00)(FHR|FK[1-9])(\\\\d{2})(000))$').not()"
          }
        ]
      },
      {
        "id": "Bundle.identifier.period",
        "path": "Bundle.identifier.period",
        "max": "0"
      },
      {
        "id": "Bundle.identifier.assigner",
        "path": "Bundle.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Bundle.type",
        "path": "Bundle.type",
        "fixedCode": "document"
      },
      {
        "id": "Bundle.timestamp",
        "path": "Bundle.timestamp",
        "short": "Erstelldatum der Datei",
        "definition": "Erstelldatum/-uhrzeit der Datei.\r\nJJJJMMTT:HHMM (zusammengesetztes Datenelement aus Erstelldatum und Erstelluhrzeit der Datei)",
        "min": 1
      },
      {
        "id": "Bundle.total",
        "path": "Bundle.total",
        "max": "0"
      },
      {
        "id": "Bundle.link",
        "path": "Bundle.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry",
        "path": "Bundle.entry",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "resource.meta.profile"
            }
          ],
          "rules": "closed"
        },
        "short": "Composition, List und Rechnungen",
        "definition": "Die Liste der Rechnung_Bundles, die Composition und die darin referenzierten Rechnungen werden hier inhaltlich vollständig aufgeführt.",
        "min": 2
      },
      {
        "id": "Bundle.entry:Rechnung_Composition",
        "path": "Bundle.entry",
        "sliceName": "Rechnung_Composition",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.link",
        "path": "Bundle.entry.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "Resource",
            "profile": [
              "https://fhir.biv-ot.org/eVerordnungAbrechnungsdaten/BIV_PR_TA6_Rechnung_Composition|1.4"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.resource.extension",
        "path": "Bundle.entry.resource.extension",
        "max": "2"
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.resource.date.extension",
        "path": "Bundle.entry.resource.date.extension",
        "max": "1"
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Rechnung_Composition.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Rechnung_List",
        "path": "Bundle.entry",
        "sliceName": "Rechnung_List",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:Rechnung_List.link",
        "path": "Bundle.entry.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Rechnung_List.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1
      },
      {
        "id": "Bundle.entry:Rechnung_List.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "Resource",
            "profile": [
              "https://fhir.biv-ot.org/eVerordnungAbrechnungsdaten/BIV_PR_TA6_Rechnung_List|1.4"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:Rechnung_List.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Rechnung_List.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Rechnung_List.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.entry:VerordnungBundle",
        "path": "Bundle.entry",
        "sliceName": "VerordnungBundle",
        "min": 1
      },
      {
        "id": "Bundle.entry:VerordnungBundle.link",
        "path": "Bundle.entry.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry:VerordnungBundle.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1
      },
      {
        "id": "Bundle.entry:VerordnungBundle.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "Resource",
            "profile": [
              "https://fhir.biv-ot.org/eVerordnungAbrechnungsdaten/BIV_PR_TA6_VerordnungBundle"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:VerordnungBundle.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:VerordnungBundle.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry:VerordnungBundle.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.signature",
        "path": "Bundle.signature",
        "max": "0"
      }
    ]
  }
}