2 // Copyright (C) 2011 Ken Chapple <ken@mi-squared.com>
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.
9 require_once( 'ClinicalType.php' );
11 class Allergy
extends ClinicalType
13 const DTAP_VAC
= 'med_allergy_dtap_vac';
14 const IPV
= 'med_allergy_ipv';
15 const NEOMYCIN
= 'med_allergy_neomycin';
16 const STREPTOMYCIN
= 'med_allergy_streptomycin';
17 const POLYMYXIN
= 'med_allergy_polymyxin';
18 const HIB
= 'med_allergy_hib';
19 const MUMPS_VAC
= 'med_allergy_mumps_vac';
20 const MEASLES_VAC
= 'med_allergy_measles_vac';
21 const RUBELLA_VAC
= 'med_allergy_rubella_vac';
22 const MMR
= 'med_allergy_mmr';
23 const BAKERS_YEAST
= 'subst_allergy_bakers_yeast';
24 const VZV
= 'med_allergy_vzv';
25 const PNEUM_VAC
= 'med_allergy_pneum_vac';
26 const HEP_A_VAC
= 'med_allergy_hep_a_vac';
27 const HEP_B_VAC
= 'med_allergy_hep_b_vac';
28 const ROTAVIRUS_VAC
= 'med_allergy_rotavirus_vac';
29 const INFLUENZA_VAC
= 'med_allergy_flu_vac';
30 const INFLUENZA_IMMUN
= 'med_allergy_flu_immun';
31 const EGGS
= 'subst_allergy_eggs';
33 public function getListType() {
37 public function getListId() {
38 return 'Clinical_Rules_Allergy_Types';
42 * Check to see if a patient had an allergy to THIS thing between $beginDate and $endDate
43 * $beginDate and $endDate can be the same, indicating a check for allergy on particular date
45 * @param (RsPatient) $patient Patient to check
46 * @param (date) $beginDate Lower bound on date to check for allergy
47 * @param (date) $endDate Upper bound on date to check for allergy
49 public function doPatientCheck( RsPatient
$patient, $beginDate = null, $endDate = null, $options = null )
51 $data = Codes
::lookup( $this->getOptionId() );
52 $type = $this->getListType();
53 foreach( $data as $codeType => $codes ) {
54 foreach ( $codes as $code ) {
55 if ( exist_lists_item( $patient->id
, $type, $codeType.'::'.$code, $endDate ) ) {