2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
8 $sanitize_all_escapes=true;
11 //STOP FAKE REGISTER GLOBALS
12 $fake_register_globals=false;
15 require_once("../../globals.php");
16 require_once("$srcdir/patient.inc");
17 require_once("$srcdir/acl.inc");
18 require_once("$srcdir/classes/Address.class.php");
19 require_once("$srcdir/classes/InsuranceCompany.class.php");
20 require_once("$srcdir/classes/Document.class.php");
21 require_once("$srcdir/options.inc.php");
22 require_once("../history/history.inc.php");
23 require_once("$srcdir/formatting.inc.php");
24 require_once("$srcdir/edi.inc");
26 if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) {
27 include_once("$srcdir/pid.inc");
28 setpid($_GET['set_pid']);
31 function print_as_money($money) {
32 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
33 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
34 $ccheck = strrev($tmp);
35 if ($ccheck[0] == ",") {
36 $tmp = substr($ccheck,1,strlen($ccheck)-1);
38 if ($moneymatches[2] != "") {
39 return "$ " . strrev($tmp) . "." . $moneymatches[2];
41 return "$ " . strrev($tmp);
45 // get an array from Photos category
46 function pic_array($pid,$picture_directory) {
48 $sql_query = "select documents.id from documents join categories_to_documents " .
49 "on documents.id = categories_to_documents.document_id " .
50 "join categories on categories.id = categories_to_documents.category_id " .
51 "where categories.name like ? and documents.foreign_id = ?";
52 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
53 while( $results = sqlFetchArray($query) ) {
54 array_push($pics,$results['id']);
59 // Get the document ID of the first document in a specific catg.
60 function get_document_by_catg($pid,$doc_catg) {
64 if ($pid and $doc_catg) {
65 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
66 "documents AS d, categories_to_documents AS cd, categories AS c " .
67 "WHERE d.foreign_id = ? " .
68 "AND cd.document_id = d.id " .
69 "AND c.id = cd.category_id " .
70 "AND c.name LIKE ? " .
71 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg) );
74 return($result['id']);
77 // Display image in 'widget style'
78 function image_widget($doc_id,$doc_catg)
80 global $pid, $web_root;
81 $docobj = new Document($doc_id);
82 $image_file = $docobj->get_url_file();
83 $extension = substr($image_file, strrpos($image_file,"."));
84 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp'); // image ext supported by fancybox viewer
85 if ( in_array($extension,$viewable_types) ) { // extention matches list
86 $to_url = "<td> <a href = $web_root" .
87 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
88 "/tmp$extension" . // Force image type URL for fancybox
89 " onclick=top.restoreSession(); class='image_modal'>" .
90 " <img src = $web_root" .
91 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
92 " width=100 alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
93 htmlspecialchars($doc_catg) . '<br /> ' . htmlspecialchars($image_file) .
97 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
98 "&patient_id=$pid&document_id=$doc_id'" .
99 " onclick='top.restoreSession()' class='css_button_small'>" .
101 htmlspecialchars( xl("View"), ENT_QUOTES
)."</a> " .
102 htmlspecialchars( "$doc_catg - $image_file", ENT_QUOTES
) .
107 echo "</tr></table>";
110 // Determine if the Vitals form is in use for this site.
111 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
112 "directory = 'vitals' AND state = 1");
113 $vitals_is_registered = $tmp['count'];
118 <?php
html_header_show();?
>
119 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
120 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
121 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
122 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
123 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
124 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
125 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
126 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
127 <script type
="text/javascript" src
="../../../library/js/jquery.1.3.2.js"></script
>
128 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
129 <script type
="text/javascript" src
="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
130 <script type
="text/javascript" language
="JavaScript">
131 //Visolve - sync the radio buttons - Start
132 if((top
.window
.parent
) && (parent
.window
)){
133 var wname
= top
.window
.parent
.left_nav
;
135 wname
.setRadio(parent
.window
.name
, "dem");
137 //Visolve - sync the radio buttons - End
139 var mypcc
= '<?php echo htmlspecialchars($GLOBALS['phone_country_code
'],ENT_QUOTES); ?>';
141 function oldEvt(eventid
) {
142 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid
, '_blank', 550, 270);
145 function advdirconfigure() {
146 dlgopen('advancedirectives.php', '_blank', 500, 450);
149 function refreshme() {
150 top
.restoreSession();
154 // Process click on Delete link.
155 function deleteme() {
156 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
160 // Called by the deleteme.php window on a successful delete.
161 function imdeleted() {
162 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
163 parent
.left_nav
.clearPatient();
165 top
.restoreSession();
166 top
.location
.href
= '../main/main_screen.php';
170 function validate() {
171 var f
= document
.forms
[0];
173 if ($GLOBALS['athletic_team']) {
174 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
175 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
176 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
179 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo htmlspecialchars($irow['title
'],ENT_QUOTES); ?>"?')) {
180 f
.form_issue_id
.value
= '<?php echo htmlspecialchars($irow['id
'],ENT_QUOTES); ?>';
182 alert('OK, you will need to manually update the return date in any affected issue(s).');
185 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
189 } // end athletic team
195 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 550, 270);
199 function sendimage(pid
, what
) {
200 // alert('Not yet implemented.'); return false;
201 dlgopen('../upload_dialog.php?patientid=' + pid +
'&file=' + what
,
208 <script type
="text/javascript">
210 function toggleIndicator(target
,div
) {
212 $mode = $
(target
).find(".indicator").text();
213 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
214 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
216 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 0 });
218 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
220 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 1 });
224 $
(document
).ready(function(){
227 $
("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
228 // (note need to place javascript code here also to get the dynamic link to work)
229 $
(".rx_modal").fancybox( {
230 'overlayOpacity' : 0.0,
231 'showCloseButton' : true,
234 'centerOnScroll' : false,
235 'callbackOnClose' : function() {
240 $
("#pnotes_ps_expand").load("pnotes_fragment.php");
241 $
("#disclosures_ps_expand").load("disc_fragment.php");
243 <?php
if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?
>
244 $
("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
245 // (note need to place javascript code here also to get the dynamic link to work)
246 $
(".medium_modal").fancybox( {
247 'overlayOpacity' : 0.0,
248 'showCloseButton' : true,
251 'centerOnScroll' : false,
252 'callbackOnClose' : function() {
259 <?php
if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?
>
260 $
("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
263 <?php
if ($vitals_is_registered) { ?
>
264 // Initialize the Vitals form if it is registered.
265 $
("#vitals_ps_expand").load("vitals_fragment.php");
269 // Initialize for each applicable LBF form.
270 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
271 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
272 while($gfrow = sqlFetchArray($gfres)) {
274 $
("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
284 // modal for dialog boxes
285 $
(".large_modal").fancybox( {
286 'overlayOpacity' : 0.0,
287 'showCloseButton' : true,
290 'centerOnScroll' : false
293 // modal for image viewer
294 $
(".image_modal").fancybox( {
295 'overlayOpacity' : 0.0,
296 'showCloseButton' : true,
297 'centerOnScroll' : false,
305 <style type
="css/text">
314 <body
class="body_top">
317 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
318 $result2 = getEmployerData($pid);
319 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
322 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
323 $insco_name = getInsuranceProvider($result3['provider']);
326 $thisauth = acl_check('patients', 'demo');
328 if ($result['squad'] && ! acl_check('squads', $result['squad']))
333 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES
) . ")</p>\n";
334 echo "</body>\n</html>\n";
338 if ($thisauth == 'write') {
339 echo "<table><tr><td><span class='title'>" .
340 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES
) .
343 if (acl_check('admin', 'super')) {
344 echo "<td style='padding-left:1em;'><a class='css_button iframe' href='../deleter.php?patient=" .
345 htmlspecialchars($pid,ENT_QUOTES
) . "'>" .
346 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES
).
349 echo "</tr></table>";
352 // Get the document ID of the patient ID card if access to it is wanted here.
353 $idcard_doc_id = false;
354 if ($GLOBALS['patient_id_category_name']) {
355 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
359 <table cellspacing
='0' cellpadding
='0' border
='0'>
361 <td
class="small" colspan
='4'>
362 <a href
="../history/history.php" onclick
='top.restoreSession()'>
363 <?php
echo htmlspecialchars(xl('History'),ENT_NOQUOTES
); ?
></a
>
365 <?php
//note that we have temporarily removed report screen from the modal view ?>
366 <a href
="../report/patient_report.php" onclick
='top.restoreSession()'>
367 <?php
echo htmlspecialchars(xl('Report'),ENT_NOQUOTES
); ?
></a
>
369 <?php
//note that we have temporarily removed document screen from the modal view ?>
370 <a href
="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick
='top.restoreSession()'>
371 <?php
echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES
); ?
></a
>
373 <a href
="../transaction/transactions.php" class='iframe large_modal' onclick
='top.restoreSession()'>
374 <?php
echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES
); ?
></a
>
377 </table
> <!-- end header
-->
379 <div style
='margin-top:10px'> <!-- start main content div
-->
380 <table border
="0" cellspacing
="0" cellpadding
="0" width
="100%">
382 <td align
="left" valign
="top">
383 <!-- start left column div
-->
384 <div style
='float:left; margin-right:20px'>
385 <table cellspacing
=0 cellpadding
=0>
389 // Billing expand collapse widget
390 $widgetTitle = xl("Billing");
391 $widgetLabel = "billing";
392 $widgetButtonLabel = xl("Edit");
393 $widgetButtonLink = "return newEvt();";
394 $widgetButtonClass = "";
395 $linkMethod = "javascript";
396 $bodyClass = "notab";
399 if ($GLOBALS['force_billing_widget_open']) {
400 $forceExpandAlways = true;
403 $forceExpandAlways = false;
405 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
406 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
407 $widgetAuth, $fixedWidth, $forceExpandAlways);
411 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
412 // Show current balance and billing note, if any.
413 echo " <div style='margin-left: 10px; margin-right: 10px'>" .
414 "<span class='bold'><font color='#ee6600'>" .
415 htmlspecialchars(xl('Balance Due'),ENT_NOQUOTES
) .
416 ": " . htmlspecialchars(oeFormatMoney(get_patient_balance($pid)),ENT_NOQUOTES
) .
417 "</font></span><br>";
418 if ($result['genericname2'] == 'Billing') {
419 echo "<span class='bold'><font color='red'>" .
420 htmlspecialchars(xl('Billing Note'),ENT_NOQUOTES
) . ":" .
421 htmlspecialchars($result['genericval2'],ENT_NOQUOTES
) .
422 "</font></span><br>";
424 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
425 echo "<span class='bold'>" .
426 htmlspecialchars(xl('Primary Insurance'),ENT_NOQUOTES
) . ': ' . htmlspecialchars($insco_name,ENT_NOQUOTES
) .
427 "</span> ";
428 if ($result3['copay'] > 0) {
429 echo "<span class='bold'>" .
430 htmlspecialchars(xl('Copay'),ENT_NOQUOTES
) . ': ' . htmlspecialchars($result3['copay'],ENT_NOQUOTES
) .
431 "</span> ";
433 echo "<span class='bold'>" .
434 htmlspecialchars(xl('Effective Date'),ENT_NOQUOTES
) . ': ' . htmlspecialchars(oeFormatShortDate($result3['effdate'],ENT_NOQUOTES
)) .
440 </div
> <!-- required
for expand_collapse_widget
-->
446 // Demographics expand collapse widget
447 $widgetTitle = xl("Demographics");
448 $widgetLabel = "demographics";
449 $widgetButtonLabel = xl("Edit");
450 $widgetButtonLink = "demographics_full.php";
451 $widgetButtonClass = "";
452 $linkMethod = "html";
454 $widgetAuth = ($thisauth == "write");
456 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
457 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
458 $widgetAuth, $fixedWidth);
462 <?php
display_layout_tabs('DEM', $result, $result2); ?
>
464 <div
class="tabContainer">
465 <?php
display_layout_tabs_data('DEM', $result, $result2); ?
>
468 </div
> <!-- required
for expand_collapse_widget
-->
475 $insurance_count = 0;
476 foreach (array('primary','secondary','tertiary') as $instype) {
477 $enddate = 'Present';
478 $query = "SELECT * FROM insurance_data WHERE " .
479 "pid = ? AND type = ? " .
480 "ORDER BY date DESC";
481 $res = sqlStatement($query, array($pid, $instype) );
482 while( $row = sqlFetchArray($res) ) {
483 if ($row['provider'] ) $insurance_count++
;
487 if ( $insurance_count > 0 ) {
488 // Insurance expand collapse widget
489 $widgetTitle = xl("Insurance");
490 $widgetLabel = "insurance";
491 $widgetButtonLabel = xl("Edit");
492 $widgetButtonLink = "demographics_full.php";
493 $widgetButtonClass = "";
494 $linkMethod = "html";
496 $widgetAuth = ($thisauth == "write");
498 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
499 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
500 $widgetAuth, $fixedWidth);
502 if ( $insurance_count > 0 ) {
505 <ul
class="tabNav"><?php
506 ///////////////////////////////// INSURANCE SECTION
508 foreach (array('primary','secondary','tertiary') as $instype) {
510 $query = "SELECT * FROM insurance_data WHERE " .
511 "pid = ? AND type = ? " .
512 "ORDER BY date DESC";
513 $res = sqlStatement($query, array($pid, $instype) );
515 $enddate = 'Present';
517 while( $row = sqlFetchArray($res) ) {
518 if ($row['provider'] ) {
520 $ins_description = ucfirst($instype);
521 $ins_description = xl($ins_description);
522 $ins_description .= strcmp($enddate, 'Present') != 0 ?
" (".xl('Old').")" : "";
524 <li
<?php
echo $first ?
'class="current"' : '' ?
>><a href
="/play/javascript-tabbed-navigation/">
525 <?php
echo htmlspecialchars($ins_description,ENT_NOQUOTES
); ?
></a
></li
>
529 $enddate = $row['date'];
532 // Display the eligibility tab
533 echo "<li><a href='/play/javascript-tabbed-navigation/'>" .
534 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES
) . "</a></li>";
540 <div
class="tabContainer">
543 foreach (array('primary','secondary','tertiary') as $instype) {
544 $enddate = 'Present';
546 $query = "SELECT * FROM insurance_data WHERE " .
547 "pid = ? AND type = ? " .
548 "ORDER BY date DESC";
549 $res = sqlStatement($query, array($pid, $instype) );
550 while( $row = sqlFetchArray($res) ) {
551 if ($row['provider'] ) {
553 <div
class="tab <?php echo $first ? 'current' : '' ?>">
554 <table border
='0' cellpadding
='0' width
='100%'>
556 $icobj = new InsuranceCompany($row['provider']);
557 $adobj = $icobj->get_address();
558 $insco_name = trim($icobj->get_name());
561 <td valign
='top' colspan
='3'>
563 <?php
if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES
)." "; ?
>
564 <?php
$tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES
); ?
>
565 <?php
if (strcmp($row['date'], '0000-00-00') != 0) { ?
>
566 <?php
echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES
); ?
>
568 <?php
echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES
);
569 echo (strcmp($enddate, 'Present') != 0) ?
$enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES
); ?
>:</span
>
577 echo htmlspecialchars($insco_name,ENT_NOQUOTES
) . '<br>';
578 if (trim($adobj->get_line1())) {
579 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES
) . '<br>';
580 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES
);
583 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES
)."</b></font>";
587 <?php
echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES
); ?
>:
588 <?php
echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES
) ?
><br
>
589 <?php
echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES
); ?
>:
590 <?php
echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES
); ?
><br
>
591 <?php
echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES
); ?
>:
592 <?php
echo htmlspecialchars($row['group_number'],ENT_NOQUOTES
); ?
></span
>
595 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES
); ?
>: </span
><br
>
596 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES
); ?
>
598 if ($row['subscriber_relationship'] != "") {
599 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES
) . ")";
603 <?php
echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES
); ?
>:
604 <?php
echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES
); ?
><br
>
605 <?php
echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES
); ?
>:
606 <?php
if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES
); ?
><br
>
607 <?php
echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES
); ?
>:
608 <?php
echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES
); ?
>
612 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES
); ?
>: </span
><br
>
613 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES
); ?
><br
>
614 <?php
echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES
); ?
>
615 <?php
if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES
); ?
>
616 <?php
if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES
); ?
>
617 <?php
echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES
); ?
></span
>
619 <?php
if (trim($row['subscriber_employer'])) { ?
>
620 <br
><span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES
); ?
>: </span
><br
>
621 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES
); ?
><br
>
622 <?php
echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES
); ?
><br
>
623 <?php
echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES
); ?
>
624 <?php
if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES
); ?
>
625 <?php
if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES
); ?
>
626 <?php
echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES
); ?
>
634 <?php
if ($row['copay'] != "") { ?
>
635 <span
class='bold'><?php
echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES
); ?
>: </span
>
636 <span
class='text'><?php
echo htmlspecialchars($row['copay'],ENT_NOQUOTES
); ?
></span
>
639 <span
class='bold'><?php
echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES
); ?
>:</span
>
640 <span
class='text'><?php
if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?
>
641 <?php
if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?
></span
>
643 <td valign
='top'></td
>
644 <td valign
='top'></td
>
651 } // end if ($row['provider'])
652 $enddate = $row['date'];
657 // Display the eligibility information
658 echo "<div class='tab'>";
659 show_eligibility_information($pid,true);
662 ///////////////////////////////// END INSURANCE SECTION
675 // Notes expand collapse widget
676 $widgetTitle = xl("Notes");
677 $widgetLabel = "pnotes";
678 $widgetButtonLabel = xl("Edit");
679 $widgetButtonLink = "pnotes_full.php";
680 $widgetButtonClass = "";
681 $linkMethod = "html";
682 $bodyClass = "notab";
685 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
686 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
687 $widgetAuth, $fixedWidth);
691 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
695 <?php
if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) ) {
696 echo "<tr><td width='650px'>";
697 // patient reminders collapse widget
698 $widgetTitle = xl("Patient Reminders");
699 $widgetLabel = "patient_reminders";
700 $widgetButtonLabel = xl("Edit");
701 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
702 $widgetButtonClass = "";
703 $linkMethod = "html";
704 $bodyClass = "notab";
707 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?
>
709 <div style
='margin-left:10px' class='text'><image src
='../../pic/ajax-loader.gif'/></div
><br
/>
713 <?php
} //end if prw is activated ?>
718 // disclosures expand collapse widget
719 $widgetTitle = xl("Disclosures");
720 $widgetLabel = "disclosures";
721 $widgetButtonLabel = xl("Edit");
722 $widgetButtonLink = "disclosure_full.php";
723 $widgetButtonClass = "";
724 $linkMethod = "html";
725 $bodyClass = "notab";
728 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
729 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
730 $widgetAuth, $fixedWidth);
733 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
738 <?php
if ($vitals_is_registered) { ?
>
741 <?php
// vitals expand collapse widget
742 $widgetTitle = xl("Vitals");
743 $widgetLabel = "vitals";
744 $widgetButtonLabel = xl("Trend");
745 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
746 $widgetButtonClass = "";
747 $linkMethod = "html";
748 $bodyClass = "notab";
749 // check to see if any vitals exist
750 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
758 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
759 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
760 $widgetAuth, $fixedWidth);
763 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
767 <?php
} // end if ($vitals_is_registered) ?>
770 // This generates a section similar to Vitals for each LBF form that
771 // supports charting. The form ID is used as the "widget label".
773 $gfres = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
774 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
775 while($gfrow = sqlFetchArray($gfres)) {
779 <?php
// vitals expand collapse widget
780 $vitals_form_id = $gfrow['option_id'];
781 $widgetTitle = $gfrow['title'];
782 $widgetLabel = $vitals_form_id;
783 $widgetButtonLabel = xl("Trend");
784 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
785 $widgetButtonClass = "";
786 $linkMethod = "html";
787 $bodyClass = "notab";
788 // check to see if any instances exist for this patient
789 $existVitals = sqlQuery(
790 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
791 array($pid, $vitals_form_id));
792 $widgetAuth = $existVitals ?
true : false;
794 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
795 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
796 $widgetAuth, $fixedWidth);
799 <div style
='margin-left:10px' class='text'>
800 <image src
='../../pic/ajax-loader.gif'/>
803 </div
> <!-- This is required by
expand_collapse_widget(). -->
813 <!-- end left column div
-->
815 <!-- start right column div
-->
824 // If there is an ID Card or any Photos show the widget
825 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
826 if ($photos or $idcard_doc_id )
828 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
829 $widgetLabel = "photos";
830 $linkMethod = "javascript";
831 $bodyClass = "notab-right";
834 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
835 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
836 $widgetAuth, $fixedWidth);
840 if ($idcard_doc_id) {
841 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
844 foreach ($photos as $photo_doc_id) {
845 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
854 // Advance Directives
855 if ($GLOBALS['advance_directives_warning']) {
856 // advance directives expand collapse widget
857 $widgetTitle = xl("Advance Directives");
858 $widgetLabel = "directives";
859 $widgetButtonLabel = xl("Edit");
860 $widgetButtonLink = "return advdirconfigure();";
861 $widgetButtonClass = "";
862 $linkMethod = "javascript";
863 $bodyClass = "summary_item small";
866 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
867 $counterFlag = false; //flag to record whether any categories contain ad records
868 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
869 $myrow2 = sqlQuery($query);
871 $parentId = $myrow2['id'];
872 $query = "SELECT id, name FROM categories WHERE parent=?";
873 $resNew1 = sqlStatement($query, array($parentId) );
874 while ($myrows3 = sqlFetchArray($resNew1)) {
875 $categoryId = $myrows3['id'];
876 $nameDoc = $myrows3['name'];
877 $query = "SELECT documents.date, documents.id " .
879 "INNER JOIN categories_to_documents " .
880 "ON categories_to_documents.document_id=documents.id " .
881 "WHERE categories_to_documents.category_id=? " .
882 "AND documents.foreign_id=? " .
883 "ORDER BY documents.date DESC";
884 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
885 $limitCounter = 0; // limit to one entry per category
886 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
887 $dateTimeDoc = $myrows4['date'];
888 // remove time from datetime stamp
889 $tempParse = explode(" ",$dateTimeDoc);
890 $dateDoc = $tempParse[0];
891 $idDoc = $myrows4['id'];
892 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
893 htmlspecialchars($pid,ENT_QUOTES
) . "&document_id=" .
894 htmlspecialchars($idDoc,ENT_QUOTES
) . "&as_file=true'>" .
895 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES
) . "</a> " .
896 htmlspecialchars($dateDoc,ENT_NOQUOTES
);
898 $limitCounter = $limitCounter +
1;
904 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
907 <?php
} // close advanced dir block
909 // This is a feature for a specific client. -- Rod
910 if ($GLOBALS['cene_specific']) {
913 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$pid/demographics";
914 $imagepath = "$web_root/sites/" . $_SESSION['site_id'] . "/documents/$pid/demographics";
916 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
917 "title='Click to attach patient image'>\n";
918 if (is_file("$imagedir/photo.jpg")) {
919 echo " <img src='$imagepath/photo.jpg' /></a>\n";
921 echo " Attach Patient Image</a><br />\n";
923 echo " <br /> <br />\n";
925 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
926 "title='Click to attach fingerprint'>\n";
927 if (is_file("$imagedir/fingerprint.jpg")) {
928 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
930 echo " Attach Biometric Fingerprint</a><br />\n";
932 echo " <br /> <br />\n";
935 // This stuff only applies to athletic team use of OpenEMR. The client
936 // insisted on being able to quickly change fitness and return date here:
938 if (false && $GLOBALS['athletic_team']) {
939 // blue green yellow red orange
940 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
941 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
942 $fitcolor = $fitcolors[0];
943 $form_fitness = $_POST['form_fitness'];
944 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
945 $form_issue_id = $_POST['form_issue_id'];
947 $returndate = $form_userdate1 ?
"'$form_userdate1'" : "NULL";
948 sqlStatement("UPDATE patient_data SET fitness = ?, " .
949 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
950 // Update return date in the designated issue, if requested.
951 if ($form_issue_id) {
952 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
953 "id = ?", array($returndate, $form_issue_id) );
956 $form_fitness = $result['fitness'];
957 if (! $form_fitness) $form_fitness = 1;
958 $form_userdate1 = $result['userdate1'];
960 $fitcolor = $fitcolors[$form_fitness - 1];
961 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
962 echo " <span class='bold'>Fitness to Play:</span><br />\n";
963 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
964 $res = sqlStatement("SELECT * FROM list_options WHERE " .
965 "list_id = 'fitness' ORDER BY seq");
966 while ($row = sqlFetchArray($res)) {
967 $key = $row['option_id'];
968 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES
) . "'";
969 if ($key == $form_fitness) echo " selected";
970 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES
) . "</option>\n";
973 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
974 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
975 "value='$form_userdate1' " .
976 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES
) . "' " .
977 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
978 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
979 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
980 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES
) . "'>\n";
981 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES
) . "' />\n";
982 echo " <input type='hidden' name='form_issue_id' value='' />\n";
983 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
987 // Show current and upcoming appointments.
988 if (isset($pid) && !$GLOBALS['disable_calendar']) {
989 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
990 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
992 "FROM openemr_postcalendar_events AS e, users AS u, " .
993 "openemr_postcalendar_categories AS c WHERE " .
994 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
995 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
996 "ORDER BY e.pc_eventDate, e.pc_startTime";
997 $res = sqlStatement($query, array($pid) );
999 if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) {
1000 // clinical summary expand collapse widget
1001 $widgetTitle = xl("Clinical Reminders");
1002 $widgetLabel = "clinical_reminders";
1003 $widgetButtonLabel = xl("Edit");
1004 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;;
1005 $widgetButtonClass = "";
1006 $linkMethod = "html";
1007 $bodyClass = "summary_item small";
1009 $fixedWidth = false;
1010 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1012 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1016 // appointments expand collapse widget
1017 $widgetTitle = xl("Appointments");
1018 $widgetLabel = "appointments";
1019 $widgetButtonLabel = xl("Add");
1020 $widgetButtonLink = "return newEvt();";
1021 $widgetButtonClass = "";
1022 $linkMethod = "javascript";
1023 $bodyClass = "summary_item small";
1024 $widgetAuth = (isset($res) && $res != null);
1025 $fixedWidth = false;
1026 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1029 while($row = sqlFetchArray($res)) {
1031 $dayname = date("l", strtotime($row['pc_eventDate']));
1033 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
1034 $dispmin = substr($row['pc_startTime'], 3, 2);
1035 if ($disphour >= 12) {
1037 if ($disphour > 12) $disphour -= 12;
1039 $etitle = xl('(Click to edit)');
1040 if ($row['pc_hometext'] != "") {
1041 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1043 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES
) .
1044 ")' title='" . htmlspecialchars($etitle,ENT_QUOTES
) . "'>";
1045 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES
) . "</b><br>";
1046 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES
) . "<br>\n";
1047 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES
) . "</a><br>\n";
1049 if (isset($res) && $res != null) {
1050 if ( $count < 1 ) { echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
); }
1057 <div id
='stats_div'>
1059 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
1065 </div
> <!-- end right column div
-->
1072 </div
> <!-- end main content div
-->
1074 <?php
if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?
>
1075 <script language
='JavaScript'>
1076 top
.window
.parent
.left_nav
.setPatient(<?php
echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES
) .
1077 "'," . htmlspecialchars($pid,ENT_QUOTES
) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES
) .
1078 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']), ENT_QUOTES
) . "'"; ?
>);
1079 EncounterDateArray
=new Array;
1080 CalendarCategoryArray
=new Array;
1081 EncounterIdArray
=new Array;
1084 //Encounter details are stored to javacript as array.
1085 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
1086 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
1087 if(sqlNumRows($result4)>0)
1088 while($rowresult4 = sqlFetchArray($result4))
1091 EncounterIdArray
[Count
]='<?php echo htmlspecialchars($rowresult4['encounter
'], ENT_QUOTES); ?>';
1092 EncounterDateArray
[Count
]='<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
']))), ENT_QUOTES); ?>';
1093 CalendarCategoryArray
[Count
]='<?php echo htmlspecialchars( xl_appt_category($rowresult4['pc_catname
']), ENT_QUOTES); ?>';
1098 top
.window
.parent
.left_nav
.setPatientEncounter(EncounterIdArray
,EncounterDateArray
,CalendarCategoryArray
);
1099 parent
.left_nav
.setRadio(window
.name
, 'dem');
1103 <?php
if (false && $GLOBALS['athletic_team']) { ?
>
1104 <script language
='JavaScript'>
1105 Calendar
.setup({inputField
:"form_userdate1", ifFormat
:"%Y-%m-%d", button
:"img_userdate1"});