ЕСОЗ - публічна документація

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Purpose

This process is designed to deactivate declaration manually (for NHS admin or patient authorized via Cabinet)

Apiary

https://uaehealthapi.docs.apiary.io/#reference/internal.-ops-db/declarations/terminate-declarations-by-employee-or-person

Authorize user

  1. Verify the validity of access token
  2. Check user scopes declaration:terminate in order to perform this action
    1. In case error - generate 401 response

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

  1. For NHS admin
    1. Search person by $.id
      1. in case error return 404
    2. Search declaration by $.person_id
      1. in case error return 404
    3. Check declaration status = active
      1. in case error return 422. Message:"declaration status is not active"
  2. For authorized patient:
    1. extract person_id from 

Validate employee

  1. Search employee by $.id
    1. in case error return 404
  2. Check if employee is an active doctor (employee_type=DOCTOR and is_active=true)
    1. in case error return 422. Message: "Employee is not an active doctor"
  3. Select all active declarations by $.employee_id
    1. in case error return 422. Message: "Employee does not have active declarations"

Terminate declaration

  1. Change declaration status to `terminated`
  2. If in payload employee_id was set then change reason to `manual_employee`
  3. If in payload person_id was set then change reason to `manual_person`
  • No labels