ЕСОЗ - публічна документація
RC_(CSI-1323)_Check confidant person relationship
Purpose
This algorithm is used to validate relationship between Confidant Person and Patient based on confidant_person_relationships (MPI DB table).
Key points
This algorithm uses dataset data to check if relationship between two patients from mpi database is exists confidant_person_relationships table or not and what kind of verification status it has.
This algorithm can be used in different processes and is not limited to specific process.
At least one of ids must be set as input parameter
Specification
Service logic
Get relationship between two persons from confidant_person_relationships table where:
person_id is equal to $.person_id
AND confidant_person_id is equal to $.confidant_person_id (if confidant_person_id exists in the dataset)
AND is_active=true
AND active_to > now() or active_to is null
Return result:
If record is found and has
verification_status = “VERIFIED”
OR
verification_status = “VERIFICATION_NEEDED” AND verification_reason = “MANUAL_CREATED_BY_DOCTOR”
return{:ok, {:approved, "Relationship is approved"}}
Else if record is found but has another status
return{:ok, {:not_approved, "Relationship is not approved yet"}}
Else if record is not found
return{:error, {:not_found, "Relationship is not found"}}
ЕСОЗ - публічна документація