3 // Copyright (C) 2011 by following authors:
4 // - Cassian LUP <cassi.lup@gmail.com>
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 )
22 //landing page definition -- where to go if something goes wrong
23 $landingpage = "index.php?site=".$_SESSION['site_id'];
26 // kick out if patient not authenticated
27 if ( isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite']) ) {
28 $pid = $_SESSION['pid'];
32 header('Location: '.$landingpage.'&w');
40 require_once("../interface/globals.php");
41 require_once("$srcdir/patient.inc");
42 require_once("$srcdir/acl.inc");
43 require_once("$srcdir/options.inc.php");
44 require_once("../interface/patient_file/history/history.inc.php");
45 require_once("$srcdir/edi.inc");
46 include_once("$srcdir/lists.inc");
51 <title
><?php
echo xlt('Patient Information'); ?
></title
>
52 <?php
html_header_show(); ?
>
53 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
54 <link rel
="stylesheet" type
="text/css" href
="<?php echo $web_root; ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
55 <link rel
="stylesheet" type
="text/css" href
="<?php echo $web_root; ?>/library/dynarch_calendar.css">
56 <script type
="text/javascript" src
="<?php echo $web_root; ?>/library/textformat.js"></script
>
57 <script type
="text/javascript" src
="<?php echo $web_root; ?>/library/dynarch_calendar.js"></script
>
58 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
59 <script type
="text/javascript" src
="<?php echo $web_root; ?>/library/dynarch_calendar_setup.js"></script
>
60 <script type
="text/javascript" src
="<?php echo $web_root; ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
61 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script
>
62 <script type
="text/javascript" src
="<?php echo $web_root; ?>/library/js/common.js"></script
>
63 <script type
="text/javascript" src
="<?php echo $web_root; ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
64 <link rel
="stylesheet" href
="css/base.css" type
="text/css"/>
65 <link rel
="stylesheet" href
="css/tables.css" type
="text/css"/>
66 <script type
="text/javascript" language
="JavaScript">
68 function refreshme() {
72 function toggleIndicator(target
,div
) {
74 $mode = $
(target
).find(".indicator").text();
75 if ( $mode == "<?php echo xla('collapse'); ?>" ) {
76 $
(target
).find(".indicator").text( "<?php echo xla('expand'); ?>" );
79 $
(target
).find(".indicator").text( "<?php echo xla('collapse'); ?>" );
84 function refreshAppointments() {
85 $
("#appointments_ps_expand").load("get_appointments.php", { 'embeddedScreen' : true }, function() {
86 $
(".edit_event").fancybox({
87 'overlayOpacity' : 0.0,
88 'showCloseButton' : true,
89 'centerOnScroll' : false,
91 'hihdeOnContentClick' : false,
92 'callbackOnClose' : function() {
93 refreshAppointments();
99 function show_date_fun(){
100 if(document
.getElementById('show_date').checked
== true){
101 document
.getElementById('date_div').style
.display
= '';
103 document
.getElementById('date_div').style
.display
= 'none';
108 $
(document
).ready(function(){
111 $
("#labtestresults_ps_expand").load("get_lab_results.php", { 'embeddedScreen' : true }, function() {
112 // (note need to place javascript code here also to get the dynamic link to work)
113 $
(".medium_modal").fancybox( {
114 'overlayOpacity' : 0.0,
115 'showCloseButton' : true,
118 'centerOnScroll' : false,
119 'callbackOnClose' : function() {
124 $
("#problemlist_ps_expand").load("get_problems.php", { 'embeddedScreen' : true }, function() {
125 // (note need to place javascript code here also to get the dynamic link to work)
126 $
(".medium_modal").fancybox( {
127 'overlayOpacity' : 0.0,
128 'showCloseButton' : true,
131 'centerOnScroll' : false,
132 'callbackOnClose' : function() {
137 $
("#medicationlist_ps_expand").load("get_medications.php", { 'embeddedScreen' : true }, function() {
138 // (note need to place javascript code here also to get the dynamic link to work)
139 $
(".medium_modal").fancybox( {
140 'overlayOpacity' : 0.0,
141 'showCloseButton' : true,
144 'centerOnScroll' : false,
145 'callbackOnClose' : function() {
150 $
("#medicationallergylist_ps_expand").load("get_allergies.php", { 'embeddedScreen' : true }, function() {
151 // (note need to place javascript code here also to get the dynamic link to work)
152 $
(".medium_modal").fancybox( {
153 'overlayOpacity' : 0.0,
154 'showCloseButton' : true,
157 'centerOnScroll' : false,
158 'callbackOnClose' : function() {
163 $
("#amendments_ps_expand").load("get_amendments.php", { 'embeddedScreen' : true }, function() {
164 // (note need to place javascript code here also to get the dynamic link to work)
165 $
(".medium_modal").fancybox( {
166 'overlayOpacity' : 0.0,
167 'showCloseButton' : true,
170 'centerOnScroll' : false,
171 'callbackOnClose' : function() {
178 refreshAppointments();
183 // modal for dialog boxes
184 $
(".large_modal").fancybox( {
185 'overlayOpacity' : 0.0,
186 'showCloseButton' : true,
189 'centerOnScroll' : false
192 // modal for image viewer
193 $
(".image_modal").fancybox( {
194 'overlayOpacity' : 0.0,
195 'showCloseButton' : true,
196 'centerOnScroll' : false,
200 $
(".add_event").fancybox( {
201 'overlayOpacity' : 0.0,
202 'showCloseButton' : true,
203 'centerOnScroll' : false,
205 'hideOnContentClick' : false,
206 'onClose' : function() {
211 $
(".generateCCR").click(
213 if(document
.getElementById('show_date').checked
== true){
214 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
215 alert('<?php echo xls('Please select a start date
and end date
') ?>');
219 var ccrAction
= document
.getElementsByName('ccrAction');
220 ccrAction
[0].value
= 'generate';
221 var raw
= document
.getElementsByName('raw');
223 ccr_form
.setAttribute("target", "_blank");
224 $
("#ccr_form").submit();
225 ccr_form
.setAttribute("target", "");
227 $
(".generateCCR_raw").click(
229 var ccrAction
= document
.getElementsByName('ccrAction');
230 ccrAction
[0].value
= 'generate';
231 var raw
= document
.getElementsByName('raw');
232 raw
[0].value
= 'yes';
233 ccr_form
.setAttribute("target", "_blank");
234 $
("#ccr_form").submit();
235 ccr_form
.setAttribute("target", "");
237 $
(".generateCCR_download_h").click(
239 var ccrAction
= document
.getElementsByName('ccrAction');
240 ccrAction
[0].value
= 'generate';
241 var raw
= document
.getElementsByName('raw');
242 raw
[0].value
= 'hybrid';
243 $
("#ccr_form").submit();
245 $
(".generateCCR_download_p").click(
247 if(document
.getElementById('show_date').checked
== true){
248 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
249 alert('<?php echo xls('Please select a start date
and end date
') ?>');
253 var ccrAction
= document
.getElementsByName('ccrAction');
254 ccrAction
[0].value
= 'generate';
255 var raw
= document
.getElementsByName('raw');
256 raw
[0].value
= 'pure';
257 $
("#ccr_form").submit();
261 var ccrAction
= document
.getElementsByName('ccrAction');
262 ccrAction
[0].value
= 'viewccd';
263 var raw
= document
.getElementsByName('raw');
265 ccr_form
.setAttribute("target", "_blank");
266 $
("#ccr_form").submit();
267 ccr_form
.setAttribute("target", "");
269 $
(".viewCCD_raw").click(
271 var ccrAction
= document
.getElementsByName('ccrAction');
272 ccrAction
[0].value
= 'viewccd';
273 var raw
= document
.getElementsByName('raw');
274 raw
[0].value
= 'yes';
275 ccr_form
.setAttribute("target", "_blank");
276 $
("#ccr_form").submit();
277 ccr_form
.setAttribute("target", "");
279 $
(".viewCCD_download").click(
281 var ccrAction
= document
.getElementsByName('ccrAction');
282 ccrAction
[0].value
= 'viewccd';
283 var raw
= document
.getElementsByName('raw');
284 raw
[0].value
= 'pure';
285 $
("#ccr_form").submit();
287 $
(".generateDoc_download").click(
289 $
("#doc_form").submit();
291 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
292 $
(".viewCCR_send_dialog").click(
294 $
("#ccr_send_dialog").toggle();
296 $
(".viewCCR_transmit").click(
298 $
(".viewCCR_transmit").attr('disabled','disabled');
299 var ccrAction
= document
.getElementsByName('ccrAction');
300 ccrAction
[0].value
= 'generate';
301 var ccrRecipient
= $
("#ccr_send_to").val();
302 var raw
= document
.getElementsByName('raw');
303 raw
[0].value
= 'send '+ccrRecipient
;
304 if(ccrRecipient
=="") {
305 $
("#ccr_send_message").html("<?php
306 echo xla('Please enter a valid Direct Address above.');?>");
307 $
("#ccr_send_result").show();
309 $
(".viewCCR_transmit").attr('disabled','disabled');
310 $
("#ccr_send_message").html("<?php
311 echo xla('Working... this may take a minute.');?>");
312 $
("#ccr_send_result").show();
313 var action
=$
("#ccr_form").attr('action');
314 $
.post(action
, {ccrAction
:'generate',raw
:'send '+ccrRecipient
,requested_by
:'patient'},
316 if(data
=="SUCCESS") {
317 $
("#ccr_send_message").html("<?php
318 echo xla('Your message was submitted for delivery to');
320 $
("#ccr_send_to").val("");
322 $
("#ccr_send_message").html(data
);
324 $
(".viewCCR_transmit").removeAttr('disabled');
329 if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
330 $
(".viewCCD_send_dialog").click(
332 $
("#ccd_send_dialog").toggle();
334 $
(".viewCCD_transmit").click(
336 $
(".viewCCD_transmit").attr('disabled','disabled');
337 var ccrAction
= document
.getElementsByName('ccrAction');
338 ccrAction
[0].value
= 'viewccd';
339 var ccdRecipient
= $
("#ccd_send_to").val();
340 var raw
= document
.getElementsByName('raw');
341 raw
[0].value
= 'send '+ccdRecipient
;
342 if(ccdRecipient
=="") {
343 $
("#ccd_send_message").html("<?php
344 echo xla('Please enter a valid Direct Address above.');?>");
345 $
("#ccd_send_result").show();
347 $
(".viewCCD_transmit").attr('disabled','disabled');
348 $
("#ccd_send_message").html("<?php
349 echo xla('Working... this may take a minute.');?>");
350 $
("#ccd_send_result").show();
351 var action
=$
("#ccr_form").attr('action');
352 $
.post(action
, {ccrAction
:'viewccd',raw
:'send '+ccdRecipient
,requested_by
:'patient'},
354 if(data
=="SUCCESS") {
355 $
("#ccd_send_message").html("<?php
356 echo xla('Your message was submitted for delivery to');
358 $
("#ccd_send_to").val("");
360 $
("#ccd_send_message").html(data
);
362 $
(".viewCCD_transmit").removeAttr('disabled');
374 <body
class="body_top">
376 <div id
="wrapper" class="lefttop" style
="width: 700px;">
377 <h2
class="heading"><?php
echo xlt("Patient Portal"); ?
></h2
>
380 $result = getPatientData($pid);
382 <?php
echo xlt('Welcome'); ?
> <b
><?php
echo text($result['fname']." ".$result['lname']); ?
></b
>
384 <div style
='margin-top:10px'> <!-- start main content div
-->
385 <table border
="0" cellspacing
="0" cellpadding
="0" width
="100%">
387 <td align
="left" valign
="top">
388 <!-- start left column div
-->
389 <div style
='float:left; margin-right:20px'>
390 <table cellspacing
=0 cellpadding
=0>
391 <?php
if ( $GLOBALS['activate_ccr_ccd_report'] ) { // show CCR/CCD reporting options ?>
396 $widgetTitle = xl("Reports");
397 $widgetLabel = "reports";
398 $widgetButtonLabel = xl("");
399 $widgetButtonClass = "hidden";
400 $linkMethod = "html";
401 $bodyClass = "notab";
404 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
405 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
406 $widgetAuth, $fixedWidth);
409 <div style
='margin-left:3em; margin-right:3em; padding:1em; border:1px solid blue;' class='text'>
410 <div id
="ccr_report">
411 <form name
='ccr_form' id
='ccr_form' method
='post' action
='../ccr/createCCR.php?portal_auth=1'>
412 <span
class='text'><b
><?php
echo xlt('Continuity of Care Record (CCR)'); ?
></b
></span
> 
; 
;
414 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
417 <input type
='hidden' name
='ccrAction'>
418 <input type
='hidden' name
='raw'>
419 <input type
="checkbox" name
="show_date" id
="show_date" onchange
="show_date_fun();" ><span
class='text'><?php
echo xlt('Use Date Range'); ?
>
421 <div id
="date_div" style
="display:none" >
423 <table border
="0" cellpadding
="0" cellspacing
="0" >
426 <span
class='bold'><?php
echo xlt('Start Date');?
>: </span
>
429 <input type
='text' size
='10' name
='Start' id
='Start'
430 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
431 title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
432 <img src
='../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
433 id
='img_start' border
='0' alt
='[?]' style
='cursor:pointer'
434 title
='<?php echo xla('Click here to choose a date
'); ?>' >
435 <script LANGUAGE
="JavaScript">
436 Calendar
.setup({inputField
:"Start", ifFormat
:"%Y-%m-%d", button
:"img_start"});
441 <span
class='bold'><?php
echo xlt('End Date');?
>: </span
>
444 <input type
='text' size
='10' name
='End' id
='End'
445 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
446 title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
447 <img src
='../interface/pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
448 id
='img_end' border
='0' alt
='[?]' style
='cursor:pointer'
449 title
='<?php echo xla('Click here to choose a date
'); ?>' >
450 <script LANGUAGE
="JavaScript">
451 Calendar
.setup({inputField
:"End", ifFormat
:"%Y-%m-%d", button
:"img_end"});
458 <input type
="button" class="generateCCR" value
="<?php echo xla('View/Print'); ?>" />
459 <!-- <input type
="button" class="generateCCR_download_h" value
="<?php echo xla('Download'); ?>" /> -->
460 <input type
="button" class="generateCCR_download_p" value
="<?php echo xla('Download'); ?>" />
461 <!-- <input type
="button" class="generateCCR_raw" value
="<?php echo xla('Raw Report'); ?>" /> -->
462 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
463 <input type
="button" class="viewCCR_send_dialog" value
="<?php echo xla('Transmit'); ?>" />
465 <div id
="ccr_send_dialog" style
="display:none" >
467 <table border
="0" cellpadding
="0" cellspacing
="0" >
470 <span
class='bold'><?php
echo xlt('Enter Recipient\'s Direct Address');?
>: </span
>
471 <input type
="text" size
="64" name
="ccr_send_to" id
="ccr_send_to" value
="">
472 <input type
="button" class="viewCCR_transmit" value
="<?php echo xla('Send'); ?>" />
473 <div id
="ccr_send_result" style
="display:none" >
474 <span
class="text" id
="ccr_send_message"></span
>
482 <span
class='text'><b
><?php
echo xlt('Continuity of Care Document (CCD)'); ?
></b
></span
> 
; 
;
484 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
487 <input type
="button" class="viewCCD" value
="<?php echo xla('View/Print'); ?>" />
488 <input type
="button" class="viewCCD_download" value
="<?php echo xla('Download'); ?>" />
489 <!-- <input type
="button" class="viewCCD_raw" value
="<?php echo xla('Raw Report'); ?>" /> -->
490 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
491 <input type
="button" class="viewCCD_send_dialog" value
="<?php echo xla('Transmit'); ?>" />
493 <div id
="ccd_send_dialog" style
="display:none" >
495 <table border
="0" cellpadding
="0" cellspacing
="0" >
498 <span
class='bold'><?php
echo xlt('Enter Recipient\'s Direct Address');?
>: </span
>
499 <input type
="text" size
="64" name
="ccd_send_to" id
="ccd_send_to" value
="">
500 <input type
="button" class="viewCCD_transmit" value
="<?php echo xla('Send'); ?>" />
501 <div id
="ccd_send_result" style
="display:none" >
502 <span
class="text" id
="ccd_send_message"></span
>
517 <?php
} // end CCR/CCD reporting options ?>
518 <?php
if ( $GLOBALS['portal_onsite_document_download'] ) { ?
>
519 <?php
echo "<tr><td width='650px'>";
520 $widgetTitle = xl('Documents');
521 $widgetLabel = "documents";
522 $widgetButtonLabel = xl('Download');
523 $widgetButtonClass = "hidden";
524 $linkMethod = "html";
525 $bodyClass = "notab";
528 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
529 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
530 $widgetAuth, $fixedWidth);
532 <span
class="text"><?php
echo xlt('Download all patient documents');?
></span
>
534 <form name
='doc_form' id
='doc_form' action
='get_patient_documents.php' method
='post'>
535 <input type
="button" class="generateDoc_download" value
="<?php echo xla('Download'); ?>" />
541 <?php
echo "<tr><td width='650px'>";
542 // Lab tests results expand collapse widget
543 $widgetTitle = xl("Lab Test Results");
544 $widgetLabel = "labtestresults";
545 $widgetButtonLabel = xl("");
546 $widgetButtonClass = "hidden";
547 $linkMethod = "html";
548 $bodyClass = "notab";
551 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
552 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
553 $widgetAuth, $fixedWidth);
557 <div style
='margin-left:10px' class='text'><img src
='images/ajax-loader.gif'/></div
><br
/>
562 <?php
echo "<tr><td width='650px'>";
563 // problem list collapse widget
564 $widgetTitle = xl("Problem List");
565 $widgetLabel = "problemlist";
566 $widgetButtonLabel = xl("");
567 $widgetButtonClass = "hidden";
568 $linkMethod = "html";
569 $bodyClass = "notab";
572 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?
>
583 // medication list expand collapse widget
584 $widgetTitle = xl("Medication List");
585 $widgetLabel = "medicationlist";
586 $widgetButtonLabel = xl("");
587 $widgetButtonClass = "hidden";
588 $linkMethod = "html";
589 $bodyClass = "notab";
592 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
593 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
594 $widgetAuth, $fixedWidth);
597 <div style
='margin-left:10px' class='text'><img src
='images/ajax-loader.gif'/></div
><br
/>
605 <?php
// medication allergy expand collapse widget
606 $widgetTitle = xl("Medication Allergy List");
607 $widgetLabel = "medicationallergylist";
608 $widgetButtonLabel = xl("");
609 $widgetButtonClass = "";
610 $linkMethod = "html";
611 $bodyClass = "notab";
614 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
615 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
616 $widgetAuth, $fixedWidth);
619 <div style
='margin-left:10px' class='text'><img src
='images/ajax-loader.gif'/></div
><br
/>
626 <?php
if ( $GLOBALS['amendments'] ) { ?
>
630 $widgetTitle = xl("Amendments");
631 $widgetLabel = "amendments";
632 $widgetButtonLabel = xl("");
633 $widgetButtonClass = "hidden";
634 $linkMethod = "html";
635 $bodyClass = "notab";
638 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
639 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
640 $widgetAuth, $fixedWidth);
644 <div style
='margin-left:10px' class='text'><img src
='images/ajax-loader.gif'/></div
><br
/>
651 // Show current and upcoming appointments.
652 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
653 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
655 "FROM openemr_postcalendar_events AS e, users AS u, " .
656 "openemr_postcalendar_categories AS c WHERE " .
657 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
658 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
659 "ORDER BY e.pc_eventDate, e.pc_startTime";
661 $res = sqlStatement($query, array($pid) );
663 // appointments expand collapse widget
664 $widgetTitle = xl("Appointments");
665 $widgetLabel = "appointments";
666 $widgetButtonLabel = xl("Add");
667 $widgetButtonLink = "add_edit_event_user.php?pid=".htmlspecialchars($pid, ENT_QUOTES
);
668 $widgetButtonClass = "edit_event iframe";
670 $bodyClass = "summary_item small";
671 if ($GLOBALS['portal_onsite_appt_modify'])
680 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
683 <div id
='stats_div' style
="display:none">
684 <div style
='margin-left:10px' class='text'><img src
='images/ajax-loader.gif'/></div
>
698 </div
> <!-- end main content div
-->
700 <div id
="portal-buttons-bottom"> <!-- buttons bottom div
-->
701 <input type
="button" style
="text-align: right;" value
="<?php echo xla('Log Out'); ?>" onclick
="window.location = 'logout.php'"/>
703 <input type
="button" style
="text-align: right;" value
="<?php echo xla('Change Password'); ?>" onclick
="window.location = '<?php echo $landingpage."&password_update
=1";?>'"/>
704 </div
><!-- end buttons bottom div
-->