ЕСОЗ - публічна документація
RC_Rx_[AUTO] Terminate Medication dispenses
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_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
ЕСОЗ - публічна документація