LIJU 1 month ago
parent
commit
73dfd57f26
1 changed files with 600 additions and 0 deletions
  1. 600 0
      test_workinjury_interface.html

+ 600 - 0
test_workinjury_interface.html

@@ -0,0 +1,600 @@
+<!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>
+        body {
+            font-family: 'Microsoft YaHei', Arial, sans-serif;
+            margin: 0;
+            padding: 20px;
+            background-color: #f0f0f0;
+        }
+        .container {
+            max-width: 1000px;
+            margin: 0 auto;
+            background: white;
+            border-radius: 8px;
+            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+            overflow: hidden;
+        }
+        .header {
+            background: #4472C4;
+            color: white;
+            padding: 15px 20px;
+            font-size: 16px;
+            font-weight: bold;
+            display: flex;
+            align-items: center;
+        }
+        .header::before {
+            content: "🏥";
+            margin-right: 10px;
+            font-size: 18px;
+        }
+        .button-group {
+            padding: 20px;
+            border-bottom: 1px solid #ddd;
+            background: #f8f9fa;
+        }
+        .btn {
+            background: #5B9BD5;
+            color: white;
+            border: none;
+            padding: 8px 16px;
+            margin: 4px;
+            border-radius: 4px;
+            cursor: pointer;
+            font-size: 14px;
+            min-width: 80px;
+            transition: background-color 0.2s;
+        }
+        .btn:hover {
+            background: #4682B4;
+        }
+        .btn:active {
+            background: #2F5496;
+        }
+        .btn.init { background: #70AD47; }
+        .btn.init:hover { background: #5A8A3A; }
+        .btn.signin { background: #FFC000; color: #333; }
+        .btn.signin:hover { background: #E6AC00; }
+        .btn.signout { background: #FF6B6B; }
+        .btn.signout:hover { background: #E55555; }
+        .btn.business { background: #5B9BD5; }
+        .btn.business:hover { background: #4682B4; }
+        .btn.clear { background: #D9534F; }
+        .btn.clear:hover { background: #C9302C; }
+        .btn.reset { background: #6C757D; }
+        .btn.reset:hover { background: #5A6268; }
+        
+        .section {
+            padding: 15px 20px;
+        }
+        .section-title {
+            font-weight: bold;
+            margin-bottom: 10px;
+            color: #333;
+        }
+        .param-area {
+            width: 100%;
+            height: 300px;
+            border: 1px solid #ccc;
+            padding: 10px;
+            font-family: 'Courier New', monospace;
+            font-size: 12px;
+            resize: vertical;
+            background: #fafafa;
+        }
+        .param-area:focus {
+            outline: none;
+            border-color: #5B9BD5;
+            background: white;
+        }
+        .help-text {
+            font-size: 12px;
+            color: #666;
+            margin-top: 5px;
+            line-height: 1.4;
+        }
+        .function-help {
+            background: #e8f4fd;
+            border: 1px solid #b6d7ff;
+            border-radius: 4px;
+            padding: 10px;
+            margin: 10px 0;
+            font-size: 12px;
+            color: #0066cc;
+        }
+        .status-bar {
+            background: #f8f9fa;
+            border-top: 1px solid #ddd;
+            padding: 10px 20px;
+            font-size: 12px;
+            color: #666;
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+        }
+        .error-msg {
+            color: #d9534f;
+            font-weight: bold;
+        }
+        .success-msg {
+            color: #5cb85c;
+            font-weight: bold;
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <div class="header">
+            江苏工伤联网结算接口测试工具 - WorkInjuryInterfaceTest
+        </div>
+        
+        <div class="button-group">
+            <!-- 系统管理按钮 -->
+            <button class="btn init" onclick="loadInitParams()" title="初始化工伤联网系统">初始化</button>
+            <button class="btn signin" onclick="loadSignInParams()" title="操作员签到">签到</button>
+            <button class="btn signout" onclick="loadSignOutParams()" title="操作员签退">签退</button>
+            <button class="btn business" onclick="loadBusinessParams()" title="工伤业务交易">业务</button>
+            
+            <!-- 特殊功能按钮 -->
+            <button class="btn" onclick="loadHealthCheckParams()" title="检查系统健康状态">健康检查</button>
+            <button class="btn" onclick="loadStatsParams()" title="获取系统统计信息">统计信息</button>
+            
+                                  <!-- 执行按钮 -->
+             <button class="btn" onclick="callWorkInjuryAPI()" title="调用工伤联网接口" style="background: #28A745; font-weight: bold;">🚀 调用接口</button>
+             
+             <!-- 工具按钮 -->
+             <button class="btn clear" onclick="clearAll()" title="清空入参和出参">清屏</button>
+             <button class="btn reset" onclick="resetToDefault()" title="恢复默认参数">重置</button>
+             <button class="btn" onclick="showParamExamples()" title="显示参数示例" style="background: #17A2B8;">参数示例</button>
+     </div>
+        
+                 <!-- 功能说明 -->
+         <div class="function-help">
+             <strong>📋 使用说明:</strong><br>
+             1. <strong>初始化</strong>:系统启动时必须先调用,配置医院信息和系统参数<br>
+             2. <strong>签到</strong>:操作员登录工伤系统,获取签到流水号(每日首次使用)<br>
+             3. <strong>签退</strong>:操作员退出工伤系统(下班时调用)<br>
+             4. <strong>业务</strong>:处理工伤患者的各种业务交易(读卡、登记、结算等)<br>
+             5. <strong>健康检查</strong>:检查系统运行状态和DLL文件<br>
+             6. <strong>统计信息</strong>:查看交易统计和系统状态<br><br>
+             <strong>⚠️ 注意事项:</strong>必须按顺序操作:初始化 → 签到 → 业务交易 → 签退<br><br>
+             <strong>🔧 关于"诊区"功能的说明:</strong><br>
+             原测试界面的"诊区"功能在工伤系统中不适用,因为:<br>
+             • 工伤系统关注的是<strong>业务交易类型</strong>,而非物理诊疗区域<br>
+             • 江苏工伤联网规范中没有诊区概念,主要是签到、读卡、登记、结算等交易<br>
+             • 已改为"健康检查"功能,更符合系统监控需求
+         </div>
+        
+        <div class="section">
+            <div class="section-title">入参</div>
+            <textarea id="inputParams" class="param-area" placeholder="请选择上方按钮加载默认参数,或手动输入JSON格式的请求参数..."></textarea>
+                         <div class="help-text">
+                 💡 <strong>参数格式说明:</strong><br>
+                 • <strong>action</strong>: 操作类型 (init|transaction|health|stats|signin_status)<br>
+                 • <strong>transactionName</strong>: 交易名称 (读卡|RegisterPatient|PreSettle|Settle等)<br>
+                 • <strong>businessParams</strong>: 业务参数对象<br>
+                 • <strong>identifyMode</strong>: 识别方式 (1-实体卡|2-电子凭证)<br>
+                 • <strong>operatorId</strong>: 操作员编号<br>
+                 • <strong>operatorName</strong>: 操作员姓名<br><br>
+                 
+                 📝 <strong>使用步骤:</strong><br>
+                 1. 点击上方按钮加载对应功能的默认参数<br>
+                 2. 根据实际情况修改参数值(如操作员信息、患者信息等)<br>
+                 3. 点击"🚀 调用接口"按钮或双击此文本框或按Ctrl+Enter<br>
+                 4. 查看下方出参框中的返回结果<br><br>
+                 
+                 <span id="currentFunction" style="color: #0066cc; font-weight: bold;">当前功能:未选择</span>
+             </div>
+        </div>
+        
+        <div class="section">
+            <div class="section-title">出参</div>
+            <textarea id="outputParams" class="param-area" placeholder="调用接口后,返回结果将显示在这里..." readonly></textarea>
+            <div class="help-text">
+                📊 <strong>返回字段说明:</strong><br>
+                • <strong>success</strong>: 调用是否成功 (true|false)<br>
+                • <strong>code</strong>: 结果代码 (200-成功,其他-失败)<br>
+                • <strong>message</strong>: 结果描述信息<br>
+                • <strong>data</strong>: 具体业务数据<br>
+                • <strong>device</strong>: 设备标识
+            </div>
+        </div>
+        
+        <div class="status-bar">
+            <span id="statusMsg">就绪 - 请选择功能并配置参数</span>
+            <span>接口地址: http://localhost:8321/api/entry/workinjury</span>
+        </div>
+    </div>
+
+    <script>
+        const inputArea = document.getElementById('inputParams');
+        const outputArea = document.getElementById('outputParams');
+        const statusMsg = document.getElementById('statusMsg');
+        
+        // 默认参数配置
+        const defaultParams = {
+            init: {
+                action: "init",
+                config: {
+                    fixmedinsCode: "H32132200561",
+                    fixmedinsName: "宿迁沭阳铭和医院",
+                    receiverSysCode: "JSYTH",
+                    interfaceVersion: "V2.1",
+                    operatorType: "1",
+                    defaultOperator: "001",
+                    defaultOperatorName: "收费员张三",
+                    logPath: "logs/workinjury/"
+                }
+            },
+            signin: {
+                action: "transaction",
+                transactionName: "SignIn",
+                operatorId: "001",
+                operatorName: "收费员张三"
+            },
+            signout: {
+                action: "transaction",
+                transactionName: "SignOut",
+                operatorId: "001",
+                operatorName: "收费员张三"
+            },
+            business: {
+                action: "transaction",
+                transactionName: "读卡",
+                identifyMode: "1",
+                operatorId: "001",
+                operatorName: "收费员张三",
+                businessParams: {
+                    // 根据具体交易类型填写对应参数
+                    // 例如登记时需要填写:psn_no、visit_type、dept_code等
+                    // 例如结算时需要填写:visit_no、fee_details等
+                }
+            },
+            health: {
+                action: "health"
+            },
+            stats: {
+                action: "stats"
+            }
+        };
+        
+                 // 加载初始化参数
+         function loadInitParams() {
+             inputArea.value = JSON.stringify(defaultParams.init, null, 2);
+             updateStatus('已加载初始化参数 - 配置医院信息和系统环境');
+             updateCurrentFunction('系统初始化');
+         }
+        
+                 // 加载签到参数
+         function loadSignInParams() {
+             inputArea.value = JSON.stringify(defaultParams.signin, null, 2);
+             updateStatus('已加载签到参数 - 操作员登录工伤系统');
+             updateCurrentFunction('操作员签到');
+         }
+         
+         // 加载签退参数
+         function loadSignOutParams() {
+             inputArea.value = JSON.stringify(defaultParams.signout, null, 2);
+             updateStatus('已加载签退参数 - 操作员退出工伤系统');
+             updateCurrentFunction('操作员签退');
+         }
+        
+        // 加载业务交易参数
+        function loadBusinessParams() {
+            const businessExamples = [
+                {
+                    name: "读卡",
+                    params: {
+                        action: "transaction",
+                        transactionName: "读卡",
+                        identifyMode: "1",
+                        operatorId: "001",
+                        operatorName: "收费员张三"
+                    }
+                },
+                {
+                    name: "患者登记",
+                    params: {
+                        action: "transaction",
+                        transactionName: "RegisterPatient",
+                        businessParams: {
+                            psn_no: "32010219800101001X",
+                            visit_type: "1",
+                            dept_code: "001",
+                            dept_name: "骨科",
+                            doctor_code: "DOC001",
+                            doctor_name: "张主任",
+                            diag_code: "M79.900",
+                            diag_name: "骨折",
+                            visit_time: "2024-12-01 10:30:00"
+                        },
+                        identifyMode: "1"
+                    }
+                },
+                {
+                    name: "费用预结算",
+                    params: {
+                        action: "transaction",
+                        transactionName: "PreSettle",
+                        businessParams: {
+                            visit_no: "V20241201001",
+                            fee_details: [
+                                {
+                                    fee_ocur_time: "2024-12-01 10:30:00",
+                                    med_list_codg: "001",
+                                    med_list_name: "X光片检查",
+                                    med_chrgitm_type: "4",
+                                    fee_amt: 120.00,
+                                    cnt: 1,
+                                    pric: 120.00,
+                                    spec: "胸部X光",
+                                    dept_code: "001",
+                                    dept_name: "骨科"
+                                }
+                            ]
+                        }
+                    }
+                },
+                {
+                    name: "正式结算",
+                    params: {
+                        action: "transaction",
+                        transactionName: "Settle",
+                        businessParams: {
+                            visit_no: "V20241201001",
+                            pre_settle_id: "PS20241201001"
+                        }
+                    }
+                }
+            ];
+            
+            // 显示业务交易选择提示
+            const selected = prompt(
+                "请选择业务交易类型:\n" +
+                "1. 读卡\n" +
+                "2. 患者登记\n" +
+                "3. 费用预结算\n" +
+                "4. 正式结算\n\n" +
+                "请输入数字 (1-4):"
+            );
+            
+            const index = parseInt(selected) - 1;
+                         if (index >= 0 && index < businessExamples.length) {
+                 inputArea.value = JSON.stringify(businessExamples[index].params, null, 2);
+                 updateStatus(`已加载业务参数 - ${businessExamples[index].name}`);
+                 updateCurrentFunction(`业务交易 - ${businessExamples[index].name}`);
+             } else {
+                 inputArea.value = JSON.stringify(defaultParams.business, null, 2);
+                 updateStatus('已加载默认业务参数 - 读卡');
+                 updateCurrentFunction('业务交易 - 读卡');
+             }
+        }
+        
+                 // 加载健康检查参数
+         function loadHealthCheckParams() {
+             inputArea.value = JSON.stringify(defaultParams.health, null, 2);
+             updateStatus('已加载健康检查参数 - 系统状态诊断');
+             updateCurrentFunction('系统健康检查');
+         }
+         
+         // 加载统计信息参数
+         function loadStatsParams() {
+             inputArea.value = JSON.stringify(defaultParams.stats, null, 2);
+             updateStatus('已加载统计信息参数 - 查看系统运行数据');
+             updateCurrentFunction('系统统计信息');
+         }
+        
+                 // 清空所有内容
+         function clearAll() {
+             inputArea.value = '';
+             outputArea.value = '';
+             updateStatus('已清空所有内容');
+             updateCurrentFunction('未选择');
+         }
+         
+         // 重置为默认参数
+         function resetToDefault() {
+             loadInitParams();
+             outputArea.value = '';
+             updateStatus('已重置为默认初始化参数');
+             // loadInitParams()中已包含updateCurrentFunction调用
+         }
+        
+                 // 更新状态信息
+         function updateStatus(message, isError = false) {
+             statusMsg.textContent = message;
+             statusMsg.className = isError ? 'error-msg' : 'success-msg';
+             
+             // 3秒后恢复默认状态
+             setTimeout(() => {
+                 statusMsg.textContent = '就绪 - 请选择功能并配置参数';
+                 statusMsg.className = '';
+             }, 3000);
+         }
+         
+         // 更新当前功能显示
+         function updateCurrentFunction(functionName) {
+             const currentFunctionSpan = document.getElementById('currentFunction');
+             currentFunctionSpan.textContent = `当前功能:${functionName}`;
+         }
+        
+        // 调用接口(当前只是模拟,需要连接实际接口)
+        async function callWorkInjuryAPI() {
+            try {
+                const inputText = inputArea.value.trim();
+                if (!inputText) {
+                    updateStatus('请先输入参数', true);
+                    return;
+                }
+                
+                const params = JSON.parse(inputText);
+                updateStatus('正在调用接口...');
+                
+                const response = await fetch('http://localhost:8321/api/entry/workinjury', {
+                    method: 'POST',
+                    headers: {
+                        'Content-Type': 'application/json'
+                    },
+                    body: JSON.stringify(params)
+                });
+                
+                const result = await response.json();
+                outputArea.value = JSON.stringify(result, null, 2);
+                
+                if (result.success) {
+                    updateStatus('接口调用成功');
+                } else {
+                    updateStatus(`接口调用失败: ${result.message}`, true);
+                }
+                
+            } catch (error) {
+                outputArea.value = JSON.stringify({
+                    success: false,
+                    error: error.message,
+                    timestamp: new Date().toISOString()
+                }, null, 2);
+                updateStatus(`调用异常: ${error.message}`, true);
+            }
+        }
+        
+        // 双击入参区域调用接口
+        inputArea.addEventListener('dblclick', callWorkInjuryAPI);
+        
+        // 添加键盘快捷键支持
+        document.addEventListener('keydown', function(e) {
+            if (e.ctrlKey) {
+                switch(e.key) {
+                    case '1': loadInitParams(); e.preventDefault(); break;
+                    case '2': loadSignInParams(); e.preventDefault(); break;
+                    case '3': loadSignOutParams(); e.preventDefault(); break;
+                    case '4': loadBusinessParams(); e.preventDefault(); break;
+                    case 'Enter': callWorkInjuryAPI(); e.preventDefault(); break;
+                    case 'Delete': clearAll(); e.preventDefault(); break;
+                    case 'r': resetToDefault(); e.preventDefault(); break;
+                }
+            }
+        });
+        
+                 // 显示参数示例
+         function showParamExamples() {
+             const examples = `
+📋 工伤联网接口参数示例大全
+
+🔧 1. 系统初始化
+{
+  "action": "init",
+  "config": {
+    "fixmedinsCode": "H32132200561",     // 医院编号(必填)
+    "fixmedinsName": "宿迁沭阳铭和医院",  // 医院名称(必填)
+    "receiverSysCode": "JSYTH",         // 固定值
+    "interfaceVersion": "V2.1",         // 固定值
+    "operatorType": "1",                // 1-人工 2-自助
+    "defaultOperator": "001",           // 操作员编号
+    "defaultOperatorName": "收费员张三"  // 操作员姓名
+  }
+}
+
+👤 2. 操作员签到
+{
+  "action": "transaction",
+  "transactionName": "SignIn",
+  "operatorId": "001",                  // 当前操作员编号
+  "operatorName": "收费员张三"           // 当前操作员姓名
+}
+
+🏥 3. 工伤患者读卡
+{
+  "action": "transaction",
+  "transactionName": "读卡",
+  "identifyMode": "1",                  // 1-实体卡 2-电子凭证
+  "operatorId": "001",
+  "operatorName": "收费员张三"
+}
+
+📝 4. 患者登记
+{
+  "action": "transaction",
+  "transactionName": "RegisterPatient",
+  "businessParams": {
+    "psn_no": "32010219800101001X",     // 身份证号(必填)
+    "visit_type": "1",                  // 1-门诊 2-住院
+    "dept_code": "001",                 // 科室编码
+    "dept_name": "骨科",                // 科室名称
+    "doctor_code": "DOC001",            // 医生编码
+    "doctor_name": "张主任",            // 医生姓名
+    "diag_code": "M79.900",            // 诊断代码
+    "diag_name": "骨折"                 // 诊断名称
+  },
+  "identifyMode": "1"
+}
+
+💰 5. 费用预结算
+{
+  "action": "transaction",
+  "transactionName": "PreSettle",
+  "businessParams": {
+    "visit_no": "V20241201001",         // 就诊号(来自登记结果)
+    "fee_details": [                    // 费用明细数组
+      {
+        "fee_ocur_time": "2024-12-01 10:30:00",
+        "med_list_codg": "001",         // 项目编码
+        "med_list_name": "X光检查",     // 项目名称
+        "med_chrgitm_type": "4",        // 1-药品 2-诊疗 4-检查
+        "fee_amt": 120.00,              // 总金额
+        "cnt": 1,                       // 数量
+        "pric": 120.00,                 // 单价
+        "spec": "胸部X光",              // 规格
+        "dept_code": "001",             // 科室编码
+        "dept_name": "骨科"             // 科室名称
+      }
+    ]
+  }
+}
+
+💳 6. 正式结算
+{
+  "action": "transaction",
+  "transactionName": "Settle",
+  "businessParams": {
+    "visit_no": "V20241201001",         // 就诊号
+    "pre_settle_id": "PS20241201001"    // 预结算ID(来自预结算结果)
+  }
+}
+
+📊 7. 健康检查
+{
+  "action": "health"
+}
+
+📈 8. 统计信息
+{
+  "action": "stats"
+}
+
+⚠️ 重要提示:
+• 患者身份证号、就诊号、预结算ID等关键参数必须使用真实有效的值
+• 医院编号和名称必须与江苏人社备案信息一致
+• 操作员信息建议使用当前登录用户的真实信息
+• 费用明细中的医疗目录编码需要符合当地医保目录规范
+            `;
+            
+            alert(examples);
+         }
+         
+         // 页面加载时显示欢迎信息
+         window.onload = function() {
+             updateStatus('工伤联网接口测试工具已就绪');
+             // 默认加载初始化参数
+             setTimeout(() => {
+                 loadInitParams();
+             }, 1000);
+         };
+    </script>
+</body>
+</html>
+