Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.

Page Properties
idpage_properties_method_REST API

Document type

Метод REST API

Document title

[Document status] REST API [Назва методу] [ID методу]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)

Date of update

ХХ.ХХ.ХХХХ (дата зміни версії)

Method API ID

API-005-004-001-0067

Microservices (namespace)

IL

Component

Declarations

Component ID

COM-005-004

Link на API-специфікацію

Resource

{{host}}/declarations/terminate

Scope

declaration:terminate

Protocol type

REST

Request type

PATCH

Sync/Async

Sync

Public/Private

Private

Purpose

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

Logic

Description of the working algorithm of the API method and the interaction of services with each other add Service logic (if necessary)

Configuration parameters

Description of the configuration parameters that are used when processing a request in the system

Dictionaries

Provides a list of links to dictionaries that are available in Confluence

Input parameters

Description of input parameters

Input parameter

Mandatory

Type

Description

Example

1

composition_id

 M

String ($uuid) (path)

Composition object ID

 89678f60-4cdc-4fe3-ae83-e8b3ebd35c59

2

 

 

 

 

 

Request structure

See on API-specification (посилання на сторінку з API-специфікацією)

Description of the REST API request structure, example

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

Headers

Key

Value

Mandatory

Description

Example

1

Content-Type

application/json

M

Тип контенту

Content-Type:application/json

2

3

 

 

 

 

 

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 examples

See on API-specification (посилання на сторінку з API-специфікацією)

Description of the REST API response structure, example

Expand
titleExample
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
  }
}

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

200

Response

 

3

401

  1. Invalid access token

  2. Error

  1. Check of the user`s scope failed

4

401

Unauthorized

 

Помилка підтвердження

5

1000

404

Composition not found

COMPOSITION_NOT_FOUND_404

Не знайдено медичний висновок

6

404

Error

Search employee by $.id failed

7

404

Error

Search person by $.id failed

8

404

Error

Search declaration by $.person_id

9

422

Error

Declaration status is not active

10

 

422

Error

Employee does not have active declarations

11

422

Error

Employee is not an active doctor

12

Специфічні

13

 

422

Only for active MPI record can be created medication request!

 

 

Post-processing processes

Description of actions performed on data after processing

Technical modules where the method is used

List of pages describing technical modules where the method is used