ЕСОЗ - публічна документація

[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

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

  1. Read MEDICATION_DISPENSE_EXPIRATION parameter value

  2. Fetch records from OPS.medication_dispenses, where:

    1. status = 'NEW'

    2. inserted_at < now() - MEDICATION_DISPENSE_EXPIRATION

  3. Update status for all records to EXPIRED:

    1. status = 'EXPIRED'

    2. updated_at = now()

    3. updated_by = SYSTEM_USER

  4. Write changes to audit log

  5. Write changes to event manager

ЕСОЗ - публічна документація