A generic HL7 interface using HL7 ~2.3.1
ADT messages are sent upon creating or updating as case.
DFT messages are sent through Batch Management.
ZPM messages are sent when a payment is flagged to "Export". The ZPM is a custom packet type but uses standard segments.
Key Characters are hard coded and most fields are sanitized using the standard escape sequence. The table below shows the values:
| Purpose | Sample | Name | ASCII | Escape |
Segment Separator | \n | Line Feed | 10 | \X0A\ |
Field Separator | | | Pipe | 124 | \F\ |
Component Separator | ^ | Carrot | 94 | \S\ |
Subcomponent Separator | & | Ampersand | 38 | \T\ |
Repeat Separator | ~ | Tilde | 126 | \R\ |
Escape | \ | Backslash | 92 | \E\ |
Example ADT - Patient Create/Update
- MSH|^~\&|QuickEMR|FF12|Receiving Application|Receiving Facility|202502121438||ADT^A08|QEMR_202502121438_11|P|2.3.1|||||US|UTF-8|en|
- EVN|A08|202502121438||||
- PID|1|9||AVALJESS01|Avalanche^Jessie^||19630316|F|The Gun||3358 Almond Blvd^^Willow^NY^12495|US|^PRN^^daniel+jesse@danielphenry.com||en^English|^||M012345686|
- PV1|1||^^^^^^^^Final Fantasy 12||||123456789^Bashir^Julian|4307890^Farrah Fowler^Amy
- GT1|1|9|Avalanche^Jessie^||3358 Almond Blvd^^Willow^NY^12495|||1963-03-16 00:00:00|F||18|
- IN1|1|1021|0002|Commercial (no modifiers)|2192 Orange Acacia Blvd^^Quaker Hill^CT^06375||2007503041|||||202001010000|||CI|Avalanche^Jessie^|S|1963-03-16 00:00:00|3358 Almond Blvd^^Willow^NY^12495|||||||||||||||||pn1234|||||||F||||||
Example DFT - Charges
- MSH|^~\&|QuickEMR|FF12|Receiving Application|Receiving Facility|202502121438||DFT^P03|QEMR_202502121438_11|P|2.3.1|||||US|UTF-8|en|
- EVN|P03|202502121438||||
- PID|1|9||AVALJESS01|Avalanche^Jessie^||19630316|F|The Gun||3358 Almond Blvd^^Willow^NY^12495|US|^PRN^^daniel+jesse@danielphenry.com||en^English|^||M012345686|
- PV1|1||^^^^^^^^Final Fantasy 12||||123456789^Bashir^Julian|4307890^Farrah Fowler^Amy
- FT1|1|3150|5120|202502040000|202502040940|CG|97530|Therapeutic/Functional activities|Therapeutic/Functional activities|2||||||11|||M25.571^Pain in right ankle and joints of right foot~A00.9^Cholera, unspecified|BAJU01^Bashir^Julian|119221902^Esper||||97530^Therapeutic/Functional activities^C4^^|59~~~
- FT1|2|3150|5120|202502040000|202502040940|CG|97140|Manual Therapy|Manual Therapy|0||||||11|||M25.571^Pain in right ankle and joints of right foot~A00.9^Cholera, unspecified|BAJU01^Bashir^Julian|119221902^Esper||||97140^Manual Therapy^C4^^|~~~
- FT1|3|3150|5120|202502040000|202502040940|CG|97110|Therapeutic Exercises|Therapeutic Exercises|0||||||11|||M25.571^Pain in right ankle and joints of right foot~A00.9^Cholera, unspecified|BAJU01^Bashir^Julian|119221902^Esper||||97110^Therapeutic Exercises^C4^^|~~~
- DG1|1||M25.571^Pain in right ankle and joints of right foot^I10||||||||||||||||
- DG1|1||A00.9^Cholera, unspecified^I10||||||||||||||||
Example ZPM - Payment
- MSH|^~\&|QuickEMR|FF12|Receiving Application|Receiving Facility|202502121438||ZPM^ZPM|QEMR_202502121438_11|P|2.3.1|||||US|UTF-8|en|
- EVN|ZPM|202502121438||||
- PID|1|9||AVALJESS01|Avalanche^Jessie^||19630316|F|The Gun||3358 Almond Blvd^^Willow^NY^12495|US|^PRN^^daniel+jesse@danielphenry.com||en^English|^||M012345686|
- PV1|1||^^^^^^^^Final Fantasy 12||||^^|4307890^Farrah Fowler^Amy
- PMT|2047|2025-02-12 00:00:00||Cash||20.00||||||
- NTE|2047|2|
Segment Definitions
- Constant: "|"
- Constant: "^~\&"
- Constant: "QuickEMR"
- Facility Code - The code field of the facility assigned to the given case record. E.g. "ABCT001". (See screenshot MSH.4)
- Receiving Application - Configurable in billing settings. Defaults to "Medtrak" (See screenshot MSH.5-6
- Receiving Facility - Configurable in billing settings. Defaults to "Medtrak" (See screenshot MSH.5-6)
- Message Date - The date the message was generated. Formatted: YYYYMMDDHHmm. Unless otherwise specified all dates will match this format.
- Empty
- Message
- Message Type - ADT, DFT, ZPM
- Message Subtype - A08 for first ADT send. A04 for subsequent ADT sends. Always P03 for DFT messages. Always "ZPM" for ZPM messages.
- Message Control ID - A unique identifier. Should be unique for each message and contains parts "QEMR_{Date:MSH7}_{case_id}". The case id is the unique identifier for a patient episode of care (case) in QuickEMR and may be seen in the URL of the case. For the URL "https://server2.quickemr.com/DEMO001V8/case?case_id=2019" the case id is "2019".
- Constant: "P"
- Constant: "2.3.1"
- Empty
- Empty
- Empty
- Empty
- Constant: "US"
- Character Set (Constant): "UTF-8" - Packets will usually be base ascii but may occasionally contain UTF-8 characters.
- Language (Constant): "en"
- Empty
EVN - Event Type
- Event Type: See MSH.9.2. Will always match. EVN Header may be safely ignored but is included in case it is expected.
- Message Date: See MSH.7. Will always match.
- Empty
- Empty
- Empty
- Empty
- Constant: 1
- Patient ID - The unique patient id from QuickEMR. (See PID.2, PID.4 Screenshot)
- Empty
- Alternate Patient ID - The patient code in QuickEMR. (See PID.2, PID.4 Screenshot)
- Name
- Last Name
- First Name
- Middle Initial
- Empty
- Date of Birth - Date in the format YYYYMMDD like "20100101"
- Gender at Birth - "M" or "F"
- Nickname - "Jack"
- Empty
- Address
- Address Line 1
- Address Line 2
- City
- State - 2 diget state code.
- Zip - 5 or 5+4 like "12345" or "12345-1234"
- Country Code (Constant) - "US"
- Phone
- Number - 10 digits separated by dashes like "200-200-1234"
- Constant: "PRN"
- Empty
- E-Mail - An e-mail address "test@example.com"
- Empty
- Language
- Language Code - ISO 639-1 Language code. Usually "en", occasionally "es", rarely others, MODIFIED to include: "sgn" from ISO 639-2 indicating sign-language.
- Language Description - The corresponding ISO 639-1 description. Usually "English", occasionally "Spanish", rarely others.
- Marital Status
- Status ID - One of "Married", "Single", "Legally Separated", "Divorced", "Widowed", "Unknown", or "Not Applicable"
- Empty
- Empty
- Case Code - The unique code assigned to a patients episode of care. See Screenshot PID.18
- Empty
- Constant - "1"
- Empty
- Patient Location
- Empty
- Empty
- Empty
- Facility - The "Other Code" field for the facility specified on the note. (See screenshot PV1.3)
- Empty
- Empty
- Empty
- Empty
- Facility Description - The full name of the facility specified on the note. (See screenshot PV1.3)
- Empty
- Empty
- Empty
- Attending Physician - DFT Message will contain the rendering physician. Otherwise the case assigned provider will be here. May be empty for non-DFT messages.
- NPI
- Last Name
- First Name
- Referring Physician - DFT message will contain the facility specified on the note. Otherwise the case facility is used.
- NPI
- Last Name
- First Name
- Empty (9-53 are empty)
GT1 - Guarantor
- Constant: 1
- Guarantor ID - An id corresponding to the source record in QuickEMR. This may be a patient record or a guarantor record depending on the users preferences.
- Guarantor Name
- Last Name
- First Name
- Middle Initial
- Empty
- Guarantor Address
- Address Line 1
- Address Line 2
- City
- State - 2 digit state code.
- Zip - 5 or 5+4
- Home Phone Number - 10 digits with no separators.
- Work Phone Number - 10 digits with no separators.
- Date of Birth - Date in format YYYYMMDD
- Gender at Birth - "M" or "F"
- Guarantor Type - The source of the guarantor record. 'patient' or 'guarantor' or 'self'. Used for debugging and tracing.
- Relationship - 18: self, G8: Other
- Empty
- Indicator - 1: Primary, 2: Secondary, 3: Tertiary. Up to 3 IN1 segments may be included but only one for each indicator.
- Policy ID - unique id for this plan.
- Payer ID - Unique Code for this insurance. See Screenshot IN1.3
- Name - Name of the insurance company.
- Insurance Company Address
- Address Line 1
- Address Line 2
- City
- State - 2 digit code
- Zip - 5 or 5+4 "12345-1234"
- Insurance Contact Name
- Insurance Contact Phone Number - 10 digits no seperator
- Insurance Policy Group Number
- Insurance Policy Group Name
- Empty
- Empty
- Plan Effective Date - YYYYMMDDHHmm
- Plan Termination Date - YYYYMMDDHHmm
- Empty
- Plan Type - BC: Blue Cross, C: Champus/TriCare, F: FECA Black Lung, G: Group Health Plan, MC: Medicare, MD: Medicaid, CMD: Commercial Medicaid, MG: Medigap, WC: Workers’ Comp, O: Other
- Insureds Name
- First Name
- Last Name
- Middle Initial
- Insured Relationship - S: Self, O: Other
- Insured Date of Birth - YYYYMMDD
- Insured Address
- Address Line 1
- Address Line 2
- City
- State - 2 letter code
- Zip - 5 or 5+4
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Insurance Policy Number
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
- Insureds Gender at Birth- M, F
- Empty
- Empty
- Empty
- Empty
- Empty
- Empty
FT1 - Financial Transaction
- Set id - Iterated for each charge present. Starts at 1.
- Transaction ID - The unique note (encounter) ID from within QuickEMR
- Batch ID - The unique batch ID from within QuickEMR. Items with the same batch ID were all exported together.
- Date of Service - YYMMDDHHmm
- Date Signed - YYMMDDHHmm
- Type (constant) - "CG"
- Procedure Code - CPT Code for the charge e.g. "97161"
- Description - CPT Code name. e.g. "PT Eval Low Complexity"
- Alternate Description - An alternative description for the given CPT Code.
- Units - Number of units being charges.
- Empty
- Empty
- Empty
- Empty
- Empty
- Place of Service - Usually "10" but User Defined.
- Empty
- Patient Type - Discipline currently one of: "Physical Therapy", "Occupational Therapy", "Speech Therapy", "Chiropractic", "Behavioral", "Respiratory", "OB-GYN Women's Health", "Other".
- Diagnosis Code - Repeating
- Code - ICD 10 code with decimal after 3 digits
- Description - Standard ICD 10 code description.
- Rendering Provider
- ID - The unique user code from within QuickEMR. See Screenshot FT1.20.1
- Last Name
- First Name
- Billing Provider
- ID - Tax ID
- Company Name
- Empty
- Empty
- Empty
- Empty
- Procedure Code
- Code - CPT4 code - Matches FT1.7
- Description - User provided description - Matches FT1.8
- Constant - "C4"
- Modifiers - Repeating 2 digit modifier codes up to 4. e.g. "GP~UB~KX"
DG1 - Diagnosis Code
- Constant - 1
- Empty
- Diagnosis Code
- Code - ICD 10 Code
- Description - Standard ICD 10 Description
- Constant - I10
- Unused (4-19 are unused)
PMT - Payment
- Payment ID - Unique numerical id generated by QuickEMR.
- Payment Date - The date indicated by the user. YYYYMMDDhhmm
- Empty
- Method - User Defined. Usually something like "Cash", "Credit", "Check"
- Empty
- Amount - "12.33"
- Reference - Free text provided by the user about this payment. Usually a check number or CC verification code. See Screenshot PMT
- Empty
- Empty
- Empty
- Empty
- Empty
NTE - Note
- Payment ID - PMT.1
- User ID - Unique integer id representing the user who accepted the payment.
- Note - Free text added to the payment. Usually includes important notes about who paid, or where the payment should be directed. See Screenshot PMT
Screenshots
MSH.4
MSH.5-6
PID.2, PID.4
PID.18
PV1.3
IN1.3
FT1.20.1
PMT