{
  "resourceType": "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition",
  "resource": "Bundle",
  "id": "ViewDefinition-Condition",
  "title": "Problemen (incl. diagnosen)",
  "select": [
    {
      "column": [
        {
          "path": "meta.extension('http://hl7.org/fhir/4.0/StructureDefinition/extension-Meta.source').valueUri",
          "name": "Bron",
          "description": "Lookup adhv uri (AGB-Z of OID) <code>&lt;adressering-base&gt;/Organization?identifier=&lt;.meta.tag.code&gt;</code> en gebruik dan <code>Organization.name</code>",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "nvt" } ]
        },
        {
          "path": "onsetPeriod.start | onsetDateTime",
          "name": "Datum",
          "description": "Laat één datum zien als de <code>.onsetDateTime</code> en <code>.onsetPeriod</code> hetzelfde zijn",
          "type": "dateTime",
          "tag": [ { "name": "Zib element", "value": "ProbleemBeginDatum" } ]
        },
        {
          "path": "code.text | code.coding[0].display",
          "name": "Diagnose",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "ProbleemNaam" } ]
        },
        {
          "path": "clinicalStatus.lookup('ProbleemStatus').display",
          "name": "Status",
          "description": "Zie voor labels: <a href='ValueSet-ProbleemStatus.html'>ValueSet-ProbleemStatus</a>",
          "type": "code",
          "tag": [ { "name": "Zib element", "value": "ProbleemStatus" } ]
        },
        {
          "path": "code.coding[0].select(system.lookup('CodeSystems')[0].display+'#' + code + ' ' + iif(exists(display),display,''))",
          "name": "+Diagnose",
          "description": "Meerdere codes mogelijk.<br/>Ignore NullFlavor.<br/>Lookup system label middels <code>&lt;terminologie-base&gt;/CodeSystem?url=&lt;.system&gt;</code> en gebruik dan <code>.display</code><br/>Zie voor labels: <a href='ValueSet-CodeSystems.html'>ValueSet-CodeSystems</a>",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "ProbleemNaam" } ]
        },
        {
          "path": "note.text",
          "name": "+Toelichting",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "Toelichting" } ]
        },
        {
          "path": "clinicalStatus",
          "name": "(regelkleur)",
          "description": "Actueel (<code>active,recurrence</code>) = groene rijen, dikgedrukt<br/>Niet actueel (<code>inactive,remission,resolved</code>) = grijze rijen",
          "type": "code",
          "tag": [ { "name": "Zib element", "value": "ProbleemStatus" } ]
        }
      ],
      "forEach": "entry.resource.where(resourceType='Condition')"
    }
  ]
}