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

Format

Value

Default value

MEDICATION_REQUEST_AUTOTERMINATION_SCHEDULE

(Cron Format)

How often to perform

termination0 3

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. <

...

    1. NOW()

  1. Update

...

  1. status for all records:

    1. status  =

...

    1.  EXPIRED

    2. updated_by =

...

    1.  SYSTEM_USER

    2. updated_at = timestamp

  1. Write changes to audit log

  2. Write changes to event manager

  3. if the medication request is based on the activity with quantity:

    1. Recalculate and set remaining_quantity for the activity as described at Create Medication Request: Validate based_on (p. 2.d.1 )