} if (isset($_POST["mode"]) && $_POST["mode"] == "findpatient") { $_SESSION["findby"] = $_POST["findBy"]; $_SESSION["lastname"] = $_POST["lastname"]; $_SESSION["firstname"] = $_POST["firstname"]; $category = $_POST["category"]; } $findby = $_SESSION["findby"]; $lastname = $_SESSION["lastname"]; $firstname = $_SESSION["firstname"]; // do the search, if we have some good criteria if (isset($lastname) && $lastname != "") { if ($findby == "Last") { $result = getPatientLnames("{$lastname}", "*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS"); } elseif ($findby == "ID") { $result = getPatientId("{$lastname}", "*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS"); } elseif ($findby == "DOB") { $result = getPatientDOB("{$lastname}", "*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS"); } elseif ($findby == "SSN") { $result = getPatientSSN("{$lastname}", "*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS"); } elseif ($searchby == "Phone") { //(CHEMED) Search by phone number $result = getPatientPhone("{$searchparm}", "*"); } } ?> <html> <head> <?php html_header_show();
include_once "../../globals.php"; include_once "{$srcdir}/patient.inc"; include_once "{$srcdir}/formdata.inc.php"; $info_msg = ""; // If we are searching, search. // if ($_REQUEST['searchby'] && $_REQUEST['searchparm']) { $searchby = $_REQUEST['searchby']; $searchparm = trim($_REQUEST['searchparm']); if ($searchby == "Last") { $result = getPatientLnames("{$searchparm}", "*"); } elseif ($searchby == "Phone") { //(CHEMED) Search by phone number $result = getPatientPhone("{$searchparm}", "*"); } elseif ($searchby == "ID") { $result = getPatientId("{$searchparm}", "*"); } elseif ($searchby == "DOB") { $result = getPatientDOB("{$searchparm}", "*"); } elseif ($searchby == "SSN") { $result = getPatientSSN("{$searchparm}", "*"); } } ?> <html> <head> <?php html_header_show(); ?> <title><?php echo htmlspecialchars(xl('Patient Finder'), ENT_NOQUOTES);
$result = array(); while ($row = sqlFetchArray($rez)) { $result[] = $row; } _set_patient_inc_count($sqllimit, count($result), $where); } else { $patient = formData("patient", "R"); $findBy = $_REQUEST['findBy']; $searchFields = $_REQUEST['searchFields']; echo "<input type='hidden' name='patient' value='{$patient}' />\n"; echo "<input type='hidden' name='findBy' value='{$findBy}' />\n"; if ($findBy == "Last") { $result = getPatientLnames("{$patient}", $given, $orderby, $sqllimit, $fstart); } else { if ($findBy == "ID") { $result = getPatientId("{$patient}", $given, "id ASC, " . $orderby, $sqllimit, $fstart); } else { if ($findBy == "DOB") { $result = getPatientDOB("{$patient}", $given, "DOB ASC, " . $orderby, $sqllimit, $fstart); } else { if ($findBy == "SSN") { $result = getPatientSSN("{$patient}", $given, "ss ASC, " . $orderby, $sqllimit, $fstart); } elseif ($findBy == "Phone") { //(CHEMED) Search by phone number $result = getPatientPhone("{$patient}", $given, $orderby, $sqllimit, $fstart); } else { if ($findBy == "Any") { $result = getByPatientDemographics("{$patient}", $given, $orderby, $sqllimit, $fstart); } else { if ($findBy == "Filter") { $result = getByPatientDemographicsFilter($searchFields, "{$patient}", $given, $orderby, $sqllimit, $fstart);
foreach ($result as $iter) { if ($total >= $M) { break; } print "<tr><td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'>" . $iter["lname"] . ", " . $iter["fname"] . "</td></a>\n"; print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'>" . $iter["ss"] . "</a></td>"; if ($iter["DOB"] != "0000-00-00 00:00:00") { print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'>" . $iter["DOB_TS"] . "</a></td>"; } else { print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'> </a></td>"; } print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'>" . $iter["pubpid"] . "</a></td>"; $total++; } } if ($findBy == "ID" && ($result = getPatientId("{$patient}", "*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS"))) { foreach ($result as $iter) { if ($total >= $M) { break; } print "<tr><td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'>" . $iter["lname"] . ", " . $iter["fname"] . "</td></a>\n"; print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'>" . $iter["ss"] . "</a></td>"; if ($iter["DOB"] != "0000-00-00 00:00:00") { print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'>" . $iter["DOB_TS"] . "</a></td>"; } else { print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&set_pid=" . $iter["pid"] . "'> </a></td>"; } print "<td><a class=text target=_top href='browse.php?browsenum={$browsenum}&vset_pid=" . $iter["pid"] . "'>" . $iter["pubpid"] . "</a></td>"; $total++; } }