phpgacl implementation updates
[openemr.git] / interface / patient_file / summary / demographics.php
blobe8aee303b36cac3b694ab4286f0bfde3ae9158fd
1 <?
2 include_once("../../globals.php");
3 include_once("$srcdir/patient.inc");
4 include_once("$srcdir/acl.inc");
5 ?>
6 <html>
8 <head>
9 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
10 </head>
12 <body <?echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
15 $thisauth = acl_check('patients', 'demo');
17 if (!$thisauth) {
18 echo "<p>(Demographics not authorized)</p>\n";
19 echo "</body>\n</html>\n";
20 exit();
23 if ($thisauth == 'write') {
24 echo "<p><a href='demographics_full.php' target='Main'>" .
25 "<font class='title'>Demographics</font>" .
26 "<font class='more'>$tmore</font></a></p>\n";
30 <table border="0" width="100%">
31 <tr>
32 <td align="left" valign="top">
33 <table border='0' cellpadding='0' width='100%'>
35 $result = getPatientData($pid);
36 $result2 = getEmployerData($pid);
38 <tr>
39 <td valign='top'>
40 <span class='bold'>Name: </span><span class='text'><?echo $result{"title"}?> <?echo $result{"fname"}?> <?echo $result{"mname"}?> <?echo $result{"lname"}?></span><br>
41 <span class='bold'>Number: </span><span class='text'><?echo $result{"pubpid"}?></span>
42 </td>
43 <td valign='top'>
45 if ($result{"DOB"} && $result{"DOB"} != "0000-00-00") {
47 <span class='bold'>DOB: </span>
48 <span class='text'>
50 echo $result{"DOB"};
53 </span>
54 </td>
55 <td valign='top'><? if ($result{"sex"} != ""){?><span class='bold'>Sex: </span><?}?><span class='text'><?echo $result{"sex"}?></span></td>
56 <td valign='top'><? if ($result{"ss"} != "") {?><span class='bold'>S.S.: </span><?}?><span class='text'><?echo $result{"ss"}?></span></td>
57 </tr>
58 <tr>
59 <td valign='top'>
60 <? if (($result{"street"} != "") || ($result{"city"} != "") || ($result{"state"} != "") || ($result{"country_code"} != "") || ($result{"postal_code"} != "")) {?>
61 <span class='bold'>Address: </span>
62 <?}?>
63 <br><span class='text'><?echo $result{"street"}?><br><?echo $result{"city"}?><?if($result{"city"} != ""){echo ", ";}?><?echo $result{"state"};?>
64 <? if($result{"country_code"} != ""){ echo ", "; }?><?echo $result{"country_code"}?>
65 <?echo " ";
66 echo $result{"postal_code"}?>
67 </span>
68 </td>
69 <td valign='top'>
71 if ( ($result{"contact_relationship"} != "") ||
72 ($result{"phone_contact"} != "") ||
73 ($result{"phone_home"} != "") ||
74 ($result{"phone_biz"} != "") ||
75 ($result{"email"} != "") ||
76 ($result{"phone_cell"} != "") ){
78 <span class='bold'>Emergency Contact: </span><?}?><span class='text'><?echo $result{"contact_relationship"}?><?echo " "?>
80 if ($result{"phone_contact"} != "") {
81 echo " " . $result{"phone_contact"};
83 if ($result{"phone_home"} != "") {
84 echo "<br>Home: ";
85 echo $result{"phone_home"};
87 if ($result{"phone_biz"} != "") {
88 echo "<br>Work: ";
89 echo $result{"phone_biz"};
91 if ($result{"phone_cell"} != "") {
92 echo "<br>Mobile: ";
93 echo $result{"phone_cell"};
95 if ($result{"email"} != "") {
96 echo "<br>Email: </span>";
97 echo '<a class=link_submit href="mailto:' . $result{"email"} . '">' . $result{"email"} . '</a>';
100 </td>
101 <td valign='top'>
103 if ($result{"status"} != "") {
104 echo "<span class='bold'>Marital Status: </span>";
105 echo "<span class='text'>" . $result{"status"} . "</span>";
108 </td>
109 <td valign='top'></td>
110 </tr>
112 <? if (! $GLOBALS['athletic_team']) { ?>
113 <tr>
114 <td colspan='4' valign='top'>
116 $result{"hipaa_mail"}=='NO' ? $opt_out='DOES NOT ALLOW' : $opt_out='ALLOWS' ;
117 echo "<span class='text'>Patient $opt_out Mailed Information </span>";
119 </td>
120 </tr>
121 <tr>
122 <td colspan='4' valign='top'>
124 $result{"hipaa_voice"}=='NO' ? $opt_out='DOES NOT ALLOW' : $opt_out='ALLOWS' ;
125 echo "<span class='text'>Patient $opt_out Voice Messages </span>";
127 </td>
128 </tr>
129 <? } else { ?>
130 <tr>
131 <td colspan='4' valign='top'>
132 &nbsp;
133 </td>
134 </tr>
135 <? } ?>
137 <tr>
138 <td valign='top'>
139 <? if ($result{"occupation"} != "") {?><span class='bold'>Occupation: </span><span class='text'><?echo $result{"occupation"}?></span><br><?}?>
140 <? if ($result2{"name"} != "") {?><span class='bold'>Employer: </span><span class='text'><?echo $result2{"name"}?></span><?}?>
141 </td>
142 <td valign='top'>
143 <? if (($result2{"street"} != "") || ($result2{"city"} != "") || ($result2{"state"} != "") || ($result2{"country"} != "") || ($result2{"postal_code"} != "")) {?>
144 <span class='bold'>Employer Address:</span>
145 <? } ?>
146 <br>
147 <span class='text'>
148 <?echo $result2{"street"}?><br><?echo $result2{"city"}?><?if($result2{"city"} != ""){echo ", ";}?><?echo $result2{"state"}?>
149 <?if($result2{"country"} != ""){echo ", ";}?><?echo $result2{"country"}?>
150 <?if($result2{"postal_code"} != ""){echo " ";}?>
151 <?echo $result2{"postal_code"}?>
152 </span>
153 </td>
154 <td valign='top'>
156 // This stuff only applies to athletic team use of OpenEMR:
157 if ($GLOBALS['athletic_team']) {
158 $fitcolors = array('#00ff00', '#ffff00', '#ff8800', '#ff3333');
159 $fitcolor = $fitcolors[0];
160 $fitness = $_POST['form_fitness'];
161 if ($fitness) {
162 sqlStatement("UPDATE patient_data SET fitness = '$fitness' WHERE pid = '$pid'");
163 } else {
164 $fitness = $result['fitness'];
165 if (! $fitness) $fitness = 1;
167 $fitcolor = $fitcolors[$fitness - 1];
169 <form method='post' action='demographics.php'>
170 <span class='bold'>Fitness to Play:</span><br>
171 <select name='form_fitness' onchange='document.forms[0].submit()' style='background-color:<? echo $fitcolor ?>'>
172 <option value='1'<? if ($fitness == 1) echo ' selected' ?>>Full Play</option>
173 <option value='2'<? if ($fitness == 2) echo ' selected' ?>>Full Training</option>
174 <option value='3'<? if ($fitness == 3) echo ' selected' ?>>Restricted Training</option>
175 <option value='4'<? if ($fitness == 4) echo ' selected' ?>>Injured Out</option>
176 </select>
177 </form>
178 <? } ?>
179 </td>
180 <td valign='top'></td>
181 </tr>
182 <tr>
183 <td valign='top'>
184 <? if ($result{"ethnoracial"} != "") {?><span class='bold'>Race/Ethnicity: </span><span class='text'><?echo $result{"ethnoracial"};?></span><br><?}?>
185 <? if ($result{"language"} != "") {?><span class='bold'>Language: </span><span class='text'><?echo ucfirst($result{"language"});?></span><br><?}?>
186 <? if ($result{"interpretter"} != "") {?><span class='bold'>Interpretter: </span><span class='text'><?echo $result{"interpretter"};?></span><br><?}?>
187 <? if ($result{"family_size"} != "") {?><span class='bold'>Family Size: </span><span class='text'><?echo $result{"family_size"};?></span><br><?}?>
188 </td>
189 <td valign='top'>
191 function print_as_money($money) {
192 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
193 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
194 $ccheck = strrev($tmp);
195 if ($ccheck[0] == ",") {
196 $tmp = substr($ccheck,1,strlen($ccheck)-1);
198 if ($moneymatches[2] != "") {
199 return "$ " . strrev($tmp) . "." . $moneymatches[2];
200 } else {
201 return "$ " . strrev($tmp);
205 <? if ($result{"financial_review"} != "0000-00-00 00:00:00") {?><span class='bold'>Financial Review Date: </span><span class='text'><?echo date("n/j/Y",strtotime($result{"financial_review"}));?></span><br><?}?>
206 <? if ($result{"monthly_income"} != "") {?><span class='bold'>Monthly Income: </span><span class='text'><?echo print_as_money($result{"monthly_income"});?></span><br><?}?>
207 <? if ($result{"migrantseasonal"} != "") {?><span class='bold'>Migrant/Seasonal: </span><span class='text'><?echo $result{"migrantseasonal"};?></span><br><?}?>
208 <? if ($result{"homeless"} != "") {?><span class='bold'>Homeless, etc.: </span><span class='text'><?echo $result{"homeless"};?></span><br><?}?>
209 </td>
210 <td valign='top'>
211 <table>
212 <tr>
213 <td><? if ($result{"genericname1"} != "") {?><span class='bold'><?=$result{"genericname1"}?></span>:<?}?> </td>
214 <td><? if ($result{"genericval1"} != "") {?><span class='text'><?=$result{"genericval1"}?></span><?}?></td>
215 </tr>
216 <tr>
217 <td><? if ($result{"genericname2"} != "") {?><span class='bold'><?=$result{"genericname2"}?></span>:<?}?> </td>
218 <td><? if ($result{"genericval2"} != "") {?><span class='text'><?=$result{"genericval2"}?></span><?}?></td>
219 </tr>
220 </table>
221 </td>
222 <td valign='top'></td>
223 </tr>
224 <?php
225 //////////////////////////////////REFERRAL SECTION
226 if ($result{"referrer"} != "" || $result{"referrerID"} != "")
229 <tr>
230 <td valign='top'>
231 <span class='bold'>Primary Provider: </span><span class='text'><?=getProviderName($result['providerID'])?></span><br>
232 <!--<span class='bold'>Primary Provider ID: </span><span class='text'><?=$result{"referrerID"}?></span>-->
233 </td>
234 <td valign='top'></td>
235 <td valign='top'></td>
236 <td valign='top'></td>
237 </tr>
238 <?php
241 /////////////////////////////////INSURANCE SECTION
242 $result3 = getInsuranceData($pid, "primary");
243 if ($result3{"provider"}) {
245 <tr>
246 <td valign='top'>
247 <span class='bold'>Primary Insurance Provider:</span><br><span class='text'><?echo $result3{"provider_name"}?></span><br>
248 <span class='text'>Policy Number: <?echo $result3{"policy_number"}?><br>
249 Plan Name: <?=$result3{"plan_name"}?><br>
250 Group Number: <?echo $result3{"group_number"}?></span>
251 </td>
252 <td valign='top'>
253 <span class='bold'>Subscriber: </span><br><span class='text'><?=$result3{"subscriber_fname"}?> <?=$result3{"subscriber_mname"}?> <?=$result3{"subscriber_lname"}?> <?if ($result3{"subscriber_relationship"} != "") {echo "(".$result3{"subscriber_relationship"}.")";}?><br>
254 S.S.: <?echo $result3{"subscriber_ss"}?> D.O.B.: <?if ($result3{"subscriber_DOB"} != "0000-00-00 00:00:00") {echo $result3{"subscriber_DOB"};}?><br>
255 Phone: <? echo $result3{"subscriber_phone"}?>
256 </span>
257 </td>
258 <td valign='top'>
259 <span class='bold'>Subscriber Address: </span><br><span class='text'><?echo $result3{"subscriber_street"}?><br><?echo $result3{"subscriber_city"}?><?if($result3{"subscriber_state"} != ""){echo ", ";}?><?echo $result3{"subscriber_state"}?><?if($result3{"subscriber_country"} != ""){echo ", ";}?><?echo $result3{"subscriber_country"}?> <?echo " ".$result3{"subscriber_postal_code"}?></span>
260 </td>
261 <td valign='top'>
262 <span class='bold'>Subscriber Employer: </span><br><span class='text'><?echo $result3{"subscriber_employer"}?><br><?echo $result3{"subscriber_employer_street"}?><br><?echo $result3{"subscriber_employer_city"}?><?if($result3{"subscriber_employer_city"} != ""){echo ", ";}?><?echo $result3{"subscriber_employer_state"}?><?if($result3{"subscriber_employer_country"} != ""){echo ", ";}?><?echo $result3{"subscriber_employer_country"}?> <?echo " ".$result3{"subscriber_employer_postal_code"}?></span>
263 </td>
264 </tr>
265 <tr>
266 <td><? if ($result3{"copay"} != "") {?><span class='bold'>CoPay: </span><span class='text'><?=$result3{"copay"}?></span><?}?></td>
267 <td valign='top'></td>
268 <td valign='top'></td>
269 <td valign='top'></td>
270 </tr>
271 <? } ?>
273 $result4 = getInsuranceData($pid, "secondary");
274 if ($result4{"provider"} != "") {
276 <tr>
277 <td valign='top'>
278 <span class='bold'>Secondary Insurance Provider:</span><br><span class='text'><?echo $result4{"provider_name"}?></span><br>
279 <span class='text'>Policy Number: <?echo $result4{"policy_number"}?><br>
280 Plan Name: <?=$result4{"plan_name"}?><br>
281 Group Number: <?echo $result4{"group_number"}?></span>
282 </td>
283 <td valign='top'>
284 <span class='bold'>Subscriber: </span><br><span class='text'><?=$result4{"subscriber_fname"}?> <?=$result4{"subscriber_mname"}?> <?=$result4{"subscriber_lname"}?> <?if ($result4{"subscriber_relationship"} != "") {echo "(".$result4{"subscriber_relationship"}.")";}?><br>
285 S.S.: <?echo $result4{"subscriber_ss"}?> D.O.B.: <?if ($result4{"subscriber_DOB"} != "0000-00-00 00:00:00") {echo $result4{"subscriber_DOB"};}?><br>
286 Phone: <? echo $result4{"subscriber_phone"}?>
287 </span>
288 </td>
289 <td valign='top'>
290 <span class='bold'>Subscriber Address: </span><br><span class='text'><?echo $result4{"subscriber_street"}?><br><?echo $result4{"subscriber_city"}?><?if($result4{"subscriber_state"} != ""){echo ", ";}?><?echo $result4{"subscriber_state"}?><?if($result4{"subscriber_country"} != ""){echo ", ";}?><?echo $result4{"subscriber_country"}?> <?echo " ".$result4{"subscriber_postal_code"}?></span>
291 </td>
292 <td valign='top'>
293 <span class='bold'>Subscriber Employer: </span><br><span class='text'><?echo $result4{"subscriber_employer"}?><br><?echo $result4{"subscriber_employer_street"}?><br><?echo $result4{"subscriber_employer_city"}?><?if($result4{"subscriber_employer_city"} != ""){echo ", ";}?><?echo $result4{"subscriber_employer_state"}?><?if($result4{"subscriber_employer_country"} != ""){echo ", ";}?><?echo $result4{"subscriber_employer_country"}?> <?echo " ".$result4{"subscriber_employer_postal_code"}?></span>
294 </td>
295 </tr>
296 <tr>
297 <td>
298 <? if ($result4{"copay"} != "") {?><span class='bold'>CoPay: </span><span class='text'><?=$result4{"copay"}?></span><?}?>
299 </td>
300 <td valign='top'></td>
301 <td valign='top'></td>
302 <td valign='top'></td>
303 </tr>
304 <? } ?>
306 $result5 = getInsuranceData($pid, "tertiary");
307 if ($result5{"provider"}) {
309 <tr>
310 <td valign='top'>
311 <span class='bold'>Tertiary Insurance Provider:</span><br><span class='text'><?echo $result5{"provider_name"}?></span><br>
312 <span class='text'>Policy Number: <?echo $result5{"policy_number"}?><br>
313 Plan Name: <?=$result5{"plan_name"}?><br>
314 Group Number: <?echo $result5{"group_number"}?></span>
315 </td>
316 <td valign='top'>
317 <span class='bold'>Subscriber: </span><br><span class='text'><?=$result5{"subscriber_fname"}?> <?=$result5{"subscriber_mname"}?> <?=$result5{"subscriber_lname"}?> <?if ($result5{"subscriber_relationship"} != "") {echo "(".$result5{"subscriber_relationship"}.")";}?><br>
318 S.S.: <?echo $result5{"subscriber_ss"}?> D.O.B.: <?if ($result5{"subscriber_DOB"} != "0000-00-00 00:00:00") {echo $result5{"subscriber_DOB"};}?><br>
319 Phone: <? echo $result5{"subscriber_phone"}?>
320 </span>
321 </td>
322 <td valign='top'>
323 <span class='bold'>Subscriber Address: </span><br><span class='text'><?echo $result5{"subscriber_street"}?><br><?echo $result5{"subscriber_city"}?><?if($result5{"subscriber_state"} != ""){echo ", ";}?><?echo $result5{"subscriber_state"}?><?if($result5{"subscriber_country"} != ""){echo ", ";}?><?echo $result5{"subscriber_country"}?> <?echo " ".$result5{"subscriber_postal_code"}?></span>
324 </td>
325 <td valign='top'>
326 <span class='bold'>Subscriber Employer: </span><br><span class='text'><?echo $result5{"subscriber_employer"}?><br><?echo $result5{"subscriber_employer_street"}?><br><?echo $result5{"subscriber_employer_city"}?><?if($result5{"subscriber_employer_city"} != ""){echo ", ";}?><?echo $result5{"subscriber_employer_state"}?><?if($result5{"subscriber_employer_country"} != ""){echo ", ";}?><?echo $result5{"subscriber_employer_country"}?> <?echo " ".$result5{"subscriber_employer_postal_code"}?></span>
327 </td>
328 </tr>
329 <tr>
330 <td>
331 <? if ($result5{"copay"} != "") {?><span class='bold'>CoPay: </span><span class='text'><?=$result5{"copay"}?></span><?}?>
332 </td>
333 <td valign='top'></td>
334 <td valign='top'></td>
335 <td valign='top'></td>
336 </tr>
340 </table>
341 </td>
342 <td align="right" valign="top">
343 <?php
344 // I can't believe this crap. It generates a whole new document with
345 // <html> tag and everything, and then terminates our script prematurely!
346 // So I disabled it. BTW the comments below re postnuke are not mine.
347 // -- Rod 2005-06-16
349 if (false && isset($pid)) { // was: if (isset($pid)) {
350 //postnuke doesn't make it easy to set globals/get/post
351 //didn't want to use an ifram here so I had to fake a page
352 //load environment by setting the things that would have
353 //been passed in the querystring
355 include_once("$srcdir/calendar.inc");
357 unset($func);
358 unset($module);
359 unset($Date);
360 $_GET['module'] = "PostCalendar";
361 $_GET['func'] = "search";
362 $_GET['Date'] = pc_getDate();
363 $_GET['no_nav'] = 2;
364 $_GET['patient_id'] = intval($pid);
365 $_GET['submit'] = "listapps";
366 global $func,$Date,$module;
367 $module = "PostCalendar";
368 $func = "search";
369 $Date = $_GET['Date'];
370 $submit = "listapps";
371 $no_nav = 2;
372 $patient_id = $_GET['patient_id'];
374 //now that the environment is set, include the page, it will
375 //behave as though it was loaded in an iframe with the querystring
376 //variables set
377 chdir("../../main/calendar");
378 include("index.php");
381 </td>
382 </tr>
383 </table>
385 </body>
386 </html>