Understanding HL7 v2 MRG-7: Prior Visit Number in Practice
A patient merge that happens mid-encounter leaves MRG-7 pointing at a visit number that orders and results might still be actively writing to.
MRG-7 carries the visit or encounter number tied to the losing patient record, letting a receiving system know which in-progress or historical visit needs to be reassociated with the surviving patient. Unlike MRG-1's MRN or MRG-4's account number, a visit number often represents something time-sensitive — an encounter that may still be open when the merge message arrives.
What this field contains
Example
This synthetic example omits MRG-7, reflecting a merge where the losing record had no visit currently in progress.
Where this trips people up
The riskiest scenario for MRG-7 isn't a malformed value, it's timing: a merge message arriving while the retiring visit number is still receiving orders or results from other feeds. If the merge is processed before those in-flight messages, they can land against a visit number that no longer resolves to an active patient context. Test suites should include a scenario where order or result messages referencing the old visit number arrive both before and after the merge event, not just a static snapshot with no concurrent traffic.