Highway to PSR2
[openemr.git] / library / classes / rulesets / Cqm / reports / common / DiabetesExclusions.php
blob08ed18374a5f88f3c001aae3d8786f9d3cd09de8
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 DiabetesExclusions implements CqmFilterIF
11 public function getTitle()
13 return "Exclusions";
16 public function test(CqmPatient $patient, $beginDate, $endDate)
18 $beginMinus2Years = strtotime('-2 year', strtotime($beginDate));
19 if (( Helper::checkDiagActive(Diagnosis::POLYCYSTIC_OVARIES, $patient, $patient->dob, $endDate) &&
20 !( Helper::checkDiagActive(Diagnosis::DIABETES, $patient, $beginMinus2Years, $endDate) &&
21 ( Helper::checkEncounter(Encounter::ENC_ACUTE_INP_OR_ED, $patient, $beginMinus2Years, $endDate) ||
22 Helper::checkEncounter(Encounter::ENC_NONAC_INP_OUT_OR_OPTH, $patient, $beginMinus2Years, $endDate) ) ) ) ||
23 ( ( Helper::checkDiagActive(Diagnosis::GESTATIONAL_DIABETES, $patient, $beginMinus2Years, $endDate) ||
24 Helper::checkDiagActive(Diagnosis::STEROID_INDUCED_DIABETES, $patient, $beginMinus2Years, $endDate) ) &&
25 ( Helper::checkMed(Medication::DISP_DIABETES, $patient, $beginMinus2Years, $endDate) ||
26 Helper::checkMed(Medication::ORDER_DIABETES, $patient, $beginMinus2Years, $endDate) ||
27 Helper::checkMed(Medication::ACTIVE_DIABETES, $patient, $beginMinus2Years, $endDate) ) &&
28 !( Helper::checkDiagActive(Diagnosis::DIABETES, $patient, $beginMinus2Years, $endDate) &&
29 ( Helper::checkEncounter(Encounter::ENC_ACUTE_INP_OR_ED, $patient, $beginMinus2Years, $endDate) ||
30 Helper::checkEncounter(Encounter::ENC_NONAC_INP_OUT_OR_OPTH, $patient, $beginMinus2Years, $endDate) ) ) ) ) {
31 return true;
34 return false;