Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Create new entities

...

Add record to medication_dispenses

...

Purpose

...

Specification

WS logic

...

Authorize user

...

Validate request

...

Medication dispense in a multi attempts

...

Get reimbursement amount

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:

  1. Verify Care plan:

    1. It should be in active status

      1. in case of error - return 409 (message: "Invalid care plan status")

  2. Verify care plan Activity:

    1. It has scheduled, in_progress status

      1. in case of error - return 409 (message: "Invalid activity status")

 

Validate code

  1. Check that code in request is equal to code in medication_request (or both is empty)

    1. In case code exists in request - it should match with code in medication_request

      1. Return 401 in case code doesn't match (message = "Incorrect code")

    2. In case code is missing in request - check that code in medication_request is NULL

      1. Return 401 in case code in medication_request is not NULL (message = "Missing or Invalid code")

...