7 * @link http://www.open-emr.org
8 * @author Ken Chapple <ken@mi-squared.com>
9 * @author Daniel Pflieger <daniel@mi-squared.com>, <daniel@growlingflea.com>
10 * @copyright Copyright (c) 2021 Ken Chapple <ken@mi-squared.com>
11 * @copyright Copyright (c) 2021 Daniel Pflieger <daniel@mi-squared.com>, <daniel@growlingflea.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 use OpenEMR\Common\ORDataObject\ORDataObject
;
17 class X12Partner
extends ORDataObject
21 var $x12_submitter_name; // Submitter name for TPA
27 var $x12_isa05; // Sender Interchange ID Qualifier. ZZ = mutually defined, 01 = Duns, etc.
28 var $x12_sender_id; // ISA06
29 var $x12_isa07; // Receiver Interchange ID Qualifier.
30 var $x12_receiver_id; // ISA08
31 var $x12_isa14; // Acknowledgment Requested. 0 = No, 1 = Yes.
32 var $x12_isa15; // Usage Indicator. T = testing, P = production.
33 var $x12_gs02; // Application Sender's Code. Default to ISA06.
34 var $x12_dtp03; // 270 2100C DTP03 service date for eligibility.
35 var $x12_per06; // The submitter's EDI Access Number, if any.
37 var $processing_format;
38 var $processing_format_array;
39 var $x12_gs03; // Application Sender's Code. If this isn't set then we will use the $x12_receiver_id(ISA08).
41 //for submitting claims via sftp
46 var $x12_sftp_local_dir;
47 var $x12_sftp_remote_dir;
50 * Constructor sets all Insurance attributes to their default value
53 function __construct($id = "", $prefix = "")
55 parent
::__construct();
57 $this->_table
= "x12_partners";
58 $this->processing_format_array
= $this->_load_enum("processing_format", false);
59 $this->processing_format
= isset($this->processing_format_array
[0]) ?
$this->processing_format_array
[0] : null;
60 //most recent x12 version mandated by HIPAA and CMS
61 // $this->x12_version = "004010X098A1";
62 $this->x12_version
= "005010X222A1";
63 $this->x12_isa05
= "ZZ";
64 $this->x12_isa07
= "ZZ";
65 $this->x12_isa14
= "0";
66 $this->x12_dtp03
= "A";
72 function x12_partner_factory()
75 $x = new X12Partner();
76 $sql = "SELECT id FROM " . $x->_table
. " order by name";
77 $result = $x->_db
->Execute($sql);
78 while ($result && !$result->EOF
) {
79 $partners[] = new X12Partner($result->fields
['id']);
93 if (is_numeric($id)) {
103 function get_x12_submitter_name()
105 return $this->x12_submitter_name
;
108 function set_x12_submitter_name($string)
110 $this->x12_submitter_name
= $string;
114 * SFTP credentials for direct submit to x-12 partners.
118 function set_x12_sftp_login($string)
120 $this->x12_sftp_login
= $string;
123 function get_x12_sftp_login()
125 return $this->x12_sftp_login
;
128 function set_x12_sftp_pass($string)
130 $this->x12_sftp_pass
= $string;
133 function get_x12_sftp_pass()
135 return $this->x12_sftp_pass
;
138 function set_x12_sftp_host($string)
140 $this->x12_sftp_host
= $string;
143 function get_x12_sftp_host()
145 return $this->x12_sftp_host
;
148 function set_x12_sftp_port($string)
150 $this->x12_sftp_port
= $string;
153 function get_x12_sftp_port()
155 return $this->x12_sftp_port
;
158 function set_x12_sftp_local_dir($string)
160 $this->x12_sftp_local_dir
= $string;
163 function get_x12_sftp_local_dir()
165 return $this->x12_sftp_local_dir
;
168 function set_x12_sftp_remote_dir($string)
170 $this->x12_sftp_remote_dir
= $string;
173 function get_x12_sftp_remote_dir()
175 return $this->x12_sftp_remote_dir
;
178 function set_name($string)
180 $this->name
= $string;
183 function get_id_number()
185 return $this->id_number
;
188 function set_id_number($string)
190 $this->id_number
= $string;
193 function get_x12_sender_id()
195 return $this->x12_sender_id
;
198 function set_x12_sender_id($string)
200 $this->x12_sender_id
= $string;
203 function get_x12_receiver_id()
205 return $this->x12_receiver_id
;
208 function set_x12_receiver_id($string)
210 $this->x12_receiver_id
= $string;
213 function get_x12_version()
215 return $this->x12_version
;
218 function set_x12_version($string)
220 $this->x12_version
= $string;
223 function get_x12_isa01()
225 return $this->x12_isa01
;
228 function set_x12_isa01($string)
230 $this->x12_isa01
= $string;
233 function get_x12_isa02()
235 return $this->x12_isa02
;
238 function set_x12_isa02($string)
240 $this->x12_isa02
= str_pad($string, 10);
243 function get_x12_isa03()
245 return $this->x12_isa03
;
248 function set_x12_isa03($string)
250 $this->x12_isa03
= $string;
253 function get_x12_isa04()
255 return $this->x12_isa04
;
258 function set_x12_isa04($string)
260 $this->x12_isa04
= str_pad($string, 10);
263 function get_x12_isa05()
265 return $this->x12_isa05
;
268 function set_x12_isa05($string)
270 $this->x12_isa05
= $string;
273 function get_x12_isa07()
275 return $this->x12_isa07
;
278 function set_x12_isa07($string)
280 $this->x12_isa07
= $string;
283 function get_x12_isa14()
285 return $this->x12_isa14
;
288 function set_x12_isa14($string)
290 $this->x12_isa14
= $string;
293 function get_x12_isa15()
295 return $this->x12_isa15
;
298 function set_x12_isa15($string)
300 $this->x12_isa15
= $string;
303 function get_x12_gs02()
305 return $this->x12_gs02
;
308 function set_x12_gs02($string)
310 $this->x12_gs02
= $string;
313 function get_x12_dtp03()
315 return $this->x12_dtp03
;
318 function set_x12_dtp03($string)
320 $this->x12_dtp03
= $string;
323 function get_x12_per06()
325 return $this->x12_per06
;
328 function set_x12_per06($string)
330 $this->x12_per06
= $string;
333 function get_processing_format()
335 //this is enum so it can be string or int
336 if (!is_numeric($this->processing_format
)) {
337 $ta = $this->processing_format_array
;
338 return ($ta[$this->processing_format
] ??
null);
341 return $this->processing_format
;
344 function get_processing_format_array()
346 //flip it because normally it is an id to name lookup, for templates it needs to be a name to id lookup
347 return array_flip($this->processing_format_array
);
350 function set_processing_format($string)
352 $this->processing_format
= $string;
355 function get_x12_gs03()
357 return $this->x12_gs03
;
360 function set_x12_gs03($string)
362 $this->x12_gs03
= $string;
365 function get_x12_isa14_array()
373 function get_x12_isa15_array()
381 function get_idqual_array()
384 '01' => 'Duns (Dun & Bradstreet)',
385 '14' => 'Duns Plus Suffix',
386 '20' => 'Health Industry Number (HIN)',
387 '27' => 'Carrier ID from HCFA',
388 '28' => 'Fiscal Intermediary ID from HCFA',
389 '29' => 'Medicare ID from HCFA',
390 '30' => 'U.S. Federal Tax ID Number',
391 '33' => 'NAIC Company Code',
392 'ZZ' => 'Mutually Defined',
396 function get_x12_version_array()
399 '005010X222A1' => '005010X222A1',
400 '004010X098A1' => '004010X098A1',
404 function get_x12_dtp03_type_array()
407 'C' => 'Current Date',
408 'A' => 'Appointment Date',
409 'E' => 'Subscriber Effective Date',