|
|
@@ -0,0 +1,1705 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>智慧病房管理平台 - 主页</title>
|
|
|
+ <style>
|
|
|
+ * {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+
|
|
|
+ body {
|
|
|
+ font-family: 'Microsoft YaHei', Arial, sans-serif;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ }
|
|
|
+
|
|
|
+ .container {
|
|
|
+ display: flex;
|
|
|
+ min-height: 100vh;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 左侧导航栏样式 */
|
|
|
+ .sidebar {
|
|
|
+ width: 250px;
|
|
|
+ background: #2c3e50;
|
|
|
+ color: white;
|
|
|
+ transition: all 0.3s ease;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sidebar-header {
|
|
|
+ padding: 15px;
|
|
|
+ background: #1a252f;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ border-bottom: 1px solid #34495e;
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu {
|
|
|
+ list-style: none;
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu-item {
|
|
|
+ border-bottom: 1px solid #34495e;
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu-item > a {
|
|
|
+ display: block;
|
|
|
+ padding: 12px 15px;
|
|
|
+ color: #ecf0f1;
|
|
|
+ text-decoration: none;
|
|
|
+ transition: background 0.3s ease;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu-item > a:hover {
|
|
|
+ background: #34495e;
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu-item > a i {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .submenu {
|
|
|
+ list-style: none;
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
+ background: #34495e;
|
|
|
+ max-height: 0;
|
|
|
+ overflow: hidden;
|
|
|
+ transition: max-height 0.3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ .submenu.open {
|
|
|
+ max-height: 500px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .submenu li a {
|
|
|
+ display: block;
|
|
|
+ padding: 10px 15px 10px 30px;
|
|
|
+ color: #bdc3c7;
|
|
|
+ text-decoration: none;
|
|
|
+ transition: all 0.3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ .submenu li a:hover {
|
|
|
+ background: #2c3e50;
|
|
|
+ color: white;
|
|
|
+ padding-left: 45px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .submenu li a.active {
|
|
|
+ background: #1a252f;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 主内容区域样式 */
|
|
|
+ .main-content {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ .header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 12px 20px;
|
|
|
+ background: white;
|
|
|
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
|
+ z-index: 100;
|
|
|
+ }
|
|
|
+
|
|
|
+ .welcome {
|
|
|
+ font-size: 18px;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .logout-btn {
|
|
|
+ padding: 8px 16px;
|
|
|
+ background: #dc3545;
|
|
|
+ color: white;
|
|
|
+ border: none;
|
|
|
+ border-radius: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .content {
|
|
|
+ flex: 1;
|
|
|
+ padding: 20px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .page-title {
|
|
|
+ margin-bottom: 15px;
|
|
|
+ color: #333;
|
|
|
+ font-size: 24px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .dashboard {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
|
+ gap: 15px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card {
|
|
|
+ background: white;
|
|
|
+ border-radius: 8px;
|
|
|
+ padding: 15px;
|
|
|
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ transition: transform 0.3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card:hover {
|
|
|
+ transform: translateY(-5px);
|
|
|
+ }
|
|
|
+
|
|
|
+ .card h3 {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card-icon {
|
|
|
+ font-size: 48px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 面包屑导航 */
|
|
|
+ .breadcrumb {
|
|
|
+ margin-bottom: 15px;
|
|
|
+ color: #7f8c8d;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 表格样式 */
|
|
|
+ .data-table {
|
|
|
+ width: 100%;
|
|
|
+ border-collapse: collapse;
|
|
|
+ background: white;
|
|
|
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
|
+ }
|
|
|
+
|
|
|
+ .data-table th, .data-table td {
|
|
|
+ padding: 8px 10px;
|
|
|
+ text-align: left;
|
|
|
+ border-bottom: 1px solid #ecf0f1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .data-table th {
|
|
|
+ background: #3498db;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .data-table tr:hover {
|
|
|
+ background: #f5f5f5;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 按钮样式 */
|
|
|
+ .btn {
|
|
|
+ padding: 6px 12px;
|
|
|
+ border: none;
|
|
|
+ border-radius: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ text-decoration: none;
|
|
|
+ display: inline-block;
|
|
|
+ margin: 0 3px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-primary {
|
|
|
+ background: #3498db;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-success {
|
|
|
+ background: #2ecc71;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-danger {
|
|
|
+ background: #e74c3c;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-warning {
|
|
|
+ background: #f39c12;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-secondary {
|
|
|
+ background: #95a5a6;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 表单样式 */
|
|
|
+ .form-group {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .form-group label {
|
|
|
+ display: block;
|
|
|
+ margin-bottom: 3px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ .form-group input, .form-group select, .form-group textarea {
|
|
|
+ width: 100%;
|
|
|
+ padding: 8px;
|
|
|
+ border: 1px solid #ddd;
|
|
|
+ border-radius: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .form-actions {
|
|
|
+ margin-top: 15px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="container">
|
|
|
+ <!-- 左侧导航栏 -->
|
|
|
+ <div class="sidebar">
|
|
|
+ <div class="sidebar-header">
|
|
|
+ 智慧病房管理系统
|
|
|
+ </div>
|
|
|
+ <ul class="menu">
|
|
|
+ <li class="menu-item">
|
|
|
+ <a href="#" onclick="toggleSubmenu('hospitalSubmenu')">🏥 院区信息管理</a>
|
|
|
+ <ul class="submenu" id="hospitalSubmenu">
|
|
|
+ <li><a href="#" onclick="loadContent('hospitalOverview')">医院概况</a></li>
|
|
|
+ <li><a href="#" onclick="loadContent('departmentManagement')">科室管理</a></li>
|
|
|
+ <li><a href="#" onclick="loadContent('wardManagement')">病区管理</a></li>
|
|
|
+ <li><a href="#" onclick="loadContent('roomManagement')">病房管理</a></li>
|
|
|
+ <li><a href="#" onclick="loadContent('bedManagement')">床位管理</a></li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ <li class="menu-item">
|
|
|
+ <a href="#" onclick="toggleSubmenu('medicalSubmenu')">👨⚕️ 医护管理</a>
|
|
|
+ <ul class="submenu" id="medicalSubmenu">
|
|
|
+ <li><a href="#" onclick="loadContent('patientManagement')">患者管理</a></li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ <li class="menu-item">
|
|
|
+ <a href="#" onclick="toggleSubmenu('equipmentSubmenu')">⚙️ 设备管理</a>
|
|
|
+ <ul class="submenu" id="equipmentSubmenu">
|
|
|
+ <li><a href="#" onclick="loadContent('equipmentInfo')">设备信息</a>
|
|
|
+ <ul class="submenu" style="background:#2c3e50; padding-left:20px;">
|
|
|
+ <li><a href="#" onclick="loadContent('equipmentQuery')">查询</a></li>
|
|
|
+ <li><a href="#" onclick="loadContent('equipmentAdd')">新增</a></li>
|
|
|
+ <li><a href="#" onclick="loadContent('equipmentEdit')">编辑</a></li>
|
|
|
+ <li><a href="#" onclick="loadContent('equipmentDelete')">删除</a></li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 主内容区域 -->
|
|
|
+ <div class="main-content">
|
|
|
+ <div class="header">
|
|
|
+ <div class="welcome" id="welcomeMessage">欢迎使用智慧病房管理平台</div>
|
|
|
+ <button class="logout-btn" id="logoutBtn">退出登录</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="content">
|
|
|
+ <div class="breadcrumb" id="breadcrumb">
|
|
|
+ 首页
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <h1 class="page-title" id="pageTitle">系统概览</h1>
|
|
|
+
|
|
|
+ <div id="mainContent">
|
|
|
+ <div class="dashboard">
|
|
|
+ <div class="card" onclick="loadContent('hospitalOverview')">
|
|
|
+ <div class="card-icon">🏥</div>
|
|
|
+ <h3>院区信息</h3>
|
|
|
+ <p>查看和管理院区相关信息</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="card" onclick="loadContent('medicalStaff')">
|
|
|
+ <div class="card-icon">👨⚕️</div>
|
|
|
+ <h3>医护人员</h3>
|
|
|
+ <p>管理医生和护士信息</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="card" onclick="loadContent('patientManagement')">
|
|
|
+ <div class="card-icon">👤</div>
|
|
|
+ <h3>患者信息</h3>
|
|
|
+ <p>查看和更新患者资料</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="card" onclick="loadContent('equipmentInfo')">
|
|
|
+ <div class="card-icon">⚙️</div>
|
|
|
+ <h3>设备管理</h3>
|
|
|
+ <p>查看和管理设备信息</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ // 当前激活的菜单项
|
|
|
+ let activeMenu = null;
|
|
|
+
|
|
|
+ // 切换子菜单显示/隐藏
|
|
|
+ function toggleSubmenu(menuId) {
|
|
|
+ const submenu = document.getElementById(menuId);
|
|
|
+ submenu.classList.toggle('open');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 加载内容
|
|
|
+ function loadContent(contentType) {
|
|
|
+ const mainContent = document.getElementById('mainContent');
|
|
|
+ const pageTitle = document.getElementById('pageTitle');
|
|
|
+ const breadcrumb = document.getElementById('breadcrumb');
|
|
|
+
|
|
|
+ // 更新激活状态
|
|
|
+ updateActiveMenu(contentType);
|
|
|
+
|
|
|
+ switch(contentType) {
|
|
|
+ case 'hospitalOverview':
|
|
|
+ pageTitle.textContent = '医院概况';
|
|
|
+ breadcrumb.textContent = '首页 > 院区信息管理 > 医院概况';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <h2 style="margin-bottom: 15px;">医院基本信息</h2>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="hospitalName">医院名称<span style="color: red;"> *</span></label>
|
|
|
+ <input type="text" id="hospitalName" placeholder="请输入医院名称" style="width: 50%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="hospitalAddress">医院地址</label>
|
|
|
+ <input type="text" id="hospitalAddress" placeholder="请输入医院地址" style="width: 50%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="hospitalPhone">联系电话</label>
|
|
|
+ <input type="text" id="hospitalPhone" placeholder="请输入联系电话" style="width: 50%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>医院Logo</label>
|
|
|
+ <div style="position: relative; display: inline-block; margin-top: 5px;">
|
|
|
+ <div id="logoPreview" style="width: 150px; height: 150px; border: 1px dashed #ccc; display: flex; align-items: center; justify-content: center;">
|
|
|
+ <span id="logoPlaceholder" style="color: #999;">暂无图片</span>
|
|
|
+ <img id="logoImage" src="" style="max-width: 100%; max-height: 100%; display: none;">
|
|
|
+ </div>
|
|
|
+ <div style="position: absolute; right: -3cm; bottom: 0;">
|
|
|
+ <input type="file" id="logoUpload" accept=".jpg,.jpeg,.png" style="display: none;" onchange="handleLogoUpload(event)">
|
|
|
+ <button class="btn btn-primary" onclick="document.getElementById('logoUpload').click()" style="font-size: 12px; padding: 5px 10px;">上传Logo</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <p style="font-size: 12px; color: #666; margin-top: 3px;">支持JPG、PNG格式,大小不超过10M</p>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="hospitalDescription">医院介绍</label>
|
|
|
+ <textarea id="hospitalDescription" placeholder="请输入医院介绍" style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; height: 120px;"></textarea>
|
|
|
+ </div>
|
|
|
+ <div class="form-actions">
|
|
|
+ <button class="btn btn-success" onclick="saveHospitalOverview()" style="padding: 6px 15px;">保存</button>
|
|
|
+ <button class="btn btn-secondary" onclick="loadContent('hospitalOverview')" style="padding: 6px 15px;">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+
|
|
|
+ // 加载医院概况数据
|
|
|
+ loadHospitalOverviewData();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'departmentManagement':
|
|
|
+ pageTitle.textContent = '科室管理';
|
|
|
+ breadcrumb.textContent = '首页 > 院区信息管理 > 科室管理';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
|
|
|
+ <div>
|
|
|
+ <input type="text" id="departmentName" placeholder="科室名称" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 140px; margin-right: 8px;">
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <select id="enabled" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 90px; margin-right: 8px;">
|
|
|
+ <option value="">是否启用</option>
|
|
|
+ <option value="true">是</option>
|
|
|
+ <option value="false">否</option>
|
|
|
+ </select>
|
|
|
+ <button class="btn btn-primary" onclick="searchDepartments()" style="padding: 6px 12px;">查询</button>
|
|
|
+ <button class="btn btn-secondary" onclick="clearSearch()" style="padding: 6px 12px;">重置</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <table class="data-table" id="departmentTable">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>科室代码</th>
|
|
|
+ <th>科室外部代码</th>
|
|
|
+ <th>科室名称</th>
|
|
|
+ <th>科室地址</th>
|
|
|
+ <th>科室电话</th>
|
|
|
+ <th>科室介绍</th>
|
|
|
+ <th>是否启用</th>
|
|
|
+ <th>备注</th>
|
|
|
+ <th>详情</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody id="departmentTableBody">
|
|
|
+ <!-- 动态加载数据 -->
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 科室详情模态框 -->
|
|
|
+ <div id="departmentModal" style="display:none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4); overflow: auto; padding: 50px 0;">
|
|
|
+ <div style="background-color: #fff; margin: 0 auto; padding: 0; border: 1px solid #888; width: 80%; max-width: 600px; border-radius: 5px; max-height: 80%; display: flex; flex-direction: column;">
|
|
|
+ <div style="padding: 20px; border-bottom: 1px solid #eee;">
|
|
|
+ <h2 style="margin-top: 0;">科室详情</h2>
|
|
|
+ </div>
|
|
|
+ <div style="overflow-y: auto; flex: 1; padding: 15px;">
|
|
|
+ <div class="form-group">
|
|
|
+ <label>科室代码:</label>
|
|
|
+ <input type="text" id="modalCode" readonly style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>科室外部代码:</label>
|
|
|
+ <input type="text" id="modalOutCode" readonly style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>科室名称:</label>
|
|
|
+ <input type="text" id="modalName" readonly style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>科室地址:</label>
|
|
|
+ <input type="text" id="modalAddress" readonly style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>科室电话:</label>
|
|
|
+ <input type="text" id="modalTelephone" readonly style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>科室介绍:</label>
|
|
|
+ <textarea id="modalIntroduction" readonly style="width: 100%; padding: 6px; height: 70px;"></textarea>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>是否启用:</label>
|
|
|
+ <input type="text" id="modalEnabled" readonly style="width: 100%; padding: 6px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>备注:</label>
|
|
|
+ <textarea id="modalRemark" readonly style="width: 100%; padding: 6px; height: 50px;"></textarea>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 20px; border-top: 1px solid #eee; text-align: right;">
|
|
|
+ <button class="btn btn-secondary" onclick="closeDepartmentModal()">关闭</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ // 加载科室数据
|
|
|
+ loadDepartmentData();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'wardManagement':
|
|
|
+ pageTitle.textContent = '病区管理';
|
|
|
+ breadcrumb.textContent = '首页 > 院区信息管理 > 病区管理';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
|
|
|
+ <div>
|
|
|
+ <input type="text" id="wardName" placeholder="病区名称" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 140px; margin-right: 8px;">
|
|
|
+ <input type="text" id="wardGlkeshi" placeholder="关联科室" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 140px; margin-right: 8px;">
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <select id="wardEnabled" style="padding: 6px; border: 1px solid #ddd; border-radius: 4px; width: 90px; margin-right: 8px;">
|
|
|
+ <option value="">是否启用</option>
|
|
|
+ <option value="true">是</option>
|
|
|
+ <option value="false">否</option>
|
|
|
+ </select>
|
|
|
+ <button class="btn btn-primary" onclick="searchWards()" style="padding: 6px 12px;">查询</button>
|
|
|
+ <button class="btn btn-secondary" onclick="clearWardSearch()" style="padding: 6px 12px;">重置</button>
|
|
|
+ <button class="btn btn-warning" onclick="showWardCodeSetting()" style="margin-left: 8px; padding: 6px 12px;">病区代码设置</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <table class="data-table" id="wardTable">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th><input type="checkbox" id="selectAllWards" onclick="toggleSelectAllWards()"></th>
|
|
|
+ <th>病区代码</th>
|
|
|
+ <th>病区外部代码</th>
|
|
|
+ <th>病区名称</th>
|
|
|
+ <th>病区地址</th>
|
|
|
+ <th>关联科室</th>
|
|
|
+ <th>病区电话</th>
|
|
|
+ <th>病区主任医生</th>
|
|
|
+ <th>病区护士长</th>
|
|
|
+ <th>编制床位数</th>
|
|
|
+ <th>开放床位数</th>
|
|
|
+ <th>排序号</th>
|
|
|
+ <th>是否启用</th>
|
|
|
+ <th>备注</th>
|
|
|
+ <th>详情</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody id="wardTableBody">
|
|
|
+ <!-- 数据将通过JS动态加载 -->
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 病区详情模态框 -->
|
|
|
+ <div id="wardModal" style="display:none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4); overflow: auto; padding: 50px 0;">
|
|
|
+ <div style="background-color: #fff; margin: 0 auto; padding: 0; border: 1px solid #888; width: 80%; max-width: 600px; border-radius: 5px; max-height: 80%; display: flex; flex-direction: column;">
|
|
|
+ <div style="padding: 20px; border-bottom: 1px solid #eee;">
|
|
|
+ <h2 style="margin-top: 0;">病区详情</h2>
|
|
|
+ </div>
|
|
|
+ <div style="overflow-y: auto; flex: 1; padding: 10px;">
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">病区代码:</label>
|
|
|
+ <input type="text" id="modalCode" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">病区外部代码:</label>
|
|
|
+ <input type="text" id="modalOutCode" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">病区名称:</label>
|
|
|
+ <input type="text" id="modalName" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">病区地址:</label>
|
|
|
+ <input type="text" id="modalAddress" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">关联科室:</label>
|
|
|
+ <input type="text" id="modalGlkeshi" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">病区电话:</label>
|
|
|
+ <input type="text" id="modalTelephone" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">病区主任医生:</label>
|
|
|
+ <input type="text" id="modalDirector" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">病区护士长:</label>
|
|
|
+ <input type="text" id="modalHeadNurse" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">编制床位数:</label>
|
|
|
+ <input type="text" id="modalBedCount" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">开放床位数:</label>
|
|
|
+ <input type="text" id="modalBedOpenCount" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">排序号:</label>
|
|
|
+ <input type="text" id="modalSort" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">是否启用:</label>
|
|
|
+ <input type="text" id="modalEnabled" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group" style="margin-bottom: 8px;">
|
|
|
+ <label style="margin-bottom: 2px;">备注:</label>
|
|
|
+ <textarea id="modalRemark" readonly style="width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px; height: 40px;"></textarea>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 20px; border-top: 1px solid #eee; text-align: right;">
|
|
|
+ <button class="btn btn-secondary" onclick="closeWardModal()">关闭</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 病区代码设置模态框 -->
|
|
|
+ <div id="wardCodeSettingModal" style="display:none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4); overflow: auto; padding: 50px 0;">
|
|
|
+ <div style="background-color: #fff; margin: 0 auto; padding: 0; border: 1px solid #888; width: 80%; max-width: 500px; border-radius: 5px; max-height: 80%; display: flex; flex-direction: column;">
|
|
|
+ <div style="padding: 20px; border-bottom: 1px solid #eee;">
|
|
|
+ <h2 style="margin-top: 0;">病区代码设置</h2>
|
|
|
+ </div>
|
|
|
+ <div style="overflow-y: auto; flex: 1; padding: 15px;">
|
|
|
+ <div class="form-group">
|
|
|
+ <label>起始代码 (01-99):</label>
|
|
|
+ <input type="number" id="startCode" min="1" max="99" style="width: 100%; padding: 6px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ <p style="font-size: 12px; color: #666; margin-top: 3px;">输入数字,系统会自动补零(如输入1会变成01)</p>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>选中的病区列表:</label>
|
|
|
+ <div id="selectedWardsList" style="border: 1px solid #ddd; border-radius: 4px; padding: 8px; max-height: 150px; overflow-y: auto;">
|
|
|
+ <p>请先选择病区</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 20px; border-top: 1px solid #eee; text-align: right;">
|
|
|
+ <button class="btn btn-success" onclick="saveWardCodes()">保存</button>
|
|
|
+ <button class="btn btn-secondary" onclick="closeWardCodeSetting()">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ loadWardData();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'roomManagement':
|
|
|
+ pageTitle.textContent = '病房管理';
|
|
|
+ breadcrumb.textContent = '首页 > 院区信息管理 > 病房管理';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <table class="data-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>病房编号</th>
|
|
|
+ <th>病房名称</th>
|
|
|
+ <th>所属病区</th>
|
|
|
+ <th>床位数量</th>
|
|
|
+ <th>状态</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td>R001</td>
|
|
|
+ <td>101病房</td>
|
|
|
+ <td>内科一病区</td>
|
|
|
+ <td>4</td>
|
|
|
+ <td>可用</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary">编辑</button>
|
|
|
+ <button class="btn btn-danger">删除</button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'bedManagement':
|
|
|
+ pageTitle.textContent = '床位管理';
|
|
|
+ breadcrumb.textContent = '首页 > 院区信息管理 > 床位管理';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <div style="margin-bottom: 20px;">
|
|
|
+ <button class="btn btn-success" onclick="showAddBedForm()">新增床位</button>
|
|
|
+ </div>
|
|
|
+ <table class="data-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>床位编号</th>
|
|
|
+ <th>所属病房</th>
|
|
|
+ <th>床位状态</th>
|
|
|
+ <th>患者信息</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td>B001</td>
|
|
|
+ <td>101病房</td>
|
|
|
+ <td>空闲</td>
|
|
|
+ <td>无</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary">编辑</button>
|
|
|
+ <button class="btn btn-danger">删除</button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'patientManagement':
|
|
|
+ pageTitle.textContent = '患者管理';
|
|
|
+ breadcrumb.textContent = '首页 > 医护管理 > 患者管理';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <div style="margin-bottom: 20px;">
|
|
|
+ <button class="btn btn-success" onclick="showAddPatientForm()">新增患者</button>
|
|
|
+ </div>
|
|
|
+ <table class="data-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>患者编号</th>
|
|
|
+ <th>姓名</th>
|
|
|
+ <th>性别</th>
|
|
|
+ <th>年龄</th>
|
|
|
+ <th>主治医生</th>
|
|
|
+ <th>所在病房</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td>P001</td>
|
|
|
+ <td>张三</td>
|
|
|
+ <td>男</td>
|
|
|
+ <td>45</td>
|
|
|
+ <td>李医生</td>
|
|
|
+ <td>101病房</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary">详情</button>
|
|
|
+ <button class="btn btn-warning">编辑</button>
|
|
|
+ <button class="btn btn-danger"> discharge</button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'equipmentInfo':
|
|
|
+ pageTitle.textContent = '设备信息';
|
|
|
+ breadcrumb.textContent = '首页 > 设备管理 > 设备信息';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <div style="margin-bottom: 20px; display: flex; justify-content: space-between;">
|
|
|
+ <div>
|
|
|
+ <button class="btn btn-success" onclick="showAddEquipmentForm()">新增设备</button>
|
|
|
+ <button class="btn btn-primary" onclick="loadContent('equipmentQuery')">查询</button>
|
|
|
+ <button class="btn btn-warning" onclick="loadContent('equipmentEdit')">编辑</button>
|
|
|
+ <button class="btn btn-danger" onclick="loadContent('equipmentDelete')">删除</button>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <input type="text" placeholder="搜索设备..." style="padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <table class="data-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>设备编号</th>
|
|
|
+ <th>设备名称</th>
|
|
|
+ <th>设备类型</th>
|
|
|
+ <th>所在科室</th>
|
|
|
+ <th>状态</th>
|
|
|
+ <th>购买日期</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td>E001</td>
|
|
|
+ <td>心电监护仪</td>
|
|
|
+ <td>监护设备</td>
|
|
|
+ <td>内科</td>
|
|
|
+ <td>正常</td>
|
|
|
+ <td>2023-01-15</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary">详情</button>
|
|
|
+ <button class="btn btn-warning">编辑</button>
|
|
|
+ <button class="btn btn-danger">删除</button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'equipmentQuery':
|
|
|
+ pageTitle.textContent = '设备查询';
|
|
|
+ breadcrumb.textContent = '首页 > 设备管理 > 设备信息 > 查询';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <h2 style="margin-bottom: 20px;">设备查询</h2>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备名称:</label>
|
|
|
+ <input type="text" placeholder="请输入设备名称">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备类型:</label>
|
|
|
+ <select>
|
|
|
+ <option>请选择设备类型</option>
|
|
|
+ <option>监护设备</option>
|
|
|
+ <option>治疗设备</option>
|
|
|
+ <option>检验设备</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-actions">
|
|
|
+ <button class="btn btn-primary">查询</button>
|
|
|
+ <button class="btn btn-secondary">重置</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'equipmentAdd':
|
|
|
+ pageTitle.textContent = '新增设备';
|
|
|
+ breadcrumb.textContent = '首页 > 设备管理 > 设备信息 > 新增';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); max-width: 600px;">
|
|
|
+ <h2 style="margin-bottom: 20px;">新增设备</h2>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备编号:</label>
|
|
|
+ <input type="text" placeholder="请输入设备编号">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备名称:</label>
|
|
|
+ <input type="text" placeholder="请输入设备名称">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备类型:</label>
|
|
|
+ <select>
|
|
|
+ <option>请选择设备类型</option>
|
|
|
+ <option>监护设备</option>
|
|
|
+ <option>治疗设备</option>
|
|
|
+ <option>检验设备</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>所在科室:</label>
|
|
|
+ <select>
|
|
|
+ <option>请选择科室</option>
|
|
|
+ <option>内科</option>
|
|
|
+ <option>外科</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>状态:</label>
|
|
|
+ <select>
|
|
|
+ <option>正常</option>
|
|
|
+ <option>维修中</option>
|
|
|
+ <option>报废</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-actions">
|
|
|
+ <button class="btn btn-success">保存</button>
|
|
|
+ <button class="btn btn-secondary" onclick="loadContent('equipmentInfo')">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'equipmentEdit':
|
|
|
+ pageTitle.textContent = '编辑设备';
|
|
|
+ breadcrumb.textContent = '首页 > 设备管理 > 设备信息 > 编辑';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); max-width: 600px;">
|
|
|
+ <h2 style="margin-bottom: 20px;">编辑设备信息</h2>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备编号:</label>
|
|
|
+ <input type="text" value="E001" readonly>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备名称:</label>
|
|
|
+ <input type="text" value="心电监护仪">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>设备类型:</label>
|
|
|
+ <select>
|
|
|
+ <option>监护设备</option>
|
|
|
+ <option>治疗设备</option>
|
|
|
+ <option>检验设备</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>所在科室:</label>
|
|
|
+ <select>
|
|
|
+ <option>内科</option>
|
|
|
+ <option>外科</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label>状态:</label>
|
|
|
+ <select>
|
|
|
+ <option>正常</option>
|
|
|
+ <option>维修中</option>
|
|
|
+ <option>报废</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-actions">
|
|
|
+ <button class="btn btn-success">保存</button>
|
|
|
+ <button class="btn btn-secondary" onclick="loadContent('equipmentInfo')">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'equipmentDelete':
|
|
|
+ pageTitle.textContent = '删除设备';
|
|
|
+ breadcrumb.textContent = '首页 > 设备管理 > 设备信息 > 删除';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div style="background: white; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
|
|
+ <h2 style="margin-bottom: 20px;">删除设备</h2>
|
|
|
+ <p>请选择要删除的设备:</p>
|
|
|
+ <table class="data-table">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th><input type="checkbox"></th>
|
|
|
+ <th>设备编号</th>
|
|
|
+ <th>设备名称</th>
|
|
|
+ <th>设备类型</th>
|
|
|
+ <th>所在科室</th>
|
|
|
+ <th>状态</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td><input type="checkbox"></td>
|
|
|
+ <td>E001</td>
|
|
|
+ <td>心电监护仪</td>
|
|
|
+ <td>监护设备</td>
|
|
|
+ <td>内科</td>
|
|
|
+ <td>正常</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td><input type="checkbox"></td>
|
|
|
+ <td>E002</td>
|
|
|
+ <td>输液泵</td>
|
|
|
+ <td>治疗设备</td>
|
|
|
+ <td>外科</td>
|
|
|
+ <td>正常</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <div style="margin-top: 20px;">
|
|
|
+ <button class="btn btn-danger">删除选中设备</button>
|
|
|
+ <button class="btn btn-secondary" onclick="loadContent('equipmentInfo')">返回</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ pageTitle.textContent = '系统概览';
|
|
|
+ breadcrumb.textContent = '首页';
|
|
|
+ mainContent.innerHTML = `
|
|
|
+ <div class="dashboard">
|
|
|
+ <div class="card" onclick="loadContent('hospitalOverview')">
|
|
|
+ <div class="card-icon">🏥</div>
|
|
|
+ <h3>院区信息</h3>
|
|
|
+ <p>查看和管理院区相关信息</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="card" onclick="loadContent('medicalStaff')">
|
|
|
+ <div class="card-icon">👨⚕️</div>
|
|
|
+ <h3>医护人员</h3>
|
|
|
+ <p>管理医生和护士信息</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="card" onclick="loadContent('patientManagement')">
|
|
|
+ <div class="card-icon">👤</div>
|
|
|
+ <h3>患者信息</h3>
|
|
|
+ <p>查看和更新患者资料</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="card" onclick="loadContent('equipmentInfo')">
|
|
|
+ <div class="card-icon">⚙️</div>
|
|
|
+ <h3>设备管理</h3>
|
|
|
+ <p>查看和管理设备信息</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新激活菜单状态
|
|
|
+ function updateActiveMenu(contentType) {
|
|
|
+ // 移除之前激活的菜单项
|
|
|
+ if (activeMenu) {
|
|
|
+ activeMenu.classList.remove('active');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据内容类型激活相应的菜单项
|
|
|
+ let menuItem;
|
|
|
+ switch(contentType) {
|
|
|
+ case 'hospitalOverview':
|
|
|
+ case 'departmentManagement':
|
|
|
+ case 'wardManagement':
|
|
|
+ case 'roomManagement':
|
|
|
+ case 'bedManagement':
|
|
|
+ menuItem = document.querySelector('#hospitalSubmenu a[href="#"][onclick*="' + contentType + '"]');
|
|
|
+ // 展开院区信息管理子菜单
|
|
|
+ document.getElementById('hospitalSubmenu').classList.add('open');
|
|
|
+ break;
|
|
|
+ case 'patientManagement':
|
|
|
+ menuItem = document.querySelector('#medicalSubmenu a[href="#"][onclick*="' + contentType + '"]');
|
|
|
+ // 展开医护管理子菜单
|
|
|
+ document.getElementById('medicalSubmenu').classList.add('open');
|
|
|
+ break;
|
|
|
+ case 'equipmentInfo':
|
|
|
+ case 'equipmentQuery':
|
|
|
+ case 'equipmentAdd':
|
|
|
+ case 'equipmentEdit':
|
|
|
+ case 'equipmentDelete':
|
|
|
+ menuItem = document.querySelector('#equipmentSubmenu a[href="#"][onclick*="' + contentType + '"]');
|
|
|
+ // 展开设备管理子菜单
|
|
|
+ document.getElementById('equipmentSubmenu').classList.add('open');
|
|
|
+ // 特别处理设备信息下的子菜单
|
|
|
+ if (contentType !== 'equipmentInfo') {
|
|
|
+ document.querySelector('#equipmentSubmenu > li > ul').style.display = 'block';
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ // 默认情况不激活任何菜单项
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (menuItem) {
|
|
|
+ menuItem.classList.add('active');
|
|
|
+ activeMenu = menuItem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示添加表单的函数(示例)
|
|
|
+ function showAddDepartmentForm() {
|
|
|
+ alert('显示新增科室表单');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showAddWardForm() {
|
|
|
+ alert('显示新增病区表单');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showAddRoomForm() {
|
|
|
+ alert('显示新增病房表单');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showAddBedForm() {
|
|
|
+ alert('显示新增床位表单');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showAddPatientForm() {
|
|
|
+ alert('显示新增患者表单');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showAddEquipmentForm() {
|
|
|
+ alert('显示新增设备表单');
|
|
|
+ }
|
|
|
+
|
|
|
+ document.addEventListener('DOMContentLoaded', function() {
|
|
|
+ // 检查登录状态
|
|
|
+ fetch('/shixian/api/status')
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (!data.loggedIn) {
|
|
|
+ // 未登录,跳转到登录页
|
|
|
+ window.location.href = '/shixian/';
|
|
|
+ } else {
|
|
|
+ // 显示欢迎信息
|
|
|
+ document.getElementById('welcomeMessage').textContent =
|
|
|
+ `欢迎,${data.username} (${data.userType === 'admin' ? '管理员' : '用户'})`;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('Error:', error);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 页面加载完成后初始化病区管理数据
|
|
|
+ if (document.getElementById('wardTableBody')) {
|
|
|
+ loadWardData();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 退出登录
|
|
|
+ document.getElementById('logoutBtn').addEventListener('click', function() {
|
|
|
+ fetch('/shixian/api/logout', {
|
|
|
+ method: 'POST'
|
|
|
+ })
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ window.location.href = '/shixian/';
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('Error:', error);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 监听病区管理页面的全选复选框变化
|
|
|
+ const selectAllWards = document.getElementById('selectAllWards');
|
|
|
+ if (selectAllWards) {
|
|
|
+ selectAllWards.addEventListener('change', function() {
|
|
|
+ const checkboxes = document.querySelectorAll('.ward-checkbox');
|
|
|
+ checkboxes.forEach(checkbox => {
|
|
|
+ checkbox.checked = this.checked;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // Logo上传处理函数
|
|
|
+ function handleLogoUpload(event) {
|
|
|
+ const file = event.target.files[0];
|
|
|
+ if (!file) return;
|
|
|
+
|
|
|
+ // 检查文件类型
|
|
|
+ const allowedTypes = ['image/jpeg', 'image/png'];
|
|
|
+ if (!allowedTypes.includes(file.type)) {
|
|
|
+ alert('请上传JPG或PNG格式的图片');
|
|
|
+ event.target.value = ''; // 清空文件选择
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查文件大小 (10MB = 10 * 1024 * 1024 bytes)
|
|
|
+ const maxSize = 10 * 1024 * 1024;
|
|
|
+ if (file.size > maxSize) {
|
|
|
+ alert('图片大小不能超过10M');
|
|
|
+ event.target.value = ''; // 清空文件选择
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建FormData对象
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('file', file);
|
|
|
+
|
|
|
+ // 上传文件到服务器
|
|
|
+ fetch('/shixian/api/upload-logo', {
|
|
|
+ method: 'POST',
|
|
|
+ body: formData
|
|
|
+ })
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ // 预览图片
|
|
|
+ const reader = new FileReader();
|
|
|
+ reader.onload = function(e) {
|
|
|
+ const logoImage = document.getElementById('logoImage');
|
|
|
+ const logoPlaceholder = document.getElementById('logoPlaceholder');
|
|
|
+
|
|
|
+ logoImage.src = e.target.result;
|
|
|
+ logoImage.style.display = 'block';
|
|
|
+ logoPlaceholder.style.display = 'none';
|
|
|
+ };
|
|
|
+ reader.readAsDataURL(file);
|
|
|
+
|
|
|
+ alert('Logo上传成功');
|
|
|
+ } else {
|
|
|
+ alert('Logo上传失败: ' + data.message);
|
|
|
+ event.target.value = ''; // 清空文件选择
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('上传Logo失败:', error);
|
|
|
+ alert('Logo上传失败,请稍后重试');
|
|
|
+ event.target.value = ''; // 清空文件选择
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 加载医院概况数据
|
|
|
+ function loadHospitalOverviewData() {
|
|
|
+ fetch('/shixian/api/hospital-overview')
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success && data.data) {
|
|
|
+ // 填充表单数据
|
|
|
+ document.getElementById('hospitalName').value = data.data.id || '';
|
|
|
+ document.getElementById('hospitalAddress').value = data.data.dizhi || '';
|
|
|
+ document.getElementById('hospitalPhone').value = data.data.dianhua || '';
|
|
|
+ document.getElementById('hospitalDescription').value = data.data.jieshao || '';
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('加载医院概况数据失败:', error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存医院概况数据
|
|
|
+ function saveHospitalOverview() {
|
|
|
+ const hospitalData = {
|
|
|
+ id: document.getElementById('hospitalName').value,
|
|
|
+ dizhi: document.getElementById('hospitalAddress').value,
|
|
|
+ dianhua: document.getElementById('hospitalPhone').value,
|
|
|
+ jieshao: document.getElementById('hospitalDescription').value
|
|
|
+ };
|
|
|
+
|
|
|
+ fetch('/shixian/api/hospital-overview', {
|
|
|
+ method: 'POST',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ },
|
|
|
+ body: JSON.stringify(hospitalData)
|
|
|
+ })
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ alert('保存成功');
|
|
|
+ } else {
|
|
|
+ alert('保存失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('保存医院概况数据失败:', error);
|
|
|
+ alert('保存失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 加载科室数据
|
|
|
+ function loadDepartmentData() {
|
|
|
+ fetch('/shixian/api/departments')
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ const tbody = document.getElementById('departmentTableBody');
|
|
|
+ tbody.innerHTML = '';
|
|
|
+
|
|
|
+ data.forEach(dept => {
|
|
|
+ const row = document.createElement('tr');
|
|
|
+ row.innerHTML = `
|
|
|
+ <td>${dept.code}</td>
|
|
|
+ <td>${dept.outCode}</td>
|
|
|
+ <td>${dept.name}</td>
|
|
|
+ <td>${dept.address || ''}</td>
|
|
|
+ <td>${dept.telephone || ''}</td>
|
|
|
+ <td>${dept.introduction || ''}</td>
|
|
|
+ <td>${dept.enabled ? '是' : '否'}</td>
|
|
|
+ <td>${dept.remark || ''}</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary" onclick="viewDepartment('${dept.code}')">详情</button>
|
|
|
+ </td>
|
|
|
+ `;
|
|
|
+ tbody.appendChild(row);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('加载科室数据失败:', error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示新增科室表单
|
|
|
+ function showAddDepartmentForm() {
|
|
|
+ alert('显示新增科室表单');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询科室
|
|
|
+ function searchDepartments() {
|
|
|
+ const name = document.getElementById('departmentName').value;
|
|
|
+ const enabled = document.getElementById('enabled').value;
|
|
|
+
|
|
|
+ // 构建查询参数
|
|
|
+ let url = '/shixian/api/departments';
|
|
|
+ const params = [];
|
|
|
+
|
|
|
+ if (name) {
|
|
|
+ params.push(`name=${encodeURIComponent(name)}`);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (enabled !== '') {
|
|
|
+ params.push(`enabled=${enabled}`);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (params.length > 0) {
|
|
|
+ url += '?' + params.join('&');
|
|
|
+ }
|
|
|
+
|
|
|
+ fetch(url)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ const tbody = document.getElementById('departmentTableBody');
|
|
|
+ tbody.innerHTML = '';
|
|
|
+
|
|
|
+ data.forEach(dept => {
|
|
|
+ const row = document.createElement('tr');
|
|
|
+ row.innerHTML = `
|
|
|
+ <td>${dept.code}</td>
|
|
|
+ <td>${dept.outCode}</td>
|
|
|
+ <td>${dept.name}</td>
|
|
|
+ <td>${dept.address || ''}</td>
|
|
|
+ <td>${dept.telephone || ''}</td>
|
|
|
+ <td>${dept.introduction || ''}</td>
|
|
|
+ <td>${dept.enabled ? '是' : '否'}</td>
|
|
|
+ <td>${dept.remark || ''}</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary" onclick="viewDepartment('${dept.code}')">详情</button>
|
|
|
+ </td>
|
|
|
+ `;
|
|
|
+ tbody.appendChild(row);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('查询科室数据失败:', error);
|
|
|
+ alert('查询失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清空查询条件
|
|
|
+ function clearSearch() {
|
|
|
+ document.getElementById('departmentName').value = '';
|
|
|
+ document.getElementById('enabled').value = '';
|
|
|
+ // 重新加载所有数据
|
|
|
+ loadDepartmentData();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查看科室详情
|
|
|
+ function viewDepartment(code) {
|
|
|
+ // 获取科室数据
|
|
|
+ fetch(`/shixian/api/departments/${code}`)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ const dept = data.data;
|
|
|
+
|
|
|
+ // 填充弹窗内容
|
|
|
+ document.getElementById('modalCode').value = dept.code || '';
|
|
|
+ document.getElementById('modalOutCode').value = dept.outCode || '';
|
|
|
+ document.getElementById('modalName').value = dept.name || '';
|
|
|
+ document.getElementById('modalAddress').value = dept.address || '';
|
|
|
+ document.getElementById('modalTelephone').value = dept.telephone || '';
|
|
|
+ document.getElementById('modalIntroduction').value = dept.introduction || '';
|
|
|
+ document.getElementById('modalEnabled').value = dept.enabled ? '是' : '否';
|
|
|
+ document.getElementById('modalRemark').value = dept.remark || '';
|
|
|
+
|
|
|
+ // 显示弹窗
|
|
|
+ document.getElementById('departmentModal').style.display = 'block';
|
|
|
+ } else {
|
|
|
+ alert('获取科室信息失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('获取科室信息失败:', error);
|
|
|
+ alert('获取科室信息失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭弹窗
|
|
|
+ function closeDepartmentModal() {
|
|
|
+ document.getElementById('departmentModal').style.display = 'none';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击弹窗外部关闭
|
|
|
+ window.onclick = function(event) {
|
|
|
+ const departmentModal = document.getElementById('departmentModal');
|
|
|
+ const wardModal = document.getElementById('wardModal');
|
|
|
+
|
|
|
+ if (event.target === departmentModal) {
|
|
|
+ departmentModal.style.display = 'none';
|
|
|
+ } else if (event.target === wardModal) {
|
|
|
+ wardModal.style.display = 'none';
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 编辑科室
|
|
|
+ function editDepartment(code) {
|
|
|
+ alert('编辑科室: ' + code);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除科室
|
|
|
+ function deleteDepartment(code) {
|
|
|
+ if (confirm('确定要删除该科室吗?')) {
|
|
|
+ fetch(`/shixian/api/departments/${code}`, {
|
|
|
+ method: 'DELETE'
|
|
|
+ })
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ alert('删除成功');
|
|
|
+ // 重新加载数据
|
|
|
+ loadDepartmentData();
|
|
|
+ } else {
|
|
|
+ alert('删除失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('删除科室失败:', error);
|
|
|
+ alert('删除失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 加载病区数据
|
|
|
+ function loadWardData() {
|
|
|
+ const name = document.getElementById('wardName').value;
|
|
|
+ const glkeshi = document.getElementById('wardGlkeshi').value;
|
|
|
+ const enabled = document.getElementById('wardEnabled').value;
|
|
|
+
|
|
|
+ // 构造查询参数
|
|
|
+ let url = '/shixian/api/wards';
|
|
|
+ const params = [];
|
|
|
+ if (name) params.push(`name=${encodeURIComponent(name)}`);
|
|
|
+ if (glkeshi) params.push(`glkeshi=${encodeURIComponent(glkeshi)}`);
|
|
|
+ if (enabled !== '') params.push(`enabled=${enabled}`);
|
|
|
+ if (params.length > 0) url += '?' + params.join('&');
|
|
|
+
|
|
|
+ fetch(url)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ const tbody = document.getElementById('wardTableBody');
|
|
|
+ tbody.innerHTML = '';
|
|
|
+
|
|
|
+ data.forEach(ward => {
|
|
|
+ const row = document.createElement('tr');
|
|
|
+ row.innerHTML = `
|
|
|
+ <td><input type="checkbox" class="ward-checkbox" data-code="${ward.code}"></td>
|
|
|
+ <td>${ward.code}</td>
|
|
|
+ <td>${ward.outCode || ''}</td>
|
|
|
+ <td>${ward.name}</td>
|
|
|
+ <td>${ward.address || ''}</td>
|
|
|
+ <td>${ward.glkeshi || ''}</td>
|
|
|
+ <td>${ward.telephone || ''}</td>
|
|
|
+ <td>${ward.director || ''}</td>
|
|
|
+ <td>${ward.headNurse || ''}</td>
|
|
|
+ <td>${ward.bedCount || 0}</td>
|
|
|
+ <td>${ward.bedOpenCount || 0}</td>
|
|
|
+ <td>${ward.sort || 0}</td>
|
|
|
+ <td>${ward.enabled ? '是' : '否'}</td>
|
|
|
+ <td>${ward.remark || ''}</td>
|
|
|
+ <td>
|
|
|
+ <button class="btn btn-primary" onclick="viewWardDetail('${ward.code}')">详情</button>
|
|
|
+ </td>
|
|
|
+ `;
|
|
|
+ tbody.appendChild(row);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 添加事件监听器到复选框
|
|
|
+ document.querySelectorAll('.ward-checkbox').forEach(checkbox => {
|
|
|
+ checkbox.addEventListener('change', function() {
|
|
|
+ // 可以在这里添加处理逻辑,例如记录选中的项目等
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 重置全选复选框
|
|
|
+ document.getElementById('selectAllWards').checked = false;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('Error loading ward data:', error);
|
|
|
+ alert('加载病区数据失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 全选/取消全选功能
|
|
|
+ function toggleSelectAllWards() {
|
|
|
+ const selectAllCheckbox = document.getElementById('selectAllWards');
|
|
|
+ const checkboxes = document.querySelectorAll('.ward-checkbox');
|
|
|
+
|
|
|
+ checkboxes.forEach(checkbox => {
|
|
|
+ checkbox.checked = selectAllCheckbox.checked;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示病区代码设置界面
|
|
|
+ function showWardCodeSetting() {
|
|
|
+ const checkboxes = document.querySelectorAll('.ward-checkbox:checked');
|
|
|
+ if (checkboxes.length === 0) {
|
|
|
+ alert('请先选择至少一个病区');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示选中的病区列表
|
|
|
+ const selectedWardsList = document.getElementById('selectedWardsList');
|
|
|
+ selectedWardsList.innerHTML = '';
|
|
|
+
|
|
|
+ checkboxes.forEach((checkbox, index) => {
|
|
|
+ const code = checkbox.getAttribute('data-code');
|
|
|
+ const name = checkbox.closest('tr').querySelector('td:nth-child(4)').textContent;
|
|
|
+
|
|
|
+ const wardItem = document.createElement('div');
|
|
|
+ wardItem.innerHTML = `
|
|
|
+ <div style="display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eee;">
|
|
|
+ <span>${name} (${code})</span>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ selectedWardsList.appendChild(wardItem);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 显示模态框
|
|
|
+ document.getElementById('wardCodeSettingModal').style.display = 'block';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭病区代码设置界面
|
|
|
+ function closeWardCodeSetting() {
|
|
|
+ document.getElementById('wardCodeSettingModal').style.display = 'none';
|
|
|
+ document.getElementById('startCode').value = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存病区代码设置
|
|
|
+ function saveWardCodes() {
|
|
|
+ const startCode = document.getElementById('startCode').value;
|
|
|
+
|
|
|
+ if (!startCode) {
|
|
|
+ alert('请输入起始代码');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const numStartCode = parseInt(startCode);
|
|
|
+ if (numStartCode < 1 || numStartCode > 99) {
|
|
|
+ alert('病区代码必须在1-99之间');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const checkboxes = document.querySelectorAll('.ward-checkbox:checked');
|
|
|
+ if (checkboxes.length === 0) {
|
|
|
+ alert('没有选中的病区');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否有代码冲突
|
|
|
+ const formattedCode = numStartCode.toString().padStart(2, '0');
|
|
|
+
|
|
|
+ // 这里应该调用后端API检查代码是否重复,暂时用前端模拟
|
|
|
+ // 在实际应用中,应该发送请求到后端验证
|
|
|
+
|
|
|
+ // 生成代码序列
|
|
|
+ let currentCode = numStartCode;
|
|
|
+ const updatePromises = [];
|
|
|
+
|
|
|
+ // 先获取所有选中病区的完整数据
|
|
|
+ const fetchDataPromises = [];
|
|
|
+ checkboxes.forEach(checkbox => {
|
|
|
+ const wardCode = checkbox.getAttribute('data-code');
|
|
|
+ const promise = fetch(`/shixian/api/wards/${wardCode}`)
|
|
|
+ .then(response => {
|
|
|
+ if (!response.ok) {
|
|
|
+ throw new Error(`HTTP error! status: ${response.status}`);
|
|
|
+ }
|
|
|
+ return response.json();
|
|
|
+ })
|
|
|
+ .then(data => {
|
|
|
+ if (!data.success) {
|
|
|
+ throw new Error(data.message || '获取病区信息失败');
|
|
|
+ }
|
|
|
+ return { originalCode: wardCode, data: data.data };
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('获取病区信息失败:', error);
|
|
|
+ throw error;
|
|
|
+ });
|
|
|
+ fetchDataPromises.push(promise);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 获取完所有数据后再执行更新操作
|
|
|
+ Promise.all(fetchDataPromises)
|
|
|
+ .then(wardsData => {
|
|
|
+ wardsData.forEach(wardObj => {
|
|
|
+ const formattedCurrentCode = currentCode.toString().padStart(2, '0');
|
|
|
+ const wardCode = wardObj.originalCode;
|
|
|
+ const ward = wardObj.data;
|
|
|
+
|
|
|
+ // 更新病区代码
|
|
|
+ ward.code = formattedCurrentCode;
|
|
|
+
|
|
|
+ // 发送更新请求,包含完整的病区数据
|
|
|
+ const promise = fetch(`/shixian/api/wards/${wardCode}`, {
|
|
|
+ method: 'PUT',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ },
|
|
|
+ body: JSON.stringify(ward)
|
|
|
+ }).then(response => {
|
|
|
+ if (!response.ok) {
|
|
|
+ throw new Error(`HTTP error! status: ${response.status}`);
|
|
|
+ }
|
|
|
+ return response.json();
|
|
|
+ })
|
|
|
+ .then(data => {
|
|
|
+ if (!data.success) {
|
|
|
+ throw new Error(data.message || '更新病区信息失败');
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('更新病区代码失败:', error);
|
|
|
+ throw error;
|
|
|
+ });
|
|
|
+
|
|
|
+ updatePromises.push(promise);
|
|
|
+ currentCode++;
|
|
|
+
|
|
|
+ // 如果超出范围则停止
|
|
|
+ if (currentCode > 99) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 处理所有更新请求
|
|
|
+ return Promise.all(updatePromises);
|
|
|
+ })
|
|
|
+ .then(results => {
|
|
|
+ // 检查是否有任何更新失败
|
|
|
+ const failedUpdates = results.filter(result => !result.success);
|
|
|
+
|
|
|
+ if (failedUpdates.length === 0) {
|
|
|
+ alert('病区代码更新成功');
|
|
|
+ closeWardCodeSetting();
|
|
|
+ loadWardData(); // 重新加载数据
|
|
|
+ } else {
|
|
|
+ alert(`部分病区代码更新失败: ${failedUpdates.length} 个`);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('更新病区代码时出错:', error);
|
|
|
+ alert('更新病区代码时发生错误: ' + error.message);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询病区
|
|
|
+ function searchWards() {
|
|
|
+ loadWardData();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查看病区详情
|
|
|
+ function viewWardDetail(code) {
|
|
|
+ // 获取病区数据
|
|
|
+ fetch(`/shixian/api/wards/${code}`)
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ if (data.success) {
|
|
|
+ const ward = data.data;
|
|
|
+
|
|
|
+ // 填充弹窗内容
|
|
|
+ document.getElementById('modalCode').value = ward.code || '';
|
|
|
+ document.getElementById('modalOutCode').value = ward.outCode || '';
|
|
|
+ document.getElementById('modalName').value = ward.name || '';
|
|
|
+ document.getElementById('modalAddress').value = ward.address || '';
|
|
|
+ document.getElementById('modalGlkeshi').value = ward.glkeshi || '';
|
|
|
+ document.getElementById('modalTelephone').value = ward.telephone || '';
|
|
|
+ document.getElementById('modalDirector').value = ward.director || '';
|
|
|
+ document.getElementById('modalHeadNurse').value = ward.headNurse || '';
|
|
|
+ document.getElementById('modalBedCount').value = ward.bedCount !== null && ward.bedCount !== undefined ? ward.bedCount : '';
|
|
|
+ document.getElementById('modalBedOpenCount').value = ward.bedOpenCount !== null && ward.bedOpenCount !== undefined ? ward.bedOpenCount : '';
|
|
|
+ document.getElementById('modalSort').value = ward.sort !== null && ward.sort !== undefined ? ward.sort : '';
|
|
|
+ document.getElementById('modalEnabled').value = ward.enabled !== null && ward.enabled !== undefined ? (ward.enabled ? '是' : '否') : '';
|
|
|
+ document.getElementById('modalRemark').value = ward.remark || '';
|
|
|
+
|
|
|
+ // 确保强制刷新所有字段
|
|
|
+ const inputs = document.querySelectorAll('#wardModal input, #wardModal textarea');
|
|
|
+ inputs.forEach(input => {
|
|
|
+ input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
|
+ input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
|
+ });
|
|
|
+
|
|
|
+ // 显示弹窗
|
|
|
+ document.getElementById('wardModal').style.display = 'block';
|
|
|
+ } else {
|
|
|
+ alert('获取病区信息失败: ' + data.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('获取病区信息失败:', error);
|
|
|
+ alert('获取病区信息失败,请稍后重试');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭病区详情弹窗
|
|
|
+ function closeWardModal() {
|
|
|
+ document.getElementById('wardModal').style.display = 'none';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击弹窗关闭按钮或按ESC键关闭弹窗
|
|
|
+ document.addEventListener('keydown', function(event) {
|
|
|
+ if (event.key === 'Escape') {
|
|
|
+ const wardModal = document.getElementById('wardModal');
|
|
|
+ const wardCodeSettingModal = document.getElementById('wardCodeSettingModal');
|
|
|
+ const departmentModal = document.getElementById('departmentModal');
|
|
|
+
|
|
|
+ if (wardModal && wardModal.style.display === 'block') {
|
|
|
+ wardModal.style.display = 'none';
|
|
|
+ } else if (wardCodeSettingModal && wardCodeSettingModal.style.display === 'block') {
|
|
|
+ wardCodeSettingModal.style.display = 'none';
|
|
|
+ } else if (departmentModal && departmentModal.style.display === 'block') {
|
|
|
+ departmentModal.style.display = 'none';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 重置查询条件
|
|
|
+ function clearWardSearch() {
|
|
|
+ document.getElementById('wardName').value = '';
|
|
|
+ document.getElementById('wardGlkeshi').value = '';
|
|
|
+ document.getElementById('wardEnabled').value = '';
|
|
|
+ loadWardData();
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|