Versions Compared

Key

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

Purpose

This method is used to create Declaration Request (as part of Declaration creation process) via new api.

Створення декларації (версія 3)

Specification

...

Link

...

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/declaration-requests/create-declaration-request-v3

...

Resource

...

/api/v3/declaration_requests

...

Scope

...

declaration_request:write

...

Components

...

Declarations

...

Using Dictionaries

...

API paragraph not found

...

Using Microservices

...

API paragraph not found

...

Protocol type

...

REST

...

Request type

...

POST

...

Sync/Async

...

Sync

...

Public/Private/Internal

...

Public

Logic

This method allows you to create a declaration only for an existing person.

To create declaration request based on active declaration in reorganized legal entity, parent_declaration_id must be passed in request

Global and configuration parameters

Invoke Global parameters to get following parameters:

  • ADULT_AGE

  • DECLARATION_TERM

  • no_self_auth_ag 

Request structure

Example:

Expand
titleRequest example
Code Block
{
  "person_id": "4d0d790c-cbf1-44f5-ab21-ba8db67da161",
  "employee_id": "1a8b10ea-ba09-40f2-8f9e-55608e9208c6",
  "division_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "authorize_with": "cc949559-5dfe-420f-ac05-065e443b2cc6",
  "parent_declaration_id": "8c7753fc-a647-435f-8e43-4ff4546431f6"
}

Authorize

  1. Verify the validity of access token

    1. in case error return 401 

  2. Check users scopes (declaration_request:write) to perform this action

    1. in case error return 403 - forbidden

Request to process the request using a token in the headers

Headers

  • Content-Type:application/json

  • Authorization:Bearer c2778f3064753ea70de870a53795f5c9

  • api-key:uXhEczJ56adsfh3Ri9SUkc4en

Validate request

...

titleJson schema
Code Block
 {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "person_id": {
      "type": "string"
    },
    "employee_id": {
      "type": "string"
    },
    "division_id": {
      "type": "string"
    },
    "authorize_with": {
      "type": "string"
    },
    "parent_declaration_id": {
      "type": "string"
    }
  },
  "required": [
    "person_id",
    "employee_id",
    "division_id"
  ]
}

Validation data request

Validate Legal Entity Type

Validate legal entity from token:  legal_entities.type should be in DECLARATION_REQUEST_LEGAL_ENTITY_TYPES("MSP,PRIMARY_CARE,MSP_PHARMACY") and legal_entities.status =='active' 

Validate doctor

...

Get employee details

Invoke Get employee details

Validate Response $.data.employee_type == DOCTOR

Take the doctor_id and the division_id from the token

Validate person 

  • validate person_id UUID

    • in case error return 422

  • search person by person_id in MPI 

    • in case error return 404, "Such person doesn't exist"

  • validate person.auth_method != NA

    • in case error return 422, "Person must have authentication method"

  • validate person.status = ‘active’ and is_active =true

    • in case error return 404, "Such person doesn't exist"

Validate person verification status

  • validate patient's verification_status is not equal to NOT_VERIFIED.

    • in case of error return 409, "Patient is not verified"

Validate authorize_with

The person can pass the id of his auth_method which he wants to confirm the create declaration request. The necessary auth method can be found by making Get person's auth methods

...

validate auth_method.id is UUID

  1. in case error return 422

...

search auth method in MPI.person_authentication_method

  1. in case error return 422, "such authentication method doesn't exist"

...

search auth method of this person where  MPI.person_authentication_method.person_id = $.person.id

  1. in case error return 422, "such authentication method does not belong to this person"

...

validate that auth_method.type = NA

  1. in case error return 422, "Сannot be confirmed by a method with type= NA. Use a different method."

...

Table of Contents
minLevel1
maxLevel3

Purpose

This method is used to create Declaration Request (as part of Declaration creation process) via new api.

Створення декларації (версія 3)

Specification

Link

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/declaration-requests/create-declaration-request-v3

Resource

/api/v3/declaration_requests

Scope

declaration_request:write

Components

Declarations

Using Dictionaries

API paragraph not found

Using Microservices

API paragraph not found

Protocol type

REST

Request type

POST

Sync/Async

Sync

Public/Private/Internal

Public

Logic

This method allows you to create a declaration only for an existing person.

To create declaration request based on active declaration in reorganized legal entity, parent_declaration_id must be passed in request

Global and configuration parameters

Invoke Global parameters to get following parameters:

  • ADULT_AGE

  • DECLARATION_TERM

  • no_self_auth_ag 

Request structure

Example:

Expand
titleRequest example
Code Block
{
  "person_id": "4d0d790c-cbf1-44f5-ab21-ba8db67da161",
  "employee_id": "1a8b10ea-ba09-40f2-8f9e-55608e9208c6",
  "division_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "authorize_with": "cc949559-5dfe-420f-ac05-065e443b2cc6",
  "parent_declaration_id": "8c7753fc-a647-435f-8e43-4ff4546431f6"
}

Authorize

  1. Verify the validity of access token

    1. in case error return 401 

  2. Check users scopes (declaration_request:write) to perform this action

    1. in case error return 403 - forbidden

Request to process the request using a token in the headers

Headers

  • Content-Type:application/json

  • Authorization:Bearer c2778f3064753ea70de870a53795f5c9

  • api-key:uXhEczJ56adsfh3Ri9SUkc4en

Validate request

Expand
titleJson schema
Code Block
 {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "person_id": {
      "type": "string"
    },
    "employee_id": {
      "type": "string"
    },
    "division_id": {
      "type": "string"
    },
    "authorize_with": {
      "type": "string"
    },
    "parent_declaration_id": {
      "type": "string"
    }
  },
  "required": [
    "person_id",
    "employee_id",
    "division_id"
  ]
}

Validation data request

Validate Legal Entity Type

Validate legal entity from token:  legal_entities.type should be in DECLARATION_REQUEST_LEGAL_ENTITY_TYPES("MSP,PRIMARY_CARE,MSP_PHARMACY") and legal_entities.status =='active' 

Validate doctor

...

Get employee details

Invoke Get employee details

Validate Response $.data.employee_type == DOCTOR

Take the doctor_id and the division_id from the token

Validate person 

  • validate person_id UUID

    • in case error return 422

  • search person by person_id in MPI 

    • in case error return 404, "Such person doesn't exist"

  • validate person.auth_method != NA

    • in case error return 422, "Person must have authentication method"

  • validate person.status = ‘active’ and is_active =true

    • in case error return 404, "Such person doesn't exist"

Validate person verification status

  • validate patient's verification_status is not equal to NOT_VERIFIED.

    • in case of error return 409, "Patient is not verified"

Validate authorize_with

The person can pass the id of his auth_method which he wants to confirm the create declaration request. The necessary auth method can be found by making Get person's auth methods

  1. validate auth_method.id is UUID

    1. in case error return 422

  2. search auth method in MPI.person_authentication_method

    1. in case error return 422, "such authentication method doesn't exist"

  3. search auth method of this person where  MPI.person_authentication_method.person_id = $.person.id

    1. in case error return 422, "such authentication method does not belong to this person"

  4. validate that auth_method.type = NA

    1. in case error return 422, "Сannot be confirmed by a method with type= NA. Use a different method."

  5. validate that this method is active ( authentication_method.ended_at > now() and is_active = true)

This field is optional and set in il.declaration_reques.authentication_method_current.

If person request doesn't have this field, then choose that method which is returned from mpi as person's default method

Validate parent declaration

  • check that parent declaration exists and in status ‘active’

    • in case of error - return 404 (‘Active parent declaration was not found’)

  • check that the parent declaration belongs to a person (person_id of parent declaration and person_id from request are the same)

    • in case of error - return 422 (‘Parent declaration does not belong to this person’)

  • check that the legal entity of parent declaration and the current legal entity are in reorganization process with types ACCESSION, MERGING, DIVIDING, SEPARATING (request: select * from related_legal_entities where is_active=true and merged_from_id=parent_declaration_id.legal_entity_id and merged_to_id=employee_id.legal_entity_id and type in (‘ACCESSION’, ‘MERGING’, ‘DIVIDING’, ‘SEPARATING’); returns at least one record)

    • in case of error - return 422 (‘Legal entities of parent declaration and current are not in reorganization process’)    

  • check that party_id of employee from parent declaration and party_id of current employee are the same

    • in case of error - return 422 (‘Employee of parent declaration and current employee are not the same’)

This field is optional and set in il.declaration_reques.authenticationparent_methoddeclaration_currentid.

If person request doesn't have this field, then choose that method which is returned from mpi as person's default methodparent_declaration_id is passed in request, authorize_with validation and processing must be skipped, created declaration request will be processed without patients involvement.

Calculate patient age

Calculate patient age

...

Each link is generated for one one-page document in jpeg format. Document should be no more than 10MB.

Set auth_method_current

Set jpeg format. Document should be no more than 10MB.

Set auth_method_current

Get parent_declaration_id from il.declaration_requests.parent_declaration_id.

If parent_declaration_id is null, set default auth method of person on IL.auth_method_request.auth_method_current - use function in mpi, that return default auth method.

If auth_method_current = NA - return Error "person authentication method is undefined".

If parent_declaration_id is not null, set auth_method_current = NA (request is processed without patients involvement).

Generate verification code

...