Fix for patient finder with PHP < 5.2.0.
[openemr.git] / contrib / forms / plist / new.php
blobe491fa0179d2f02d128783d9707f0270dc5f2083
1 <?php
2 include_once("../../globals.php");
3 include_once("$srcdir/api.inc");
4 include_once("$srcdir/forms.inc");
5 include_once("$srcdir/calendar.inc");
6 include_once("$srcdir/lists.inc");
7 $frmn = 'form_plist';
8 $ftitle = 'Problem list';
9 $old = sqlStatement("select form_id, formdir from forms where (form_name='${ftitle}') and (pid=$pid) order by date desc limit 1");
10 if ($old) {
11 $dt = sqlFetchArray($old);
12 $fid = $dt{'form_id'};
13 if ($fid && ($fid != 0) && ($fid != '')){
14 $fdir = $dt{'formdir'};
15 unset($dt);
16 $dt = formFetch($frmn, $fid);
17 $newid = formSubmit($frmn, array_slice($dt,7), $id, $userauthorized);
18 addForm($encounter, $ftitle, $newid, $fdir, $pid, $userauthorized);
19 $id = $newid;
20 formJump("${rootdir}/patient_file/encounter/view_form.php?formname=${fdir}&id=${newid}");
21 exit;
25 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
26 "http://www.w3.org/TR/html4/loose.dtd">
28 <html>
29 <head>
30 <?php html_header_show();?>
31 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
32 <link rel="stylesheet" href="../../acog.css" type="text/css">
33 <script language="JavaScript" src="../../acog.js" type="text/JavaScript"></script>
34 <script language="JavaScript" type="text/JavaScript">
35 window.onload = initialize;
36 </script>
37 </head>
38 <?php
39 $fres=sqlStatement("select * from patient_data where pid=".$_SESSION["pid"]);
40 if ($fres){
41 $patient = sqlFetchArray($fres);
43 $history = getHistoryData($_SESSION["pid"]);
45 <body class="body_top">
47 <form action="<?php echo $rootdir;?>/forms/plist/save.php?mode=new" method="post" enctype="multipart/form-data" name="my_form">
48 <?php include("../../acog_menu.inc"); ?>
49 <table width="70%" border="0" cellspacing="0" cellpadding="4">
50 <tr>
51 <td width="120" align="left" valign="bottom" class="srvCaption">Patient name:</td>
52 <td align="left" valign="bottom"><input name="pname" type="text" class="fullin" id="pname" value="<?php echo $patient{'fname'}.' '.$patient{'mname'}.' '.$patient{'lname'}; ?>"></td>
53 </tr>
54 <tr>
55 <td width="120" align="left" valign="bottom" class="srvCaption">Birth date: </td>
56 <td align="left" valign="bottom"><input name="pbdate" type="text" class="fullin" id="pbdate" value="<?php echo $patient{'DOB'}; ?>"></td>
57 </tr>
58 <tr>
59 <td width="120" align="left" valign="bottom" class="srvCaption">ID No:</td>
60 <td align="left" valign="bottom"><input name="pl_pid" type="text" class="fullin" id="pl_pid" value="<?php echo $patient{'id'}; ?>" readonly="true"></td>
61 </tr>
62 <tr>
63 <td width="120" align="left" valign="bottom" class="srvCaption">Date</td>
64 <td align="left" valign="bottom"><input name="pl_date" type="text" class="fullin" id="pl_date" value="<?php echo date('Y-m-d'); ?>"></td>
65 </tr>
66 </table>
67 <div class="srvChapter">Problem list <a href="#" onMouseOver="toolTip('The Problem List captures problems, allergies, family history, and current medication use.')" onMouseOut="toolTip();"><img src="../../pic/mark_q.png" width="13" height="13" border="0"></a></div>
68 <div style="border: solid 2px black; background-color:#FFFFFF;">
69 <table width="100%" border="0" cellspacing="0" cellpadding="2">
70 <tr>
71 <td width="50%" class="ficaption3" id="bordR">High risk:</td>
72 <td width="50%" class="ficaption3">Family history:</td>
73 </tr>
74 <tr>
75 <td class="fibody2" id="bordR"><textarea name="pl_high_risk" rows="6" wrap="VIRTUAL" class="fullin2" id="pl_high_risk"><?php echo $obj{'pl_high_risk'} ?></textarea></td>
76 <td class="fibody2"><textarea name="pl_family_history" rows="6" wrap="VIRTUAL" class="fullin2" id="pl_family_history"><?php
77 // ($history['history_mother'] != '' ) ? $tmp[] = "Mother: " . $history['history_mother'] : '';
78 // ($history['history_father'] != '' ) ? $tmp[] = "Father: " . $history['history_father'] : '';
79 // ($history['history_siblings'] != '' ) ? $tmp[] = "Siblings: " . $history['history_siblings'] : '';
80 // ($history['history_spouse'] != '' ) ? $tmp[] = "Spouse: " . $history['history_spouse'] : '';
81 // ($history['history_offspring'] != '') ? $tmp[] = "Offspring: " . $history['history_offspring'] : '';
82 // echo join(', ', $tmp);
83 $tmp = array();
84 if ($history['history_mother' ] != '') $tmp[] = "Mother: " . $history['history_mother' ];
85 if ($history['history_father' ] != '') $tmp[] = "Father: " . $history['history_father' ];
86 if ($history['history_siblings' ] != '') $tmp[] = "Siblings: " . $history['history_siblings' ];
87 if ($history['history_spouse' ] != '') $tmp[] = "Spouse: " . $history['history_spouse' ];
88 if ($history['history_offspring'] != '') $tmp[] = "Offspring: " . $history['history_offspring'];
89 if (count($tmp)) echo join(', ', $tmp);
90 ?></textarea></td>
91 </tr>
92 <tr>
93 <td class="ficaption3" id="bordR">Drug/Latex/Transfusion/Allergic reactions: </td>
94 <td class="ficaption3">Current medications:</td>
95 </tr>
96 <tr>
97 <td class="fibody3" id="bordR"><textarea name="pl_reactions" rows="6" wrap="VIRTUAL" class="fullin2" id="pl_reactions"><?php
98 $allergies = ''; $checked = 'checked';
99 if ($result = getListByType($pid, "allergy", "id,title,comments,activity,date", 1, "all", 0)){
100 foreach ($result as $iter) {
101 $al_tmp[] = $iter{"title"}.' ('.$iter{"comments"}.') ';
102 $checked = '';
104 $allergies = join(',', $al_tmp);
106 echo $allergies;
107 ?></textarea></td>
108 <td class="fibody3"><textarea name="pl_medications" rows="6" wrap="VIRTUAL" class="fullin2" id="pl_medications"><?php
109 if ($result = getListByType($pid, "medication", "id,title,comments,activity,date", 1, "all", 0)){
110 foreach ($result as $iter) {
111 $tmp_med[] = $iter{"title"}.' ('.$iter{"comments"}.') ';
113 echo join(', ', $tmp_med);
115 ?></textarea></td>
116 </tr>
117 </table>
118 </div>
119 <p>&nbsp;</p>
120 <div style="border: solid 2px black; background-color:#FFFFFF;">
121 <table width="100%" border="0" cellspacing="0" cellpadding="2">
122 <tr>
123 <td width="20" align="left" valign="bottom" class="ficaption2" id="bordR">No</td>
124 <td width="120" align="center" valign="bottom" class="ficaption2" id="bordR">Entry date </td>
125 <td align="center" valign="bottom" class="ficaption2" id="bordR">Problem/Resolution</td>
126 <td width="120" align="center" valign="bottom" class="ficaption2" id="bordR">Onset age and date </td>
127 <td width="120" align="center" valign="bottom" class="ficaption2">Resolution date </td>
128 </tr>
129 <?php
130 $pli = 1;
132 while ($pli < 26){
133 //print $obj["pl_problem_$pli"];
134 list($pl_ed, $pl_problem, $pl_onset, $pl_rd) = explode('|~', $obj["pl_problem_${pli}"]);
135 print <<<EOL
136 <tr>
137 <td align="left" valign="bottom" class="fibody2" id="bordR">${pli}.</td>
138 <td align="left" valign="bottom" class="fibody2" id="bordR"><input name="pl_ed_${pli}" type="text" class="fullin2" value="${pl_ed}"></td>
139 <td align="left" valign="bottom" class="fibody2" id="bordR"><input name="pl_problem_${pli}" type="text" class="fullin2" value="${pl_problem}"></td>
140 <td align="left" valign="bottom" class="fibody2" id="bordR"><input name="pl_onset_${pli}" type="text" class="fullin2" value="${pl_onset}"></td>
141 <td align="left" valign="bottom" class="fibody2"><input name="pl_rd_${pli}" type="text" class="fullin2" value="${pl_rd}"></td>
142 </tr>
143 EOL;
144 $pli++;
147 </table>
148 </div>
149 <table width="100%" border="0">
150 <tr>
151 <td align="left" width="100"> <a href="javascript:top.restoreSession();document.my_form.submit();" class="link_submit">[Save Data]</a> </td>
152 <td align="right"> <a href="<?php echo $GLOBALS['form_exit_url']; ?>" class="link_submit"
153 onclick="top.restoreSession()">[Don't Save]</a> </td>
154 </tr>
155 </table>
156 </form>
157 <?php
158 formFooter();
160 </body>
161 </html>