Table of Contents | ||||
---|---|---|---|---|
|
...
This WS is designed to reject previously created Medication request Request (patch)Request.
Key points
Only authenticated and authorized user with appropriate scope can reject Medication request Request.
Medication request Request can be rejected only from ‘NEW' status.
Specification
Page Properties | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Logic
API paragraph not found
...
Verify the validity of access tokenCheck user scope
in case of error - return 401 (“Invalid access token”) in case of validation fails.
Verify that token is not expired
in case of error - return 401 (“Invalid access token”).
Check user scopes in order to perform this action (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 (
return 403 (“Your scope does not allow to access this resource. Missing allowances: medication_request_request
In case error - generate 403 response “Medication request Request can not be rejected by employee from another legal entity”
:reject”) in case of invalid scope(s).
Headers
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Validate request
...
Request data validation
Validate user
Medication request request rejection is allowed for user if he has one of the following active and approved approved employee that 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 med_admin from legal entity where Medication request request is created
in case of error - return 409 ("
...
Request data validation
Validation transition
...
For info - status charts: Medication_request_Request
...
Get Request for Medication request status by $.id
Check status == NEW
...
Employee is not author of medication request request, doesn't have approval or required employee type").
Validate transition
Get status of Medication request request by $.id in IL DB. Check that Medication request request is in status 'NEW'
in case of error - return 409 ("Invalid status Request for Medication request for reject transition!")
...
For more information look at Medication request status model .
Parameters that are used when processing the request
...
Processing
Update status
Update (Set values) Request for Medication request request data in IL DB:
set status = REJECTED 'REJECTED'
updated_by = user_id
updated_at = timestampnow()
Response structure
See on Apiary
...
HTTP status code | Message | What caused the error | ||
---|---|---|---|---|
200 | Response |
| ||
401 | Invalid access token |
| ||
403 | Invalid scope | 409 | ErrorYour scope does not allow to access this resource. Missing allowances: medication_request_request:reject | |
409 |
|
Backward compatibility
API paragraph not found