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