<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://medico-emr.net/medico/r4/sd/Encounter_Consultation_1" />
  <name value="Encounter_Consultation_1" />
  <status value="draft" />
  <description value="A resource of this profile represents a &quot;consultation care&quot; in medico&#xD;&#xA;A consulation in medico reprents each showup of a patient in an outpatient facility (=ambulance).&#xD;&#xA;A consultation is part of an administrative case, i.e. partof references a resource of the profile &quot;encounter_case&quot;.&#xD;&#xA;&#xD;&#xA;Database mapping &#xD;&#xA;- mapping to x1205awo ( where consil=1 )." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Encounter" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Encounter" />
  <derivation value="constraint" />
  <differential>
    <element id="Encounter.id">
      <path value="Encounter.id" />
      <definition value="Format: ConsultationEncounter-####&#xD;&#xA;A resource of this profile represents a &quot;consultation care&quot; in medico&#xD;&#xA;A consulation in medico reprents each showup of a patient in an outpatient facility (=ambulance).&#xD;&#xA;A consultation is part of an administrative case, i.e. .partof references a resource of the profile &quot;encounter_case&quot;." />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.meta">
      <path value="Encounter.meta" />
      <type>
        <code value="Meta" />
        <profile value="https://medico-emr.net/medico/r4/sd/Meta_ProfileOnly_1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.meta.lastUpdated">
      <path value="Encounter.meta.lastUpdated" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.meta.profile">
      <path value="Encounter.meta.profile" />
      <fixedCanonical value="https://medico-emr.net/medico/r4/sd/Encounter_Consultation_1" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.identifier">
      <path value="Encounter.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.identifier:medicoResourceId">
      <path value="Encounter.identifier" />
      <sliceName value="medicoResourceId" />
      <type>
        <code value="Identifier" />
        <profile value="https://medico-emr.net/medico/r4/sd/Identifier_medicoResourceId_1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.identifier:medicoResourceId.system">
      <path value="Encounter.identifier.system" />
      <definition value="The resulting value will be https://medico-emr.net/medico/%KUNDE%/sid1/*   &#xD;&#xA; - where * is the in code.code  - see below&#xD;&#xA; - and %KUNDE&amp; is a tenant specific 2-3 character id&#xD;&#xA;for automatic calculation the Code with the system &quot;https://medico-emr.net/medico/cs/customerdefinedsystem&quot; is used&#xD;&#xA;&#xD;&#xA;maps to https://medico-emr.net/medico/%KUNDE%/sid1/ConsultationEncounter" />
      <comment value="Dynamically resolved for validation&#xD;&#xA;--FixedValue=https://medico-emr.net/medico/%KUNDE%/sid1/ConsultationEncounter" />
    </element>
    <element id="Encounter.status">
      <path value="Encounter.status" />
      <definition value="medico available: planned  | in-progress | finished" />
    </element>
    <element id="Encounter.class">
      <path value="Encounter.class" />
      <definition value="medico - possible values:&#xD;&#xA;IMP-inpatient encounter types" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.class.system">
      <path value="Encounter.class.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v3-ActCode" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.class.code">
      <path value="Encounter.class.code" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.type">
      <path value="Encounter.type" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.type:Kontaktart">
      <path value="Encounter.type" />
      <sliceName value="Kontaktart" />
      <max value="1" />
      <patternCodeableConcept>
        <coding>
          <system value="http://fhir.de/CodeSystem/kontaktart-de" />
        </coding>
      </patternCodeableConcept>
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="http://fhir.de/ValueSet/kontaktart-de" />
      </binding>
    </element>
    <element id="Encounter.type:type">
      <path value="Encounter.type" />
      <sliceName value="type" />
      <max value="1" />
      <patternCodeableConcept>
        <coding>
          <system value="https://medico-emr.net/medico/cs/cs1" />
        </coding>
      </patternCodeableConcept>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.type:type.coding">
      <path value="Encounter.type.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.type:type.coding.system">
      <path value="Encounter.type.coding.system" />
      <min value="1" />
      <fixedUri value="https://medico-emr.net/medico/cs/cs1" />
    </element>
    <element id="Encounter.type:type.coding.code">
      <path value="Encounter.type.coding.code" />
      <definition value="medico - possible values:&#xD;&#xA;IMP   (=inpatient) - the default value for all medico consultations (consils only) &#xD;&#xA;EMER   (Emergency) - an ambulatory encounter/consultation especially marked" />
      <min value="1" />
    </element>
    <element id="Encounter.subject">
      <path value="Encounter.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <profile value="https://medico-emr.net/medico/r4/sd/Reference_SubjectPatient_1" />
        <targetProfile value="https://medico-emr.net/medico/r4/sd/Patient_Patient_1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.period">
      <path value="Encounter.period" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.period.start">
      <path value="Encounter.period.start" />
      <definition value="The start of the period. The boundary is inclusive.&#xD;&#xA;(x1205awo.datf)" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.period.end">
      <path value="Encounter.period.end" />
      <definition value="The end of the period. If the end of the period is missing, it means no end was known or planned at the time the instance was created. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time.&#xD;&#xA;&#xD;&#xA;(x1205awo.datt)" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.account">
      <path value="Encounter.account" />
      <type>
        <code value="Reference" />
        <profile value="https://medico-emr.net/medico/r4/sd/Reference_Base_1" />
        <targetProfile value="https://medico-emr.net/medico/r4/sd/Account_CaseAccount_1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location">
      <path value="Encounter.location" />
      <definition value="the ward the consultation took place (x1205awo.wds)" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.location">
      <path value="Encounter.location.location" />
      <type>
        <code value="Reference" />
        <profile value="https://medico-emr.net/medico/r4/sd/Reference_LocationUnit_1" />
        <targetProfile value="https://medico-emr.net/medico/r4/sd/Location_Unit_1" />
      </type>
    </element>
    <element id="Encounter.location.status">
      <path value="Encounter.location.status" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.physicalType">
      <path value="Encounter.location.physicalType" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.physicalType.coding">
      <path value="Encounter.location.physicalType.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.physicalType.coding.system">
      <path value="Encounter.location.physicalType.coding.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/location-physical-type" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.physicalType.coding.code">
      <path value="Encounter.location.physicalType.coding.code" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.period">
      <path value="Encounter.location.period" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.period.start">
      <path value="Encounter.location.period.start" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.period.end">
      <path value="Encounter.location.period.end" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.serviceProvider">
      <path value="Encounter.serviceProvider" />
      <definition value="the department the consultation took place (x1205awo.dep)" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://medico-emr.net/medico/r4/sd/Organization_Department_1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.serviceProvider.reference">
      <path value="Encounter.serviceProvider.reference" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.serviceProvider.type">
      <path value="Encounter.serviceProvider.type" />
      <fixedUri value="Organization" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.serviceProvider.identifier">
      <path value="Encounter.serviceProvider.identifier" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.serviceProvider.identifier.system">
      <path value="Encounter.serviceProvider.identifier.system" />
      <comment value="The fixed value is inserted at runtime&#xD;&#xA;FixedValue=https://medico-emr.net/medico/%KUNDE%/sid1/Department" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.serviceProvider.identifier.value">
      <path value="Encounter.serviceProvider.identifier.value" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.partOf">
      <path value="Encounter.partOf" />
      <type>
        <code value="Reference" />
        <profile value="https://medico-emr.net/medico/r4/sd/Reference_ContextEncounter_1" />
        <targetProfile value="https://medico-emr.net/medico/r4/sd/Encounter_Case_1" />
      </type>
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>