Table of Contents |
---|
Apiary
Private. Get Medication request by ID
Purpose
This WS is designed to return Medication request detail for NHS_ADMIN. In the response of these endpoint person_id is return in hashed form.
Search Medication Request is possible in 2 options: by `medication_request.id` OR `medication_request.request_number`.
According to requirements user of NHS_ADMIN can see all Medication request (without limitations)
Input parameters (filters)
id
Validate request
Search Medication Request
Search record by `$.id` in column `medication_request.id`
If not found - Search record by `$.id` in column `medication_request.request_number`
If not found - Return 404 in case "Not found record in DB with this ID!"
Validate FK
Read data from `ops_db.medication_requests` by `id`
Validate legal_entity_id - legal_entity_id exists
Return 422 in case validation fails (422 EView)
Validate employee_id - employee_id exists
Return 422 in case validation fails (422 EView)
Validate division_id - division_id exists
Return 422 in case validation fails (422 EView)
Validate medical_program_id - medical_program_id exists
Return 422 in case validation fails (422 EView)
Validate all medication_id - medication_id exists
Return 422 in case validation fails (422 EView)
Validate patient_id - mpi_id exists
Return 422 in case validation fails (422 EView)
Logic WS
Verify the validity of access token
Return 401 in case validation fails
Check user scopes in order to perform this action (scope = 'medication_request_admin:details')
Return 403 in case invalid scope(s)
Get `client_type` from `mithril.clients`
Search Medication request by $.id:
Code Block SELECT * FROM medication_requests MR WHERE (MR.id = $.id OR MR.request_number = $.id) AND MR.is_active = TRUE
Response (output)
Return object with responce structure from WS Sign Medication Request.