<OperationDefinition xmlns="http://hl7.org/fhir">
  <meta>
    <lastUpdated value="2018-10-05T00:00:00+01:00" />
  </meta>
  <url value="https://fhir.nhs.uk/STU3/OperationDefinition/eRS-PatientServiceSearch-Operation-1" />
  <version value="1.2.0" />
  <name value="eRS-PatientServiceSearch-Operation-1" />
  <status value="draft" />
  <kind value="operation" />
  <date value="2019-04-15T00:00:00+01:00" />
  <publisher value="NHS Digital" />
  <contact>
    <name value="Interoperability Team" />
    <telecom>
      <system value="email" />
      <value value="interoperabilityteam@nhs.net" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="Request to retrieve a healthcare service using patient specific details." />
  <code value="ers.searchHealthcareServicesForPatient" />
  <system value="false" />
  <type value="true" />
  <instance value="false" />
  <parameter>
    <name value="patient" />
    <use value="in" />
    <min value="1" />
    <max value="1" />
    <documentation value="The NHS Number of the patient who the search is for. Format: ^[0-9]{10}$" />
    <type value="Identifier" />
  </parameter>
  <parameter>
    <name value="requestType" />
    <use value="in" />
    <min value="1" />
    <max value="1" />
    <documentation value="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 value="Coding" />
    <binding>
      <strength value="required" />
      <valueSetReference>
        <reference value="https://fhir.nhs.uk/STU3/ValueSet/eRS-RequestType-1" />
      </valueSetReference>
    </binding>
  </parameter>
  <parameter>
    <name value="referringClinician" />
    <use value="in" />
    <min value="0" />
    <max value="1" />
    <documentation value="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 value="Identifier" />
  </parameter>
  <parameter>
    <name value="searchCriteria" />
    <use value="in" />
    <min value="1" />
    <max value="1" />
    <documentation value="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 value="https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ServiceSearchCriteria-Parameters-1" />
    </profile>
  </parameter>
  <parameter>
    <name value="sortBy" />
    <use value="in" />
    <min value="1" />
    <max value="1" />
    <documentation value="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 value="Coding" />
    <binding>
      <strength value="required" />
      <valueSetReference>
        <reference value="https://fhir.nhs.uk/STU3/ValueSet/eRS-SortBy-1" />
      </valueSetReference>
    </binding>
  </parameter>
  <parameter>
    <name value="response" />
    <use value="out" />
    <min value="1" />
    <max value="1" />
    <documentation value="The List resource that has been returned in response to the given input parameters" />
    <type value="List" />
    <profile>
      <reference value="https://fhir.nhs.uk/STU3/StructureDefinition/eRS-FetchServices-List-1" />
    </profile>
  </parameter>
</OperationDefinition>