In the OpenMRS data model, when an order has been changed, we actually create a new order and add a reference to the previous order in the previousOrder field. In FHIR, this corresponds to the replaces field when the action is one of RENEW, DISCONTINUE, or REVISE. So, when the OpenMRS Order.action field is one of these values, we should populate the replaces FHIR field with 1. a reference to the previous order and 2. the order number of the previous order in the Reference.identifer field.
1. When retrieving a ServiceRequest or MedicationRequest where the OpenMRS action field is one of RENEW, DISCONTINUE, or REVISE, the replaces field should be populated with a reference to the previous order.