{
  "resourceType": "StructureDefinition",
  "url": "http://fhir.cezih.hr/specifikacije/StructureDefinition/HRCreatePrescriptionMessage",
  "name": "HRCreatePrescriptionMessage",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Bundle",
  "baseDefinition": "http://fhir.cezih.hr/specifikacije/StructureDefinition/hr-request-message",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Bundle.entry",
        "path": "Bundle.entry",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "resource"
            }
          ],
          "rules": "closed"
        },
        "min": 3,
        "max": "3"
      },
      {
        "id": "Bundle.entry:messageHeader",
        "path": "Bundle.entry",
        "sliceName": "messageHeader",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:messageHeader.resource",
        "path": "Bundle.entry.resource",
        "type": [
          {
            "code": "MessageHeader",
            "profile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/HRPrescriptionMessageHeader"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:messageHeader.resource.event[x]",
        "path": "Bundle.entry.resource.event[x]",
        "fixedCoding": {
          "system": "http://fhir.cezih.hr/specifikacije/CodeSystem/message-types",
          "code": "4.1",
          "display": "TR01 - Kreiranje recepta"
        }
      },
      {
        "id": "Bundle.entry:messageHeader.resource.event[x].code",
        "path": "Bundle.entry.resource.event[x].code",
        "fixedCode": "4.1"
      },
      {
        "id": "Bundle.entry:messageHeader.resource.focus",
        "path": "Bundle.entry.resource.focus",
        "definition": "Referenca na sadržaj poruke.",
        "min": 2,
        "max": "2"
      },
      {
        "id": "Bundle.entry:recept",
        "path": "Bundle.entry",
        "sliceName": "recept",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:recept.resource",
        "path": "Bundle.entry.resource",
        "type": [
          {
            "code": "MedicationRequest",
            "profile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/HRRecept"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:recept.resource.extension:hRTroskoviSudjelovanje",
        "path": "Bundle.entry.resource.extension",
        "sliceName": "hRTroskoviSudjelovanje",
        "definition": "Podatci o sudjelovanju pacijenta u troškovima liječenja. Ne koristi se u privatnom receptu."
      },
      {
        "id": "Bundle.entry:recept.resource.status",
        "path": "Bundle.entry.resource.status",
        "fixedCode": "active"
      },
      {
        "id": "Bundle.entry:recept.resource.intent",
        "path": "Bundle.entry.resource.intent",
        "fixedCode": "order"
      },
      {
        "id": "Bundle.entry:recept.resource.dispenseRequest.numberOfRepeatsAllowed",
        "path": "Bundle.entry.resource.dispenseRequest.numberOfRepeatsAllowed",
        "short": "Broj dozvoljenih izdavanja po receptu",
        "constraint": [
          {
            "key": "IZD-1",
            "severity": "error",
            "human": "Nedozvoljen broj ponavljanja po receptu,",
            "expression": "$this >=0 and $this <=5"
          }
        ]
      },
      {
        "id": "Bundle.entry:pacijent",
        "path": "Bundle.entry",
        "sliceName": "pacijent",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:pacijent.resource",
        "path": "Bundle.entry.resource",
        "type": [
          {
            "code": "Patient",
            "profile": [
              "http://fhir.cezih.hr/specifikacije/StructureDefinition/hr-pacijent"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:pacijent.resource.name",
        "path": "Bundle.entry.resource.name",
        "min": 1
      },
      {
        "id": "Bundle.entry:pacijent.resource.name.family",
        "path": "Bundle.entry.resource.name.family",
        "min": 1
      },
      {
        "id": "Bundle.entry:pacijent.resource.name.given",
        "path": "Bundle.entry.resource.name.given",
        "min": 1
      }
    ]
  }
}