The original intent was order groups would never span encounters. If you revise an order that was in a group, then it would be linked to the previous order, but not directly to the group – i.e., orders revised in subsequent encounters would be related to the original grouping through order.getInitialOrder().getOrderGroup()
(where getInitialOrder()
returns the start of the previous order chain).
Consider this example:
- On Monday, a user orders drugs within an Order Set A, including Drug X.
- Drug X order is in an order group, both are linked to Monday’s encounter.
- On Thursday, they use Order Set B, which also includes Drug X, and end up revising the Drug X order.
- Revised Drug X order is in a separate order group, both are linked to Thursday’s encounter.
- Revised Drug X order’s
previousOrder
points to the original order for Drug X in encounter A and in its original order group. The revised Drug X order is not in the original order group; rather, it’s relationship to the original order group is inferred through it’s link to the previous order in that group.