7 * @link https://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @author Daniel Ehrlich <daniel.ehrlich1@gmail.com>
11 * @copyright Copyright (c) 2005 Rod Roark <rod@sunsetsystems.com>
12 * @copyright Copyright (c) 2018-2021 Brady Miller <brady.g.miller@gmail.com>
13 * @copyright Copyright (c) 2018 Daniel Ehrlich <daniel.ehrlich1@gmail.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 require_once("../../globals.php");
18 require_once("$srcdir/api.inc");
19 require_once("$srcdir/forms.inc");
21 use OpenEMR\Common\Csrf\CsrfUtils
;
22 use OpenEMR\Core\Header
;
26 if (! $encounter) { // comes from globals.php
27 die("Internal error: we do not seem to be in an encounter!");
30 function rbvalue($rbname)
32 $tmp = $_POST[$rbname] ??
null;
40 function cbvalue($cbname)
42 return $_POST[$cbname] ?
'1' : '0';
45 function rbinput($name, $value, $desc, $colname)
48 $ret = "<input type='radio' name='" . attr($name) . "' value='" . attr($value) . "'";
49 if (!empty($row) && ($row[$colname] == $value)) {
53 $ret .= " />" . text($desc);
57 function rbcell($name, $value, $desc, $colname)
59 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
62 function cbinput($name, $colname)
65 $ret = "<input type='checkbox' name='" . attr($name) . "' value='1'";
74 function cbcell($name, $desc, $colname)
76 return "<td width='25%' nowrap>" . cbinput($name, $colname) . text($desc) . "</td>\n";
79 $formid = $_GET['id'] ??
null;
81 // If Save was clicked, save the info.
83 if (!empty($_POST['bn_save'])) {
84 $fu_timing = $_POST['fu_timing'];
85 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
86 CsrfUtils
::csrfNotVerified();
89 // If updating an existing form...
92 $query = "UPDATE form_clinic_note SET
96 followup_required = ?,
100 sqlStatement($query, array($_POST['form_history'], $_POST['form_examination'], $_POST['form_plan'], rbvalue('fu_required'), $fu_timing, $formid));
101 } else { // If adding a new form...
102 $query = "INSERT INTO form_clinic_note ( " .
103 "history, examination, plan, followup_required, followup_timing
104 ) VALUES ( ?, ?, ?, ?, ? )";
106 $newid = sqlInsert($query, array($_POST['form_history'], $_POST['form_examination'], $_POST['form_plan'], rbvalue('fu_required'), $fu_timing));
107 addForm($encounter, "Clinic Note", $newid, "clinic_note", $pid, $userauthorized);
110 formHeader("Redirecting....");
117 $row = sqlQuery("SELECT * FROM form_clinic_note WHERE " .
118 "id = ? AND activity = '1'", array($formid));
123 <?php Header
::setupHeader(); ?
>
127 <body
<?php
echo $top_bg_line;?
> topmargin
="0" rightmargin
="0" leftmargin
="2"
128 bottommargin
="0" marginwidth
="2" marginheight
="0">
129 <form method
="post" action
="<?php echo $rootdir ?>/forms/clinic_note/new.php?id=<?php echo attr_url($formid) ?>"
130 onsubmit
="return top.restoreSession()">
131 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
136 <table border
='1' width
='95%'>
138 <tr bgcolor
='#dddddd'>
139 <td colspan
='2' align
='center'><b
><?php
echo xlt("This Encounter"); ?
></b
></td
>
143 <td width
='5%' nowrap
> <?php
echo xlt("History"); ?
> </td
>
144 <td width
='95%' nowrap
>
145 <textarea name
='form_history' rows
='7' style
='width:100%'><?php
echo text($row['history'] ??
'') ?
></textarea
>
150 <td nowrap
> <?php
echo xlt("Examination"); ?
> </td
>
152 <textarea name
='form_examination' rows
='7' style
='width:100%'><?php
echo text($row['examination'] ??
'') ?
></textarea
>
157 <td nowrap
> <?php
echo xlt("Plan"); ?
> </td
>
159 <textarea name
='form_plan' rows
='7' style
='width:100%'><?php
echo text($row['plan'] ??
'') ?
></textarea
>
164 <td nowrap
><?php
echo xlt("Follow Up"); ?
></td
>
168 <td width
='5%' nowrap
>
169 <?php
echo rbinput('fu_required', '1', xl('Required in') . ':', 'followup_required') ?
>
172 <input type
='text' name
='fu_timing' size
='10' style
='width:100%'
173 title
='<?php echo xla("When to follow up"); ?>'
174 value
='<?php echo attr($row['followup_timing
'] ?? '') ?>' />
178 <td colspan
='2' nowrap
>
179 <?php
echo rbinput('fu_required', '2', xl('Pending investigation'), 'followup_required') ?
>
183 <td colspan
='2' nowrap
>
184 <?php
echo rbinput('fu_required', '0', xl('None required'), 'followup_required') ?
>
194 <input type
='submit' name
='bn_save' value
='<?php echo xla("Save"); ?>' />
196 <input type
='button' value
='<?php echo xla("Cancel"); ?>' onclick
="parent.closeTab(window.name, false)" />