Installer Class missing array variable check
[openemr.git] / library / classes / ClinicalTypes / Characteristic.php
bloba90fc7c61e6c94482e69dd1c0c96c42fb771d5db
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 require_once( 'ClinicalType.php' );
11 class Characteristic extends ClinicalType
13 const TERMINAL_ILLNESS = 'terminal_illness';
14 const TOBACCO_USER = 'char_tobacco_user';
15 const TOBACCO_NON_USER = 'char_tobacco_non_user';
17 public function getListId() {
18 return 'Clinical_Rules_Char_Types';
21 public function doPatientCheck( RsPatient $patient, $beginDate = null, $endDate = null, $options = null )
23 $return = false;
25 if ( $this->getOptionId() == self::TERMINAL_ILLNESS )
27 // TODO check for terminal illness
29 else if ( $this->getOptionId() == self::TOBACCO_USER )
31 $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' ) {
36 $return = true;
37 } else if ( $tobaccoStatus == 'quittobacco' ) {
38 $quitDate = $tmp[2];
39 if ( strtotime( $quitDate ) > strtotime( $beginDate ) ) {
40 $return = true;
45 else if ( $this->getOptionId() == self::TOBACCO_NON_USER )
47 $tobaccoHistory = getHistoryData( $patient->id, "tobacco", $beginDate, $endDate );
48 if ( isset( $tobaccoHistory['tobacco'] ) ) {
49 $tmp = explode( '|', $tobaccoHistory['tobacco'] );
50 $tobaccoStatus = $tmp[1];
51 if ( $tobaccoStatus == 'quittobacco' ) {
52 $quitDate = $tmp[2];
53 if ( strtotime( $quitDate ) < strtotime( $beginDate ) ) {
54 $return = true;
56 } else if ( $tobaccoStatus == 'nevertobacco' ) {
57 $return = true;
62 return $return;