PHP_WORKS/modules/diagnoses/list.php
2025-05-30 11:11:04 +08:00

299 lines
18 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>诊断管理 - 电子病历系统</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link href="../../css/material.css" rel="stylesheet">
</head>
<body>
<header class="header">
<h1>
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/>
</svg>
诊断管理
</h1>
</header>
<nav class="nav-menu">
<ul>
<li><a href="../../index.php">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z"/>
</svg>
仪表板
</a></li>
<li><a href="../patients/list.php">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"/>
</svg>
患者管理
</a></li>
<li><a href="../doctors/list.php">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M14.84,2.5C16.2,2.5 17.5,3.2 18.28,4.38L18.5,4.75L19.25,4.38C19.92,4 20.75,4.2 21.13,4.87C21.5,5.54 21.33,6.42 20.66,6.79L20.04,7.12C20.04,7.12 20.04,7.12 20.04,7.12C20.47,7.88 20.47,8.78 20.04,9.54L20.5,9.78C21.17,10.15 21.33,11.04 20.97,11.71C20.6,12.38 19.72,12.54 19.05,12.17L18.5,11.88C17.71,13.07 16.39,13.77 15.04,13.77C13.68,13.77 12.36,13.07 11.57,11.88L11,12.17C10.33,12.54 9.45,12.38 9.08,11.71C8.71,11.04 8.88,10.15 9.55,9.78L10,9.54C9.58,8.78 9.58,7.88 10,7.12L9.38,6.79C8.71,6.42 8.55,5.54 8.92,4.87C9.29,4.2 10.17,4 10.84,4.38L11.57,4.75C12.35,3.56 13.67,2.86 15.04,2.86M15.04,4.64C14.18,4.64 13.4,5.09 12.96,5.78L12.5,6.5L11.78,6.06C11.58,5.94 11.32,6 11.19,6.21C11.07,6.42 11.13,6.68 11.34,6.81L12.06,7.25L11.78,7.94C11.58,8.38 11.58,8.87 11.78,9.31L12.06,10L11.34,10.44C11.13,10.57 11.07,10.83 11.19,11.04C11.32,11.25 11.58,11.31 11.78,11.19L12.5,10.75L12.96,11.47C13.4,12.16 14.18,12.61 15.04,12.61C15.9,12.61 16.68,12.16 17.12,11.47L17.58,10.75L18.3,11.19C18.5,11.31 18.76,11.25 18.89,11.04C19.01,10.83 18.95,10.57 18.74,10.44L18.02,10L18.3,9.31C18.5,8.87 18.5,8.38 18.3,7.94L18.02,7.25L18.74,6.81C18.95,6.68 19.01,6.42 18.89,6.21C18.76,6 18.5,5.94 18.3,6.06L17.58,6.5L17.12,5.78C16.68,5.09 15.9,4.64 15.04,4.64M11,15.5V17.5H3V15.5C3,14.39 6.69,13.5 9.5,13.5C10.4,13.5 11.5,13.65 12.5,13.91C11.84,14.8 11.5,15.88 11.5,17C11.34,16.83 11.17,16.66 11,15.5M9.5,12A2.5,2.5 0 0,1 7,9.5A2.5,2.5 0 0,1 9.5,7A2.5,2.5 0 0,1 12,9.5A2.5,2.5 0 0,1 9.5,12Z"/>
</svg>
医生管理
</a></li>
<li><a href="../medical_records/list.php">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/>
</svg>
病历管理
</a></li>
<li><a href="../departments/list.php">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z"/>
</svg>
科室管理
</a></li>
<li><a href="../medications/list.php">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M17,3C18.1,3 19,3.9 19,5V8H21V10H19V19C19,20.1 18.1,21 17,21H7C5.9,21 5,20.1 5,19V10H3V8H5V5C5,3.9 5.9,3 7,3H17M7,5V8H17V5H7M7,10V19H17V10H7M9,12H15V14H9V12M9,15H13V17H9V15Z"/>
</svg>
药品管理
</a></li>
<li><a href="list.php" class="active">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/>
</svg>
诊断管理
</a></li>
</ul>
</nav>
<div class="container">
<?php
include "../../conn/conn.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action'])) {
if ($_POST['action'] == 'add') {
$code = mysqli_real_escape_string($connID, $_POST['code']);
$name = mysqli_real_escape_string($connID, $_POST['name']);
$category = mysqli_real_escape_string($connID, $_POST['category']);
$description = mysqli_real_escape_string($connID, $_POST['description']);
$sql = "INSERT INTO diagnoses (code, name, category, description) VALUES ('$code', '$name', '$category', '$description')";
if (mysqli_query($connID, $sql)) {
echo '<div class="alert alert-success">诊断信息添加成功!</div>';
} else {
echo '<div class="alert alert-error">添加失败:' . mysqli_error($connID) . '</div>';
}
}
}
$search = isset($_GET['search']) ? mysqli_real_escape_string($connID, $_GET['search']) : '';
$category_filter = isset($_GET['category']) ? mysqli_real_escape_string($connID, $_GET['category']) : '';
$sql = "SELECT * FROM diagnoses WHERE 1=1";
if ($search) {
$sql .= " AND (code LIKE '%$search%' OR name LIKE '%$search%' OR description LIKE '%$search%')";
}
if ($category_filter) {
$sql .= " AND category = '$category_filter'";
}
$sql .= " ORDER BY category, code";
$result = mysqli_query($connID, $sql);
$stats_sql = "SELECT category, COUNT(*) as count FROM diagnoses GROUP BY category";
$stats_result = mysqli_query($connID, $stats_sql);
$stats = [];
while ($row = mysqli_fetch_assoc($stats_result)) {
$stats[$row['category']] = $row['count'];
}
?>
<div class="grid">
<div class="stats-container">
<div class="stat-card">
<div class="stat-icon" style="background: #e3f2fd;">
<svg viewBox="0 0 24 24" fill="#1976d2">
<path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/>
</svg>
</div>
<div>
<div class="stat-number"><?php echo mysqli_num_rows($result); ?></div>
<div class="stat-label">诊断项目</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background: #e8f5e8;">
<svg viewBox="0 0 24 24" fill="#388e3c">
<path d="M17,13H13V17H11V13H7V11H11V7H13V11H17M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"/>
</svg>
</div>
<div>
<div class="stat-number"><?php echo isset($stats['内科']) ? $stats['内科'] : 0; ?></div>
<div class="stat-label">内科诊断</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background: #fff3e0;">
<svg viewBox="0 0 24 24" fill="#f57c00">
<path d="M19,3H5C3.89,3 3,3.89 3,5V19C3,20.11 3.89,21 5,21H19C20.11,21 21,20.11 21,19V5C21,3.89 20.11,3 19,3M13.5,6L16,8.5L10.5,14L7.5,11L9,9.5L10.5,11L13.5,6Z"/>
</svg>
</div>
<div>
<div class="stat-number"><?php echo isset($stats['外科']) ? $stats['外科'] : 0; ?></div>
<div class="stat-label">外科诊断</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background: #fce4ec;">
<svg viewBox="0 0 24 24" fill="#c2185b">
<path d="M6,2A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6M6,4H13V9H18V20H6V4M8,12V14H16V12H8M8,16V18H13V16H8Z"/>
</svg>
</div>
<div>
<div class="stat-number"><?php echo array_sum($stats); ?></div>
<div class="stat-label">总计分类</div>
</div>
</div>
</div>
</div>
<div class="grid grid-2">
<div class="card">
<div class="card-header">
<h2 class="card-title">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/>
</svg>
诊断列表
</h2>
</div>
<div class="card-content">
<div class="search-filters">
<form method="GET" style="display: flex; gap: 16px; margin-bottom: 24px;">
<input type="text" name="search" placeholder="搜索诊断编码或名称..."
value="<?php echo htmlspecialchars($search); ?>" class="form-control" style="flex: 1;">
<select name="category" class="form-control" style="width: 150px;">
<option value="">全部分类</option>
<option value="内科" <?php echo $category_filter == '内科' ? 'selected' : ''; ?>>内科</option>
<option value="外科" <?php echo $category_filter == '外科' ? 'selected' : ''; ?>>外科</option>
<option value="妇科" <?php echo $category_filter == '妇科' ? 'selected' : ''; ?>>妇科</option>
<option value="儿科" <?php echo $category_filter == '儿科' ? 'selected' : ''; ?>>儿科</option>
<option value="神经科" <?php echo $category_filter == '神经科' ? 'selected' : ''; ?>>神经科</option>
<option value="皮肤科" <?php echo $category_filter == '皮肤科' ? 'selected' : ''; ?>>皮肤科</option>
<option value="眼科" <?php echo $category_filter == '眼科' ? 'selected' : ''; ?>>眼科</option>
<option value="耳鼻喉科" <?php echo $category_filter == '耳鼻喉科' ? 'selected' : ''; ?>>耳鼻喉科</option>
<option value="其他" <?php echo $category_filter == '其他' ? 'selected' : ''; ?>>其他</option>
</select>
<button type="submit" class="btn btn-primary">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/>
</svg>
搜索
</button>
</form>
</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>编码</th>
<th>诊断名称</th>
<th>分类</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<?php if(mysqli_num_rows($result) > 0): ?>
<?php while($diagnosis = mysqli_fetch_assoc($result)): ?>
<tr>
<td><strong><?php echo htmlspecialchars($diagnosis['code']); ?></strong></td>
<td><?php echo htmlspecialchars($diagnosis['name']); ?></td>
<td>
<span class="status-badge status-processing">
<?php echo htmlspecialchars($diagnosis['category']); ?>
</span>
</td>
<td style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
<?php echo htmlspecialchars($diagnosis['description'] ?: '-'); ?>
</td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr>
<td colspan="4" style="text-align: center; color: #999; padding: 40px;">
暂无诊断数据
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2 class="card-title">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"/>
</svg>
新增诊断
</h2>
</div>
<div class="card-content">
<form method="POST">
<input type="hidden" name="action" value="add">
<div class="form-group">
<label class="form-label">诊断编码 *</label>
<input type="text" name="code" class="form-control" required placeholder="如K59.1、J00.9">
</div>
<div class="form-group">
<label class="form-label">诊断名称 *</label>
<input type="text" name="name" class="form-control" required placeholder="疾病或症状名称">
</div>
<div class="form-group">
<label class="form-label">分类 *</label>
<select name="category" class="form-control" required>
<option value="">请选择分类</option>
<option value="内科">内科</option>
<option value="外科">外科</option>
<option value="妇科">妇科</option>
<option value="儿科">儿科</option>
<option value="神经科">神经科</option>
<option value="皮肤科">皮肤科</option>
<option value="眼科">眼科</option>
<option value="耳鼻喉科">耳鼻喉科</option>
<option value="其他">其他</option>
</select>
</div>
<div class="form-group">
<label class="form-label">说明</label>
<textarea name="description" class="form-control" rows="4" placeholder="诊断详细说明或备注"></textarea>
</div>
<button type="submit" class="btn btn-primary" style="width: 100%;">
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/>
</svg>
添加诊断
</button>
</form>
<div style="margin-top: 24px; padding: 16px; background: #f5f5f5; border-radius: 4px;">
<h4 style="margin: 0 0 12px 0; color: #666;">常用诊断编码示例</h4>
<div style="color: #666; font-size: 14px; line-height: 1.6;">
<strong>内科:</strong> J00.9-感冒、K59.1-便秘、I10-高血压<br>
<strong>外科:</strong> S72.0-股骨骨折、K35.9-急性阑尾炎<br>
<strong>妇科:</strong> N92.0-月经过多、N81.1-子宫脱垂<br>
<strong>儿科:</strong> A09-腹泻、J06.9-急性上呼吸道感染
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>