Highway to PSR2
[openemr.git] / library / classes / rulesets / Cqm / reports / NFQ_0101 / DenominatorException.php
blob7d37020932ef563a2868de54a3a5a8d3e3232676
1 <?php
2 /**
4 * CQM NQF 0101 Denominator Exception
6 * Copyright (C) 2015 Ensoftek, Inc
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>;.
19 * @package OpenEMR
20 * @author Ensoftek
21 * @link http://www.open-emr.org
25 class NFQ_0101_DenominatorException implements CqmFilterIF
27 public function getTitle()
29 return "DenominatorException";
32 public function test(CqmPatient $patient, $beginDate, $endDate)
34 //Risk Category Assessment not done: Medical Reasons and Risk Category Assessment: Patient Not Ambulatory with their identifying
35 //SNOMEDCT(160685001) code to support a Denominator Exception in the measure when chosen for a patient.
36 //OR
37 //Risk Category Tobacco Screening Done to allow a provider to document that the screening was performed along with other numerous options from the Risk
38 //Category Assessment not done: Medical Reason value set with the identifying SNOMEDCT Code attached at the Select List level.
39 //Risk Category Assessment SNOMEDCT 161590003, 183932001, 183964008, 183966005, 216952002, 266721009, 269191009
40 $riskCatAssessQry = "SELECT count(*) as cnt FROM form_encounter fe ".
41 "INNER JOIN openemr_postcalendar_categories opc ON fe.pc_catid = opc.pc_catid ".
42 "INNER JOIN procedure_order pr ON fe.encounter = pr.encounter_id ".
43 "INNER JOIN procedure_order_code prc ON pr.procedure_order_id = prc.procedure_order_id ".
44 "WHERE opc.pc_catname = 'Office Visit' ".
45 "AND (fe.date BETWEEN ? AND ?) ".
46 "AND fe.pid = ? ".
47 "AND ( prc.procedure_code = '160685001' OR prc.procedure_code = '161590003' OR prc.procedure_code = '183932001' OR prc.procedure_code = '183964008' OR prc.procedure_code = '183966005' OR prc.procedure_code = '216952002' OR prc.procedure_code = '266721009' OR prc.procedure_code = '269191009' ) ".
48 "AND prc.procedure_order_title = 'Risk Category Assessment'";
50 $check = sqlQuery($riskCatAssessQry, array($beginDate, $endDate, $patient->id));
51 if ($check['cnt'] > 0) {
52 return true;
53 } else {
54 return false;