Table of Contents |
---|
Purpose
...
Create new person in mpi database, set values in following tables based on person registration request:
persons
tableperson_phones
tableperson_addresses
tableperson_documents
tableperson_authentication_methods
table
Save signed content to media storage
Submit person on verification - create record in person_verifications table for person_id, set values for each verification stream:
Manual NHS verifiation
if
$.person.confidant_person
exists in person registration request or$.person.documents
contains document with type = 'PERMANENT_RESIDENCE_PERMIT' or$.person.unzr
is not empty and first 8 digits of$.person.unzr
!=$.person.birth_date
set nhs_verification_status = NOT_VERIFIED
set nhs_verification_reason = DOCUMENTS_TRIGGERED
else - scan copies of persons documents are not needed, set verification status according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1785810131718201706567/UPD+RC_Sign+person+request+v2#Manual+v2+DRACS+2.0#Manual-NHS-verification
DRFO registry verification - according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1785810131718201706567/UPD+RC_Sign+person+request+v2#DRFOv2+DRACS+2.0#DRFO-registry-verification
DRACS death acts registry verification - according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1785810131718201706567/UPD+RC_Sign+person+request+v2#DRACS+v2+DRACS+2.0#DRACS-death-acts-registry-verification
DRACS birth acts registry verification - according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1785810131718201706567/UPD+RC_Sign+person+request+v2#DRACS+v2+DRACS+2.0#DRACS-birth-acts-registry-verification
DRACS name change acts registry verification - according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1785810131718201706567/UPD+RC_Sign+person+request+v2#DRACS-name-changev2+DRACS+2.0#DRACS-birth-acts-registry-verification
Legal capacity verification - according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1785810131718201706567/UPD+RC_Sign+person+request+v2_EN#Legal+DRACS+2.0#Legal-capacity-verification
Calculate cumulative person verifiation status according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1785810131718201706567/UPD+RC_Sign+person+request+v2#Calculate+v2+DRACS+2.0#Calculate-cumulative-verification-status
Create confidant person relationship
...
Callhttps://e-health-ua.atlassian.net/wiki/spaces/PCAB/pages/17599399455. Set values:
confidant_person_id = $request.confidant_person.person_id
person_id =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 = “ONLINE_TRIGGERED_BY_PIS_REGISTRATION_VIA_CONFIDANT”
confidant_person_relationship_documents = person.confidant_person.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
else - set active_to = relationship_expiration_date
Check existing authentication method for person with type = THIRD_PERSON, ended_at > true or null and value = $request.confidant_person.person_id
if not found - create new authentication method for person, set values:
type = THIRD_PERSON
value = person.confidant_person.person_id
started_at = now()
ended_at: if person.age < no_self_auth_age
ended_at = person.birth_date + no_self_auth_age - 1d
else end_date = null
if found - update authentication method for person, set values:
ended_at: if person.age < no_self_auth_age
ended_at = person.birth_date + no_self_auth_age - 1d
else end_date = null
...
If relationship doesn’t exist - check that relationship can be created for found patient id using logic: if persons age is greater then no_self_registration_age global parameter, but less then person_full_legal_capacity_age global parameter, check that person does not have document with type from PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter or person has document with type from PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter and legal_capacity_verification_status <> VERIFIED or VERIFICATION_NOT_NEEDED
If relationship can be created for patient – Create relationship https://e-health-ua.atlassian.net/wiki/spaces/PCAB/pages/17599399347/warranty_PIS.+Confidant+patient+sign-up+registration#Create-confidant-person-relationship
If relationship can not be created for patient – return 422 ('Confidant can not be submitted for person who has document that proves legal capacity')
Search user in Mithril
Search for existing user in mithril database,
users
table, with person_id = person_id and is_active = trueIf user is found - check it is not blocked (is_blocked <> true)
in case blocked - return 401 ('User is blocked.').
in case not blocked - save its
user_id
and proceed to p.3.
If user is not found - proceed to p.4.
...