test_workinjury_interface.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  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;">🚀 调用接口1</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: "SQ201348",
  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. identifyMode: "1",
  225. operatorId: "001",
  226. operatorName: "收费员张三",
  227. businessParams: {}
  228. },
  229. signout: {
  230. action: "transaction",
  231. transactionName: "SignOut",
  232. identifyMode: "1",
  233. operatorId: "001",
  234. operatorName: "收费员张三",
  235. businessParams: {}
  236. },
  237. business: {
  238. action: "transaction",
  239. transactionName: "读卡",
  240. identifyMode: "1",
  241. operatorId: "001",
  242. operatorName: "收费员张三",
  243. businessParams: {
  244. // 根据具体交易类型填写对应参数
  245. // 例如登记时需要填写:psn_no、visit_type、dept_code等
  246. // 例如结算时需要填写:visit_no、fee_details等
  247. }
  248. },
  249. health: {
  250. action: "health"
  251. },
  252. stats: {
  253. action: "stats"
  254. }
  255. };
  256. // 加载初始化参数
  257. function loadInitParams() {
  258. inputArea.value = JSON.stringify(defaultParams.init, null, 2);
  259. updateStatus('已加载初始化参数 - 配置医院信息和系统环境');
  260. updateCurrentFunction('系统初始化');
  261. }
  262. // 加载签到参数
  263. function loadSignInParams() {
  264. inputArea.value = JSON.stringify(defaultParams.SignIn, null, 2);
  265. updateStatus('已加载签到参数 - 操作员登录工伤系统');
  266. updateCurrentFunction('操作员签到');
  267. }
  268. // 加载签退参数
  269. function loadSignOutParams() {
  270. inputArea.value = JSON.stringify(defaultParams.signout, null, 2);
  271. updateStatus('已加载签退参数 - 操作员退出工伤系统');
  272. updateCurrentFunction('操作员签退');
  273. }
  274. // 加载业务交易参数
  275. function loadBusinessParams() {
  276. const businessExamples = [
  277. {
  278. name: "读卡",
  279. params: {
  280. action: "transaction",
  281. transactionName: "读卡",
  282. identifyMode: "1",
  283. operatorId: "001",
  284. operatorName: "收费员张三"
  285. }
  286. },
  287. {
  288. name: "患者登记",
  289. params: {
  290. action: "transaction",
  291. transactionName: "RegisterPatient",
  292. businessParams: {
  293. psn_no: "32010219800101001X",
  294. visit_type: "1",
  295. dept_code: "001",
  296. dept_name: "骨科",
  297. doctor_code: "DOC001",
  298. doctor_name: "张主任",
  299. diag_code: "M79.900",
  300. diag_name: "骨折",
  301. visit_time: "2024-12-01 10:30:00"
  302. },
  303. identifyMode: "1"
  304. }
  305. },
  306. {
  307. name: "费用预结算",
  308. params: {
  309. action: "transaction",
  310. transactionName: "PreSettle",
  311. businessParams: {
  312. visit_no: "V20241201001",
  313. fee_details: [
  314. {
  315. fee_ocur_time: "2024-12-01 10:30:00",
  316. med_list_codg: "001",
  317. med_list_name: "X光片检查",
  318. med_chrgitm_type: "4",
  319. fee_amt: 120.00,
  320. cnt: 1,
  321. pric: 120.00,
  322. spec: "胸部X光",
  323. dept_code: "001",
  324. dept_name: "骨科"
  325. }
  326. ]
  327. }
  328. }
  329. },
  330. {
  331. name: "正式结算",
  332. params: {
  333. action: "transaction",
  334. transactionName: "Settle",
  335. businessParams: {
  336. visit_no: "V20241201001",
  337. pre_settle_id: "PS20241201001"
  338. }
  339. }
  340. }
  341. ];
  342. // 显示业务交易选择提示
  343. const selected = prompt(
  344. "请选择业务交易类型:\n" +
  345. "1. 读卡\n" +
  346. "2. 患者登记\n" +
  347. "3. 费用预结算\n" +
  348. "4. 正式结算\n\n" +
  349. "请输入数字 (1-4):"
  350. );
  351. const index = parseInt(selected) - 1;
  352. if (index >= 0 && index < businessExamples.length) {
  353. inputArea.value = JSON.stringify(businessExamples[index].params, null, 2);
  354. updateStatus(`已加载业务参数 - ${businessExamples[index].name}`);
  355. updateCurrentFunction(`业务交易 - ${businessExamples[index].name}`);
  356. } else {
  357. inputArea.value = JSON.stringify(defaultParams.business, null, 2);
  358. updateStatus('已加载默认业务参数 - 读卡');
  359. updateCurrentFunction('业务交易 - 读卡');
  360. }
  361. }
  362. // 加载健康检查参数
  363. function loadHealthCheckParams() {
  364. inputArea.value = JSON.stringify(defaultParams.health, null, 2);
  365. updateStatus('已加载健康检查参数 - 系统状态诊断');
  366. updateCurrentFunction('系统健康检查');
  367. }
  368. // 加载统计信息参数
  369. function loadStatsParams() {
  370. inputArea.value = JSON.stringify(defaultParams.stats, null, 2);
  371. updateStatus('已加载统计信息参数 - 查看系统运行数据');
  372. updateCurrentFunction('系统统计信息');
  373. }
  374. // 清空所有内容
  375. function clearAll() {
  376. inputArea.value = '';
  377. outputArea.value = '';
  378. updateStatus('已清空所有内容');
  379. updateCurrentFunction('未选择');
  380. }
  381. // 重置为默认参数
  382. function resetToDefault() {
  383. loadInitParams();
  384. outputArea.value = '';
  385. updateStatus('已重置为默认初始化参数');
  386. // loadInitParams()中已包含updateCurrentFunction调用
  387. }
  388. // 更新状态信息
  389. function updateStatus(message, isError = false) {
  390. statusMsg.textContent = message;
  391. statusMsg.className = isError ? 'error-msg' : 'success-msg';
  392. // 3秒后恢复默认状态
  393. setTimeout(() => {
  394. statusMsg.textContent = '就绪 - 请选择功能并配置参数';
  395. statusMsg.className = '';
  396. }, 3000);
  397. }
  398. // 更新当前功能显示
  399. function updateCurrentFunction(functionName) {
  400. const currentFunctionSpan = document.getElementById('currentFunction');
  401. currentFunctionSpan.textContent = `当前功能:${functionName}`;
  402. }
  403. // 调用接口(当前只是模拟,需要连接实际接口)
  404. async function callWorkInjuryAPI() {
  405. console.log("11111111111111111111111111111111")
  406. try {
  407. const inputText = inputArea.value.trim();
  408. console.log("inputText111111111111111111111111",inputText)
  409. if (!inputText) {
  410. updateStatus('请先输入参数', true);
  411. return;
  412. }
  413. const params = JSON.parse(inputText);
  414. updateStatus('正在调用接口...');
  415. const response = await fetch('http://localhost:8321/api/entry/workinjury', {
  416. method: 'POST',
  417. headers: {
  418. 'Content-Type': 'application/json'
  419. },
  420. body: JSON.stringify(params)
  421. });
  422. console.log("response111111111111111",response)
  423. const result = await response.json();
  424. outputArea.value = JSON.stringify(result, null, 2);
  425. if (result.success) {
  426. updateStatus('接口调用成功');
  427. } else {
  428. updateStatus(`接口调用失败: ${result.message}`, true);
  429. }
  430. } catch (error) {
  431. console.log("22222222222222222222222")
  432. outputArea.value = JSON.stringify({
  433. success: false,
  434. error: error.message,
  435. timestamp: new Date().toISOString()
  436. }, null, 2);
  437. updateStatus(`调用异常: ${error.message}`, true);
  438. }
  439. }
  440. // 双击入参区域调用接口
  441. inputArea.addEventListener('dblclick', callWorkInjuryAPI);
  442. // 添加键盘快捷键支持
  443. document.addEventListener('keydown', function(e) {
  444. if (e.ctrlKey) {
  445. switch(e.key) {
  446. case '1': loadInitParams(); e.preventDefault(); break;
  447. case '2': loadSignInParams(); e.preventDefault(); break;
  448. case '3': loadSignOutParams(); e.preventDefault(); break;
  449. case '4': loadBusinessParams(); e.preventDefault(); break;
  450. case 'Enter': callWorkInjuryAPI(); e.preventDefault(); break;
  451. case 'Delete': clearAll(); e.preventDefault(); break;
  452. case 'r': resetToDefault(); e.preventDefault(); break;
  453. }
  454. }
  455. });
  456. // 显示参数示例
  457. function showParamExamples() {
  458. const examples = `
  459. 📋 工伤联网接口参数示例大全
  460. 🔧 1. 系统初始化
  461. {
  462. "action": "init",
  463. "config": {
  464. "fixmedinsCode": "SQ201348", // 医院编号(必填)
  465. "fixmedinsName": "沭阳铭和医院", // 医院名称(必填)
  466. "receiverSysCode": "JSYTH", // 固定值
  467. "interfaceVersion": "V2.1", // 固定值
  468. "operatorType": "1", // 1-人工 2-自助
  469. "defaultOperator": "001", // 操作员编号
  470. "defaultOperatorName": "收费员张三" // 操作员姓名
  471. }
  472. }
  473. 👤 2. 操作员签到
  474. {
  475. "action": "transaction",
  476. "transactionName": "SignIn",
  477. "identifyMode": "1", // 识别方式(保持一致性)
  478. "operatorId": "001", // 当前操作员编号
  479. "operatorName": "收费员张三", // 当前操作员姓名
  480. "businessParams": {} // 空的业务参数对象(必需)
  481. }
  482. 🏥 3. 工伤患者读卡
  483. {
  484. "action": "transaction",
  485. "transactionName": "读卡",
  486. "identifyMode": "1", // 1-实体卡 2-电子凭证
  487. "operatorId": "001",
  488. "operatorName": "收费员张三"
  489. }
  490. 📝 4. 患者登记
  491. {
  492. "action": "transaction",
  493. "transactionName": "RegisterPatient",
  494. "businessParams": {
  495. "psn_no": "32010219800101001X", // 身份证号(必填)
  496. "visit_type": "1", // 1-门诊 2-住院
  497. "dept_code": "001", // 科室编码
  498. "dept_name": "骨科", // 科室名称
  499. "doctor_code": "DOC001", // 医生编码
  500. "doctor_name": "张主任", // 医生姓名
  501. "diag_code": "M79.900", // 诊断代码
  502. "diag_name": "骨折" // 诊断名称
  503. },
  504. "identifyMode": "1"
  505. }
  506. 💰 5. 费用预结算
  507. {
  508. "action": "transaction",
  509. "transactionName": "PreSettle",
  510. "businessParams": {
  511. "visit_no": "V20241201001", // 就诊号(来自登记结果)
  512. "fee_details": [ // 费用明细数组
  513. {
  514. "fee_ocur_time": "2024-12-01 10:30:00",
  515. "med_list_codg": "001", // 项目编码
  516. "med_list_name": "X光检查", // 项目名称
  517. "med_chrgitm_type": "4", // 1-药品 2-诊疗 4-检查
  518. "fee_amt": 120.00, // 总金额
  519. "cnt": 1, // 数量
  520. "pric": 120.00, // 单价
  521. "spec": "胸部X光", // 规格
  522. "dept_code": "001", // 科室编码
  523. "dept_name": "骨科" // 科室名称
  524. }
  525. ]
  526. }
  527. }
  528. 💳 6. 正式结算
  529. {
  530. "action": "transaction",
  531. "transactionName": "Settle",
  532. "businessParams": {
  533. "visit_no": "V20241201001", // 就诊号
  534. "pre_settle_id": "PS20241201001" // 预结算ID(来自预结算结果)
  535. }
  536. }
  537. 📊 7. 健康检查
  538. {
  539. "action": "health"
  540. }
  541. 📈 8. 统计信息
  542. {
  543. "action": "stats"
  544. }
  545. ⚠️ 重要提示:
  546. • 患者身份证号、就诊号、预结算ID等关键参数必须使用真实有效的值
  547. • 医院编号和名称必须与江苏人社备案信息一致
  548. • 操作员信息建议使用当前登录用户的真实信息
  549. • 费用明细中的医疗目录编码需要符合当地医保目录规范
  550. `;
  551. alert(examples);
  552. }
  553. // 页面加载时显示欢迎信息
  554. window.onload = function() {
  555. updateStatus('工伤联网接口测试工具已就绪');
  556. // 默认加载初始化参数
  557. setTimeout(() => {
  558. loadInitParams();
  559. }, 1000);
  560. };
  561. </script>
  562. </body>
  563. </html>