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

Create confidant person relationship

Purpose

This algorithm is used to create relationship between Confidant Person and Related Person and save it to the table MPI | confidant_person_relationships .

This algorithm is currently used by following WS:

TRUSTED PIS. Confidant patient sign-upUNDEFINED
PIS. Confidant patient sign-up registration
Sign person request

Key points

  1. This procedure uses dataset data to store relationship between two persons from mpi database to confidant_person_relationships and save documens that prove relationship to confidant_person_relationship_documents.

  2. This procedure can be used in different processes and is not limited to specific process.

Specification

{ "confidant_person_id": "70a9e15b-b71b-4caf-8f2e-ff247e8a5677", "person_id": "70a9e15b-b71b-4caf-8f2e-ff247e8a5678", "verification_status": "VERIFICATION_NEEDED", "verification_reason": "ONLINE_TRIGGERED", "confidant_person_relationship_documents": [ { "type": "BIRTH_CERTIFICATE", "number": "АА120518", "issued_by": "Рокитнянським РВ ГУ МВС Київської області", (optional) "issued_at": "2017-02-28" (optional) } ], "inserted_by": "70a9e15b-b71b-4caf-8f2e-ff247e8a5677", (optional) "updated_by": "70a9e15b-b71b-4caf-8f2e-ff247e8a5678", (optional) "active_to": "2022-01-01" (optional) }

Validate confidant person

  • Check if confidant_person_id is not already stored as person_id in confidant_person_relationships table

    • in case of error - return 422 ('Patient who has confidant person can not be used as confidant for other patients')

Validate newness of relationship

  • Call Check confidant person relationship to check if relationship is already exists

    • in case of error - return 422 ('Relationship between confidant patient and related patient already exists')

Service logic

  1. Create relationship between two persons to confidant_person_relationships table where:

    • confidant_person_id = $.confidant_person_id

    • person_id = $.person_id

    • is_active = true

    • verification_status = $.verification_status

    • verification_reason = $.verification_reason

    • inserted_by = $.inserted_by

    • updated_by = $.updated_by

    • active_to = $.active_to (only if active_to is presented in the input parameters, else - leave field empty)

  2. For each item in the confidant_person_relationship_documents array save it to confidant_person_documents table where:

    • confidant_person_relationship_id = relationship.id

    • type = $.confidant_person_relationship_documents[i].type

    • number = $.confidant_person_relationship_documents[i].number

    • issued_at = $.confidant_person_relationship_documents[i].issued_at

    • issued_by = $.confidant_person_relationship_documents[i].issued_by

    • inserted_by = $.inserted_by

    • updated_by = $.updated_by

       

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