Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
REST API method / Метод REST API (настанова)
Info
Note

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

Info

/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)

Table of Contents

Properties of a REST API method document

Page Properties
idpage_properties_method_REST API

Document type

Метод REST API

Document title

[Document status] REST API [Назва методу] [ID методу]DRAFT] Get Employee details [API-005-007-001-0098]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

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

Date of update

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

Method API ID

API-005-007-001-0098

Microservices (namespace)

IL

Component

Employees

Component ID

COM-005-007

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

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/employees/get-employee-details

Resource

{{host}}/api/employees/{{employee_id}}

Scope

employee:details

Protocol type

REST

Request type

GET

Sync/Async

Sync

Public/Private

Public

Purpose

This method is designed to obtain all Employees of the legal entity.

Logic

  1. Search in the legal_entity by :legal_entity_id (legal_entity_id from Context)

  2. return error if not found

  3. Search in the employee by :employee_id and is_active = true

    1. return error if not found

  4. Check employee.employee_type

    1. employee_type in (DOCTOR, PHARMACIST)

      1. Return doctor, pharmacist response structure

    2. employee_type in (HR, ACCOUNTANT, OWNER, PHARMACY_OWNER)

      1. Return other employee type response structure.

Service logic

Service returns specified Employee related to the legal entity from token:

  1. Get Employee by ID from prm.employees

    1. Filter by medication_request_id and patient_id and status (optional)

  2. Validate data consistency:

    1. Ensure that requested Employee relates to the legal entity from token:

      1. Return 403 ('Access denied') in case of error

  3. Render a response according to specification with found Employee:

    1. render a response structure depends on employee types

    2. get parties.specialities, for each  parties.specialities.speciality check condition if parties.specialities.speciality<>employee.speciality.speciality then set speciality_officio=false and add to employees.speciality else don't add to response.

Configuration parameters

Description of the configuration parameters that are used when processing a request in the systemN/A

Dictionaries

  • +DIVISION_TYPE

  • LEGAL_FORM

  • OWNER_PROPERTY_TYPE

  • EMPLOYEE_TYPE

  • +DOCUMENT_TYPE

  • PHONE_TYPE

  • EDUCATION_DEGREE

  • COUNTRY

  • QUALIFICATION_TYPE

  • SPECIALITY_TYPE

  • SPECIALITY_LEVEL

  • SPEC_QUALIFICATION_TYPE

  • SCIENCE_DEGREE

  • LEGAL_ENTITY_TYPE_V2

Input parameters

Description of input parameters

Input parameter

Mandatory

Type

Description

Example

1

employee_id

 

String

Required

d290f1ee-6c54-4b01-90e6-d701748f0851

2

Request structure

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

Description of the REST API request structure, example

Expand
titleExample
Code Block

Headers

...

Headers

...

Value

...

Mandatory

...

Description

...

Example

...

Content-Type

...

application/json

...

M

...

Тип контенту

...

Content-Type:application/json

...

Authorization

...

Bearer c2778f3064753ea70de870a53795f5c9

...

M

...

Перевірка користувача

...

Authorization:Bearer c2778f3064753ea70de870a53795f5c9

...

Request data validation

Describe the process of checking the input data transmitted in the request for compliance with the given rules and restrictions set in the API

Processing

...

Request data validation

Authorize

  • Verify the validity of access token

    • Return (401, 'Invalid access token') in case of validation fails

  • Verify that token is not expired

    • in case of error - return (401, 'Invalid access token')

  • Check user scopes in order to perform this action (scope = 'employee:details')

    • Return (403, 'Your scope does not allow to access this resource. Missing allowances: employee:details') in case of invalid scope(s)

Processing

N/A

Response structure examples

Additional info with educations, qualifications, science degree and specialities are stored in prm.parties, however speciality.speciality_officio=true is also saved to prm.employees.

  1. For Get Employee Details 

    1. get employees.speciality

    2. get parties.specialities, for each  parties.specialities.speciality check condition if parties.specialities.speciality<>employee.speciality.speciality then set speciality_officio=false and add to employees.speciality else don't add to response.

    3. form array of specialities as in example below

DOCTOR, SPECIALIST, ASSISTANT, PHARMACIST, MED_ADMIN, LABORANT or MED_COORDINATOR

Expand
titleResponse body
Code Block
languagejson
{
    "data": {
        "division": {
            "id": "1e24e73c-835f-44a5-9726-b6c4bd81225b",
            "legal_entity_id": "1ee3e298-4d6a-4c41-be48-a7b646477f60",
            "mountain_group": false,
            "name": "Відділення Клініки NoName",
            "status": "ACTIVE",
            "type": "CLINIC"
        },
        "doctor": {
            "educations": [
                {
                    "city": "Київ",
                    "country": "UA",
                    "degree": "MASTER",
                    "diploma_number": "DD123543",
                    "institution_name": "Академія Богомольця",
                    "issued_date": "2017-08-05",
                    "speciality": "Педіатр"
                }
            ],
            "qualifications": [
                {
                    "certificate_number": "2017-08-05",
                    "institution_name": "Академія Богомольця",
                    "issued_date": "2017-08-05",
                    "speciality": "Педіатр",
                    "type": "STAZHUVANNYA"
                }
            ],
            "science_degree": {
                "city": "Київ",
                "country": "UA",
                "degree": "CANDIDATE_OF_SCIENCE",
                "diploma_number": "DD123543",
                "institution_name": "Академія Богомольця",
                "issued_date": "2017-08-05",
                "speciality": "FAMILY_DOCTOR"
            },
            "specialities": [
                {
                    "attestation_date": "2017-08-05",
                    "attestation_name": "Академія Богомольця",
                    "certificate_number": "AB/21331",
                    "level": "FIRST",
                    "qualification_type": "AWARDING",
                    "speciality": "FAMILY_DOCTOR",
                    "speciality_officio": true,
                    "valid_to_date": "2017-08-05"
                }
            ]
        },
        "employee_type": "DOCTOR",
        "end_date": null,
        "id": "91b5d4ea-a443-44ff-b048-a5b36f4d3e8c",
        "legal_entity": {
            "edrpou": "3173108921",
            "id": "1ee3e298-4d6a-4c41-be48-a7b646477f60",
            "legal_form": "140",
            "mis_verified": "VERIFIED",
            "name": "Клініка NoName",
            "owner_property_type": "STATE",
            "public_name": "NoName Медікал",
            "short_name": "NoName Медікал",
            "status": "ACTIVE",
            "type": "MSP"
        },
        "party": {
            "about_myself": null,
            "birth_date": "1983-07-11",
            "declaration_count": 0,
            "declaration_limit": 0,
            "documents": [
                {
                    "number": "120518",
                    "type": "PASSPORT"
                }
            ],
            "first_name": "Виктор",
            "gender": "MALE",
            "id": "431f8bab-0aaf-45ac-9839-1434165d424e",
            "last_name": "Квітка-Основ'яненко",
            "no_tax_id": false,
            "phones": [
                {
                    "number": "+380503410870",
                    "type": "MOBILE"
                }
            ],
            "second_name": "Сергеевич",
            "tax_id": "3067305998",
            "working_experience": null
        },
        "position": "P1",
        "start_date": "2017-03-02",
        "status": "APPROVED"
    },
    "meta": {
        "code": 200,
        "request_id": "ed5924b9-ed79-46f2-bfc2-9142a621fb15#71181",
        "type": "object",
        "url": "http://api-svc.il/api/employees/91b5d4ea-a443-44ff-b048-a5b36f4d3e8c"
    }
}HR, ACCOUNTANT, OWNER, PHARMACY_OWNER

HR, ACCOUNTANT, OWNER, PHARMACY_OWNER

Expand
titleResponse body
Code Block
languagejson
{
  "meta": {
    "url": "http://example.com/resource",
    "type": "object",
    "code": 200,
    "idempotency_key": "idemp-ssjssdjoa8308u0us0",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": {
    "legal_entity_id": "d290f1ee",
    "division_id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
    "title": "рекрутер",
    "speciality": "рекрутинг",
    "start_date": "2017-03-02T10:45:16.000Z",
    "end_date": "2018-03-02T10:45:16.000Z",
    "active": true,
    "status": "pending_verification",
    "employee_type": "hr",
    "party": {
      "first_name": "Петро",
      "last_name": "Іванов",
      "second_name": "Миколайович",
      "birth_date": "1991-08-19T00:00:00.000Z",
      "gender": "MALE",
      "tax_id": "3126509816",
      "national_id": "CC7150985243",
      "email": "email@example.com",
      "documents": [
        {
          "type": "PASSPORT",
          "number": "120518",
          "issue_date": "2015-04-07T00:00:00.000Z",
          "expiry_date": "2015-04-07T00:00:00.000Z",
          "issued_by": "DMSU"
        }
      ],
      "phones": [
        {
          "type": "MOBILE",
          "number": "+380503410870"
        }
      ]
    },
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
  }
}

See on API-specification (посилання на сторінку з API-специфікацією)Description of the REST API response structure, example

Expand
titleExample
Code Block

HTTP status codes

5Only for active MPI record can be created medication request!

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

200

Response

 

3

401

Invalid access token

 

4

401

Unauthorized

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

4

403

Access denied

65

403

Your scope does not allow to access this resource. Missing allowances: employee:details

 

7

1000

404

Composition not found

COMPOSITION_NOT_FOUND_404

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

8

Специфічні

9

422

6

Специфічні

7

Post-processing processes

Description of actions performed on data after processing

Technical modules where the method is used

List of pages describing technical N/A

Technical modules where the method is used

Page Properties Report
headingsID ТМ, Статус
cqllabel = "tr-mis"

...