Table of Contents |
---|
...
Page Properties | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||
|
Logic
Save signed content to media storage, in bucket pointed in MEDIA_STORAGE_DEVICE_REQUEST_BUCKET chart parameter
Fill in the following fields:
requisition. Generate requisition number as described at Human readable Medication request number , but based on the Device Request identifier and put it in the field.
signed_content_links. Add string item in the array with a link on saved content in media storage
status = ACTIVE
status_reason = null
subject. Set hashed patient_id from URL
requester_legal_entity. Set client_id from token
quantity.unit. Set description according to quantity code and system
dispense_valid_to. Set (current_date + dispense_period_day) if medical program was set and it has dispense_period_day setting. Otherwise, set the value using device_dispense_period global parameter.
verification_code. Generate random 4-digit code
context_episode_id. Set episode from the $.encounter
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
Send verification code:
Determine patient's default authentication method as described at Determination of a default authentication method and return person's active auth_methods :
if OTP defined, then generate text according to TEMPLATE_SMS_FOR_CREATE_DEVICE_REQUEST and send SMS with verification_code
Save data to device_requests collection in MongoDB according to /wiki/spaces/CSI/pages/17467375685
Send
StatusChangeEvent
to Event Manager
...
Validate $.status is active
in case of error - return 422 ("value is not allowed in enum")
Processing
...
Response structure
See on Apiary
...
Expand | ||
---|---|---|
| ||
|
Post-processing processes
...
HTTP status codes
Page Properties | ||||||
---|---|---|---|---|---|---|
| ||||||
|
...