{
  "resourceType": "StructureDefinition",
  "id": "recare-search",
  "url": "http://fhir.recaresolutions.com/StructureDefinition/recare-search",
  "version": "0.1.0",
  "name": "RecareSearch",
  "title": "Recare Search (ServiceRequest)",
  "status": "active",
  "experimental": false,
  "publisher": "Recare Deutschland GmbH",
  "description": "Recare search representation as a FHIR ServiceRequest, emitted inside Recare search_* event bundles.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "ServiceRequest",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "ServiceRequest",
        "path": "ServiceRequest",
        "constraint": [
          {
            "key": "recare-search-performerType-has-specialty",
            "severity": "error",
            "human": "If performerType is present, it must include a coding from the Recare specialty CodeSystem.",
            "expression": "performerType.empty() or performerType.coding.where(system='http://fhir.recaresolutions.com/CodeSystem/specialty').exists()",
            "source": "http://fhir.recaresolutions.com/StructureDefinition/recare-search"
          }
        ]
      },
      {
        "id": "ServiceRequest.identifier",
        "path": "ServiceRequest.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 2
      },
      {
        "id": "ServiceRequest.identifier:SearchId",
        "path": "ServiceRequest.identifier",
        "sliceName": "SearchId",
        "min": 1,
        "max": "1"
      },
      {
        "id": "ServiceRequest.identifier:SearchId.system",
        "path": "ServiceRequest.identifier.system",
        "min": 1,
        "fixedUri": "http://fhir.recaresolutions.com/sid/search-id"
      },
      {
        "id": "ServiceRequest.identifier:SearchId.value",
        "path": "ServiceRequest.identifier.value",
        "min": 1
      },
      {
        "id": "ServiceRequest.identifier:SearchUserId",
        "path": "ServiceRequest.identifier",
        "sliceName": "SearchUserId",
        "min": 1,
        "max": "1"
      },
      {
        "id": "ServiceRequest.identifier:SearchUserId.system",
        "path": "ServiceRequest.identifier.system",
        "min": 1,
        "fixedUri": "http://fhir.recaresolutions.com/sid/search-user-id"
      },
      {
        "id": "ServiceRequest.identifier:SearchUserId.value",
        "path": "ServiceRequest.identifier.value",
        "min": 1
      },
      {
        "id": "ServiceRequest.intent",
        "path": "ServiceRequest.intent",
        "patternCode": "order"
      },
      {
        "id": "ServiceRequest.category",
        "path": "ServiceRequest.category",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://fhir.recaresolutions.com/ValueSet/recare-transfertype"
        }
      },
      {
        "id": "ServiceRequest.code",
        "path": "ServiceRequest.code",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://fhir.recaresolutions.com/ValueSet/care-search-types-de"
        }
      },
      {
        "id": "ServiceRequest.subject",
        "path": "ServiceRequest.subject",
        "definition": "Reference to the patient. In this IG, the referenced resource SHALL conform to the Recare Patient profile (http://fhir.recaresolutions.com/StructureDefinition/recare-patient).",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "ServiceRequest.encounter",
        "path": "ServiceRequest.encounter",
        "definition": "Reference to the encounter. In this IG, the referenced resource SHALL conform to the Recare Encounter profile (http://fhir.recaresolutions.com/StructureDefinition/recare-encounter).",
        "min": 1
      },
      {
        "id": "ServiceRequest.occurrence[x]",
        "path": "ServiceRequest.occurrence[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "ServiceRequest.occurrence[x]:occurrenceDateTime",
        "path": "ServiceRequest.occurrence[x]",
        "sliceName": "occurrenceDateTime",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "dateTime"
          }
        ]
      },
      {
        "id": "ServiceRequest.requester",
        "path": "ServiceRequest.requester",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://fhir.recaresolutions.com/StructureDefinition/recare-careseeker"
            ]
          }
        ]
      },
      {
        "id": "ServiceRequest.performer",
        "path": "ServiceRequest.performer",
        "min": 1
      }
    ]
  }
}