4 * AMC 304i 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>;.
21 * @link http://www.open-emr.org
24 class AMC_304i_STG1_Numerator
implements AmcFilterIF
26 public function getTitle()
28 return "AMC_304i_STG1 Numerator";
31 public function test(AmcPatient
$patient, $beginDate, $endDate)
33 //The number of transitions of care and referrals in the denominator where a summary of care record was provided.
34 // (so basically an amc element needs to exist)
35 $amcElement = amcCollect('send_sum_amc', $patient->id
, 'transactions', $patient->object['id']);
36 if (!(empty($amcElement))) {
37 $no_problems = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medical_problem'", array($patient->id
));
38 $problems = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medical_problem'", array($patient->id
));
40 $no_allergy = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'allergy'", array($patient->id
));
41 $allergies = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'allergy'", array($patient->id
));
43 $no_medication = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medication'", array($patient->id
));
44 $medications = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medication'", array($patient->id
));
45 $prescriptions = sqlQuery("select count(*) as cnt from prescriptions where patient_id = ? ", array($patient->id
));
47 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)) {