<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://example.org/fhir/StructureDefinition/MyPatient" />
  <version value="0.1" />
  <name value="HearingPatient" />
  <status value="draft" />
  <experimental value="true" />
  <description value="Patient used in the context of hearing tests." />
  <fhirVersion value="4.0.1" />
  <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>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <mapping>
    <identity value="loinc" />
    <uri value="http://loinc.org" />
    <name value="LOINC code for the element" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Patient" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient" />
  <derivation value="constraint" />
  <differential>
    <element id="Patient.extension">
      <path value="Patient.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Patient.extension:birthPlace">
      <path value="Patient.extension" />
      <sliceName value="birthPlace" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/patient-birthPlace" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Patient.extension:occupation">
      <path value="Patient.extension" />
      <sliceName value="occupation" />
      <type>
        <code value="Extension" />
        <profile value="https://example.org/fhir/StructureDefinition/Occupation" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier">
      <path value="Patient.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier.use">
      <path value="Patient.identifier.use" />
      <definition value="The official identifier." />
    </element>
    <element id="Patient.identifier:official">
      <path value="Patient.identifier" />
      <sliceName value="official" />
      <min value="1" />
      <max value="1" />
      <fixedIdentifier>
        <use value="official" />
      </fixedIdentifier>
    </element>
    <element id="Patient.identifier:official.use">
      <path value="Patient.identifier.use" />
      <min value="1" />
      <fixedCode value="official" />
    </element>
    <element id="Patient.identifier:official.system">
      <path value="Patient.identifier.system" />
      <short value="The national identifier" />
      <definition value="The national unique identifier of the patient" />
      <min value="1" />
      <fixedUri value="http://national.registry.org/ids" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:official.value">
      <path value="Patient.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:hospital">
      <path value="Patient.identifier" />
      <sliceName value="hospital" />
      <max value="1" />
      <fixedIdentifier>
        <use value="secondary" />
      </fixedIdentifier>
    </element>
    <element id="Patient.identifier:hospital.use">
      <path value="Patient.identifier.use" />
      <fixedCode value="secondary" />
    </element>
    <element id="Patient.identifier:hospital.system">
      <path value="Patient.identifier.system" />
      <short value="The hospital identifier" />
      <definition value="The unique identifier of the patient within the hospital" />
      <min value="1" />
      <fixedUri value="http://myhospital.de/ids" />
    </element>
    <element id="Patient.identifier:hospital.value">
      <path value="Patient.identifier.value" />
      <min value="1" />
    </element>
    <element id="Patient.name">
      <path value="Patient.name" />
      <min value="1" />
      <type>
        <code value="HumanName" />
        <profile value="https://example.org/fhir/StructureDefinition/MyHumanName" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Patient.gender">
      <path value="Patient.gender" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.birthDate">
      <path value="Patient.birthDate" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.birthDate.extension">
      <path value="Patient.birthDate.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Patient.birthDate.extension:birthTime">
      <path value="Patient.birthDate.extension" />
      <sliceName value="birthTime" />
      <definition value="The time of day that the Patient was born. This includes the date to ensure that the timezone information can be communicated effectively" />
      <min value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/patient-birthTime" />
      </type>
    </element>
    <element id="Patient.address">
      <path value="Patient.address" />
      <constraint>
        <key value="TemporaryAddressHasPeriod" />
        <severity value="error" />
        <human value="If the address is temporary it has to have a period" />
        <expression value="(use = 'temp') implies period.exists" />
      </constraint>
    </element>
    <element id="Patient.address.use">
      <path value="Patient.address.use" />
      <condition value="TemporaryAddressHasPeriod" />
    </element>
    <element id="Patient.address.period">
      <path value="Patient.address.period" />
      <condition value="TemporaryAddressHasPeriod" />
    </element>
  </differential>
</StructureDefinition>