ЕСОЗ - публічна документація
[DRAFT] REST API Reject Medication Request Request [API-005-008-003-0167]
Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.
https://e-health-ua.atlassian.net/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)
- 1 Properties of a REST API method document
- 2 Purpose
- 2.1 Key points
- 3 Logic
- 4 Configuration parameters
- 5 Dictionaries
- 6 Input parameters
- 7 Request structure
- 8 Headers
- 9 Request data validation
- 9.1 Authorize
- 9.2 Validate user
- 9.3 Validate transition
- 10 Processing
- 10.1 Update status
- 11 Response structure examples
- 12 HTTP status codes
- 13 Post-processing processes
- 14 Technical modules where the method is used
Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | [DRAFT] REST API Reject Medication Request Request [API-005-008-003-0167] |
Guideline ID | GUI-0011 |
Author | @ |
Document version | 1 |
Document status | DRAFT |
Date of creation | ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD) |
Date of update | ХХ.ХХ.ХХХХ (дата зміни версії) |
Method API ID | API-005-008-003-0167 |
Microservices (namespace) | IL |
Component | ePrescription |
Component ID | COM-005-008 |
Link на API-специфікацію | |
Resource | {{host}}/api/medication_request_requests/{{id}}/actions/reject |
Scope | medication_request_request:reject |
Protocol type | REST |
Request type | PATCH |
Sync/Async | Sync |
Public/Private | Public |
Purpose
This WS is designed to reject previously created Medication request 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.
Logic
Процеси роботи з випискою електронних рецептів
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
Input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | id | M | String | medication_request_request_id of a request | a89f6a26-4221-4597-a1d2-542d5e40b565 |
Request structure
See on API-specification
Headers
Request data validation
Authorize
Verify the validity of access token
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')
return 403 (“Your scope does not allow to access this resource. Missing allowances: medication_request_request:reject”) in case of invalid scope(s).
Validate user
Medication request request rejection is 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 med_admin from legal entity where Medication request request is created
in case of error - return 409 ("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 .
Processing
Update status
Update Medication request request data in IL DB:
set status = 'REJECTED'
updated_by = user_id
updated_at = now()
if the medication request request is based on the activity with quantity:
Recalculate and set remaining_quantity for the activity as described at Create Medication Request: Validate based_on (p. 2.d.1 ) and do not include current MRR
Response structure examples
See on API-specification
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 |
| 401 | Invalid access token |
| Недійсний токен доступу |
3 |
| 403 | Your scope does not allow to access this resource. Missing allowances: medication_request_request:reject |
| Для вашої ролі відсутній доступ до цього ресурсу. Необхідний доступ на відміну заявки на електронний рецепт |
4 |
| 409 | Employee is not author of medication request request, doesn't have approval or required employee type |
| Ви не є автором заявки на рецепт або не належите до потрібного типу працівника |
5 |
| 409 | Invalid status Request for Medication request for reject transition! |
| Недопустимий статус заявки на відхилення електронного рецепта |
6 | Специфічні | ||||
7 |
|
|
|
|
|
Post-processing processes
N/A
Technical modules where the method is used
Related content
ЕСОЗ - публічна документація