ЕСОЗ - публічна документація
[AUTO] Terminate Medication Dispenses
- 1 Purpose
- 1.1 Process configuration
- 1.2 Job logic
Purpose
This procedure (automatic schedule task) is designed to expire previously created Medication dispense after lifetime ends in status='NEW'.
Process configuration
Name | Description | Format | Default value |
---|---|---|---|
MEDICATION_DISPENSE_AUTOTERMINATION_SCHEDULE | How often to perform this task | Cron Format | `* * * * *` |
MEDICATION_DISPENSE_EXPIRATION | Medication dispense lifetime period | Minutes | 10 |
Job logic
Read MEDICATION_DISPENSE_EXPIRATION parameter value
Fetch records from OPS.medication_dispenses, where:
status = 'NEW'
inserted_at < now() - MEDICATION_DISPENSE_EXPIRATION
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
ЕСОЗ - публічна документація