{
  "resourceType": "OperationDefinition",
  "meta": {
    "lastUpdated": "2018-10-04T23:00:00+00:00"
  },
  "url": "https://fhir.nhs.uk/STU3/OperationDefinition/eRS-PatientServiceSearch-Operation-1",
  "version": "1.1.0",
  "name": "eRS-PatientServiceSearch-Operation-1",
  "status": "draft",
  "kind": "operation",
  "date": "2019-04-14T23:00:00+00:00",
  "publisher": "NHS Digital",
  "contact": [
    {
      "name": "Interoperability Team",
      "telecom": [
        {
          "system": "email",
          "value": "interoperabilityteam@nhs.net",
          "use": "work"
        }
      ]
    }
  ],
  "description": "Request to retrieve a healthcare service using patient specific details.",
  "code": "ers.searchHealthcareServicesForPatient",
  "system": false,
  "type": true,
  "instance": false,
  "parameter": [
    {
      "name": "patient",
      "use": "in",
      "min": 1,
      "max": "1",
      "documentation": "The NHS Number of the patient who the search is for. Format: ^[0-9]{10}$",
      "type": "Identifier"
    },
    {
      "name": "requestType",
      "use": "in",
      "min": 1,
      "max": "1",
      "documentation": "The type of request in e-RS which this service search is aimed at creating or updating. The options are appointment request (i.e. referral) or advice and guidance request. Services may support one or the other or both and will be filtered accordingly.",
      "type": "Coding",
      "binding": {
        "strength": "required",
        "valueSetReference": {
          "reference": "https://fhir.nhs.uk/STU3/ValueSet/eRS-RequestType-1"
        }
      }
    },
    {
      "name": "referringClinician",
      "use": "in",
      "min": 0,
      "max": "1",
      "documentation": "Users with the role of Referring Clinician Admin need to indicate the Referring Clinician under whose authority they are acting. This parameter is required if and only if the logged in user has a role of Referring Clinician Admin and it is only applicable when searching services for a yet to be created request. Format: ^[0-9]{12}$",
      "type": "Identifier"
    },
    {
      "name": "searchCriteria",
      "use": "in",
      "min": 1,
      "max": "1",
      "documentation": "The search criteria contain details of the specific conditions which the services need to satisfy, such as the specialty supported or the distance from a given postcode.",
      "profile": {
        "reference": "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ServiceSearchCriteria-Parameters-1"
      }
    },
    {
      "name": "restrictedService",
      "use": "in",
      "min": 0,
      "max": "1",
      "documentation": "This parameter is used to retrieve further information about a restricted service. Services flagged as restricted are not directly available to the referrer, but they are associated to a so called ‘authorised pathway’ which provides a way into the restricted service (i.e. if a patient is referred to a pathway service to start with, they can then be referred on to the restricted service) If this parameter is provided, the endpoint will calculate the list of authorised pathway services for the given restricted service, filter it according to the search criteria and return the standard service search information for each service on the authorised pathway.",
      "type": "Reference"
    },
    {
      "name": "sortBy",
      "use": "in",
      "min": 1,
      "max": "1",
      "documentation": "The service search returns the top results according to the sorting requested.         Therefore, the sorting requested affects the selection of services that are included in the response.",
      "type": "Coding",
      "binding": {
        "strength": "required",
        "valueSetReference": {
          "reference": "https://fhir.nhs.uk/STU3/ValueSet/eRS-SortBy-1"
        }
      }
    },
    {
      "name": "response",
      "use": "out",
      "min": 1,
      "max": "1",
      "documentation": "The List resource that has been returned in response to the given input parameters",
      "type": "List",
      "profile": {
        "reference": "https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchServices-List-1"
      }
    }
  ]
}