2 require_once("../../globals.php");
3 require_once("$srcdir/patient.inc");
4 require_once("$srcdir/acl.inc");
5 require_once("$srcdir/classes/Address.class.php");
6 require_once("$srcdir/classes/InsuranceCompany.class.php");
7 require_once("./patient_picture.php");
8 require_once("$srcdir/options.inc.php");
9 if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) {
10 include_once("$srcdir/pid.inc");
11 setpid($_GET['set_pid']);
14 function print_as_money($money) {
15 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
16 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
17 $ccheck = strrev($tmp);
18 if ($ccheck[0] == ",") {
19 $tmp = substr($ccheck,1,strlen($ccheck)-1);
21 if ($moneymatches[2] != "") {
22 return "$ " . strrev($tmp) . "." . $moneymatches[2];
24 return "$ " . strrev($tmp);
31 <?php
html_header_show();?
>
32 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
33 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
34 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
35 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
36 <script type
="text/javascript" src
="../../../library/dynarch_calendar_en.js"></script
>
37 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
38 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
39 <script language
="JavaScript">
41 var mypcc
= '<? echo $GLOBALS['phone_country_code
'] ?>';
43 function oldEvt(eventid
) {
44 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid
, '_blank', 550, 270);
47 function refreshme() {
52 // Process click on Delete link.
54 dlgopen('../deleter.php?patient=<?php echo $pid ?>', '_blank', 500, 450);
58 // Called by the deleteme.php window on a successful delete.
59 function imdeleted() {
60 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
61 parent
.left_nav
.clearPatient();
64 top
.location
.href
= '../main/main_screen.php';
69 var f
= document
.forms
[0];
71 if ($GLOBALS['athletic_team']) {
72 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
73 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
74 "pid = '$pid' AND enddate IS NULL ORDER BY begdate DESC LIMIT 1");
77 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo addslashes($irow['title
']) ?>"?')) {
78 f
.form_issue_id
.value
= '<?php echo $irow['id
'] ?>';
80 alert('OK, you will need to manually update the return date in any affected issue(s).');
83 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
87 } // end athletic team
95 <body
class="body_top">
97 $patient_pics = pic_array();
98 foreach ($patient_pics as $var) {
103 $result = getPatientData($pid);
104 $result2 = getEmployerData($pid);
106 $thisauth = acl_check('patients', 'demo');
108 if ($result['squad'] && ! acl_check('squads', $result['squad']))
113 echo "<p>(" . xl('Demographics not authorized') . ")</p>\n";
114 echo "</body>\n</html>\n";
118 if ($thisauth == 'write') {
119 echo "<p><a href='demographics_full.php'";
120 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
121 echo " onclick='top.restoreSession()'><span class='title'>" .
122 xl('Demographics') . "</span>" .
123 " <span class='more'>$tmore</span></a>";
124 if (acl_check('admin', 'super')) {
125 echo " <a href='' onclick='return deleteme()'>" .
126 "<span class='more' style='color:red'>(".xl('Delete').")</span></a>";
131 // Get the document ID of the patient ID card if access to it is wanted here.
133 if ($GLOBALS['patient_id_category_name']) {
134 $tmp = sqlQuery("SELECT d.id, d.date, d.url FROM " .
135 "documents AS d, categories_to_documents AS cd, categories AS c " .
136 "WHERE d.foreign_id = $pid " .
137 "AND cd.document_id = d.id " .
138 "AND c.id = cd.category_id " .
139 "AND c.name LIKE '" . $GLOBALS['patient_id_category_name'] . "' " .
140 "ORDER BY d.date DESC LIMIT 1");
141 if ($tmp) $document_id = $tmp['id'];
145 <table border
="0" width
="100%">
147 <!-- Left column of main table
; contains another table
-->
148 <td align
="left" valign
="top">
150 <table border
='0' cellpadding
='0'>
151 <?php
display_layout_rows('DEM', $result, $result2); ?
>
155 <table border
='0' cellpadding
='0' width
='100%'>
157 ///////////////////////////////// INSURANCE SECTION
159 foreach (array('primary','secondary','tertiary') as $instype) {
160 $enddate = 'Present';
162 $query = "SELECT * FROM insurance_data WHERE " .
163 "pid = '$pid' AND type = '$instype' " .
164 "ORDER BY date DESC";
165 $res = sqlStatement($query);
166 while ($row = sqlFetchArray($res)) {
167 if ($row['provider']) {
168 $icobj = new InsuranceCompany($row['provider']);
169 $adobj = $icobj->get_address();
170 $insco_name = trim($icobj->get_name());
173 <td valign
='top' colspan
='3'>
174 <br
><span
class='bold'>
175 <?php
if (strcmp($enddate, 'Present') != 0) echo "Old "; ?
>
176 <?php
xl(ucfirst($instype) . ' Insurance','e'); ?
>
177 <?php
if (strcmp($row['date'], '0000-00-00') != 0) { ?
>
178 <?php
xl(' from','e'); echo ' ' . $row['date']; ?
>
180 <?php
xl(' until ','e'); echo $enddate; ?
>
189 echo $insco_name . '<br>';
190 if (trim($adobj->get_line1())) {
191 echo $adobj->get_line1() . '<br>';
192 echo $adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip();
195 echo "<font color='red'><b>Unassigned</b></font>";
199 <?php
xl('Policy Number','e'); ?
>: <?php
echo $row['policy_number'] ?
><br
>
200 Plan Name
: <?php
echo $row['plan_name']; ?
><br
>
201 Group Number
: <?php
echo $row['group_number']; ?
></span
>
204 <span
class='bold'><?php
xl('Subscriber','e'); ?
>: </span
><br
>
205 <span
class='text'><?php
echo $row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'] ?
>
207 if ($row['subscriber_relationship'] != "") {
208 echo "(" . $row['subscriber_relationship'] . ")";
212 S
.S
.: <?php
echo $row['subscriber_ss']; ?
><br
>
213 <?php
xl('D.O.B.','e'); ?
>:
214 <?php
if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo $row['subscriber_DOB']; ?
><br
>
215 Phone
: <?php
echo $row['subscriber_phone'] ?
>
219 <span
class='bold'><?php
xl('Subscriber Address','e'); ?
>: </span
><br
>
220 <span
class='text'><?php
echo $row['subscriber_street']; ?
><br
>
221 <?php
echo $row['subscriber_city']; ?
>
222 <?php
if($row['subscriber_state'] != "") echo ", "; echo $row['subscriber_state']; ?
>
223 <?php
if($row['subscriber_country'] != "") echo ", "; echo $row['subscriber_country']; ?
>
224 <?php
echo " " . $row['subscriber_postal_code']; ?
></span
>
226 <?php
if (trim($row['subscriber_employer'])) { ?
>
227 <br
><span
class='bold'><?php
xl('Subscriber Employer','e'); ?
>: </span
><br
>
228 <span
class='text'><?php
echo $row['subscriber_employer']; ?
><br
>
229 <?php
echo $row['subscriber_employer_street']; ?
><br
>
230 <?php
echo $row['subscriber_employer_city']; ?
>
231 <?php
if($row['subscriber_employer_city'] != "") echo ", "; echo $row['subscriber_employer_state']; ?
>
232 <?php
if($row['subscriber_employer_country'] != "") echo ", "; echo $row['subscriber_employer_country']; ?
>
233 <?php
echo " " . $row['subscriber_employer_postal_code']; ?
>
241 <?php
if ($row['copay'] != "") { ?
>
242 <span
class='bold'><?php
xl('CoPay','e'); ?
>: </span
>
243 <span
class='text'><?php
echo $row['copay']; ?
></span
>
246 <span
class='bold'><?php
xl('Accept Assignment','e'); ?
>:</span
>
247 <span
class='text'><?php
if($row['accept_assignment'] == "TRUE") echo "YES"; ?
>
248 <?php
if($row['accept_assignment'] == "FALSE") echo "NO"; ?
></span
>
250 <td valign
='top'></td
>
251 <td valign
='top'></td
>
254 } // end if ($row['provider'])
255 $enddate = $row['date'];
259 ///////////////////////////////// END INSURANCE SECTION
265 <!-- Right column of main table
-->
267 <td valign
="top" class="text">
270 // This stuff only applies to athletic team use of OpenEMR. The client
271 // insisted on being able to quickly change fitness and return date here:
273 if ($GLOBALS['athletic_team']) {
274 // blue green yellow red orange
275 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
276 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
277 $fitcolor = $fitcolors[0];
278 $form_fitness = $_POST['form_fitness'];
279 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
280 $form_issue_id = $_POST['form_issue_id'];
282 $returndate = $form_userdate1 ?
"'$form_userdate1'" : "NULL";
283 sqlStatement("UPDATE patient_data SET fitness = '$form_fitness', " .
284 "userdate1 = $returndate WHERE pid = '$pid'");
285 // Update return date in the designated issue, if requested.
286 if ($form_issue_id) {
287 sqlStatement("UPDATE lists SET returndate = $returndate WHERE " .
288 "id = '$form_issue_id'");
291 $form_fitness = $result['fitness'];
292 if (! $form_fitness) $form_fitness = 1;
293 $form_userdate1 = $result['userdate1'];
295 $fitcolor = $fitcolors[$form_fitness - 1];
296 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
297 echo " <span class='bold'>Fitness to Play:</span><br />\n";
298 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
299 $res = sqlStatement("SELECT * FROM list_options WHERE " .
300 "list_id = 'fitness' ORDER BY seq");
301 while ($row = sqlFetchArray($res)) {
302 $key = $row['option_id'];
303 echo " <option value='$key'";
304 if ($key == $form_fitness) echo " selected";
305 echo ">" . $row['title'] . "</option>\n";
308 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
309 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
310 "value='$form_userdate1' " .
311 "title='" . xl('yyyy-mm-dd Date of return to play') . "' " .
312 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
313 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
314 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
315 "title='" . xl('Click here to choose a date') . "'>\n";
316 echo " <input type='hidden' name='form_original_userdate1' value='$form_userdate1' />\n";
317 echo " <input type='hidden' name='form_issue_id' value='' />\n";
318 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
322 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
323 // Show current balance and billing note, if any.
324 echo "<span class='bold'><font color='#ee6600'>Balance Due: $" .
325 get_patient_balance($pid) . "</font><br />";
326 if ($result['genericname2'] == 'Billing') {
327 xl('Billing Note') . ":";
328 echo "<span class='bold'><font color='red'>" .
329 $result['genericval2'] . "</font></span>";
331 echo "</span><br />";
334 // If there is a patient ID card, then show a link to it.
336 echo "<a href='" . $web_root . "/controller.php?document&retrieve" .
337 "&patient_id=$pid&document_id=$document_id' style='color:#00cc00' " .
338 "onclick='top.restoreSession()'>Click for ID card</a><br />";
341 // Show current and upcoming appointments.
343 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
344 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname " .
345 "FROM openemr_postcalendar_events AS e, users AS u WHERE " .
346 "e.pc_pid = '$pid' AND e.pc_eventDate >= CURRENT_DATE AND " .
348 "ORDER BY e.pc_eventDate, e.pc_startTime";
349 $res = sqlStatement($query);
351 if (isset($res) && $res != null) {
352 echo "<div id='appts'><span id='apptstitle'>Upcoming Appointments</span><br>";
354 while($row = sqlFetchArray($res)) {
355 $dayname = date("l", strtotime($row['pc_eventDate']));
357 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
358 $dispmin = substr($row['pc_startTime'], 3, 2);
359 if ($disphour >= 12) {
361 if ($disphour > 12) $disphour -= 12;
363 $etitle = "(Click to edit)";
364 if ($row['pc_hometext'] != "") {
365 $etitle = "Comments: ".addslashes($row['pc_hometext'])."\r\n".$etitle;
367 echo "<a href='javascript:oldEvt(" . $row['pc_eid'] . ")' title='$etitle'>";
368 echo "<b>$dayname, " . $row['pc_eventDate'] . "</b><br>";
369 echo "$disphour:$dispmin $dispampm " . $row['pc_title'] . "<br>\n";
370 echo $row['fname'] . " " . $row['lname'] . "</a><br> <br>\n";
372 if (isset($res) && $res != null) { echo "</div>"; }
380 <?php
if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?
>
381 <script language
='JavaScript'>
382 parent
.left_nav
.setPatient(<?php
echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',$pid,'" . addslashes($result['pubpid']) . "',''"; ?
>);
383 parent
.left_nav
.setRadio(window
.name
, 'dem');
384 <?php
if (!$_GET['is_new']) { // if new pt, do not load other frame ?>
385 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
386 parent
.left_nav
.forceDual();
387 parent
.left_nav
.setRadio(othername
, 'sum');
388 parent
.left_nav
.loadFrame('sum1', othername
, 'patient_file/summary/summary_bottom.php');
393 <?php
if ($GLOBALS['athletic_team']) { ?
>
394 <script language
='JavaScript'>
395 Calendar
.setup({inputField
:"form_userdate1", ifFormat
:"%Y-%m-%d", button
:"img_userdate1"});