{
  "resourceType": "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition",
  "resource": "Bundle",
  "id": "ViewDefinition-DocumentReference",
  "title": "Correspondentie",
  "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": "iif(exists(context.period.start), context.period.start, indexed)",
          "name": "Datum",
          "description": "N.B. tijd is GMT, dus omzetten naar CET.",
          "type": "dateTime",
          "tag": [ { "name": "Zib element", "value": "nvt" } ]
        },
        {
          "path": "iif(exists(description), description, content.attachment.title.replace('.pdf',''))+iif(exists(context.encounter.display),', '+context.encounter.display,'')",
          "name": "Beschrijving",
          "description": "Tijdelijk voor Zorgplatform: gebruik <code>content.attachment.title</code> voor de beschrijving van documenten inclusief het strippen van de <code>.pdf</code> extensie",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "nvt" } ]
        },
        {
          "path": "author.display",
          "name": "Auteur",
          "description": "Tijdelijk voor Zorgplatform: indien <code>author.display</code> is gevuld met een OID, dan wordt het veld gevuld met <code>Auteur niet bekend</code>",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "nvt" } ]
        },
        {
          "path": "iif(context.practiceSetting.text.startsWith('2.16.840.1.113883.'), context.practiceSetting.coding.code, context.practiceSetting.text)",
          "name": "Specialisme",
          "description": "Tijdelijk voor Zorgplatform: indien <code>context.practiceSetting.text</code> is gevuld met een OID (startsWith('2.16.840.1.113883.)), dan wordt het veld gevuld met <code>context.practiceSetting.coding.code</code> (een SNOMED CT code)",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "nvt" } ]
        },
        {
          "path": "content.attachment.contentType",
          "name": "(MimeType)",
          "description": "Alleen <code>application/pdf</code> tonen",
          "type": "code",
          "tag": [ { "name": "Zib element", "value": "nvt" } ]
        },
        {
          "path": "iif(type.text.startsWith('2.16.840.1.113883.'), type.coding[0].code, type.text)",
          "name": "(Type)",
          "type": "string",
          "tag": [ { "name": "Zib element", "value": "nvt" } ]
        }
      ],
      "forEach": "entry.resource.where(resourceType='DocumentReference')"
    }
  ]
}