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