test_jiangsu_ec_decode.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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: 20px;
  11. background-color: #f5f5f5;
  12. }
  13. .container {
  14. max-width: 1200px;
  15. margin: 0 auto;
  16. background: white;
  17. padding: 20px;
  18. border-radius: 8px;
  19. box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  20. }
  21. .title {
  22. color: #2c3e50;
  23. border-bottom: 3px solid #3498db;
  24. padding-bottom: 10px;
  25. margin-bottom: 20px;
  26. }
  27. .test-section {
  28. margin: 20px 0;
  29. padding: 15px;
  30. border: 1px solid #ddd;
  31. border-radius: 5px;
  32. background: #fafafa;
  33. }
  34. .button {
  35. background: #3498db;
  36. color: white;
  37. border: none;
  38. padding: 10px 20px;
  39. border-radius: 4px;
  40. cursor: pointer;
  41. margin: 5px;
  42. }
  43. .button:hover {
  44. background: #2980b9;
  45. }
  46. .success { background: #27ae60; }
  47. .warning { background: #f39c12; }
  48. .danger { background: #e74c3c; }
  49. .result {
  50. margin: 10px 0;
  51. padding: 10px;
  52. border-radius: 4px;
  53. white-space: pre-wrap;
  54. max-height: 400px;
  55. overflow-y: auto;
  56. }
  57. .result.success {
  58. background: #d4edda;
  59. border: 1px solid #c3e6cb;
  60. color: #155724;
  61. }
  62. .result.error {
  63. background: #f8d7da;
  64. border: 1px solid #f5c6cb;
  65. color: #721c24;
  66. }
  67. .result.info {
  68. background: #d1ecf1;
  69. border: 1px solid #bee5eb;
  70. color: #0c5460;
  71. }
  72. .business-types {
  73. display: grid;
  74. grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  75. gap: 10px;
  76. margin: 15px 0;
  77. }
  78. .business-type {
  79. padding: 8px;
  80. border: 1px solid #ddd;
  81. border-radius: 4px;
  82. background: white;
  83. cursor: pointer;
  84. text-align: center;
  85. }
  86. .business-type:hover {
  87. background: #e3f2fd;
  88. border-color: #3498db;
  89. }
  90. .url-example {
  91. background: #f8f9fa;
  92. border: 1px solid #e9ecef;
  93. border-radius: 4px;
  94. padding: 10px;
  95. margin: 10px 0;
  96. font-family: 'Courier New', monospace;
  97. font-size: 14px;
  98. }
  99. </style>
  100. </head>
  101. <body>
  102. <div class="container">
  103. <h1 class="title">🏥 江苏医保电子凭证解码功能测试</h1>
  104. <div class="test-section">
  105. <h3>📋 功能说明</h3>
  106. <p>本页面用于测试江苏医保电子凭证解码功能,基于《医疗保障信息平台定点基线版医药机构接口规范 v0.9.9.15》中的1.14.6电子凭证解码接口实现。</p>
  107. <h4>🔗 调用接口格式:</h4>
  108. <div class="url-example">
  109. <!-- 独立接口方式 -->
  110. <strong>独立接口:</strong><br>
  111. http://localhost:8321/api/entry?param=jiangsu_qrcode_[业务类型]<br><br>
  112. <!-- 江苏医保子功能方式 -->
  113. <strong>子功能方式:</strong><br>
  114. http://localhost:8321/api/entry?param=jiangsu_qrcode_[业务类型]<br>
  115. http://localhost:8321/api/entry?param=jiangsu_ec_[业务类型]
  116. </div>
  117. </div>
  118. <div class="test-section">
  119. <h3>🎯 业务类型选择</h3>
  120. <p>请选择要测试的业务场景:</p>
  121. <div class="business-types">
  122. <div class="business-type" onclick="testEcDecode('01101')">
  123. <strong>01101</strong><br>门诊挂号
  124. </div>
  125. <div class="business-type" onclick="testEcDecode('01201')">
  126. <strong>01201</strong><br>门诊问诊
  127. </div>
  128. <div class="business-type" onclick="testEcDecode('01301')">
  129. <strong>01301</strong><br>门诊结算
  130. </div>
  131. <div class="business-type" onclick="testEcDecode('01302')">
  132. <strong>01302</strong><br>取药
  133. </div>
  134. <div class="business-type" onclick="testEcDecode('01102')">
  135. <strong>01102</strong><br>住院建档
  136. </div>
  137. <div class="business-type" onclick="testEcDecode('02121')">
  138. <strong>02121</strong><br>药店购药
  139. </div>
  140. </div>
  141. </div>
  142. <div class="test-section">
  143. <h3>⚡ 快速测试</h3>
  144. <button class="button" onclick="testEcDecode('01101')">测试门诊挂号 (01101)</button>
  145. <button class="button warning" onclick="testEcDecode('01301')">测试门诊结算 (01301)</button>
  146. <button class="button success" onclick="testEcDecode('02121')">测试药店购药 (02121)</button>
  147. <button class="button danger" onclick="testInvalidBusinessType()">测试无效业务类型</button>
  148. </div>
  149. <div class="test-section">
  150. <h3>🔧 系统测试</h3>
  151. <button class="button" onclick="testJiangsuInit()">测试江苏医保初始化</button>
  152. <button class="button" onclick="testJiangsuStatus()">检查江苏医保状态</button>
  153. <button class="button" onclick="testDllExists()">检查DLL文件</button>
  154. </div>
  155. <div class="test-section">
  156. <h3>📊 测试结果</h3>
  157. <div id="result" class="result info">
  158. 等待测试...
  159. </div>
  160. </div>
  161. </div>
  162. <script>
  163. const resultDiv = document.getElementById('result');
  164. const baseUrl = 'http://localhost:8321/api/entry';
  165. function showResult(title, data, isSuccess = true) {
  166. const timestamp = new Date().toLocaleString();
  167. const className = isSuccess ? 'success' : 'error';
  168. resultDiv.className = `result ${className}`;
  169. resultDiv.textContent = `[${timestamp}] ${title}\n\n${JSON.stringify(data, null, 2)}`;
  170. }
  171. function showLoading(message) {
  172. resultDiv.className = 'result info';
  173. resultDiv.textContent = `⏳ ${message}...`;
  174. }
  175. // 测试江苏医保电子凭证解码
  176. async function testEcDecode(businessType) {
  177. const url = `${baseUrl}?param=jiangsu_qrcode_${businessType}`;
  178. showLoading(`正在测试江苏医保电子凭证解码 (业务类型: ${businessType})`);
  179. try {
  180. const response = await fetch(url);
  181. const data = await response.json();
  182. const isSuccess = data.code === 200 && data.success !== false;
  183. const title = `江苏医保电子凭证解码测试 - 业务类型: ${businessType}`;
  184. showResult(title, data, isSuccess);
  185. // 显示详细的业务信息
  186. if (data.businessType) {
  187. console.log(`业务类型: ${data.businessType}`);
  188. }
  189. if (data.interfaceVersion) {
  190. console.log(`接口版本: ${data.interfaceVersion}`);
  191. }
  192. } catch (error) {
  193. showResult(`江苏医保电子凭证解码测试失败 - 业务类型: ${businessType}`, {
  194. error: error.message,
  195. url: url
  196. }, false);
  197. }
  198. }
  199. // 测试无效业务类型
  200. async function testInvalidBusinessType() {
  201. const invalidType = '99999'; // 无效的业务类型
  202. const url = `${baseUrl}?param=jiangsu_qrcode_${invalidType}`;
  203. showLoading('正在测试无效业务类型处理');
  204. try {
  205. const response = await fetch(url);
  206. const data = await response.json();
  207. const title = `无效业务类型测试 - ${invalidType}`;
  208. const isSuccess = data.code !== 200; // 期望失败
  209. showResult(title, data, isSuccess);
  210. } catch (error) {
  211. showResult('无效业务类型测试异常', {
  212. error: error.message,
  213. url: url
  214. }, false);
  215. }
  216. }
  217. // 测试江苏医保初始化
  218. async function testJiangsuInit() {
  219. const url = `${baseUrl}?param=jiangsu_init`;
  220. showLoading('正在测试江苏医保系统初始化');
  221. try {
  222. const response = await fetch(url);
  223. const data = await response.json();
  224. const isSuccess = data.success === true && data.code === 200;
  225. showResult('江苏医保系统初始化测试', data, isSuccess);
  226. } catch (error) {
  227. showResult('江苏医保初始化测试失败', {
  228. error: error.message,
  229. url: url
  230. }, false);
  231. }
  232. }
  233. // 测试江苏医保状态
  234. async function testJiangsuStatus() {
  235. const url = `${baseUrl}?param=jiangsu_status`;
  236. showLoading('正在检查江苏医保系统状态');
  237. try {
  238. const response = await fetch(url);
  239. const data = await response.json();
  240. const isSuccess = data.success === true;
  241. showResult('江苏医保系统状态检查', data, isSuccess);
  242. } catch (error) {
  243. showResult('江苏医保状态检查失败', {
  244. error: error.message,
  245. url: url
  246. }, false);
  247. }
  248. }
  249. // 测试DLL文件存在性
  250. async function testDllExists() {
  251. const url = `${baseUrl}?param=jiangsu_checkdll`;
  252. showLoading('正在检查江苏医保DLL文件');
  253. try {
  254. const response = await fetch(url);
  255. const data = await response.json();
  256. const isSuccess = data.success === true;
  257. showResult('江苏医保DLL文件检查', data, isSuccess);
  258. } catch (error) {
  259. showResult('DLL文件检查失败', {
  260. error: error.message,
  261. url: url
  262. }, false);
  263. }
  264. }
  265. // 页面加载时显示欢迎信息
  266. window.onload = function() {
  267. showResult('江苏医保电子凭证解码测试页面', {
  268. 功能说明: '基于江苏医保接口规范v0.9.9.15实现的1.14.6电子凭证解码功能',
  269. 支持的业务类型: [
  270. '01101 - 门诊挂号',
  271. '01201 - 门诊问诊',
  272. '01301 - 门诊结算',
  273. '01302 - 取药',
  274. '01102 - 住院建档',
  275. '02121 - 药店购药'
  276. ],
  277. 接口格式: 'http://localhost:8321/api/entry?param=jiangsu_qrcode_[业务类型]',
  278. 准备状态: '就绪,请选择测试功能'
  279. }, true);
  280. };
  281. </script>
  282. </body>
  283. </html>