医保电子凭证在项目中的集成应用

2023-12-14 12:12

本文主要是介绍医保电子凭证在项目中的集成应用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

随着医保电子凭证使用普及,医疗行业的各个场景都要求支持医保码一码通办,在此分享一下,在C#和js中集成医保电子凭证的demo 供有需要的小伙伴参考。

一、项目效果图

  • 在c#中集成医保电子凭证效果
    在这里插入图片描述
  • 在js中集成医保电子凭证效果

在这里插入图片描述

二、主要代码

  • c#集成医保电子凭证主要代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;namespace 医保电子凭证sdk
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void btn核验_Click(object sender, EventArgs e){try {               StringBuilder outData = new StringBuilder(4000);string str = "";string inData = "{\"data\":{\"businessType\":\"01101\",\"officeId\":\"32760\",\"officeName\":\"消化内科\",\"operatorId\":\"test001\",\"operatorName\":\"超级管理员\",\"orgId\":\"H34110200888\"},\"orgId\":\"H34110200888\",\"transType\":\"ec.query\"}";string surl = "http://10.66.159.55:8080/localcfc/api/hsecfc/localQrCodeQuery";str = DecodeTip(surl, inData, outData);string rs = str;txt出参.Text = rs;}catch (Exception ex){MessageBox.Show(ex.Message);}}private void Form1_Load(object sender, EventArgs e){}[DllImport("NationECCode.dll")]private static extern string NationEcTrans(string strUrl, string InData, StringBuilder outData);private string DecodeTip(string surl, string inData, StringBuilder outData){try{string str = "";str = NationEcTrans(surl, inData, outData);string rs = outData.ToString();// int i = 10;return rs;}catch (Exception ex){return ex.Message;}}}
}
  • javascript集成医保电子凭证主要代码
 <html><head id="Head1"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style type="text/css">.form-table{line-height: 40px;}.form-table input{padding: 6px 8px;border-radius: 4px;border: 1px solid #aaa;}textarea{width: 800px;border: 1px solid #ccc;border-radius: 4px;}</style><title>国家电子凭证库测试 </title><script type="text/javascript">var DUmsocx1;var ws;var flag=0;function ToggleConnectionClicked() {          try {/*//检测当前浏览器是否支持websocket模式window.WebSocket = window.WebSocket || window.MozWebSocket;if (!window.WebSocket){alert("WebSocket not supported by this browser");return;}*/ws = new WebSocket("ws://127.0.0.1:8899");//连接服务器	ws.onopen = function(event){alert("已经与服务器建立了连接\r\n当前连接状态:"+this.readyState);flag=1;ws.send(DUmsocx1);//SendData(DUmsocx1);	};ws.onmessage = function(event){//alert("接收到服务器发送的数据:\r\n"+event.data);document.getElementById('respdata').value = event.data;flag=1;};ws.onclose = function(event){alert("已经与服务器断开连接\r\n当前连接状态:"+this.readyState);};ws.onerror = function(event){if (flag!=1)alert("WebSocket接收异常!");};} catch (ex) {alert(ex.message);      }};function SendData(str) {try{ws.send(str);}catch(ex){alert(ex.message);}};function SocektClose() {try{ws.close();}catch(ex){alert(ex.message);}};function seestate(){alert("当前连接状:"+ws.readyState);}function getResult_hs() {var url_val = document.getElementById("input-text-url").value;var aaa = {};aaa.url = url_val;aaa.indata = {"data":{"businessType":"01101","gainWay":"ALL","idNo":"","infoFrom":"","officeId":"32760","officeName":"消化内科","operatorId":"test001","operatorName":"超级管理员","orgId":"35020319001","outBizNo":"202102231332361130F1","userName":""},"orgId":"35020319001","transType":"iot.gain.ec.qrcode"};aaa = JSON.stringify(aaa);document.getElementById('result').value = aaa;};function getResult_jgtz() {var url_val = document.getElementById("input-text-url").value;var aaa = {};aaa.url = url_val;aaa.indata = {"data":{"bizNo":"20210223135202090EFB","bizType":"register","discountFee":"0","ecQrCode":"","medicalFee":"164","medicalSettleNo":"YB20200228","medicalSettleState":"SUCCESS","operatorId":"test001","operatorName":"超级管理员","outBizNo":"20210223135202090EFB","selfFee":"52","totalFee":"216"},"orgId":"35020319001","transType":"iot.medical.settle.notify"};aaa = JSON.stringify(aaa);document.getElementById('result').value = aaa;};function getResult_smd() {var url_val = document.getElementById("input-text-url").value;var aaa = {};aaa.url = url_val;aaa.indata = {"data":{"businessType":"01101","deviceType":"","officeId":"32760","officeName":"消化内科","operatorId":"test001","operatorName":"超级管理员","orgId":"35020319001"},"orgId":"35020319001","transType":"ec.query"};aaa = JSON.stringify(aaa);document.getElementById('result').value = aaa;};function qingqiu(){	document.getElementById('respdata').value = "";DUmsocx1= document.getElementById('result').value;//alert(DUmsocx1);ToggleConnectionClicked();	}function qingqiu1(){	document.getElementById('respdata').value = "";DUmsocx1= document.getElementById('result').value;//alert(DUmsocx1);ws.send(DUmsocx1);}</script></head>		<body onload=""><h1>国家电子凭证库测试程序</h1><div ><p>URL:</p><input id='input-text-url' style="width:500px" type='text' value="https://此处替换成中台地址/localcfc/api/hsecfc/localQrCodeQuery"/></div><div ><p></p><button onclick="getResult_hs();" id="btn_hs"> 核身 </button></div><div ><p></p><button onclick="getResult_jgtz();" id="btn_jgtz"> 结果通知 </button></div><div ><p></p><button onclick="getResult_smd();" id="btn_smd"> 扫码墩 </button></div><div ><p>入参:</p><textarea id='result' style="width:1000px" rows="7"></textarea></div><div ><p>出参:</p><textarea id='respdata' style="width:1000px" rows="7"></textarea></div><table cellpadding="20" cellspacing="0"><td><button onclick="qingqiu();">请求</button></td><td><button onclick="qingqiu1();">请求1</button></td></table></body>
</html>

三、资料下载

医保电子凭证集成demo
链接:https://pan.baidu.com/s/1aUCWSxOJmKhZJRkXUd1Y6A
提取码:lxq0

这篇关于医保电子凭证在项目中的集成应用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/492476

相关文章

PostgreSQL的扩展dict_int应用案例解析

《PostgreSQL的扩展dict_int应用案例解析》dict_int扩展为PostgreSQL提供了专业的整数文本处理能力,特别适合需要精确处理数字内容的搜索场景,本文给大家介绍PostgreS... 目录PostgreSQL的扩展dict_int一、扩展概述二、核心功能三、安装与启用四、字典配置方法

深度解析Java项目中包和包之间的联系

《深度解析Java项目中包和包之间的联系》文章浏览阅读850次,点赞13次,收藏8次。本文详细介绍了Java分层架构中的几个关键包:DTO、Controller、Service和Mapper。_jav... 目录前言一、各大包1.DTO1.1、DTO的核心用途1.2. DTO与实体类(Entity)的区别1

Python中re模块结合正则表达式的实际应用案例

《Python中re模块结合正则表达式的实际应用案例》Python中的re模块是用于处理正则表达式的强大工具,正则表达式是一种用来匹配字符串的模式,它可以在文本中搜索和匹配特定的字符串模式,这篇文章主... 目录前言re模块常用函数一、查看文本中是否包含 A 或 B 字符串二、替换多个关键词为统一格式三、提

Java MQTT实战应用

《JavaMQTT实战应用》本文详解MQTT协议,涵盖其发布/订阅机制、低功耗高效特性、三种服务质量等级(QoS0/1/2),以及客户端、代理、主题的核心概念,最后提供Linux部署教程、Sprin... 目录一、MQTT协议二、MQTT优点三、三种服务质量等级四、客户端、代理、主题1. 客户端(Clien

在Spring Boot中集成RabbitMQ的实战记录

《在SpringBoot中集成RabbitMQ的实战记录》本文介绍SpringBoot集成RabbitMQ的步骤,涵盖配置连接、消息发送与接收,并对比两种定义Exchange与队列的方式:手动声明(... 目录前言准备工作1. 安装 RabbitMQ2. 消息发送者(Producer)配置1. 创建 Spr

如何在Spring Boot项目中集成MQTT协议

《如何在SpringBoot项目中集成MQTT协议》本文介绍在SpringBoot中集成MQTT的步骤,包括安装Broker、添加EclipsePaho依赖、配置连接参数、实现消息发布订阅、测试接口... 目录1. 准备工作2. 引入依赖3. 配置MQTT连接4. 创建MQTT配置类5. 实现消息发布与订阅

springboot项目打jar制作成镜像并指定配置文件位置方式

《springboot项目打jar制作成镜像并指定配置文件位置方式》:本文主要介绍springboot项目打jar制作成镜像并指定配置文件位置方式,具有很好的参考价值,希望对大家有所帮助,如有错误... 目录一、上传jar到服务器二、编写dockerfile三、新建对应配置文件所存放的数据卷目录四、将配置文

SpringBoot集成LiteFlow工作流引擎的完整指南

《SpringBoot集成LiteFlow工作流引擎的完整指南》LiteFlow作为一款国产轻量级规则引擎/流程引擎,以其零学习成本、高可扩展性和极致性能成为微服务架构下的理想选择,本文将详细讲解Sp... 目录一、LiteFlow核心优势二、SpringBoot集成实战三、高级特性应用1. 异步并行执行2

怎么用idea创建一个SpringBoot项目

《怎么用idea创建一个SpringBoot项目》本文介绍了在IDEA中创建SpringBoot项目的步骤,包括环境准备(JDK1.8+、Maven3.2.5+)、使用SpringInitializr... 目录如何在idea中创建一个SpringBoot项目环境准备1.1打开IDEA,点击New新建一个项

CSS中的Static、Relative、Absolute、Fixed、Sticky的应用与详细对比

《CSS中的Static、Relative、Absolute、Fixed、Sticky的应用与详细对比》CSS中的position属性用于控制元素的定位方式,不同的定位方式会影响元素在页面中的布... css 中的 position 属性用于控制元素的定位方式,不同的定位方式会影响元素在页面中的布局和层叠关