3 * Display patient notes.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 3
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @author Brady Miller <brady.g.miller@gmail.com>
18 * @link http://www.open-emr.org
23 require_once("../../globals.php");
24 require_once("$srcdir/pnotes.inc");
25 require_once("$srcdir/acl.inc");
26 require_once("$srcdir/patient.inc");
27 require_once("$srcdir/options.inc.php");
29 // form parameter docid can be passed to restrict the display to a document.
30 $docid = empty($_REQUEST['docid']) ?
0 : intval($_REQUEST['docid']);
32 // form parameter orderid can be passed to restrict the display to a procedure order.
33 $orderid = empty($_REQUEST['orderid']) ?
0 : intval($_REQUEST['orderid']);
37 $row = sqlQuery("SELECT foreign_id FROM documents WHERE id = ?", array($docid));
38 $patient_id = intval($row['foreign_id']);
39 } else if ($orderid) {
40 $row = sqlQuery("SELECT patient_id FROM procedure_order WHERE procedure_order_id = ?", array($orderid));
41 $patient_id = intval($row['patient_id']);
44 $urlparms = "docid=$docid&orderid=$orderid";
48 <?php
html_header_show();?
>
50 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/manual-added-packages/jquery-min-1-2-2/index.js"></script
>
51 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
54 <body
class="body_bottom">
57 $thisauth = acl_check('patients', 'notes');
59 $tmp = getPatientData($patient_id, "squad");
60 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad'])) {
66 echo "<p>(" . htmlspecialchars(xl('Notes not authorized'), ENT_NOQUOTES
) . ")</p>\n";
67 echo "</body>\n</html>\n";
74 <?php
if (acl_check('patients', 'notes', '', array('write','addonly'))) : ?
>
76 <a href
="pnotes_full.php?<?php echo $urlparms; ?>" onclick
="top.restoreSession()">
78 <span
class="title"><?php
echo htmlspecialchars(xl('Notes'), ENT_NOQUOTES
); ?
>
81 echo " " . xlt("linked to document") . " ";
82 $d = new Document($docid);
83 echo $d->get_url_file();
84 } else if ($orderid) {
85 echo " " . xlt("linked to procedure order") . " $orderid";
89 <span
class=more
><?php
echo htmlspecialchars($tmore, ENT_NOQUOTES
);?
></span
>
98 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
101 // Get the billing note if there is one.
105 $resnote = getPatientData($patient_id, "billing_note");
106 if (!empty($resnote['billing_note'])) {
107 $billing_note = $resnote['billing_note'];
108 $colorbeg = "<span style='color:red'>";
109 $colorend = "</span>";
112 //Display what the patient owes
113 $balance = get_patient_balance($patient_id);
114 if ($balance != "0") {
115 $formatted = sprintf((xl('$').'%01.2f'), $balance);
116 echo " <tr class='text billing'>\n";
117 echo " <td>" . $colorbeg . htmlspecialchars(xl('Balance Due'), ENT_NOQUOTES
) .
118 $colorend . "</td><td>" . $colorbeg .
119 htmlspecialchars($formatted, ENT_NOQUOTES
) . $colorend."</td>\n";
124 echo " <tr class='text billing'>\n";
125 echo " <td>" . $colorbeg . htmlspecialchars(xl('Billing Note'), ENT_NOQUOTES
) .
126 $colorend . "</td><td>" . $colorbeg .
127 htmlspecialchars($billing_note, ENT_NOQUOTES
) . $colorend . "</td>\n";
131 //retrieve all active notes
132 $result = getPnotesByDate(
135 "id,date,body,user,title,assigned_to",
145 if ($result != null) {
146 $notes_count = 0;//number of notes so far displayed
147 foreach ($result as $iter) {
148 if ($notes_count >= $N) {
149 //we have more active notes to print, but we've reached our display maximum
151 echo " <td colspan='3' align='center'>\n";
153 echo "href='pnotes_full.php?active=1&$urlparms" .
154 "' class='alert' onclick='top.restoreSession()'>";
155 echo htmlspecialchars(xl('Some notes were not displayed.', '', '', ' '), ENT_NOQUOTES
) .
156 htmlspecialchars(xl('Click here to view all.'), ENT_NOQUOTES
) . "</a>\n";
162 $body = $iter['body'];
163 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
164 $body = nl2br(htmlspecialchars($body, ENT_NOQUOTES
));
166 $body = htmlspecialchars(date('Y-m-d H:i', strtotime($iter['date'])), ENT_NOQUOTES
) .
167 ' (' . htmlspecialchars($iter['user'], ENT_NOQUOTES
) . ') ' . nl2br(htmlspecialchars($body, ENT_NOQUOTES
));
170 echo " <tr class='text noterow' id='".htmlspecialchars($iter['id'], ENT_QUOTES
)."'>\n";
172 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
173 echo " <td valign='top' class='bold'>";
174 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
177 echo " <td valign='top'>$body</td>\n";
187 </div
> <!-- end pnotes
-->
191 <script language
="javascript">
192 // jQuery stuff to make the page a little easier to use
194 $
(document
).ready(function(){
195 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
196 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });