{
  "resourceType": "StructureDefinition",
  "url": "https://cgm.com/fhir/his/medico/r4/sd/pip/Patient_PiPPatient_1",
  "name": "Patient_PiPPatient_1",
  "status": "active",
  "description": "This profile describes the patient related data to be exchanged with Patient Portal",
  "fhirVersion": "4.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "Patient",
  "baseDefinition": "https://gematik.de/fhir/isik/v2/Basismodul/StructureDefinition/ISiKPatient",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Patient.id",
        "path": "Patient.id",
        "definition": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.\r\nif the patient is already registered within medico -\r\nthe format will be Patient-#####\r\nwhere #### is the patient id (medico x1000per.per)\r\notherwise if the patient was sent by patientportal in order to book an appointment\r\nthe format will be Patient.PIP-######\r\nwhere ##### is the temporary patient id (medico x1016pes.pes)\r\n\r\nin case this resource is sent for creating a patient resource in medico - the sent value will be ignored and is replaced by an id generated by medico"
      },
      {
        "id": "Patient.meta",
        "path": "Patient.meta",
        "min": 1
      },
      {
        "id": "Patient.meta.lastUpdated",
        "path": "Patient.meta.lastUpdated",
        "mustSupport": true
      },
      {
        "id": "Patient.meta.profile",
        "path": "Patient.meta.profile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://cgm.com/fhir/his/medico/r4/sd/pip/Patient_PiPPatient_1"
      },
      {
        "id": "Patient.meta.tag",
        "path": "Patient.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Patient.meta.tag:commonMetaTagDe",
        "path": "Patient.meta.tag",
        "sliceName": "commonMetaTagDe",
        "definition": "If this tag is present - this patient resource was created by an external system.",
        "mustSupport": true
      },
      {
        "id": "Patient.meta.tag:commonMetaTagDe.system",
        "path": "Patient.meta.tag.system",
        "min": 1,
        "fixedUri": "http://fhir.de/CodeSystem/common-meta-tag-de"
      },
      {
        "id": "Patient.meta.tag:commonMetaTagDe.code",
        "path": "Patient.meta.tag.code",
        "min": 1,
        "fixedCode": "external"
      },
      {
        "id": "Patient.meta.tag:externalSource",
        "path": "Patient.meta.tag",
        "sliceName": "externalSource",
        "definition": "in case the Patient resource was created by an external System - this tag will be present and contain a code to specify which external system created this resource.",
        "meaningWhenMissing": "If this tag is missing - the patient resource was created within CGM MEDICO",
        "mustSupport": true
      },
      {
        "id": "Patient.meta.tag:externalSource.system",
        "path": "Patient.meta.tag.system",
        "min": 1,
        "fixedUri": "https://cgm.com/fhir/his/medico/cs/ExternalSource"
      },
      {
        "id": "Patient.meta.tag:externalSource.code",
        "path": "Patient.meta.tag.code",
        "min": 1,
        "fixedCode": "PIP"
      },
      {
        "id": "Patient.identifier",
        "path": "Patient.identifier",
        "definition": "An identifier for this patient.\r\nslice Patientennummer is mandatory due to ISiK profile - please refer to the slice for more information."
      },
      {
        "id": "Patient.identifier:Patientennummer",
        "path": "Patient.identifier",
        "sliceName": "Patientennummer",
        "definition": "An identifier for this patient.\r\nin case this resource is sent for creating a patient resource in medico a temporary identifier has to be sent to be compliant to the ISiK Profile - the sent value will be ignored and is replaced by an identifier generated by medico. to be compliant to the ISiK profile identifier.type.coding.system MUST equal http://terminology.hl7.org/CodeSystem/v2-0203 and identifier.type.coding.code must equal MR"
      },
      {
        "id": "Patient.identifier:LifeId-external",
        "path": "Patient.identifier",
        "sliceName": "LifeId-external",
        "definition": "An identifier for this patient.\r\nThis identifier represents the LifeId known to the patient. There could be two identifiers due to it is possible to register using an email, a phone number or both. Will be used on printouts within CGM MEDICO",
        "max": "2",
        "patternIdentifier": {
          "type": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/ValueSet/contact-point-system"
              }
            ]
          }
        }
      },
      {
        "id": "Patient.identifier:LifeId-external.type",
        "path": "Patient.identifier.type",
        "min": 1
      },
      {
        "id": "Patient.identifier:LifeId-external.type.coding",
        "path": "Patient.identifier.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Patient.identifier:LifeId-external.type.coding.system",
        "path": "Patient.identifier.type.coding.system",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "http://hl7.org/fhir/ValueSet/contact-point-system|4.0.0"
        }
      },
      {
        "id": "Patient.identifier:LifeId-external.type.coding.code",
        "path": "Patient.identifier.type.coding.code",
        "min": 1
      },
      {
        "id": "Patient.identifier:LifeId-external.system",
        "path": "Patient.identifier.system",
        "min": 1,
        "fixedUri": "https://cgm.com/ns/life/lifeid-external"
      },
      {
        "id": "Patient.identifier:LifeId-external.value",
        "path": "Patient.identifier.value",
        "min": 1
      },
      {
        "id": "Patient.identifier:LifeId-internal",
        "path": "Patient.identifier",
        "sliceName": "LifeId-internal",
        "definition": "An identifier for this patient.\r\nThis identifier represents the internal Id used within Life which is not known by the patient and will be used in specific business usecases.",
        "max": "1",
        "patternIdentifier": {
          "system": "https://cgm.com/ns/life/lifeid-internal"
        }
      },
      {
        "id": "Patient.identifier:LifeId-internal.system",
        "path": "Patient.identifier.system",
        "min": 1,
        "fixedUri": "https://cgm.com/ns/life/lifeid-internal"
      },
      {
        "id": "Patient.identifier:LifeId-internal.value",
        "path": "Patient.identifier.value",
        "min": 1
      },
      {
        "id": "Patient.telecom",
        "path": "Patient.telecom",
        "mustSupport": true
      }
    ]
  }
}