3 * Utilities to support HCFA 1500 02/12 Version
4 * For details on format refer to:
5 * <http://www.nucc.org/index.php?option=com_content&view=article&id=186&Itemid=138>
8 * @author Kevin Yeh <kevin.y@integralemr.com>
9 * @author Stephen Waite <stephen.waite@cmsvt.com>
10 * @copyright Copyright (c) 2013 Kevin Yeh <kevin.y@integralemr.com>
11 * @copyright Copyright (c) 2018 Stephen Waite <stephen.waite@cmsvt.com>
12 * @link https://github.com/openemr/openemr/tree/master
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 * Helper class to manage which rows and columns information belong in.
18 * This allows "out of order" creation of the content.
29 * @param type $row Which row to put this data on
30 * @param type $column Which column to put this data in
31 * @param type $width How many characters max to print on
32 * @param type $info The text to print on the form at the specified location
34 public function __construct($row, $column, $width, $info)
37 $this->column
=$column;
43 * Determine relative position of an element
45 * @return type integer
47 public function get_position()
49 return $this->row
*100+
$this->column
;
53 * Add the info to the form
57 // Override the default value for "strip" with put_hcfa to keep periods
58 put_hcfa($this->row
, $this->column
, $this->width
, $this->info
, '/#/');
63 * comparator function for hfca_info class to allow proper sorting
69 function cmp_hcfa_info($first, $second)
71 $first_value=$first->get_position();
72 $second_value=$second->get_position();
73 if ($first_value==$second_value) {
77 return $first_value<$second_value ?
-1 : 1;
81 * calculate where on the form a given diagnosis belongs and add it to the entries
83 * @param array $hcfa_entries
87 function add_diagnosis(&$hcfa_entries, $number, $diag)
90 * The diagnoses go across the page.
96 $column_num = ($number%4
);
97 $row_num = (int)($number / 4);
99 // First column is at location 3, each column is 13 wide
100 $col_pos=3+
13*$column_num;
102 // First diagnosis row is 38
104 $diag = preg_replace($strip, '', strtoupper($diag));
105 $row_pos=38+
$row_num;
106 $hcfa_entries[]=new hcfa_info($row_pos, $col_pos, 8, $diag);
110 * Process the diagnoses for a given claim. log any errors
115 function process_diagnoses_02_12(&$claim, &$log)
118 $hcfa_entries=array();
119 $diags = $claim->diagArray(false);
120 if ($claim->diagtype
=='ICD10') {
126 $hcfa_entries[]=new hcfa_info(37, 42, 1, $icd_indicator);
128 // Box 22. Medicaid Resubmission Code and Original Ref. No.
129 $hcfa_entries[]=new hcfa_info(38, 50, 10, $claim->medicaidResubmissionCode());
130 $hcfa_entries[]=new hcfa_info(38, 62, 15, $claim->medicaidOriginalReference());
132 // Box 23. Prior Authorization Number
133 $hcfa_entries[]=new hcfa_info(40, 50, 28, $claim->priorAuth());
136 foreach ($diags as $diag) {
137 if ($diag_count<12) {
138 add_diagnosis($hcfa_entries, $diag_count, $diag);
140 $log.= "***Too many diagnoses ".($diag_count+
1).":".$diag;
146 // Sort the entries to put them in the page base sequence.
147 usort($hcfa_entries, "cmp_hcfa_info");
149 foreach ($hcfa_entries as $hcfa_entry) {