Highway to PSR2
[openemr.git] / contrib / forms / clinical_notes / view.php
blob5241ad6483ec0773bb469c2bd8d3511ec218306e
1 <?php
2 //////////////////////////////////////////////////////////////////////
3 // ------------------ DO NOT MODIFY VIEW.PHP !!! ---------------------
4 // View.php is an exact duplicate of new.php. If you wish to make
5 // any changes, then change new.php and either (recommended) make
6 // view.php a symbolic link to new.php, or copy new.php to view.php.
7 //
8 // And if you check in a change to either module, be sure to check
9 // in the other (identical) module also.
11 // This nonsense will go away if we ever move to subversion.
12 //////////////////////////////////////////////////////////////////////
14 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
16 // This program is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU General Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
21 include_once("../../globals.php");
22 include_once("$srcdir/api.inc");
23 include_once("$srcdir/forms.inc");
25 $row = array();
27 if (! $encounter) { // comes from globals.php
28 die("Internal error: we do not seem to be in an encounter!");
31 function rbvalue($rbname)
33 $tmp = $_POST[$rbname];
34 if (! $tmp) {
35 $tmp = '0';
38 return "'$tmp'";
41 function cbvalue($cbname)
43 return $_POST[$cbname] ? '1' : '0';
46 function rbinput($name, $value, $desc, $colname)
48 global $row;
49 $ret = "<input type='radio' name='$name' value='$value'";
50 if ($row[$colname] == $value) {
51 $ret .= " checked";
54 $ret .= " />$desc";
55 return $ret;
58 function rbcell($name, $value, $desc, $colname)
60 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
63 function cbinput($name, $colname)
65 global $row;
66 $ret = "<input type='checkbox' name='$name' value='1'";
67 if ($row[$colname]) {
68 $ret .= " checked";
71 $ret .= " />";
72 return $ret;
75 function cbcell($name, $desc, $colname)
77 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
80 $formid = $_GET['id'];
82 // If Save was clicked, save the info.
84 if ($_POST['bn_save']) {
85 $fu_timing = $_POST['fu_timing'];
87 // If updating an existing form...
89 if ($formid) {
90 $query = "UPDATE form_clinical_notes SET " .
91 "history = '" . $_POST['form_history'] . "', " .
92 "examination = '" . $_POST['form_examination'] . "', " .
93 "plan = '" . $_POST['form_plan'] . "', " .
94 "followup_required = " . rbvalue('fu_required') . ", " .
95 "followup_timing = '$fu_timing'" . " " .
96 // "outcome = " . rbvalue('outcome') . ", " .
97 // "destination = " . rbvalue('destination') . " " .
98 "WHERE id = '$formid'";
99 sqlStatement($query);
100 } // If adding a new form...
102 else {
103 $query = "INSERT INTO form_clinical_notes ( " .
104 "history, examination, plan, followup_required, followup_timing " .
105 // ",outcome, destination " .
106 ") VALUES ( " .
107 "'" . $_POST['form_history'] . "', " .
108 "'" . $_POST['form_examination'] . "', " .
109 "'" . $_POST['form_plan'] . "', " .
110 rbvalue('fu_required') . ", " .
111 "'$fu_timing'" . " " .
112 // rbvalue('outcome') . ", " .
113 // rbvalue('destination') . " " .
114 ")";
115 $newid = sqlInsert($query);
116 addForm($encounter, "Clinical Notes", $newid, "clinical_notes", $pid, $userauthorized);
119 formHeader("Redirecting....");
120 formJump();
121 formFooter();
122 exit;
125 if ($formid) {
126 $row = sqlQuery("SELECT * FROM form_clinical_notes WHERE " .
127 "id = '$formid' AND activity = '1'") ;
130 <html>
131 <head>
132 <?php html_header_show();?>
133 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
134 <script language="JavaScript">
135 </script>
136 </head>
138 <body <?php echo $top_bg_line;?> topmargin="0" rightmargin="0" leftmargin="2"
139 bottommargin="0" marginwidth="2" marginheight="0">
140 <form method="post" action="<?php echo $rootdir ?>/forms/clinical_notes/new.php?id=<?php echo $formid ?>"
141 onsubmit="return top.restoreSession()">
143 <center>
146 <table border='1' width='95%'>
148 <tr bgcolor='#dddddd'>
149 <td colspan='2' align='center'><b>This Encounter</b></td>
150 </tr>
152 <tr>
153 <td width='5%' nowrap> History </td>
154 <td width='95%' nowrap>
155 <textarea name='form_history' rows='7' style='width:100%'><?php echo $row['history'] ?></textarea>
156 </td>
157 </tr>
159 <tr>
160 <td nowrap> Examination </td>
161 <td nowrap>
162 <textarea name='form_examination' rows='7' style='width:100%'><?php echo $row['examination'] ?></textarea>
163 </td>
164 </tr>
166 <tr>
167 <td nowrap> Plan </td>
168 <td nowrap>
169 <textarea name='form_plan' rows='7' style='width:100%'><?php echo $row['plan'] ?></textarea>
170 </td>
171 </tr>
173 <tr>
174 <td nowrap>Follow Up</td>
175 <td nowrap>
176 <table width='100%'>
177 <tr>
178 <td width='5%' nowrap>
179 <?php echo rbinput('fu_required', '1', 'Required in:', 'followup_required') ?>
180 </td>
181 <td nowrap>
182 <input type='text' name='fu_timing' size='10' style='width:100%'
183 title='When to follow up'
184 value='<?php echo addslashes($row['followup_timing']) ?>' />
185 </td>
186 </tr>
187 <tr>
188 <td colspan='2' nowrap>
189 <?php echo rbinput('fu_required', '2', 'Pending investigation', 'followup_required') ?>
190 </td>
191 </tr>
192 <tr>
193 <td colspan='2' nowrap>
194 <?php echo rbinput('fu_required', '0', 'None required', 'followup_required') ?>
195 </td>
196 </tr>
197 </table>
198 </td>
199 </tr>
201 <!--
203 <tr bgcolor='#dddddd'>
204 <td colspan='2' align='center'><b>Final Discharge</b></td>
205 </tr>
207 <tr>
208 <td nowrap>Outcome</td>
209 <td nowrap>
210 <table width='100%'>
211 <tr>
212 <?php // echo rbcell('outcome', '1', 'Resolved' , 'outcome') ?>
213 <?php // echo rbcell('outcome', '2', 'Improved' , 'outcome') ?>
214 <?php // echo rbcell('outcome', '3', 'Status Quo', 'outcome') ?>
215 <?php // echo rbcell('outcome', '4', 'Worse' , 'outcome') ?>
216 </tr>
217 </table>
218 </td>
219 </tr>
221 <tr>
222 <td nowrap>Destination</td>
223 <td nowrap>
224 <table width='100%'>
225 <tr>
226 <?php // echo rbcell('destination', '1', 'GP' , 'destination') ?>
227 <?php // echo rbcell('destination', '2', 'Hospital Specialist', 'destination') ?>
228 <td width='25%'>&nbsp;</td>
229 <td width='25%'>&nbsp;</td>
230 </tr>
231 </table>
232 </td>
233 </tr>
237 </table>
240 <input type='submit' name='bn_save' value='Save' />
241 &nbsp;
242 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url'] ?>'" />
243 </p>
245 </center>
247 </form>
248 </body>
249 </html>