{
  "resourceType": "StructureDefinition",
  "id": "recare-search",
  "url": "https://fhir-repository.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='https://fhir-repository.recaresolutions.com/CodeSystem/specialty').exists()",
            "source": "https://fhir-repository.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": "https://fhir-repository.recaresolutions.com/NamingSystem/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": "https://fhir-repository.recaresolutions.com/NamingSystem/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": "https://fhir-repository.recaresolutions.com/ValueSet/recare-transfertype"
        }
      },
      {
        "id": "ServiceRequest.code",
        "path": "ServiceRequest.code",
        "binding": {
          "strength": "preferred",
          "valueSet": "https://fhir-repository.recaresolutions.com/ValueSets/Recare_care_search_types_DE"
        }
      },
      {
        "id": "ServiceRequest.encounter",
        "path": "ServiceRequest.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": [
              "https://fhir-repository.recaresolutions.com/StructureDefinition/recare-careseeker-organization"
            ]
          }
        ]
      }
    ]
  }
}