<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ERPBundleHiMi" />
  <url value="http://fhir.odilab.de/StructureDefinition/ERPBundleHiMi" />
  <name value="ERP_Bundle_HiMi" />
  <title value="Hilfsmittelverordnung" />
  <status value="draft" />
  <description value="Dieses Bundle vereint die Elemente des strukturierten Dokuments Hilfsmittelverordnung Muster 8 und 15" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="cda" />
    <uri value="http://hl7.org/v3/cda" />
    <name value="CDA (R2)" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Bundle" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Bundle" />
  <derivation value="constraint" />
  <differential>
    <element id="Bundle">
      <path value="Bundle" />
      <constraint>
        <key value="Composition-pflicht" />
        <severity value="error" />
        <human value="Die Ressource vom Typ Composition muss genau einmal vorhanden sein" />
        <expression value="entry.where(resource is Composition).count()=1" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="typComposition" />
        <severity value="error" />
        <human value="Die Instanz der Composition muss vom Profil 'CompositionHiMi' sein" />
        <expression value="entry.where(resource is Composition).resource.meta.profile = 'http://fhir.odilab.de/StructureDefinition/CompositionHiMi'" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="angabePruefnummer" />
        <severity value="error" />
        <human value="Prüfnummer nicht vorhanden, aber Pflicht bei den Kostenträger der Typen &quot;GKV&quot;, &quot;BG&quot;, &quot;SKT&quot; oder &quot;UK&quot;" />
        <expression value="(entry.where(resource is Coverage).exists() and (entry.where(resource is Coverage).resource.type.coding.code='GKV' or entry.where(resource is Coverage).resource.type.coding.code='BG' or entry.where(resource is Coverage).resource.type.coding.code='SKT' or entry.where(resource is Coverage).resource.type.coding.code='UK')) implies entry.where(resource is Composition).resource.author.identifier.where(system='https://fhir.kbv.de/NamingSystem/KBV_NS_FOR_Pruefnummer').exists()" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="angabePLZ" />
        <severity value="error" />
        <human value="Postleitzahl nicht vorhanden, aber Pflicht bei den Kostentraegern der Typen &quot;GKV&quot;, &quot;BG&quot;, &quot;SKT&quot; oder &quot;UK&quot;" />
        <expression value="(entry.where(resource is Coverage).exists() and (entry.where(resource is Coverage).resource.type.coding.code='GKV' or entry.where(resource is Coverage).resource.type.coding.code='BG' or entry.where(resource is Coverage).resource.type.coding.code='SKT' or entry.where(resource is Coverage).resource.type.coding.code='UK')) implies entry.where(resource is Patient).resource.address.postalCode.exists()" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="angabeNrAusstellendePerson" />
        <severity value="error" />
        <human value="Nummer der ausstellenden Person nicht vorhanden, aber Pflicht, wenn es sich um einen Arzt oder Zahnarzt handelt" />
        <expression value="(entry.where(resource is Coverage).exists() and (entry.where(resource is Coverage).resource.type.coding.code='GKV' or entry.where(resource is Coverage).resource.type.coding.code='BG' or entry.where(resource is Coverage).resource.type.coding.code='SKT' or entry.where(resource is Coverage).resource.type.coding.code='UK') and (entry.where(resource is Practitioner).resource.qualification.coding.code='00' or entry.where(resource is Practitioner).resource.qualification.coding.code='01')) implies entry.where(resource is Practitioner).resource.identifier.exists()" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="angabeBetriebsstaettennr" />
        <severity value="error" />
        <human value="Betriebsstaettennummer nicht vorhanden, aber Pflicht, wenn es sich um einen Arzt, Zahnarzt oder Arzt in Weiterbildung handelt" />
        <expression value="(entry.where(resource is Coverage).exists() and (entry.where(resource is Coverage).resource.type.coding.code='GKV' or entry.where(resource is Coverage).resource.type.coding.code='BG' or entry.where(resource is Coverage).resource.type.coding.code='SKT' or entry.where(resource is Coverage).resource.type.coding.code='UK') and (entry.where(resource is Practitioner).resource.qualification.coding.code='00' or entry.where(resource is Practitioner).resource.qualification.coding.code='01' or entry.where(resource is Practitioner).resource.qualification.coding.code='03')) implies entry.where(resource is Organization).resource.identifier.exists()" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="angabeRechtsgrundlage" />
        <severity value="error" />
        <human value="Rechtsgrundlage nicht vorhanden, aber Pflicht bei den Kostentraegern der Typen &quot;GKV&quot;, &quot;BG&quot;, &quot;SKT&quot; oder &quot;UK&quot;" />
        <expression value="(entry.where(resource is Coverage).exists() and (entry.where(resource is Coverage).resource.type.coding.code='GKV' or entry.where(resource is Coverage).resource.type.coding.code='BG' or entry.where(resource is Coverage).resource.type.coding.code='SKT' or entry.where(resource is Coverage).resource.type.coding.code='UK')) implies entry.where(resource is Composition).resource.extension('https://fhir.kbv.de/StructureDefinition/KBV_EX_FOR_Legal_basis').exists()" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="Arztpraxis-1" />
        <severity value="error" />
        <human value="Für eine Arztpraxis muss eine BSNR angegeben werden." />
        <expression value="entry.where(resource is Organization).exists() implies entry.where(resource is Organization).resource.identifier.system = 'https://fhir.kbv.de/NamingSystem/KBV_NS_Base_BSNR'" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="Arztpraxis-2" />
        <severity value="error" />
        <human value="Bei einer Arztpraxis darf kein Institutionskennzeichen angegeben werden." />
        <expression value="entry.where(resource is Organization).exists() implies entry.where(resource is Organization).resource.identifier.system != 'http://fhir.de/NamingSystem/arge-ik/iknr'" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="Patient-1" />
        <severity value="error" />
        <human value="Bei einem Patienten mit gesetzlicher Krankenversicherung muss die gesetzliche Krankenversicherungsnummer angegeben werden." />
        <expression value="entry.where(resource is Coverage).resource.type.coding.code = 'GKV' implies entry.where(resource is Patient).resource.identifier.type.coding.code = 'GKV'" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="Patient-2" />
        <severity value="error" />
        <human value="Bei einem Patienten mit privater Krankenversicherung muss die private Krankenversicherungsnummer angegeben werden." />
        <expression value="entry.where(resource is Coverage).resource.type.coding.code = 'PKV' implies entry.where(resource is Patient).resource.identifier.type.coding.code = 'PKV'" />
        <source value="Bundle" />
      </constraint>
      <constraint>
        <key value="unique-DeviceRequest" />
        <severity value="error" />
        <human value="Die Einträge für die Instanz DeviceRequest müssen im Dokument eindeutig sein." />
        <expression value="entry.select(resource as DeviceRequest).resource.code.coding.code.isDistinct()" />
        <source value="Bundle" />
      </constraint>
    </element>
    <element id="Bundle.id">
      <path value="Bundle.id" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.meta">
      <path value="Bundle.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.meta.id">
      <path value="Bundle.meta.id" />
      <max value="0" />
    </element>
    <element id="Bundle.meta.versionId">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.meta.versionId" />
      <max value="0" />
    </element>
    <element id="Bundle.meta.lastUpdated">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.meta.lastUpdated" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.meta.source">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.meta.source" />
      <max value="0" />
    </element>
    <element id="Bundle.meta.profile">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.meta.profile" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.meta.security">
      <path value="Bundle.meta.security" />
      <max value="0" />
    </element>
    <element id="Bundle.meta.tag">
      <path value="Bundle.meta.tag" />
      <max value="0" />
    </element>
    <element id="Bundle.implicitRules">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.implicitRules" />
      <max value="0" />
    </element>
    <element id="Bundle.language">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.language" />
      <max value="0" />
    </element>
    <element id="Bundle.identifier">
      <path value="Bundle.identifier" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.identifier.use">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.identifier.use" />
      <max value="0" />
    </element>
    <element id="Bundle.identifier.type">
      <path value="Bundle.identifier.type" />
      <max value="0" />
    </element>
    <element id="Bundle.identifier.system">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.identifier.system" />
      <definition value="Für den digitalen Vordruck &quot;Elektronische Verordnung einer Krankenbeförderung (Muster 4)&quot; wird die Dokumenten-ID gemäß den Vorgaben der gematik gesetzt." />
      <min value="1" />
      <fixedUri value="https://gematik.de/fhir/NamingSystem/PrescriptionID" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.identifier.value">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.identifier.value" />
      <short value="Dokumenten-ID" />
      <definition value="Eindeutige Identifikation des Dokuments, bzw. der Verordnung. Diese ID wird mit signiert und sichert damit die Verordnung vor Fälschungen.&#xA;&#xA;Für den digitalen Vordruck &quot;Elektronische Verordnung einer Krankenbeförderung (Muster 4)&quot; wird die Dokumenten-ID gemäß den Vorgaben der gematik gesetzt." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.identifier.period">
      <path value="Bundle.identifier.period" />
      <max value="0" />
    </element>
    <element id="Bundle.identifier.assigner">
      <path value="Bundle.identifier.assigner" />
      <max value="0" />
    </element>
    <element id="Bundle.type">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.type" />
      <fixedCode value="document" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.timestamp">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.timestamp" />
      <definition value="DateTime wann das Dokument technisch erstellt wurde. &#xA;Fachlich bildet das Ausstellungsdatum das entscheidende Datum ab" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.total">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <path value="Bundle.total" />
      <max value="0" />
    </element>
    <element id="Bundle.link">
      <path value="Bundle.link" />
      <max value="0" />
    </element>
    <element id="Bundle.entry">
      <path value="Bundle.entry" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="resource.meta.profile" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <min value="3" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry.link">
      <path value="Bundle.entry.link" />
      <max value="0" />
    </element>
    <element id="Bundle.entry.fullUrl">
      <path value="Bundle.entry.fullUrl" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry.resource">
      <path value="Bundle.entry.resource" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry.search">
      <path value="Bundle.entry.search" />
      <max value="0" />
    </element>
    <element id="Bundle.entry.request">
      <path value="Bundle.entry.request" />
      <max value="0" />
    </element>
    <element id="Bundle.entry.response">
      <path value="Bundle.entry.response" />
      <max value="0" />
    </element>
    <element id="Bundle.entry:Dokumenteninformation">
      <path value="Bundle.entry" />
      <sliceName value="Dokumenteninformation" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry:Dokumenteninformation.resource">
      <path value="Bundle.entry.resource" />
      <type>
        <code value="Composition" />
        <profile value="http://fhir.odilab.de/StructureDefinition/CompositionHiMi" />
      </type>
    </element>
    <element id="Bundle.entry:Krankenversicherungsverhaeltnis">
      <path value="Bundle.entry" />
      <sliceName value="Krankenversicherungsverhaeltnis" />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry:Krankenversicherungsverhaeltnis.resource">
      <path value="Bundle.entry.resource" />
      <type>
        <code value="Coverage" />
        <profile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_FOR_Coverage" />
      </type>
    </element>
    <element id="Bundle.entry:Patient">
      <path value="Bundle.entry" />
      <sliceName value="Patient" />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry:Patient.resource">
      <path value="Bundle.entry.resource" />
      <type>
        <code value="Patient" />
        <profile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_FOR_Patient" />
      </type>
    </element>
    <element id="Bundle.entry:Einrichtung">
      <path value="Bundle.entry" />
      <sliceName value="Einrichtung" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry:Einrichtung.resource">
      <path value="Bundle.entry.resource" />
      <type>
        <code value="Organization" />
        <profile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_FOR_Organization" />
      </type>
    </element>
    <element id="Bundle.entry:AusstellendeVerschreibendeVerantwortlichePerson">
      <path value="Bundle.entry" />
      <sliceName value="AusstellendeVerschreibendeVerantwortlichePerson" />
      <min value="1" />
      <max value="2" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry:AusstellendeVerschreibendeVerantwortlichePerson.resource">
      <path value="Bundle.entry.resource" />
      <type>
        <code value="Practitioner" />
        <profile value="https://fhir.kbv.de/StructureDefinition/KBV_PR_FOR_Practitioner" />
      </type>
    </element>
    <element id="Bundle.entry:VerordnungHilfsmittel">
      <path value="Bundle.entry" />
      <sliceName value="VerordnungHilfsmittel" />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Bundle.entry:VerordnungHilfsmittel.resource">
      <path value="Bundle.entry.resource" />
      <type>
        <code value="DeviceRequest" />
        <profile value="http://fhir.odilab.de/StructureDefinition/PrescriptionDevice" />
      </type>
    </element>
  </differential>
</StructureDefinition>