Explorar o código

医保电子凭证人脸识别设备接口开发

837390164@qq.com hai 1 ano
pai
achega
eb9719e92d
Modificáronse 4 ficheiros con 109 adicións e 68 borrados
  1. 97 58
      Business/HisMainBusiness.cs
  2. 9 8
      Forms/ChooseCard.cs
  3. 2 2
      Forms/ChooseCard.designer.cs
  4. 1 0
      Variables/Struct.cs

+ 97 - 58
Business/HisMainBusiness.cs

@@ -235,7 +235,7 @@ namespace PTMedicalInsurance.Business
                         Global.pat.certType = "01";
                         Random rd = new Random();
                         int iNum = rd.Next();
-                        string sLSH = DateTime.Now.ToString("YYYYMMDDHHNNSS") + Global.inf.hospitalNO + iNum.ToString().Substring(0, 5);
+                        string sLSH = DateTime.Now.ToString("yyyyMMddHHmmss") + Global.inf.hospitalNO + iNum.ToString().Substring(0, 5);
 
                         joCardInfo.Add("operatorId", Global.user.ID);
                         joCardInfo.Add("operatorName", Global.user.name);
@@ -244,74 +244,104 @@ namespace PTMedicalInsurance.Business
                         joCardInfo.Add("orgId", Global.inf.hospitalNO);
                         joCardInfo.Add("businessType", cc.sL_CertCodeType);
 
-                        //认证方式
-                        //二维码
-                        if (cc.EcCertDecodeType == "0")
-                        {
-                            joCardInfo.Add("deviceType", cc.sL_CertCodeType);
-                        }
-                        //电子凭证
-                        else if (cc.EcCertDecodeType == "1")
+                        //认证方式                        
+                        if (cc.EcCertDecodeType == "2") //刷脸、先授权后解码 
                         {
+                            //1.调用人脸识别认证 cn.nhsa.ec.auth
                             joCardInfo.Add("outBizNo", sLSH);
                             joCardInfo.Add("extData", "");
-                        }
-                        //刷脸、先授权后解码
-                        else if (cc.EcCertDecodeType == "2") //刷脸 
-                        {
-                            JObject JoGetAuthInfo = new JObject();
-                            JoGetAuthInfo.Add("outBizNo", sLSH);
-                            JoGetAuthInfo.Add("extData", "");
-                            JObject JoInputAuth = new JObject();
-                            JoInputAuth.Add("orgId", Global.inf.hospitalNO);
-                            JoInputAuth.Add("transType", "cn.nhsa.ec.auth");
-                            JoInputAuth.Add("data", JoGetAuthInfo);
-                            JoInputAuth.Add("extra", "");
+
+                            JObject JoEcAuth = new JObject();
+                            JoEcAuth.Add("orgId", Global.inf.hospitalNO);
+                            JoEcAuth.Add("transType", "cn.nhsa.ec.auth");
+                            JoEcAuth.Add("data", joCardInfo);
+                            JoEcAuth.Add("extra", "");
 
                             //调用刷脸认证接口cn.nhsa.ec.auth返回授权信息authNo
-                            CardRead.NationEcTrans(Global.inf.ecURL, JoInputAuth.ToString(), out sOutPar);
+                            CardRead.NationEcTrans(Global.inf.ecURL, JoEcAuth.ToString(), out sOutPar);
                             if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
                             {
-                                outParam = "调用刷脸认证接口cn.nhsa.ec.auth失败:" + sOutPar;
+                                outParam = "调用刷脸认证接口cn.nhsa.ec.auth认证失败:" + sOutPar;
                                 return -1;
                             }
-
-                            //成功返回授权信息
-                            string auth = sOutPar;                            
-
-                            JObject JoAuthOut = new JObject();
-                            JoAuthOut.Add("outBizNo", DateTime.Now.ToString("YYYYMMDDHHNNSS") + Global.inf.hospitalNO + iNum.ToString().Substring(0, 5));
-                            JoAuthOut.Add("authNo", auth);
-                            JoAuthOut.Add("extData", "");
-
-                            joCardInfo = (JObject)JoAuthOut.DeepClone();
+                            else
+                            {
+                                //成功返回授权信息
+                                string auth = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.authNo");
+                                JObject JoAuthCheckInput = new JObject();
+                                JoAuthCheckInput.Add("orgId", Global.inf.hospitalNO);
+                                JoAuthCheckInput.Add("outBizNo", DateTime.Now.ToString("yyyyMMddHHmmss") + Global.inf.hospitalNO + iNum.ToString().Substring(0, 5));
+                                JoAuthCheckInput.Add("authNo", auth);
+                                JoAuthCheckInput.Add("businessType", cc.sL_CertCodeType);
+                                JoAuthCheckInput.Add("operatorId", Global.user.ID);
+                                JoAuthCheckInput.Add("operatorName", Global.user.name);
+                                JoAuthCheckInput.Add("officeId", Global.user.officeID);
+                                JoAuthCheckInput.Add("officeName", Global.user.officeName);
+                                JoAuthCheckInput.Add("extData", "");                      
+
+                                JObject JoAuthChck = new JObject();
+                                JoAuthChck.Add("orgId", Global.inf.hospitalNO);
+                                JoAuthChck.Add("transType", "cn.nhsa.auth.check");
+                                JoAuthChck.Add("data", JoAuthCheckInput);
+                                JoAuthChck.Add("extra", "");
+
+                                //2.调用刷脸认证接口cn.nhsa.ec.auth返回授权信息authNo
+                                CardRead.NationEcTrans(Global.inf.ecURL, JoAuthChck.ToString(), out sOutPar);
+                                if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
+                                {
+                                    outParam = "调用刷脸授权获取医保身份接口cn.nhsa.auth.check失败:" + sOutPar;
+                                    return -1;
+                                }
+                                else
+                                {
+                                    Global.pat.ecToken = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.ecToken");
+                                    Global.pat.name = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.userName");
+                                    Global.pat.IDType = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idType");
+                                    Global.pat.IDNO = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idNo");
+                                    Global.pat.insuplc_admdvs = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.insuOrg");
+                                    Global.pat.mdtrtcertNO = Global.pat.ecToken;
+                                    Global.pat.certType = Global.pat.IDType;
+                                    Global.pat.certNO = Global.pat.IDNO;
+                                }
+                            }
                         }
-
-                        //调用电子凭证动态库NationECCode.dll获取身份信息                        
-                        JObject JoInput = new JObject();
-                        JoInput.Add("orgId", Global.inf.hospitalNO);
-                        JoInput.Add("transType",cc.sL_EcCertDecodeTradeNO);
-                        JoInput.Add("data", joCardInfo);
-                        JoInput.Add("extra", "");
-
-                        //MessageBox.Show("电子凭证解码地址:" + Global.inf.ecURL + ",入参:" + JoInput.ToString());
-
-                        CardRead.NationEcTrans(Global.inf.ecURL, JoInput.ToString(), out sOutPar);
-                        if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
+                        else
                         {
-                            outParam = "调用电子凭证失败:" + sOutPar;
-                            return -1;
-                        }
+                            //二维码
+                            if (cc.EcCertDecodeType == "0")
+                            {
+                                joCardInfo.Add("deviceType", cc.sL_CertCodeType);
+                            }
+                            //电子凭证
+                            else if (cc.EcCertDecodeType == "1")
+                            {
+                                joCardInfo.Add("outBizNo", sLSH);
+                                joCardInfo.Add("extData", "");
+                            }
 
-                        Global.pat.ecToken = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.ecToken");                        
-                        Global.pat.name    = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.userName");
-                        Global.pat.IDType  = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idType");                        
-                        Global.pat.IDNO    = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idNo");                        
-                        Global.pat.insuplc_admdvs = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.insuOrg");
+                            //调用电子凭证动态库NationECCode.dll获取身份信息                        
+                            JObject JoInput = new JObject();
+                            JoInput.Add("orgId", Global.inf.hospitalNO);
+                            JoInput.Add("transType", cc.sL_EcCertDecodeTradeNO);
+                            JoInput.Add("data", joCardInfo);
+                            JoInput.Add("extra", "");
+                            //MessageBox.Show("电子凭证解码地址:" + Global.inf.ecURL + ",入参:" + JoInput.ToString());
+                            CardRead.NationEcTrans(Global.inf.ecURL, JoInput.ToString(), out sOutPar);
+                            if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
+                            {
+                                outParam = "调用电子凭证失败:" + sOutPar;
+                                return -1;
+                            }
 
-                        Global.pat.mdtrtcertNO = Global.pat.ecToken;
-                        Global.pat.certType = Global.pat.IDType;
-                        Global.pat.certNO = Global.pat.IDNO;
+                            Global.pat.ecToken = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.ecToken");
+                            Global.pat.name = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.userName");
+                            Global.pat.IDType = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idType");
+                            Global.pat.IDNO = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idNo");
+                            Global.pat.insuplc_admdvs = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.insuOrg");
+                            Global.pat.mdtrtcertNO = Global.pat.ecToken;
+                            Global.pat.certType = Global.pat.IDType;
+                            Global.pat.certNO = Global.pat.IDNO;
+                        }                       
                     }
                     #endregion
 
@@ -1150,7 +1180,8 @@ namespace PTMedicalInsurance.Business
                     string occurTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                     joRegInpar.Add("psn_no", Global.pat.psn_no);
                     joRegInpar.Add("insutype", frmReg.insuType);
-                    joRegInpar.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime"));//挂号时间  这里之所以不取当前时间是因为就诊信息上传会关联判断挂号的时间DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                    //挂号时间  这里之所以不取当前时间是因为就诊信息上传会关联判断挂号的时间
+                    joRegInpar.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));   //20231122张振工单要求取当前时间JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime")
                     joRegInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
                     joRegInpar.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
                     joRegInpar.Add("ipt_otp_no", Global.pat.adm_Dr);
@@ -1173,7 +1204,7 @@ namespace PTMedicalInsurance.Business
                     joMdtrtinfo.Add("psn_no", Global.pat.psn_no);          //人员编号
                     Global.pat.medType = frmReg.med_type;
                     joMdtrtinfo.Add("med_type", frmReg.med_type);          //医疗类别
-                    joMdtrtinfo.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime"));          //开始时间
+                    joMdtrtinfo.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));          //开始时间20231122张振工单要求取当前时间 JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime")
                     joMdtrtinfo.Add("main_cond_dscr", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.main_cond_dscr"));          //主要病情描述
                     joMdtrtinfo.Add("dise_codg", diseCodg);          //病种编码
                     joMdtrtinfo.Add("dise_name", diseName);          //病种名称
@@ -1265,6 +1296,14 @@ namespace PTMedicalInsurance.Business
                 {
                     jaFeeDetail[i]["chrg_bchno"] = Global.pat.adm_Dr.ToString();
                     jaFeeDetail[i]["med_type"] = Global.pat.medType;
+
+
+                    jaFeeDetail[i]["bilg_dept_codg"] = "A10";
+                    jaFeeDetail[i]["bilg_dept_name"] = "眼科";
+                    jaFeeDetail[i]["acord_dept_codg"] = "A10";
+                    jaFeeDetail[i]["acord_dept_name"] = "眼科";
+
+
                     if (jaFeeDetail[i]["validFlag"].ToString() == "N") continue;
                     jaTmp.Add(jaFeeDetail[i]);
                     if (((i + 1) % singleCount == 0) || ((i + 1) == jaFeeDetail.Count))

+ 9 - 8
Forms/ChooseCard.cs

@@ -54,21 +54,22 @@ namespace PTMedicalInsurance.Forms
             //电子凭证
             if (rbgMdtrtCertType.SelectedIndex == 0)
             {
-                sL_CertCodeType= "01" + cbYMYWLX.Text.Trim().Substring(0,3);            //用码业务类型                
+                sL_CertCodeType= "01" + cbYMYWLX.Text.Trim().Substring(0,3);   //用码业务类型                
 
-                if (rbgEcCertDecodeType.SelectedIndex == 0)
+                if (rbgEcCertDecodeType.SelectedIndex == 0)    //电子凭证二维码解码接口
                 {
-                    sL_EcCertDecodeTradeNO = "ec.query";
+                    sL_EcCertDecodeTradeNO = "ec.query";  
                     EcCertDecodeType = "0";                    
                 }
-                else if (rbgEcCertDecodeType.SelectedIndex == 1)
+                else if (rbgEcCertDecodeType.SelectedIndex == 1)   //终端-医保电子凭证码解码接口
                 {
                     sL_EcCertDecodeTradeNO = "cn.nhsa.qrcode.get";
                     EcCertDecodeType = "1";
                 }
-                else if (rbgEcCertDecodeType.SelectedIndex == 2)
+                else if (rbgEcCertDecodeType.SelectedIndex == 2)  
                 {
-                    sL_EcCertDecodeTradeNO = "cn.nhsa.auth.check";
+                    sL_EcCertDecodeTradeNO = "cn.nhsa.ec.auth";    //终端-刷脸授权获取医保身份接口
+                    //sL_EcCertDecodeTradeNO = "cn.nhsa.auth.check";   //终端-刷脸授权获取医保身份接口
                     EcCertDecodeType = "2";
                 }
             }
@@ -124,12 +125,12 @@ namespace PTMedicalInsurance.Forms
         }
 
         private void rbgMdtrtCertType_ValueChanged(object sender, int index, string text)
-        {
+        {            
             if (rbgMdtrtCertType.SelectedIndex == 0)
             {
                 rbgEcCertDecodeType.SelectedIndex = 0;
                 uiLabel4.Text = "凭证令牌";
-                rbgEcCertDecodeType.Enabled = false;
+                rbgEcCertDecodeType.Enabled = true;
                 cbYMYWLX.Enabled = true;
 
                 uiLabel3.Visible = true;

+ 2 - 2
Forms/ChooseCard.designer.cs

@@ -228,8 +228,8 @@
             this.rbgEcCertDecodeType.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.rbgEcCertDecodeType.Items.AddRange(new object[] {
             "二维码",
-            "电子凭证",
-            "刷脸验证"});
+            "终端-二维码",
+            "终端-刷脸验证"});
             this.rbgEcCertDecodeType.ItemSize = new System.Drawing.Size(180, 35);
             this.rbgEcCertDecodeType.Location = new System.Drawing.Point(0, 0);
             this.rbgEcCertDecodeType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);

+ 1 - 0
Variables/Struct.cs

@@ -94,6 +94,7 @@ namespace PTMedicalInsurance.Variables
         public string insuplc_admdvs;
         public string mdtrtarea_admvs;   //就医地行政区划
         public string ecToken; //电子凭证令牌
+        public string authNo; //实人认证业务流水号
         public Card card;
         public string settlID;
         public string billID;