Note |
---|
Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою. |
/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)
Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | [DRAFT] Approve declaration request via Cabinet [API-005-010-002-0195] |
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
N/A
Configuration parameters
N/A
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
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
Expand | ||
---|---|---|
| ||
|
Headers
Request data validation
Authorize
Verify the validity of access token
Return 401 in case validation fails
Check user scopes in order to perform this action (scope = 'declaration_request:write')
Return 403 in case invalid scope(s)
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
Expand | |||||
---|---|---|---|---|---|
| |||||
|
HTTP status codes
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 | 404 | Declaration request was not found | Validation failed | ||
6 | 409 | Declaration request could not be approved for another person | Validation failed | ||
7 | 409 | Wrong declaration request status | |||
8 | 422 | This doctor reaches his limit and could not sign more declarations | Validation failed | ||
9 | Специфічні | ||||
10 |
|
Post-processing processes
N/A
Technical modules where the method is used
Название | ID ТМ | Статус |
---|---|---|
TM0112 | ||