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

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 10 Next »

Purpose

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

Specification

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

Example:

 Request example
{
  "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:

 Response example
{
  "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

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

  • No labels