3 * Patient disclosures main screen.
6 * @link http://www.open-emr.org
7 * @author Visolve <vicareplus_engg@visolve.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) Visolve <vicareplus_engg@visolve.com>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../../globals.php");
16 require_once("$srcdir/log.inc");
17 require_once("$srcdir/options.inc.php");
19 use OpenEMR\Core\Header
;
21 //retrieve the user name
22 $res = sqlQuery("select username from users where username=?", array($_SESSION{"authUser"}));
23 $uname=$res{"username"};
24 //if the mode variable is set to disclosure, retrieve the values from 'disclosure_form ' in record_disclosure.php to store it in database.
25 if (isset($_POST["mode"]) and $_POST["mode"] == "disclosure") {
26 $dates=trim($_POST['dates']);
27 $event=trim($_POST['form_disclosure_type']);
28 $recipient_name=trim($_POST['recipient_name']);
29 $disclosure_desc=trim($_POST['desc_disc']);
30 $disclosure_id=trim($_POST['disclosure_id']);
31 if (isset($_POST["updatemode"]) and $_POST["updatemode"] == "disclosure_update") {
32 //update the recorded disclosure in the extended_log table.
33 updateRecordedDisclosure($dates, $event, $recipient_name, $disclosure_desc, $disclosure_id);
35 //insert the disclosure records in the extended_log table.
36 recordDisclosure($dates, $event, $pid, $recipient_name, $disclosure_desc, $uname);
38 // added ajax submit to record_disclosure thus an exit() 12/19/17
42 if (isset($_GET['deletelid'])) {
43 $deletelid=$_GET['deletelid'];
44 //function to delete the recorded disclosures
45 deleteDisclosure($deletelid);
51 <?php Header
::setupHeader(['common']); ?
>
55 <body
class="body_top">
57 <span
class="title"><?php
echo xlt('Disclosures'); ?
></span
>
59 <div
class="disclosure_wrap">
60 <div style
='float: left; margin-right: 10px'><?php
echo xlt('for'); ?
> 
;
61 <span
class="title"><a href
="../summary/demographics.php" onclick
="top.restoreSession()"><?php
$pname = getPatientName($pid);
62 echo text($pname); ?
></a
></span
>
65 <a href
="record_disclosure.php" class="css_button iframe" onclick
="top.restoreSession()"><span
><?php
echo xlt('Record'); ?
></span
></a
>
68 <a href
="demographics.php"
69 class="css_button" onclick
="top.restoreSession()"> <span
><?php
echo xlt('View Patient') ?
></span
></a
>
76 $offset = $_REQUEST['offset'];
77 if (!isset($offset)) {
81 $disclQry = " SELECT el.id, el.event, el.recipient, el.description, el.date, CONCAT(u.fname, ' ', u.lname) as user_fullname FROM extended_log el" .
82 " LEFT JOIN users u ON u.username = el.user " .
83 " WHERE el.patient_id = ? AND el.event IN (SELECT option_id FROM list_options WHERE list_id='disclosure_type' AND activity = 1)" .
84 " ORDER BY el.date DESC ";
85 $r2= sqlStatement($disclQry, array($pid));
86 $totalRecords=sqlNumRows($r2);
88 $disclInnerQry = " SELECT el.id, el.event, el.recipient, el.description, el.date, CONCAT(u.fname, ' ', u.lname) as user_fullname FROM extended_log el" .
89 " LEFT JOIN users u ON u.username = el.user" .
90 " WHERE patient_id = ? AND event IN (SELECT option_id FROM list_options WHERE list_id = 'disclosure_type' AND activity = 1)" .
91 " ORDER BY date DESC LIMIT " . escape_limit($offset) . " , " . escape_limit($N);
93 $r1= sqlStatement($disclInnerQry, array($pid));
95 $noOfRecordsLeft=($totalRecords - $offset);
97 <table border
='0' class="text">
99 <td colspan
='5' style
="padding: 5px;"><a href
="disclosure_full.php" class="" id
='Submit' onclick
="top.restoreSession()"><span
><?php
echo xlt('Refresh'); ?
></span
></a
></td
>
103 <table border
='0' cellpadding
="1" width
='80%'>
104 <tr
class="showborder_head" align
='left' height
="22">
105 <th style
='width: 120px';> 
;</th
>
106 <th style
="border-style: 1px solid #000" width
="140px"><?php
echo xlt('Recipient Name'); ?
></th
>
107 <th style
="border-style: 1px solid #000" width
="140px"><?php
echo xlt('Disclosure Type'); ?
></th
>
108 <th style
="border-style: 1px solid #000"><?php
echo xlt('Description'); ?
></th
>
109 <th style
="border-style: 1px solid #000"><?php
echo xlt('Provider'); ?
></th
>
113 for ($iter = 0; $frow = sqlFetchArray($r1); $iter++
) {
114 $result2[$iter] = $frow;
117 foreach ($result2 as $iter) {
118 $description =nl2br(text($iter{'description'})); //for line break if there is any new lines in the input text area field.
120 <!-- List the recipient name
, description
, date
and edit
and delete options
-->
121 <tr
class="noterow" height
='25'>
122 <!--buttons
for edit
and delete
.-->
123 <td valign
='top'><a href
='record_disclosure.php?editlid=<?php echo text($iter{'id
'}); ?>'
124 class='css_button_small iframe' onclick
='top.restoreSession()'><span
><?php
echo xlt('Edit');?
></span
></a
>
125 <a href
='#' class='deletenote css_button_small'
126 id
='<?php echo text($iter{'id
'}); ?>' onclick
='top.restoreSession()'><span
><?php
echo xlt('Delete');?
></span
></a
></td
>
127 <td
class="text" valign
='top'><?php
echo text($iter{'recipient'});?
> 
;</td
>
128 <td
class='text' valign
='top'><?php
echo text(getListItemTitle('disclosure_type', $iter['event'])); ?
> 
;</td
>
129 <td
class='text'><?php
echo text($iter{'date'})." ".$description;?
> 
;</td
>
130 <td
class='text'><?php
echo text($iter{'user_fullname'});?
></td
>
136 <!-- Display None
, if there is no disclosure
-->
137 <span
class='text' colspan
='3'><?php
echo xlt('None');?
></span
>
142 <table width
='400' border
='0' cellpadding
='0' cellspacing
='0'>
146 if ($offset > ($N-1) && $n!=0) {
147 echo " <a class='link' href='disclosure_full.php?active=" . $active .
148 "&offset=" . attr($offset-$N) . "' onclick='top.restoreSession()'>[" .
149 xlt('Previous') . "]</a>\n";
155 if ($n >= $N && $noOfRecordsLeft!=$N) {
156 echo " <a class='link' href='disclosure_full.php?active=" . $active.
157 "&offset=" . attr($offset+
$N) ."&leftrecords=".$noOfRecordsLeft."' onclick='top.restoreSession()'>[" .
158 xlt('Next') . "]</a>\n";
167 <script type
="text/javascript">
168 $
(document
).ready(function () {
169 // todo, move this to a common library
171 $
(".noterow").mouseover(function () {
172 $
(this
).toggleClass("highlight");
174 $
(".noterow").mouseout(function () {
175 $
(this
).toggleClass("highlight");
178 //for deleting the disclosures
179 $
(".deletenote").click(function () {
183 var DeleteNote
= function (logevent
) {
184 if (confirm("<?php echo htmlspecialchars(xl('Are you sure you want to delete this disclosure?', '', '', '\n ') . xl('This action CANNOT be undone.'), ENT_QUOTES); ?>")) {
185 top
.restoreSession();
186 window
.location
.replace("disclosure_full.php?deletelid=" + logevent
.id
)
190 $
(".iframe").on('click', function(e
) {
191 e
.preventDefault();e
.stopPropagation();
192 dlgopen('', '', 500, 310, '', '', {
197 url
: $
(this
).attr('href')
202 // for record disclosure dlgclose callback
203 function refreshme() {
204 top
.restoreSession();
205 document
.location
.reload();