Setup script bootstrapped with new theme selector - Take 2 (#2139)
[openemr.git] / portal / home.php
bloba81044d7820ba9d2d044d1ef833840f9af268ae2
1 <?php
2 /**
3 * Patient Portal
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Jerry Padgett <sjpadgett@gmail.com>
8 * @copyright Copyright (c) 2016-2019 Jerry Padgett <sjpadgett@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
12 require_once("verify_session.php");
13 require_once("$srcdir/patient.inc");
14 require_once("$srcdir/options.inc.php");
15 require_once("lib/portal_mail.inc");
18 if ($_SESSION['register'] === true) {
19 session_destroy();
20 header('Location: '.$landingpage.'&w');
21 exit();
24 if (!isset($_SESSION['portal_init'])) {
25 $_SESSION['portal_init'] = true;
28 $whereto = 'profilepanel';
29 if (isset($_SESSION['whereto'])) {
30 $whereto = $_SESSION['whereto'];
32 //$whereto = 'paymentpanel';
34 $user = isset($_SESSION['sessionUser']) ? $_SESSION['sessionUser'] : 'portal user';
35 $result = getPatientData($pid);
37 $msgs = getPortalPatientNotes($_SESSION['portal_username']);
38 $msgcnt = count($msgs);
39 $newcnt = 0;
40 foreach ($msgs as $i) {
41 if ($i['message_status'] == 'New') {
42 $newcnt += 1;
46 require_once '_header.php';
48 echo "<script>var cpid='" . attr($pid) . "';var cuser='" . attr($user) . "';var webRoot='" . $GLOBALS['web_root'] . "';var ptName='" . attr($_SESSION['ptName']) . "';</script>";
50 <script type="text/javascript">
51 var webroot_url = webRoot;
53 $(document).ready(function () {
55 $("#profilereport").load("./get_profile.php", {}, function () {
56 $("table").addClass("table table-responsive");
57 $(".demographics td").removeClass("label");
58 $(".demographics td").addClass("bold");
59 $(".insurance table").addClass("table-sm table-striped");
60 $("#editDems").click(function () {
61 showProfileModal()
62 });
63 });
65 $("#medicationlist").load("./get_medications.php", {}, function () {});
66 $("#labresults").load("./get_lab_results.php", {}, function () {});
67 $("#amendmentslist").load("./get_amendments.php", {}, function () {});
68 $("#problemslist").load("./get_problems.php", {}, function () {});
69 $("#allergylist").load("./get_allergies.php", {}, function () {});
70 $("#reports").load("./report/portal_patient_report.php?pid='<?php echo attr($pid) ?>'", {}, function () {});
72 <?php if ($GLOBALS['portal_two_payments']) { ?>
73 $("#payment").load("./portal_payment.php", {}, function () {});
74 <?php } ?>
76 $('.sigPad').signaturePad({drawOnly: true});
77 $(".generateDoc_download").click(function () {
78 $("#doc_form").submit();
79 });
81 function showProfileModal() {
82 var title = '<?php echo xla('Demographics Legend Red: Charted Values. Blue: Patient Edits'); ?> ';
84 var params = {
85 buttons: [
86 {text: '<?php echo xla('Help'); ?>', close: false, style: 'info', id: 'formHelp'},
87 {text: '<?php echo xla('Cancel'); ?>', close: true, style: 'default'},
88 {text: '<?php echo xla('Revert Edits'); ?>', close: false, style: 'danger', id: 'replaceAllButton'},
89 {text: '<?php echo xla('Send for Review'); ?>', close: false, style: 'success', id: 'donePatientButton'}
91 onClosed: 'reload',
92 type: 'GET',
93 url: webRoot + '/portal/patient/patientdata?pid=' + cpid + '&user=' + cuser
95 dlgopen('','','modal-xl', 500, '', title, params);
98 function saveProfile() {
99 page.updateModel();
102 var gowhere = '#<?php echo $whereto?>';
103 $(gowhere).collapse('show');
105 var $doHides = $('#panelgroup');
106 $doHides.on('show.bs.collapse', '.collapse', function () {
107 $doHides.find('.collapse.in').collapse('hide');
109 //Enable sidebar toggle
110 $("[data-toggle='offcanvas']").click(function (e) {
111 e.preventDefault();
112 //If window is small enough, enable sidebar push menu
113 if ($(window).width() <= 992) {
114 $('.row-offcanvas').toggleClass('active');
115 $('.left-side').removeClass("collapse-left");
116 $(".right-side").removeClass("strech");
117 $('.row-offcanvas').toggleClass("relative");
118 } else {
119 //Else, enable content streching
120 $('.left-side').toggleClass("collapse-left");
121 $(".right-side").toggleClass("strech");
124 $(function () {
125 $('#popwait').hide();
126 $('#callccda').click(function () {
127 $('#popwait').show();
132 function editAppointment(mode,deid){
133 if(mode == 'add'){
134 var title = '<?php echo xla('Request New Appointment'); ?>';
135 var mdata = {pid:deid};
137 else{
138 var title = '<?php echo xla('Edit Appointment'); ?>';
139 var mdata = {eid:deid};
141 var params = {
142 dialogId: 'editpop',
143 buttons: [
144 { text: '<?php echo xla('Cancel'); ?>', close: true, style: 'default' }
145 //{ text: 'Print', close: false, style: 'success', click: showCustom }
147 type:'GET',
148 dataType: 'text',
149 url: './add_edit_event_user.php',
150 data: mdata
153 dlgopen('', 'apptModal', 610, 300, '', title, params);
156 </script>
157 <!-- Right side column. Contains content of the page -->
158 <aside class="right-side">
159 <!-- Main content -->
160 <section class="container-fluid content panel-group" id="panelgroup">
161 <div id="popwait" class="alert alert-warning" style="font-size:18px"><strong><?php echo xlt('Working!'); ?></strong> <?php echo xlt('Please wait...'); ?></div>
162 <div class="row collapse" id="lists">
163 <div class="col-sm-6">
164 <div class="panel panel-primary">
165 <header class="panel-heading"><?php echo xlt('Medications'); ?> </header>
166 <div id="medicationlist" class="panel-body"></div>
168 <div class="panel-footer"></div>
169 </div>
171 <div class="panel panel-primary">
172 <header class="panel-heading"><?php echo xlt('Medications Allergy List'); ?> </header>
173 <div id="allergylist" class="panel-body"></div>
175 <div class="panel-footer"></div>
176 </div>
177 </div><!-- /.col -->
178 <div class="col-sm-6">
179 <div class="panel panel-primary">
180 <header class="panel-heading"><?php echo xlt('Issues List'); ?></header>
181 <div id="problemslist" class="panel-body"></div>
183 <div class="panel-footer"></div>
184 </div>
185 <div class="panel panel-primary">
186 <header class="panel-heading"><?php echo xlt('Amendment List'); ?> </header>
187 <div id="amendmentslist" class="panel-body"></div>
189 <div class="panel-footer"></div>
190 </div>
191 </div><!-- /.col -->
192 <div class="col-sm-12">
193 <div class="panel panel-primary">
194 <header class="panel-heading"><?php echo xlt('Lab Results'); ?> </header>
195 <div id="labresults" class="panel-body"></div>
196 <div class="panel-footer"></div>
197 </div><!-- /.panel -->
198 </div><!-- /.col -->
200 </div><!-- /.lists -->
201 <?php if ($GLOBALS['allow_portal_appointments']) { ?>
202 <div class="row">
203 <div class="col-sm-6">
204 <div class="panel panel-primary collapse" id="appointmentpanel">
205 <header class="panel-heading"><?php echo xlt('Appointments'); ?> </header>
206 <div id="appointmentslist" class="panel-body">
207 <?php
208 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
209 "e.pc_startTime, e.pc_hometext, e.pc_apptstatus, u.fname, u.lname, u.mname, " .
210 "c.pc_catname " . "FROM openemr_postcalendar_events AS e, users AS u, " .
211 "openemr_postcalendar_categories AS c WHERE " . "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
212 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " . "ORDER BY e.pc_eventDate, e.pc_startTime";
213 $res = sqlStatement($query, array(
214 $pid
217 if (sqlNumRows($res) > 0) {
218 $count = 0;
219 echo '<table id="appttable" style="width:100%;background:#eee;" class="table table-striped fixedtable"><thead>
220 </thead><tbody>';
221 while ($row = sqlFetchArray($res)) {
222 $status_title = getListItemTitle('apptstat', $row['pc_apptstatus']);
223 $count++;
224 $dayname = xl(date("l", strtotime($row ['pc_eventDate'])));
225 $dispampm = "am";
226 $disphour = substr($row ['pc_startTime'], 0, 2) + 0;
227 $dispmin = substr($row ['pc_startTime'], 3, 2);
228 if ($disphour >= 12) {
229 $dispampm = "pm";
230 if ($disphour > 12) {
231 $disphour -= 12;
235 if ($row ['pc_hometext'] != "") {
236 $etitle = 'Comments' . ": " . $row ['pc_hometext'] . "\r\n";
237 } else {
238 $etitle = "";
241 echo "<tr><td><p>";
242 echo "<a href='#' onclick='editAppointment(0," . htmlspecialchars($row ['pc_eid'], ENT_QUOTES) . ')' .
243 "' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
244 echo "<b>" . htmlspecialchars($dayname . ", " . $row ['pc_eventDate'], ENT_NOQUOTES) . "&nbsp;";
245 echo htmlspecialchars("$disphour:$dispmin " . $dispampm, ENT_NOQUOTES) . "</b><br>";
246 echo htmlspecialchars($row ['pc_catname'], ENT_NOQUOTES) . "<br><b>";
247 echo xlt("Provider") . ":</b> " . htmlspecialchars($row ['fname'] . " " . $row ['lname'], ENT_NOQUOTES) . "<br><b>";
248 echo xlt("Status") . ":</b> " . htmlspecialchars($status_title, ENT_NOQUOTES);
249 echo "</a></p></td></tr>";
252 if (isset($res) && $res != null) {
253 if ($count < 1) {
254 echo "&nbsp;&nbsp;" . xlt('None');
257 } else { // if no appts
258 echo xlt('No Appointments');
261 echo '</tbody></table>';
263 <div style='margin: 5px 0 5px'>
264 <a href='#' onclick="editAppointment('add',<?php echo attr($pid); ?>)">
265 <button class='btn btn-primary pull-right'><?php echo xlt('Schedule New Appointment'); ?></button>
266 </a>
267 </div>
268 </div>
269 <div class="panel-footer"></div>
270 </div><!-- /.panel -->
271 </div><!-- /.col -->
272 </div><!-- /.row -->
273 <?php } ?>
274 <?php if ($GLOBALS['portal_two_payments']) { ?>
275 <div class="row">
276 <div class="col-sm-12">
277 <div class="panel panel-primary collapse" id="paymentpanel">
278 <header class="panel-heading"> <?php echo xlt('Payments'); ?> </header>
279 <div id="payment" class="panel-body"></div>
280 <div class="panel-footer">
281 </div>
282 </div>
283 </div> <!--/.col -->
284 </div>
285 <?php } ?>
286 <?php if ($GLOBALS['allow_portal_chat']) { ?>
287 <div class="row">
288 <div class="col-sm-12">
289 <div class="panel panel-primary collapse" style="padding-top:0;padding-bottom:0;" id="messagespanel">
290 <!-- <header class="panel-heading"><?php //echo xlt('Secure Chat'); ?> </header>-->
291 <div id="messages" class="panel-body" style="height:calc(100vh - 120px);overflow:auto;padding:0 0 0 0;" >
292 <iframe src="./messaging/secure_chat.php" width="100%" height="100%"></iframe>
293 </div>
294 </div>
295 </div><!-- /.col -->
296 </div>
297 <?php } ?>
298 <div class="row">
299 <div class="col-sm-8">
300 <div class="panel panel-primary collapse" id="reportpanel">
301 <header class="panel-heading"><?php echo xlt('Reports'); ?> </header>
302 <div id="reports" class="panel-body"></div>
303 <div class="panel-footer"></div>
304 </div>
305 </div>
306 <!-- /.col -->
307 <?php if (!empty($GLOBALS['portal_onsite_document_download'])) { ?>
308 <div class="col-sm-6">
309 <div class="panel panel-primary collapse" id="downloadpanel">
310 <header class="panel-heading"> <?php echo xlt('Download Documents'); ?> </header>
311 <div id="docsdownload" class="panel-body">
312 <div>
313 <span class="text"><?php echo xlt('Download all patient documents');?></span>
314 <form name='doc_form' id='doc_form' action='./get_patient_documents.php' method='post'>
315 <input type="button" class="generateDoc_download" value="<?php echo xla('Download'); ?>" />
316 </form>
317 </div>
318 </div><!-- /.panel-body -->
319 <div class="panel-footer"></div>
320 </div>
321 </div><!-- /.col -->
322 <?php } ?>
323 </div>
324 <?php if ($GLOBALS['portal_two_ledger']) { ?>
325 <div class="row">
326 <div class="col-sm-12">
327 <div class="panel panel-primary collapse" id="ledgerpanel">
328 <header class="panel-heading"><?php echo xlt('Ledger');?> </header>
329 <div id="patledger" class="panel-body"></div>
330 <div class="panel-footer">
331 <iframe src="./report/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" width="100%" height="475" scrolling="yes"></iframe>
332 </div>
333 </div>
334 </div><!-- /.col -->
335 </div>
336 <?php } ?>
337 <div class="row">
338 <div class="col-sm-12">
339 <div class="panel panel-primary collapse" id="profilepanel">
340 <header class="panel-heading"><?php echo xlt('Profile'); ?></header>
341 <div id="profilereport" class="panel-body"></div>
342 <div class="panel-footer"></div>
343 </div>
344 </div>
345 </div>
347 </section>
348 <!-- /.content -->
349 <!--<div class="footer-main">Onsite Patient Portal Beta v3.0 Copyright &copy By sjpadgett@gmail.com, 2016 All Rights Reserved and Recorded</div>-->
350 </aside><!-- /.right-side -->
351 </div><!-- ./wrapper -->
352 <div id="openSignModal" class="modal fade" role="dialog">
353 <div class="modal-dialog modal-lg">
354 <div class="modal-content">
355 <div class="modal-header">
356 <button type="button" class="close" data-dismiss="modal">&times;</button>
357 <div class="input-group">
358 <span class="input-group-addon"
359 onclick="getSignature(document.getElementById('patientSignaturem'))"><em> <?php echo xlt('Show Current Signature On File'); ?>
360 <br>
361 <?php echo xlt('As appears on documents'); ?>.</em></span> <img
362 class="signature form-control" type="patient-signature"
363 id="patientSignaturem" onclick="getSignature(this)"
364 alt="Signature On File" src="">
365 </div>
366 </div>
367 <div class="modal-body">
368 <form name="signit" id="signit" class="sigPad">
369 <input type="hidden" name="name" id="name" class="name">
370 <ul class="sigNav">
371 <label style='display: none;'><input style='display: none;'
372 type="checkbox" class="" id="isAdmin" name="isAdmin" /><?php echo xlt('Is Authorizing Signature');?></label>
373 <li class="clearButton"><a href="#clear"><button><?php echo xlt('Clear Signature');?></button></a></li>
374 </ul>
375 <div class="sig sigWrapper">
376 <div class="typed"></div>
377 <canvas class="spad" id="drawpad" width="765" height="325"
378 style="border: 1px solid #000000; left: 0px;"></canvas>
379 <img id="loading"
380 style="display: none; position: absolute; TOP: 150px; LEFT: 315px; WIDTH: 100px; HEIGHT: 100px"
381 src="sign/assets/loading.gif" /> <input type="hidden" id="output"
382 name="output" class="output">
383 </div>
384 <input type="hidden" name="type" id="type"
385 value="patient-signature">
386 <button type="button" onclick="signDoc(this)"><?php echo xlt('Acknowledge as my Electronic Signature');?>.</button>
387 </form>
388 </div>
389 </div>
390 <!-- <div class="modal-footer">
391 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
392 </div> -->
393 </div>
394 </div><!-- Modal -->
395 <img id="waitend"
396 style="display: none; position: absolute; top: 100px; left: 260px; width: 100px; height: 100px"
397 src="sign/assets/loading.gif" />
400 </body>
401 </html>