{
  "resourceType": "SearchParameter",
  "id": "servicerequest-referral-status",
  "url": "https://fhir.apps.health/SearchParameter/servicerequest-referral-status",
  "description": "Filter `ServiceRequest` by status, counting only referrals (`intent = proposal`).\n\n    GET [base]/ServiceRequest?referral-status=active\n    GET [base]/Patient?_has:ServiceRequest:subject:referral-status=active&_sort=name\n\n**R4 cannot ask this with base parameters, and that is why this one exists.** Referrals and orders\nshare `ServiceRequest` and differ by `intent`, so \"a referral in progress\" is two conditions on one\nrequest. Two reverse-chained parameters (`_has:ServiceRequest:subject:intent=proposal` and\n`_has:ServiceRequest:subject:status=active`) are evaluated independently, and each may be satisfied\nby a different request: a patient with a completed referral and an active lab order matches both.\nThis parameter indexes `status` on referrals only, so one `_has` carries both conditions and an\norder can never satisfy it.\n\nIt is a `token` over the request-status code. Any status may be asked for, and several at once\n(`referral-status=active,on-hold`); which states count as \"in progress\" is the caller's choice,\nnot the definition's.\n\n**A store that has not been given this definition does not refuse a search that names it.** It drops\nthe parameter and answers as if it were absent, so an unfiltered result is indistinguishable from a\nsuccessful narrow one. Load the definition before relying on it, and prove the filter ran with a\nnegative case: a patient whose only open request is an order must be ABSENT from an active-referral\nsearch.\n\n**Indexing is separate from definition.** On stores that index search parameters as a background\njob, writing the definition makes the parameter known and does not by itself make it usable; until\nthe index completes, the search behaves as it does on a store that never had the definition at all.",
  "name": "ServiceRequestReferralStatus",
  "status": "draft",
  "experimental": false,
  "date": "2026-09-23",
  "publisher": "WELLSTAR Technologies Corp.",
  "contact": [
    {
      "name": "Nexus EMR FHIR Implementation Guide",
      "telecom": [
        {
          "system": "url",
          "value": "https://fhir.apps.health"
        }
      ]
    }
  ],
  "jurisdiction": [
    {
      "coding": [
        {
          "code": "CA",
          "system": "urn:iso:std:iso:3166",
          "display": "Canada"
        }
      ]
    }
  ],
  "code": "referral-status",
  "base": [
    "ServiceRequest"
  ],
  "type": "token",
  "expression": "ServiceRequest.where(intent = 'proposal').status"
}
