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.
Specification
Page Properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Logic
Dispense of medication is possible only under Medication Request and during the period specified in Medication Request (dispense_valid_from, dispense_valid_to)
Dispense details - several medications of different manufacturers with the same substance can be dispensed at a time. Total of medication_qty should be less or equal to medication quantity specified in Medication Request
If patient wants to split medication dispense of his medication request into several parts, it is possible to create and process medication dispense of the medication request with the desired medication quantity.
...
contracts.type==reimbursement
contracts.status==VERIFIED
Contract dates: start_date <= current_date & end_date >= current_date
contracts.contractor_legal_entity_id=token.client_id
$division_id in contract_divisionscontracts.medical_program_id==$.medical_program_id
сontracts.is_suspended ==false
...
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 division
If division_id submitted:
Validate division is active
in case of error - return 409 ("Division is not active")
Validate division belongs to user's legal entity
in case of error - return 409 ("Division does not belong to user's legal entity")
If chart parameter DISPENSE_DIVISION_DLS_VERIFY is on, then validate division is DLS verified (dls_verified=true)
in case of error - return 409 "Division is not verified in DLS"
If chart parameter MEDICAL_PROGRAM_PROVISION_VERIFY, then check division provide each submitted program. For each medical program provision validate:
it is exist and active:
in case of error - return status=INVALID for a program, rejection_reason= "Division does not provide the medical program"
it relates to the actual reimbursement contract: contract.start_date <= current_date <= contract.end_date, is_active = true, status = VERIFIED.
in case of error - return status=INVALID for a program, rejection_reason="Medical program provision is not related to any actual contract for the current date"
Validate code
Check that code in request is equal to code in medication_request (or both are 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")
...
Validation 1: Min package quantity is equal to package quantity
Check that requested discount price is equal to allowed reimbursement amount for the requested medication quantity (the way how to calculate allowed reimbursement amount is below)
Code Block discount_amount <= reimbursement_amount * (medication_qty/package_qty)
...
Parameter | Source | Description |
---|---|---|
id | UUID | Autogenerated |
payment_id | NULL | NULL for new records |
status | Const: NEW | Always NEW for new records |
is_active | Const: TRUE | Alwayls TRUE for new records |
inserted_at | Timestamp: now() | Get current date-time |
inserted_by | Token: user_id | Extract user from token |
updated_at | Timestamp: now() | Get current date-time |
updated_by | Token: user_id | Extract user from token |
...
Parameter | Source | Description |
---|---|---|
id | UUID | Autogenerated |
medication_dispense_id | FK: medication_dispense | |
reimbursement_amount |
Response structure
See on Apiary
...