ЕСОЗ - публічна документація
Terminate declarations by employee or person
Purpose
This process is designed to deactivate declaration manually (for NHS admin or patient authorized via Cabinet).
Specification
Link | |
Resource | /declarations/terminate |
Scope | declaration:terminate |
Components | Declarations |
Microservices | il/api ops/api |
Protocol type | REST |
Request type | PATCH |
Sync/Async | Sync |
Public/Private/Internal | Internal |
Logic
API paragraph not found
Input parameters
No
Filters
No
Dictionaries
API paragraph not found
Request structure
Example:
Authorize
Verify the validity of access token
Check user scopes declaration:terminate in order to perform this action
In case error - generate 401 response.
Headers
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:
Post-processing processes
API paragraph not found
HTTP status codes
HTTP status code | Message | What caused the error |
---|---|---|
200 | Response |
|
401 |
| 2. Check of the user`s scope failed |
404 | Error |
|
422 | Error |
|
Backward compatibility
API paragraph not found
ЕСОЗ - публічна документація