Table of Contents |
---|
...
Check that confidant person relationship request from URL exists in https://e-health-ua.atlassian.net/wiki/spaces/CSIEH/pages/17613422609724271171/IL#confidant_person_relationship_requests table with person_id = person_id from URL
in case of error - return 404('Confidant person relationship request is not found')
Check that confidant person relationship request from URL has status = NEW
in case of error - return 409 ('Invalid transition')
Check absence of extra parameters from request
in case of error - return 422 ('schema does not allow additional properties')
...
Create confidant person relationship between person and confidant person:
Call /wiki/spaces/CSI/pages/17612832814 RC_(CSI-1323)_Create Confidant Person relationship request , set values:
person_id = confidant_person_relationship_request.person_id
confidant_person_id = confidant_person_relationship_request.confidant_person_id
verification_status = “VERIFICATION_NEEDED”
verification_reason based on relationship document:
if
documents_relationship
contains document with type BIRTH_CERTIFICATE, set verification_reason = “ONLINE_TRIGGERED”if
documents_relationship
does not contain document with type BIRTH_CERTIFICATE, set verification_reason = “MANUAL_CREATED_BY_DOCTOR”
confidant_person_relationship_documents = confidant_person_relationship_request.confidant_person_relationship.documents_relationship
In case if persons age < person_full_legal_capacity_age years old:
calculate relationship_expiration_date - date when person becomes person_full_legal_capacity_age years old
check if $.active_to <= relationship_expiration_date
if true - set active_to = $.active_to
if false or $.active_to = null - set active_to = relationship_expiration_date
...
Deactivate relationship record in relationship https://e-health-ua.atlassian.net/wiki/spaces/CSIEH/pages/17613488166724729917/MPI#confidant_person_relationships table where id =
confidant_person_relationship_id
and is_active = true, set values:active_to = now()
updated_at = now()
updated_by = user_id (from token)
Save documents from documents_relationship field to https://e-health-ua.atlassian.net/wiki/spaces/CSIEH/pages/17613488166724729917/MPI#confidant_person_relationship_documents table for deactivated confidant person relationship, set values:
id = autogenerate uuid
confidant_person_relationship_id =
confidant_person_relationship_id
of deactivated relationshiptype =
documents_relationship[i].type
number =
documents_relationship[i].number
issued_at =
documents_relationship[i].issued_at
issued_by =
documents_relationship[i].issued_by
inserted_by = user_id (from token)
updated_by = user_id (from token)
inserted_at = now()
updated_at = now()
For deactivated relationship - deactivate person authentication methods in https://e-health-ua.atlassian.net/wiki/spaces/CSIEH/pages/17613488166724729917/MPI#person_authentication_methods table with type = THIRD_PERSON and value =
confidant_person_relationships.confidant_person_id
, set values:ended_at = now()
updated_at = now()
updated_by = user_id (from token)
...
Update confidant person relationship request in https://e-health-ua.atlassian.net/wiki/spaces/CSIEH/pages/17613422609724271171/IL#confidant_person_relationship_requests table, set values:
status = COMPLETED
updated_at = now()
updated_by = user_id (from token)
confidant_person_relationship_id = confidant_person_relationship.id of created relationship (from action = INSERT)