Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4805

Retrospective stop of orders



    • Bug
    • Status: Closed
    • TBD
    • Resolution: Fixed
    • Platform 1.12.0
    • Platform 1.12.0
    • Order Entry
    • None


      The below scenario is for retrospective create and update of drug orders.
      A user is trying to enter patient record data for a previous date (say on 20th of Oct 2015 for 12th and 13th of Oct 2015)
      User enters a drug order(D1) for a patient for a specific date (say 12th of Oct 2015) for a duration of 2 days. (the auto expire date will then be 14th of Oct 2015).
      The user finds that the patient has visited the hospital again the next day(13th of Oct 2015) and the drug order was stopped. A revised drug order(D2) needs to be created with the previous order as D1. The save of the drug order fails with an exception, Cannot discontinue an order that is already stopped, expired or voided.
      The save of D2 fails as the drug order has already expired with respect to the current date of data entry (20th Oct 2015). But since the actual drug was edited not on 20th but on 13th, the discontinuation of the drug order D1 must be allowed.
      The OpenMRS Order service API uses the current date of the system to check for the state of the drug order. If the drug order is expired with respect to the current date, the discontinuation of the drug order is not allowed.
      The API must check the state of the order based on the dateActivated of the revised order(D2) instead of the current system time to allow for retrospective entry of drug order create.

      A similar story (TRUNK-4782) was played for the edit of drug orders. Looks like the story handles only "REVISE" of order. "DISCONTINUE" of order in retrospective mode is still not handled.

      Dev Notes

      • Javadoc for saveOrder with retrospective flag needs to explicitly say that the caller must be aware of the implications, that the API can't guarantee that orders haven't been acted on in external systems
      • Should validate and not let you retrospectively REVISE/DC an order that has a later change. You can only retrospectively enter a revision or discontinuation to the LAST order in the "chain" of orders i.e OrderService.getDiscontinuationOrder(Order) and OrderService.getRevisionOrder(Order) should both return null for the order that is being retrospectively revised or discontinued otherwise fail with an exception.
      • Retrospectively placing a DC order MUST discontinue any relevant orders that were active at the time (not today)

      Gliffy Diagrams




              nehashri Nehashri P L
              nehashri Nehashri P L
              0 Vote for this issue
              5 Start watching this issue