consolidated reviewMode in forms.php (this can then be used for view only acl users...
[openemr.git] / custom / qrda_category1.inc
blobb83e3db3de0afbfc5d486d64d77b5b7dea1dc3b7
1 <?php
2 /**
3  *
4  * QRDA Category1 File
5  *
6  * Copyright (C) 2015 Ensoftek, Inc
7  *
8  * LICENSE: This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18  *
19  * @package OpenEMR
20  * @author  Ensoftek
21  * @link    http://www.open-emr.org
22  */
25         //Initialization of QRDA Elements
26         //QRDA Needed Race
27         $mainQrdaRaceCodeArr =  array('amer_ind_or_alaska_native'=>'1002-5', 'Asian'=>'2028-9', 'black_or_afri_amer'=>'2054-5', 'native_hawai_or_pac_island'=>'2076-8', 'white'=>'2106-3', 'Asian_Pacific_Island'=>'2131-1', 'Black_not_of_Hispan'=>'2131-1', 'Hispanic'=>'2131-1', 'White_not_of_Hispan'=>'2131-1');
28         
29         //QRDA Needed Ethnicity
30         $mainEthiCodeArr =  array('not_hisp_or_latin'=>'2186-5', 'hisp_or_latin'=>'2135-2');
31         
32         //QRDA Needed Payer Info
33         $mainQrdaPayerCodeSendArr = array();
34         $encCheckUniqId = array();
35         $mainQrdaPayerCodeSendArr['Medicare'] = "1";
36         $mainQrdaPayerCodeSendArr['Medicaid'] = "2";
37         $mainQrdaPayerCodeSendArr['Private Health Insurance'] = "5";
38         $mainQrdaPayerCodeSendArr['Other'] = "349";
39         
40         //QRDA
41         $preDefinedUniqIDRules = array();
42         $preDefinedUniqIDRules['0101'] = '40280381-4555-E1C1-0145-672613970D15';
43         $preDefinedUniqIDRules['0043'] = '40280381-4555-E1C1-0145-762578A81C4C';
44         $preDefinedUniqIDRules['0421'] = '40280381-4555-E1C1-0145-D2B36DBB3FE6';
45         $preDefinedUniqIDRules['0038'] = '40280381-4555-E1C1-0145-D7C003364261';
46         $preDefinedUniqIDRules['0028'] = '40280381-4600-425F-0146-1F5867D40E82';
47         $preDefinedUniqIDRules['0384'] = '40280381-4600-425F-0146-1F620BDF0EB0';
48         $preDefinedUniqIDRules['0002'] = '40280381-4600-425F-0146-1F6E280C0F09';
49         $preDefinedUniqIDRules['0018'] = '40280381-4600-425F-0146-1F6F722B0F17';
50         $preDefinedUniqIDRules['0013'] = '40280381-4600-425F-0146-1F6F722B0F17';
51         $preDefinedUniqIDRules['0024'] = '40280381-4555-E1C1-0145-85C7311720F5';
52         $preDefinedUniqIDRules['0059'] = '40280381-4555-E1C1-0145-90AC70DE2C73';
53         $preDefinedUniqIDRules['0041'] = '40280381-4600-425F-0146-EE66F0005509';
54         
55         $qrda_file_path = $GLOBALS['OE_SITE_DIR'] . "/documents/cqm_qrda/";
56         
57         $EncounterCptCodes = array('ophthalmological_services' => '92002');
58         
59         function getCombinePatients($dataSheet, $reportID) {
60                 foreach( $dataSheet as $singleDataSheet ) {
61                         //var_dump($singleDataSheet['cqm_nqf_code'],$singleDataSheet['init_patients']);
62                         if ( count($cqmCodes) && in_array($singleDataSheet['cqm_nqf_code'],$cqmCodes) ) {
63                                 $initPatArr = collectItemizedPatientsCdrReport($reportID, $singleDataSheet['itemized_test_id'], "init_patients");
64                                 $fullPatArr = array();
65                                 foreach($initPatArr as $initPatInfo){
66                                         $fullPatArr[] = $initPatInfo['pid'];
67                                 }
68                                 $patients[$singleDataSheet['cqm_nqf_code']] = array_merge($patients[$singleDataSheet['cqm_nqf_code']], $fullPatArr);
69                                 $patients[$singleDataSheet['cqm_nqf_code']] = array_unique($patients[$singleDataSheet['cqm_nqf_code']]);
70                         } else {
71                                 $cqmCodes[] = $singleDataSheet['cqm_nqf_code'];
72                                 $initPatArr = collectItemizedPatientsCdrReport($reportID, $singleDataSheet['itemized_test_id'], "init_patients");
73                                 $fullPatArr = array();
74                                 foreach($initPatArr as $initPatInfo){
75                                         $fullPatArr[] = $initPatInfo['pid'];
76                                 }
77                                 $patients[$singleDataSheet['cqm_nqf_code']] = $fullPatArr;
78                         }
79                 }
80                 return $patients;
81         }
82         
83