dump db version
[openemr.git] / patients / summary_pat_portal.php
blob98afe381bfc6735d2e3ff9e16508b76d7135491f
1 <?php
2 /**
3 * summary_pat_portal
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Cassian LUP <cassi.lup@gmail.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2011 Cassian LUP <cassi.lup@gmail.com>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 //continue session
15 session_start();
17 //landing page definition -- where to go if something goes wrong
18 $landingpage = "index.php?site=".$_SESSION['site_id'];
21 // kick out if patient not authenticated
22 if (isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite'])) {
23 $pid = $_SESSION['pid'];
24 } else {
25 session_destroy();
26 header('Location: '.$landingpage.'&w');
27 exit;
32 $ignoreAuth = true;
33 global $ignoreAuth;
35 require_once("../interface/globals.php");
36 require_once("$srcdir/patient.inc");
37 require_once("$srcdir/acl.inc");
38 require_once("$srcdir/options.inc.php");
39 require_once("../interface/patient_file/history/history.inc.php");
40 require_once("$srcdir/edi.inc");
41 require_once("$srcdir/lists.inc");
43 <html>
44 <head>
46 <title><?php echo xlt('Patient Information'); ?></title>
48 <?php html_header_show(); ?>
49 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
50 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker/build/jquery.datetimepicker.min.css">
52 <script type="text/javascript" src="<?php echo $web_root; ?>/library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
53 <script type="text/javascript" src="<?php echo $web_root; ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
54 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery/dist/jquery.min.js"></script>
55 <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/common.js?v=<?php echo $v_js_includes; ?>"></script>
56 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker/build/jquery.datetimepicker.full.min.js"></script>
59 <link rel="stylesheet" href="css/base.css" type="text/css"/>
60 <link rel="stylesheet" href="css/tables.css" type="text/css"/>
62 <script type="text/javascript" language="JavaScript">
64 function refreshme() {
65 location.reload();
68 function toggleIndicator(target,div) {
70 $mode = $(target).find(".indicator").text();
71 if ( $mode == "<?php echo xla('collapse'); ?>" ) {
72 $(target).find(".indicator").text( "<?php echo xla('expand'); ?>" );
73 $("#"+div).hide();
74 } else {
75 $(target).find(".indicator").text( "<?php echo xla('collapse'); ?>" );
76 $("#"+div).show();
80 function show_date_fun(){
81 if(document.getElementById('show_date').checked == true){
82 document.getElementById('date_div').style.display = '';
83 }else{
84 document.getElementById('date_div').style.display = 'none';
86 return;
89 $(document).ready(function(){
91 // load divs
92 $("#labtestresults_ps_expand").load("get_lab_results.php");
93 $("#problemlist_ps_expand").load("get_problems.php");
94 $("#medicationlist_ps_expand").load("get_medications.php");
95 $("#medicationallergylist_ps_expand").load("get_allergies.php");
96 $("#amendments_ps_expand").load("get_amendments.php");
97 $("#appointments_ps_expand").load("get_appointments.php");
99 $(".generateCCR").click(
100 function() {
101 if(document.getElementById('show_date').checked == true){
102 if(document.getElementById('Start').value == '' || document.getElementById('End').value == ''){
103 alert('<?php echo xls('Please select a start date and end date') ?>');
104 return false;
107 var ccrAction = document.getElementsByName('ccrAction');
108 ccrAction[0].value = 'generate';
109 var raw = document.getElementsByName('raw');
110 raw[0].value = 'no';
111 ccr_form.setAttribute("target", "_blank");
112 $("#ccr_form").submit();
113 ccr_form.setAttribute("target", "");
115 $(".generateCCR_raw").click(
116 function() {
117 var ccrAction = document.getElementsByName('ccrAction');
118 ccrAction[0].value = 'generate';
119 var raw = document.getElementsByName('raw');
120 raw[0].value = 'yes';
121 ccr_form.setAttribute("target", "_blank");
122 $("#ccr_form").submit();
123 ccr_form.setAttribute("target", "");
125 $(".generateCCR_download_h").click(
126 function() {
127 var ccrAction = document.getElementsByName('ccrAction');
128 ccrAction[0].value = 'generate';
129 var raw = document.getElementsByName('raw');
130 raw[0].value = 'hybrid';
131 $("#ccr_form").submit();
133 $(".generateCCR_download_p").click(
134 function() {
135 if(document.getElementById('show_date').checked == true){
136 if(document.getElementById('Start').value == '' || document.getElementById('End').value == ''){
137 alert('<?php echo xls('Please select a start date and end date') ?>');
138 return false;
141 var ccrAction = document.getElementsByName('ccrAction');
142 ccrAction[0].value = 'generate';
143 var raw = document.getElementsByName('raw');
144 raw[0].value = 'pure';
145 $("#ccr_form").submit();
147 $(".viewCCD").click(
148 function() {
149 var ccrAction = document.getElementsByName('ccrAction');
150 ccrAction[0].value = 'viewccd';
151 var raw = document.getElementsByName('raw');
152 raw[0].value = 'no';
153 ccr_form.setAttribute("target", "_blank");
154 $("#ccr_form").submit();
155 ccr_form.setAttribute("target", "");
157 $(".viewCCD_raw").click(
158 function() {
159 var ccrAction = document.getElementsByName('ccrAction');
160 ccrAction[0].value = 'viewccd';
161 var raw = document.getElementsByName('raw');
162 raw[0].value = 'yes';
163 ccr_form.setAttribute("target", "_blank");
164 $("#ccr_form").submit();
165 ccr_form.setAttribute("target", "");
167 $(".viewCCD_download").click(
168 function() {
169 var ccrAction = document.getElementsByName('ccrAction');
170 ccrAction[0].value = 'viewccd';
171 var raw = document.getElementsByName('raw');
172 raw[0].value = 'pure';
173 $("#ccr_form").submit();
175 $(".generateDoc_download").click(
176 function() {
177 $("#doc_form").submit();
179 <?php if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?>
180 $(".viewCCR_send_dialog").click(
181 function() {
182 $("#ccr_send_dialog").toggle();
184 $(".viewCCR_transmit").click(
185 function() {
186 $(".viewCCR_transmit").attr('disabled','disabled');
187 var ccrAction = document.getElementsByName('ccrAction');
188 ccrAction[0].value = 'generate';
189 var ccrRecipient = $("#ccr_send_to").val();
190 var raw = document.getElementsByName('raw');
191 raw[0].value = 'send '+ccrRecipient;
192 if(ccrRecipient=="") {
193 $("#ccr_send_message").html("<?php
194 echo xla('Please enter a valid Direct Address above.');?>");
195 $("#ccr_send_result").show();
196 } else {
197 $(".viewCCR_transmit").attr('disabled','disabled');
198 $("#ccr_send_message").html("<?php
199 echo xla('Working... this may take a minute.');?>");
200 $("#ccr_send_result").show();
201 var action=$("#ccr_form").attr('action');
202 $.post(action, {ccrAction:'generate',raw:'send '+ccrRecipient,requested_by:'patient'},
203 function(data) {
204 if(data=="SUCCESS") {
205 $("#ccr_send_message").html("<?php
206 echo xla('Your message was submitted for delivery to');
207 ?> "+ccrRecipient);
208 $("#ccr_send_to").val("");
209 } else {
210 $("#ccr_send_message").html(data);
212 $(".viewCCR_transmit").removeAttr('disabled');
216 <?php }
218 if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?>
219 $(".viewCCD_send_dialog").click(
220 function() {
221 $("#ccd_send_dialog").toggle();
223 $(".viewCCD_transmit").click(
224 function() {
225 $(".viewCCD_transmit").attr('disabled','disabled');
226 var ccrAction = document.getElementsByName('ccrAction');
227 ccrAction[0].value = 'viewccd';
228 var ccdRecipient = $("#ccd_send_to").val();
229 var raw = document.getElementsByName('raw');
230 raw[0].value = 'send '+ccdRecipient;
231 if(ccdRecipient=="") {
232 $("#ccd_send_message").html("<?php
233 echo xla('Please enter a valid Direct Address above.');?>");
234 $("#ccd_send_result").show();
235 } else {
236 $(".viewCCD_transmit").attr('disabled','disabled');
237 $("#ccd_send_message").html("<?php
238 echo xla('Working... this may take a minute.');?>");
239 $("#ccd_send_result").show();
240 var action=$("#ccr_form").attr('action');
241 $.post(action, {ccrAction:'viewccd',raw:'send '+ccdRecipient,requested_by:'patient'},
242 function(data) {
243 if(data=="SUCCESS") {
244 $("#ccd_send_message").html("<?php
245 echo xla('Your message was submitted for delivery to');
246 ?> "+ccdRecipient);
247 $("#ccd_send_to").val("");
248 } else {
249 $("#ccd_send_message").html(data);
251 $(".viewCCD_transmit").removeAttr('disabled');
255 <?php } ?>
257 $('.datepicker').datetimepicker({
258 <?php $datetimepicker_timepicker = false; ?>
259 <?php $datetimepicker_showseconds = false; ?>
260 <?php $datetimepicker_formatInput = false; ?>
261 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
262 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
266 </script>
268 </head>
270 <body class="body_top">
272 <div id="wrapper" class="lefttop" style="width: 700px;">
273 <h2 class="heading"><?php echo xlt("Patient Portal"); ?></h2>
275 <?php
276 $result = getPatientData($pid);
278 <?php echo xlt('Welcome'); ?> <b><?php echo text($result['fname']." ".$result['lname']); ?></b>
280 <div style='margin-top:10px'> <!-- start main content div -->
281 <table border="0" cellspacing="0" cellpadding="0" width="100%">
282 <tr>
283 <td align="left" valign="top">
284 <!-- start left column div -->
285 <div style='float:left; margin-right:20px'>
286 <table cellspacing=0 cellpadding=0>
287 <?php if ($GLOBALS['activate_ccr_ccd_report']) { // show CCR/CCD reporting options ?>
288 <tr>
289 <td width='650px'>
290 <?php
291 // Reports widget
292 $widgetTitle = xl("Reports");
293 $widgetLabel = "reports";
294 $widgetButtonLabel = xl("");
295 $widgetButtonClass = "hidden";
296 $linkMethod = "html";
297 $bodyClass = "notab";
298 $widgetAuth = false;
299 $fixedWidth = true;
300 expand_collapse_widget(
301 $widgetTitle,
302 $widgetLabel,
303 $widgetButtonLabel,
304 $widgetButtonLink,
305 $widgetButtonClass,
306 $linkMethod,
307 $bodyClass,
308 $widgetAuth,
309 $fixedWidth
312 <br/>
313 <div style='margin-left:3em; margin-right:3em; padding:1em; border:1px solid blue;' class='text'>
314 <div id="ccr_report">
315 <form name='ccr_form' id='ccr_form' method='post' action='../ccr/createCCR.php?portal_auth=1'>
316 <span class='text'><b><?php echo xlt('Continuity of Care Record (CCR)'); ?></b></span>&nbsp;&nbsp;
317 <br/>
318 <span class='text'>(<?php echo xlt('Pop ups need to be enabled to see these reports'); ?>)</span>
319 <br/>
320 <br/>
321 <input type='hidden' name='ccrAction'>
322 <input type='hidden' name='raw'>
323 <input type="checkbox" name="show_date" id="show_date" onchange="show_date_fun();" ><span class='text'><?php echo xlt('Use Date Range'); ?>
324 <br>
325 <div id="date_div" style="display:none" >
326 <br>
327 <table border="0" cellpadding="0" cellspacing="0" >
328 <tr>
329 <td>
330 <span class='bold'><?php echo xlt('Start Date');?>: </span>
331 </td>
332 <td>
333 <input type='text' size='10' class='datepicker' name='Start' id='Start'
334 title='<?php echo xla('yyyy-mm-dd'); ?>' />
335 </td>
336 <td>
337 &nbsp;
338 <span class='bold'><?php echo xlt('End Date');?>: </span>
339 </td>
340 <td>
341 <input type='text' class='datepicker' size='10' name='End' id='End'
342 title='<?php echo xla('yyyy-mm-dd'); ?>' />
343 </td>
344 </tr>
345 </table>
346 </div>
347 <br>
348 <input type="button" class="generateCCR" value="<?php echo xla('View/Print'); ?>" />
349 <!-- <input type="button" class="generateCCR_download_h" value="<?php echo xla('Download'); ?>" /> -->
350 <input type="button" class="generateCCR_download_p" value="<?php echo xla('Download'); ?>" />
351 <!-- <input type="button" class="generateCCR_raw" value="<?php echo xla('Raw Report'); ?>" /> -->
352 <?php if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?>
353 <input type="button" class="viewCCR_send_dialog" value="<?php echo xla('Transmit'); ?>" />
354 <br>
355 <div id="ccr_send_dialog" style="display:none" >
356 <br>
357 <table border="0" cellpadding="0" cellspacing="0" >
358 <tr>
359 <td>
360 <span class='bold'><?php echo xlt('Enter Recipient\'s Direct Address');?>: </span>
361 <input type="text" size="64" name="ccr_send_to" id="ccr_send_to" value="">
362 <input type="button" class="viewCCR_transmit" value="<?php echo xla('Send'); ?>" />
363 <div id="ccr_send_result" style="display:none" >
364 <span class="text" id="ccr_send_message"></span>
365 </div>
366 </td>
367 </tr>
368 </table>
369 </div>
370 <?php } ?>
371 <hr/>
372 <span class='text'><b><?php echo xlt('Continuity of Care Document (CCD)'); ?></b></span>&nbsp;&nbsp;
373 <br/>
374 <span class='text'>(<?php echo xlt('Pop ups need to be enabled to see these reports'); ?>)</span>
375 <br/>
376 <br/>
377 <input type="button" class="viewCCD" value="<?php echo xla('View/Print'); ?>" />
378 <input type="button" class="viewCCD_download" value="<?php echo xla('Download'); ?>" />
379 <!-- <input type="button" class="viewCCD_raw" value="<?php echo xla('Raw Report'); ?>" /> -->
380 <?php if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?>
381 <input type="button" class="viewCCD_send_dialog" value="<?php echo xla('Transmit'); ?>" />
382 <br>
383 <div id="ccd_send_dialog" style="display:none" >
384 <br>
385 <table border="0" cellpadding="0" cellspacing="0" >
386 <tr>
387 <td>
388 <span class='bold'><?php echo xlt('Enter Recipient\'s Direct Address');?>: </span>
389 <input type="text" size="64" name="ccd_send_to" id="ccd_send_to" value="">
390 <input type="button" class="viewCCD_transmit" value="<?php echo xla('Send'); ?>" />
391 <div id="ccd_send_result" style="display:none" >
392 <span class="text" id="ccd_send_message"></span>
393 </div>
394 </td>
395 </tr>
396 </table>
397 </div>
398 <?php } ?>
399 </form>
400 </div>
401 </div>
402 <br/>
404 </div>
405 </td>
406 </tr>
407 <?php } // end CCR/CCD reporting options ?>
408 <?php if ($GLOBALS['portal_onsite_document_download']) { ?>
409 <?php echo "<tr><td width='650px'>";
410 $widgetTitle = xl('Documents');
411 $widgetLabel = "documents";
412 $widgetButtonLabel = xl('Download');
413 $widgetButtonClass = "hidden";
414 $linkMethod = "html";
415 $bodyClass = "notab";
416 $widgetAuth = false;
417 $fixedWidth = true;
418 expand_collapse_widget(
419 $widgetTitle,
420 $widgetLabel,
421 $widgetButtonLabel,
422 $widgetButtonLink,
423 $widgetButtonClass,
424 $linkMethod,
425 $bodyClass,
426 $widgetAuth,
427 $fixedWidth
430 <span class="text"><?php echo xlt('Download all patient documents');?></span>
431 <br /><br />
432 <form name='doc_form' id='doc_form' action='get_patient_documents.php' method='post'>
433 <input type="button" class="generateDoc_download" value="<?php echo xla('Download'); ?>" />
434 </form>
435 </div>
436 </td>
437 </tr>
438 <?php } ?>
439 <?php echo "<tr><td width='650px'>";
440 // Lab tests results expand collapse widget
441 $widgetTitle = xl("Lab Test Results");
442 $widgetLabel = "labtestresults";
443 $widgetButtonLabel = xl("");
444 $widgetButtonClass = "hidden";
445 $linkMethod = "html";
446 $bodyClass = "notab";
447 $widgetAuth = false;
448 $fixedWidth = true;
449 expand_collapse_widget(
450 $widgetTitle,
451 $widgetLabel,
452 $widgetButtonLabel,
453 $widgetButtonLink,
454 $widgetButtonClass,
455 $linkMethod,
456 $bodyClass,
457 $widgetAuth,
458 $fixedWidth
462 <br/>
463 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div><br/>
464 </div>
466 </td>
467 </tr>
468 <?php echo "<tr><td width='650px'>";
469 // problem list collapse widget
470 $widgetTitle = xl("Problem List");
471 $widgetLabel = "problemlist";
472 $widgetButtonLabel = xl("");
473 $widgetButtonClass = "hidden";
474 $linkMethod = "html";
475 $bodyClass = "notab";
476 $widgetAuth = false;
477 $fixedWidth = true;
478 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
480 </div>
483 </td>
484 </tr>
486 <tr>
487 <td width='650px'>
488 <?php
489 // medication list expand collapse widget
490 $widgetTitle = xl("Medication List");
491 $widgetLabel = "medicationlist";
492 $widgetButtonLabel = xl("");
493 $widgetButtonClass = "hidden";
494 $linkMethod = "html";
495 $bodyClass = "notab";
496 $widgetAuth = false;
497 $fixedWidth = true;
498 expand_collapse_widget(
499 $widgetTitle,
500 $widgetLabel,
501 $widgetButtonLabel,
502 $widgetButtonLink,
503 $widgetButtonClass,
504 $linkMethod,
505 $bodyClass,
506 $widgetAuth,
507 $fixedWidth
510 <br/>
511 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div><br/>
512 </div>
514 </td>
515 </tr>
517 <tr>
518 <td width='650px'>
519 <?php // medication allergy expand collapse widget
520 $widgetTitle = xl("Medication Allergy List");
521 $widgetLabel = "medicationallergylist";
522 $widgetButtonLabel = xl("");
523 $widgetButtonClass = "";
524 $linkMethod = "html";
525 $bodyClass = "notab";
526 $widgetAuth = false;
527 $fixedWidth = true;
528 expand_collapse_widget(
529 $widgetTitle,
530 $widgetLabel,
531 $widgetButtonLabel,
532 $widgetButtonLink,
533 $widgetButtonClass,
534 $linkMethod,
535 $bodyClass,
536 $widgetAuth,
537 $fixedWidth
540 <br/>
541 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div><br/>
542 </div>
544 </td>
545 </tr>
547 <!-- Amendments -->
548 <?php if ($GLOBALS['amendments']) { ?>
549 <tr>
550 <td width='650px'>
551 <?php
552 $widgetTitle = xl("Amendments");
553 $widgetLabel = "amendments";
554 $widgetButtonLabel = xl("");
555 $widgetButtonClass = "hidden";
556 $linkMethod = "html";
557 $bodyClass = "notab";
558 $widgetAuth = false;
559 $fixedWidth = true;
560 expand_collapse_widget(
561 $widgetTitle,
562 $widgetLabel,
563 $widgetButtonLabel,
564 $widgetButtonLink,
565 $widgetButtonClass,
566 $linkMethod,
567 $bodyClass,
568 $widgetAuth,
569 $fixedWidth
573 <br/>
574 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div><br/>
575 </td>
576 </tr>
577 <?php } ?>
578 <tr>
579 <td width='650px'>
580 <?php
581 // Show current and upcoming appointments.
582 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
583 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
584 "c.pc_catname " .
585 "FROM openemr_postcalendar_events AS e, users AS u, " .
586 "openemr_postcalendar_categories AS c WHERE " .
587 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
588 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
589 "ORDER BY e.pc_eventDate, e.pc_startTime";
590 //echo $query;
591 $res = sqlStatement($query, array($pid));
593 // appointments expand collapse widget
594 $widgetTitle = xl("Appointments");
595 $widgetLabel = "appointments";
596 $widgetButtonLabel = xl("Add");
597 $widgetButtonLink = "add_edit_event_user.php?pid=".htmlspecialchars($pid, ENT_QUOTES);
598 $widgetButtonClass = "edit_event iframe";
599 $linkMethod = "";
600 $bodyClass = "summary_item small";
601 if ($GLOBALS['portal_onsite_appt_modify']) {
602 $widgetAuth = true;
603 } else {
604 $widgetAuth = false;
607 $fixedWidth = false;
608 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
609 $count = 0;
611 <div id='stats_div' style="display:none">
612 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div>
613 </div>
614 </td>
615 </tr>
616 </table>
618 </div>
620 </td>
622 </tr>
624 </table>
626 </div> <!-- end main content div -->
628 <div id="portal-buttons-bottom"> <!-- buttons bottom div -->
629 <input type="button" style="text-align: right;" value="<?php echo xla('Log Out'); ?>" onclick="window.location = 'logout.php'"/>
631 <input type="button" style="text-align: right;" value="<?php echo xla('Change Password'); ?>" onclick="window.location = '<?php echo $landingpage."&password_update=1";?>'"/>
632 </div><!-- end buttons bottom div -->
634 </div>
635 </body>
636 </html>