{
  "resourceType": "StructureDefinition",
  "id": "KjConsentBehandlingsavklaring",
  "url": "http://nhn.no/kj/fhir/StructureDefinition/KjConsentBehandlingsavklaring",
  "name": "KjConsentBehandlingsavklaring",
  "title": "KjConsentBehandlingsavklaring",
  "status": "active",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Consent",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Consent",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Consent.contained",
        "path": "Consent.contained",
        "min": 1
      },
      {
        "id": "Consent.extension",
        "path": "Consent.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        },
        "min": 3
      },
      {
        "id": "Consent.extension:behandlingsavklaringHlrMinusReason",
        "path": "Consent.extension",
        "sliceName": "behandlingsavklaringHlrMinusReason",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-hlr-minus-reason"
            ]
          }
        ],
        "constraint": [
          {
            "key": "kj-cos-2",
            "human": "The text must be between 2 and 80 characters",
            "source": "http://nhn.no/kj/fhir/StructureDefinition/KjConsentBehandlingsavklaring",
            "severity": "error",
            "expression": "value.length() >=2 and value.length() <= 80"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:treatmentGoal",
        "path": "Consent.extension",
        "sliceName": "treatmentGoal",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-treatment-goal"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:treatmentGoalText",
        "path": "Consent.extension",
        "sliceName": "treatmentGoalText",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-treatment-goal-text"
            ]
          }
        ],
        "constraint": [
          {
            "key": "kj-cos-3",
            "human": "The text must be between 2 and  700 characters",
            "source": "http://nhn.no/kj/fhir/StructureDefinition/KjConsentBehandlingsavklaring",
            "severity": "error",
            "expression": "value.length() >=2 and value.length() <= 700"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:decisionBasis",
        "path": "Consent.extension",
        "sliceName": "decisionBasis",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-decision-basis"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:infoGivenPatient",
        "path": "Consent.extension",
        "sliceName": "infoGivenPatient",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-info-given-patient"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:infoTextPatient",
        "path": "Consent.extension",
        "sliceName": "infoTextPatient",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-info-text-patient"
            ]
          }
        ],
        "constraint": [
          {
            "key": "kj-cos-2",
            "human": "The text must be between 2 and 80 characters",
            "source": "http://nhn.no/kj/fhir/StructureDefinition/KjConsentBehandlingsavklaring",
            "severity": "error",
            "expression": "value.length() >=2 and value.length() <= 80"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:infoGivenRelatives",
        "path": "Consent.extension",
        "sliceName": "infoGivenRelatives",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-info-given-relatives"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:infoTextRelatives",
        "path": "Consent.extension",
        "sliceName": "infoTextRelatives",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-info-text-relatives"
            ]
          }
        ],
        "constraint": [
          {
            "key": "kj-cos-2",
            "human": "The text must be between 2 and 80 characters",
            "source": "http://nhn.no/kj/fhir/StructureDefinition/KjConsentBehandlingsavklaring",
            "severity": "error",
            "expression": "value.length() >=2 and value.length() <= 80"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:hasOtherPlans",
        "path": "Consent.extension",
        "sliceName": "hasOtherPlans",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-has-other-plans"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:otherPlanText",
        "path": "Consent.extension",
        "sliceName": "otherPlanText",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/behandlingsavklaring-other-plan-text"
            ]
          }
        ],
        "constraint": [
          {
            "key": "kj-cos-2",
            "human": "The text must be between 2 and 80 characters",
            "source": "http://nhn.no/kj/fhir/StructureDefinition/KjConsentBehandlingsavklaring",
            "severity": "error",
            "expression": "value.length() >=2 and value.length() <= 80"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:KjText",
        "path": "Consent.extension",
        "sliceName": "KjText",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/KjText"
            ]
          }
        ],
        "constraint": [
          {
            "key": "kj-cos-3",
            "human": "The text must be between 2 and  700 characters",
            "source": "http://nhn.no/kj/fhir/StructureDefinition/KjConsentBehandlingsavklaring",
            "severity": "error",
            "expression": "value.length() >=2 and value.length() <= 700"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.extension:KjValidUntil",
        "path": "Consent.extension",
        "sliceName": "KjValidUntil",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nhn.no/kj/fhir/StructureDefinition/KjValidUntil"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.status",
        "extension": [
          null,
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "Consent.status",
        "definition": "Normalt: \"Active\", inactive hvis avkreftet og entered in error hvis slettet.",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "http://nhn.no/kj/fhir/ValueSet/ConsentStatus"
        }
      },
      {
        "id": "Consent.scope",
        "path": "Consent.scope",
        "mustSupport": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "ConsentScope"
            }
          ],
          "strength": "required",
          "description": "The four anticipated uses for the Consent Resource.",
          "valueSet": "http://hl7.org/fhir/ValueSet/consent-scope"
        }
      },
      {
        "id": "Consent.scope.coding",
        "path": "Consent.scope.coding",
        "min": 1,
        "max": "1",
        "fixedCoding": {
          "code": "treatment",
          "system": "http://terminology.hl7.org/CodeSystem/consentscope"
        },
        "mustSupport": true
      },
      {
        "id": "Consent.scope.coding.system",
        "path": "Consent.scope.coding.system",
        "min": 1
      },
      {
        "id": "Consent.scope.coding.code",
        "path": "Consent.scope.coding.code",
        "min": 1
      },
      {
        "id": "Consent.category",
        "path": "Consent.category",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Consent.category.coding",
        "path": "Consent.category.coding",
        "min": 1,
        "max": "1",
        "fixedCoding": {
          "code": "11",
          "system": "http://nhn.no/kj/fhir/CodeSystem/SubcategoriesOfCriticalInformation",
          "display": "HLR-minus og behandlingsavklaringer"
        }
      },
      {
        "id": "Consent.patient",
        "path": "Consent.patient",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.dateTime",
        "path": "Consent.dateTime",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Consent.performer",
        "path": "Consent.performer",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://nhn.no/kj/fhir/StructureDefinition/KjPractitionerRole"
            ],
            "aggregation": [
              "contained"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.policyRule",
        "path": "Consent.policyRule",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Consent.policyRule.coding",
        "path": "Consent.policyRule.coding",
        "min": 1,
        "max": "1",
        "fixedCoding": {
          "code": "2",
          "system": "http://nhn.no/kj/fhir/CodeSystem/ConsentPolicies",
          "display": "HLR-minus og behandlingsavklaringer"
        },
        "mustSupport": true
      },
      {
        "id": "Consent.provision",
        "path": "Consent.provision",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Consent.provision.code",
        "path": "Consent.provision.code",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Consent.provision.code.coding",
        "path": "Consent.provision.code.coding",
        "min": 1,
        "max": "1",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "http://nhn.no/kj/fhir/ValueSet/KjVarighetBehandlingsavklaringVS"
        }
      }
    ]
  }
}