ЕСОЗ - публічна документація

Private. Get Medication requests

 

Apiary

Private. Get Medication Requests


Purpose

This WS is designed to search (get list) of Medication requests for NHS_ADMIN. In the response of these endpoint person_id is return in hashed form.

According to requirements user of NHS_ADMIN can see all Medication request (without limitations)

Input parameters (filters)

  • legal_entity_id (optional)

  • employee_id (optional)

  • patient_id (hash of person_id)(optional)

  • status (optional). By default status=ACTIVE.

  • request_number (optional)

  • created_from  (optional)

  • created_to  (optional)

  • medication_id (optional)

  • intent (optional)

  • care_plan_id (optional)

  • encounter_id (optional)

  • page (optional)

  • page_size (optional)

Logic WS 

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check user scopes in order to perform this action (scope = 'medication_request_admin:read')
    Return 403 in case invalid scope(s)

  3. Search Medication requests by filters: 

    SELECT * FROM medication_requests MR WHERE (MR.employee_id == $.employee_id OR $.employee_id IS NULL) AND (MR.status == $.status OR $.status IS NULL) AND (MR.patient_id == $.patient_id OR $.patient_id IS NULL) AND (MR.medication_id = $.medication_id OR $.medication_id IS NULL) AND (MR.number = $.request_number OR $.request_number IS NULL) AND (MR.created_at >= $.created_from OR $.created_from IS NULL) AND (MR.created_at <= $.created_to OR $.created_to IS NULL) AND (MR.legal_entity_id == $.legal_entity_id OR $.legal_entity_id IS NULL)

Response (output)

  1. If according to filters requests are not found, WS returns empty data array.

    1. WS also returns pagination data - for technical info.

 

ЕСОЗ - публічна документація