108 lines
3.3 KiB
PHP
108 lines
3.3 KiB
PHP
<?php
|
|
include "db_config.php";
|
|
date_default_timezone_set("Asia/Shanghai");
|
|
$conn = $link;
|
|
|
|
// 初始化变量
|
|
$search_field = isset($_POST["search_field"]) ? $_POST["search_field"] : "doctor";
|
|
$search_value = isset($_POST["search_value"]) ? $_POST["search_value"] : "";
|
|
$message = "";
|
|
|
|
// 查询挂号信息
|
|
$sql_query = "
|
|
SELECT
|
|
department_90.department_name,
|
|
doctor_90.doctor_name,
|
|
patient_90.patient_name,
|
|
FROM_UNIXTIME(register_90.register_date, '%Y-%m-%d') AS register_date,
|
|
register_90.fee,
|
|
register_90.biz_id
|
|
FROM register_90
|
|
JOIN doctor_90 ON register_90.doctor_id = doctor_90.doctor_id
|
|
JOIN department_90 ON doctor_90.department_id = department_90.department_id
|
|
JOIN patient_90 ON register_90.patient_id = patient_90.patient_id";
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST" && !empty($search_value)) {
|
|
if ($search_field == "doctor") {
|
|
$sql_query .= " WHERE doctor_90.doctor_name LIKE '%$search_value%'";
|
|
} elseif ($search_field == "patient") {
|
|
$sql_query .= " WHERE patient_90.patient_name LIKE '%$search_value%'";
|
|
}
|
|
}
|
|
|
|
$result = $conn->query($sql_query);
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>患者挂号列表</title>
|
|
<style>
|
|
table {
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
}
|
|
th, td {
|
|
border: 1px solid #ddd;
|
|
padding: 8px;
|
|
}
|
|
th {
|
|
background-color: #f2f2f2;
|
|
}
|
|
tr:hover {
|
|
background-color: #f5f5f5;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h2>患者挂号列表</h2>
|
|
<form action="patient_register_list_90.php" method="post">
|
|
<label for="search_field">查询条件:</label>
|
|
<select id="search_field" name="search_field">
|
|
<option value="doctor" <?php echo ($search_field == "doctor") ? "selected" : ""; ?>>医生</option>
|
|
<option value="patient" <?php echo ($search_field == "patient") ? "selected" : ""; ?>>患者</option>
|
|
</select>
|
|
=
|
|
<input type="text" id="search_value" name="search_value" value="<?php echo htmlspecialchars($search_value); ?>">
|
|
<input type="submit" id="ok" name="ok" value="确定">
|
|
</form>
|
|
|
|
<hr>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>科室</th>
|
|
<th>医生</th>
|
|
<th>患者</th>
|
|
<th>就诊时间</th>
|
|
<th>挂号费</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if ($result && $result->num_rows > 0): ?>
|
|
<?php while ($row = $result->fetch_assoc()) { ?>
|
|
<tr>
|
|
<td><?php echo $row["department_name"]; ?></td>
|
|
<td><?php echo $row["doctor_name"]; ?></td>
|
|
<td><?php echo $row["patient_name"]; ?></td>
|
|
<td><?php echo $row["register_date"]; ?></td>
|
|
<td><?php echo $row["fee"]; ?></td>
|
|
<td>
|
|
<a href="edit_register_90.php?biz_id=<?php echo $row['biz_id']; ?>">编辑</a>
|
|
|
|
|
<a href="delete_register_90.php?biz_id=<?php echo $row['biz_id']; ?>" onclick="return confirm('确定要删除此记录吗?');">删除</a>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php else: ?>
|
|
<tr>
|
|
<td colspan="6" style="text-align: center;">暂无数据</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html>
|