{
  "resourceType": "StructureDefinition",
  "url": "https://tehik.ee/fhir/StructureDefinition/ExercisePatient",
  "name": "ExercisePatient",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "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"
        },
        "min": 0
      },
      {
        "id": "Patient.extension:birthPlace",
        "path": "Patient.extension",
        "sliceName": "birthPlace",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/patient-birthPlace"
            ]
          }
        ]
      },
      {
        "id": "Patient.extension:occupation",
        "path": "Patient.extension",
        "sliceName": "occupation",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://tehik.ee/fhir/StructureDefinition/ExerciseOccupation"
            ]
          }
        ]
      },
      {
        "id": "Patient.extension:occupation.value[x]",
        "path": "Patient.extension.value[x]",
        "short": "Occupations",
        "binding": {
          "strength": "extensible",
          "description": "Occupations",
          "valueSet": "http://www.alpha-hospital.alp/occupations"
        }
      },
      {
        "id": "Patient.identifier",
        "path": "Patient.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.identifier:officialIdentifier",
        "path": "Patient.identifier",
        "sliceName": "officialIdentifier",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Patient.identifier:officialIdentifier.use",
        "path": "Patient.identifier.use",
        "min": 1,
        "fixedCode": "official"
      },
      {
        "id": "Patient.identifier:officialIdentifier.system",
        "path": "Patient.identifier.system",
        "min": 1,
        "fixedUri": "https://politsei.ee/id"
      },
      {
        "id": "Patient.identifier:officialIdentifier.value",
        "path": "Patient.identifier.value",
        "min": 1
      },
      {
        "id": "Patient.identifier:hospitalIdentifier",
        "path": "Patient.identifier",
        "sliceName": "hospitalIdentifier",
        "max": "1"
      },
      {
        "id": "Patient.identifier:hospitalIdentifier.use",
        "path": "Patient.identifier.use",
        "min": 1,
        "fixedCode": "hospital"
      },
      {
        "id": "Patient.identifier:hospitalIdentifier.system",
        "path": "Patient.identifier.system",
        "min": 1,
        "fixedUri": "https://tehik.ee/patient/hospital/id"
      },
      {
        "id": "Patient.identifier:hospitalIdentifier.value",
        "path": "Patient.identifier.value",
        "min": 1
      },
      {
        "id": "Patient.name",
        "path": "Patient.name",
        "min": 1,
        "type": [
          {
            "code": "HumanName",
            "profile": [
              "https://tehik.ee/fhir/StructureDefinition/ExerciseHumanName"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Patient.birthDate",
        "path": "Patient.birthDate",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.address.use",
        "path": "Patient.address.use",
        "condition": [
          "temp-addr-period-missing"
        ],
        "constraint": [
          {
            "key": "temp-addr-period-missing",
            "severity": "error",
            "human": "Temporary address period is missing!",
            "expression": "(use = 'temp') implies period.exists()"
          }
        ]
      },
      {
        "id": "Patient.address.period",
        "path": "Patient.address.period",
        "condition": [
          "temp-addr-period-missing"
        ],
        "constraint": [
          {
            "key": "temp-addr-period-missing",
            "severity": "error",
            "human": "Temporary address period is missing!",
            "expression": "(use = 'temp') implies period.exists()"
          }
        ]
      }
    ]
  }
}