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.
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 require_once("../../globals.php");
22 require_once("$srcdir/api.inc");
23 require_once("$srcdir/forms.inc");
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];
41 function cbvalue($cbname)
43 return $_POST[$cbname] ?
'1' : '0';
46 function rbinput($name, $value, $desc, $colname)
49 $ret = "<input type='radio' name='" . attr($name) . "' value='" . attr($value) . "'";
50 if ($row[$colname] == $value) {
54 $ret .= " />" . text($desc);
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)
66 $ret = "<input type='checkbox' name='".attr($name)."' value='1'";
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'];
86 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
87 die(xlt('Authentication Error'));
90 // If updating an existing form...
93 $query = "UPDATE form_clinical_notes SET
97 followup_required = ?,
101 sqlStatement($query, array($_POST['form_history'], $_POST['form_examination'], $_POST['form_plan'], rbvalue('fu_required'), $fu_timing, $formid));
102 } // If adding a new form...
105 $query = "INSERT INTO form_clinical_notes ( " .
106 "history, examination, plan, followup_required, followup_timing
107 ) VALUES ( ?, ?, ?, ?, ? )";
109 $newid = sqlInsert($query, array($_POST['form_history'], $_POST['form_examination'], $_POST['form_plan'], rbvalue('fu_required'), $fu_timing));
110 addForm($encounter, "Clinical Notes", $newid, "clinical_notes", $pid, $userauthorized);
113 formHeader("Redirecting....");
120 $row = sqlQuery("SELECT * FROM form_clinical_notes WHERE " .
121 "id = ? AND activity = '1'", array($formid)) ;
126 <?php
html_header_show();?
>
127 <link rel
=stylesheet href
="<?php echo $css_header;?>" type
="text/css">
128 <script language
="JavaScript">
132 <body
<?php
echo $top_bg_line;?
> topmargin
="0" rightmargin
="0" leftmargin
="2"
133 bottommargin
="0" marginwidth
="2" marginheight
="0">
134 <form method
="post" action
="<?php echo $rootdir ?>/forms/clinical_notes/new.php?id=<?php echo attr($formid) ?>"
135 onsubmit
="return top.restoreSession()">
136 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr($_SESSION['csrf_token']); ?>" />
141 <table border
='1' width
='95%'>
143 <tr bgcolor
='#dddddd'>
144 <td colspan
='2' align
='center'><b
>This Encounter
</b
></td
>
148 <td width
='5%' nowrap
> History
</td
>
149 <td width
='95%' nowrap
>
150 <textarea name
='form_history' rows
='7' style
='width:100%'><?php
echo text($row['history']) ?
></textarea
>
155 <td nowrap
> Examination
</td
>
157 <textarea name
='form_examination' rows
='7' style
='width:100%'><?php
echo text($row['examination']) ?
></textarea
>
162 <td nowrap
> Plan
</td
>
164 <textarea name
='form_plan' rows
='7' style
='width:100%'><?php
echo text($row['plan']) ?
></textarea
>
169 <td nowrap
>Follow Up
</td
>
173 <td width
='5%' nowrap
>
174 <?php
echo rbinput('fu_required', '1', 'Required in:', 'followup_required') ?
>
177 <input type
='text' name
='fu_timing' size
='10' style
='width:100%'
178 title
='When to follow up'
179 value
='<?php echo attr($row['followup_timing
']) ?>' />
183 <td colspan
='2' nowrap
>
184 <?php
echo rbinput('fu_required', '2', 'Pending investigation', 'followup_required') ?
>
188 <td colspan
='2' nowrap
>
189 <?php
echo rbinput('fu_required', '0', 'None required', 'followup_required') ?
>
198 <tr bgcolor
='#dddddd'>
199 <td colspan
='2' align
='center'><b
>Final Discharge
</b
></td
>
203 <td nowrap
>Outcome
</td
>
207 <?php
// echo rbcell('outcome', '1', 'Resolved' , 'outcome') ?>
208 <?php
// echo rbcell('outcome', '2', 'Improved' , 'outcome') ?>
209 <?php
// echo rbcell('outcome', '3', 'Status Quo', 'outcome') ?>
210 <?php
// echo rbcell('outcome', '4', 'Worse' , 'outcome') ?>
217 <td nowrap
>Destination
</td
>
221 <?php
// echo rbcell('destination', '1', 'GP' , 'destination') ?>
222 <?php
// echo rbcell('destination', '2', 'Hospital Specialist', 'destination') ?>
223 <td width
='25%'> 
;</td
>
224 <td width
='25%'> 
;</td
>
235 <input type
='submit' name
='bn_save' value
='Save' />
237 <input type
='button' value
='Cancel' onclick
="parent.closeTab(window.name, false)" />