{
  "resourceType": "StructureDefinition",
  "id": "TR07-TR08-TR09-TR10-response",
  "meta": {
    "versionId": "25",
    "lastUpdated": "2022-09-20T14:18:12.183+00:00"
  },
  "url": "http://fhir.cezih.hr/specifikacije/StructureDefinition/TR07-TR08-TR09-TR10-response",
  "version": "0.1",
  "name": "TR07TR08TR09TR10Response",
  "title": "Poruka odgovora na zahtjeva za poništavanje uputnice (TR07, TR08, TR09, TR10)",
  "status": "active",
  "description": "Ovaj profil definira poruku koju CEZIH šalje kao odgovor na poruku odbijanja uputnice (TR07/TR08TR09/TR10 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 i 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 sadržavati reference prema svim elementima poruke",
            "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())"
          },
          {
            "key": "rsp-3",
            "severity": "error",
            "human": "ServiceRequest resurs mora imati referencu na contained resurs Communication (poruku o poništavanju)",
            "expression": "entry.resource.ofType(ServiceRequest).contained.ofType(Communication).where(topic.coding.code=2).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"
        }
      },
      {
        "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/ponistavanje-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",
        "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": "cancelled"
      },
      {
        "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 TR07, TR08, TR09 ili TR10.",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "http://fhir.cezih.hr/specifikacije/ValueSet/tranzicije-ponistavanja-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 poništavanja uputnica se nalazi u stanju ST05.",
        "min": 1,
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://fhir.cezih.hr/specifikacije/CodeSystem/status-procesa-specijalisticke-uputnice",
              "code": "ST05"
            }
          ]
        }
      },
      {
        "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.identifier",
        "path": "Bundle.entry.resource.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "ordered": false,
          "rules": "closed"
        },
        "min": 1,
        "max": "1"
      },
      {
        "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": "0"
      },
      {
        "id": "Bundle.entry:Uputnica.resource.status",
        "path": "Bundle.entry.resource.status",
        "fixedCode": "revoked"
      },
      {
        "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"
      }
    ]
  }
}