{
  "resourceType": "StructureDefinition",
  "url": "https://cgm.com/fhir/his/medico/r4/sd/pip/DocumentReference_PiPDocument_1",
  "name": "DocumentReference_PiPDocument_1",
  "status": "draft",
  "description": "This profile describes document relevant data exchanged with Patient Portal",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "DocumentReference",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DocumentReference",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "DocumentReference.id",
        "path": "DocumentReference.id",
        "definition": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.\r\nFormat will be Document-#####\r\nwhere #### is the document id (medico x1350dre.dre)",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.meta",
        "path": "DocumentReference.meta",
        "min": 1
      },
      {
        "id": "DocumentReference.meta.lastUpdated",
        "path": "DocumentReference.meta.lastUpdated",
        "definition": "When the resource last changed - e.g. when the version changed.\r\nLife: Modified\r\nMedico: LastUpdated",
        "min": 1
      },
      {
        "id": "DocumentReference.meta.profile",
        "path": "DocumentReference.meta.profile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://cgm.com/fhir/his/medico/r4/sd/pip/DocumentReference_PiPDocument_1"
      },
      {
        "id": "DocumentReference.extension",
        "path": "DocumentReference.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        },
        "min": 0
      },
      {
        "id": "DocumentReference.extension:uploadInformation",
        "path": "DocumentReference.extension",
        "sliceName": "uploadInformation",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://cgm.com/fhir/his/medico/r4/sd/pip/ext/DocumentReference_UploadInformation_1"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.extension:uploadInformation.value[x]",
        "path": "DocumentReference.extension.value[x]",
        "definition": "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).\r\nLife: TransmissionDate\r\nMedico: Upload date",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier",
        "path": "DocumentReference.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "DocumentReference.identifier:medicoIdentifier",
        "path": "DocumentReference.identifier",
        "sliceName": "medicoIdentifier",
        "definition": "Other identifiers associated with the document, including version independent identifiers.\r\n\r\nrepresents the identifier within CGM MEDICO. Is always present if this document is uploaded to Life, will not be present at the moment this document is downloaded to CGM MEDICO.",
        "max": "1",
        "patternIdentifier": {
          "type": {
            "coding": [
              {
                "system": "https://cgm.com/fhir/his/medico/cs/identifier-type",
                "code": "MedicoDocument"
              }
            ]
          }
        },
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier:medicoIdentifier.system",
        "path": "DocumentReference.identifier.system",
        "comment": "Dynamically resolved for validation\r\n--FixedValue=https://cgm.com/fhir/his/medico/%KUNDE%/sid1/Document",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier:medicoIdentifier.value",
        "path": "DocumentReference.identifier.value",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier:lifeIdentifier",
        "path": "DocumentReference.identifier",
        "sliceName": "lifeIdentifier",
        "definition": "Other identifiers associated with the document, including version independent identifiers.\r\n\r\nrepresents the identifier within Life. It is present after it was downloaded from Life or uploaded to Life.",
        "max": "1",
        "patternIdentifier": {
          "type": {
            "coding": [
              {
                "system": "https://cgm.com/fhir/his/medico/cs/identifier-type",
                "code": "LifeDocument"
              }
            ]
          }
        },
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier:lifeIdentifier.system",
        "path": "DocumentReference.identifier.system",
        "fixedUri": "https://cgm.com/ns/life/document",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier:lifeIdentifier.value",
        "path": "DocumentReference.identifier.value",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.type",
        "path": "DocumentReference.type",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.type.coding",
        "path": "DocumentReference.type.coding",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.type.coding.system",
        "path": "DocumentReference.type.coding.system",
        "mustSupport": true,
        "binding": {
          "strength": "preferred",
          "valueSet": "http://ihe-d.de/ValueSets/IHEXDStypeCode"
        }
      },
      {
        "id": "DocumentReference.type.coding.version",
        "path": "DocumentReference.type.coding.version",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.type.coding.code",
        "path": "DocumentReference.type.coding.code",
        "definition": "A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).\r\nLife: Category\r\nMedico: tbd.",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.subject",
        "path": "DocumentReference.subject",
        "definition": "Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).\r\n\r\nLife: Owner\r\nMedico: PatientId",
        "min": 1
      },
      {
        "id": "DocumentReference.subject.identifier",
        "path": "DocumentReference.subject.identifier",
        "min": 1,
        "mustSupport": false
      },
      {
        "id": "DocumentReference.subject.identifier.system",
        "path": "DocumentReference.subject.identifier.system",
        "comment": "Dynamically resolved for validation\r\n--FixedValue=https://cgm.com/fhir/his/medico/%KUNDE%/sid1/Patient",
        "min": 1
      },
      {
        "id": "DocumentReference.subject.identifier.value",
        "path": "DocumentReference.subject.identifier.value",
        "min": 1
      },
      {
        "id": "DocumentReference.author",
        "path": "DocumentReference.author",
        "definition": "Identifies who is responsible for adding the information to the document.\r\nat least a department is required",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://cgm.com/fhir/his/medico/r4/sd/pip/Location_PiPWard_1",
              "https://cgm.com/fhir/his/medico/r4/sd/pip/Organization_PipDepartment_1",
              "https://cgm.com/fhir/his/medico/r4/sd/pip/Patient_PiPPatient_1"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author.identifier",
        "path": "DocumentReference.author.identifier",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author.identifier.system",
        "path": "DocumentReference.author.identifier.system",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author.identifier.value",
        "path": "DocumentReference.author.identifier.value",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.description",
        "path": "DocumentReference.description",
        "definition": "Human-readable description of the source document.\r\n\r\nLife: Comment\r\nMedico: Comment",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content",
        "path": "DocumentReference.content",
        "max": "1"
      },
      {
        "id": "DocumentReference.content.attachment.contentType",
        "path": "DocumentReference.content.attachment.contentType",
        "definition": "Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.\r\nLife: mimetype\r\nMedico: mimetype",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.data",
        "path": "DocumentReference.content.attachment.data",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.title",
        "path": "DocumentReference.content.attachment.title",
        "definition": "A label or set of text to display in place of the data.\r\nLife: Name\r\nMedico: Title (x1350dre.info)",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context",
        "path": "DocumentReference.context",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.encounter",
        "path": "DocumentReference.context.encounter",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.encounter.reference",
        "path": "DocumentReference.context.encounter.reference",
        "mustSupport": true
      }
    ]
  }
}