Reference·HL7 v2·MRG
HL7 v2 Reference

HL7 v2 MRG Segment Guide: Fields, Format, and Testing Gotchas

Jul 27, 2026 · 6 min read

MRG carries the identifiers of the patient record being erased, not the one surviving the merge, and a surprising number of integrations get that direction backwards on the first pass.

Quick answer

MRG (Merge Patient Information) shows up in patient-merge ADT messages, most often an A34 or A40, and it holds the old identifiers of a duplicate record that's being folded into the patient described by the message's own PID segment. Everything in MRG points at the record being retired; everything in PID points at the record that survives. Mixing that up is the single most common way MRG handling breaks.

The fields that actually matter in practice

MRG-1 →
Prior Patient Identifier List — the retiring MRN(s) that used to identify the duplicate record; the field most systems key their merge logic off
MRG-3 →
Prior Alternate Patient ID — a secondary identifier from the losing record, often from a legacy or feeder system that has its own ID scheme
MRG-4 →
Prior Patient Account Number — the retiring account number, distinct from the MRN and tied to billing rather than clinical identity
MRG-5 →
Prior Patient ID — a now-deprecated field carried for backward compatibility; most modern interfaces read MRG-1 instead
MRG-7 →
Prior Visit Number — the retiring visit or encounter number, relevant when the merge needs to reconcile in-progress encounters

Example

Synthetic example Generated by Synthibase
MRG|847213609^^^HOSP^MR|||55219847^^^HOSP^AN|ACC-102938

A synthetic MRG segment showing a retiring MRN, alternate ID, and account number folding into the surviving patient named in the same message's PID segment — invented for this example, not from any real patient or facility.

Where this trips people up

The direction of a merge is implicit in segment placement, not stated anywhere in plain language: MRG describes the loser, PID describes the winner. Test suites that build MRG messages by copying a PID segment and renaming it often get this backwards, and code that reads MRG-1 expecting the surviving MRN will silently retire the wrong record. A second, quieter failure mode is incomplete cleanup — a receiving system updates the patient index but leaves orders, results, or scheduled visits still pointing at the old identifier from MRG-7 or MRG-4, because those field values only mattered for the duration of the merge event and nothing forces a system to trace every downstream reference.

HL7 ADT Messages: A01 through A08 Explained
How to Build a Synthetic Patient Registry for Healthcare Testing
Test patient merges without risking real records
Synthibase generates A34/A40-style merge messages with correctly-directed MRG segments, mismatched identifier schemes, and edge cases like in-flight visits, so your merge logic gets proven out before it touches a live registry.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.