feat: 实现首页仪表盘功能
This commit is contained in:
parent
80ad27cb84
commit
6f1dff182b
227
index.php
Normal file
227
index.php
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
<!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="M19,3H5C3.9,3 3,3.9 3,5V19C3,20.1 3.9,21 5,21H19C20.1,21 21,20.1 21,19V5C21,3.9 20.1,3 19,3M18,14H16V12H18V14M18,11H16V9H18V11M18,8H16V6H18V8M15,14H13V12H15V14M15,11H13V9H15V11M15,8H13V6H15V8M12,14H6V12H12V14M12,11H6V9H12V11M12,8H6V6H12V8Z"/>
|
||||||
|
</svg>
|
||||||
|
电子病历管理系统
|
||||||
|
</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<nav class="nav-menu">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php" class="active">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z"/>
|
||||||
|
</svg>
|
||||||
|
仪表板
|
||||||
|
</a></li>
|
||||||
|
<li><a href="modules/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="modules/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="modules/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="modules/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="modules/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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="grid grid-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-content">
|
||||||
|
<h3 style="color: #1976d2; margin-bottom: 16px;">今日统计</h3>
|
||||||
|
<?php
|
||||||
|
include "conn/conn.php";
|
||||||
|
$today = date('Y-m-d');
|
||||||
|
|
||||||
|
$patients_query = "SELECT COUNT(*) as count FROM patients WHERE DATE(created_at) = '$today'";
|
||||||
|
$patients_result = mysqli_query($connID, $patients_query);
|
||||||
|
$patients_count = mysqli_fetch_assoc($patients_result)['count'];
|
||||||
|
|
||||||
|
$records_query = "SELECT COUNT(*) as count FROM medical_records WHERE DATE(visit_date) = '$today'";
|
||||||
|
$records_result = mysqli_query($connID, $records_query);
|
||||||
|
$records_count = mysqli_fetch_assoc($records_result)['count'];
|
||||||
|
|
||||||
|
$pending_query = "SELECT COUNT(*) as count FROM medical_records WHERE status = '待诊' AND DATE(visit_date) = '$today'";
|
||||||
|
$pending_result = mysqli_query($connID, $pending_query);
|
||||||
|
$pending_count = mysqli_fetch_assoc($pending_result)['count'];
|
||||||
|
?>
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #e3f2fd; border-radius: 4px;">
|
||||||
|
<span>新增患者</span>
|
||||||
|
<strong style="color: #1976d2; font-size: 18px;"><?php echo $patients_count; ?></strong>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #e8f5e8; border-radius: 4px;">
|
||||||
|
<span>今日就诊</span>
|
||||||
|
<strong style="color: #388e3c; font-size: 18px;"><?php echo $records_count; ?></strong>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #fff3e0; border-radius: 4px;">
|
||||||
|
<span>待诊患者</span>
|
||||||
|
<strong style="color: #f57c00; font-size: 18px;"><?php echo $pending_count; ?></strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-content">
|
||||||
|
<h3 style="color: #1976d2; margin-bottom: 16px;">最近患者</h3>
|
||||||
|
<?php
|
||||||
|
$recent_patients_query = "SELECT * FROM patients ORDER BY created_at DESC LIMIT 5";
|
||||||
|
$recent_patients = mysqli_query($connID, $recent_patients_query);
|
||||||
|
?>
|
||||||
|
<div style="display: grid; gap: 8px;">
|
||||||
|
<?php while($patient = mysqli_fetch_assoc($recent_patients)): ?>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; padding: 8px; border-bottom: 1px solid #e0e0e0;">
|
||||||
|
<div>
|
||||||
|
<strong><?php echo $patient['name']; ?></strong>
|
||||||
|
<div style="font-size: 12px; color: #666;"><?php echo $patient['phone']; ?></div>
|
||||||
|
</div>
|
||||||
|
<span style="font-size: 12px; color: #999;"><?php echo date('m-d', strtotime($patient['created_at'])); ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-content">
|
||||||
|
<h3 style="color: #1976d2; margin-bottom: 16px;">待诊列表</h3>
|
||||||
|
<?php
|
||||||
|
$pending_records_query = "SELECT mr.*, p.name as patient_name, d.name as doctor_name FROM medical_records mr
|
||||||
|
JOIN patients p ON mr.patient_id = p.id
|
||||||
|
JOIN doctors d ON mr.doctor_id = d.id
|
||||||
|
WHERE mr.status = '待诊' ORDER BY mr.visit_date ASC LIMIT 5";
|
||||||
|
$pending_records = mysqli_query($connID, $pending_records_query);
|
||||||
|
?>
|
||||||
|
<div style="display: grid; gap: 8px;">
|
||||||
|
<?php while($record = mysqli_fetch_assoc($pending_records)): ?>
|
||||||
|
<div style="padding: 8px; border: 1px solid #e0e0e0; border-radius: 4px;">
|
||||||
|
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
||||||
|
<strong><?php echo $record['patient_name']; ?></strong>
|
||||||
|
<span class="status-badge status-pending">待诊</span>
|
||||||
|
</div>
|
||||||
|
<div style="font-size: 12px; color: #666;">
|
||||||
|
医生:<?php echo $record['doctor_name']; ?><br>
|
||||||
|
时间:<?php echo date('H:i', strtotime($record['visit_date'])); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</div>
|
||||||
|
</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="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7.07,18.28C7.5,17.38 10.12,16.5 12,16.5C13.88,16.5 16.5,17.38 16.93,18.28C15.57,19.36 13.86,20 12,20C10.14,20 8.43,19.36 7.07,18.28M18.36,16.83C16.93,15.09 13.46,14.5 12,14.5C10.54,14.5 7.07,15.09 5.64,16.83C4.62,15.5 4,13.82 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,13.82 19.38,15.5 18.36,16.83M12,6C10.06,6 8.5,7.56 8.5,9.5C8.5,11.44 10.06,13 12,13C13.94,13 15.5,11.44 15.5,9.5C15.5,7.56 13.94,6 12,6M12,11A1.5,1.5 0 0,1 10.5,9.5A1.5,1.5 0 0,1 12,8A1.5,1.5 0 0,1 13.5,9.5A1.5,1.5 0 0,1 12,11Z"/>
|
||||||
|
</svg>
|
||||||
|
系统概览
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="grid grid-2">
|
||||||
|
<div>
|
||||||
|
<h4 style="margin-bottom: 12px;">系统统计</h4>
|
||||||
|
<?php
|
||||||
|
$total_patients = mysqli_query($connID, "SELECT COUNT(*) as count FROM patients");
|
||||||
|
$total_patients_count = mysqli_fetch_assoc($total_patients)['count'];
|
||||||
|
|
||||||
|
$total_doctors = mysqli_query($connID, "SELECT COUNT(*) as count FROM doctors");
|
||||||
|
$total_doctors_count = mysqli_fetch_assoc($total_doctors)['count'];
|
||||||
|
|
||||||
|
$total_records = mysqli_query($connID, "SELECT COUNT(*) as count FROM medical_records");
|
||||||
|
$total_records_count = mysqli_fetch_assoc($total_records)['count'];
|
||||||
|
|
||||||
|
$total_medications = mysqli_query($connID, "SELECT COUNT(*) as count FROM medications");
|
||||||
|
$total_medications_count = mysqli_fetch_assoc($total_medications)['count'];
|
||||||
|
?>
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<div style="display: flex; justify-content: space-between; padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
||||||
|
<span>总患者数</span>
|
||||||
|
<strong><?php echo $total_patients_count; ?></strong>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
||||||
|
<span>医生总数</span>
|
||||||
|
<strong><?php echo $total_doctors_count; ?></strong>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
||||||
|
<span>病历总数</span>
|
||||||
|
<strong><?php echo $total_records_count; ?></strong>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
||||||
|
<span>药品种类</span>
|
||||||
|
<strong><?php echo $total_medications_count; ?></strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4 style="margin-bottom: 12px;">快速操作</h4>
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<a href="modules/patients/add.php" class="btn btn-primary">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M6,10V7H4V10H1V12H4V15H6V12H9V10M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12Z"/>
|
||||||
|
</svg>
|
||||||
|
新增患者
|
||||||
|
</a>
|
||||||
|
<a href="modules/medical_records/add.php" class="btn btn-success">
|
||||||
|
<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>
|
||||||
|
<a href="modules/doctors/add.php" class="btn btn-warning">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4M15,5.9C16.16,5.9 17.1,6.84 17.1,8C17.1,9.16 16.16,10.1 15,10.1A2.1,2.1 0 0,1 12.9,8A2.1,2.1 0 0,1 15,5.9M4,7V10H1V12H4V15H6V12H9V10H6V7H4M15,13C12.33,13 7,14.33 7,17V20H23V17C23,14.33 17.67,13 15,13Z"/>
|
||||||
|
</svg>
|
||||||
|
添加医生
|
||||||
|
</a>
|
||||||
|
<a href="modules/medications/add.php" class="btn btn-danger">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user