Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

Purpose

This job is designed to expire previously created Medication requests. All active medication requests where dispense_valid_to in the past must be expired.

Process configuration

Parameter

Name

Description

Value

Format

Default value

MEDICATION_REQUEST_AUTOTERMINATION_SCHEDULE

(Cron Format)

How often to perform

termination

this task

Cron Format

`* * * * *`

...

Job logic

...

Get list Medication request 

...

languagesql

...

  1. Fetch records from `medication_requests`, where:

    1. status = 'ACTIVE'

    2. dispense_valid_to

    1. <

    current_date
    1. NOW()

  2. Update

    (Set values) Medication request

    status for all records:

    1. status  =

        EXPIRED

       EXPIRED

    2. updated_by =

      SYSTEM

       SYSTEM_USER

    3. updated_at = timestamp

  3. Write changes to audit log

  4. Write changes to event manager