Highway to PSR2
[openemr.git] / library / classes / rulesets / Cqm / reports / NFQ_0013 / InitialPatientPopulation.php
blobbf194801dabe78325d4f5a31c8e687afe318472d
1 <?php
2 /**
4 * CQM NQF 0013 Initial Patient Population
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 NFQ_0013_InitialPatientPopulation implements CqmFilterIF
26 public function getTitle()
28 return "Initial Patient Population";
31 public function test(CqmPatient $patient, $beginDate, $endDate)
33 $encounterCount = array( Encounter::OPTION_ENCOUNTER_COUNT => 1 );
34 if ($patient->calculateAgeOnDate($beginDate) >= 18 && $patient->calculateAgeOnDate($beginDate) < 85 &&
35 ( Helper::check(ClinicalType::DIAGNOSIS, Diagnosis::HYPERTENSION, $patient, $beginDate, date('Y-m-d H:i:s', strtotime('+6 month', strtotime($beginDate)))) || (Helper::check(ClinicalType::DIAGNOSIS, Diagnosis::HYPERTENSION, $patient, $beginDate, $beginDate)) ) &&
36 ( Helper::check(ClinicalType::ENCOUNTER, Encounter::ENC_OUTPATIENT, $patient, $beginDate, $endDate, $encounterCount) ||
37 Helper::check(ClinicalType::ENCOUNTER, Encounter::ENC_NURS_FAC, $patient, $beginDate, $endDate, $encounterCount) ) ) {
38 return true;
41 return false;