Highway to PSR2
[openemr.git] / library / classes / rulesets / Cqm / reports / common / DiabetesDenominator.php
blob3f8c83fcb164340ea5eec03886dba4a180c7971c
1 <?php
2 // Copyright (C) 2011 Ken Chapple <ken@mi-squared.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 class DiabetesDenominator implements CqmFilterIF
11 public function getTitle()
13 return "Denominator";
16 public function test(CqmPatient $patient, $beginDate, $endDate)
18 // TODO how to check for these medication types?
19 $beginMinus2Years = strtotime('-2 year', strtotime($beginDate));
20 if (Helper::checkMed(Medication::DISP_DIABETES, $patient, $beginMinus2Years, $endDate) ||
21 Helper::checkMed(Medication::ORDER_DIABETES, $patient, $beginMinus2Years, $endDate) ||
22 Helper::checkMed(Medication::ACTIVE_DIABETES, $patient, $beginMinus2Years, $endDate) ||
23 ( Helper::checkDiagActive(Diagnosis::DIABETES, $patient, $beginMinus2Years, $endDate) &&
24 ( Helper::checkEncounter(Encounter::ENC_ACUTE_INP_OR_ED, $patient, $beginDate, $endDate) ||
25 Helper::checkEncounter(Encounter::ENC_NONAC_INP_OUT_OR_OPTH, $patient, $beginDate, $endDate, array( Encounter::OPTION_ENCOUNTER_COUNT => 2 )) ) ) ) {
26 return true;
29 return false;