feat: 核心病历管理系统
This commit is contained in:
parent
c7b0bd6532
commit
7145d3975d
214
modules/medical_records/add.php
Normal file
214
modules/medical_records/add.php
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<!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="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/>
|
||||||
|
</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="list.php" class="active">
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
include "../../conn/conn.php";
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$patient_id = mysqli_real_escape_string($connID, $_POST['patient_id']);
|
||||||
|
$doctor_id = mysqli_real_escape_string($connID, $_POST['doctor_id']);
|
||||||
|
$department_id = mysqli_real_escape_string($connID, $_POST['department_id']);
|
||||||
|
$visit_date = mysqli_real_escape_string($connID, $_POST['visit_date']);
|
||||||
|
$chief_complaint = mysqli_real_escape_string($connID, $_POST['chief_complaint']);
|
||||||
|
$present_illness = mysqli_real_escape_string($connID, $_POST['present_illness']);
|
||||||
|
$physical_examination = mysqli_real_escape_string($connID, $_POST['physical_examination']);
|
||||||
|
$diagnosis = mysqli_real_escape_string($connID, $_POST['diagnosis']);
|
||||||
|
$treatment_plan = mysqli_real_escape_string($connID, $_POST['treatment_plan']);
|
||||||
|
$notes = mysqli_real_escape_string($connID, $_POST['notes']);
|
||||||
|
|
||||||
|
$sql = "INSERT INTO medical_records (patient_id, doctor_id, department_id, visit_date, chief_complaint, present_illness, physical_examination, diagnosis, treatment_plan, notes)
|
||||||
|
VALUES ('$patient_id', '$doctor_id', '$department_id', '$visit_date', '$chief_complaint', '$present_illness', '$physical_examination', '$diagnosis', '$treatment_plan', '$notes')";
|
||||||
|
|
||||||
|
if (mysqli_query($connID, $sql)) {
|
||||||
|
echo '<div class="alert alert-success">病历创建成功!</div>';
|
||||||
|
echo '<script>setTimeout(function(){window.location.href="list.php";}, 2000);</script>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert alert-error">创建失败:' . mysqli_error($connID) . '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$selected_patient_id = isset($_GET['patient_id']) ? $_GET['patient_id'] : '';
|
||||||
|
|
||||||
|
$patients_query = "SELECT * FROM patients ORDER BY name";
|
||||||
|
$patients_result = mysqli_query($connID, $patients_query);
|
||||||
|
|
||||||
|
$doctors_query = "SELECT d.*, dept.name as department_name FROM doctors d JOIN departments dept ON d.department_id = dept.id ORDER BY d.name";
|
||||||
|
$doctors_result = mysqli_query($connID, $doctors_query);
|
||||||
|
|
||||||
|
$departments_query = "SELECT * FROM departments ORDER BY name";
|
||||||
|
$departments_result = mysqli_query($connID, $departments_query);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<div class="grid grid-2">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">患者 *</label>
|
||||||
|
<select name="patient_id" class="form-control" required onchange="loadPatientInfo(this.value)">
|
||||||
|
<option value="">请选择患者</option>
|
||||||
|
<?php while($patient = mysqli_fetch_assoc($patients_result)): ?>
|
||||||
|
<option value="<?php echo $patient['id']; ?>" <?php echo ($selected_patient_id == $patient['id']) ? 'selected' : ''; ?>>
|
||||||
|
<?php echo htmlspecialchars($patient['name']); ?> - <?php echo $patient['phone']; ?>
|
||||||
|
</option>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">医生 *</label>
|
||||||
|
<select name="doctor_id" class="form-control" required onchange="loadDoctorDepartment(this.value)">
|
||||||
|
<option value="">请选择医生</option>
|
||||||
|
<?php while($doctor = mysqli_fetch_assoc($doctors_result)): ?>
|
||||||
|
<option value="<?php echo $doctor['id']; ?>" data-department="<?php echo $doctor['department_id']; ?>">
|
||||||
|
<?php echo htmlspecialchars($doctor['name']); ?> - <?php echo htmlspecialchars($doctor['department_name']); ?>
|
||||||
|
</option>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">科室 *</label>
|
||||||
|
<select name="department_id" class="form-control" required id="department_select">
|
||||||
|
<option value="">请选择科室</option>
|
||||||
|
<?php while($department = mysqli_fetch_assoc($departments_result)): ?>
|
||||||
|
<option value="<?php echo $department['id']; ?>">
|
||||||
|
<?php echo htmlspecialchars($department['name']); ?>
|
||||||
|
</option>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">就诊时间 *</label>
|
||||||
|
<input type="datetime-local" name="visit_date" class="form-control" required value="<?php echo date('Y-m-d\TH:i'); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">主诉</label>
|
||||||
|
<textarea name="chief_complaint" class="form-control" rows="3" placeholder="患者主要症状和就诊原因"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">现病史</label>
|
||||||
|
<textarea name="present_illness" class="form-control" rows="4" placeholder="患者病情发展过程、症状变化等"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">体格检查</label>
|
||||||
|
<textarea name="physical_examination" class="form-control" rows="4" placeholder="体温、血压、心率等生命体征及体格检查结果"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">诊断</label>
|
||||||
|
<textarea name="diagnosis" class="form-control" rows="3" placeholder="初步诊断或确定诊断"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">治疗方案</label>
|
||||||
|
<textarea name="treatment_plan" class="form-control" rows="4" placeholder="治疗计划、用药方案、注意事项等"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">备注</label>
|
||||||
|
<textarea name="notes" class="form-control" rows="3" placeholder="其他需要记录的信息"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex; gap: 16px; margin-top: 24px;">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
<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>
|
||||||
|
<a href="list.php" class="btn" style="background: #f5f5f5; color: #666;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
|
||||||
|
</svg>
|
||||||
|
取消
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function loadDoctorDepartment(doctorId) {
|
||||||
|
if (doctorId) {
|
||||||
|
const doctorSelect = document.querySelector('select[name="doctor_id"]');
|
||||||
|
const selectedOption = doctorSelect.querySelector('option[value="' + doctorId + '"]');
|
||||||
|
if (selectedOption) {
|
||||||
|
const departmentId = selectedOption.getAttribute('data-department');
|
||||||
|
const departmentSelect = document.getElementById('department_select');
|
||||||
|
departmentSelect.value = departmentId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
306
modules/medical_records/complete.php
Normal file
306
modules/medical_records/complete.php
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
<!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="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/>
|
||||||
|
</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="list.php" class="active">
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
include "../../conn/conn.php";
|
||||||
|
|
||||||
|
$record_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
|
|
||||||
|
if ($record_id <= 0) {
|
||||||
|
echo '<div class="alert alert-error">无效的病历ID</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$action = $_POST['action'] ?? '';
|
||||||
|
|
||||||
|
if ($action == 'complete') {
|
||||||
|
$sql = "UPDATE medical_records SET status = '已完成' WHERE id = $record_id AND status = '就诊中'";
|
||||||
|
|
||||||
|
if (mysqli_query($connID, $sql)) {
|
||||||
|
if (mysqli_affected_rows($connID) > 0) {
|
||||||
|
echo '<div class="alert alert-success">诊治已完成,病历状态已更新!</div>';
|
||||||
|
echo '<script>setTimeout(function(){window.location.href="view.php?id=' . $record_id . '";}, 2000);</script>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert alert-error">操作失败,病历状态可能已变更</div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert alert-error">操作失败:' . mysqli_error($connID) . '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT mr.*, p.name as patient_name, p.gender as patient_gender,
|
||||||
|
d.name as doctor_name, dept.name as department_name
|
||||||
|
FROM medical_records mr
|
||||||
|
JOIN patients p ON mr.patient_id = p.id
|
||||||
|
JOIN doctors d ON mr.doctor_id = d.id
|
||||||
|
JOIN departments dept ON mr.department_id = dept.id
|
||||||
|
WHERE mr.id = $record_id";
|
||||||
|
$result = mysqli_query($connID, $sql);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($result) == 0) {
|
||||||
|
echo '<div class="alert alert-error">病历不存在</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = mysqli_fetch_assoc($result);
|
||||||
|
|
||||||
|
if ($record['status'] != '就诊中') {
|
||||||
|
echo '<div class="alert alert-error">该病历状态为:' . $record['status'] . ',无法完成诊治</div>';
|
||||||
|
echo '<div style="text-align: center; margin-top: 20px;">';
|
||||||
|
echo '<a href="view.php?id=' . $record_id . '" class="btn btn-primary">查看病历详情</a>';
|
||||||
|
echo '</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查必要信息是否完整
|
||||||
|
$warnings = [];
|
||||||
|
if (empty($record['chief_complaint'])) $warnings[] = '患者主诉';
|
||||||
|
if (empty($record['diagnosis'])) $warnings[] = '诊断结果';
|
||||||
|
if (empty($record['treatment_plan'])) $warnings[] = '治疗方案';
|
||||||
|
|
||||||
|
// 检查是否有处方
|
||||||
|
$prescription_count = mysqli_fetch_assoc(mysqli_query($connID, "SELECT COUNT(*) as count FROM prescriptions WHERE record_id = $record_id"))['count'];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2 class="card-title">
|
||||||
|
<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>
|
||||||
|
完成诊治 - MR<?php echo str_pad($record['id'], 6, '0', STR_PAD_LEFT); ?>
|
||||||
|
</h2>
|
||||||
|
<p style="margin: 8px 0 0 0; color: #666;">
|
||||||
|
将病历状态从 "就诊中" 更改为 "已完成"
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="grid grid-2">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
病历信息
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>患者:</strong>
|
||||||
|
<span style="color: #1976d2; font-weight: 500;"><?php echo htmlspecialchars($record['patient_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>医生:</strong>
|
||||||
|
<span style="color: #1976d2; font-weight: 500;"><?php echo htmlspecialchars($record['doctor_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>科室:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['department_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>就诊时间:</strong>
|
||||||
|
<span><?php echo date('Y-m-d H:i', strtotime($record['visit_date'])); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>当前状态:</strong>
|
||||||
|
<span class="status-badge status-processing">就诊中</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M9,12L11,14L15,10M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2Z"/>
|
||||||
|
</svg>
|
||||||
|
完整性检查
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div style="display: grid; gap: 8px;">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span>患者主诉</span>
|
||||||
|
<?php if ($record['chief_complaint']): ?>
|
||||||
|
<span style="color: #4caf50;">✓ 已填写</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span style="color: #f44336;">✗ 未填写</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span>现病史</span>
|
||||||
|
<?php if ($record['present_illness']): ?>
|
||||||
|
<span style="color: #4caf50;">✓ 已填写</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span style="color: #ff9800;">○ 可选</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span>体格检查</span>
|
||||||
|
<?php if ($record['physical_examination']): ?>
|
||||||
|
<span style="color: #4caf50;">✓ 已填写</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span style="color: #ff9800;">○ 可选</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span>诊断结果</span>
|
||||||
|
<?php if ($record['diagnosis']): ?>
|
||||||
|
<span style="color: #4caf50;">✓ 已填写</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span style="color: #f44336;">✗ 未填写</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span>治疗方案</span>
|
||||||
|
<?php if ($record['treatment_plan']): ?>
|
||||||
|
<span style="color: #4caf50;">✓ 已填写</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span style="color: #f44336;">✗ 未填写</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span>处方信息</span>
|
||||||
|
<?php if ($prescription_count > 0): ?>
|
||||||
|
<span style="color: #4caf50;">✓ 已开具 (<?php echo $prescription_count; ?>项)</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span style="color: #ff9800;">○ 未开具</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!empty($warnings)): ?>
|
||||||
|
<div style="margin-top: 24px; padding: 16px; background: #fff3e0; border-left: 4px solid #ff9800; border-radius: 4px;">
|
||||||
|
<h4 style="margin: 0 0 12px 0; color: #f57c00;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M12,2L13.09,8.26L22,9L13.09,9.74L12,16L10.91,9.74L2,9L10.91,8.26L12,2Z"/>
|
||||||
|
</svg>
|
||||||
|
注意事项
|
||||||
|
</h4>
|
||||||
|
<p style="margin: 0; color: #f57c00; font-size: 14px;">
|
||||||
|
以下关键信息尚未填写:<strong><?php echo implode('、', $warnings); ?></strong>
|
||||||
|
<br>建议先完善这些信息后再完成诊治。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div style="margin-top: 24px; padding: 16px; background: #e8f5e8; border-radius: 4px;">
|
||||||
|
<h4 style="margin: 0 0 12px 0; color: #388e3c;">
|
||||||
|
<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>
|
||||||
|
完成诊治说明
|
||||||
|
</h4>
|
||||||
|
<ul style="margin: 0; padding-left: 20px; color: #388e3c; font-size: 14px; line-height: 1.6;">
|
||||||
|
<li>完成诊治后,病历状态将变更为"已完成"</li>
|
||||||
|
<li>已完成的病历将无法再次编辑</li>
|
||||||
|
<li>患者可以查看完整的诊治记录和处方信息</li>
|
||||||
|
<li>请确保所有诊治信息准确无误</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex; gap: 16px; margin-top: 24px;">
|
||||||
|
<?php if (empty($warnings)): ?>
|
||||||
|
<form method="POST" style="display: inline;">
|
||||||
|
<input type="hidden" name="action" value="complete">
|
||||||
|
<button type="submit" class="btn btn-success" style="font-size: 16px; padding: 12px 24px;">
|
||||||
|
<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>
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="edit.php?id=<?php echo $record['id']; ?>" class="btn btn-warning" style="font-size: 16px; padding: 12px 24px;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/>
|
||||||
|
</svg>
|
||||||
|
完善病历信息
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<a href="view.php?id=<?php echo $record['id']; ?>" class="btn btn-secondary">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z"/>
|
||||||
|
</svg>
|
||||||
|
查看详情
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="list.php" class="btn" style="background: #f5f5f5; color: #666;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
|
||||||
|
</svg>
|
||||||
|
取消
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
220
modules/medical_records/edit.php
Normal file
220
modules/medical_records/edit.php
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
<!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="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/>
|
||||||
|
</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="list.php" class="active">
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
include "../../conn/conn.php";
|
||||||
|
|
||||||
|
$record_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
|
|
||||||
|
if ($record_id <= 0) {
|
||||||
|
echo '<div class="alert alert-error">无效的病历ID</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$chief_complaint = $_POST['chief_complaint'] ? mysqli_real_escape_string($connID, $_POST['chief_complaint']) : NULL;
|
||||||
|
$present_illness = $_POST['present_illness'] ? mysqli_real_escape_string($connID, $_POST['present_illness']) : NULL;
|
||||||
|
$physical_examination = $_POST['physical_examination'] ? mysqli_real_escape_string($connID, $_POST['physical_examination']) : NULL;
|
||||||
|
$diagnosis = $_POST['diagnosis'] ? mysqli_real_escape_string($connID, $_POST['diagnosis']) : NULL;
|
||||||
|
$treatment_plan = $_POST['treatment_plan'] ? mysqli_real_escape_string($connID, $_POST['treatment_plan']) : NULL;
|
||||||
|
$notes = $_POST['notes'] ? mysqli_real_escape_string($connID, $_POST['notes']) : NULL;
|
||||||
|
|
||||||
|
$sql = "UPDATE medical_records SET
|
||||||
|
chief_complaint = " . ($chief_complaint ? "'$chief_complaint'" : "NULL") . ",
|
||||||
|
present_illness = " . ($present_illness ? "'$present_illness'" : "NULL") . ",
|
||||||
|
physical_examination = " . ($physical_examination ? "'$physical_examination'" : "NULL") . ",
|
||||||
|
diagnosis = " . ($diagnosis ? "'$diagnosis'" : "NULL") . ",
|
||||||
|
treatment_plan = " . ($treatment_plan ? "'$treatment_plan'" : "NULL") . ",
|
||||||
|
notes = " . ($notes ? "'$notes'" : "NULL") . "
|
||||||
|
WHERE id = $record_id";
|
||||||
|
|
||||||
|
if (mysqli_query($connID, $sql)) {
|
||||||
|
echo '<div class="alert alert-success">病历信息更新成功!</div>';
|
||||||
|
echo '<script>setTimeout(function(){window.location.href="view.php?id=' . $record_id . '";}, 2000);</script>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert alert-error">更新失败:' . mysqli_error($connID) . '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT mr.*, p.name as patient_name, d.name as doctor_name, dept.name as department_name
|
||||||
|
FROM medical_records mr
|
||||||
|
JOIN patients p ON mr.patient_id = p.id
|
||||||
|
JOIN doctors d ON mr.doctor_id = d.id
|
||||||
|
JOIN departments dept ON mr.department_id = dept.id
|
||||||
|
WHERE mr.id = $record_id";
|
||||||
|
$result = mysqli_query($connID, $sql);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($result) == 0) {
|
||||||
|
echo '<div class="alert alert-error">病历不存在</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = mysqli_fetch_assoc($result);
|
||||||
|
|
||||||
|
if ($record['status'] == '已完成') {
|
||||||
|
echo '<div class="alert alert-error">已完成的病历无法编辑</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status_class = '';
|
||||||
|
switch($record['status']) {
|
||||||
|
case '待诊': $status_class = 'status-pending'; break;
|
||||||
|
case '就诊中': $status_class = 'status-processing'; break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2 class="card-title">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/>
|
||||||
|
</svg>
|
||||||
|
编辑病历 - MR<?php echo str_pad($record['id'], 6, '0', STR_PAD_LEFT); ?>
|
||||||
|
</h2>
|
||||||
|
<div style="margin: 8px 0 0 0; display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span style="color: #666;">
|
||||||
|
患者:<?php echo htmlspecialchars($record['patient_name']); ?> |
|
||||||
|
医生:<?php echo htmlspecialchars($record['doctor_name']); ?> |
|
||||||
|
科室:<?php echo htmlspecialchars($record['department_name']); ?>
|
||||||
|
</span>
|
||||||
|
<span class="status-badge <?php echo $status_class; ?>">
|
||||||
|
<?php echo $record['status']; ?>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<form method="POST">
|
||||||
|
<div class="grid grid-2">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">主诉</label>
|
||||||
|
<textarea name="chief_complaint" class="form-control" rows="4"
|
||||||
|
placeholder="患者的主要症状或不适..."><?php echo htmlspecialchars($record['chief_complaint']); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">现病史</label>
|
||||||
|
<textarea name="present_illness" class="form-control" rows="4"
|
||||||
|
placeholder="发病时间、症状发展过程..."><?php echo htmlspecialchars($record['present_illness']); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">体格检查</label>
|
||||||
|
<textarea name="physical_examination" class="form-control" rows="4"
|
||||||
|
placeholder="体温、血压、心率等体征及检查结果..."><?php echo htmlspecialchars($record['physical_examination']); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">诊断</label>
|
||||||
|
<textarea name="diagnosis" class="form-control" rows="4"
|
||||||
|
placeholder="根据症状和检查结果给出的诊断..."><?php echo htmlspecialchars($record['diagnosis']); ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">治疗方案</label>
|
||||||
|
<textarea name="treatment_plan" class="form-control" rows="6"
|
||||||
|
placeholder="详细的治疗计划,包括药物治疗、手术方案、康复指导等..."><?php echo htmlspecialchars($record['treatment_plan']); ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">备注</label>
|
||||||
|
<textarea name="notes" class="form-control" rows="3"
|
||||||
|
placeholder="其他需要记录的信息..."><?php echo htmlspecialchars($record['notes']); ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 24px; padding: 16px; background: #e3f2fd; border-radius: 4px;">
|
||||||
|
<h4 style="margin: 0 0 12px 0; color: #1976d2;">编辑提示</h4>
|
||||||
|
<ul style="margin: 0; padding-left: 20px; color: #1976d2; font-size: 14px; line-height: 1.6;">
|
||||||
|
<li>请根据患者实际情况如实填写各项内容</li>
|
||||||
|
<li>诊断应基于充分的检查和分析</li>
|
||||||
|
<li>治疗方案要详细明确,便于后续执行</li>
|
||||||
|
<li>重要信息请在备注中详细说明</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex; gap: 16px; margin-top: 24px;">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
<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>
|
||||||
|
<a href="view.php?id=<?php echo $record['id']; ?>" class="btn btn-secondary">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z"/>
|
||||||
|
</svg>
|
||||||
|
查看详情
|
||||||
|
</a>
|
||||||
|
<a href="list.php" class="btn" style="background: #f5f5f5; color: #666;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
|
||||||
|
</svg>
|
||||||
|
取消
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 16px; text-align: center; color: #666; font-size: 14px;">
|
||||||
|
创建时间:<?php echo date('Y年m月d日 H:i', strtotime($record['created_at'])); ?> |
|
||||||
|
就诊时间:<?php echo date('Y年m月d日 H:i', strtotime($record['visit_date'])); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
200
modules/medical_records/list.php
Normal file
200
modules/medical_records/list.php
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
<!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="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/>
|
||||||
|
</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="list.php" class="active">
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2 class="card-title">
|
||||||
|
<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>
|
||||||
|
病历列表
|
||||||
|
</h2>
|
||||||
|
<div style="margin-top: 16px;">
|
||||||
|
<a href="add.php" class="btn btn-primary">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"/>
|
||||||
|
</svg>
|
||||||
|
新建病历
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div style="margin-bottom: 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
|
||||||
|
<form method="GET" style="display: flex; gap: 16px; align-items: center;">
|
||||||
|
<input type="text" name="search" class="form-control" placeholder="搜索患者姓名或医生姓名"
|
||||||
|
value="<?php echo isset($_GET['search']) ? htmlspecialchars($_GET['search']) : ''; ?>"
|
||||||
|
style="max-width: 300px;">
|
||||||
|
<select name="status" class="form-control" style="max-width: 150px;">
|
||||||
|
<option value="">全部状态</option>
|
||||||
|
<option value="待诊" <?php echo (isset($_GET['status']) && $_GET['status'] == '待诊') ? 'selected' : ''; ?>>待诊</option>
|
||||||
|
<option value="就诊中" <?php echo (isset($_GET['status']) && $_GET['status'] == '就诊中') ? 'selected' : ''; ?>>就诊中</option>
|
||||||
|
<option value="已完成" <?php echo (isset($_GET['status']) && $_GET['status'] == '已完成') ? 'selected' : ''; ?>>已完成</option>
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="btn btn-primary btn-small">搜索</button>
|
||||||
|
<?php if(isset($_GET['search']) && $_GET['search'] || isset($_GET['status']) && $_GET['status']): ?>
|
||||||
|
<a href="list.php" class="btn btn-small" style="background: #f5f5f5; color: #666;">清除</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>病历号</th>
|
||||||
|
<th>患者姓名</th>
|
||||||
|
<th>医生</th>
|
||||||
|
<th>科室</th>
|
||||||
|
<th>就诊时间</th>
|
||||||
|
<th>主诉</th>
|
||||||
|
<th>诊断</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
include "../../conn/conn.php";
|
||||||
|
|
||||||
|
$search = isset($_GET['search']) ? trim($_GET['search']) : '';
|
||||||
|
$status = isset($_GET['status']) ? trim($_GET['status']) : '';
|
||||||
|
|
||||||
|
$where_clause = 'WHERE 1=1';
|
||||||
|
if ($search) {
|
||||||
|
$search = mysqli_real_escape_string($connID, $search);
|
||||||
|
$where_clause .= " AND (p.name LIKE '%$search%' OR d.name LIKE '%$search%')";
|
||||||
|
}
|
||||||
|
if ($status) {
|
||||||
|
$status = mysqli_real_escape_string($connID, $status);
|
||||||
|
$where_clause .= " AND mr.status = '$status'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT mr.*, p.name as patient_name, d.name as doctor_name, dept.name as department_name
|
||||||
|
FROM medical_records mr
|
||||||
|
JOIN patients p ON mr.patient_id = p.id
|
||||||
|
JOIN doctors d ON mr.doctor_id = d.id
|
||||||
|
JOIN departments dept ON mr.department_id = dept.id
|
||||||
|
$where_clause
|
||||||
|
ORDER BY mr.visit_date DESC";
|
||||||
|
|
||||||
|
$result = mysqli_query($connID, $sql);
|
||||||
|
|
||||||
|
if(mysqli_num_rows($result) > 0):
|
||||||
|
while($record = mysqli_fetch_assoc($result)):
|
||||||
|
$status_class = '';
|
||||||
|
switch($record['status']) {
|
||||||
|
case '待诊': $status_class = 'status-pending'; break;
|
||||||
|
case '就诊中': $status_class = 'status-processing'; break;
|
||||||
|
case '已完成': $status_class = 'status-completed'; break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><strong>MR<?php echo str_pad($record['id'], 6, '0', STR_PAD_LEFT); ?></strong></td>
|
||||||
|
<td><?php echo htmlspecialchars($record['patient_name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($record['doctor_name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($record['department_name']); ?></td>
|
||||||
|
<td><?php echo date('Y-m-d H:i', strtotime($record['visit_date'])); ?></td>
|
||||||
|
<td style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
||||||
|
<?php echo htmlspecialchars($record['chief_complaint'] ?: '-'); ?>
|
||||||
|
</td>
|
||||||
|
<td style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
||||||
|
<?php echo htmlspecialchars($record['diagnosis'] ?: '-'); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="status-badge <?php echo $status_class; ?>">
|
||||||
|
<?php echo $record['status']; ?>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="view.php?id=<?php echo $record['id']; ?>" class="btn btn-small btn-primary">查看</a>
|
||||||
|
<?php if($record['status'] != '已完成'): ?>
|
||||||
|
<a href="edit.php?id=<?php echo $record['id']; ?>" class="btn btn-small btn-warning">编辑</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($record['status'] == '待诊'): ?>
|
||||||
|
<a href="start.php?id=<?php echo $record['id']; ?>" class="btn btn-small btn-success">开始诊治</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if($record['status'] == '就诊中'): ?>
|
||||||
|
<a href="complete.php?id=<?php echo $record['id']; ?>" class="btn btn-small btn-success">完成诊治</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endwhile;
|
||||||
|
else:
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" style="text-align: center; color: #999; padding: 40px;">
|
||||||
|
<?php if($search || $status): ?>
|
||||||
|
未找到匹配的病历记录
|
||||||
|
<?php else: ?>
|
||||||
|
暂无病历数据
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
275
modules/medical_records/start.php
Normal file
275
modules/medical_records/start.php
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
<!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="M8,5.14V19.14L19,12.14L8,5.14Z"/>
|
||||||
|
</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="list.php" class="active">
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
include "../../conn/conn.php";
|
||||||
|
|
||||||
|
$record_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
|
|
||||||
|
if ($record_id <= 0) {
|
||||||
|
echo '<div class="alert alert-error">无效的病历ID</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$action = $_POST['action'] ?? '';
|
||||||
|
|
||||||
|
if ($action == 'start') {
|
||||||
|
$chief_complaint = $_POST['chief_complaint'] ? mysqli_real_escape_string($connID, $_POST['chief_complaint']) : NULL;
|
||||||
|
$notes = $_POST['notes'] ? mysqli_real_escape_string($connID, $_POST['notes']) : NULL;
|
||||||
|
|
||||||
|
$sql = "UPDATE medical_records SET
|
||||||
|
status = '就诊中',
|
||||||
|
chief_complaint = " . ($chief_complaint ? "'$chief_complaint'" : "chief_complaint") . ",
|
||||||
|
notes = " . ($notes ? "'$notes'" : "notes") . "
|
||||||
|
WHERE id = $record_id AND status = '待诊'";
|
||||||
|
|
||||||
|
if (mysqli_query($connID, $sql)) {
|
||||||
|
if (mysqli_affected_rows($connID) > 0) {
|
||||||
|
echo '<div class="alert alert-success">已开始诊治,病历状态已更新!</div>';
|
||||||
|
echo '<script>setTimeout(function(){window.location.href="view.php?id=' . $record_id . '";}, 2000);</script>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert alert-error">操作失败,病历可能已被其他医生处理</div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert alert-error">操作失败:' . mysqli_error($connID) . '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT mr.*, p.name as patient_name, p.gender as patient_gender, p.birth_date, p.phone as patient_phone,
|
||||||
|
d.name as doctor_name, d.specialty, dept.name as department_name
|
||||||
|
FROM medical_records mr
|
||||||
|
JOIN patients p ON mr.patient_id = p.id
|
||||||
|
JOIN doctors d ON mr.doctor_id = d.id
|
||||||
|
JOIN departments dept ON mr.department_id = dept.id
|
||||||
|
WHERE mr.id = $record_id";
|
||||||
|
$result = mysqli_query($connID, $sql);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($result) == 0) {
|
||||||
|
echo '<div class="alert alert-error">病历不存在</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = mysqli_fetch_assoc($result);
|
||||||
|
|
||||||
|
if ($record['status'] != '待诊') {
|
||||||
|
echo '<div class="alert alert-error">该病历状态为:' . $record['status'] . ',无法开始诊治</div>';
|
||||||
|
echo '<div style="text-align: center; margin-top: 20px;">';
|
||||||
|
echo '<a href="view.php?id=' . $record_id . '" class="btn btn-primary">查看病历详情</a>';
|
||||||
|
echo '</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$age = '';
|
||||||
|
if($record['birth_date']) {
|
||||||
|
$today = new DateTime();
|
||||||
|
$birth = new DateTime($record['birth_date']);
|
||||||
|
$age = $today->diff($birth)->y . '岁';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h2 class="card-title">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M8,5.14V19.14L19,12.14L8,5.14Z"/>
|
||||||
|
</svg>
|
||||||
|
开始诊治 - MR<?php echo str_pad($record['id'], 6, '0', STR_PAD_LEFT); ?>
|
||||||
|
</h2>
|
||||||
|
<p style="margin: 8px 0 0 0; color: #666;">
|
||||||
|
将病历状态从 "待诊" 更改为 "就诊中"
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="grid grid-2">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
患者信息
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>姓名:</strong>
|
||||||
|
<span style="color: #1976d2; font-weight: 500;"><?php echo htmlspecialchars($record['patient_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>性别:</strong>
|
||||||
|
<span><?php echo $record['patient_gender']; ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>年龄:</strong>
|
||||||
|
<span><?php echo $age ?: '未知'; ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>联系电话:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['patient_phone']); ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
诊治信息
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>主治医生:</strong>
|
||||||
|
<span style="color: #1976d2; font-weight: 500;"><?php echo htmlspecialchars($record['doctor_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>专业:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['specialty']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>科室:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['department_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>就诊时间:</strong>
|
||||||
|
<span><?php echo date('Y-m-d H:i', strtotime($record['visit_date'])); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>当前状态:</strong>
|
||||||
|
<span class="status-badge status-pending">待诊</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" style="margin-top: 24px;">
|
||||||
|
<input type="hidden" name="action" value="start">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
初步记录(可选)
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">患者主诉</label>
|
||||||
|
<textarea name="chief_complaint" class="form-control" rows="4"
|
||||||
|
placeholder="患者描述的主要症状或不适..."><?php echo htmlspecialchars($record['chief_complaint']); ?></textarea>
|
||||||
|
<small style="color: #666;">可以先记录患者的主要症状,后续可在编辑页面完善</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">医生备注</label>
|
||||||
|
<textarea name="notes" class="form-control" rows="3"
|
||||||
|
placeholder="诊治开始时的备注信息..."><?php echo htmlspecialchars($record['notes']); ?></textarea>
|
||||||
|
<small style="color: #666;">记录诊治开始时需要注意的事项</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 24px; padding: 16px; background: #fff3e0; border-radius: 4px;">
|
||||||
|
<h4 style="margin: 0 0 12px 0; color: #f57c00;">操作说明</h4>
|
||||||
|
<ul style="margin: 0; padding-left: 20px; color: #f57c00; font-size: 14px; line-height: 1.6;">
|
||||||
|
<li>点击"开始诊治"后,病历状态将从"待诊"变更为"就诊中"</li>
|
||||||
|
<li>状态变更后可以进入详细的病历编辑和诊断流程</li>
|
||||||
|
<li>初步信息可选填,主要诊治内容请在后续页面完善</li>
|
||||||
|
<li>开始诊治后可以创建处方和记录详细诊断信息</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: flex; gap: 16px; margin-top: 24px;">
|
||||||
|
<button type="submit" class="btn btn-success" style="font-size: 16px; padding: 12px 24px;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M8,5.14V19.14L19,12.14L8,5.14Z"/>
|
||||||
|
</svg>
|
||||||
|
开始诊治
|
||||||
|
</button>
|
||||||
|
<a href="view.php?id=<?php echo $record['id']; ?>" class="btn btn-secondary">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z"/>
|
||||||
|
</svg>
|
||||||
|
查看详情
|
||||||
|
</a>
|
||||||
|
<a href="list.php" class="btn" style="background: #f5f5f5; color: #666;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
|
||||||
|
</svg>
|
||||||
|
取消
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
335
modules/medical_records/view.php
Normal file
335
modules/medical_records/view.php
Normal file
@ -0,0 +1,335 @@
|
|||||||
|
<!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="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/>
|
||||||
|
</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="list.php" class="active">
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
include "../../conn/conn.php";
|
||||||
|
|
||||||
|
$record_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
|
|
||||||
|
if ($record_id <= 0) {
|
||||||
|
echo '<div class="alert alert-error">无效的病历ID</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT mr.*, p.name as patient_name, p.gender as patient_gender, p.birth_date, p.phone as patient_phone,
|
||||||
|
d.name as doctor_name, d.specialty, dept.name as department_name
|
||||||
|
FROM medical_records mr
|
||||||
|
JOIN patients p ON mr.patient_id = p.id
|
||||||
|
JOIN doctors d ON mr.doctor_id = d.id
|
||||||
|
JOIN departments dept ON mr.department_id = dept.id
|
||||||
|
WHERE mr.id = $record_id";
|
||||||
|
|
||||||
|
$result = mysqli_query($connID, $sql);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($result) == 0) {
|
||||||
|
echo '<div class="alert alert-error">病历不存在</div>';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = mysqli_fetch_assoc($result);
|
||||||
|
|
||||||
|
$status_class = '';
|
||||||
|
switch($record['status']) {
|
||||||
|
case '待诊': $status_class = 'status-pending'; break;
|
||||||
|
case '就诊中': $status_class = 'status-processing'; break;
|
||||||
|
case '已完成': $status_class = 'status-completed'; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$age = '';
|
||||||
|
if($record['birth_date']) {
|
||||||
|
$today = new DateTime();
|
||||||
|
$birth = new DateTime($record['birth_date']);
|
||||||
|
$age = $today->diff($birth)->y . '岁';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<h2 class="card-title">
|
||||||
|
<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>
|
||||||
|
病历号:MR<?php echo str_pad($record['id'], 6, '0', STR_PAD_LEFT); ?>
|
||||||
|
</h2>
|
||||||
|
<div>
|
||||||
|
<span class="status-badge <?php echo $status_class; ?>">
|
||||||
|
<?php echo $record['status']; ?>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 16px;">
|
||||||
|
<?php if($record['status'] != '已完成'): ?>
|
||||||
|
<a href="edit.php?id=<?php echo $record['id']; ?>" class="btn btn-warning">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/>
|
||||||
|
</svg>
|
||||||
|
编辑病历
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if($record['status'] == '待诊'): ?>
|
||||||
|
<a href="start.php?id=<?php echo $record['id']; ?>" class="btn btn-success">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M8,5.14V19.14L19,12.14L8,5.14Z"/>
|
||||||
|
</svg>
|
||||||
|
开始诊治
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if($record['status'] == '就诊中'): ?>
|
||||||
|
<a href="complete.php?id=<?php echo $record['id']; ?>" class="btn btn-success">
|
||||||
|
<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>
|
||||||
|
完成诊治
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<a href="../patients/view.php?id=<?php echo $record['patient_id']; ?>" class="btn btn-primary">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-2">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
患者信息
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>姓名:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['patient_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>性别:</strong>
|
||||||
|
<span><?php echo $record['patient_gender']; ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>年龄:</strong>
|
||||||
|
<span><?php echo $age ?: '未知'; ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>联系电话:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['patient_phone']); ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
医生信息
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div style="display: grid; gap: 12px;">
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>医生:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['doctor_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>专业:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['specialty']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>科室:</strong>
|
||||||
|
<span><?php echo htmlspecialchars($record['department_name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: space-between;">
|
||||||
|
<strong>就诊时间:</strong>
|
||||||
|
<span><?php echo date('Y年m月d日 H:i', strtotime($record['visit_date'])); ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
病历内容
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="grid grid-2">
|
||||||
|
<div>
|
||||||
|
<h4 style="color: #1976d2; margin-bottom: 8px;">主诉</h4>
|
||||||
|
<div style="padding: 12px; background: #f5f5f5; border-radius: 4px; margin-bottom: 16px;">
|
||||||
|
<?php echo $record['chief_complaint'] ? nl2br(htmlspecialchars($record['chief_complaint'])) : '<span style="color: #999;">未填写</span>'; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 style="color: #1976d2; margin-bottom: 8px;">现病史</h4>
|
||||||
|
<div style="padding: 12px; background: #f5f5f5; border-radius: 4px; margin-bottom: 16px;">
|
||||||
|
<?php echo $record['present_illness'] ? nl2br(htmlspecialchars($record['present_illness'])) : '<span style="color: #999;">未填写</span>'; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 style="color: #1976d2; margin-bottom: 8px;">体格检查</h4>
|
||||||
|
<div style="padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
||||||
|
<?php echo $record['physical_examination'] ? nl2br(htmlspecialchars($record['physical_examination'])) : '<span style="color: #999;">未填写</span>'; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h4 style="color: #1976d2; margin-bottom: 8px;">诊断</h4>
|
||||||
|
<div style="padding: 12px; background: #e8f5e8; border-radius: 4px; margin-bottom: 16px;">
|
||||||
|
<?php echo $record['diagnosis'] ? nl2br(htmlspecialchars($record['diagnosis'])) : '<span style="color: #999;">未填写</span>'; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 style="color: #1976d2; margin-bottom: 8px;">治疗方案</h4>
|
||||||
|
<div style="padding: 12px; background: #fff3e0; border-radius: 4px; margin-bottom: 16px;">
|
||||||
|
<?php echo $record['treatment_plan'] ? nl2br(htmlspecialchars($record['treatment_plan'])) : '<span style="color: #999;">未填写</span>'; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if($record['notes']): ?>
|
||||||
|
<h4 style="color: #1976d2; margin-bottom: 8px;">备注</h4>
|
||||||
|
<div style="padding: 12px; background: #f5f5f5; border-radius: 4px;">
|
||||||
|
<?php echo nl2br(htmlspecialchars($record['notes'])); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$prescriptions_sql = "SELECT p.*, m.name as medication_name, m.specification, m.unit
|
||||||
|
FROM prescriptions p
|
||||||
|
JOIN medications m ON p.medication_id = m.id
|
||||||
|
WHERE p.record_id = $record_id
|
||||||
|
ORDER BY p.created_at";
|
||||||
|
$prescriptions_result = mysqli_query($connID, $prescriptions_sql);
|
||||||
|
|
||||||
|
if(mysqli_num_rows($prescriptions_result) > 0):
|
||||||
|
?>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
<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>
|
||||||
|
处方明细
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>药品名称</th>
|
||||||
|
<th>规格</th>
|
||||||
|
<th>剂量</th>
|
||||||
|
<th>用法频次</th>
|
||||||
|
<th>疗程</th>
|
||||||
|
<th>用药说明</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php while($prescription = mysqli_fetch_assoc($prescriptions_result)): ?>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php echo htmlspecialchars($prescription['medication_name']); ?></strong></td>
|
||||||
|
<td><?php echo htmlspecialchars($prescription['specification']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($prescription['dosage']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($prescription['frequency']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($prescription['duration']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($prescription['instructions'] ?: '-'); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div style="margin-top: 24px; text-align: center;">
|
||||||
|
<a href="list.php" class="btn" style="background: #f5f5f5; color: #666;">
|
||||||
|
<svg class="icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"/>
|
||||||
|
</svg>
|
||||||
|
返回病历列表
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 16px; text-align: center; color: #666; font-size: 14px;">
|
||||||
|
创建时间:<?php echo date('Y年m月d日 H:i', strtotime($record['created_at'])); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user