Highway to PSR2
[openemr.git] / library / classes / ClinicalTypes / ClinicalType.php
blob9c4354a570b6cdd7d1a71d5916c4c22e2e8b4cd9
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(dirname(__FILE__) . "/../../clinical_rules.php");
10 require_once(dirname(__FILE__) . "/../../forms.inc");
11 require_once(dirname(__FILE__) . "/../../patient.inc");
12 require_once(dirname(__FILE__) . "/../../lists.inc");
13 require_once(dirname(__FILE__) . "/../rulesets/library/RsPatient.php");
14 require_once('codes.php');
16 abstract class ClinicalType
18 const ALLERGY = 'Allergy';
19 const CARE_GOAL = 'CareGoal';
20 const DIAGNOSIS = 'Diagnosis';
21 const ENCOUNTER = 'Encounter';
22 const MEDICATION = 'Medication';
23 const COMMUNICATION = 'Communication';
24 const CHARACTERISTIC = 'Characteristic';
25 const PHYSICAL_EXAM = 'PhysicalExam';
26 const LAB_RESULT = 'LabResult';
28 private $_optionId;
29 private $_title;
30 private $_notes;
32 public function __construct($optionId)
34 $this->_optionId = $optionId;
35 $result = $this->getListOptionById($optionId);
36 $this->_title = $result['title'];
37 $this->_notes = $result['notes'];
41 * Check if this clinical type applies to this patient.
43 * @param (RsPatient) $patient
44 * @param (date) $beginMeasurement
45 * @param (date) $endMeasurement
47 * @return true if type applies, false ow
49 abstract public function doPatientCheck(RsPatient $patient, $beginDate = null, $endDate = null, $options = null);
50 abstract public function getListId();
52 public function getOptionId()
54 return $this->_optionId;
57 public function getNotes()
59 return $this->_notes;
62 public function getListOptions()
64 return array();
67 private function getListOptionById($id)
69 $query = "SELECT * " .
70 "FROM `list_options` " .
71 "WHERE list_id = ? " .
72 "AND option_id = ? AND activity = 1";
73 $results = sqlStatement($query, array( $this->getListId(), $id ));
74 $arr = sqlFetchArray($results);
75 return $arr;