因线上退款医保金额,需要获取患者ectoken作为凭证,自己做了一个测试程序调用医保DLL获取患者ectokne。
下面展示一些 代码片
。
[DllImport("NationECCode.dll", CallingConvention = CallingConvention.StdCall)]
static extern string NationEcTrans(string strUrl, string InData, IntPtr outPut);
private void button1_Click(object sender, EventArgs e)
{
IntPtr outPut = System.Runtime.InteropServices.Marshal.AllocHGlobal(2048);
string res = NationEcTrans("https://igb.hsa.gdgov.cn/prd_nation_eccode/prd_eccode/localcfc/api/hsecfc/localQrCodeQuery", sendJson(), outPut);
string retStr = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(outPut);
JObject result = JsonConvert.DeserializeObject<JObject>(retStr);
string ecToken = result["data"]["ecToken"].ToString();
textBox4.Text = ecToken;
}
运行调出界面
获取token成功