...
Table of Contents |
---|
Purpose
This procedure (Automatic automatic schedule task) is designed to expire previously created Medication request request Request after lifetime ends in lifetime ends in status='NEW'.
Process configuration
Parameter
Value
(Cron Format)
termination
(Minutes, integer > 0)
Request
Name | Description |
---|
Format | Default value |
---|---|
MEDICATION_REQUEST_REQUEST_SCHEDULE |
How often to perform |
this task | Cron Format | `* * * * *` |
MEDICATION_REQUEST_REQUEST_EXPIRATION |
Medication request request |
lifetime period | Minutes | 30 |
...
Job logic
...
Read MEDICATION_REQUEST_REQUEST_EXPIRATION parameter EXPIRATION parameter value.
Fetch records from `medication_request_requests`, where:
status = 'NEW'
inserted_at < NOW() -
MEDICATION_REQUEST_REQUEST_EXPIRATION
Update
(Set values) Medication request Requeststatus for all records:
status = EXPIRED
updated_by =
SYSTEMSYSTEM_USER
updated_at = timestamp