PackagesCanonicalsLogsProblems
    Packages
    rs/hl7.cda.us.ccda@4.0.0
    http://hl7.org/cda/us/ccda/StructureDefinition/EncounterDiagnosis
description: 'This template wraps relevant problems or diagnoses at the close of a visit or that need to be followed after the visit. This entry requires at least one Problem Observation entry.  The Problem Status template in the Problem Observation entry indicates the status of the diagnosis.\n\n#### Templates Used\nAlthough open templates may contain any valid CDA content, the following templates are specifically called out by this template:\n\n**Required EntryRelationships**: [ProblemObservation](StructureDefinition-ProblemObservation.html)'
package_name: rs/hl7.cda.us.ccda
derivation: constraint
name: EncounterDiagnosis
type: http://hl7.org/cda/stds/core/StructureDefinition/Act
elements:
  templateId:
    index: 0
    slicing:
      rules: open
      discriminator:
      - {path: root, type: value}
      - {path: extension, type: value}
      min: 1
      slices:
        encounter-dx:
          match: {root: 2.16.840.1.113883.10.20.22.4.80, extension: '2024-05-01'}
          schema:
            _required: true
            index: 1
            elements:
              root:
                pattern: {type: string, value: 2.16.840.1.113883.10.20.22.4.80}
                type: string
                index: 2
              extension:
                pattern: {type: string, value: '2024-05-01'}
                type: string
                index: 3
            required: [extension, root]
            extensions: {}
  classCode:
    pattern: {type: code, value: ACT}
    type: code
    index: 4
  moodCode:
    pattern: {type: code, value: EVN}
    type: code
    index: 5
  code:
    short: Diagnosis
    index: 6
    elements:
      code:
        pattern: {type: code, value: 29308-4}
        type: code
        index: 7
      codeSystem:
        short: LOINC
        pattern: {type: string, value: 2.16.840.1.113883.6.1}
        type: string
        index: 8
    required: [code, codeSystem]
  text:
    short: SHOULD reference the portion of section narrative text corresponding to this entry
    index: 9
    elements:
      reference:
        constraint:
          value-starts-octothorpe: {human: 'If reference/@value is present, it SHALL begin with a ''#'' and SHALL point to its corresponding narrative', source: 'http://hl7.org/cda/us/ccda/StructureDefinition/EncounterDiagnosis', severity: error, expression: value.exists() implies value.startsWith('#')}
        index: 10
  statusCode:
    index: 11
    elements:
      code:
        pattern: {type: code, value: completed}
        type: code
        index: 12
    required: [code]
  entryRelationship:
    index: 13
    slicing:
      rules: open
      discriminator:
      - {path: observation, type: profile}
      - {path: typeCode, type: value}
      min: 1
      slices:
        problemObservation:
          match: {typeCode: SUBJ}
          schema:
            array: true
            min: 1
            _required: true
            index: 14
            elements:
              typeCode:
                pattern: {type: code, value: SUBJ}
                type: code
                index: 15
              observation: {type: 'http://hl7.org/cda/stds/core/StructureDefinition/Observation', index: 16}
            required: [observation]
package_version: 4.0.0
class: logical
kind: logical
url: http://hl7.org/cda/us/ccda/StructureDefinition/EncounterDiagnosis
base: http://hl7.org/cda/stds/core/StructureDefinition/Act
version: 4.0.0
required: [entryRelationship, statusCode, templateId]