...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Add record to medication_dispenses
...
...
...
...
...
Medication dispense in a multi attempts
...
Table of Contents |
---|
Purpose
This method is designed to create hold (reservation) on medication in order to prevent multiple dispenses under the same Medication Request. This hold lasts certain time (configuration parameter MEDICATION_DISPENSE_EXPIRATION) after with it goes to EXPIRED status
...
Code Block |
---|
{:error, [{%{ description: "Medication not found", params: [], rule: :invalid }, "$.dispense_details[:index].medication_id"}]} |
Validate related Care plan
If (medication_request.based_on is present and not null) AND medication_program is absent:
Verify Care plan:
It should be in active status
in case of error - return 409 (message: "Invalid care plan status")
Verify care plan Activity:
It has scheduled, in_progress status
in case of error - return 409 (message: "Invalid activity status")
Validate code
Check that code in request is equal to code in medication_request (or both is empty)
In case code exists in request - it should match with code in medication_request
Return 401 in case code doesn't match (message = "Incorrect code")
In case code is missing in request - check that code in medication_request is NULL
Return 401 in case code in medication_request is not NULL (message = "Missing or Invalid code")
...