incremented patch version 13
[openemr.git] / patients / summary_pat_portal.php
blob16b6a850199483924d13dfa677e542449d789823
1 <?php
3 // Copyright (C) 2011 by following authors:
4 // - Cassian LUP <cassi.lup@gmail.com>
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 //SANITIZE ALL ESCAPES
12 // (note this is already completed by the script that includes this
13 // get_patient_info.php )
15 //STOP FAKE REGISTER GLOBALS
16 // (note this is already completed by the script that includes this
17 // get_patient_info.php )
19 //landing page definition -- where to go if something goes wrong
20 $landingpage = "index.php";
23 // kick out if patient not authenticated
24 session_start();
25 if ( isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite']) ) {
26 $pid = $_SESSION['pid'];
28 else {
29 session_destroy();
30 header('Location: '.$landingpage.'?w');
31 exit;
35 $ignoreAuth = true;
36 global $ignoreAuth;
38 require_once("../interface/globals.php");
39 require_once("$srcdir/patient.inc");
40 require_once("$srcdir/acl.inc");
41 require_once("$srcdir/classes/Address.class.php");
42 require_once("$srcdir/classes/InsuranceCompany.class.php");
43 require_once("$srcdir/classes/Document.class.php");
44 require_once("$srcdir/options.inc.php");
45 require_once("../interface/patient_file/history/history.inc.php");
46 require_once("$srcdir/formatting.inc.php");
47 require_once("$srcdir/edi.inc");
48 include_once("$srcdir/lists.inc");
51 <html>
53 <head>
54 <?php html_header_show(); ?>
55 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
56 <link rel="stylesheet" type="text/css" href="<?php echo $web_root; ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
57 <link rel="stylesheet" type="text/css" href="<?php echo $web_root; ?>/library/dynarch_calendar.css">
58 <script type="text/javascript" src="<?php echo $web_root; ?>/library/textformat.js"></script>
59 <script type="text/javascript" src="<?php echo $web_root; ?>/library/dynarch_calendar.js"></script>
60 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
61 <script type="text/javascript" src="<?php echo $web_root; ?>/library/dynarch_calendar_setup.js"></script>
62 <script type="text/javascript" src="<?php echo $web_root; ?>/library/dialog.js"></script>
63 <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery.1.3.2.js"></script>
64 <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/common.js"></script>
65 <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
66 <link rel="stylesheet" href="css/base.css" type="text/css"/>
67 <link rel="stylesheet" href="css/tables.css" type="text/css"/>
68 <script type="text/javascript" language="JavaScript">
70 function refreshme() {
71 location.reload();
74 function toggleIndicator(target,div) {
76 $mode = $(target).find(".indicator").text();
77 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
78 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
79 $("#"+div).hide();
80 } else {
81 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
82 $("#"+div).show();
86 function refreshAppointments() {
87 $("#appointments_ps_expand").load("get_appointments.php", { 'embeddedScreen' : true }, function() {
88 $(".edit_event").fancybox({
89 'overlayOpacity' : 0.0,
90 'showCloseButton' : true,
91 'centerOnScroll' : false,
92 'autoscale' : true,
93 'hihdeOnContentClick' : false,
94 'callbackOnClose' : function() {
95 refreshAppointments();
97 });
98 });
101 function show_date_fun(){
102 if(document.getElementById('show_date').checked == true){
103 document.getElementById('date_div').style.display = '';
104 }else{
105 document.getElementById('date_div').style.display = 'none';
107 return;
110 $(document).ready(function(){
112 // load divs
113 $("#labtestresults_ps_expand").load("get_lab_results.php", { 'embeddedScreen' : true }, function() {
114 // (note need to place javascript code here also to get the dynamic link to work)
115 $(".medium_modal").fancybox( {
116 'overlayOpacity' : 0.0,
117 'showCloseButton' : true,
118 'frameHeight' : 500,
119 'frameWidth' : 800,
120 'centerOnScroll' : false,
121 'callbackOnClose' : function() {
122 refreshme();
126 $("#problemlist_ps_expand").load("get_problems.php", { 'embeddedScreen' : true }, function() {
127 // (note need to place javascript code here also to get the dynamic link to work)
128 $(".medium_modal").fancybox( {
129 'overlayOpacity' : 0.0,
130 'showCloseButton' : true,
131 'frameHeight' : 500,
132 'frameWidth' : 800,
133 'centerOnScroll' : false,
134 'callbackOnClose' : function() {
135 refreshme();
139 $("#medicationlist_ps_expand").load("get_medications.php", { 'embeddedScreen' : true }, function() {
140 // (note need to place javascript code here also to get the dynamic link to work)
141 $(".medium_modal").fancybox( {
142 'overlayOpacity' : 0.0,
143 'showCloseButton' : true,
144 'frameHeight' : 500,
145 'frameWidth' : 800,
146 'centerOnScroll' : false,
147 'callbackOnClose' : function() {
148 refreshme();
152 $("#medicationallergylist_ps_expand").load("get_allergies.php", { 'embeddedScreen' : true }, function() {
153 // (note need to place javascript code here also to get the dynamic link to work)
154 $(".medium_modal").fancybox( {
155 'overlayOpacity' : 0.0,
156 'showCloseButton' : true,
157 'frameHeight' : 500,
158 'frameWidth' : 800,
159 'centerOnScroll' : false,
160 'callbackOnClose' : function() {
161 refreshme();
166 refreshAppointments();
168 // fancy box
169 enable_modals();
171 // modal for dialog boxes
172 $(".large_modal").fancybox( {
173 'overlayOpacity' : 0.0,
174 'showCloseButton' : true,
175 'frameHeight' : 600,
176 'frameWidth' : 1000,
177 'centerOnScroll' : false
180 // modal for image viewer
181 $(".image_modal").fancybox( {
182 'overlayOpacity' : 0.0,
183 'showCloseButton' : true,
184 'centerOnScroll' : false,
185 'autoscale' : true
188 $(".add_event").fancybox( {
189 'overlayOpacity' : 0.0,
190 'showCloseButton' : true,
191 'centerOnScroll' : false,
192 'autoscale' : true,
193 'hideOnContentClick' : false,
194 'onClose' : function() {
195 refreshme();
199 $(".generateCCR").click(
200 function() {
201 if(document.getElementById('show_date').checked == true){
202 if(document.getElementById('Start').value == '' || document.getElementById('End').value == ''){
203 alert('<?php echo addslashes( xl('Please select a start date and end date')) ?>');
204 return false;
207 var ccrAction = document.getElementsByName('ccrAction');
208 ccrAction[0].value = 'generate';
209 var raw = document.getElementsByName('raw');
210 raw[0].value = 'no';
211 ccr_form.setAttribute("target", "_blank");
212 $("#ccr_form").submit();
213 ccr_form.setAttribute("target", "");
215 $(".generateCCR_raw").click(
216 function() {
217 var ccrAction = document.getElementsByName('ccrAction');
218 ccrAction[0].value = 'generate';
219 var raw = document.getElementsByName('raw');
220 raw[0].value = 'yes';
221 ccr_form.setAttribute("target", "_blank");
222 $("#ccr_form").submit();
223 ccr_form.setAttribute("target", "");
225 $(".generateCCR_download_h").click(
226 function() {
227 var ccrAction = document.getElementsByName('ccrAction');
228 ccrAction[0].value = 'generate';
229 var raw = document.getElementsByName('raw');
230 raw[0].value = 'hybrid';
231 $("#ccr_form").submit();
233 $(".generateCCR_download_p").click(
234 function() {
235 if(document.getElementById('show_date').checked == true){
236 if(document.getElementById('Start').value == '' || document.getElementById('End').value == ''){
237 alert('<?php echo addslashes( xl('Please select a start date and end date')) ?>');
238 return false;
241 var ccrAction = document.getElementsByName('ccrAction');
242 ccrAction[0].value = 'generate';
243 var raw = document.getElementsByName('raw');
244 raw[0].value = 'pure';
245 $("#ccr_form").submit();
247 $(".viewCCD").click(
248 function() {
249 var ccrAction = document.getElementsByName('ccrAction');
250 ccrAction[0].value = 'viewccd';
251 var raw = document.getElementsByName('raw');
252 raw[0].value = 'no';
253 ccr_form.setAttribute("target", "_blank");
254 $("#ccr_form").submit();
255 ccr_form.setAttribute("target", "");
257 $(".viewCCD_raw").click(
258 function() {
259 var ccrAction = document.getElementsByName('ccrAction');
260 ccrAction[0].value = 'viewccd';
261 var raw = document.getElementsByName('raw');
262 raw[0].value = 'yes';
263 ccr_form.setAttribute("target", "_blank");
264 $("#ccr_form").submit();
265 ccr_form.setAttribute("target", "");
270 </script>
272 </head>
274 <body class="body_top">
276 <div id="wrapper" class="lefttop" style="width: 700px;">
277 <h2 class="heading"><?php echo htmlspecialchars( xl('Patient Portal'), ENT_NOQUOTES); ?></h2>
279 <?php
280 $result = getPatientData($pid);
282 <?php echo htmlspecialchars( xl('Welcome'), ENT_NOQUOTES); ?> <b><?php echo htmlspecialchars($result['fname']." ".$result['lname'],ENT_NOQUOTES); ?></b>
284 <div style='margin-top:10px'> <!-- start main content div -->
285 <table border="0" cellspacing="0" cellpadding="0" width="100%">
286 <tr>
287 <td align="left" valign="top">
288 <!-- start left column div -->
289 <div style='float:left; margin-right:20px'>
290 <table cellspacing=0 cellpadding=0>
291 <?php if ( $GLOBALS['activate_ccr_ccd_report'] ) { // show CCR/CCD reporting options ?>
292 <tr>
293 <td width='650px'>
294 <?php
295 // Reports widget
296 $widgetTitle = xl("Reports");
297 $widgetLabel = "reports";
298 $widgetButtonLabel = xl("");
299 $widgetButtonClass = "hidden";
300 $linkMethod = "html";
301 $bodyClass = "notab";
302 $widgetAuth = false;
303 $fixedWidth = true;
304 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
305 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
306 $widgetAuth, $fixedWidth);
308 <br/>
309 <div style='margin-left:3em; margin-right:3em; padding:1em; border:1px solid blue;' class='text'>
310 <div id="ccr_report">
311 <form name='ccr_form' id='ccr_form' method='post' action='../ccr/createCCR.php?portal_auth=1'>
312 <span class='text'><b><?php echo htmlspecialchars( xl('Continuity of Care Record (CCR)'), ENT_NOQUOTES); ?></b></span>&nbsp;&nbsp;
313 <br/>
314 <span class='text'>(<?php echo htmlspecialchars( xl('Pop ups need to be enabled to see these reports'), ENT_NOQUOTES); ?>)</span>
315 <br/>
316 <br/>
317 <input type='hidden' name='ccrAction'>
318 <input type='hidden' name='raw'>
319 <input type="checkbox" name="show_date" id="show_date" onchange="show_date_fun();" ><span class='text'><?php echo htmlspecialchars( xl('Use Date Range'), ENT_NOQUOTES); ?>
320 <br>
321 <div id="date_div" style="display:none" >
322 <br>
323 <table border="0" cellpadding="0" cellspacing="0" >
324 <tr>
325 <td>
326 <span class='bold'><?php echo htmlspecialchars( xl('Start Date'), ENT_NOQUOTES);?>: </span>
327 </td>
328 <td>
329 <input type='text' size='10' name='Start' id='Start'
330 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
331 title='<?php echo htmlspecialchars( xl('yyyy-mm-dd'), ENT_QUOTES); ?>' />
332 <img src='../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
333 id='img_start' border='0' alt='[?]' style='cursor:pointer'
334 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>' >
335 <script LANGUAGE="JavaScript">
336 Calendar.setup({inputField:"Start", ifFormat:"%Y-%m-%d", button:"img_start"});
337 </script>
338 </td>
339 <td>
340 &nbsp;
341 <span class='bold'><?php echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES);?>: </span>
342 </td>
343 <td>
344 <input type='text' size='10' name='End' id='End'
345 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
346 title='<?php echo htmlspecialchars( xl('yyyy-mm-dd'), ENT_QUOTES); ?>' />
347 <img src='../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
348 id='img_end' border='0' alt='[?]' style='cursor:pointer'
349 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>' >
350 <script LANGUAGE="JavaScript">
351 Calendar.setup({inputField:"End", ifFormat:"%Y-%m-%d", button:"img_end"});
352 </script>
353 </td>
354 </tr>
355 </table>
356 </div>
357 <br>
358 <input type="button" class="generateCCR" value="<?php echo htmlspecialchars( xl('View/Print'), ENT_QUOTES); ?>" />
359 <!-- <input type="button" class="generateCCR_download_h" value="<?php echo htmlspecialchars( xl('Download'), ENT_QUOTES); ?>" /> -->
360 <input type="button" class="generateCCR_download_p" value="<?php echo htmlspecialchars( xl('Download'), ENT_QUOTES); ?>" />
361 <!-- <input type="button" class="generateCCR_raw" value="<?php echo htmlspecialchars( xl('Raw Report'), ENT_QUOTES); ?>" /> -->
362 <hr/>
363 <span class='text'><b><?php echo htmlspecialchars( xl('Continuity of Care Document (CCD)'), ENT_NOQUOTES); ?></b></span>&nbsp;&nbsp;
364 <br/>
365 <span class='text'>(<?php echo htmlspecialchars( xl('Pop ups need to be enabled to see these reports'), ENT_NOQUOTES); ?>)</span>
366 <br/>
367 <br/>
368 <input type="button" class="viewCCD" value="<?php echo htmlspecialchars( xl('View/Print', ENT_QUOTES)); ?>" />
369 <!-- <input type="button" class="viewCCD_raw" value="<?php echo htmlspecialchars( xl('Raw Report', ENT_QUOTES)); ?>" /> -->
370 </form>
371 </div>
372 </div>
373 <br/>
374 </div>
375 </td>
376 </tr>
377 <?php } // end CCR/CCD reporting options ?>
379 <?php echo "<tr><td width='650px'>";
380 // Lab tests results expand collapse widget
381 $widgetTitle = xl("Lab Test Results");
382 $widgetLabel = "labtestresults";
383 $widgetButtonLabel = xl("");
384 $widgetButtonClass = "hidden";
385 $linkMethod = "html";
386 $bodyClass = "notab";
387 $widgetAuth = false;
388 $fixedWidth = true;
389 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
390 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
391 $widgetAuth, $fixedWidth);
394 <br/>
395 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div><br/>
396 </div>
397 </td>
398 </tr>
399 <?php echo "<tr><td width='650px'>";
400 // problem list collapse widget
401 $widgetTitle = xl("Problem List");
402 $widgetLabel = "problemlist";
403 $widgetButtonLabel = xl("");
404 $widgetButtonClass = "hidden";
405 $linkMethod = "html";
406 $bodyClass = "notab";
407 $widgetAuth = false;
408 $fixedWidth = true;
409 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
411 </div>
412 </td>
413 </tr>
415 <tr>
416 <td width='650px'>
417 <?php
418 // medication list expand collapse widget
419 $widgetTitle = xl("Medication List");
420 $widgetLabel = "medicationlist";
421 $widgetButtonLabel = xl("");
422 $widgetButtonClass = "hidden";
423 $linkMethod = "html";
424 $bodyClass = "notab";
425 $widgetAuth = false;
426 $fixedWidth = true;
427 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
428 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
429 $widgetAuth, $fixedWidth);
431 <br/>
432 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div><br/>
433 </div>
434 </td>
435 </tr>
437 <tr>
438 <td width='650px'>
439 <?php // medication allergy expand collapse widget
440 $widgetTitle = xl("Medication Allergy List");
441 $widgetLabel = "medicationallergylist";
442 $widgetButtonLabel = xl("");
443 $widgetButtonClass = "";
444 $linkMethod = "html";
445 $bodyClass = "notab";
446 $widgetAuth = false;
447 $fixedWidth = true;
448 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
449 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
450 $widgetAuth, $fixedWidth);
452 <br/>
453 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div><br/>
454 </div>
455 </td>
456 </tr>
457 <tr>
458 <td>
460 <?php
461 // Show current and upcoming appointments.
462 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
463 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
464 "c.pc_catname " .
465 "FROM openemr_postcalendar_events AS e, users AS u, " .
466 "openemr_postcalendar_categories AS c WHERE " .
467 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
468 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
469 "ORDER BY e.pc_eventDate, e.pc_startTime";
470 //echo $query;
471 $res = sqlStatement($query, array($pid) );
473 // appointments expand collapse widget
474 $widgetTitle = xl("Appointments");
475 $widgetLabel = "appointments";
476 $widgetButtonLabel = xl("Add");
477 $widgetButtonLink = "add_edit_event_user.php?pid=".htmlspecialchars($pid, ENT_QUOTES);
478 $widgetButtonClass = "edit_event iframe";
479 $linkMethod = "";
480 $bodyClass = "summary_item small";
481 if ($GLOBALS['portal_onsite_appt_modify']) {
482 $widgetAuth = true;
484 else {
485 $widgetAuth = false;
487 $fixedWidth = false;
489 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
491 $count = 0;
494 <div id='stats_div' style="display:none">
495 <div style='margin-left:10px' class='text'><img src='images/ajax-loader.gif'/></div>
496 </div>
498 </td>
499 </tr>
500 </table>
502 </div>
504 </td>
506 </tr>
507 </table>
509 </div> <!-- end main content div -->
511 <input type="button" style="text-align: right;" value="<? echo xl('Log Out'); ?>" onclick="window.location = 'logout.php'">
513 </wrapper>
515 </body>
516 </html>