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
TBD
Service logic
Only authenticated and authorized OWNER, 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)
Required set of medical events (TBD)
Validate external_id
Check external_id is not empty.
Check external_id is unique ? (unique within le?)
Save object to Mongo DB
Insert patient and set of submitted medical events
patients collection
Parameter | Source | Description |
---|---|---|
_id | string | Autogenerated hash. |
status | string | Status. By default is “active” |
external_id | Request: external_id | Identifier from external system. Required |
note | Request: note | Used as comment to specify preperson in free way. Optional |
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 |
2. medical event collections (TBD)