Purpose
This WS gives the opportunity to update external identifier of unidentified person in eHealth.
Specification
Service logic
Only authenticated and authorized SPECIALIST, ASSISTANT, RECEPTIONIST employees can update external_id of preperson.
Preperson can be updated only in OUTPATIENT or EMERGENCY legal entity type, if MPI identifier of preperson is being known (returns after Create preperson).
Only external_id field can be updated.
Update allowed for prepersons with status = ACTIVE.
Authentication
Verify the validity of access token
Return 401 in case validation fails
Check user scopes in order to perform this action (scope = 'preperson:update')
Return 403 in case invalid scope(s)
Validate legal entity
Check that legal entity is active (status = ACTIVE, SUSPENDED) and belongs to the user
Extract client_id from token (token.client_id == legal_entity_id)
Check legal entity status (status = ACTIVE, SUSPENDED)
In case of error - return 409 (Legal entity must be ACTIVE or SUSPENDED)
Validate ID
Check ID exists and belongs to preperson
Check ID exists in MPI.persons
In case error - 404
Check the entry in MPI.persons with this ID has flag preperson=true
In case error - return 422 (Person_id doesn’t belong to preperson)
Check preperson has status=active
In case error - return 422 (Preperson is not active)
Validate external_id
Check external_id is not empty.
In case of error - return 422 (external_id should not be empty)
Update object in DB
persons table
Parameter | Source | Description |
---|---|---|
external_id | Request: external_id | Identifier from external system, required. Get from request body. Required |
updated_at | timestamp: now() | Get current date-time |
updated_by | uuid | Extract user from token |