Change support desk contact information (#7561)
[openemr.git] / library / classes / rulesets / Amc / reports / AMC_304i_STG1 / Numerator.php
blob3f4432b4012bba56c36ce5082acd022e141e0015
1 <?php
3 /**
5 * AMC 304i STAGE1 Numerator
7 * Copyright (C) 2015 Ensoftek, Inc
9 * LICENSE: This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
20 * @package OpenEMR
21 * @author Ensoftek
22 * @link http://www.open-emr.org
25 class AMC_304i_STG1_Numerator implements AmcFilterIF
27 public function getTitle()
29 return "AMC_304i_STG1 Numerator";
32 public function test(AmcPatient $patient, $beginDate, $endDate)
34 //The number of transitions of care and referrals in the denominator where a summary of care record was provided.
35 // (so basically an amc element needs to exist)
36 $amcElement = amcCollect('send_sum_amc', $patient->id, 'transactions', $patient->object['id']);
37 if (!(empty($amcElement))) {
38 $no_problems = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medical_problem'", array($patient->id));
39 $problems = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medical_problem'", array($patient->id));
41 $no_allergy = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'allergy'", array($patient->id));
42 $allergies = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'allergy'", array($patient->id));
44 $no_medication = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medication'", array($patient->id));
45 $medications = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medication'", array($patient->id));
46 $prescriptions = sqlQuery("select count(*) as cnt from prescriptions where patient_id = ? ", array($patient->id));
48 if (($no_problems['cnt'] > 0 || $problems['cnt'] > 0) && ($no_allergy['cnt'] > 0 || $allergies['cnt'] > 0) && ($no_medication['cnt'] > 0 || $medications['cnt'] > 0 || $prescriptions['cnt'] > 0)) {
49 return true;
52 return false;
53 } else {
54 return false;