Encounters should appropriately save retrospective orders

Description

See Talk thread at:

https://talk.openmrs.org/t/retrospective-encounters-and-orders/33266

There is a feature that exists in the Order Entry API that allows one to distinguish between a real-time Order and a retrospectively-entered Order:

OrderServiceImpl:

{{}}

{{}}

The "saveRetrospectiveOrder" method saves with a specific flag that changes validation rules.  In particular, it allows for  stopping/discontinuing an Order for a date prior to it’s auto-expire date, even if that auto-expire date is currently in the past.

However, currently in the Encounter Service, all nested Orders are saved by invoking the non-retrospective method:

From EncounterServiceImpl:

{{}}

 

This needs to be modified in order to ensure that if an Encounter and Orders are entered retrospectively, that the appropriate retrospective order processing is invoked.

Activity

Show:

Mike Seaton April 30, 2021 at 2:35 PM

Mike Seaton April 28, 2021 at 2:17 PM
Edited

I have a PR issued here (against the 2.3.x branch):

https://github.com/openmrs/openmrs-core/pull/3758

The approach I ended up taking with this was to modify the OrderServiceImpl.saveOrder(order, ordercontext, isRetrospective) method to force-set isRetrospective to true if the order.dateActivated is prior to the current date (excluding time).

This is my first pass take at this - any concerns or better suggestions as to how to handle this are welcome.

I included a unit test that fails without this change and passes with this change to demonstrate.

 /  /  /  FYI.

Fixed

Details

Assignee

Reporter

Complexity

Undetermined

Priority

Created April 27, 2021 at 2:13 PM
Updated October 31, 2021 at 10:41 PM
Resolved October 31, 2021 at 10:41 PM