Table of Contents |
---|
...
Page Properties | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||
|
Logic
Fill in the following fields:
status = IN_PROGRESS
status_reason = null
subject. Set hashed patient_id from URL
performer_legal_entity. Set client_id from token
quantity.unit. Set description according to quantity code and system
inserted_at. Set current date and time
updated_at. Set current date and time
inserted_by. Set current user from token
updated_by. Set current user from token
Save data to device_dispenses collection in MongoDB according to /wiki/spaces/CSI/pages/17467572335
Send
StatusChangeEvent
to Event Manager
...
Extract user_id from token. Check that requester belongs to one of the user’s employee.
in case of error - return 422 ('User is not allowed to create device dispense for the performer')
Check performer is an active and approved employee.
in case of error - return 422 ('Employee is not active ')
Check performer employee.end_date is grater then today.
in case of error - return 422 ('end_date must be in future ')
Check performer relates to the legal entity (client_id from token).
in case of error - return 422 ('Employee does not belong to legal entity from token')
...