Specification
Apiary | |
JSON Schema response |
Purpose
This WS is designed to reject previously created Medication request Request (patch).
Input parameters (filters)
id
Authorize
Verify the validity of access token
Check user scope (scope = 'medication_request_request:reject') in order to perform this action
In case error - generate 401 response
Check user's legal entity is legal entity where Medication request Request has been created (medication_request_request.data.legal_entity_id = client_id from token)
In case error - generate 403 response “Medication request Request can not be rejected by employee from another legal entity”
Validate User
Do reject Medication request Request allowed for User if he has one of the following active and approved employee that:
is an author of the Medication request Request (medication_request_request.employee_id)
has an approval on write Care plan if Medication request Request based on the Care plan (medication_request_request.based_on)
is a Doctor whohas declarationwith the Patient.in case of error - return 409 ("Only an author, employee with approval on care plan or doctor with an active declaration with the patient can reject medication request request")
Validation transition
For info - status charts: Medication_request_Request
Get Request for Medication request status by $.id
Check status == NEW
if invalid - return 409 error (message: "Invalid status Request for Medication request for reject transition!")'
Update status
Update (Set values) Request for Medication request
status = REJECTED
updated_by = user_id
updated_at = timestamp