Purpose
This WS is designed to reject previously created Medication request Request (patch).
Specification
Logic
API paragraph not found
Preconditions
No
Global and configurable parameters
No
Input parameters
Input parameter | Values | Type | Description | Example |
---|---|---|---|---|
id | String | Required | a89f6a26-4221-4597-a1d2-542d5e40b565 |
Filters
No
Request structure
API paragraph not found
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”
Headers
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Validate request
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 who has declaration with 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")
Request data validation
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!")'
Parameters that are used when processing the request
Configuration parameters
Access to the method is defined by the scope medication_request_request:reject. Permission for this scope is determined by the System administrator by configuring scopes in the context of clients and roles.
Dictionaries
API paragraph not found
Processing
Update status
Update (Set values) Request for Medication request
status = REJECTED
updated_by = user_id
updated_at = timestamp
Response structure
See on Apiary
Example:
Post-processing processes
No
HTTP status codes
HTTP status code | Message | What caused the error |
---|---|---|
200 | Response |
|
401 | Invalid access token |
|
403 | Invalid scope | |
409 | Error |
Backward compatibility
API paragraph not found