Key elements
This job is more universal and has replaced the previous one [AUTO] Deactivate Program medications
Purpose
This procedure (automatic schedule task) is designed to deactivate medical program participants (program medications and program devices) after end date ends.
Process configuration
Name | Description | Format | Default value |
---|---|---|---|
MEDICAL_PROGRAM_PARTICIPANTS_DEACTIVATION_SCHEDULE | How often to perform this task | Cron Format |
|
Job logic
Deactivate program medications:
Fetch records from PRM.program_medications, where:
is_active = TRUE
end_date < current_date()
Update all records to:
is_active = FALSE
medication_request_allowed = FALSE
care_plan_activity_allowed = FALSE
updated_at = now()
updated_by = SYSTEM_USER
Write changes to audit log
Write changes to event manager
Deactivate program devices:
Fetch records from PRM.program_devices, where:
is_active = TRUE
end_date < current_date()
Update all records to:
is_active = FALSE
device_request_allowed = FALSE
care_plan_activity_allowed = FALSE
updated_at = now()
updated_by = SYSTEM_USER
Write changes to audit log
Write changes to event manager