Purpose
This WS give the opportunity to create unidentified person in eHealth. It means that person can be created w/o any information about it but requires a medical identification with set of medical events.
Specification
Service logic
Only authenticated and authorized SPECIALIST, ASSISTANT, RECEPTIONIST employees can register prepersons.
Prepersons can be registered in OUTPATIENT and EMERGENCY legal entities.
Prepersons shoul be registered only with predefined set of medical events (package).
Preperson registered w/o entry in MPI. Only as document in patients collection.
Service should generate patient_id in MongoDB, but return person_id (w/o creating entry in MPI)
Authentication
Verify the validity of access token
Return 401 in case validation fails
Check user scopes in order to perform this action (scope = 'preperson:create')
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 request
Validate request using schema (TBD)
Validate external_id
Check external_id is not empty.
In case of error - return 422 (external_id should not be empty)
Generate person_id
Generate person_id (will be returned in response). Ensure there is no such person_id in MPI.persons
Generate patient_id to save it in patients collection.
Save object to DB
Insert preperson to MPI
persons table
Parameter | Source | Description |
---|---|---|
id | string | Autogenerated. |
status | string | Status. By default is “active” |
external_id | Request: external_id | Identifier from external system. Required |
preperson | bool | Mark that entry belongs to preperson, required. Set true. |
is_active | bool | Technical flag. By default is true. |
inserted_by | uuid | Extract user from token |
inserted_at | timestamp | Get current date-time |
updated_by | uuid | Extract user from token |
updated_at | timestamp | Get current date-time |