HL7 SFTP Export

HL7 SFTP Export

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:
PurposeSample
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


  1. MSH|^~\&|QuickEMR|FF12|Receiving Application|Receiving Facility|202502121438||ADT^A08|QEMR_202502121438_11|P|2.3.1|||||US|UTF-8|en|
  2. EVN|A08|202502121438||||
  3. 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|
  4. PV1|1||^^^^^^^^Final Fantasy 12||||123456789^Bashir^Julian|4307890^Farrah Fowler^Amy
  5. GT1|1|9|Avalanche^Jessie^||3358 Almond Blvd^^Willow^NY^12495|||1963-03-16 00:00:00|F||18|
  6. 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

  1. MSH|^~\&|QuickEMR|FF12|Receiving Application|Receiving Facility|202502121438||DFT^P03|QEMR_202502121438_11|P|2.3.1|||||US|UTF-8|en|
  2. EVN|P03|202502121438||||
  3. 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|
  4. PV1|1||^^^^^^^^Final Fantasy 12||||123456789^Bashir^Julian|4307890^Farrah Fowler^Amy
  5. 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~~~
  6. 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^^|~~~
  7. 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^^|~~~
  8. DG1|1||M25.571^Pain in right ankle and joints of right foot^I10||||||||||||||||
  9. DG1|1||A00.9^Cholera, unspecified^I10||||||||||||||||

Example ZPM - Payment

  1. MSH|^~\&|QuickEMR|FF12|Receiving Application|Receiving Facility|202502121438||ZPM^ZPM|QEMR_202502121438_11|P|2.3.1|||||US|UTF-8|en|
  2. EVN|ZPM|202502121438||||
  3. 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|
  4. PV1|1||^^^^^^^^Final Fantasy 12||||^^|4307890^Farrah Fowler^Amy
  5. PMT|2047|2025-02-12 00:00:00||Cash||20.00||||||
  6. NTE|2047|2|

Segment Definitions

MSH - Message Header

  1. Constant: "|"
  2. Constant: "^~\&"
  3. Constant: "QuickEMR"
  4. Facility Code - The code field of the facility assigned to the given case record. E.g. "ABCT001". (See screenshot MSH.4)
  5. Receiving Application - Configurable in billing settings. Defaults to "Medtrak" (See screenshot MSH.5-6
  6. Receiving Facility - Configurable in billing settings. Defaults to "Medtrak" (See screenshot MSH.5-6)
  7. Message Date - The date the message was generated. Formatted: YYYYMMDDHHmm. Unless otherwise specified all dates will match this format.
  8. Empty
  9. Message
    1. Message Type - ADT, DFT, ZPM
    2. Message Subtype - A08 for first ADT send. A04 for subsequent ADT sends. Always P03 for DFT messages. Always "ZPM" for ZPM messages.
  10. 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".
  11. Constant: "P"
  12. Constant: "2.3.1"
  13. Empty
  14. Empty
  15. Empty
  16. Empty
  17. Constant: "US"
  18. Character Set (Constant): "UTF-8" - Packets will usually be base ascii but may occasionally contain UTF-8 characters.
  19. Language (Constant): "en"
  20. Empty

EVN - Event Type

  1. Event Type: See MSH.9.2. Will always match. EVN Header may be safely ignored but is included in case it is expected.
  2. Message Date: See MSH.7. Will always match.
  3. Empty
  4. Empty
  5. Empty
  6. Empty

PID - Patient Information

  1. Constant: 1
  2. Patient ID - The unique patient id from QuickEMR. (See PID.2, PID.4 Screenshot)
  3. Empty
  4. Alternate Patient ID - The patient code in QuickEMR. (See PID.2, PID.4 Screenshot)
  5. Name
    1. Last Name
    2. First Name
    3. Middle Initial
  6. Empty
  7. Date of Birth - Date in the format YYYYMMDD like "20100101"
  8. Gender at Birth - "M" or "F"
  9. Nickname - "Jack"
  10. Empty
  11. Address
    1. Address Line 1
    2. Address Line 2
    3. City
    4. State - 2 diget state code.
    5. Zip - 5 or 5+4 like "12345" or "12345-1234"
  12. Country Code (Constant) - "US"
  13. Phone
    1. Number - 10 digits separated by dashes like "200-200-1234"
    2. Constant: "PRN"
    3. Empty
    4. E-Mail - An e-mail address "test@example.com"
  14. Empty
  15. Language
    1. Language Code - ISO 639-1 Language code. Usually "en", occasionally "es", rarely others, MODIFIED to include: "sgn" from ISO 639-2 indicating sign-language.
    2. Language Description - The corresponding ISO 639-1 description. Usually "English", occasionally "Spanish", rarely others.
  16. Marital Status
    1. Status ID - One of "Married", "Single", "Legally Separated", "Divorced", "Widowed", "Unknown", or "Not Applicable"
    2. Empty
  17. Empty
  18. Case Code - The unique code assigned to a patients episode of care. See Screenshot PID.18
  19. Empty

PV1 - Patient Visit Information

  1. Constant - "1"
  2. Empty
  3. Patient Location
    1. Empty
    2. Empty
    3. Empty
    4. Facility - The "Other Code" field for the facility specified on the note. (See screenshot PV1.3)
    5. Empty
    6. Empty
    7. Empty
    8. Empty
    9. Facility Description - The full name of the facility specified on the note. (See screenshot PV1.3)
  4. Empty
  5. Empty
  6. Empty
  7. Attending Physician - DFT Message will contain the rendering physician. Otherwise the case assigned provider will be here. May be empty for non-DFT messages.
    1. NPI
    2. Last Name
    3. First Name
  8. Referring Physician - DFT message will contain the facility specified on the note. Otherwise the case facility is used.
    1. NPI
    2. Last Name
    3. First Name
  9. Empty (9-53 are empty)

GT1 - Guarantor

  1. Constant: 1
  2. 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.
  3. Guarantor Name
    1. Last Name
    2. First Name
    3. Middle Initial
  4. Empty
  5. Guarantor Address
    1. Address Line 1
    2. Address Line 2
    3. City
    4. State - 2 digit state code.
    5. Zip - 5 or 5+4
  6. Home Phone Number - 10 digits with no separators. 
  7. Work Phone Number - 10 digits with no separators.
  8. Date of Birth - Date in format YYYYMMDD
  9. Gender at Birth - "M" or "F"
  10. Guarantor Type - The source of the guarantor record. 'patient' or 'guarantor' or 'self'. Used for debugging and tracing.
  11. Relationship - 18: self, G8: Other
  12. Empty

IN1 - Insurance Information

  1. Indicator - 1: Primary, 2: Secondary, 3: Tertiary. Up to 3 IN1 segments may be included but only one for each indicator.
  2. Policy ID - unique id for this plan.
  3. Payer ID - Unique Code for this insurance. See Screenshot IN1.3
  4. Name - Name of the insurance company.
  5. Insurance Company Address
    1. Address Line 1
    2. Address Line 2
    3. City
    4. State - 2 digit code
    5. Zip - 5 or 5+4 "12345-1234"
  6. Insurance Contact Name
  7. Insurance Contact Phone Number - 10 digits no seperator
  8. Insurance Policy Group Number
  9. Insurance Policy Group Name
  10. Empty
  11. Empty
  12. Plan Effective Date - YYYYMMDDHHmm
  13. Plan Termination Date - YYYYMMDDHHmm
  14. Empty
  15. 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
  16. Insureds Name
    1. First Name
    2. Last Name
    3. Middle Initial
  17. Insured Relationship - S: Self, O: Other
  18. Insured Date of Birth - YYYYMMDD
  19. Insured Address
    1. Address Line 1
    2. Address Line 2
    3. City
    4. State - 2 letter code
    5. Zip - 5 or 5+4
  20. Empty
  21. Empty
  22. Empty
  23. Empty
  24. Empty
  25. Empty
  26. Empty
  27. Empty
  28. Empty
  29. Empty
  30. Empty
  31. Empty
  32. Empty
  33. Empty
  34. Empty
  35. Empty
  36. Insurance Policy Number
  37. Empty
  38. Empty
  39. Empty
  40. Empty
  41. Empty
  42. Empty
  43. Insureds Gender at Birth- M, F
  44. Empty
  45. Empty
  46. Empty
  47. Empty
  48. Empty
  49. Empty

FT1 - Financial Transaction

  1. Set id - Iterated for each charge present. Starts at 1.
  2. Transaction ID - The unique note (encounter) ID from within QuickEMR
  3. Batch ID - The unique batch ID from within QuickEMR. Items with the same batch ID were all exported together.
  4. Date of Service - YYMMDDHHmm
  5. Date Signed - YYMMDDHHmm
  6. Type (constant) - "CG"
  7. Procedure Code - CPT Code for the charge e.g. "97161"
  8. Description - CPT Code name. e.g. "PT Eval Low Complexity"
  9. Alternate Description - An alternative description for the given CPT Code.
  10. Units - Number of units being charges.
  11. Empty
  12. Empty
  13. Empty
  14. Empty
  15. Empty
  16. Place of Service - Usually "10" but User Defined.
  17. Empty
  18. Patient Type - Discipline currently one of: "Physical Therapy", "Occupational Therapy", "Speech Therapy", "Chiropractic", "Behavioral", "Respiratory", "OB-GYN Women's Health", "Other".
  19. Diagnosis Code - Repeating
    1. Code - ICD 10 code with decimal after 3 digits
    2. Description - Standard ICD 10 code description.
  20. Rendering Provider
    1. ID - The unique user code from within QuickEMR. See Screenshot FT1.20.1
    2. Last Name
    3. First Name
  21. Billing Provider
    1. ID - Tax ID
    2. Company Name
    3. Empty
  22. Empty
  23. Empty
  24. Empty
  25. Procedure Code
    1. Code - CPT4 code - Matches FT1.7
    2. Description - User provided description - Matches FT1.8
    3. Constant - "C4"
  26. Modifiers - Repeating 2 digit modifier codes up to 4. e.g. "GP~UB~KX"

DG1 - Diagnosis Code

  1. Constant - 1
  2. Empty
  3. Diagnosis Code
    1. Code - ICD 10 Code
    2. Description - Standard ICD 10 Description
    3. Constant - I10
  4. Unused (4-19 are unused)

PMT - Payment

  1. Payment ID - Unique numerical id generated by QuickEMR.
  2. Payment Date - The date indicated by the user. YYYYMMDDhhmm
  3. Empty
  4. Method - User Defined. Usually something like "Cash", "Credit", "Check"
  5. Empty
  6. Amount - "12.33"
  7. Reference - Free text provided by the user about this payment. Usually a check number or CC verification code. See Screenshot PMT
  8. Empty
  9. Empty
  10. Empty
  11. Empty
  12. Empty

NTE - Note

  1. Payment ID - PMT.1
  2. User ID - Unique integer id representing the user who accepted the payment.
  3. 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


    • Related Articles

    • APTA Mips API Integration

      You must be using QuickEMR Version 8 to integrate with APTA. Obtain SFTP information and enter it at “Settings” => “Documentation” => “Outcomes Type” => “APTA” => “APTA Host” and save. Past data may be manually exported by visiting “Reports” => ...
    • QEMR Native (Self Pay Billing Management System)

      **This system is for facilities that ONLY accept cash-pay patients and is not yet intended for facilities that are submitting claims to insurances** Enabling QuickEMR Native: Where to go? 1. The Quickemr Native system can be enabled by going under ...
    • FOTO Integration Part 2: Usage

      Mappings QuickEMR Patient => FOTO Patient QuickEMR Case => FOTO Episode QuickEMR Note => FOTO Encounter Create a new patient or visit an existing patient not connected to FOTO. FOTO requires several fields that are optional in QuickEMR. Before ...
    • Making the Guarantor for Minors and Signature Assignment Required before Exporting

      A few optional validation rules can be applied before exporting a note. Validation Rules: Where to go? 1. This can be found under Settings -> Validation 1. Check marking the following validation rules will require this information before a note can ...