Files
basicBench/010/010_r.html
2026-01-19 21:14:58 +08:00

930 lines
43 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>City General Hospital - HIS System V2.0</title>
<style>
/* === CSS Variables & Reset === */
:root {
--primary: #007bff; /* 医疗蓝 */
--secondary: #6c757d;
--success: #28a745;
--danger: #dc3545;
--warning: #ffc107;
--info: #17a2b8;
--light: #f8f9fa;
--dark: #343a40;
--border-color: #dee2e6;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #f4f6f9;
color: #212529;
margin: 0;
font-size: 14px;
line-height: 1.5;
}
a { text-decoration: none; color: var(--primary); }
a:hover { text-decoration: underline; }
/* === 布局重构:强制覆盖 Table 样式 === */
table, tbody, tr, td { display: block; width: 100% !important; border: none !important; background: transparent !important; padding: 0 !important; }
/* 顶部广播 - 改为顶部通知条 */
body > table:first-of-type {
background: #fff3cd !important; color: #856404; padding: 10px 20px !important; border-bottom: 1px solid #ffeeba !important;
}
body > table:first-of-type font { color: #856404 !important; font-weight: bold; }
body > table:first-of-type font[size="2"] { font-size: 12px; font-weight: normal; margin-left: 10px; }
/* Header 区域 */
body > table:nth-of-type(2) { background: white !important; padding: 10px 20px !important; border-bottom: 1px solid var(--border-color) !important; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
body > table:nth-of-type(2) tr { display: flex; justify-content: space-between; align-items: center; }
body > table:nth-of-type(2) td { width: auto !important; }
body > table:nth-of-type(2) font[size="5"] b { font-size: 20px; color: var(--primary); }
body > table:nth-of-type(2) td:last-child font { color: #666 !important; font-size: 13px; }
body > table:nth-of-type(2) a { color: var(--secondary) !important; margin-left: 10px; font-size: 12px; }
/* 导航菜单 */
body > table:nth-of-type(3) { background: #343a40 !important; padding: 0 !important; }
body > table:nth-of-type(3) td { display: flex; gap: 0; padding: 0 !important; }
/* Nav Item Logic */
.nav-item {
color: rgba(255,255,255,0.7) !important; padding: 12px 20px;
border-right: 1px solid rgba(255,255,255,0.1); cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white !important; text-decoration: none; }
/* Active State */
.nav-item.active { background: var(--primary) !important; color: white !important; font-weight: bold; }
/* === 主体三栏布局 (Grid) === */
.layout-table > tbody > tr {
display: grid; grid-template-columns: 240px 1fr 240px; gap: 20px; padding: 20px; max-width: 1600px; margin: 0 auto; align-items: start;
}
/* 左侧:患者列表 */
.layout-table > tbody > tr > td:first-child {
background: white !important; border-radius: 4px; border: 1px solid var(--border-color) !important; overflow: hidden;
}
/* 患者列表标题 */
.layout-table > tbody > tr > td:first-child table tr:first-child td {
background: #f8f9fa !important; padding: 10px 15px !important; border-bottom: 1px solid var(--border-color) !important;
}
.layout-table > tbody > tr > td:first-child table tr:first-child font { color: #333 !important; font-weight: bold; }
/* 患者项 */
.layout-table > tbody > tr > td:first-child table tr:not(:first-child) td {
padding: 15px !important; border-bottom: 1px solid #eee !important; cursor: pointer; transition: background 0.2s;
}
.layout-table > tbody > tr > td:first-child table tr:not(:first-child) td:hover { background: #f1f7ff !important; }
/* VIP 样式处理 */
.layout-table > tbody > tr > td:first-child table tr[bgcolor="#ffffcc"] td {
background: #fffbe6 !important; border-left: 3px solid var(--warning) !important;
}
/* 隐藏左侧栏的广告 (医药代表, 食堂) */
.layout-table > tbody > tr > td:first-child table[bgcolor="#e0ffff"],
.layout-table > tbody > tr > td:first-child table[bgcolor="#ffe4e1"] { display: none !important; }
/* 中间:工作区 */
.layout-table > tbody > tr > td:nth-child(2) {
background: transparent !important;
}
/* 患者信息卡片 */
.layout-table > tbody > tr > td:nth-child(2) > table:first-child {
background: white !important; padding: 20px !important; border-radius: 4px; border: 1px solid var(--border-color) !important; margin-bottom: 20px;
display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px;
}
/* 标题行跨列 */
.layout-table > tbody > tr > td:nth-child(2) > table:first-child tr:first-child {
grid-column: 1 / -1; background: transparent !important; border-bottom: 1px solid #eee !important; padding-bottom: 10px !important; margin-bottom: 10px; font-size: 16px;
}
/* 信息行 Grid 化 */
.layout-table > tbody > tr > td:nth-child(2) > table:first-child tr:not(:first-child) {
display: flex; gap: 10px; align-items: baseline;
}
/* 医嘱表单 */
.layout-table > tbody > tr > td:nth-child(2) form table {
background: white !important; border-radius: 4px; border: 1px solid var(--border-color) !important; overflow: hidden;
}
/* 表头 */
.layout-table > tbody > tr > td:nth-child(2) form table tr:first-child {
background: #f8f9fa !important; padding: 10px 15px !important; border-bottom: 1px solid var(--border-color) !important;
}
.layout-table > tbody > tr > td:nth-child(2) form table tr:nth-child(2) {
display: grid; grid-template-columns: 40px 1.5fr 1fr 2fr 80px; background: #fafafa; border-bottom: 1px solid var(--border-color); padding: 10px !important; font-weight: bold; font-size: 12px; color: #666;
}
/* 药品行 */
.layout-table > tbody > tr > td:nth-child(2) form table tr:not(:first-child):not(:nth-child(2)):not(:last-child) {
display: grid; grid-template-columns: 40px 1.5fr 1fr 2fr 80px; padding: 10px !important; border-bottom: 1px solid #eee; align-items: center;
}
/* 隐藏干扰行 (库存警告) */
.layout-table > tbody > tr > td:nth-child(2) form table tr[bgcolor="#ffebcd"] { display: none !important; }
/* 底部按钮组 - 覆盖旧样式 */
.layout-table > tbody > tr > td:nth-child(2) form table tr:last-child td {
padding: 15px !important; display: flex; gap: 10px; justify-content: flex-end; background: #f8f9fa !important;
}
/* Toast Styles */
.toast {
position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
background: #333; color: white; padding: 12px 24px; border-radius: 4px;
z-index: 2000; opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }
/* 检查报告 */
.layout-table > tbody > tr > td:nth-child(2) > table:last-of-type {
background: white !important; margin-top: 20px; border: 1px solid var(--border-color) !important; border-radius: 4px; padding: 15px !important;
}
/* 隐藏系统升级通知 Div */
.layout-table > tbody > tr > td:nth-child(2) > div { display: none !important; }
/* 右侧:辅助工具 */
.layout-table > tbody > tr > td:last-child {
background: white !important; padding: 20px !important; border-radius: 4px; border: 1px solid var(--border-color) !important;
}
/* 临床路径/值班表 标题美化 */
.layout-table > tbody > tr > td:last-child table tr:first-child td {
background: transparent !important; color: #333 !important; font-weight: bold; border-bottom: 2px solid var(--primary) !important; padding-bottom: 5px !important; margin-bottom: 10px;
}
.layout-table > tbody > tr > td:last-child table tr:first-child font { color: #333 !important; }
/* 复选框行间距 */
.layout-table > tbody > tr > td:last-child table tr:not(:first-child) td { padding: 5px 0 !important; }
/* 隐藏右侧的“常用链接”和下面的无序列表 */
.layout-table > tbody > tr > td:last-child > p { display: none; }
.layout-table > tbody > tr > td:last-child > ul { display: none; }
/* 页脚 */
center:last-of-type {
margin-top: 40px; border-top: 1px solid var(--border-color); padding: 20px; color: #999; font-size: 12px;
}
hr { display: none; }
/* === Enhanced Dynamic Styles === */
.patient-row { cursor: pointer; transition: 0.2s; }
.patient-row:hover { background-color: #f1f7ff; }
.patient-row.active { background-color: #e3f2fd !important; border-left: 4px solid var(--primary) !important; }
.status-badge { padding: 2px 6px; border-radius: 4px; font-size: 11px; color: white; display:inline-block; margin-left:5px; }
.badge-signed { background-color: var(--success); }
.badge-draft { background-color: var(--secondary); }
.badge-vip { background-color: var(--warning); color: #856404; }
/* Modal Styles */
.modal-overlay {
position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000;
display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); width: 450px;
transform: translateY(-20px); transition: 0.3s;
}
.modal-overlay.show .modal-box { transform: translateY(0); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; color: #333; }
.form-group input, .form-group select { width: 100%; padding: 8px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px; font-size:14px; }
</style>
</head>
<body bgcolor="#e6e6e6" text="#000000" link="#000080" vlink="#800080" alink="#FF0000">
<!-- Add Drug Modal -->
<div id="drug-modal" class="modal-overlay">
<div class="modal-box">
<h3 style="margin-top:0; color:var(--primary); border-bottom:1px solid #eee; padding-bottom:10px;">新增长嘱</h3>
<div class="form-group">
<label>药品名称</label>
<select id="modal-drug-name" onchange="updateDrugSpecs()">
<option value="">-- 请选择 --</option>
<option value="Aspirin">阿司匹林肠溶片</option>
<option value="Atorvastatin">阿托伐他汀钙片</option>
<option value="Metoprolol">美托洛尔缓释片</option>
<option value="Cefradine">头孢拉定胶囊</option>
<option value="Ibuprofen">布洛芬缓释胶囊</option>
<option value="Insulin">人胰岛素注射液</option>
<option value="Omeprazole">奥美拉唑肠溶胶囊</option>
<option value="Metformin">二甲双胍片</option>
</select>
</div>
<div class="form-group">
<label>规格 & 包装</label>
<input type="text" id="modal-drug-spec" readonly style="background:#f5f5f5; color:#666;">
</div>
<div class="form-group">
<label>用法用量</label>
<div style="display:flex; gap:10px;">
<input type="text" id="modal-drug-dose" placeholder="剂量 (如 100mg)">
<select id="modal-drug-freq" style="width:140px;">
<option value="qd">qd (每日一次)</option>
<option value="bid">bid (每日两次)</option>
<option value="tid">tid (每日三次)</option>
<option value="qid">qid (每日四次)</option>
<option value="qn">qn (每晚一次)</option>
<option value="prn">prn (必要时)</option>
</select>
</div>
</div>
<div class="form-group">
<label>给药途径</label>
<select id="modal-drug-route">
<option value="口服">PO (口服)</option>
<option value="静脉注射">IV (静脉注射)</option>
<option value="皮下注射">IH (皮下注射)</option>
<option value="雾化吸入">Inhale (雾化吸入)</option>
</select>
</div>
<div style="text-align:right; margin-top:20px; padding-top:10px; border-top:1px solid #eee;">
<button type="button" onclick="closeModal()" style="padding:8px 15px; margin-right:10px; background:white; border:1px solid #ccc; border-radius:4px; cursor:pointer;">取消</button>
<button type="button" onclick="confirmAddDrug()" style="padding:8px 15px; background:var(--primary); color:white; border:none; border-radius:4px; cursor:pointer;">确认开立</button>
</div>
</div>
</div>
<div id="toast" class="toast">操作成功</div>
<table width="100%" border="1" bgcolor="#ffcccc" cellpadding="5">
<tr>
<td align="center">
<font color="red"><b>全院广播:</b> 请各科室注意,下午 3 点在行政楼会议室召开医保控费紧急会议。</font>
<br>
<font size="2">发布时间2025-12-22 08:30</font>
</td>
</tr>
</table>
<br>
<table width="100%" border="0" bgcolor="#008080" cellpadding="10">
<tr>
<td width="50%">
<font color="white" size="5"><b>市中心医院 - 医生工作站</b></font>
</td>
<td width="50%" align="right">
<font color="white">
当前用户:<b>李医生 (主治医师)</b> | 科室:心内科<br>
<a href="javascript:void(0)" onclick="modifyPassword()" style="color:yellow">[修改密码]</a>
<a href="javascript:void(0)" onclick="logout()" style="color:white">[注销登录]</a>
</font>
</td>
</tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bgcolor="#343a40">
<tr>
<td style="display:flex; padding:0;">
<div class="nav-item active" onclick="switchModule(this, 'clinic')">门诊工作台</div>
<div class="nav-item" onclick="switchModule(this, 'inpatient')">住院部管理</div>
<div class="nav-item" onclick="switchModule(this, 'surgery')">手术排期</div>
<div class="nav-item" onclick="switchModule(this, 'lab')">检验报告查询</div>
<div class="nav-item" onclick="switchModule(this, 'pharmacy')">药房库存</div>
<div class="nav-item" onclick="switchModule(this, 'admin')">医嘱管理</div>
</td>
</tr>
</table>
<br>
<!-- Module: Clinic (Doctor Station) -->
<div id="module-clinic" class="main-module">
<table class="layout-table" width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="250" valign="top" bgcolor="#f0f0f0" style="height: 100%;">
<br>
<table width="100%" border="1" cellpadding="0" style="background:white; border-radius:4px; overflow:hidden; border-collapse:collapse;">
<tr><td bgcolor="#008080" style="padding:10px;"><font color="white"><b>待诊患者列表 (<span id="patient-count">0</span>)</b></font></td></tr>
<tbody id="patient-list-container">
<!-- Dynamic Content -->
</tbody>
</table>
<div style="margin-top:20px; padding:15px; background:#fff3cd; border:1px solid #ffeeba; border-radius:4px; color:#856404; font-size:12px;">
<b>值班提示:</b><br>
今晚急诊科留观床位已满,请协调转运。
</div>
</td>
<td valign="top">
<!-- Patient Info Header -->
<table width="100%" border="1" cellpadding="5" bgcolor="#ffffff" id="patient-info-card" style="margin-bottom:20px;">
<tr><td align="center" style="padding:40px; color:#999;">正在加载患者信息...</td></tr>
</table>
<!-- Order Entry Form -->
<div id="order-panel" style="display:none;">
<form onsubmit="event.preventDefault();">
<table width="100%" border="1" cellpadding="3" cellspacing="0">
<tr>
<td colspan="6" bgcolor="#dddddd" style="display:flex; justify-content:space-between; align-items:center;">
<b>长期医嘱录入</b>
<span style="font-size:12px; color:#666;">上次刷新: <span id="last-sync-time">Just now</span></span>
</td>
</tr>
<thead style="background:#fafafa; color:#666; font-size:12px; font-weight:bold;">
<tr style="display:grid; grid-template-columns: 40px 1.5fr 1fr 2fr 100px 80px; padding:10px; border-bottom:1px solid #eee;">
<td></td>
<td>药品名称</td>
<td>规格</td>
<td>用法用量</td>
<td>状态</td>
<td>操作</td>
</tr>
</thead>
<tbody id="order-list-body">
<!-- Dynamic Orders -->
</tbody>
<tr>
<td colspan="6" align="right" style="padding:15px; border-top:1px solid #eee; background:#f8f9fa;">
<button type="button" onclick="openAddDrugModal()" style="padding:8px 16px; background:white; border:1px solid #ced4da; color:var(--primary); border-radius:4px; cursor:pointer; font-weight:500;">+ 新增药品</button>
<button type="button" onclick="signOrder()" style="padding:8px 16px; background:var(--primary); color:white; border:none; border-radius:4px; cursor:pointer; margin-left:10px; font-weight:500;">签署医嘱</button>
<button type="button" onclick="voidOrder()" style="padding:8px 16px; background:var(--danger); color:white; border:none; border-radius:4px; cursor:pointer; margin-left:5px; font-weight:500;">作废条目</button>
</td>
</tr>
</table>
</form>
</div>
<br>
<!-- Labs -->
<table width="100%" border="1" cellpadding="3" id="lab-panel" style="display:none; background:white; border-radius:4px;">
<tr><td bgcolor="#dddddd"><b>检查报告 / 检验结果</b></td></tr>
<tr>
<td>
<ul style="padding-left:20px; margin:10px 0;" id="lab-list">
<!-- Dynamic Labs -->
</ul>
</td>
</tr>
</table>
</td>
<td width="200" valign="top" bgcolor="#f0f0f0">
<br>
<table width="100%" border="1" cellpadding="3">
<tr><td bgcolor="#008080"><font color="white"><b>临床路径</b></font></td></tr>
<tbody id="clinical-path-list">
<!-- Dynamic -->
</tbody>
</table>
<br>
<table width="100%" border="1" cellpadding="3">
<tr><td bgcolor="#008080"><font color="white"><b>值班排班</b></font></td></tr>
<tr><td>周一:张医生 (白)</td></tr>
<tr><td>周一:王医生 (夜)</td></tr>
<tr><td>周二:李医生 (白)</td></tr>
<tr><td>周二:赵医生 (夜)</td></tr>
</table>
<br>
<p><b>常用链接:</b></p>
<ul>
<li><a href="javascript:void(0)" onclick="openOA()">OA系统</a></li>
<li><a href="javascript:void(0)" onclick="openLibrary()">医学文献库</a></li>
</ul>
</td>
</tr>
</table>
</div>
<!-- Module: Inpatient -->
<div id="module-inpatient" class="main-module" style="display:none; padding:20px;">
<div style="background:white; padding:30px; border-radius:8px; text-align:center; border:1px solid #ddd;">
<h2 style="color:#007bff;">住院部床位管理系统</h2>
<p style="color:#666;">当前空闲床位: 12 张 | 重症监护室: 满员</p>
<div style="margin-top:20px; display:grid; grid-template-columns:repeat(auto-fill, minmax(100px, 1fr)); gap:10px;">
<div style="background:#d4edda; padding:10px; border-radius:4px; color:#155724;">01床 (空)</div>
<div style="background:#f8d7da; padding:10px; border-radius:4px; color:#721c24;">02床 (占用)</div>
<div style="background:#f8d7da; padding:10px; border-radius:4px; color:#721c24;">03床 (占用)</div>
<div style="background:#d4edda; padding:10px; border-radius:4px; color:#155724;">04床 (空)</div>
<div style="background:#fff3cd; padding:10px; border-radius:4px; color:#856404;">05床 (预留)</div>
</div>
</div>
</div>
<!-- Module: Surgery -->
<div id="module-surgery" class="main-module" style="display:none; padding:20px;">
<div style="background:white; padding:30px; border-radius:8px; border:1px solid #ddd;">
<h2 style="color:#007bff; border-bottom:1px solid #eee; padding-bottom:10px;">手术排期表 (2025-12-23)</h2>
<table width="100%" border="0" cellpadding="10">
<tr bgcolor="#f8f9fa" style="font-weight:bold;"><td>时间</td><td>手术室</td><td>患者</td><td>手术名称</td><td>主刀</td></tr>
<tr><td>08:00</td><td>OR-01</td><td>张三</td><td>冠状动脉搭桥术</td><td>Dr. Liu</td></tr>
<tr><td>09:30</td><td>OR-03</td><td>Unknown</td><td>急诊阑尾切除</td><td>Dr. Wang</td></tr>
<tr><td>13:00</td><td>OR-02</td><td>李四</td><td>白内障超声乳化</td><td>Dr. Zhang</td></tr>
</table>
</div>
</div>
<!-- Module: Lab -->
<div id="module-lab" class="main-module" style="display:none; padding:20px;">
<div style="background:white; padding:40px; border-radius:8px; text-align:center; border:1px solid #ddd;">
<h2 style="color:#17a2b8;">LIS 检验报告查询</h2>
<input id="lab-search-input" type="text" placeholder="输入住院号/姓名搜索..." style="padding:10px; width:300px; border:1px solid #ccc; border-radius:4px;">
<button onclick="searchLabReport()" style="padding:10px 20px; background:#17a2b8; color:white; border:none; border-radius:4px; cursor:pointer;">查询</button>
</div>
</div>
<!-- Module: Pharmacy -->
<div id="module-pharmacy" class="main-module" style="display:none; padding:20px;">
<div style="background:white; padding:30px; border-radius:8px; border:1px solid #ddd;">
<h2 style="color:#28a745;">药房库存预警</h2>
<table width="100%" border="0" cellpadding="8">
<tr style="border-bottom:2px solid #eee;"><td>药品名</td><td>库存量</td><td>状态</td><td>操作</td></tr>
<tr><td>阿司匹林</td><td>12,000</td><td style="color:green">充足</td><td>-</td></tr>
<tr><td>胰岛素注射液</td><td>50</td><td style="color:red; font-weight:bold;">缺货预警</td><td><a href="javascript:void(0)" onclick="restockDrug('胰岛素注射液')">申请补货</a></td></tr>
<tr><td>头孢拉定</td><td>340</td><td style="color:orange">一般</td><td>-</td></tr>
</table>
</div>
</div>
<!-- Module: Admin -->
<div id="module-admin" class="main-module" style="display:none; padding:20px;">
<div style="background:white; padding:30px; border-radius:8px; border:1px solid #ddd;">
<h2 style="color:#6c757d;">系统管理 & 医嘱审核</h2>
<div id="admin-task-area">
<p>当前共有 <b>3</b> 条医嘱待主任审核。</p>
<button onclick="batchApproveOrders()" style="padding:8px 15px; background:#007bff; color:white; border:none; border-radius:4px; cursor:pointer;">批量通过</button>
<button onclick="batchRejectOrders()" style="padding:8px 15px; background:#dc3545; color:white; border:none; border-radius:4px; cursor:pointer;">批量驳回</button>
</div>
</div>
</div>
<hr>
<center>
<font size="1">
技术支持:市卫生信息中心 | 电话8888-1234<br>
版权所有 © 2025 City General Hospital
</font>
</center>
<script>
// -------------------------------------------------------------------------
// Mock Data
// -------------------------------------------------------------------------
const DRUG_DICT = {
'Aspirin': { name: '阿司匹林肠溶片', spec: '100mg*30片' },
'Atorvastatin': { name: '阿托伐他汀钙片', spec: '20mg*7片' },
'Metoprolol': { name: '美托洛尔缓释片', spec: '47.5mg*7片' },
'Cefradine': { name: '头孢拉定胶囊', spec: '0.25g*24粒' },
'Ibuprofen': { name: '布洛芬缓释胶囊', spec: '0.3g*10粒' },
'Insulin': { name: '人胰岛素注射液', spec: '3ml:300IU' },
'Omeprazole': { name: '奥美拉唑肠溶胶囊', spec: '20mg*14粒' },
'Metformin': { name: '二甲双胍片', spec: '0.5g*20片' }
};
let PATIENTS = [
{
id: 101, name: "张三", gender: "男", age: 45, type: "common",
complaint: "胸闷气短三天",
diagnosis: "冠心病; 心绞痛",
tags: ["胸痛", "高血压"],
allergies: ["青霉素"],
insurance: "省医保",
vitals: { bp: "140/90", hr: 88, t: 36.5 },
orders: [
{ id: 1, drug: "Aspirin", dose: "100mg", freq: "qd", route: "口服", status: "signed" },
{ id: 2, drug: "Atorvastatin", dose: "20mg", freq: "qn", route: "口服", status: "signed" }
],
labs: [
{ date: "2025-12-20", name: "心电图", result: "窦性心律ST段轻度压低", link: true},
{ date: "2025-12-20", name: "心脏彩超", result: "左室舒张功能减低EF 55%", link: true},
{ date: "2025-12-19", name: "血常规", result: "WBC 6.5, Hb 135, PLT 210", link: false}
],
pathways: [
{ name: "入院宣教", checked: true },
{ name: "签署知情同意书", checked: true },
{ name: "上级医师查房", checked: false },
{ name: "术前讨论", checked: false }
]
},
{
id: 102, name: "李四", gender: "女", age: 62, type: "common",
complaint: "头晕伴恶心一周",
diagnosis: "高血压病(3级); 颈椎病",
tags: ["头晕"],
allergies: ["无"],
insurance: "新农合",
vitals: { bp: "160/100", hr: 76, t: 36.8 },
orders: [
{ id: 3, drug: "Metoprolol", dose: "23.75mg", freq: "qd", route: "口服", status: "draft" }
],
labs: [
{ date: "2025-12-21", name: "头颅CT", result: "未见明显异常", link: true},
{ date: "2025-12-21", name: "生化全套", result: "TG 2.3mmol/L (偏高)", link: false}
],
pathways: [
{ name: "入院宣教", checked: true },
{ name: "血压监测 (Q4H)", checked: true },
{ name: "眼底检查", checked: false }
]
},
{
id: 103, name: "王总", gender: "男", age: 50, type: "vip",
complaint: "年度体检报告咨询",
diagnosis: "脂肪肝; 高尿酸血症",
tags: ["VIP", "体检"],
allergies: ["磺胺类"],
insurance: "自费",
vitals: { bp: "130/85", hr: 80, t: 36.6 },
orders: [], // Empty initially
labs: [
{ date: "2025-12-22", name: "肝功能", result: "ALT 55, AST 40", link: false},
{ date: "2025-12-22", name: "腹部B超", result: "中度脂肪肝", link: true}
]
},
{
id: 104, name: "赵六", gender: "男", age: 28, type: "common",
complaint: "急性胃痛2小时",
diagnosis: "急性胃炎",
tags: ["急诊"],
allergies: ["无"],
insurance: "市医保",
vitals: { bp: "120/75", hr: 92, t: 37.2 },
orders: [
{ id: 4, drug: "Omeprazole", dose: "20mg", freq: "qd", route: "口服", status: "signed" }
],
labs: []
}
];
let currentPatientId = null;
// -------------------------------------------------------------------------
// Utils
// -------------------------------------------------------------------------
function showToast(msg, type = 'info') {
const container = document.getElementById('toast-container');
if(!container) return; // safety
const toast = document.createElement('div');
toast.className = 'toast';
toast.style.background = type === 'error' ? 'rgba(220, 53, 69, 0.9)' : 'rgba(0, 0, 0, 0.8)';
toast.innerText = msg;
container.appendChild(toast);
// Trigger reflow
void toast.offsetWidth;
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
setTimeout(() => toast.remove(), 300);
}, 3000);
}
function switchModule(el, moduleName) {
// Toggle active state in Nav
document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
if (el) el.classList.add('active');
// Hide all modules
document.querySelectorAll('.main-module').forEach(m => m.style.display = 'none');
// Show target module
const target = document.getElementById(`module-${moduleName}`);
if(target) {
target.style.display = 'block';
showToast(`已切换至 [${moduleName === 'clinic' ? '门诊工作台' :
moduleName === 'inpatient' ? '住院部管理' :
moduleName === 'surgery' ? '手术排期' :
moduleName === 'lab' ? '检验报告' :
moduleName === 'pharmacy' ? '药房库存' : '医嘱管理'}]`);
} else {
// Fallback
document.getElementById('module-clinic').style.display = 'block';
showToast(`模块 [${moduleName}] 正在维护中`, "warning");
}
}
function logout() {
if(confirm("确定要退出当前用户 (Dr. Zhang) 吗?")) {
showToast("正在注销...", "info");
setTimeout(() => location.reload(), 1000);
}
}
function openOA() { showToast("正在打开OA办公系统..."); }
function openLibrary() { showToast("正在连接医院知识库..."); }
function modifyPassword() { showToast("请联系信息科重置密码"); }
// -------------------------------------------------------------------------
// Core Logic
// -------------------------------------------------------------------------
// Initialize
window.onload = function() {
document.getElementById('patient-count').innerText = PATIENTS.length;
renderPatientList();
// Automatically select first patient
if(PATIENTS.length > 0) {
selectPatient(PATIENTS[0].id);
}
// Update time
document.getElementById('last-sync-time').innerText = new Date().toLocaleTimeString();
};
function renderPatientList() {
const tbody = document.getElementById('patient-list-container');
tbody.innerHTML = '';
PATIENTS.forEach(p => {
const tr = document.createElement('tr');
tr.className = `patient-row ${currentPatientId === p.id ? 'active' : ''}`;
tr.onclick = () => selectPatient(p.id);
// Background color for VIP or special rows based on type/logic
let rowStyle = '';
if (p.type === 'vip') rowStyle = 'background-color:#fffbe6;';
// Name display formatting
let nameHtml = `<b>${p.id}. ${p.name} (${p.gender}, ${p.age}岁)</b>`;
if (p.type === 'vip') nameHtml = `<font color="red"><b>VIP. ${p.name} (${p.gender}, ${p.age}岁)</b></font>`;
const actionsHtml = `<div style="margin-top:5px;">
<a href="javascript:void(0)" style="font-size:12px;">[接诊]</a>
<a href="javascript:void(0)" style="font-size:12px; color:#999; margin-left:5px;">[过号]</a>
</div>`;
tr.innerHTML = `
<td style="padding:15px; border-bottom:1px solid #eee; ${rowStyle}">
${nameHtml}<br>
<font size="2" color="#666">主诉:${p.complaint}</font><br>
${actionsHtml}
</td>
`;
tbody.appendChild(tr);
});
}
function selectPatient(id) {
currentPatientId = id;
renderPatientList(); // Re-render to update highlight
const p = PATIENTS.find(x => x.id === id);
if(!p) return;
// Render Top Info
const infoCard = document.getElementById('patient-info-card');
const allergyHtml = p.allergies.includes("无") ? '无' : `<font color="red" style="background:#ffe3e3; padding:2px 5px; border-radius:3px;">${p.allergies.join(',')}</font>`;
infoCard.innerHTML = `
<tr>
<td colspan="4" bgcolor="#cccccc"><b>当前患者:${p.name} (ID: 2025${p.id})</b> - <font color="#333">${p.diagnosis}</font></td>
</tr>
<tr>
<td width="15%"><b>过敏史:</b></td>
<td width="35%">${allergyHtml}</td>
<td width="15%"><b>费别:</b></td>
<td width="35%">${p.insurance}</td>
</tr>
<tr>
<td><b>生命体征:</b></td>
<td colspan="3">BP: ${p.vitals.bp} mmHg, HR: ${p.vitals.hr}, T: ${p.vitals.t}°C</td>
</tr>
`;
// Render Labs
const labList = document.getElementById('lab-list');
labList.innerHTML = '';
if (p.labs.length === 0) {
labList.innerHTML = '<li style="color:#999;font-style:italic;">暂无检查结果</li>';
} else {
p.labs.forEach(lab => {
const linkPart = lab.link ? ` <a href="javascript:void(0)" onclick="viewLabImage('${lab.name}')">[查看图像]</a>` : '';
const li = document.createElement('li');
li.style.marginBottom = '5px';
li.innerHTML = `${lab.date}: ${lab.name} - ${lab.result} ${linkPart}`;
labList.appendChild(li);
});
}
// Show Panels
document.getElementById('order-panel').style.display = 'block';
document.getElementById('lab-panel').style.display = 'block';
renderOrders();
renderClinicalPaths();
}
function renderClinicalPaths() {
const p = PATIENTS.find(x => x.id === currentPatientId);
const container = document.getElementById('clinical-path-list');
if(!container) return;
container.innerHTML = '';
if(!p.pathways || p.pathways.length === 0) {
container.innerHTML = '<tr><td colspan="2" style="color:#999; text-align:center;">暂无临床路径任务</td></tr>';
return;
}
p.pathways.forEach((path, idx) => {
const tr = document.createElement('tr');
const isChecked = path.checked ? 'checked' : '';
const statusColor = path.checked ? 'green' : '#666';
tr.innerHTML = `
<td width="30" align="center">
<input type="checkbox" ${isChecked} disabled>
</td>
<td style="color:${statusColor};">${path.name}</td>
`;
container.appendChild(tr);
});
}
function renderOrders() {
const p = PATIENTS.find(x => x.id === currentPatientId);
const tbody = document.getElementById('order-list-body');
tbody.innerHTML = '';
if(p.orders.length === 0) {
tbody.innerHTML = '<tr><td colspan="6" align="center" style="padding:20px; color:#999;">暂无医嘱,请点击“新增药品”开立</td></tr>';
return;
}
p.orders.forEach(order => {
const drugInfo = DRUG_DICT[order.drug] || { name: order.drug, spec: '未知' };
let statusBadge = '';
let actionHtml = '';
if (order.status === 'signed') {
statusBadge = '<span class="status-badge badge-signed">已签署</span>';
actionHtml = '<span style="color:#ccc; font-size:12px;">不可撤</span>'; // Simplify logic
} else {
statusBadge = '<span class="status-badge badge-draft">草稿</span>';
actionHtml = `<a href="javascript:void(0)" style="color:#dc3545;" onclick="removeOrder(${order.id})">删除</a>`;
}
const tr = document.createElement('tr');
// Use grid style matching header
tr.style.display = 'grid';
tr.style.gridTemplateColumns = '40px 1.5fr 1fr 2fr 100px 80px';
tr.style.padding = '10px';
tr.style.borderBottom = '1px solid #eee';
tr.style.alignItems = 'center';
tr.innerHTML = `
<td align="center"><input type="checkbox" name="order-select" value="${order.id}"></td>
<td>${drugInfo.name}</td>
<td>${drugInfo.spec}</td>
<td>
${order.status === 'draft' ?
`<input type="text" value="${order.dose}" style="width:50px; border:1px solid #ddd; padding:2px;"> <span style="font-size:12px;">${order.freq}</span>` :
`<b>${order.dose}</b> ${order.freq} ${order.route}`
}
</td>
<td>${statusBadge}</td>
<td>${actionHtml}</td>
`;
tbody.appendChild(tr);
});
}
// -------------------------------------------------------------------------
// Actions
// -------------------------------------------------------------------------
function openAddDrugModal() {
document.getElementById('drug-modal').classList.add('show');
// Reset form
document.getElementById('modal-drug-spec').value = '';
document.getElementById('modal-drug-name').value = '';
document.getElementById('modal-drug-dose').value = '';
}
function closeModal() {
document.getElementById('drug-modal').classList.remove('show');
}
function updateDrugSpecs() {
const key = document.getElementById('modal-drug-name').value;
const specInput = document.getElementById('modal-drug-spec');
if(key && DRUG_DICT[key]) {
specInput.value = DRUG_DICT[key].spec;
} else {
specInput.value = '';
}
}
function confirmAddDrug() {
const key = document.getElementById('modal-drug-name').value;
const dose = document.getElementById('modal-drug-dose').value;
if(!key || !dose) {
showToast("请完善药品和剂量信息", "error");
return;
}
const freq = document.getElementById('modal-drug-freq').value;
const route = document.getElementById('modal-drug-route').value;
const p = PATIENTS.find(x => x.id === currentPatientId);
// Add new order
p.orders.push({
id: Date.now(),
drug: key,
dose: dose,
freq: freq,
route: route,
status: 'draft'
});
closeModal();
renderOrders();
showToast("医嘱已开立 (草稿)", "success");
}
function removeOrder(orderId) {
if(!confirm("确定要删除这条医嘱吗?")) return;
const p = PATIENTS.find(x => x.id === currentPatientId);
p.orders = p.orders.filter(o => o.id !== orderId);
renderOrders();
showToast("医嘱已删除");
}
function signOrder() {
const p = PATIENTS.find(x => x.id === currentPatientId);
const drafts = p.orders.filter(o => o.status === 'draft');
if (drafts.length === 0) {
showToast("当前没有需要签署的草稿医嘱。", "warning");
return;
}
const pin = prompt(`正在为患者 [${p.name}] 签署 ${drafts.length} 条医嘱。\n\n请输入电子签名密码 (随意输入):`);
if(pin) {
drafts.forEach(o => o.status = 'signed');
showToast("医嘱已签署,并发送至药房系统。", "success");
renderOrders();
}
}
function voidOrder() {
showToast("请先选择要作废的已签署医嘱,然后提交医务科审核。", "warning");
}
function viewLabImage(name) {
showToast(`正在调取 PACS 系统图像: ${name}...`, "info");
}
// -------------------------------------------------------------------------
// Module Logic (New)
// -------------------------------------------------------------------------
function searchLabReport() {
const val = document.getElementById('lab-search-input').value;
if(!val) {
showToast("请输入查询关键字", "warning");
return;
}
showToast(`正在 LIS 系统中检索 [${val}] 的报告...`, "info");
setTimeout(() => {
showToast("未查询到相关记录 (模拟)", "error");
}, 1500);
}
function restockDrug(drugName) {
if(confirm(`确定要向药库发送 [${drugName}] 的补货申请吗?`)) {
showToast("补货申请已提交至物资科", "success");
}
}
function batchApproveOrders() {
if(confirm("确定要批量审核通过这 3 条医嘱吗?")) {
showToast("已完成批量审核", "success");
document.getElementById('admin-task-area').innerHTML = '<p style="color:green;">所有待办任务已处理完毕。</p>';
}
}
function batchRejectOrders() {
const reason = prompt("请输入驳回原因:");
if(reason) {
showToast(`已驳回 3 条医嘱,原因: ${reason}`, "info");
document.getElementById('admin-task-area').innerHTML = '<p style="color:green;">所有待办任务已处理完毕。</p>';
}
}
console.log("HIS System Loaded. Interface modernized.");
</script>
</body>
</html>