4 * Copyright (C) 2016-2018 Jerry Padgett <sjpadgett@gmail.com>
6 * LICENSE: This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @author Jerry Padgett <sjpadgett@gmail.com>
21 * @link http://www.open-emr.org
23 require_once("verify_session.php");
24 require_once("$srcdir/patient.inc");
25 require_once("lib/portal_mail.inc");
27 if ($_SESSION['register'] === true) {
29 header('Location: '.$landingpage.'&w');
33 if (!isset($_SESSION['portal_init'])) {
34 $_SESSION['portal_init'] = true;
37 $whereto = 'profilepanel';
38 if (isset($_SESSION['whereto'])) {
39 $whereto = $_SESSION['whereto'];
42 $user = isset($_SESSION['sessionUser']) ?
$_SESSION['sessionUser'] : 'portal user';
43 $result = getPatientData($pid);
45 $msgs = getPortalPatientNotes($_SESSION['portal_username']);
46 $msgcnt = count($msgs);
48 foreach ($msgs as $i) {
49 if ($i['message_status']=='New') {
54 require_once '_header.php';
55 echo "<script>var cpid='" . attr($pid) . "';var cuser='" . attr($user) . "';var webRoot='" . $GLOBALS['web_root'] . "';var ptName='" . attr($_SESSION['ptName']) . "';</script>";
57 <script type
="text/javascript">
58 var webroot_url
= webRoot
;
60 $
(document
).ready(function () {
62 $
("#profilereport").load("./get_profile.php", {'embeddedScreen': true}, function () {
63 $
("table").addClass("table table-responsive");
64 $
(".demographics td").removeClass("label");
65 $
(".demographics td").addClass("bold");
66 $
(".insurance table").addClass("table-sm table-striped");
67 $
("#editDems").click(function () {
71 $
("#reports").load("./report/portal_patient_report.php?pid='<?php echo attr($pid) ?>'", {'embeddedScreen': true}, function () {
72 <?php
if ($GLOBALS['portal_two_payments']) { ?
>
73 $
("#payment").load("./portal_payment.php", {'embeddedScreen': true}, function () {});
76 $
("#medicationlist").load("./get_medications.php", {'embeddedScreen': true}, function () {
77 $
("#allergylist").load("./get_allergies.php", {'embeddedScreen': true}, function () {
78 $
("#problemslist").load("./get_problems.php", {'embeddedScreen': true}, function () {
79 $
("#amendmentslist").load("./get_amendments.php", {'embeddedScreen': true}, function () {
80 $
("#labresults").load("./get_lab_results.php", {'embeddedScreen': true}, function () {
88 $
('.sigPad').signaturePad({drawOnly
: true});
89 $
(".generateDoc_download").click(function () {
90 $
("#doc_form").submit();
93 function showProfileModal() {
94 var title
= '<?php echo xla('Demographics Legend Red
: Charted Values
. Blue
: Patient Edits
'); ?> ';
98 {text
: '<?php echo xla('Help
'); ?>', close
: false, style
: 'info', id
: 'formHelp'},
99 {text
: '<?php echo xla('Cancel
'); ?>', close
: true, style
: 'default'},
100 {text
: '<?php echo xla('Revert Edits
'); ?>', close
: false, style
: 'danger', id
: 'replaceAllButton'},
101 {text
: '<?php echo xla('Send
for Review
'); ?>',
104 id
: 'donePatientButton'
108 url
: webRoot +
'/portal/patient/patientdata?pid=' + cpid +
'&user=' + cuser
110 dlgopen('','','modal-xl', 500, '', title
, params
);
113 function saveProfile() {
117 var gowhere
= '#<?php echo $whereto?>';
118 $
(gowhere
).collapse('show');
120 var $doHides = $
('#panelgroup');
121 $doHides.on('show.bs.collapse', '.collapse', function () {
122 $doHides.find('.collapse.in').collapse('hide');
124 //Enable sidebar toggle
125 $
("[data-toggle='offcanvas']").click(function (e
) {
127 //If window is small enough, enable sidebar push menu
128 if ($
(window
).width() <= 992) {
129 $
('.row-offcanvas').toggleClass('active');
130 $
('.left-side').removeClass("collapse-left");
131 $
(".right-side").removeClass("strech");
132 $
('.row-offcanvas').toggleClass("relative");
134 //Else, enable content streching
135 $
('.left-side').toggleClass("collapse-left");
136 $
(".right-side").toggleClass("strech");
140 $
('#popwait').hide();
141 $
('#callccda').click(function () {
142 $
('#popwait').show();
147 function editAppointment(mode
,deid
){
149 var title
= '<?php echo xla('Request
New Appointment
'); ?>';
150 var mdata
= {pid
:deid
};
153 var title
= '<?php echo xla('Edit Appointment
'); ?>';
154 var mdata
= {eid
:deid
};
159 { text
: '<?php echo xla('Cancel
'); ?>', close
: true, style
: 'default' }
160 //{ text: 'Print', close: false, style: 'success', click: showCustom }
164 url
: './add_edit_event_user.php',
168 dlgopen('', 'apptModal', 610, 300, '', title
, params
);
173 <!-- Right side column
. Contains content of the page
-->
174 <aside
class="right-side">
175 <!-- Main content
-->
176 <section
class="container-fluid content panel-group" id
="panelgroup">
177 <div id
="popwait" class="alert alert-warning" style
="font-size:18px"><strong
><?php
echo xlt('Working!'); ?
></strong
> <?php
echo xlt('Please wait...'); ?
></div
>
178 <div
class="row collapse" id
="lists">
179 <div
class="col-sm-6">
180 <div
class="panel panel-primary">
181 <header
class="panel-heading"><?php
echo xlt('Medications'); ?
> </header
>
182 <div id
="medicationlist" class="panel-body"></div
>
184 <div
class="panel-footer"></div
>
187 <div
class="panel panel-primary">
188 <header
class="panel-heading"><?php
echo xlt('Medications Allergy List'); ?
> </header
>
189 <div id
="allergylist" class="panel-body"></div
>
191 <div
class="panel-footer"></div
>
194 <div
class="col-sm-6">
195 <div
class="panel panel-primary">
196 <header
class="panel-heading"><?php
echo xlt('Issues List'); ?
></header
>
197 <div id
="problemslist" class="panel-body"></div
>
199 <div
class="panel-footer"></div
>
201 <div
class="panel panel-primary">
202 <header
class="panel-heading"><?php
echo xlt('Amendment List'); ?
> </header
>
203 <div id
="amendmentslist" class="panel-body"></div
>
205 <div
class="panel-footer"></div
>
208 <div
class="col-sm-12">
209 <div
class="panel panel-primary">
210 <header
class="panel-heading"><?php
echo xlt('Lab Results'); ?
> </header
>
211 <div id
="labresults" class="panel-body"></div
>
212 <div
class="panel-footer"></div
>
213 </div
><!-- /.panel
-->
216 </div
><!-- /.lists
-->
219 <div
class="col-sm-6">
220 <div
class="panel panel-primary collapse" id
="appointmentpanel">
221 <header
class="panel-heading"><?php
echo xlt('Appointments'); ?
> </header
>
222 <div id
="appointmentslist" class="panel-body">
224 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " . "e.pc_startTime, e.pc_hometext, e.pc_apptstatus, u.fname, u.lname, u.mname, " .
225 "c.pc_catname " . "FROM openemr_postcalendar_events AS e, users AS u, " .
226 "openemr_postcalendar_categories AS c WHERE " . "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " . "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " . "ORDER BY e.pc_eventDate, e.pc_startTime";
228 $res = sqlStatement($query, array(
232 if (sqlNumRows($res) > 0) {
234 echo '<table id="appttable" style="width:100%;background:#eee;" class="table table-striped fixedtable"><thead>
236 while ($row = sqlFetchArray($res)) {
238 $dayname = xl(date("l", strtotime($row ['pc_eventDate'])));
240 $disphour = substr($row ['pc_startTime'], 0, 2) +
0;
241 $dispmin = substr($row ['pc_startTime'], 3, 2);
242 if ($disphour >= 12) {
244 if ($disphour > 12) {
249 if ($row ['pc_hometext'] != "") {
250 $etitle = 'Comments' . ": " . $row ['pc_hometext'] . "\r\n";
256 echo "<a href='#' onclick='editAppointment(0," . htmlspecialchars($row ['pc_eid'], ENT_QUOTES
) . ')' . "' title='" . htmlspecialchars($etitle, ENT_QUOTES
) . "'>";
257 echo "<b>" . htmlspecialchars($dayname . ", " . $row ['pc_eventDate'], ENT_NOQUOTES
) . "</b><br>";
258 echo htmlspecialchars("$disphour:$dispmin " . $dispampm . " " . $row ['pc_catname'], ENT_NOQUOTES
) . "<br>";
259 echo htmlspecialchars($row ['fname'] . " " . $row ['lname'], ENT_NOQUOTES
) . "<br>";
260 echo htmlspecialchars("Status: " . $row ['pc_apptstatus'], ENT_NOQUOTES
);
261 echo "</a></p></td></tr>";
264 if (isset($res) && $res != null) {
266 echo " " . xlt('None');
269 } else { // if no appts
270 echo xlt('No Appointments');
273 echo '</tbody></table>';
275 <div style
='margin: 5px 0 5px'>
276 <a href
='#' onclick
="editAppointment('add',<?php echo attr($pid); ?>)">
277 <button
class='btn btn-primary pull-right'><?php
echo xlt('Schedule New Appointment'); ?
></button
>
281 <div
class="panel-footer"></div
>
282 </div
><!-- /.panel
-->
285 <?php
if ($GLOBALS['portal_two_payments']) { ?
>
287 <div
class="col-sm-12">
288 <div
class="panel panel-primary collapse" id
="paymentpanel">
289 <header
class="panel-heading"> <?php
echo xlt('Payments'); ?
> </header
>
290 <div id
="payment" class="panel-body"></div
>
291 <div
class="panel-footer">
298 <div
class="col-sm-12">
299 <div
class="panel panel-primary collapse" style
="padding-top:0;padding-bottom:0;" id
="messagespanel">
300 <!-- <header
class="panel-heading"><?php
//echo xlt('Secure Chat'); ?> </header>-->
301 <div id
="messages" class="panel-body" style
="height:calc(100vh - 120px);overflow:auto;padding:0 0 0 0;" >
302 <iframe src
="./messaging/secure_chat.php" width
="100%" height
="100%"></iframe
>
309 <div
class="col-sm-8">
310 <div
class="panel panel-primary collapse" id
="reportpanel">
311 <header
class="panel-heading"><?php
echo xlt('Reports'); ?
> </header
>
312 <div id
="reports" class="panel-body"></div
>
313 <div
class="panel-footer"></div
>
318 <div
class="col-sm-6">
319 <div
class="panel panel-primary collapse" id
="downloadpanel">
320 <header
class="panel-heading"> <?php
echo xlt('Download Documents'); ?
> </header
>
321 <div id
="docsdownload" class="panel-body">
322 <?php
if ($GLOBALS['portal_onsite_document_download']) { ?
>
324 <span
class="text"><?php
echo xlt('Download all patient documents');?
></span
>
325 <form name
='doc_form' id
='doc_form' action
='./get_patient_documents.php' method
='post'>
326 <input type
="button" class="generateDoc_download" value
="<?php echo xla('Download'); ?>" />
330 </div
><!-- /.panel
-body
-->
331 <div
class="panel-footer"></div
>
337 <div
class="col-sm-12">
338 <div
class="panel panel-primary collapse" id
="ledgerpanel">
339 <header
class="panel-heading"><?php
echo xlt('Ledger');?
> </header
>
340 <div id
="patledger" class="panel-body"></div
>
341 <div
class="panel-footer">
342 <iframe src
="./report/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" width
="100%" height
="475" scrolling
="yes"></iframe
>
349 <div
class="col-sm-12">
350 <div
class="panel panel-primary collapse" id
="profilepanel">
351 <header
class="panel-heading"><?php
echo xlt('Profile'); ?
></header
>
352 <div id
="profilereport" class="panel-body"></div
>
353 <div
class="panel-footer"></div
>
360 <!--<div
class="footer-main">Onsite Patient Portal Beta v3
.0 Copyright
© By sjpadgett@gmail
.com
, 2016 All Rights Reserved
and Recorded
</div
>-->
361 </aside
><!-- /.right
-side
-->
362 </div
><!-- ./wrapper
-->
363 <div id
="openSignModal" class="modal fade" role
="dialog">
364 <div
class="modal-dialog modal-lg">
365 <div
class="modal-content">
366 <div
class="modal-header">
367 <button type
="button" class="close" data
-dismiss
="modal">×
;</button
>
368 <div
class="input-group">
369 <span
class="input-group-addon"
370 onclick
="getSignature(document.getElementById('patientSignaturem'))"><em
> <?php
echo xlt('Show Current Signature On File'); ?
>
372 <?php
echo xlt('As appears on documents'); ?
>.</em
></span
> <img
373 class="signature form-control" type
="patient-signature"
374 id
="patientSignaturem" onclick
="getSignature(this)"
375 alt
="Signature On File" src
="">
378 <div
class="modal-body">
379 <form name
="signit" id
="signit" class="sigPad">
380 <input type
="hidden" name
="name" id
="name" class="name">
382 <label style
='display: none;'><input style
='display: none;'
383 type
="checkbox" class="" id
="isAdmin" name
="isAdmin" /><?php
echo xlt('Is Authorizing Signature');?
></label
>
384 <li
class="clearButton"><a href
="#clear"><button
><?php
echo xlt('Clear Signature');?
></button
></a
></li
>
386 <div
class="sig sigWrapper">
387 <div
class="typed"></div
>
388 <canvas
class="spad" id
="drawpad" width
="765" height
="325"
389 style
="border: 1px solid #000000; left: 0px;"></canvas
>
391 style
="display: none; position: absolute; TOP: 150px; LEFT: 315px; WIDTH: 100px; HEIGHT: 100px"
392 src
="sign/assets/loading.gif" /> <input type
="hidden" id
="output"
393 name
="output" class="output">
395 <input type
="hidden" name
="type" id
="type"
396 value
="patient-signature">
397 <button type
="button" onclick
="signDoc(this)"><?php
echo xlt('Acknowledge as my Electronic Signature');?
>.</button
>
401 <!-- <div
class="modal-footer">
402 <button type
="button" class="btn btn-default" data
-dismiss
="modal">Close
</button
>
407 style
="display: none; position: absolute; top: 100px; left: 260px; width: 100px; height: 100px"
408 src
="sign/assets/loading.gif" />