Table of Contents |
---|
...
Search for declarations using user_id and client_id
- Select party_id from PRM.Party_users where
- PRM.Party_users.user_id = user_id
- Select IDs from PRM.Employees where
- PRM.Employees.party_id = Select 1.
- PRM.Employees.legal_entitty_id= client_id
- Select person_id from OPS.Declarations where
- OPS.Declarations.employee_id IN Select 2.
- OPS.Declarations.status IN (active, pending_verification)
- Select user_id from PRM.Party_users where
- PRM.Party_users.party_id = Select 1.
- Write all selected records into Redis in the structure:
user_id | client_id | | [{person_id}|
Search for declarations using party_id and client_id
- Select user_id from PRM.Party_users where
- PRM.Party_users.party_id = party_id
- Select IDs from PRM.Employee where
- PRM.Employee.party_id = Select 1.
- PRM.Employee.legal_entitty_id= client_id
- Select person_id from OPS.Declarations where
- OPS.Declarations.employee_id = Select 2.
- OPS.Declarations.status = active
- Write all selected records into Redis in the structure:
user_id | client_id | | [{patient_id}|
The data in the Redis expires after N minutes or when declared event happens:
...
Whenever doctor tries to access patient medical data, active declaration should be checked according to the algorithm:
Validate declaration
...
using user_id and client_id
- Search for a record in the Redis where the key = token.user_id id + client_id
- If there is no record, perform point 2 - Search perform method Search for declarations using token
- If there is a record, search for patient_id in array
- If there are no records with such patient_id return an error -"Access denied - you have no active declaration with the patient"
- If there is a record - grand access
...