Highway to PSR2
[openemr.git] / library / classes / rulesets / Amc / reports / AMC_314g_1_2_20 / Numerator.php
blob657eb569848a6a9f3cf34c47f567ca21bbfc3f34
1 <?php
2 /**
4 * AMC 314g_1_2_20 STAGE1 Numerator
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
24 class AMC_314g_1_2_20_Numerator implements AmcFilterIF
27 // Still TODO
28 // AMC MU2 TODO :
29 // 1. Remove the $patArr stuff.
31 public $patArr = array();
32 public function getTitle()
34 return "AMC_314g_1_2_20 Numerator";
37 public function test(AmcPatient $patient, $beginDate, $endDate)
39 if (!in_array($patient->id, $this->patArr)) {
40 $this->patArr[] = $patient->id;
42 // Still TODO
43 // AMC MU2 TODO :
44 // These mechanism seems really odd. Will need to research this a bit.
46 $docLabQry = "SELECT count(*) as cnt FROM documents d ".
47 "INNER JOIN categories_to_documents cd ON d.id = cd.document_id ".
48 "INNER JOIN categories dlc ON cd.category_id = dlc.id AND dlc.name = 'Lab Report' ".
49 "INNER JOIN patient_data pd ON pd.pid = d.foreign_id ".
50 "WHERE d.foreign_id = ? AND (d.date BETWEEN ? AND ?) ";
51 $check = sqlQuery($docLabQry, array($patient->id, $beginDate, $endDate));
52 if ($check['cnt'] > 0) {
53 return true;
54 } else {
55 return false;