2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 if (!empty($GLOBALS['ippf_specific'])) {
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),
16 else if (!empty($GLOBALS['athletic_team'])) {
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),
24 else { // default version
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),
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.
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.
50 // 06/2009 - BM Migrated the ISSUE_OCCURRENCES to list_options
53 $ISSUE_CLASSIFICATIONS = array(
54 0 => xl('Unknown or N/A'),
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")
67 $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC";
69 $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC";
71 $sql .= " limit $offset,$limit";
74 $res = sqlStatement($sql);
75 for($iter =0;$row = sqlFetchArray($res);$iter++)
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'");
92 function reappearList ($id)
94 sqlStatement("update lists set activity = '1' where id='$id'");
98 function getListTouch ($patient_id,$type)
100 $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) );
110 function setListTouch ($patient_id,$type)
112 $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) );
115 // Already touched, so can exit
119 sqlStatement("INSERT INTO `lists_touch` ( `pid`,`type`,`date` ) VALUES ( ?, ?, NOW() )", array($patient_id,$type) );