test_workinjury_interface.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>江苏工伤联网结算接口测试</title>
  7. <style>
  8. body {
  9. font-family: 'Microsoft YaHei', Arial, sans-serif;
  10. margin: 0;
  11. padding: 20px;
  12. background-color: #f0f0f0;
  13. }
  14. .container {
  15. max-width: 1000px;
  16. margin: 0 auto;
  17. background: white;
  18. border-radius: 8px;
  19. box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  20. overflow: hidden;
  21. }
  22. .header {
  23. background: #4472C4;
  24. color: white;
  25. padding: 15px 20px;
  26. font-size: 16px;
  27. font-weight: bold;
  28. display: flex;
  29. align-items: center;
  30. }
  31. .header::before {
  32. content: "🏥";
  33. margin-right: 10px;
  34. font-size: 18px;
  35. }
  36. .button-group {
  37. padding: 20px;
  38. border-bottom: 1px solid #ddd;
  39. background: #f8f9fa;
  40. }
  41. .btn {
  42. background: #5B9BD5;
  43. color: white;
  44. border: none;
  45. padding: 8px 16px;
  46. margin: 4px;
  47. border-radius: 4px;
  48. cursor: pointer;
  49. font-size: 14px;
  50. min-width: 80px;
  51. transition: background-color 0.2s;
  52. }
  53. .btn:hover {
  54. background: #4682B4;
  55. }
  56. .btn:active {
  57. background: #2F5496;
  58. }
  59. .btn.init { background: #70AD47; }
  60. .btn.init:hover { background: #5A8A3A; }
  61. .btn.signin { background: #FFC000; color: #333; }
  62. .btn.signin:hover { background: #E6AC00; }
  63. .btn.signout { background: #FF6B6B; }
  64. .btn.signout:hover { background: #E55555; }
  65. .btn.business { background: #5B9BD5; }
  66. .btn.business:hover { background: #4682B4; }
  67. .btn.clear { background: #D9534F; }
  68. .btn.clear:hover { background: #C9302C; }
  69. .btn.reset { background: #6C757D; }
  70. .btn.reset:hover { background: #5A6268; }
  71. .section {
  72. padding: 15px 20px;
  73. }
  74. .section-title {
  75. font-weight: bold;
  76. margin-bottom: 10px;
  77. color: #333;
  78. }
  79. .param-area {
  80. width: 100%;
  81. height: 300px;
  82. border: 1px solid #ccc;
  83. padding: 10px;
  84. font-family: 'Courier New', monospace;
  85. font-size: 12px;
  86. resize: vertical;
  87. background: #fafafa;
  88. }
  89. .param-area:focus {
  90. outline: none;
  91. border-color: #5B9BD5;
  92. background: white;
  93. }
  94. .help-text {
  95. font-size: 12px;
  96. color: #666;
  97. margin-top: 5px;
  98. line-height: 1.4;
  99. }
  100. .function-help {
  101. background: #e8f4fd;
  102. border: 1px solid #b6d7ff;
  103. border-radius: 4px;
  104. padding: 10px;
  105. margin: 10px 0;
  106. font-size: 12px;
  107. color: #0066cc;
  108. }
  109. .status-bar {
  110. background: #f8f9fa;
  111. border-top: 1px solid #ddd;
  112. padding: 10px 20px;
  113. font-size: 12px;
  114. color: #666;
  115. display: flex;
  116. justify-content: space-between;
  117. align-items: center;
  118. }
  119. .error-msg {
  120. color: #d9534f;
  121. font-weight: bold;
  122. }
  123. .success-msg {
  124. color: #5cb85c;
  125. font-weight: bold;
  126. }
  127. </style>
  128. </head>
  129. <body>
  130. <div class="container">
  131. <div class="header">
  132. 江苏工伤联网结算接口测试工具 - WorkInjuryInterfaceTest
  133. </div>
  134. <div class="button-group">
  135. <!-- 系统管理按钮 -->
  136. <button class="btn init" onclick="loadInitParams()" title="初始化工伤联网系统">初始化</button>
  137. <button class="btn signin" onclick="loadSignInParams()" title="操作员签到">签到</button>
  138. <button class="btn signout" onclick="loadSignOutParams()" title="操作员签退">签退</button>
  139. <button class="btn business" onclick="loadBusinessParams()" title="工伤业务交易">业务</button>
  140. <!-- 特殊功能按钮 -->
  141. <button class="btn" onclick="loadHealthCheckParams()" title="检查系统健康状态">健康检查</button>
  142. <button class="btn" onclick="loadStatsParams()" title="获取系统统计信息">统计信息</button>
  143. <!-- 执行按钮 -->
  144. <button class="btn" onclick="callWorkInjuryAPI()" title="调用工伤联网接口" style="background: #28A745; font-weight: bold;">🚀 调用接口</button>
  145. <!-- 工具按钮 -->
  146. <button class="btn clear" onclick="clearAll()" title="清空入参和出参">清屏</button>
  147. <button class="btn reset" onclick="resetToDefault()" title="恢复默认参数">重置</button>
  148. <button class="btn" onclick="showParamExamples()" title="显示参数示例" style="background: #17A2B8;">参数示例</button>
  149. </div>
  150. <!-- 功能说明 -->
  151. <div class="function-help">
  152. <strong>📋 使用说明:</strong><br>
  153. 1. <strong>初始化</strong>:系统启动时必须先调用,配置医院信息和系统参数<br>
  154. 2. <strong>签到</strong>:操作员登录工伤系统,获取签到流水号(每日首次使用)<br>
  155. 3. <strong>签退</strong>:操作员退出工伤系统(下班时调用)<br>
  156. 4. <strong>业务</strong>:处理工伤患者的各种业务交易(读卡、登记、结算等)<br>
  157. 5. <strong>健康检查</strong>:检查系统运行状态和DLL文件<br>
  158. 6. <strong>统计信息</strong>:查看交易统计和系统状态<br><br>
  159. <strong>⚠️ 注意事项:</strong>必须按顺序操作:初始化 → 签到 → 业务交易 → 签退<br><br>
  160. <strong>🔧 关于"诊区"功能的说明:</strong><br>
  161. 原测试界面的"诊区"功能在工伤系统中不适用,因为:<br>
  162. • 工伤系统关注的是<strong>业务交易类型</strong>,而非物理诊疗区域<br>
  163. • 江苏工伤联网规范中没有诊区概念,主要是签到、读卡、登记、结算等交易<br>
  164. • 已改为"健康检查"功能,更符合系统监控需求
  165. </div>
  166. <div class="section">
  167. <div class="section-title">入参</div>
  168. <textarea id="inputParams" class="param-area" placeholder="请选择上方按钮加载默认参数,或手动输入JSON格式的请求参数..."></textarea>
  169. <div class="help-text">
  170. 💡 <strong>参数格式说明:</strong><br>
  171. • <strong>action</strong>: 操作类型 (init|transaction|health|stats|signin_status)<br>
  172. • <strong>transactionName</strong>: 交易名称 (读卡|RegisterPatient|PreSettle|Settle等)<br>
  173. • <strong>businessParams</strong>: 业务参数对象<br>
  174. • <strong>identifyMode</strong>: 识别方式 (1-实体卡|2-电子凭证)<br>
  175. • <strong>operatorId</strong>: 操作员编号<br>
  176. • <strong>operatorName</strong>: 操作员姓名<br><br>
  177. 📝 <strong>使用步骤:</strong><br>
  178. 1. 点击上方按钮加载对应功能的默认参数<br>
  179. 2. 根据实际情况修改参数值(如操作员信息、患者信息等)<br>
  180. 3. 点击"🚀 调用接口"按钮或双击此文本框或按Ctrl+Enter<br>
  181. 4. 查看下方出参框中的返回结果<br><br>
  182. <span id="currentFunction" style="color: #0066cc; font-weight: bold;">当前功能:未选择</span>
  183. </div>
  184. </div>
  185. <div class="section">
  186. <div class="section-title">出参</div>
  187. <textarea id="outputParams" class="param-area" placeholder="调用接口后,返回结果将显示在这里..." readonly></textarea>
  188. <div class="help-text">
  189. 📊 <strong>返回字段说明:</strong><br>
  190. • <strong>success</strong>: 调用是否成功 (true|false)<br>
  191. • <strong>code</strong>: 结果代码 (200-成功,其他-失败)<br>
  192. • <strong>message</strong>: 结果描述信息<br>
  193. • <strong>data</strong>: 具体业务数据<br>
  194. • <strong>device</strong>: 设备标识
  195. </div>
  196. </div>
  197. <div class="status-bar">
  198. <span id="statusMsg">就绪 - 请选择功能并配置参数</span>
  199. <span>接口地址: http://localhost:8321/api/entry/workinjury</span>
  200. </div>
  201. </div>
  202. <script>
  203. const inputArea = document.getElementById('inputParams');
  204. const outputArea = document.getElementById('outputParams');
  205. const statusMsg = document.getElementById('statusMsg');
  206. // 默认参数配置
  207. const defaultParams = {
  208. init: {
  209. action: "init",
  210. config: {
  211. fixmedinsCode: "H32132200561",
  212. fixmedinsName: "宿迁沭阳铭和医院",
  213. receiverSysCode: "JSYTH",
  214. interfaceVersion: "V2.1",
  215. operatorType: "1",
  216. defaultOperator: "001",
  217. defaultOperatorName: "收费员张三",
  218. logPath: "logs/workinjury/"
  219. }
  220. },
  221. signin: {
  222. action: "transaction",
  223. transactionName: "SignIn",
  224. operatorId: "001",
  225. operatorName: "收费员张三"
  226. },
  227. signout: {
  228. action: "transaction",
  229. transactionName: "SignOut",
  230. operatorId: "001",
  231. operatorName: "收费员张三"
  232. },
  233. business: {
  234. action: "transaction",
  235. transactionName: "读卡",
  236. identifyMode: "1",
  237. operatorId: "001",
  238. operatorName: "收费员张三",
  239. businessParams: {
  240. // 根据具体交易类型填写对应参数
  241. // 例如登记时需要填写:psn_no、visit_type、dept_code等
  242. // 例如结算时需要填写:visit_no、fee_details等
  243. }
  244. },
  245. health: {
  246. action: "health"
  247. },
  248. stats: {
  249. action: "stats"
  250. }
  251. };
  252. // 加载初始化参数
  253. function loadInitParams() {
  254. inputArea.value = JSON.stringify(defaultParams.init, null, 2);
  255. updateStatus('已加载初始化参数 - 配置医院信息和系统环境');
  256. updateCurrentFunction('系统初始化');
  257. }
  258. // 加载签到参数
  259. function loadSignInParams() {
  260. inputArea.value = JSON.stringify(defaultParams.signin, null, 2);
  261. updateStatus('已加载签到参数 - 操作员登录工伤系统');
  262. updateCurrentFunction('操作员签到');
  263. }
  264. // 加载签退参数
  265. function loadSignOutParams() {
  266. inputArea.value = JSON.stringify(defaultParams.signout, null, 2);
  267. updateStatus('已加载签退参数 - 操作员退出工伤系统');
  268. updateCurrentFunction('操作员签退');
  269. }
  270. // 加载业务交易参数
  271. function loadBusinessParams() {
  272. const businessExamples = [
  273. {
  274. name: "读卡",
  275. params: {
  276. action: "transaction",
  277. transactionName: "读卡",
  278. identifyMode: "1",
  279. operatorId: "001",
  280. operatorName: "收费员张三"
  281. }
  282. },
  283. {
  284. name: "患者登记",
  285. params: {
  286. action: "transaction",
  287. transactionName: "RegisterPatient",
  288. businessParams: {
  289. psn_no: "32010219800101001X",
  290. visit_type: "1",
  291. dept_code: "001",
  292. dept_name: "骨科",
  293. doctor_code: "DOC001",
  294. doctor_name: "张主任",
  295. diag_code: "M79.900",
  296. diag_name: "骨折",
  297. visit_time: "2024-12-01 10:30:00"
  298. },
  299. identifyMode: "1"
  300. }
  301. },
  302. {
  303. name: "费用预结算",
  304. params: {
  305. action: "transaction",
  306. transactionName: "PreSettle",
  307. businessParams: {
  308. visit_no: "V20241201001",
  309. fee_details: [
  310. {
  311. fee_ocur_time: "2024-12-01 10:30:00",
  312. med_list_codg: "001",
  313. med_list_name: "X光片检查",
  314. med_chrgitm_type: "4",
  315. fee_amt: 120.00,
  316. cnt: 1,
  317. pric: 120.00,
  318. spec: "胸部X光",
  319. dept_code: "001",
  320. dept_name: "骨科"
  321. }
  322. ]
  323. }
  324. }
  325. },
  326. {
  327. name: "正式结算",
  328. params: {
  329. action: "transaction",
  330. transactionName: "Settle",
  331. businessParams: {
  332. visit_no: "V20241201001",
  333. pre_settle_id: "PS20241201001"
  334. }
  335. }
  336. }
  337. ];
  338. // 显示业务交易选择提示
  339. const selected = prompt(
  340. "请选择业务交易类型:\n" +
  341. "1. 读卡\n" +
  342. "2. 患者登记\n" +
  343. "3. 费用预结算\n" +
  344. "4. 正式结算\n\n" +
  345. "请输入数字 (1-4):"
  346. );
  347. const index = parseInt(selected) - 1;
  348. if (index >= 0 && index < businessExamples.length) {
  349. inputArea.value = JSON.stringify(businessExamples[index].params, null, 2);
  350. updateStatus(`已加载业务参数 - ${businessExamples[index].name}`);
  351. updateCurrentFunction(`业务交易 - ${businessExamples[index].name}`);
  352. } else {
  353. inputArea.value = JSON.stringify(defaultParams.business, null, 2);
  354. updateStatus('已加载默认业务参数 - 读卡');
  355. updateCurrentFunction('业务交易 - 读卡');
  356. }
  357. }
  358. // 加载健康检查参数
  359. function loadHealthCheckParams() {
  360. inputArea.value = JSON.stringify(defaultParams.health, null, 2);
  361. updateStatus('已加载健康检查参数 - 系统状态诊断');
  362. updateCurrentFunction('系统健康检查');
  363. }
  364. // 加载统计信息参数
  365. function loadStatsParams() {
  366. inputArea.value = JSON.stringify(defaultParams.stats, null, 2);
  367. updateStatus('已加载统计信息参数 - 查看系统运行数据');
  368. updateCurrentFunction('系统统计信息');
  369. }
  370. // 清空所有内容
  371. function clearAll() {
  372. inputArea.value = '';
  373. outputArea.value = '';
  374. updateStatus('已清空所有内容');
  375. updateCurrentFunction('未选择');
  376. }
  377. // 重置为默认参数
  378. function resetToDefault() {
  379. loadInitParams();
  380. outputArea.value = '';
  381. updateStatus('已重置为默认初始化参数');
  382. // loadInitParams()中已包含updateCurrentFunction调用
  383. }
  384. // 更新状态信息
  385. function updateStatus(message, isError = false) {
  386. statusMsg.textContent = message;
  387. statusMsg.className = isError ? 'error-msg' : 'success-msg';
  388. // 3秒后恢复默认状态
  389. setTimeout(() => {
  390. statusMsg.textContent = '就绪 - 请选择功能并配置参数';
  391. statusMsg.className = '';
  392. }, 3000);
  393. }
  394. // 更新当前功能显示
  395. function updateCurrentFunction(functionName) {
  396. const currentFunctionSpan = document.getElementById('currentFunction');
  397. currentFunctionSpan.textContent = `当前功能:${functionName}`;
  398. }
  399. // 调用接口(当前只是模拟,需要连接实际接口)
  400. async function callWorkInjuryAPI() {
  401. try {
  402. const inputText = inputArea.value.trim();
  403. if (!inputText) {
  404. updateStatus('请先输入参数', true);
  405. return;
  406. }
  407. const params = JSON.parse(inputText);
  408. updateStatus('正在调用接口...');
  409. const response = await fetch('http://localhost:8321/api/entry/workinjury', {
  410. method: 'POST',
  411. headers: {
  412. 'Content-Type': 'application/json'
  413. },
  414. body: JSON.stringify(params)
  415. });
  416. const result = await response.json();
  417. outputArea.value = JSON.stringify(result, null, 2);
  418. if (result.success) {
  419. updateStatus('接口调用成功');
  420. } else {
  421. updateStatus(`接口调用失败: ${result.message}`, true);
  422. }
  423. } catch (error) {
  424. outputArea.value = JSON.stringify({
  425. success: false,
  426. error: error.message,
  427. timestamp: new Date().toISOString()
  428. }, null, 2);
  429. updateStatus(`调用异常: ${error.message}`, true);
  430. }
  431. }
  432. // 双击入参区域调用接口
  433. inputArea.addEventListener('dblclick', callWorkInjuryAPI);
  434. // 添加键盘快捷键支持
  435. document.addEventListener('keydown', function(e) {
  436. if (e.ctrlKey) {
  437. switch(e.key) {
  438. case '1': loadInitParams(); e.preventDefault(); break;
  439. case '2': loadSignInParams(); e.preventDefault(); break;
  440. case '3': loadSignOutParams(); e.preventDefault(); break;
  441. case '4': loadBusinessParams(); e.preventDefault(); break;
  442. case 'Enter': callWorkInjuryAPI(); e.preventDefault(); break;
  443. case 'Delete': clearAll(); e.preventDefault(); break;
  444. case 'r': resetToDefault(); e.preventDefault(); break;
  445. }
  446. }
  447. });
  448. // 显示参数示例
  449. function showParamExamples() {
  450. const examples = `
  451. 📋 工伤联网接口参数示例大全
  452. 🔧 1. 系统初始化
  453. {
  454. "action": "init",
  455. "config": {
  456. "fixmedinsCode": "H32132200561", // 医院编号(必填)
  457. "fixmedinsName": "宿迁沭阳铭和医院", // 医院名称(必填)
  458. "receiverSysCode": "JSYTH", // 固定值
  459. "interfaceVersion": "V2.1", // 固定值
  460. "operatorType": "1", // 1-人工 2-自助
  461. "defaultOperator": "001", // 操作员编号
  462. "defaultOperatorName": "收费员张三" // 操作员姓名
  463. }
  464. }
  465. 👤 2. 操作员签到
  466. {
  467. "action": "transaction",
  468. "transactionName": "SignIn",
  469. "operatorId": "001", // 当前操作员编号
  470. "operatorName": "收费员张三" // 当前操作员姓名
  471. }
  472. 🏥 3. 工伤患者读卡
  473. {
  474. "action": "transaction",
  475. "transactionName": "读卡",
  476. "identifyMode": "1", // 1-实体卡 2-电子凭证
  477. "operatorId": "001",
  478. "operatorName": "收费员张三"
  479. }
  480. 📝 4. 患者登记
  481. {
  482. "action": "transaction",
  483. "transactionName": "RegisterPatient",
  484. "businessParams": {
  485. "psn_no": "32010219800101001X", // 身份证号(必填)
  486. "visit_type": "1", // 1-门诊 2-住院
  487. "dept_code": "001", // 科室编码
  488. "dept_name": "骨科", // 科室名称
  489. "doctor_code": "DOC001", // 医生编码
  490. "doctor_name": "张主任", // 医生姓名
  491. "diag_code": "M79.900", // 诊断代码
  492. "diag_name": "骨折" // 诊断名称
  493. },
  494. "identifyMode": "1"
  495. }
  496. 💰 5. 费用预结算
  497. {
  498. "action": "transaction",
  499. "transactionName": "PreSettle",
  500. "businessParams": {
  501. "visit_no": "V20241201001", // 就诊号(来自登记结果)
  502. "fee_details": [ // 费用明细数组
  503. {
  504. "fee_ocur_time": "2024-12-01 10:30:00",
  505. "med_list_codg": "001", // 项目编码
  506. "med_list_name": "X光检查", // 项目名称
  507. "med_chrgitm_type": "4", // 1-药品 2-诊疗 4-检查
  508. "fee_amt": 120.00, // 总金额
  509. "cnt": 1, // 数量
  510. "pric": 120.00, // 单价
  511. "spec": "胸部X光", // 规格
  512. "dept_code": "001", // 科室编码
  513. "dept_name": "骨科" // 科室名称
  514. }
  515. ]
  516. }
  517. }
  518. 💳 6. 正式结算
  519. {
  520. "action": "transaction",
  521. "transactionName": "Settle",
  522. "businessParams": {
  523. "visit_no": "V20241201001", // 就诊号
  524. "pre_settle_id": "PS20241201001" // 预结算ID(来自预结算结果)
  525. }
  526. }
  527. 📊 7. 健康检查
  528. {
  529. "action": "health"
  530. }
  531. 📈 8. 统计信息
  532. {
  533. "action": "stats"
  534. }
  535. ⚠️ 重要提示:
  536. • 患者身份证号、就诊号、预结算ID等关键参数必须使用真实有效的值
  537. • 医院编号和名称必须与江苏人社备案信息一致
  538. • 操作员信息建议使用当前登录用户的真实信息
  539. • 费用明细中的医疗目录编码需要符合当地医保目录规范
  540. `;
  541. alert(examples);
  542. }
  543. // 页面加载时显示欢迎信息
  544. window.onload = function() {
  545. updateStatus('工伤联网接口测试工具已就绪');
  546. // 默认加载初始化参数
  547. setTimeout(() => {
  548. loadInitParams();
  549. }, 1000);
  550. };
  551. </script>
  552. </body>
  553. </html>