Purpose
This process is designed to deactivate declaration manually (for NHS admin or patient authorized via Cabinet).
Specification
Page Properties |
---|
Link | https://uaehealthapi.docs.apiary.io/#reference/internal.-ops-db/declarations/terminate-declarations-by-employee-or-person | Посилання на Apiary або Swagger | Resource | /declarations/terminate | Посилання на ресурс, наприклад: /api/persons/create | Scope | declaration:terminate | Scope для доступу | Components | Declarations | Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription | Microservices | API paragraph not found | Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC | Protocol type | REST | Тип протоколу, який використовується запитом, наприклад: SOAP | REST | Request type | PATCH | Тип запиту API, наприклад: GET, POST, PATCH… | Sync/Async | Sync | Метод є синхронним чи асинхронним? | Public/Private/Internal | Internal | Потрібно зазначити тип методу за ступенем доступності |
|
Logic
API paragraph not found
Preconditions
API paragraph not found
Global and configurable parameters
No
Input parameters
No
Filters
No
Dictionaries
API paragraph not found
Request structure
See on Apiary
Example:
Expand |
---|
|
Code Block |
---|
{
"employee_id": "73ebee6e-b9d9-41b0-b2ad-ab7704d5306e",
"person_id": "50320ee5-2bca-472c-a1a0-28e2e003ec2a",
"reason_description": "Згідно постанови 1 від 10.01.2017"
} |
|
Authorize
Verify the validity of access token
Check user scopes declaration:terminate in order to perform this action
In case error - generate 401 response.
Content-Type:application/json
Request data validation
Validate request
One of parameter person_id or employee_id
must be set. Also can be added the description field: reason_description.
Patient via cabinet can terminate only his own active declaration.
Validate person
For NHS admin
Search person by $.id
in case error return 404
Search declaration by $.person_id
in case error return 404
Check declaration status = active
in case error return 422. Message:"declaration status is not active".
For authorized patient:
extract person_id from.
Validate employee
Search employee by $.id
in case error return 404.
Check if employee is an active doctor (employee_type=DOCTOR and is_active=true)
in case error return 422. Message: "Employee is not an active doctor".
Select all active declarations by $.employee_id
in case error return 422. Message: "Employee does not have active declarations".
Processing
Terminate declaration
Change declaration status to `terminated`
If in payload employee_id
was set then change reason to `manual_employee`
If in payload person_id
was set then change reason to `manual_person`.
Response structure
...
Example:
Expand |
---|
|
Code Block |
---|
{
"meta": {
"code": 200,
"url": "https://example.com/resource",
"type": "object",
"request_id": "6617aeec-15e2-4d6f-b9bd-53559c358f97#17810"
},
"data": [
{
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"employee_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"division_id": "`d290f1ee-6c54-4b01-90e6-d701748f0851`m",
"scope": "family_doctor",
"start_date": "2017-03-02",
"end_date": "2017-03-02",
"signed_at": "2017-03-02T10:45:16.000Z",
"person": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"first_name": "Петро",
"last_name": "Іванов",
"second_name": "Миколайович"
},
"legal_entity": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"name": "Клініка Ноунейм",
"short_name": "Ноунейм",
"public_name": "Клініка Ноунейм",
"type": "MSP",
"edrpou": "5432345432",
"status": "ACTIVE"
},
"declaration_request_id": "74a6fae6-4207-4e03-a136-f2e70c6b0c02",
"reason": "manual_employee",
"reason_description": "Згідно постанови 1 від 10.01.2017"
}
],
"paging": {
"page_number": 2,
"page_size": 50,
"total_entries": 1000,
"total_pages": 23
}
} |
|
Post-processing processes
API paragraph not found
HTTP status codes
Page Properties |
---|
HTTP status code | Message | What caused the error |
---|
200 | Response | | 401 | Invalid access token Error
| 2. Check of the user`s scope failed | 404 | Error | Search employee by $.id failed Search person by $.id failed Search declaration by $.person_id
| 422 | Error | Declaration status is not active Employee does not have active declarations Employee is not an active doctor
|
|
Backward compatibility
API paragraph not found