Table of Contents |
---|
...
Purpose
This procedure (automatic schedule task) is designed to expire previously created Medication dispense after lifetime ends in status='NEW'.
Process configuration
Parameter
Value
(Cron Format)
termination
(Minutes, integer > 0) Medication Dispense lifetime
Name | Description | Format |
---|
Default value |
---|
MEDICATION_DISPENSE_SCHEDULE |
How often to perform |
this task | Cron Format | `* * * * *` |
MEDICATION_DISPENSE_EXPIRATION |
Medication dispense lifetime period | Minutes | 10 |
Specification
Search candidates
...
Job logic
Read MEDICATION_DISPENSE_
...
EXPIRATION parameter value
...
Fetch records from OPS.medication_dispenses, where:
status = 'NEW'
inserted_at < now() -
...
MEDICATION_DISPENSE_EXPIRATION
Change status
...
Update status for all records to EXPIRED:
status = 'EXPIRED'
updated_at = now()
updated_by = SYSTEM_USER
Write changes to audit log
Write changes to event manager