Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Purpose

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

Specification

Page Properties
Тип протоколу, який використовується запитом, наприклад: SOAP |

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:terminateScope для доступу

Components

Declarations

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

API paragraph not found

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

REST

Microservices

il/api

ops/api

Protocol type

REST

Request type

PATCH

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

Sync

Метод є синхронним чи асинхронним?

Logic

API paragraph not found

...

Public/Private/Internal

Internal

Logic

API paragraph not found

Global and configurable parameters

No

Input parameters

No

Filters

No

Dictionaries

API paragraph not found

Request structure

...

Example:

Expand
titleRequest example
Code Block
{
  "employee_id": "73ebee6e-b9d9-41b0-b2ad-ab7704d5306e",
  "person_id": "50320ee5-2bca-472c-a1a0-28e2e003ec2a",
  "reason_description": "Згідно постанови 1 від 10.01.2017"
}

Authorize

  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.

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

  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".

Processing

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`.

Response structure

...

Example:

Expand
titleResponse example
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

  1. Invalid access token

  2. 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