REST API method / Метод REST API (настанова) (remove the link block before publishing the document)
Properties of a REST API method document
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
MEDICATION_REQUEST_BLOCK_REASON
MEDICATION_REQUEST_INTENT
MEDICATION_REQUEST_CATEGORY
MEDICATION_REQUEST_PRIORITY
eHealth/SNOMED/additional_dosage_instructions
eHealth/SNOMED/anatomical_structure_administration_site_codes
eHealth/SNOMED/route_codes
eHealth/SNOMED/administration_methods
eHealth/SNOMED/dose_and_rate
eHealth/ICD10_AM/condition_codes
eHealth/ICPC2/condition_codes
Input parameters
Description of input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | id |
| String | Required | a89f6a26-4221-4597-a1d2-542d5e40b565 |
2 |
Request structure
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API request structure, example
Headers
Key | Value | Mandatory | Description | Example | |
---|---|---|---|---|---|
1 | Content-Type | application/json | M | Тип контенту | Content-Type:application/json |
2 | Authorization | Bearer c2778f3064753ea70de870a53795f5c9 | M | Перевірка користувача | Authorization:Bearer c2778f3064753ea70de870a53795f5c9 |
3 |
Request data validation
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 (посилання на сторінку з API-специфікацією)
Description of the REST API response structure, example
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 | 200 | Response |
| ||
3 | 401 | Invalid access token |
| ||
4 | 401 | Unauthorized | Помилка підтвердження | ||
5 | 403 | Your scope does not allow to access this resource. Missing allowances: medication_request_request:reject |
| ||
6 | 1000 | 404 | Composition not found | COMPOSITION_NOT_FOUND_404 | Не знайдено медичний висновок |
7 | 409 | Employee is not author of medication request request, doesn't have approval or required employee type | |||
8 | 409 | Invalid status Request for Medication request for reject transition! | |||
9 | |||||
10 | Специфічні | ||||
11 | 422 | Only for active MPI record can be created medication request! |
Post-processing processes
Description of actions performed on data after processing
Technical modules where the method is used
List of pages describing technical modules where the method is used