added ending dates of service
[openemr.git] / library / lists.inc
blobcd4f945bbfb126d165d19023abe0abae780884b8
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     'general'         => array('General'          , 'General'   , 'G',  1),
27   );
30 $ISSUE_OCCURRENCES = array(
31   0   => xl('Unknown or N/A'),
32   1   => xl('First'),
33   6   => xl('Early Recurrence (<2 Mo)'),
34   7   => xl('Late Recurrence (2-12 Mo)'),
35   8   => xl('Delayed Recurrence (> 12 Mo)'),
36 //2   => xl('Second'),
37 //3   => xl('Third'),
38   4   => xl('Chronic/Recurrent'),
39   5   => xl('Acute on Chronic')
42 $ISSUE_CLASSIFICATIONS = array(
43   0   => xl('Unknown or N/A'),
44   1   => xl('Trauma'),
45   2   => xl('Overuse')
48 function getListById ($id, $cols = "*")
50         return sqlQuery("select $cols from lists where id='$id' order by date DESC limit 0,1");
53 function getListByType ($pid, $type, $cols = "*", $active = "all", $limit = "all", $offset="0")
55         if($active == "all")
56                 $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC";
57         else
58                 $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC";
59         if ($limit != "all")
60                 $sql .= " limit $offset,$limit";
61         
63         $res = sqlStatement($sql);
64         for($iter =0;$row = sqlFetchArray($res);$iter++)
65                 $all[$iter] = $row;
66         return $all;
70 function addList ($pid, $type, $title, $comments, $activity = "1")
72         return sqlInsert("insert into lists (date, pid, type, title, activity, comments, user, groupname) values (NOW(), '$pid', '$type', '$title', '$activity', '$comments', '".$_SESSION['authUser']."', '".$_SESSION['authProvider']."')");
75 function disappearList ($id)
77         sqlStatement("update lists set activity = '0' where id='$id'");
78         return true;
81 function reappearList ($id)
83         sqlStatement("update lists set activity = '1' where id='$id'");
84         return true;