Table of Contents |
---|
...
Validate merge_person_id UUID
In case of error - return 422
Find preperson by id in mpi.prepersons
In case of error - return 404 (Preperson not found)
Check preperson status is active in mpi.prepersons
In case of error - return 409 (Preperson is not active)
Check if exists another preperson merge requests with status NEW or APPROVED for this preperson
if exists - update status of another requests to CANCELLED
Check if preperson has at least one episode( status!= "entered_in_error")
if no episodes - return 409 (Preperson has no episodes)
...
If type is OTP or THIRD_PERSON - Generate verification code as on create patient request process.
If type is OFFLINE - Generate uploaded URLs as on create patient request process. Set il.merge_requests.documents
In case no auth methods found (null) - return error with code 409 (Person has no auth methods)
Save object to DB
il.merge_requeststable
...