{
  "resourceType": "StructureDefinition",
  "id": "TR02-TR06-response",
  "meta": {
    "versionId": "39",
    "lastUpdated": "2023-03-17T08:29:56.788+00:00"
  },
  "url": "http://fhir.cezih.hr/specifikacije/StructureDefinition/TR02-TR06-response",
  "version": "0.1",
  "name": "TR02TR06Response",
  "title": "Poruka odgovora na poruku zahtjeva za odobravanje uputnice (TR02, TR06)",
  "status": "active",
  "description": "Ovaj profil definira poruku koju CEZIH šalje kao odgovor na poruku odobrenja uputnice (TR02/TR06 Request).",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Bundle",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Bundle",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Bundle",
        "path": "Bundle",
        "constraint": [
          {
            "key": "rsp-1",
            "severity": "error",
            "human": "Odgovor mora sadržavati podatke o uputnici, statusu uputnice  (Task, ServiceRequest) ako je zahtjev obrađen uspješno ili podatke o grešci (OperationOutcome)",
            "expression": "(entry.resource.ofType(Task).exists() and entry.resource.ofType(ServiceRequest).exists() and entry.resource.ofType(OperationOutcome).exists().not()) or (entry.resource.ofType(OperationOutcome).exists() and entry.resource.ofType(Task).exists().not() and entry.resource.ofType(ServiceRequest).exists().not())"
          },
          {
            "key": "rsp-2",
            "severity": "error",
            "human": "Zaglavlje poruke mora imati referencu na sve elemente poruke u MessageHeader.focus",
            "expression": "(entry.resource.ofType(MessageHeader).focus.resolve().ofType(Task).exists() and entry.resource.ofType(MessageHeader).focus.resolve().ofType(ServiceRequest).exists() and entry.resource.ofType(MessageHeader).focus.resolve().ofType(OperationOutcome).exists().not()) or (entry.resource.ofType(MessageHeader).focus.resolve().ofType(OperationOutcome).exists() and entry.resource.ofType(MessageHeader).focus.resolve().ofType(Task).exists().not() and entry.resource.ofType(MessageHeader).focus.resolve().ofType(ServiceRequest).exists().not() and entry.resource.ofType(MessageHeader).focus.resolve().ofType(DocumentReference).exists().not() and entry.resource.ofType(MessageHeader).focus.resolve().ofType(Communication).exists().not())"
          },
          {
            "key": "rsp-3",
            "severity": "error",
            "human": "ServiceRequest resurs mora imati referencu na contained resurs Communication (poruku odobravanja)",
            "expression": "entry.resource.ofType(ServiceRequest).contained.ofType(Communication).where(topic.coding.code=1).exists()"
          }
        ]
      },
      {
        "id": "Bundle.id",
        "path": "Bundle.id",
        "short": "Jedinstveni identifikator poruke",
        "min": 1
      },
      {
        "id": "Bundle.type",
        "path": "Bundle.type",
        "fixedCode": "message",
        "mustSupport": true
      },
      {
        "id": "Bundle.timestamp",
        "path": "Bundle.timestamp",
        "short": "Vrijeme kreiranja poruke",
        "min": 1
      },
      {
        "id": "Bundle.entry",
        "path": "Bundle.entry",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "resource"
            }
          ],
          "rules": "closed"
        },
        "min": 1
      },
      {
        "id": "Bundle.entry:MessageHeader",
        "path": "Bundle.entry",
        "sliceName": "MessageHeader",
        "short": "Zaglavlje poruke",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:MessageHeader.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "short": "Jedinstveni identifikator zapisa u poruci",
        "definition": "Identifikator definira pošiljatelj poruke u UUID formatu. Ovaj identifikator mora biti jednak identifikatoru resursa (atribut id) koji se nalazi u zapisu (entry)",
        "min": 1
      },
      {
        "id": "Bundle.entry:MessageHeader.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "MessageHeader",
            "profile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/hr-message-header"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:MessageHeader.resource.event[x]",
        "path": "Bundle.entry.resource.event[x]",
        "short": "Kod poruke",
        "definition": "Kod poruke definira koja je tranzicija bila inicirana request porukom.",
        "binding": {
          "strength": "required",
          "valueSet": "http://fhir.cezih.hr/specifikacije/ValueSet/odobravanje-uputnice"
        }
      },
      {
        "id": "Bundle.entry:MessageHeader.resource.response",
        "path": "Bundle.entry.resource.response",
        "short": "Reference na poruku zahtjeva",
        "min": 1
      },
      {
        "id": "Bundle.entry:MessageHeader.resource.focus",
        "path": "Bundle.entry.resource.focus",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this.resolve()"
            }
          ],
          "rules": "closed"
        }
      },
      {
        "id": "Bundle.entry:MessageHeader.resource.focus:stanje-procesa",
        "path": "Bundle.entry.resource.focus",
        "sliceName": "stanje-procesa",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/stanje-procesa-uputnice"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:MessageHeader.resource.focus:ishod-obrade-zahtjeva",
        "path": "Bundle.entry.resource.focus",
        "sliceName": "ishod-obrade-zahtjeva",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/ishod"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:MessageHeader.resource.focus:specijalisticka-uputnica",
        "path": "Bundle.entry.resource.focus",
        "sliceName": "specijalisticka-uputnica",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/specijalisticka-uputnica"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:MessageHeader.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:MessageHeader.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry:MessageHeader.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Stanje",
        "path": "Bundle.entry",
        "sliceName": "Stanje",
        "short": "Stanje procesa",
        "definition": "Obavezno u slučaju uspjeha. \n\nU slučaju uspješno registriranog odobrenja uputnice poruka će sadržavati Task resurs s trenutnim stanjem procesa uputnice.",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:Stanje.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "short": "Jedinstveni identifikator zapisa u poruci",
        "definition": "Ovaj identifikator mora biti jednak identifikatoru resursa (atribut id) koji se nalazi u zapisu (entry)",
        "min": 1
      },
      {
        "id": "Bundle.entry:Stanje.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "Task",
            "profile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/stanje-procesa-uputnice"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:Stanje.resource.status",
        "path": "Bundle.entry.resource.status",
        "fixedCode": "accepted"
      },
      {
        "id": "Bundle.entry:Stanje.resource.statusReason",
        "path": "Bundle.entry.resource.statusReason",
        "short": "Tranzicija",
        "definition": "Element sadrži informaciju o tranziciji koja je dovela do trenutnog stanja poslovnog procesa uputnice. U ovom slučaju to je TR02 ili TR06.",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "http://fhir.cezih.hr/specifikacije/ValueSet/tranzicije-odobravanja-uputnice"
        }
      },
      {
        "id": "Bundle.entry:Stanje.resource.businessStatus",
        "path": "Bundle.entry.resource.businessStatus",
        "short": "Stanje poslovnog procesa uputnice",
        "definition": "Element sadrži trenutno stanje poslovnog procesa uputnice. U ovom slučaju, nakon odobravanja uputnica se nalazi u stanju ST02.",
        "min": 1,
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://fhir.cezih.hr/specifikacije/CodeSystem/status-procesa-specijalisticke-uputnice",
              "code": "ST02"
            }
          ]
        }
      },
      {
        "id": "Bundle.entry:Stanje.resource.intent",
        "path": "Bundle.entry.resource.intent",
        "fixedCode": "order"
      },
      {
        "id": "Bundle.entry:Stanje.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Stanje.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Stanje.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Ishod",
        "path": "Bundle.entry",
        "sliceName": "Ishod",
        "short": "Ishod operacije",
        "comment": "Šalje se u slučaju pogreške. Sadrži informaciju o pogrešci.",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:Ishod.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "short": "Jedinstveni identifikator zapisa u poruci",
        "definition": "Ovaj identifikator mora biti jednak identifikatoru resursa (atribut id) koji se nalazi u zapisu (entry)",
        "min": 1
      },
      {
        "id": "Bundle.entry:Ishod.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "OperationOutcome",
            "profile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/ishod"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:Ishod.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Ishod.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Ishod.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Uputnica",
        "path": "Bundle.entry",
        "sliceName": "Uputnica",
        "definition": "Obavezno u slučaju uspjeha. U slučaju uspješno registriranog odobrenja uputnice poruka će sadržavati ServiceRequest resurs originalne uputnice.",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:Uputnica.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "short": "Jedinstveni identifikator zapisa u poruci",
        "definition": "Ovaj identifikator mora biti jednak identifikatoru resursa (atribut id) koji se nalazi u zapisu (entry)",
        "min": 1
      },
      {
        "id": "Bundle.entry:Uputnica.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "ServiceRequest",
            "profile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/specijalisticka-uputnica"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:Uputnica.resource.contained",
        "path": "Bundle.entry.resource.contained",
        "short": "Uključeni resursi",
        "definition": "ServiceRequest mora sadržavati poruku odobrenja uputnice i sve dokumente priložene uz uputnicu i/ili poruku odobrenja.",
        "min": 1
      },
      {
        "id": "Bundle.entry:Uputnica.resource.identifier",
        "path": "Bundle.entry.resource.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "ordered": false,
          "rules": "closed"
        },
        "min": 1,
        "max": "2"
      },
      {
        "id": "Bundle.entry:Uputnica.resource.identifier:identifikatorUputnice",
        "path": "Bundle.entry.resource.identifier",
        "sliceName": "identifikatorUputnice",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:Uputnica.resource.identifier:CustomerOrderNumber",
        "path": "Bundle.entry.resource.identifier",
        "sliceName": "CustomerOrderNumber",
        "max": "1"
      },
      {
        "id": "Bundle.entry:Uputnica.resource.status",
        "path": "Bundle.entry.resource.status",
        "fixedCode": "completed"
      },
      {
        "id": "Bundle.entry:Uputnica.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Uputnica.request",
        "path": "Bundle.entry.request",
        "max": "0"
      },
      {
        "id": "Bundle.entry:Uputnica.response",
        "path": "Bundle.entry.response",
        "max": "0"
      }
    ]
  }
}