HL7 MDM (Medical Document Management) messages carry transcribed notes, operative reports, discharge summaries, and scanned documents between clinical systems. While ADT handles patient movement and ORU handles lab results, MDM handles the narrative clinical content — the records that give movement and results their clinical meaning. This guide covers the production Mirth Connect channel for MDM T01 (notify), T02 (send with body), T10 (replace), and T11 (cancel) events. For the C-CDA document format that MDM bodies often carry, see our C-CDA processing guide.
MDM Event Types: When to Use Each
T01 — Notify (no body): Signals a document exists; receiver fetches content separately via XDS.b or FHIR DocumentReference. Use when documents are large, receivers can make outbound calls, or multiple receivers have different access rights. T02 — Send with full body: The most common MDM event. Document content is embedded in OBX segments as TX (text), FT (formatted text), or ED (Base64 binary). T04 — Addendum: Appends content to an existing document — common for progress note addenda and amended lab reports. T10 — Replace: Full document replacement. TXA-12 identifies the original; TXA-13 identifies the replacement. T11 — Cancel: Revokes a previously transmitted document — typically due to transcription error or patient ID mistake.
The TXA Segment: Document Header Fields
TXA (Transcription Document Header) is unique to MDM messages and carries all document metadata. TXA-12 (Unique Document Number) is the critical linking field — it connects T01, T02, T04, T10, and T11 events for the same document across time. Always extract and index it:
var docType = msg['TXA']['TXA.2'].toString(); // DS/OP/PN/RAD
var docFormat = msg['TXA']['TXA.3'].toString(); // TX/AP/FT
var activityDT = msg['TXA']['TXA.4'].toString();
var authorLN = msg['TXA']['TXA.9']['XCN.3'].toString();
var uniqueDocID= msg['TXA']['TXA.12']['EI.1'].toString(); // KEY — link all events
var docStatus = msg['TXA']['TXA.17'].toString(); // AU=Authenticated
var docTitle = msg['TXA']['TXA.21'].toString();
channelMap.put('doc_id', uniqueDocID);
channelMap.put('doc_type', docType);
channelMap.put('doc_status', docStatus);TXA-12 is what makes T10 (replace) and T11 (cancel) work — all downstream systems use it to locate and update the original document. Without it, replacements and cancellations cannot be applied. See our patient portal integration guide for how patient portal routing decisions use TXA-17 (authentication status) to determine document visibility.
Extracting Document Body from OBX Segments
var docBody = '';
var contentType = 'text/plain';
for each (var obx in msg['OBX']) {
var valType = obx['OBX.2'].toString();
var content = obx['OBX.5'].toString();
if (valType === 'TX' || valType === 'FT') {
docBody += content + '\n';
} else if (valType === 'ED') {
// Format: source^type^encoding^dataType^Base64Data
var parts = content.split('^');
if (parts.length >= 5) {
docBody = parts[4];
contentType = 'application/pdf';
}
}
}
channelMap.put('doc_body', docBody);
channelMap.put('content_type', contentType);T10 Document Replacement Handling
if (channelMap.get('event_type') === 'T10') {
var originalDocId = msg['TXA']['TXA.12']['EI.1'].toString();
var replacementDocId = msg['TXA']['TXA.13']['EI.1'].toString();
channelMap.put('original_doc_id', originalDocId);
channelMap.put('replacement_doc_id', replacementDocId);
channelMap.put('is_replacement', 'true');
logger.info('Doc replacement: ' + originalDocId + ' -> ' + replacementDocId);
}FHIR DocumentReference Construction
The FHIR R4 equivalent of an MDM document is a DocumentReference resource. Map TXA-2 (document type) to a LOINC document code, TXA-17 (status) to DocumentReference.status, and the body to an attachment. See our HL7 to FHIR transformation guide for the complete FHIR API routing pattern.



