Table of Contents |
---|
...
Fetch records from `medication_requests`, where:
status = 'ACTIVE'
dispense_valid_to < NOW()
Update status for all records:
status = EXPIRED
updated_by = SYSTEM_USER
updated_at = timestamp
Write changes to audit log
Write changes to event manager
if the medication request is based on the activity with quantity:
Recalculate and set remaining_quantity for the activity as described at Create Medication Request: Validate based_on (p. 2.d.1 )