Specification
Apiary | |
JSON Schema response | SPECS |
Purpose
This WS is designed to return Medication request detail.
Input parameters (filters)
- id
Validate request
Validate FK
- Validate id - medication_request_id exists
- Return 404 in case not found record in DB with this ID
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:detail')
- Return 403 in case invalid scope(s)
- Get `my_party_id` from `$.context.user_id`
- Return 500 in case ("Not found party for this user!")
- Get list of employees for this `party_id` & `$.context.legal_entity_id` (if not NULL)
Search Medication requests by filters:
SELECT * FROM medication_request MR INNER JOIN employees E ON E.party_id = my_party_id AND (E.id = $.employee_id OR $.employee_id IS NULL) AND (E.legal_entity_id == $.context.legal_entity_id OR $.context.legal_entity_id IS NULL) LEFT JOIN declarations D ON D.Employee_id = E.id AND E.status = ACTIVE AND D.status = ACTIVE AND MR.person_id = D.person_id WHERE MR.id = $.id AND MR.employee_id == E.id AND MR.is_active = TRUE
Response (output)
- Return object with responce structure from WS Sign Medication Request.