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

Get merge request by ID

Purpose

Method returns merge request details by it's ID.

Specification

Link

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/merge-request/get-merge-request-by-id

Посилання на Apiary або Swagger

Resource

/api/merge_requests/{{id}}

Посилання на ресурс, наприклад: /api/persons/create

Scope

merge_request:read

Scope для доступу

Components

Patient registry

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

Microservices

il/api

mpi/api

fe/admin-web

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

Protocol type

REST

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

Request type

GET

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

Sync/Async

Sync

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

Public/Private/Internal

Public

Потрібно зазначити тип методу за ступенем доступності

Logic

  1. Only authenticated and authorized SPECIALIST, ASSISTANT or RECEPTIONIST employees can use this WS.

  2. Usage of this WS allowed in EMERGENCY or OUTPATIENT legal entities.

  3. Service returns only merge request related to the same legal entity as the user.

  4. Depending on merge request status different data should returned in response:

    1. if status is NEW, REJECTED or EXPIRED - short data returns, data_to_be_signed field that contains details about person and preperson will be empty (null).

    2. If status is APPROVED or SIGNED - data_to_be_signed field returns. It contains detailed information about person and preperson, printout form e.t.c that will be needed for sign merge request. Data in this field of SIGNED merge request will be avaliable limited period of time which depends on Auto cleaning of person data from merge requests process.

Input parameters

Input parameter

Values

Type

Description

Example

Input parameter

Values

Type

Description

Example

id

 

String

Identifier of the merge request. Required.

7c3da506-804d-4550-8993-bf17f9ee0404

Dictionaries

  • GENDER

  • DOCUMENT_TYPE

  • ADDRESS_TYPE

  • COUNTRY

  • SETTLEMENT_TYPE

  • STREET_TYPE

  • PHONE_TYPE

  • CONFIDANT_PERSON_TYPE

  • PREFERRED_WAY_COMMUNICATION

  • DOCUMENT_RELATIONSHIP_TYPE

  • AUTHENTICATION_METHOD

Request structure

See on Apiary

Authorize

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check scopes in order to perform this action (scope = 'merge_request:read')

    1. Return 403 in case invalid scope(s)

Headers

Content-Type:application/json

Authorization:Bearer {{access_token}}

Api-key:{{secret}}

Request data validation

Validate ID

  1. Check ID exists in merge_requests table

    1. Return 404 in case validation fails

  2. Extract client_id from token and compare it with merge_requests.legal_entity_id

    1. Return 403 in case not match (Client is not allowed to get merge_request)

Processing

Prepare response

Service returns only merge request related to the same legal entity as the user

  1. Return entry with ID from merge_requests table. Use data field to render data_to_be_signed section in response according to next logic:

    1. if status is NEW, REJECTED or EXPIRED - short data returns. Field data_to_be_signed is empty (null).

    2. If status is APPROVED or SIGNED - data_to_be_signed field returns and contains detailed information about person and preperson, printout form etc.

Response structure

See on Apiary

Example:

{ "meta": { "code": 200, "url": "https://example.com/resource", "type": "object", "request_id": "6617aeec-15e2-4d6f-b9bd-53559c358f97#17810" }, "data": { "id": "7c3da506-804d-4550-8993-bf17f9ee0404", "master_person_id": "7c3da506-804d-4550-8993-bf17f9ee0402", "merge_person_id": "7c3da506-804d-4550-8993-bf17f9ee0403", "status": "APPROVED", "inserted_at": "2017-04-20T19:14:13Z", "inserted_by": "e1453f4c-1077-4e85-8c98-c13ffca0063e", "updated_at": "2017-04-20T19:14:13Z", "updated_by": "2922a240-63db-404e-b730-09222bfeb2dd", "data_to_be_signed": { "id": "7c3da506-804d-4550-8993-bf17f9ee0404", "status": "APPROVED", "master_person": { "id": "13001c60-45a0-4b5a-b425-9505e1de18bd", "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "birth_date": "2009-07-05", "birth_country": "Україна", "birth_settlement": "Вінниця", "gender": "MALE", "email": "email@example.com", "no_tax_id": false, "tax_id": "3999869394", "secret": "secret", "documents": [ { "type": "BIRTH_CERTIFICATE", "number": "АА120518", "issued_by": "Рокитнянським РВ ГУ МВС Київської області", "issued_at": "2017-02-28", "expiration_date": "2027-02-28" } ], "addresses": [ { "type": "RESIDENCE", "country": "UA", "area": "Житомирська", "region": "Бердичівський", "settlement": "Київ", "settlement_type": "CITY", "settlement_id": "b075f148", "street_type": "STREET", "street": "вул. Ніжинська", "building": "15", "apartment": "23", "zip": "02090" } ], "phones": [ { "type": "MOBILE", "number": "+380503410870" } ], "unzr": "20090705-00011", "emergency_contact": { "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "phones": [ { "type": "MOBILE", "number": "+380503410870" } ] }, "confidant_person": [ { "relation_type": "PRIMARY", "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "birth_date": "1972-10-26", "birth_country": "Україна", "birth_settlement": "Вінниця", "gender": "MALE", "tax_id": "2659719350", "secret": "secret", "unzr": "19900101-00099", "preferred_way_communication": "email", "documents_person": [ { "type": "PASSPORT", "number": "АА120518", "expiration_date": "2021-02-28", "issued_by": "Рокитнянським РВ ГУ МВС Київської області", "issued_at": "2017-02-28" } ], "documents_relationship": [ { "type": "BIRTH_CERTIFICATE", "number": "АА120518", "issued_by": "Рокитнянським РВ ГУ МВС Київської області", "issued_at": "2017-02-28" } ], "phones": [ { "type": "MOBILE", "number": "+380503410870" } ], "email": "emaill@example.com" } ], "preferred_way_communication": "email" }, "patient_signed": false, "merge_person": { "external_id": "#1234-FDS-aa", "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "gender": "MALE", "birth_date": "1980-01-01", "emergency_contact": { "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "phones": [ { "type": "MOBILE", "number": "+380503410870" } ] }, "id": "7c3da506-804d-4550-8993-bf17f9ee0402", "note": "Registered in SmartMed clinic at 01.01.2019 16:40. Male, 40 years old approximately, tatoo with sport motorcycle on the right forearm" }, "content": "HTML" } }, "urgent": { "authentication_method_current": [ { "type": "OTP", "phone_number": "+38093*****85" } ], "documents": [ { "type": "PASSPORT", "url": "https://storage.ehealth.world" } ] } }

HTTP status codes

HTTP status code

Message

What caused the error

HTTP status code

Message

What caused the error

 200

 Response

 

 401

 Access token validation failed

Validation failed

403

Client is not allowed to get merge_request

Invalid scope

404

 

Check that ID exists in merge_requests table failed

 

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