Table of Contents | ||
---|---|---|
|
...
|
Authorize
Verify the validity of access token
Check user scope employee_request:update in order to perform this action
In case error - return 401 error
...
if action = APPROVE, add user new role
if action - REJECT, update employee request status on REJECTED
Update employee request status to REJECTED
Invoke WS to update employee request status with parameter 'action'='reject'
...
|
Get Employee Request Details
Invoke WS Get Employee Request by ID for further employee creation
...
|
Create user in Auth
Create user in Auth
Create/Update employee
Search party_id by tax_id (tax_id or passport_number) and birth_date for deduplication Party
If found, update object party - Update party WS
If not found, - Create object party
Update Party. See specification
The following fields can't be changed:
tax_id (tax_id or passport_number)
birth_date
If doctor object in ER is null, don't update party.eductions/party.qualifications/party.specialities/party.science_degree. Otherwise update those objects.
if about_myself/working_experience is null or empty string - don't update correspondent fields in parties.
Create party WS. See specification
create related entity party-user in PRM
Chech employee_id in request
if employee_id is exist in request, Update employee.
if employee_id is not exist, Create employee.
Update employee. See specification
The following fields can't be changed:
employee_type
legal_entity_id
start_date
if employee_type = 'DOCTOR', update doctor object
if one of next fields were changed:
first_name
second_name
last_name
find contracts with contractor_owner_id=$owner_id and status='VERIFIED'. Set ops.contracts.is_suspended=true
if main speciality (speciality with speciality_officio = true) of employee is changed:
from PEDIATRICIAN or FAMILY_DOCTOR to THERAPIST
find declarations with employee_id=$.employee_id, patient.birth_date>now() - global_parameters.adult_age (years) and status in ('active', 'pending_verification'), if found - update declarations in ops db:
set status = 'terminated'
set reason = 'AUTO_RETRAINED_AS_THERAPIST'
set updated_at, updated_by
from THERAPIST or FAMILY_DOCTOR to PEDIATRICIAN
find declarations with employee_id=$.employee_id, patient.birth_date<=now() - global_parameters.adult_age (years) and status in ('active', 'pending_verification'), if found - update declarations in ops db
set status = 'terminated'
set reason = 'AUTO_RETRAINED_AS_PEDIATRICIAN'
set updated_at, updated_by
find declarations with employee_id=$.employee_id, patient.birth_date>now() - global_parameters.adult_age (years) and status in ('active', 'pending_verification'), if found - update declarations in ops db
set end_date = min(patient.birth_date + prm.global_parametrs.adult_age - 1d, start_date + prm.global_parametrs.declaration_term - 1d)
set updated_at, updated_by
from PEDIATRICIAN to FAMILY_DOCTOR
find declarations with employee_id=$.employee_id, patient.birth_date>now() - global_parameters.adult_age (years) and status in ('active', 'pending_verification'), if found - update declarations in ops db
end_date = start_date + prm.global_parametrs.declaration_term - 1d
set updated_at, updated_by
Create new employee. See specification
If (employee_type = OWNER || employee_type = PHARMACY_OWNER) : deactivate all other records with the employee_type = OWNER
or employee_type = PHARMACY_OWNER for the legal_entity,
where new owner is creating:
...
Set ops.contracts.is_suspended=true
Create related entity party-user
Create related entity party-user
...
If not - return 422 error: "ЦЯ EMAIL-АДРЕСА ВЖЕ ЗАЙНЯТА ІНШИМ КОРИСТУВАЧЕМ"
Add role
Add user role by invoke service - название метода
...
|
Update employee request status to APPROVED
Invoke WS to update employee request status with parameter 'action'='approve'
...
|
Send Email
Send email with successful registration using WS - Send Message (TBD)
Temporarily use Postmark
Submit party on verification
Create or update existing record in party_verifications table for a party according to logic in sections below. Also, set:
updated_at = now()
updated_by = user uuid
inserted_at = now() (for new records)
inserted_by = user uuid (for new records)
DRFO registry verification
Set to party verification record as ready for online verification with DRFO registry:
...
Then party will be verified online with DRFO registry via separate process: https://e-health-ua.atlassian.net/wiki/spaces/RNOKPP/pages/17271128770
DRACS death acts registry verification
Set to party verification record as ready for online verification with DRACS death acts registry:
...
Then party will be verified online with DRACS death acts registry via separate process: https://e-health-ua.atlassian.net/wiki/spaces/DRACS/pages/17249239231
MVS passport registry verification
If party’s data match following rules: party has document with type ‘PASSPORT’ or ‘NATIONAL_ID’
thenonline verification with MVS passports registry needed. Set to party verification record:
mvs_passport_data_id = NULL
mvs_passport_data_status = NULL
mvs_passport_synced_at = NULL
mvs_passport_verification_status = VERIFICATION_NEEDED
mvs_passport_verification_reason = ONLINE_TRIGGERED
Then party will be verified online with MVS passports registry via separate process: https://e-health-ua.atlassian.net/wiki/spaces/EDDR/pages/18051334145
If party’s data does not match rules from above – online verification with MVS passports registry is not needed. Set to party verification record:
mvs_passport_data_id = NULL
mvs_passport_data_status = NULL
mvs_passport_synced_at = NULL
mvs_passport_verification_status = VERIFICATION_NOT_NEEDED
mvs_passport_verification_reason = AUTO_DATA_ABSENT
DMS passport registry verification
If party’s data match following rules: party has document with type ‘PASSPORT’ or ‘NATIONAL_ID’
thenonline verification with DMS passports registry needed. Set to party verification record:
dms_passport_data_id = NULL
dms_passport_data_status = NULL
dms_passport_synced_at = NULL
dms_passport_verification_status = VERIFICATION_NEEDED
dms_passport_verification_reason = ONLINE_TRIGGERED
Then party will be verified online with DMS passports registry via separate process: https://e-health-ua.atlassian.net/wiki/spaces/EDDR/pages/18050449429
If party’s data does not match rules from above – online verification with DMS passports registry is not needed. Set to party verification record:
dms_passport_data_id = NULL
dms_passport_data_status = NULL
dms_passport_synced_at = NULL
dms_passport_verification_status = VERIFICATION_NOT_NEEDED
dms_passport_verification_reason = AUTO_DATA_ABSENT
Calculate cumulative verification status
Calculate parties cumulative verification status based on parties verification status in each stream: DRFO registry verification, DRACS death acts registry verification, MVS passport registry verification, DMS passport registry verification according to logic described at https://e-health-ua.atlassian.net/wiki/spaces/EDDR/pages/18048417906/Party+verification+status+model#Cumulative-verification-status
...