4 * CQM NQF 0013 Exclusion
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 NFQ_0013_Exclusion
implements CqmFilterIF
26 public function getTitle()
31 public function test( CqmPatient
$patient, $beginDate, $endDate )
33 //Also exclude patients with a diagnosis of pregnancy during the measurement period.
34 if ( Helper
::check( ClinicalType
::DIAGNOSIS
, Diagnosis
::PREGNANCY
, $patient, $beginDate, $beginDate ) || Helper
::check( ClinicalType
::DIAGNOSIS
, Diagnosis
::END_STAGE_RENAL_DISEASE
, $patient, $beginDate, $beginDate ) || Helper
::check( ClinicalType
::DIAGNOSIS
, Diagnosis
::CHRONIC_KIDNEY_DISEASE
, $patient, $beginDate, $beginDate )){
38 $procedure_code = implode(',',Codes
::lookup(Procedure
::DIALYSIS_SERVICE
,'SNOMED'));
39 //Dialysis procedure exists exclude the patient
40 $sql = "SELECT count(*) as cnt FROM procedure_order pr ".
41 "INNER JOIN procedure_order_code prc ON pr.procedure_order_id = prc.procedure_order_id ".
42 "WHERE pr.patient_id = ? ".
43 "AND prc.procedure_code IN ($procedure_code) ".
44 "AND (pr.date_ordered BETWEEN ? AND ?)";
46 $check = sqlQuery( $sql, array($patient->id
, $beginDate, $endDate) );
47 if ($check['cnt'] > 0){