<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="Mxx-HealthHub-Condition" />
  <url value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_Condition" />
  <version value="1.5.0" />
  <name value="Mxx_HealthHub_Condition" />
  <status value="active" />
  <publisher value="medatixx GmbH &amp; Co. KG" />
  <description value="Diagnosis data from the patient's problem list as recorded in the PVS. Uses ICD-10-GM coding with German-specific extensions for diagnostic certainty (Diagnosesicherheit) and laterality (Seitenlokalisation). Supports both permanent diagnoses (Dauerdiagnosen) and case-level diagnoses (Falldiagnosen). Also used as the write payload for Condition/$propose; the optional Ausnahmetatbestand and correction (entered-in-error) extensions are set on write and reflected on read." />
  <copyright value="medatixx GmbH &amp; Co. KG" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Condition" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Condition" />
  <derivation value="constraint" />
  <differential>
    <element id="Condition">
      <path value="Condition" />
      <short value="Patient diagnosis data" />
      <definition value="Represents diagnoses (Diagnosen) from the patient's problem list as recorded in the practice management system. Includes ICD-10-GM coding with German-specific modifiers for diagnostic certainty and laterality." />
    </element>
    <element id="Condition.extension:isPermanentDiagnosis">
      <path value="Condition.extension" />
      <sliceName value="isPermanentDiagnosis" />
      <definition value="Indicates whether this is a permanent diagnosis (Dauerdiagnose) that persists across encounters, as opposed to a case-level diagnosis (Falldiagnose)." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_IsPermanentDiagnosis" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Condition.extension:ausnahmetatbestand">
      <path value="Condition.extension" />
      <sliceName value="ausnahmetatbestand" />
      <short value="Ausnahmetatbestand" />
      <definition value="Ausnahmetatbestand zur Diagnose (z.B. Heilmittel-/Wirtschaftlichkeitskontext). Beim Schreiben ueber Condition/$propose gesetzt und beim Lesen zurueckgespiegelt. Optional." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_Ausnahmetatbestand" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Condition.modifierExtension:diagnosisEnteredInError">
      <path value="Condition.modifierExtension" />
      <sliceName value="diagnosisEnteredInError" />
      <short value="Fehlerkorrektur-Kennzeichen" />
      <definition value="Fehlerkorrektur-Kennzeichen (entered-in-error): markiert die Diagnose als Fehleingabe. Eigener Kanal, unabhaengig von der aus der Diagnosesicherheit abgeleiteten verificationStatus. Beim Aktualisieren ueber Condition/$propose gesetzt und beim Lesen zurueckgespiegelt. Als Modifier-Extension gefuehrt, da eine zurueckgezogene Diagnose nicht ignoriert werden darf. Optional." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_DiagnosisEnteredInError" />
      </type>
      <isModifier value="true" />
      <isModifierReason value="Marks the diagnosis as a retracted mis-entry; a consumer that ignores it would render a retracted diagnosis as valid." />
    </element>
    <element id="Condition.identifier">
      <path value="Condition.identifier" />
      <max value="0" />
    </element>
    <element id="Condition.clinicalStatus">
      <path value="Condition.clinicalStatus" />
      <short value="active | inactive | resolved" />
      <definition value="The clinical status of the condition." />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.medatixx.de/HealthHub/ValueSet/Mxx_HealthHub_VS_ConditionClinicalStatus" />
      </binding>
    </element>
    <element id="Condition.verificationStatus">
      <path value="Condition.verificationStatus" />
      <short value="confirmed | provisional | refuted" />
      <definition value="The verification status of the condition. Finer-grained diagnostic certainty (including Zustand nach / status post) is carried on the icd-10-gm-diagnosesicherheit extension on Condition.code.coding." />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.medatixx.de/HealthHub/ValueSet/Mxx_HealthHub_VS_ConditionVerificationStatus" />
      </binding>
    </element>
    <element id="Condition.category">
      <path value="Condition.category" />
      <max value="0" />
    </element>
    <element id="Condition.severity">
      <path value="Condition.severity" />
      <max value="0" />
    </element>
    <element id="Condition.code">
      <path value="Condition.code" />
      <short value="ICD-10-GM diagnosis code" />
      <definition value="The diagnosis coded as ICD-10-GM (German Modification). The coding element contains the ICD-10-GM code with version. Extensions for Diagnosesicherheit and Seitenlokalisation are placed on the coding element as per Deutsche Basisprofile convention." />
      <min value="1" />
    </element>
    <element id="Condition.code.coding">
      <path value="Condition.code.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Condition.code.coding.extension:diagnosesicherheit">
      <path value="Condition.code.coding.extension" />
      <sliceName value="diagnosesicherheit" />
      <short value="Diagnostic certainty (G/V/Z/A)" />
      <definition value="German diagnostic certainty modifier: G (Gesichert/confirmed), V (Verdacht/suspected), Z (Zustand nach/status post), A (Ausschluss/excluded). Required for German billing." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://fhir.de/StructureDefinition/icd-10-gm-diagnosesicherheit" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Condition.code.coding.extension:seitenlokalisation">
      <path value="Condition.code.coding.extension" />
      <sliceName value="seitenlokalisation" />
      <short value="Laterality (L/R/B)" />
      <definition value="Body side for lateralized diagnoses: L (Links/left), R (Rechts/right), B (Beidseitig/bilateral)." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://fhir.de/StructureDefinition/seitenlokalisation" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Condition.code.coding.system">
      <path value="Condition.code.coding.system" />
      <min value="1" />
      <fixedUri value="http://fhir.de/CodeSystem/bfarm/icd-10-gm" />
    </element>
    <element id="Condition.code.coding.version">
      <path value="Condition.code.coding.version" />
      <short value="ICD-10-GM year version (e.g., '2026')" />
      <definition value="The annual version of the ICD-10-GM catalog. May not be available from all PVS systems (notably x.isynet does not track ICD version)." />
    </element>
    <element id="Condition.code.coding.code">
      <path value="Condition.code.coding.code" />
      <min value="1" />
    </element>
    <element id="Condition.code.coding.display">
      <path value="Condition.code.coding.display" />
      <short value="ICD-10-GM catalog display text" />
      <definition value="Canonical ICD-10-GM catalog text, fixed to the code and not updatable. Max 512 characters." />
      <maxLength value="512" />
    </element>
    <element id="Condition.code.text">
      <path value="Condition.code.text" />
      <short value="Free-text diagnosis description" />
      <definition value="Human-readable diagnosis text as recorded in the PVS. May be the ICD display name or a free-text entry by the physician. Max 255 characters." />
      <maxLength value="255" />
    </element>
    <element id="Condition.bodySite">
      <path value="Condition.bodySite" />
      <max value="0" />
    </element>
    <element id="Condition.subject">
      <path value="Condition.subject" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_Patient" />
      </type>
    </element>
    <element id="Condition.encounter">
      <path value="Condition.encounter" />
      <max value="0" />
    </element>
    <element id="Condition.onset[x]">
      <path value="Condition.onset[x]" />
      <short value="When the condition was first established" />
      <definition value="When the condition was first diagnosed. May not be available from all PVS systems." />
      <type>
        <code value="dateTime" />
      </type>
    </element>
    <element id="Condition.abatement[x]">
      <path value="Condition.abatement[x]" />
      <max value="0" />
    </element>
    <element id="Condition.recordedDate">
      <path value="Condition.recordedDate" />
      <short value="When the diagnosis was recorded in the PVS" />
    </element>
    <element id="Condition.recorder">
      <path value="Condition.recorder" />
      <max value="0" />
    </element>
    <element id="Condition.asserter">
      <path value="Condition.asserter" />
      <max value="0" />
    </element>
    <element id="Condition.stage">
      <path value="Condition.stage" />
      <max value="0" />
    </element>
    <element id="Condition.evidence">
      <path value="Condition.evidence" />
      <max value="0" />
    </element>
    <element id="Condition.note">
      <path value="Condition.note" />
      <short value="Diagnoseerlaeuterung" />
      <definition value="Supplementary explanatory text for the diagnosis (Diagnoseerlaeuterung), distinct from the physician free text on Condition.code.text. Carried on the diagnosis itself and persisted; readable again via SearchConditions (round-trip). Written via Condition/$propose. Max 255 characters." />
      <max value="1" />
    </element>
    <element id="Condition.note.author[x]">
      <path value="Condition.note.author[x]" />
      <max value="0" />
    </element>
    <element id="Condition.note.time">
      <path value="Condition.note.time" />
      <max value="0" />
    </element>
    <element id="Condition.note.text">
      <path value="Condition.note.text" />
      <short value="Diagnoseerlaeuterung text" />
      <maxLength value="255" />
    </element>
  </differential>
</StructureDefinition>