<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="Mxx-HealthHub-ProposeMedicationBundle" />
  <url value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_ProposeMedicationBundle" />
  <version value="1.5.0" />
  <name value="Mxx_HealthHub_ProposeMedicationBundle" />
  <title value="Mxx_HealthHub_ProposeMedicationBundle" />
  <status value="active" />
  <publisher value="medatixx GmbH &amp; Co. KG" />
  <description value="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." />
  <copyright value="medatixx GmbH &amp; Co. KG" />
  <fhirVersion value="4.0.1" />
  <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="bundle-same-subject-requester" />
        <severity value="error" />
        <human value="Alle MedicationRequest-Einträge eines Batches müssen denselben subject (Patient) und denselben requester (Partnersystem) haben." />
        <expression value="entry.resource.ofType(MedicationRequest).subject.reference.distinct().count() &lt;= 1 and entry.resource.ofType(MedicationRequest).subject.identifier.value.distinct().count() &lt;= 1 and entry.resource.ofType(MedicationRequest).requester.reference.distinct().count() &lt;= 1" />
      </constraint>
    </element>
    <element id="Bundle.identifier">
      <path value="Bundle.identifier" />
      <short value="Übertragungs-/Batch-Identifikator" />
      <definition value="Identifiziert diese eine Übermittlung/den Batch als Ganzes. Empfohlen wird eine UUID (urn:uuid:...); das Format wird serverseitig nicht erzwungen." />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Bundle.identifier.value">
      <path value="Bundle.identifier.value" />
      <min value="1" />
    </element>
    <element id="Bundle.type">
      <path value="Bundle.type" />
      <short value="Typ des Bundles" />
      <definition value="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 value="collection" />
    </element>
    <element id="Bundle.entry">
      <path value="Bundle.entry" />
      <short value="Medikationsvorschläge (1-20)" />
      <definition value="Liste der einzelnen Medikationsvorschläge. Jeder Eintrag muss konform zum Profil Mxx_HealthHub_MedicationRequest sein." />
      <min value="1" />
      <max value="20" />
    </element>
    <element id="Bundle.entry.resource">
      <path value="Bundle.entry.resource" />
      <short value="Einzelner Medikationsvorschlag" />
      <definition value="Ein MedicationRequest-Vorschlag, konform zum Profil Mxx_HealthHub_MedicationRequest." />
      <min value="1" />
      <type>
        <code value="Resource" />
        <profile value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_MedicationRequest" />
      </type>
    </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>
  </differential>
</StructureDefinition>