Table of Contents |
---|
...
Only authenticated and authorized users with appropriate scope can invoke Complete Device Dispense
Device Dispense is completed in async way. Successful result of the job should return a link to the existing Device Dispense (look at RС_[UPD] Get Device dispense details)
Complete request must be signed with Digital Signature. So, all the Device dispense data must be signed and submitted.
The method is used only for Device requests with the medical program.
...
С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 Care Plan and Activity as described in https://e-health-ua.atlassian.net/wiki/spaces/RMDNEH/pages/17670996847/UPD+Qualify+Device+request#Validate17782015072#Validate-related-Care-plan
Validate User
...
For more information look at RС_[UPD] Device dispense status model
...
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 RС_[UPD] Device dispense data model: 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