4 * Patient summary screen.
6 * LICENSE: 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 3
9 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @author Brady Miller <brady@sparmy.com>
19 * @link http://www.open-emr.org
22 //SANITIZE ALL ESCAPES
23 $sanitize_all_escapes=true;
26 //STOP FAKE REGISTER GLOBALS
27 $fake_register_globals=false;
30 require_once("../../globals.php");
31 require_once("$srcdir/patient.inc");
32 require_once("$srcdir/acl.inc");
33 require_once("$srcdir/classes/Address.class.php");
34 require_once("$srcdir/classes/InsuranceCompany.class.php");
35 require_once("$srcdir/classes/Document.class.php");
36 require_once("$srcdir/options.inc.php");
37 require_once("../history/history.inc.php");
38 require_once("$srcdir/formatting.inc.php");
39 require_once("$srcdir/edi.inc");
40 require_once("$srcdir/invoice_summary.inc.php");
41 require_once("$srcdir/clinical_rules.php");
42 require_once("$srcdir/options.js.php");
44 require_once(dirname(__FILE__
)."/../../../library/appointments.inc.php");
46 if ($GLOBALS['concurrent_layout'] && isset($_GET['set_pid'])) {
47 include_once("$srcdir/pid.inc");
48 setpid($_GET['set_pid']);
51 $active_reminders = false;
52 $all_allergy_alerts = false;
53 if ($GLOBALS['enable_cdr']) {
55 if ($GLOBALS['enable_allergy_check'] && $GLOBALS['enable_alert_log']) {
56 //Check for new allergies conflicts and throw popup if any exist(note need alert logging to support this)
57 $new_allergy_alerts = allergy_conflict($pid,'new',$_SESSION['authUser']);
58 if (!empty($new_allergy_alerts)) {
59 $pop_warning = '<script type="text/javascript">alert(\'' . xls('WARNING - FOLLOWING ACTIVE MEDICATIONS ARE ALLERGIES') . ':\n';
60 foreach ($new_allergy_alerts as $new_allergy_alert) {
61 $pop_warning .= addslashes($new_allergy_alert) . '\n';
63 $pop_warning .= '\')</script>';
67 if ((!isset($_SESSION['alert_notify_pid']) ||
($_SESSION['alert_notify_pid'] != $pid)) && isset($_GET['set_pid']) && $GLOBALS['enable_cdr_crp']) {
68 // showing a new patient, so check for active reminders and allergy conflicts, which use in active reminder popup
69 $active_reminders = active_alert_summary($pid,"reminders-due",'','default',$_SESSION['authUser'],TRUE);
70 if ($GLOBALS['enable_allergy_check']) {
71 $all_allergy_alerts = allergy_conflict($pid,'all',$_SESSION['authUser'],TRUE);
76 function print_as_money($money) {
77 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
78 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
79 $ccheck = strrev($tmp);
80 if ($ccheck[0] == ",") {
81 $tmp = substr($ccheck,1,strlen($ccheck)-1);
83 if ($moneymatches[2] != "") {
84 return "$ " . strrev($tmp) . "." . $moneymatches[2];
86 return "$ " . strrev($tmp);
90 // get an array from Photos category
91 function pic_array($pid,$picture_directory) {
93 $sql_query = "select documents.id from documents join categories_to_documents " .
94 "on documents.id = categories_to_documents.document_id " .
95 "join categories on categories.id = categories_to_documents.category_id " .
96 "where categories.name like ? and documents.foreign_id = ?";
97 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
98 while( $results = sqlFetchArray($query) ) {
99 array_push($pics,$results['id']);
104 // Get the document ID of the first document in a specific catg.
105 function get_document_by_catg($pid,$doc_catg) {
109 if ($pid and $doc_catg) {
110 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
111 "documents AS d, categories_to_documents AS cd, categories AS c " .
112 "WHERE d.foreign_id = ? " .
113 "AND cd.document_id = d.id " .
114 "AND c.id = cd.category_id " .
115 "AND c.name LIKE ? " .
116 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg) );
119 return($result['id']);
122 // Display image in 'widget style'
123 function image_widget($doc_id,$doc_catg)
125 global $pid, $web_root;
126 $docobj = new Document($doc_id);
127 $image_file = $docobj->get_url_file();
128 $extension = substr($image_file, strrpos($image_file,"."));
129 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp','.PNG','.JPG','.JPEG','.PNG','.BMP'); // image ext supported by fancybox viewer
130 if ( in_array($extension,$viewable_types) ) { // extention matches list
131 $to_url = "<td> <a href = $web_root" .
132 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
133 "/tmp$extension" . // Force image type URL for fancybox
134 " onclick=top.restoreSession(); class='image_modal'>" .
135 " <img src = $web_root" .
136 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
137 " width=100 alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
138 htmlspecialchars($doc_catg) . '<br /> ' . htmlspecialchars($image_file) .
142 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
143 "&patient_id=$pid&document_id=$doc_id'" .
144 " onclick='top.restoreSession()' class='css_button_small'>" .
146 htmlspecialchars( xl("View"), ENT_QUOTES
)."</a> " .
147 htmlspecialchars( "$doc_catg - $image_file", ENT_QUOTES
) .
152 echo "</tr></table>";
155 // Determine if the Vitals form is in use for this site.
156 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
157 "directory = 'vitals' AND state = 1");
158 $vitals_is_registered = $tmp['count'];
160 // Get patient/employer/insurance information.
162 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
163 $result2 = getEmployerData($pid);
164 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
166 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
167 $insco_name = getInsuranceProvider($result3['provider']);
173 <?php
html_header_show();?
>
174 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
175 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
176 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
177 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
178 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
179 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
180 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
181 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
182 <script type
="text/javascript" src
="../../../library/js/jquery-1.6.4.min.js"></script
>
183 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
184 <script type
="text/javascript" src
="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
185 <script type
="text/javascript" language
="JavaScript">
187 var mypcc
= '<?php echo htmlspecialchars($GLOBALS['phone_country_code
'],ENT_QUOTES); ?>';
189 function oldEvt(apptdate
, eventid
) {
190 dlgopen('../../main/calendar/add_edit_event.php?date=' + apptdate +
'&eid=' + eventid
, '_blank', 775, 375);
193 function advdirconfigure() {
194 dlgopen('advancedirectives.php', '_blank', 500, 450);
197 function refreshme() {
198 top
.restoreSession();
202 // Process click on Delete link.
203 function deleteme() {
204 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
208 // Called by the deleteme.php window on a successful delete.
209 function imdeleted() {
210 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
211 parent
.left_nav
.clearPatient();
213 top
.restoreSession();
214 top
.location
.href
= '../main/main_screen.php';
218 function validate() {
219 var f
= document
.forms
[0];
221 if ($GLOBALS['athletic_team']) {
222 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
223 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
224 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
227 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo htmlspecialchars($irow['title
'],ENT_QUOTES); ?>"?')) {
228 f
.form_issue_id
.value
= '<?php echo htmlspecialchars($irow['id
'],ENT_QUOTES); ?>';
230 alert('OK, you will need to manually update the return date in any affected issue(s).');
233 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
237 } // end athletic team
243 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 775, 375);
247 function sendimage(pid
, what
) {
248 // alert('Not yet implemented.'); return false;
249 dlgopen('../upload_dialog.php?patientid=' + pid +
'&file=' + what
,
256 <script type
="text/javascript">
258 function toggleIndicator(target
,div
) {
260 $mode = $
(target
).find(".indicator").text();
261 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
262 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
264 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 0 });
266 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
268 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 1 });
272 $
(document
).ready(function(){
275 if($GLOBALS['erx_enable']){
276 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
277 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where pid=? and soap_import_status in ('1','3')",array($pid));
278 while($row_soapstatus=sqlFetchArray($soap_status)){
279 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
280 top
.restoreSession();
283 url
: "../../soap_functions/soap_patientfullmedication.php",
286 patient
:<?php
echo $row_soapstatus['pid']; ?
>,
289 success
: function(thedata
){
291 msg_updation+
=thedata
;
299 //elseif($soap_status['soap_import_status']=='3'){ ?>
300 top
.restoreSession();
303 url
: "../../soap_functions/soap_allergy.php",
306 patient
:<?php
echo $row_soapstatus['pid']; ?
>,
309 success
: function(thedata
){
311 msg_updation+
=thedata
;
318 if($GLOBALS['erx_import_status_message']){ ?
>
328 $
("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
329 // (note need to place javascript code here also to get the dynamic link to work)
330 $
(".rx_modal").fancybox( {
331 'overlayOpacity' : 0.0,
332 'showCloseButton' : true,
335 'centerOnScroll' : false,
336 'callbackOnClose' : function() {
341 $
("#pnotes_ps_expand").load("pnotes_fragment.php");
342 $
("#disclosures_ps_expand").load("disc_fragment.php");
344 <?php
if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?
>
345 top
.restoreSession();
346 $
("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
347 // (note need to place javascript code here also to get the dynamic link to work)
348 $
(".medium_modal").fancybox( {
349 'overlayOpacity' : 0.0,
350 'showCloseButton' : true,
353 'centerOnScroll' : false,
354 'callbackOnClose' : function() {
361 <?php
if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?
>
362 top
.restoreSession();
363 $
("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
366 <?php
if ($vitals_is_registered && acl_check('patients', 'med')) { ?
>
367 // Initialize the Vitals form if it is registered and user is authorized.
368 $
("#vitals_ps_expand").load("vitals_fragment.php");
371 // Initialize track_anything
372 $
("#track_anything_ps_expand").load("track_anything_fragment.php");
375 // Initialize labdata
376 $
("#labdata_ps_expand").load("labdata_fragment.php");
378 // Initialize for each applicable LBF form.
379 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
380 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
381 while($gfrow = sqlFetchArray($gfres)) {
383 $
("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
393 // modal for dialog boxes
394 $
(".large_modal").fancybox( {
395 'overlayOpacity' : 0.0,
396 'showCloseButton' : true,
399 'centerOnScroll' : false
402 // modal for image viewer
403 $
(".image_modal").fancybox( {
404 'overlayOpacity' : 0.0,
405 'showCloseButton' : true,
406 'centerOnScroll' : false,
410 $
(".iframe1").fancybox( {
412 'overlayOpacity' : 0.0,
413 'showCloseButton' : true,
417 // special size for patient portal
418 $
(".small_modal").fancybox( {
419 'overlayOpacity' : 0.0,
420 'showCloseButton' : true,
423 'centerOnScroll' : false
426 <?php
if ($active_reminders ||
$all_allergy_alerts) { ?
>
427 // show the active reminder modal
428 $
("#reminder_popup_link").fancybox({
429 'overlayOpacity' : 0.0,
430 'showCloseButton' : true,
433 'centerOnScroll' : false
439 // JavaScript stuff to do when a new patient is set.
441 function setMyPatient() {
442 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
443 // Avoid race conditions with loading of the left_nav or Title frame.
444 if (!parent
.allFramesLoaded()) {
445 setTimeout("setMyPatient()", 500);
448 <?php
if (isset($_GET['set_pid'])) { ?
>
449 parent
.left_nav
.setPatient(<?php
echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES
) .
450 "'," . htmlspecialchars($pid,ENT_QUOTES
) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES
) .
451 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAgeDisplay($result['DOB_YMD']), ENT_QUOTES
) . "'"; ?
>);
452 var EncounterDateArray
= new Array;
453 var CalendarCategoryArray
= new Array;
454 var EncounterIdArray
= new Array;
457 //Encounter details are stored to javacript as array.
458 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
459 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
460 if(sqlNumRows($result4)>0) {
461 while($rowresult4 = sqlFetchArray($result4)) {
463 EncounterIdArray
[Count
] = '<?php echo htmlspecialchars($rowresult4['encounter
'], ENT_QUOTES); ?>';
464 EncounterDateArray
[Count
] = '<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
']))), ENT_QUOTES); ?>';
465 CalendarCategoryArray
[Count
] = '<?php echo htmlspecialchars(xl_appt_category($rowresult4['pc_catname
']), ENT_QUOTES); ?>';
471 parent
.left_nav
.setPatientEncounter(EncounterIdArray
,EncounterDateArray
,CalendarCategoryArray
);
472 <?php
} // end setting new pid ?>
473 parent
.left_nav
.setRadio(window
.name
, 'dem');
474 parent
.left_nav
.syncRadios();
475 <?php
if ( (isset($_GET['set_pid']) ) && (isset($_GET['set_encounterid'])) && ( intval($_GET['set_encounterid']) > 0 ) ) {
476 $encounter = intval($_GET['set_encounterid']);
477 $_SESSION['encounter'] = $encounter;
478 $query_result = sqlQuery("SELECT `date` FROM `form_encounter` WHERE `encounter` = ?", array($encounter)); ?
>
479 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
480 parent
.left_nav
.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date
']))); ?>', '<?php echo attr($encounter); ?>', othername
);
481 parent
.left_nav
.setRadio(othername
, 'enc');
482 parent
.frames
[othername
].location
.href
= '../encounter/encounter_top.php?set_encounter=' +
<?php
echo attr($encounter);?
> +
'&pid=' +
<?php
echo attr($pid);?
>;
483 <?php
} // end setting new encounter id (only if new pid is also set) ?>
484 <?php
} // end concurrent layout ?>
487 $
(window
).load(function() {
493 <style type
="css/text">
502 <body
class="body_top">
504 <a href
='../reminder/active_reminder_popup.php' id
='reminder_popup_link' style
='visibility: false;' class='iframe' onclick
='top.restoreSession()'></a
>
507 $thisauth = acl_check('patients', 'demo');
509 if ($result['squad'] && ! acl_check('squads', $result['squad']))
513 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES
) . ")</p>\n";
514 echo "</body>\n</html>\n";
518 echo "<table><tr><td><span class='title'>" .
519 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES
) .
522 if (acl_check('admin', 'super')) {
523 echo "<td style='padding-left:1em;'><a class='css_button iframe' href='../deleter.php?patient=" .
524 htmlspecialchars($pid,ENT_QUOTES
) . "' onclick='top.restoreSession()'>" .
525 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES
).
528 if($GLOBALS['erx_enable']){
529 echo '<td style="padding-left:1em;"><a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">';
530 echo "<span>".htmlspecialchars(xl('NewCrop MedEntry'),ENT_NOQUOTES
)."</span></a></td>";
531 echo '<td style="padding-left:1em;"><a class="css_button iframe1" href="../../soap_functions/soap_accountStatusDetails.php" onclick="top.restoreSession()">';
532 echo "<span>".htmlspecialchars(xl('NewCrop Account Status'),ENT_NOQUOTES
)."</span></a></td><td id='accountstatus'></td>";
535 $portalUserSetting = true; //flag to see if patient has authorized access to portal
536 if($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']){
537 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
538 if ($portalStatus['allow_patient_portal']=='YES') {
539 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));
540 echo "<td style='padding-left:1em;'><a class='css_button iframe small_modal' href='create_portallogin.php?portalsite=on&patient=" . htmlspecialchars($pid,ENT_QUOTES
) . "' onclick='top.restoreSession()'>";
541 if (empty($portalLogin)) {
542 echo "<span>".htmlspecialchars(xl('Create Onsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
545 echo "<span>".htmlspecialchars(xl('Reset Onsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
549 $portalUserSetting = false;
552 if($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']){
553 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
554 if ($portalStatus['allow_patient_portal']=='YES') {
555 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
556 echo "<td style='padding-left:1em;'><a class='css_button iframe small_modal' href='create_portallogin.php?portalsite=off&patient=" . htmlspecialchars($pid,ENT_QUOTES
) . "' onclick='top.restoreSession()'>";
557 if (empty($portalLogin)) {
558 echo "<span>".htmlspecialchars(xl('Create Offsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
561 echo "<span>".htmlspecialchars(xl('Reset Offsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
565 $portalUserSetting = false;
568 if (!($portalUserSetting)) {
569 // Show that the patient has not authorized portal access
570 echo "<td style='padding-left:1em;'>" . htmlspecialchars( xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES
) . "</td>";
574 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
575 $days_deceased = is_patient_deceased($pid);
576 if ($days_deceased) {
577 echo "<td style='padding-left:1em;font-weight:bold;color:red'>" . htmlspecialchars( xl('DECEASED') ,ENT_NOQUOTES
) . " (" . htmlspecialchars($days_deceased,ENT_NOQUOTES
) . " " . htmlspecialchars( xl('days ago') ,ENT_NOQUOTES
) . ")</td>";
580 echo "</tr></table>";
583 // Get the document ID of the patient ID card if access to it is wanted here.
584 $idcard_doc_id = false;
585 if ($GLOBALS['patient_id_category_name']) {
586 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
590 <table cellspacing
='0' cellpadding
='0' border
='0'>
592 <td
class="small" colspan
='4'>
593 <a href
="../history/history.php" onclick
='top.restoreSession()'>
594 <?php
echo htmlspecialchars(xl('History'),ENT_NOQUOTES
); ?
></a
>
596 <?php
//note that we have temporarily removed report screen from the modal view ?>
597 <a href
="../report/patient_report.php" onclick
='top.restoreSession()'>
598 <?php
echo htmlspecialchars(xl('Report'),ENT_NOQUOTES
); ?
></a
>
600 <?php
//note that we have temporarily removed document screen from the modal view ?>
601 <a href
="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick
='top.restoreSession()'>
602 <?php
echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES
); ?
></a
>
604 <a href
="../transaction/transactions.php" class='iframe large_modal' onclick
='top.restoreSession()'>
605 <?php
echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES
); ?
></a
>
607 <a href
="stats_full.php?active=all" onclick
='top.restoreSession()'>
608 <?php
echo htmlspecialchars(xl('Issues'),ENT_NOQUOTES
); ?
></a
>
610 <a href
="../../reports/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" onclick
='top.restoreSession()'>
611 <?php
echo xlt('Ledger'); ?
></a
>
613 <a href
="../../reports/external_data.php" onclick
='top.restoreSession()'>
614 <?php
echo xlt('External Data'); ?
></a
>
616 <!-- DISPLAYING HOOKS STARTS HERE
-->
618 $module_query = sqlStatement("SELECT msh.*,ms.menu_name,ms.path,m.mod_ui_name,m.type FROM modules_hooks_settings AS msh
619 LEFT OUTER JOIN modules_settings AS ms ON obj_name=enabled_hooks AND ms.mod_id=msh.mod_id
620 LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
621 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='demographics' ORDER BY mod_id");
622 $DivId = 'mod_installer';
623 if (sqlNumRows($module_query)) {
626 while ($modulerow = sqlFetchArray($module_query)) {
627 $DivId = 'mod_'.$modulerow['mod_id'];
628 $new_category = $modulerow['mod_ui_name'];
631 if($modulerow['type'] == 0) {
632 $modulePath = $GLOBALS['customModDir'];
637 $modulePath = $GLOBALS['zendModDir'];
639 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
640 $nickname = $modulerow['menu_name'] ?
$modulerow['menu_name'] : 'Noname';
642 $modid = $modulerow['mod_id'];
645 <a href
="<?php echo $relative_link; ?>" onclick
='top.restoreSession()'>
646 <?php
echo htmlspecialchars($nickname,ENT_NOQUOTES
); ?
></a
>
651 <!-- DISPLAYING HOOKS ENDS HERE
-->
656 </table
> <!-- end header
-->
658 <div style
='margin-top:10px'> <!-- start main content div
-->
659 <table border
="0" cellspacing
="0" cellpadding
="0" width
="100%">
661 <td
class="demographics-box" align
="left" valign
="top">
662 <!-- start left column div
-->
663 <div style
='float:left; margin-right:20px'>
664 <table cellspacing
=0 cellpadding
=0>
665 <tr
<?php
if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?
>>
668 // Billing expand collapse widget
669 $widgetTitle = xl("Billing");
670 $widgetLabel = "billing";
671 $widgetButtonLabel = xl("Edit");
672 $widgetButtonLink = "return newEvt();";
673 $widgetButtonClass = "";
674 $linkMethod = "javascript";
675 $bodyClass = "notab";
678 if ($GLOBALS['force_billing_widget_open']) {
679 $forceExpandAlways = true;
682 $forceExpandAlways = false;
684 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
685 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
686 $widgetAuth, $fixedWidth, $forceExpandAlways);
690 //PATIENT BALANCE,INS BALANCE naina@capminds.com
691 $patientbalance = get_patient_balance($pid, false);
692 //Debit the patient balance from insurance balance
693 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
694 $totalbalance=$patientbalance +
$insurancebalance;
695 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
696 // Show current balance and billing note, if any.
697 echo "<table border='0'><tr><td>" .
698 "<table ><tr><td><span class='bold'><font color='red'>" .
699 xlt('Patient Balance Due') .
700 " : " . text(oeFormatMoney($patientbalance)) .
701 "</font></span></td></tr>".
702 "<tr><td><span class='bold'><font color='red'>" .
703 xlt('Insurance Balance Due') .
704 " : " . text(oeFormatMoney($insurancebalance)) .
705 "</font></span></td></tr>".
706 "<tr><td><span class='bold'><font color='red'>" .
707 xlt('Total Balance Due').
708 " : " . text(oeFormatMoney($totalbalance)) .
709 "</font></span></td></td></tr>";
710 if (!empty($result['billing_note'])) {
711 echo "<tr><td><span class='bold'><font color='red'>" .
712 xlt('Billing Note') . ":" .
713 text($result['billing_note']) .
714 "</font></span></td></tr>";
716 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
717 echo "<tr><td><span class='bold'>" .
718 xlt('Primary Insurance') . ': ' . text($insco_name) .
719 "</span> ";
720 if ($result3['copay'] > 0) {
721 echo "<span class='bold'>" .
722 xlt('Copay') . ': ' . text($result3['copay']) .
723 "</span> ";
725 echo "<span class='bold'>" .
726 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
729 echo "</table></td></tr></td></tr></table><br>";
732 </div
> <!-- required
for expand_collapse_widget
-->
738 // Demographics expand collapse widget
739 $widgetTitle = xl("Demographics");
740 $widgetLabel = "demographics";
741 $widgetButtonLabel = xl("Edit");
742 $widgetButtonLink = "demographics_full.php";
743 $widgetButtonClass = "";
744 $linkMethod = "html";
746 $widgetAuth = acl_check('patients', 'demo', '', 'write');
748 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
749 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
750 $widgetAuth, $fixedWidth);
754 <?php
display_layout_tabs('DEM', $result, $result2); ?
>
756 <div
class="tabContainer">
757 <?php
display_layout_tabs_data('DEM', $result, $result2); ?
>
760 </div
> <!-- required
for expand_collapse_widget
-->
767 $insurance_count = 0;
768 foreach (array('primary','secondary','tertiary') as $instype) {
769 $enddate = 'Present';
770 $query = "SELECT * FROM insurance_data WHERE " .
771 "pid = ? AND type = ? " .
772 "ORDER BY date DESC";
773 $res = sqlStatement($query, array($pid, $instype) );
774 while( $row = sqlFetchArray($res) ) {
775 if ($row['provider'] ) $insurance_count++
;
779 if ( $insurance_count > 0 ) {
780 // Insurance expand collapse widget
781 $widgetTitle = xl("Insurance");
782 $widgetLabel = "insurance";
783 $widgetButtonLabel = xl("Edit");
784 $widgetButtonLink = "demographics_full.php";
785 $widgetButtonClass = "";
786 $linkMethod = "html";
788 $widgetAuth = acl_check('patients', 'demo', '', 'write');
790 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
791 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
792 $widgetAuth, $fixedWidth);
794 if ( $insurance_count > 0 ) {
797 <ul
class="tabNav"><?php
798 ///////////////////////////////// INSURANCE SECTION
800 foreach (array('primary','secondary','tertiary') as $instype) {
802 $query = "SELECT * FROM insurance_data WHERE " .
803 "pid = ? AND type = ? " .
804 "ORDER BY date DESC";
805 $res = sqlStatement($query, array($pid, $instype) );
807 $enddate = 'Present';
809 while( $row = sqlFetchArray($res) ) {
810 if ($row['provider'] ) {
812 $ins_description = ucfirst($instype);
813 $ins_description = xl($ins_description);
814 $ins_description .= strcmp($enddate, 'Present') != 0 ?
" (".xl('Old').")" : "";
816 <li
<?php
echo $first ?
'class="current"' : '' ?
>><a href
="/play/javascript-tabbed-navigation/">
817 <?php
echo htmlspecialchars($ins_description,ENT_NOQUOTES
); ?
></a
></li
>
821 $enddate = $row['date'];
824 // Display the eligibility tab
825 echo "<li><a href='/play/javascript-tabbed-navigation/'>" .
826 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES
) . "</a></li>";
832 <div
class="tabContainer">
835 foreach (array('primary','secondary','tertiary') as $instype) {
836 $enddate = 'Present';
838 $query = "SELECT * FROM insurance_data WHERE " .
839 "pid = ? AND type = ? " .
840 "ORDER BY date DESC";
841 $res = sqlStatement($query, array($pid, $instype) );
842 while( $row = sqlFetchArray($res) ) {
843 if ($row['provider'] ) {
845 <div
class="tab <?php echo $first ? 'current' : '' ?>">
846 <table border
='0' cellpadding
='0' width
='100%'>
848 $icobj = new InsuranceCompany($row['provider']);
849 $adobj = $icobj->get_address();
850 $insco_name = trim($icobj->get_name());
853 <td valign
='top' colspan
='3'>
855 <?php
if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES
)." "; ?
>
856 <?php
$tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES
); ?
>
857 <?php
if (strcmp($row['date'], '0000-00-00') != 0) { ?
>
858 <?php
echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES
); ?
>
860 <?php
echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES
);
861 echo (strcmp($enddate, 'Present') != 0) ?
$enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES
); ?
>:</span
>
869 echo htmlspecialchars($insco_name,ENT_NOQUOTES
) . '<br>';
870 if (trim($adobj->get_line1())) {
871 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES
) . '<br>';
872 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES
);
875 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES
)."</b></font>";
879 <?php
echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES
); ?
>:
880 <?php
echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES
) ?
><br
>
881 <?php
echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES
); ?
>:
882 <?php
echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES
); ?
><br
>
883 <?php
echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES
); ?
>:
884 <?php
echo htmlspecialchars($row['group_number'],ENT_NOQUOTES
); ?
></span
>
887 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES
); ?
>: </span
><br
>
888 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES
); ?
>
890 if ($row['subscriber_relationship'] != "") {
891 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES
) . ")";
895 <?php
echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES
); ?
>:
896 <?php
echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES
); ?
><br
>
897 <?php
echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES
); ?
>:
898 <?php
if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES
); ?
><br
>
899 <?php
echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES
); ?
>:
900 <?php
echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES
); ?
>
904 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES
); ?
>: </span
><br
>
905 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES
); ?
><br
>
906 <?php
echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES
); ?
>
907 <?php
if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES
); ?
>
908 <?php
if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES
); ?
>
909 <?php
echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES
); ?
></span
>
911 <?php
if (trim($row['subscriber_employer'])) { ?
>
912 <br
><span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES
); ?
>: </span
><br
>
913 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES
); ?
><br
>
914 <?php
echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES
); ?
><br
>
915 <?php
echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES
); ?
>
916 <?php
if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES
); ?
>
917 <?php
if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES
); ?
>
918 <?php
echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES
); ?
>
926 <?php
if ($row['copay'] != "") { ?
>
927 <span
class='bold'><?php
echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES
); ?
>: </span
>
928 <span
class='text'><?php
echo htmlspecialchars($row['copay'],ENT_NOQUOTES
); ?
></span
>
931 <span
class='bold'><?php
echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES
); ?
>:</span
>
932 <span
class='text'><?php
if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?
>
933 <?php
if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?
></span
>
934 <?php
if (!empty($row['policy_type'])) { ?
>
936 <span
class='bold'><?php
echo htmlspecialchars(xl('Secondary Medicare Type'),ENT_NOQUOTES
); ?
>: </span
>
937 <span
class='text'><?php
echo htmlspecialchars($policy_types[$row['policy_type']],ENT_NOQUOTES
); ?
></span
>
940 <td valign
='top'></td
>
941 <td valign
='top'></td
>
948 } // end if ($row['provider'])
949 $enddate = $row['date'];
954 // Display the eligibility information
955 echo "<div class='tab'>";
956 show_eligibility_information($pid,true);
959 ///////////////////////////////// END INSURANCE SECTION
972 // Notes expand collapse widget
973 $widgetTitle = xl("Notes");
974 $widgetLabel = "pnotes";
975 $widgetButtonLabel = xl("Edit");
976 $widgetButtonLink = "pnotes_full.php?form_active=1";
977 $widgetButtonClass = "";
978 $linkMethod = "html";
979 $bodyClass = "notab";
982 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
983 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
984 $widgetAuth, $fixedWidth);
988 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
992 <?php
if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) ) {
993 echo "<tr><td width='650px'>";
994 // patient reminders collapse widget
995 $widgetTitle = xl("Patient Reminders");
996 $widgetLabel = "patient_reminders";
997 $widgetButtonLabel = xl("Edit");
998 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
999 $widgetButtonClass = "";
1000 $linkMethod = "html";
1001 $bodyClass = "notab";
1004 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?
>
1006 <div style
='margin-left:10px' class='text'><image src
='../../pic/ajax-loader.gif'/></div
><br
/>
1010 <?php
} //end if prw is activated ?>
1015 // disclosures expand collapse widget
1016 $widgetTitle = xl("Disclosures");
1017 $widgetLabel = "disclosures";
1018 $widgetButtonLabel = xl("Edit");
1019 $widgetButtonLink = "disclosure_full.php";
1020 $widgetButtonClass = "";
1021 $linkMethod = "html";
1022 $bodyClass = "notab";
1025 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1026 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1027 $widgetAuth, $fixedWidth);
1030 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
1034 <?php
if ($GLOBALS['amendments']) { ?
>
1037 <?php
// Amendments widget
1038 $widgetTitle = xlt('Amendments');
1039 $widgetLabel = "amendments";
1040 $widgetButtonLabel = xlt("Edit");
1041 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/main_frameset.php?feature=amendment";
1042 $widgetButtonClass = "iframe rx_modal";
1043 $linkMethod = "html";
1044 $bodyClass = "summary_item small";
1046 $fixedWidth = false;
1047 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1048 $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
1049 $result = sqlStatement($sql, array($pid) );
1051 if (sqlNumRows($result) == 0) {
1052 echo " <table><tr>\n";
1053 echo " <td colspan='$numcols' class='text'> " . xlt('None') . "</td>\n";
1054 echo " </tr></table>\n";
1057 while ($row=sqlFetchArray($result)){
1058 echo " ";
1059 echo "<a class= '" . $widgetButtonClass . "' href='" . $widgetButtonLink . "&id=" . attr($row['amendment_id']) . "' onclick='top.restoreSession()'>" . text($row['amendment_date']);
1060 echo " " . text($row['amendment_desc']);
1070 <?php
// labdata expand collapse widget
1071 $widgetTitle = xl("Labs");
1072 $widgetLabel = "labdata";
1073 $widgetButtonLabel = xl("Trend");
1074 $widgetButtonLink = "../summary/labdata.php";#"../encounter/trend_form.php?formname=labdata";
1075 $widgetButtonClass = "";
1076 $linkMethod = "html";
1077 $bodyClass = "notab";
1078 // check to see if any labdata exist
1079 $spruch = "SELECT procedure_report.date_collected AS date " .
1080 "FROM procedure_report " .
1081 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
1082 "WHERE procedure_order.patient_id = ? " .
1083 "ORDER BY procedure_report.date_collected DESC ";
1084 $existLabdata = sqlQuery($spruch, array($pid) );
1085 if ($existLabdata) {
1089 $widgetAuth = false;
1092 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1093 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1094 $widgetAuth, $fixedWidth);
1097 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
1101 <?php
// end labdata ?>
1106 <?php
if ($vitals_is_registered && acl_check('patients', 'med')) { ?
>
1109 <?php
// vitals expand collapse widget
1110 $widgetTitle = xl("Vitals");
1111 $widgetLabel = "vitals";
1112 $widgetButtonLabel = xl("Trend");
1113 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
1114 $widgetButtonClass = "";
1115 $linkMethod = "html";
1116 $bodyClass = "notab";
1117 // check to see if any vitals exist
1118 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
1123 $widgetAuth = false;
1126 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1127 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1128 $widgetAuth, $fixedWidth);
1131 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
1135 <?php
} // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
1138 // This generates a section similar to Vitals for each LBF form that
1139 // supports charting. The form ID is used as the "widget label".
1141 $gfres = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
1142 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
1143 while($gfrow = sqlFetchArray($gfres)) {
1147 <?php
// vitals expand collapse widget
1148 $vitals_form_id = $gfrow['option_id'];
1149 $widgetTitle = $gfrow['title'];
1150 $widgetLabel = $vitals_form_id;
1151 $widgetButtonLabel = xl("Trend");
1152 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
1153 $widgetButtonClass = "";
1154 $linkMethod = "html";
1155 $bodyClass = "notab";
1156 // check to see if any instances exist for this patient
1157 $existVitals = sqlQuery(
1158 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
1159 array($pid, $vitals_form_id));
1160 $widgetAuth = $existVitals ?
true : false;
1162 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1163 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1164 $widgetAuth, $fixedWidth);
1167 <div style
='margin-left:10px' class='text'>
1168 <image src
='../../pic/ajax-loader.gif'/>
1171 </div
> <!-- This is required by
expand_collapse_widget(). -->
1181 <!-- end left column div
-->
1183 <!-- start right column div
-->
1192 // If there is an ID Card or any Photos show the widget
1193 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1194 if ($photos or $idcard_doc_id )
1196 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1197 $widgetLabel = "photos";
1198 $linkMethod = "javascript";
1199 $bodyClass = "notab-right";
1200 $widgetAuth = false;
1201 $fixedWidth = false;
1202 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
1203 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1204 $widgetAuth, $fixedWidth);
1208 if ($idcard_doc_id) {
1209 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1212 foreach ($photos as $photo_doc_id) {
1213 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1222 // Advance Directives
1223 if ($GLOBALS['advance_directives_warning']) {
1224 // advance directives expand collapse widget
1225 $widgetTitle = xl("Advance Directives");
1226 $widgetLabel = "directives";
1227 $widgetButtonLabel = xl("Edit");
1228 $widgetButtonLink = "return advdirconfigure();";
1229 $widgetButtonClass = "";
1230 $linkMethod = "javascript";
1231 $bodyClass = "summary_item small";
1233 $fixedWidth = false;
1234 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1235 $counterFlag = false; //flag to record whether any categories contain ad records
1236 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1237 $myrow2 = sqlQuery($query);
1239 $parentId = $myrow2['id'];
1240 $query = "SELECT id, name FROM categories WHERE parent=?";
1241 $resNew1 = sqlStatement($query, array($parentId) );
1242 while ($myrows3 = sqlFetchArray($resNew1)) {
1243 $categoryId = $myrows3['id'];
1244 $nameDoc = $myrows3['name'];
1245 $query = "SELECT documents.date, documents.id " .
1247 "INNER JOIN categories_to_documents " .
1248 "ON categories_to_documents.document_id=documents.id " .
1249 "WHERE categories_to_documents.category_id=? " .
1250 "AND documents.foreign_id=? " .
1251 "ORDER BY documents.date DESC";
1252 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
1253 $limitCounter = 0; // limit to one entry per category
1254 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1255 $dateTimeDoc = $myrows4['date'];
1256 // remove time from datetime stamp
1257 $tempParse = explode(" ",$dateTimeDoc);
1258 $dateDoc = $tempParse[0];
1259 $idDoc = $myrows4['id'];
1260 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1261 htmlspecialchars($pid,ENT_QUOTES
) . "&document_id=" .
1262 htmlspecialchars($idDoc,ENT_QUOTES
) . "&as_file=true' onclick='top.restoreSession()'>" .
1263 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES
) . "</a> " .
1264 htmlspecialchars($dateDoc,ENT_NOQUOTES
);
1266 $limitCounter = $limitCounter +
1;
1267 $counterFlag = true;
1271 if (!$counterFlag) {
1272 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
1275 <?php
} // close advanced dir block
1277 // This is a feature for a specific client. -- Rod
1278 if ($GLOBALS['cene_specific']) {
1281 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$pid/demographics";
1282 $imagepath = "$web_root/sites/" . $_SESSION['site_id'] . "/documents/$pid/demographics";
1284 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
1285 "title='Click to attach patient image'>\n";
1286 if (is_file("$imagedir/photo.jpg")) {
1287 echo " <img src='$imagepath/photo.jpg' /></a>\n";
1289 echo " Attach Patient Image</a><br />\n";
1291 echo " <br /> <br />\n";
1293 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
1294 "title='Click to attach fingerprint'>\n";
1295 if (is_file("$imagedir/fingerprint.jpg")) {
1296 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
1298 echo " Attach Biometric Fingerprint</a><br />\n";
1300 echo " <br /> <br />\n";
1303 // This stuff only applies to athletic team use of OpenEMR. The client
1304 // insisted on being able to quickly change fitness and return date here:
1306 if (false && $GLOBALS['athletic_team']) {
1307 // blue green yellow red orange
1308 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
1309 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
1310 $fitcolor = $fitcolors[0];
1311 $form_fitness = $_POST['form_fitness'];
1312 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
1313 $form_issue_id = $_POST['form_issue_id'];
1315 $returndate = $form_userdate1 ?
"'$form_userdate1'" : "NULL";
1316 sqlStatement("UPDATE patient_data SET fitness = ?, " .
1317 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
1318 // Update return date in the designated issue, if requested.
1319 if ($form_issue_id) {
1320 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
1321 "id = ?", array($returndate, $form_issue_id) );
1324 $form_fitness = $result['fitness'];
1325 if (! $form_fitness) $form_fitness = 1;
1326 $form_userdate1 = $result['userdate1'];
1328 $fitcolor = $fitcolors[$form_fitness - 1];
1329 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
1330 echo " <span class='bold'>Fitness to Play:</span><br />\n";
1331 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
1332 $res = sqlStatement("SELECT * FROM list_options WHERE " .
1333 "list_id = 'fitness' ORDER BY seq");
1334 while ($row = sqlFetchArray($res)) {
1335 $key = $row['option_id'];
1336 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES
) . "'";
1337 if ($key == $form_fitness) echo " selected";
1338 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES
) . "</option>\n";
1340 echo " </select>\n";
1341 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
1342 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
1343 "value='$form_userdate1' " .
1344 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES
) . "' " .
1345 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
1346 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
1347 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
1348 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES
) . "'>\n";
1349 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES
) . "' />\n";
1350 echo " <input type='hidden' name='form_issue_id' value='' />\n";
1351 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
1355 // Show current and upcoming appointments.
1356 if (isset($pid) && !$GLOBALS['disable_calendar']) {
1358 $current_date2 = date('Y-m-d');
1360 $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
1361 if($apptNum != 0) $apptNum2 = abs($apptNum);
1362 else $apptNum2 = 10;
1363 $events = fetchNextXAppts($current_date2, $pid, $apptNum2);
1364 $events = sortAppointments($events);
1367 // Show Clinical Reminders for any user that has rules that are permitted.
1368 $clin_rem_check = resolve_rules_sql('','0',TRUE,'',$_SESSION['authUser']);
1369 if ( (!empty($clin_rem_check)) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) {
1370 // clinical summary expand collapse widget
1371 $widgetTitle = xl("Clinical Reminders");
1372 $widgetLabel = "clinical_reminders";
1373 $widgetButtonLabel = xl("Edit");
1374 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;;
1375 $widgetButtonClass = "";
1376 $linkMethod = "html";
1377 $bodyClass = "summary_item small";
1379 $fixedWidth = false;
1380 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1382 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1386 // appointments expand collapse widget
1387 $widgetTitle = xl("Appointments");
1388 $widgetLabel = "appointments";
1389 $widgetButtonLabel = xl("Add");
1390 $widgetButtonLink = "return newEvt();";
1391 $widgetButtonClass = "";
1392 $linkMethod = "javascript";
1393 $bodyClass = "summary_item small";
1394 $widgetAuth = $resNotNull; // $resNotNull refects state of query (appts) in fetchAppointments()
1395 $fixedWidth = false;
1396 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1398 foreach($events as $row) { //////
1400 $dayname = date("D", strtotime($row['pc_eventDate'])); //////
1402 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
1403 $dispmin = substr($row['pc_startTime'], 3, 2);
1404 if ($disphour >= 12) {
1406 if ($disphour > 12) $disphour -= 12;
1408 $etitle = xl('(Click to edit)');
1409 if ($row['pc_hometext'] != "") {
1410 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1413 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']),ENT_QUOTES
) . ', ' . htmlspecialchars($row['pc_eid'],ENT_QUOTES
) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES
) . "'>";
1415 echo "<b>" . htmlspecialchars($row['pc_eventDate'] . " (" . xl($dayname),ENT_NOQUOTES
) . ")</b><br>";
1416 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm),ENT_NOQUOTES
) . " ";
1417 if ($row['pc_recurrtype']) echo "<img src='" . $GLOBALS['webroot'] . "/interface/main/calendar/modules/PostCalendar/pntemplates/default/images/repeating8.png' border='0' style='margin:0px 2px 0px 2px;' title='".htmlspecialchars(xl("Repeating event"),ENT_QUOTES
)."' alt='".htmlspecialchars(xl("Repeating event"),ENT_QUOTES
)."'>";
1418 echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . "'> ( " . htmlspecialchars($row['pc_apptstatus'],ENT_NOQUOTES
) . " )</span>";
1419 if ($row['pc_hometext']) echo "<font color='green'> CMT</font>";
1420 echo "<br>" . htmlspecialchars(xl_appt_category($row['pc_catname']),ENT_NOQUOTES
) . "<br>\n";
1421 echo htmlspecialchars($row['ufname'] . " " . $row['ulname'],ENT_NOQUOTES
) . "</a><br>\n";
1423 if ($resNotNull) { //////
1425 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
1431 // Show PAST appointments.
1432 // added by Terry Hill to allow reverse sorting of the appointments
1434 if ($GLOBALS['num_past_appointments_to_show'] < 0) {
1435 $direction = "DESC";
1436 ($showpast = -1 * $GLOBALS['num_past_appointments_to_show'] );
1440 $showpast = $GLOBALS['num_past_appointments_to_show'];
1443 if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0) {
1444 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1445 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1446 "c.pc_catname, e.pc_apptstatus " .
1447 "FROM openemr_postcalendar_events AS e, users AS u, " .
1448 "openemr_postcalendar_categories AS c WHERE " .
1449 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1450 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1451 "ORDER BY e.pc_eventDate $direction , e.pc_startTime DESC " .
1452 "LIMIT " . $showpast;
1454 $pres = sqlStatement($query, array($pid) );
1456 // appointments expand collapse widget
1457 $widgetTitle = xl("Past Appoinments");
1458 $widgetLabel = "past_appointments";
1459 $widgetButtonLabel = '';
1460 $widgetButtonLink = '';
1461 $widgetButtonClass = '';
1462 $linkMethod = "javascript";
1463 $bodyClass = "summary_item small";
1464 $widgetAuth = false; //no button
1465 $fixedWidth = false;
1466 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1468 while($row = sqlFetchArray($pres)) {
1470 $dayname = date("l", strtotime($row['pc_eventDate']));
1472 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
1473 $dispmin = substr($row['pc_startTime'], 3, 2);
1474 if ($disphour >= 12) {
1476 if ($disphour > 12) $disphour -= 12;
1478 if ($row['pc_hometext'] != "") {
1479 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1481 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES
) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES
) . "'>";
1482 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES
) . "</b>" . xlt("Status") . "(";
1483 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1484 echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " ";
1485 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES
) . "</a><br>\n";
1487 if (isset($pres) && $res != null) {
1489 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
1494 // END of past appointments
1499 <div id
='stats_div'>
1501 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
1506 <?php
// TRACK ANYTHING -----
1508 // Determine if track_anything form is in use for this site.
1509 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
1510 "directory = 'track_anything' AND state = 1");
1511 $track_is_registered = $tmp['count'];
1512 if($track_is_registered){
1514 // track_anything expand collapse widget
1515 $widgetTitle = xl("Tracks");
1516 $widgetLabel = "track_anything";
1517 $widgetButtonLabel = xl("Tracks");
1518 $widgetButtonLink = "../../forms/track_anything/create.php";
1519 $widgetButtonClass = "";
1520 $widgetAuth = ""; // don't show the button
1521 $linkMethod = "html";
1522 $bodyClass = "notab";
1523 // check to see if any tracks exist
1524 $spruch = "SELECT id " .
1528 $existTracks = sqlQuery($spruch, array($pid, "track_anything") );
1530 $fixedWidth = false;
1531 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1532 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1533 $widgetAuth, $fixedWidth);
1536 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
1540 <?php
} // end track_anything ?>
1543 </div
> <!-- end right column div
-->
1550 </div
> <!-- end main content div
-->
1552 <?php
if (false && $GLOBALS['athletic_team']) { ?
>
1553 <script language
='JavaScript'>
1554 Calendar
.setup({inputField
:"form_userdate1", ifFormat
:"%Y-%m-%d", button
:"img_userdate1"});
1557 <script language
='JavaScript'>
1558 // Array of skip conditions for the checkSkipConditions() function.
1560 <?php
echo $condition_str; ?
>
1562 checkSkipConditions();