added allergies as a separate issue type for sports teams
[openemr.git] / library / lists.inc
blobec89e7d84cc85d18313876df6050859833bd7576
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 if (empty($GLOBALS['athletic_team'])) {
5   $ISSUE_TYPES = array(
6     // table type               plural              singular    abbrev style
7     'medical_problem' => array('Medical Problems', 'Problem'   , 'P',  0),
8     'allergy'         => array('Allergies'       , 'Allergy'   , 'A',  0),
9     'medication'      => array('Medications'     , 'Medication', 'M',  0),
10     'surgery'         => array('Surgeries'       , 'Surgery'   , 'S',  0),
11     'dental'          => array('Dental Issues'   , 'Dental'    , 'D',  0),
12     //
13     // Styles are:
14     // 0 - Normal, as in 2.8.1.
15     // 1 - Simplified: only title, start date, comments and an Active checkbox;
16     //     no diagnosis, occurrence, end date, referred-by or sports fields.
17     //     Internally we'll still use a null end date to indicate active.
18     // 2 - Football Injury.
19     //
20   );
22 else { // sports team version
23   $ISSUE_TYPES = array(
24     'football_injury' => array('Football Injuries', 'Injury'    , 'I',  2),
25     'medical_problem' => array('Medical Problems' , 'Problem'   , 'P',  0),
26     'allergy'         => array('Allergies'        , 'Allergy'   , 'A',  1),
27     'general'         => array('General'          , 'General'   , 'G',  1),
28   );
31 $ISSUE_OCCURRENCES = array(
32   0   => xl('Unknown or N/A'),
33   1   => xl('First'),
34   6   => xl('Early Recurrence (<2 Mo)'),
35   7   => xl('Late Recurrence (2-12 Mo)'),
36   8   => xl('Delayed Recurrence (> 12 Mo)'),
37 //2   => xl('Second'),
38 //3   => xl('Third'),
39   4   => xl('Chronic/Recurrent'),
40   5   => xl('Acute on Chronic')
43 $ISSUE_CLASSIFICATIONS = array(
44   0   => xl('Unknown or N/A'),
45   1   => xl('Trauma'),
46   2   => xl('Overuse')
49 function getListById ($id, $cols = "*")
51         return sqlQuery("select $cols from lists where id='$id' order by date DESC limit 0,1");
54 function getListByType ($pid, $type, $cols = "*", $active = "all", $limit = "all", $offset="0")
56         if($active == "all")
57                 $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC";
58         else
59                 $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC";
60         if ($limit != "all")
61                 $sql .= " limit $offset,$limit";
62         
64         $res = sqlStatement($sql);
65         for($iter =0;$row = sqlFetchArray($res);$iter++)
66                 $all[$iter] = $row;
67         return $all;
71 function addList ($pid, $type, $title, $comments, $activity = "1")
73         return sqlInsert("insert into lists (date, pid, type, title, activity, comments, user, groupname) values (NOW(), '$pid', '$type', '$title', '$activity', '$comments', '".$_SESSION['authUser']."', '".$_SESSION['authProvider']."')");
76 function disappearList ($id)
78         sqlStatement("update lists set activity = '0' where id='$id'");
79         return true;
82 function reappearList ($id)
84         sqlStatement("update lists set activity = '1' where id='$id'");
85         return true;