Search loading...

API Hub

Explore and Make use of Nationally Defined Messaging APIs

 

A010: Patient Service Search

Status: Live

Description

As a Referring Clinician (/Administrator) needing to refer a patient I want to search for services that are appropriate for my patient So that I can create a shortlist of services where my patient can be referred to

Base URL (Dev1): https://api.dev1.ers.ncrs.nhs.uk/ers-api

Resource URL

Method URL Authentication
POST {Base URL}/STU3/v1/HealthcareService/$ers.searchHealthcareServicesForPatient Session Token (Details)
  • {Base URL} (Dev1) = https://api.dev1.ers.ncrs.nhs.uk/ers-api

Operation Definition

The Operation Definition for this endpoint is available on the FHIR server: ers.patientServiceSearch

Prerequisite Operations

  • If using the filter on specialty, the value provided must be a valid code obtained via the FHIR 3 version of the Get Reference Data (A004) endpoint.

INPUT

Request Operation: Header

Field Name Value
XAPI_ASID The “Accredited System ID” issued to the third party
HTTP_X_SESSION_KEY The session key generated by the Create Session endpoint (A001)
Content-Type application/fhir+json

Request Operation: Parameters

Parameter Name Cardinality Type Notes
patient 1..1 Identifier The master NHS Number for the patient
requestType 1..1 Code  
referringClinician 0..1 Identifier If the logged in user is an RCA (and only in this case) they need to specify the referring clinician on whose behalf they are operating, in the context of the current referral
SearchCriteria 1..1 Resource The StructureDefintion of this Resource is: eRS-ServiceSearchCriteria-Parameters-1
sortBy 1..1 Code  

Removed Parameters

Removed Parameter Notes
restrictedService This parameter was removed in e-RS Release 9.1

Example Request Header

Example Request Body

Note: These examples contain environment specific URLs and test data, these should be replaced with appropriate values for your implementation.

OUTPUT

Response: Success

If successful, the status code 200 (OK) is returned and the response body contains the list of services (if any) that match the search criteria provided in the format of an eRS-FetchServices-List-1

Example Response Body

Note: These examples contain environment specific URLs and test data, these should be replaced with appropriate values for your implementation.

Response: Failure

If an error occurs, the relating HTTP status code will be returned in the header. Where status code 422 (Unprocessable Entity) is returned then an eRS-OperationOutcome-1 will be included in the body, as detailed below.

issue.details.code Description
FIELD_NOT_PERMITTED A referring clinician is provided when the logged in user is not an RCA; or: one of the following occurs: the distance limit is specified when the postcode is not provided, the IWT limit is specified when the priority is TWO_WEEK_WAIT or the clinic type is specified when the specialty is not provided
INAPPROPRIATE_VALUE The value of commissioning provisioning is ALL_SERVICES (this value is not supported)
NO_REG_GP_PRACTICE The patient provided was found not to have a registered GP practice. The patient is not eligible to be referred via e-RS while this problem persists
ORGANISATION_IS_CLOSED The organisation identifier supplied corresponds to an organisation that is closed
ORGANISATION_NOT_APPROPRIATE The organisation identifier supplied corresponds to an organisation of a type other than ‘Service location’ and ‘Service providing organisation’
PATIENT_ERROR There was a problem with the patient’s record in SDS. The patient is not eligible to be referred via e-RS while this problem persists
REFERENCE_NOT_FOUND An entity referenced (e.g. the patient, the postcode, the organisation or a clinician) is not found
REFERENCED_USER_IS_NOT_ACTIVE The SDS user provided as the referring clinician or the named clinician is found to be not active in SDS
REFERENCED_USER_IS_NOT_RC The SDS user provided as the referring clinician does not actually have the Referring Clinician business function in e-RS
REFERENCED_USER_IS_NOT_SPC The SDS user provided as the named clinician does not actually have the Service Provider Clinician business function in e-RS
REFERENCED_USER_NOT_IN_ORG The referring clinician provided does not belong to the same organisation as the logged in user
VALUE_IS_REQUIRED A referring clinician is not provided when the logged in user is an RCA; or: one of the following three is not provided: the pair specialty + clinic type, the clinical term¬ or the named clinician

All content is available under the Open Government Licence v3.0, except where otherwise stated