edihistory -- outline selected row in csvTables tab
[openemr.git] / library / lists.inc
blob9a5806bd9f9c675532ab9f68615a5aa87f7b3690
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 if (!empty($GLOBALS['ippf_specific'])) {
5   $ISSUE_TYPES = array(
6     // table type, plural, singular, abbrev, style, force show patient summary screen
7     'medical_problem' => array(xl('Medical Problems'),xl('Problem')      ,xl('P'),0,1),
8     'allergy'         => array(xl('Allergies')       ,xl('Allergy')      ,xl('Y'),0,1),
9     'medication'      => array(xl('Medications')     ,xl('Medication')   ,xl('M'),0,1),
10     'surgery'         => array(xl('Surgeries')       ,xl('Surgery')      ,xl('S'),0,0),
11     'ippf_gcac'       => array(xl('Abortions')       ,xl('Abortion')     ,xl('A'),3,0),
12     'contraceptive'   => array(xl('Contraception')   ,xl('Contraception'),xl('C'),4,0),
13 //  'ippf_srh'        => array(xl('SRH')             ,xl('SRH')          ,xl('R'),5),
14   );
16 else if (!empty($GLOBALS['athletic_team'])) {
17   $ISSUE_TYPES = array(
18     'football_injury' => array(xl('Football Injuries'),xl('Injury') ,xl('I'),2,1),
19     'medical_problem' => array(xl('Medical Problems') ,xl('Medical'),xl('P'),0,0),
20     'allergy'         => array(xl('Allergies')        ,xl('Allergy'),xl('A'),1,0),
21     'general'         => array(xl('General')          ,xl('General'),xl('G'),1,0),
22   );
24 else { // default version
25   $ISSUE_TYPES = array(
26     // table type, plural, singular, abbrev, style, force show patient summary screen
27     'medical_problem' => array(xl('Medical Problems'),xl('Problem')   ,xl('P'),0,1),
28     'allergy'         => array(xl('Allergies')       ,xl('Allergy')   ,xl('A'),0,1),
29     'medication'      => array(xl('Medications')     ,xl('Medication'),xl('M'),0,1),
30     'surgery'         => array(xl('Surgeries')       ,xl('Surgery')   ,xl('S'),0,0),
31     'dental'          => array(xl('Dental Issues')   ,xl('Dental')    ,xl('D'),0,0),
32     //
33     // Styles are:
34     // 0 - Normal, as in 2.8.1.
35     // 1 - Simplified: only title, start date, comments and an Active checkbox;
36     //     no diagnosis, occurrence, end date, referred-by or sports fields.
37     //     Internally we'll still use a null end date to indicate active.
38     // 2 - Football Injury.
39     //
40     // force show patient summary screen is:
41     // 0 - Do not show this category on the patient summary screen if there have
42     //     been no issues entered in for this category.
43     // 1 - Show this category on the patient summary screen even if no issues have
44     //     been entered for this category.
45     //
46   );
50 // 06/2009 - BM Migrated the ISSUE_OCCURRENCES to list_options
53 $ISSUE_CLASSIFICATIONS = array(
54   0   => xl('Unknown or N/A'),
55   1   => xl('Trauma'),
56   2   => xl('Overuse')
59 function getListById ($id, $cols = "*")
61         return sqlQuery("select $cols from lists where id='$id' order by date DESC limit 0,1");
64 function getListByType ($pid, $type, $cols = "*", $active = "all", $limit = "all", $offset="0")
66         if($active == "all")
67                 $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC";
68         else
69                 $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC";
70         if ($limit != "all")
71                 $sql .= " limit $offset,$limit";
72         
74         $res = sqlStatement($sql);
75         for($iter =0;$row = sqlFetchArray($res);$iter++)
76                 $all[$iter] = $row;
77         return $all;
81 function addList ($pid, $type, $title, $comments, $activity = "1")
83         return sqlInsert("insert into lists (date, pid, type, title, activity, comments, user, groupname) values (NOW(), '$pid', '$type', '$title', '$activity', '$comments', '".$_SESSION['authUser']."', '".$_SESSION['authProvider']."')");
86 function disappearList ($id)
88         sqlStatement("update lists set activity = '0' where id='$id'");
89         return true;
92 function reappearList ($id)
94         sqlStatement("update lists set activity = '1' where id='$id'");
95         return true;
98 function getListTouch ($patient_id,$type)
100         $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) );
102         if (!empty($ret)) {
103                 return $ret['date'];
104         }
105         else {
106                 return false;
107         }
110 function setListTouch ($patient_id,$type)
112         $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) );
114         if (!empty($ret)) {
115                 // Already touched, so can exit
116                 return;
117         }
118         else {
119                 sqlStatement("INSERT INTO `lists_touch` ( `pid`,`type`,`date` ) VALUES ( ?, ?, NOW() )", array($patient_id,$type) );
120         }