Table of Contents |
---|
...
Page Properties | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||
|
Logic
Save signed content to media storage, in bucket pointed in MEDIA_STORAGE_DEVICE_DISPENSE_BUCKET chart parameter
Fill in the following fields:
signed_content_links. Add string item in the array with a link(s) to saved content in media storage
status = COMPLETED
updated_at. Set current date and time
updated_by. Set current user from token
If Device request has quantity:
Save (update) data to device_requests collection in MongoDB according to /wiki/spaces/CSI/pages/17467375685 : set device_requests.status = COMPLETED (as all its quantity has been provided by Device dispense)
If related Device request has a reference on an Activity as device_request.based_on, then
add the reference on the Device dispense resource to the outcome_reference attribute of the related Activity
if Activity.status is
scheduled
change it toin_progress
Send
StatusChangeEvent
to Event Manager for Device Dispense and related Device Request
...
Сheck that Device request is_active = true and status == 'ACTIVE'
in case of error - return 409 error ('Device request is not active')
Validate related Care plan
Verify Care Plan and Activity as described in https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/17573085459/Qualify+Device+Request+by+ID#Validate-related-Care-plan
Validate User
Extract user_id from token
Check that device dispense is completed by the same user who created it
User from token must match with device_dispense.inserted_by
in case of error - Return 409 ('Employee is not an author of device dispense')
...
For more information look at Device dispense status model /wiki/spaces/CSI/pages/17467572347
Response structure
See on Apiary
...