2 include_once("../../globals.php");
3 include_once("$srcdir/patient.inc");
5 $patient = $_REQUEST['patient'];
6 $findBy = $_REQUEST['findBy'];
7 $MAXSHOW = 500; // maximum number of results to display at once
9 // this is a quick fix so it doesn't go to thousands records.
10 // the searching functions on patient.inc need improvement.
11 if ($patient=='') $patient=xl('Please enter some information','e');
16 <?php
html_header_show();?
>
18 <link rel
=stylesheet href
="<?php echo $css_header;?>" type
="text/css">
28 background
-color
: #ddddff;
32 #searchResultsHeader {
34 background
-color
: lightgrey
;
36 #searchResultsHeader table {
37 width
: 96%
; /* not 100% because the 'searchResults' table has a scrollbar */
38 border
-collapse
: collapse
;
40 #searchResultsHeader th {
49 .srName
{ width
: 12%
; }
50 .srPhone
{ width
: 11%
; }
55 .srNumEnc
{ width
: 11%
; }
56 .srNumDays
{ width
: 11%
; }
57 .srDateLast
{ width
: 11%
; }
58 .srDateNext
{ width
: 11%
; }
60 #searchResults table {
62 border
-collapse
: collapse
;
63 background
-color
: white
;
71 border
-bottom
: 1px solid
#eee;
74 .billing
{ color
: red
; font
-weight
: bold
; }
78 padding
: 1px
1px
10px
1px
;
81 background
-color
: #fc0;
86 padding
: 1px
1px
10px
1px
;
89 background
-color
: #9f6;
92 background
-color
: #336699;
97 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.2.2.min.js"></script
>
100 <body
class="body_top">
101 <a href
="./patient_select_help.php" target
=_new
>[Help
] 
</a
>
104 //the maximum number of patient records to display:
105 $sqllimit = $MAXSHOW;
107 if ($findBy == "Last")
108 $result = getPatientLnames("$patient","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", "lname ASC, fname ASC", $sqllimit);
109 else if ($findBy == "ID")
110 $result = getPatientId("$patient","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", "lname ASC, fname ASC", $sqllimit);
111 else if ($findBy == "DOB")
112 $result = getPatientDOB("$patient","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", "lname ASC, fname ASC", $sqllimit);
113 else if ($findBy == "SSN")
114 $result = getPatientSSN("$patient","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", "lname ASC, fname ASC", $sqllimit);
115 elseif ($findBy == "Phone") //(CHEMED) Search by phone number
116 $result = getPatientPhone("$patient","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", "lname ASC, fname ASC", $sqllimit);
119 <?php
if ($GLOBALS['PATIENT_INC_COUNT'] > $MAXSHOW): ?
>
120 <span id
="tooManyResults">
122 <span id
="howManyResults">
124 <?php
echo "Showing " . count($result) . " of " . $GLOBALS['PATIENT_INC_COUNT'] . " records found."; ?
></span
>
128 <div id
="searchResultsHeader">
131 <th
class="srName"><?php
xl('Name','e');?
></th
>
132 <th
class="srPhone"><?php
xl('Phone','e');?
></th
>
133 <th
class="srSS"><?php
xl('SS','e');?
></th
>
134 <th
class="srDOB"><?php
xl('DOB','e');?
></th
>
135 <th
class="srID"><?php
xl('ID','e');?
></th
>
136 <th
class="srPID"><?php
xl('PID','e');?
></th
>
137 <th
class="srNumEnc"><?php
xl('[Number Of Encounters]','e');?
></th
>
138 <th
class="srNumDays"><?php
xl('[Days Since Last Encounter]','e');?
></th
>
139 <th
class="srDateLast"><?php
xl('[Date of Last Encounter]','e');?
></th
>
140 <th
class="srDateNext">
143 if (preg_match('/^(\d+)\s*(.*)/',$patient,$matches) > 0) {
144 $add_days = $matches[1];
145 $patient = $matches[2];
148 [<?php
echo $add_days?
> Days From Last Encounter
]
154 <div id
="searchResults">
160 foreach ($result as $iter) {
161 echo "<tr class='oneresult' id='".$iter['pid']."'>";
162 echo "<td class='srName'>" . $iter['lname'] . ", " . $iter['fname'] . "</td>\n";
163 //other phone number display setup for tooltip
165 if ($iter{"phone_biz"} != "") {
166 $phone_biz = " [business phone ".$iter{"phone_biz"}."] ";
169 if ($iter{"phone_contact"} != "") {
170 $phone_contact = " [contact phone ".$iter{"phone_contact"}."] ";
173 if ($iter{"phone_cell"} != "") {
174 $phone_cell = " [cell phone ".$iter{"phone_cell"}."] ";
176 $all_other_phones = $phone_biz.$phone_contact.$phone_cell;
177 if ($all_other_phones == '') {$all_other_phones = 'No other phone numbers listed';}
178 //end of phone number display setup, now display the phone number(s)
179 echo "<td class='srPhone' title='$all_other_phones'>" . $iter['phone_home']. "</td>\n";
180 echo "<td class='srSS'>" . $iter['ss'] . "</td>";
181 if ($iter{"DOB"} != "0000-00-00 00:00:00") {
182 echo "<td class='srDOB'>" . $iter['DOB_TS'] . "</td>";
184 echo "<td class='srDOB'> </td>";
186 echo "<td class='srID'>" . $iter['pubpid'] . "</td>";
187 echo "<td class='srPID'>" . $iter['pid'] . "</td>";
188 //setup for display of encounter date info
189 $encounter_count = 0;
191 $last_date_seen = '';
195 // calculate date differences based on date of last encounter with billing entries
196 $query = "select DATE_FORMAT(max(form_encounter.date),'%m/%d/%y') as mydate," .
197 " (to_days(current_date())-to_days(max(form_encounter.date))) as day_diff," .
198 " DATE_FORMAT(max(form_encounter.date) + interval " . $add_days .
199 " day,'%m/%d/%y') as next_appt, dayname(max(form_encounter.date) + interval " .
200 $add_days." day) as next_appt_day from form_encounter " .
201 "join billing on billing.encounter = form_encounter.encounter and " .
202 "billing.pid = form_encounter.pid and billing.activity = 1 and " .
203 "billing.code_type not like 'COPAY' where ".
204 "form_encounter.pid = " . $iter{"pid"};
205 $statement= sqlStatement($query);
206 if ($results = mysql_fetch_array($statement, MYSQL_ASSOC
)) {
207 $last_date_seen = $results['mydate'];
208 $day_diff = $results['day_diff'];
209 $next_appt_date= $results['next_appt_day'].', '.$results['next_appt'];
212 //calculate count of encounters by distinct billing dates with cpt4
214 $query = "select count(distinct date) as encounter_count " .
215 "from billing where code_type not like 'COPAY' and activity = 1 " .
216 "and pid = ".$iter{"pid"};
217 $statement= sqlStatement($query);
218 if ($results = mysql_fetch_array($statement, MYSQL_ASSOC
)) {
219 $encounter_count = $results['encounter_count'];
221 echo "<td class='srNumEnc'>".$encounter_count."</td>";
222 echo "<td class='srNumDay'>".$day_diff."</td>";
223 echo "<td class='srDateLast'>".$last_date_seen."</td>";
224 echo "<td class='srDateNext'>".$next_appt_date."</td>";
230 </div
> <!-- end searchResults DIV
-->
232 <script language
="javascript">
234 // jQuery stuff to make the page a little easier to use
236 $
(document
).ready(function(){
237 $
("#searchparm").focus();
238 $
(".oneresult").mouseover(function() { $
(this
).toggleClass("highlight"); });
239 $
(".oneresult").mouseout(function() { $
(this
).toggleClass("highlight"); });
240 $
(".oneresult").click(function() { SelectPatient(this
); });
241 //$(".event").dblclick(function() { EditEvent(this); });
244 var SelectPatient
= function (eObj
) {
246 // For the old layout we load a frameset that also sets up the new pid.
247 // The new layout loads just the demographics frame here, which in turn
248 // will set the pid and load all the other frames.
249 if ($GLOBALS['concurrent_layout'])
252 // larry :: dbc insert
253 if( $GLOBALS['dutchpc'] )
254 $newPage = "../../patient_file/summary/demographics_dutch.php?set_pid=";
256 $newPage = "../../patient_file/summary/demographics.php?set_pid=";
257 // larry :: end of dbc insert
259 $target = "document";
261 $newPage = "../../patient_file/patient_file.php?set_pid=";
266 var parts
= objID
.split("~");
267 <?php
echo $target; ?
>.location
.href
= '<?php echo $newPage; ?>' + parts
[0];