Page Properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||
|
REST API method / Метод REST API (настанова) (remove the link block before publishing the document)
Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | Approve declaration request via Cabinet |
Guideline ID | GUI-0011 |
Author | |
Document version | 1 |
Document status | DRAFT |
Date of creation | ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD) |
Date of update | ХХ.ХХ.ХХХХ (дата зміни версії) |
Method API ID | API-005-010-002-0195 |
Microservices (namespace) | IL |
Component | Patient Cabinet |
Component ID | COM-005-010 |
Link на API-специфікацію | |
Resource | {{host}}/api/cabinet/declaration_requests/{{id}}/actions/approve |
Scope | declaration_request:write |
Protocol type | REST |
Request type | PATCH |
Sync/Async | Sync |
Public/Private | Public |
Purpose
This WS is created to approve declaration request online via Cabinet by patient.
After /wiki/spaces/PCAB/pages/583401903 it has to be approved. Declaration request that was created online could be approved only online by a patient. Declaration request that was created offline in Clinic by Doctor could be apporoved offline by employees of a Clinic only. While the patient in cabinet always has auth method otp, sms is not checked on online approve. Each patient could approve only their own declaration request.
Logic
Description of the working algorithm of the API method and the interaction of services with each other add Service logic (if necessary)
Configuration parameters
Description of the configuration parameters that are used when processing a request in the system
Dictionaries
PHONE_TYPE
CONFIDANT_PERSON_TYPE
GENDER
PREFERRED_WAY_COMMUNICATION
DOCUMENT_TYPE
DOCUMENT_RELATIONSHIP_TYPE
POSITION
EMPLOYEE_TYPE
EMPLOYEE_STATUS
COUNTRY
EDUCATION_DEGREE
QUALIFICATION_TYPE
SPECIALITY_TYPE
SPECIALITY_LEVEL
SPEC_QUALIFICATION_TYPE
SCIENCE_DEGREE
ADDRESS_TYPE
SETTLEMENT_TYPE
STREET_TYPE
LEGAL_FORM
Input parameters
Description of input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | id |
| String | Declaration request id. Required. | b075f148-7f93-4fc2-b2ec-2d81b19a9b7b |
2 |
|
|
|
|
|
Request structure
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API request structure, example
Expand | ||
---|---|---|
| ||
|
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 request
check $.id exists in il.declaration_requests.id
in case error return 404 "Declaration request was not found"
Check channel
if channel = CABINET do not check authentication method and do not check sms
if channel = MIS return error 403 "Declaration request should be approved by Doctor"
Validate user
get user_id from token
check if users.person_id=$.declaration_request.mpi_id
in case error return 409 - "Declaration request could not be approved for another person"
Check doctor's limit
Get employee.id from declaration request
get party for employee_id
Find all employees in status= 'APPROVED' for the party. Count all declaration in status='active' for these employees.
If amount of declaration for party >= parties.declaration_limit and declaration.overlimit is not true
return error 422 - This doctor reaches his limit and could not sign more declarations
Declaration request status
Check declaration status = 'NEW'
in case error return 409 "Wrong declaration request status"
Processing
Change declaration request status
Change entity status in IL_DB.declaration_request to APPROVED
Response structure examples
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API response structure, example
Expand | ||
---|---|---|
| ||
|
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description |
---|
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 | 200 | Response |
| ||
3 | 401 |
| Validation failed | ||
4 | 403 | Declaration request should be approved by Doctor | Invalid scope(s) | ||
5 | 1000 | 404 | Composition not found | COMPOSITION_NOT_FOUND_404 | Не знайдено медичний висновок |
6 | 404 | Declaration request was not found | Validation failed | ||
7 | 401 | Unauthorized |
| Помилка підтвердження | |
8 | 409 | Declaration request could not be approved for another person | Validation failed | ||
9 | 409 | Wrong declaration request status | |||
10 | 422 | This doctor reaches his limit and could not sign more declarations | Validation failed | ||
11 | Специфічні | ||||
12 |
| 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
Название | ID ТМ | Статус |
---|---|---|
TM0112 | ||