3 // Copyright (C) 2011 Ken Chapple <ken@mi-squared.com>
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 require_once('ClinicalType.php');
12 class Characteristic
extends ClinicalType
14 const TERMINAL_ILLNESS
= 'terminal_illness';
15 const TOBACCO_USER
= 'char_tobacco_user';
16 const TOBACCO_NON_USER
= 'char_tobacco_non_user';
18 public function getListId()
20 return 'Clinical_Rules_Char_Types';
23 public function doPatientCheck(RsPatient
$patient, $beginDate = null, $endDate = null, $options = null)
27 if ($this->getOptionId() == self
::TERMINAL_ILLNESS
) {
28 // TODO check for terminal illness
29 } elseif ($this->getOptionId() == self
::TOBACCO_USER
) {
30 $tobaccoHistory = getHistoryData($patient->id
, "tobacco", $beginDate, $endDate);
32 if (isset($tobaccoHistory['tobacco'])) {
33 $tmp = explode('|', $tobaccoHistory['tobacco']);
34 $tobaccoStatus = $tmp[1];
35 if ($tobaccoStatus == 'currenttobacco') {
37 } elseif ($tobaccoStatus == 'quittobacco') {
39 if (strtotime($quitDate) > strtotime($beginDate)) {
44 } elseif ($this->getOptionId() == self
::TOBACCO_NON_USER
) {
45 $tobaccoHistory = getHistoryData($patient->id
, "tobacco", $beginDate, $endDate);
46 if (isset($tobaccoHistory['tobacco'])) {
47 $tmp = explode('|', $tobaccoHistory['tobacco']);
48 $tobaccoStatus = $tmp[1];
49 if ($tobaccoStatus == 'quittobacco') {
51 if (strtotime($quitDate) < strtotime($beginDate)) {
54 } elseif ($tobaccoStatus == 'nevertobacco') {