Ejemplo n.º 1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            { //WebReference.WSFaces wsf = new WebReference.WSFaces();//我们的接口服务
                Paneljps.Visible = false;


                Test.WSFaces wsf = new Test.WSFaces();
                yPhone = txtPhone.Text.Trim();
                //Regex rx = new Regex(@"((^13[0-9]{1}[0-9]{8}|^15[0-9]{1}[0-9]{8}|^14[0-9]{1}[0-9]{8}|^16[0-9]{1}[0-9]{8}|^17[0-9]{1}[0-9]{8}|^18[0-9]{1}[0-9]{8}|^19[0-9]{1}[0-9]{8})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)");
                if (!Phone(txtPhone.Text.Trim()))
                {
                    MessageBox.Show("手机号码格式有误", "温馨提示", MessageBoxButtons.OK);
                    return;
                }
                yCode = wsf.VerificationCode(txtPhone.Text.Trim());//验证码
                JObject obj = JObject.Parse(yCode);
                yCode         = obj["string"]["#text"].ToString();
                link2.Enabled = false;
                link3.Text    = "30 秒后重试";
                link2.Visible = false;
                link3.Visible = true;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
                Logging.LogFile(s);
            }


            #region 倒计时事件
            timer1.Enabled = true;
            #endregion
        }
Ejemplo n.º 2
0
        String UserID      = "194";   //明医用户ID

        private void button1_Click_1(object sender, EventArgs e)
        {
            //获取用户信息,取数



            #region 生成支付宝二维码
            SJC = ConvertDateTimeLong(DateTime.Now).ToString();      //生成时间戳
            Test.WSFaces wsf     = new Test.WSFaces();
            String       PayJson = wsf.ScanCodeGen(XMMC, DDJE, SJC); //获取生成支付宝二维码的数据

            JObject jsonObj = JsonConvert.DeserializeObject <JObject>(PayJson);
            string  code    = jsonObj["code"].ToString();//获取返回code
            if (code == "1")
            {
                String[] jso = jsonObj["msg"].ToString().Split(',');
                DoWaitProcess(jso[0]);//生成二维码

                timer2.Enabled = true;
                Thread t1 = new Thread(new ParameterizedThreadStart(LoopQuery));//线程—开启轮询
                t1.Start(jso[1]);
            }
            else
            {
                MessageBox.Show("二维码生成失败");
            }
            #endregion
        }
Ejemplo n.º 3
0
 //定时器判断用户是否支付成功
 private void timer2_Tick(object sender, EventArgs e)
 {
     if (res != "")
     {
         JObject jsonObj = JsonConvert.DeserializeObject <JObject>(res);
         if (jsonObj["code"].ToString() == "1")
         {
             timer2.Enabled = false;
             MessageBox.Show(jsonObj["msg"].ToString());//支付成功
             #region 记录刷脸支付的数据
             Test.WSFaces wsf      = new Test.WSFaces();
             String       HospCode = PASSWORD_MODIFY.APP_Encode("1001");
             HisOrderNum = PASSWORD_MODIFY.APP_Encode(HisOrderNum);
             String Source = PASSWORD_MODIFY.APP_Encode("刷脸支付");
             SJC    = PASSWORD_MODIFY.APP_Encode(SJC);  //Billnumber
             DDJE   = PASSWORD_MODIFY.APP_Encode(DDJE); //订单金额
             UserID = PASSWORD_MODIFY.APP_Encode(UserID);
             String Payment = PASSWORD_MODIFY.APP_Encode("1");
             XMMC = PASSWORD_MODIFY.APP_Encode(XMMC);
             int i = wsf.AddPaymentRecord(HospCode, HisOrderNum, SJC, DDJE, Source, UserID, Payment, XMMC);
             #endregion
             return;
         }
         else
         {
             timer2.Enabled = false;
             MessageBox.Show(jsonObj["msg"].ToString());
             return;
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 开启轮询
 /// </summary>
 /// <param name="qye"></param>
 public void LoopQuery(object qye)
 {
     Test.WSFaces wsf = new Test.WSFaces();
     try
     {
         res = wsf.LoopQuery(qye.ToString());
     }
     catch (Exception)
     {
         res = wsf.LoopQuery(qye.ToString());
     }
 }
Ejemplo n.º 5
0
        private void picRegister_Click(object sender, EventArgs e)
        {
            #region   检验是否正确
            if (String.IsNullOrEmpty(txtPhone.Text))
            {
                MessageBox.Show("请输入手机号码");
                return;
            }
            if (String.IsNullOrEmpty(txtYan.Text))
            {
                MessageBox.Show("请输入验证码");
                return;
            }
            if (IsAgree == 0)
            {
                MessageBox.Show("请同意该协议!");
                return;
            }
            String Mge = "";
            #region 验证身份证是否合法
            Sidnum  = this.txtIDCard.Text;
            Address = this.txtAddress.Text;
            SName   = this.txtName.Text;
            SNation = "汉";
            string cid = CheckCidInfo18(Sidnum);
            if (cid != "")
            {
                Mge = cid;
                Ts_Show("2", Mge);//显示提示界面
                return;
            }
            #region 验证手机号码是否合法
            if (!Phone(txtPhone.Text.Trim()))
            {
                Mge = "手机号码格式错误";
                Ts_Show("2", Mge);//显示提示界面
                return;
            }
            #endregion
            #region 判断手机号与验证码是否合法
            if (!String.IsNullOrEmpty(txtPhone.Text))
            {
                if (string.IsNullOrEmpty(yPhone))
                {
                    MessageBox.Show("请您获取验证码");
                    return;
                }
                if (txtPhone.Text != yPhone)//如果接收验证码的手机与文本框的手机不一致
                {
                    MessageBox.Show("手机号码不一致");
                    return;
                }
                if (String.IsNullOrEmpty(txtYan.Text))//如果验证码为空
                {
                    MessageBox.Show("请输入验证码");
                    return;
                }
                if (txtYan.Text.Trim() != yCode)//与发送的验证码不一致
                {
                    MessageBox.Show("验证码错误");
                    return;
                }
            }
            #endregion

            #endregion



            #region 抓取图片
            if (File.Exists(System.IO.Path.GetFullPath(".\\") + "temp.jpg"))
            {
                File.Delete(System.IO.Path.GetFullPath(".\\") + "temp.jpg");
            }
            imgFace.Save(System.IO.Path.GetFullPath(".\\") + "temp.jpg");
            imgFace.Dispose();
            #endregion

            Test.WSFaces wsf = new Test.WSFaces();

            #region 调用公安验证
            FileStream jpgStream = new FileStream(System.IO.Path.GetFullPath(".\\") + "temp.jpg", FileMode.Open);
            byte[]     bytes     = StreamToBytes(jpgStream);
            string     result    = wsf.AuthenPliceFace(Sidnum, SName, this.txtPhone.Text, SNation, Address, bytes);

            JObject obj = JObject.Parse(result);
            //结果码
            string str = obj["code"].ToString();
            //结果信息
            MessageBox.Show(obj["message"].ToString());
            jpgStream.Close();
            jpgStream.Dispose();
            #endregion
            //if (str == "1")
            //{
            //    Ts_Show("0", obj["message"].ToString());//显示提示注册成功界面
            //}


            #endregion
        }
Ejemplo n.º 6
0
        private void btnTwoText_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textIDno.Text) && String.IsNullOrEmpty(textPhone.Text))//如果身份证号与手机号码都为空,那么不允许操作
            {
                MessageBox.Show("请输入手机号或者身份证号码");
            }

            #region 判断手机号与验证码是否合法
            if (!String.IsNullOrEmpty(textPhone.Text))
            {
                if (textPhone.Text != Phone)//如果接收验证码的手机与文本框的手机不一致
                {
                    MessageBox.Show("手机号码不一致");
                    return;
                }
                if (String.IsNullOrEmpty(textCode.Text))//如果验证码为空
                {
                    MessageBox.Show("请输入验证码");
                    return;
                }
                if (textCode.Text.Trim() != Code)//与发送的验证码不一致
                {
                    MessageBox.Show("验证码错误");
                    return;
                }
            }
            #endregion
            //if ((!Regex.IsMatch(textIDno.Text.Trim(), @"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$", RegexOptions.IgnoreCase)))//正则表达式验证身份证号码是否合法
            //{
            //    MessageBox.Show("身份证格式有误");
            //}

            #region 查询患者信息及绑定界面数据
            //UserInfoBLL bll = new UserInfoBLL();
            //DataTable dt = bll.GetUserInfo(textPhone.Text.Trim(), textIDno.Text.Trim());
            Test.WSFaces wsf = new Test.WSFaces();
            DataTable    dt  = wsf.GetUserIdAndPhone(textPhone.Text.Trim(), textIDno.Text.Trim());
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("该患者未注册");
                return;
            }
            if (dt.Rows.Count > 1)
            {
                MessageBox.Show("该患者数目不对,请联系工程师进行核实");
                return;
            }
            textName.Text = dt.Rows[0]["RealName"].ToString();
            String idno   = dt.Rows[0]["IDno"].ToString();
            String JMidno = idno.Substring(0, 6);            //身份证号码
            JMidno       += "********" + idno.Substring(14, 4);
            textIDno.Text = JMidno;                          //需要加**
            String phones  = dt.Rows[0]["Phone"].ToString(); //手机号
            String JMphone = phones.Substring(0, 3);
            JMphone       += "****" + phones.Substring(7, 4);
            textPhone.Text = JMphone;//需要加**
            #endregion

            #region 获取用户头像
            String json = wsf.GetAvatar("420922199401141012", "17621251520");

            JObject jo       = (JObject)JsonConvert.DeserializeObject(json);
            string  jcode    = jo["code"].ToString();
            string  jmessage = jo["message"].ToString();
            if (jcode == "1")
            {
                string jjson = jo["data"].ToString();
                jjson = jjson.Substring(1, jjson.Length - 1);
                jjson = jjson.Substring(0, jjson.Length - 1);
                JObject obj = JObject.Parse(jjson);

                string base64 = obj["base64"].ToString();                  //用户头像的Base64数据

                byte[]       bytes     = Convert.FromBase64String(base64); //Base64转二进制流
                MemoryStream memStream = new MemoryStream(bytes);
                Image        mImage    = Image.FromStream(memStream);      //流文件转文件
                pictureBox2.Image = mImage;                                //显示在界面上
            }
            else
            {
                MessageBox.Show(jmessage);//提示
            }
            #endregion
            Phone = "";
            Code  = "";
        }
Ejemplo n.º 7
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            #region   检验是否正确


            String Mge = "";
            //#region 非空验证
            //if (String.IsNullOrEmpty(txtOneName.Text))
            //{
            //    MessageBox.Show("请输入姓名");
            //    return;
            //}
            //if (String.IsNullOrEmpty(txtOneIDNum.Text))
            //{
            //    MessageBox.Show("请输入身份证号码");
            //    return;
            //}
            //if (String.IsNullOrEmpty(txtOnePhone.Text))
            //{
            //    MessageBox.Show("请输入手机号码");
            //    return;
            //}
            //if (String.IsNullOrEmpty(textCode.Text))
            //{
            //    MessageBox.Show("请输入验证码");
            //    return;
            //}
            //#endregion
            #region 验证身份证是否合法
            Sidnum = "142727199802101033";
            SName  = "付玲琪";
            string cid = CheckCidInfo18(Sidnum);
            if (cid != "")
            {
                Mge = cid;
                Ts_Show("2", Mge);//显示提示界面
                return;
            }
            #endregion
            //#region 验证手机号码是否合法
            //if (!Phone(txtOnePhone.Text.Trim()))
            //{
            //    Mge = "手机号码格式错误";
            //    Ts_Show("2", Mge);//显示提示界面
            //    return;
            //}
            //#endregion
            //#region 判断手机号与验证码是否合法
            //if (!String.IsNullOrEmpty(txtOnePhone.Text))
            //{
            //    if (txtOnePhone.Text != yPhone)//如果接收验证码的手机与文本框的手机不一致
            //    {
            //        MessageBox.Show("手机号码不一致");
            //        return;
            //    }
            //    if (String.IsNullOrEmpty(textCode.Text))//如果验证码为空
            //    {
            //        MessageBox.Show("请输入验证码");
            //        return;
            //    }
            //    if (textCode.Text.Trim() != yCode)//与发送的验证码不一致
            //    {
            //        MessageBox.Show("验证码错误");
            //        return;
            //    }
            //}
            //#endregion



            #region 抓取图片
            if (File.Exists(System.IO.Path.GetFullPath(".\\") + "temp.jpg"))
            {
                File.Delete(System.IO.Path.GetFullPath(".\\") + "temp.jpg");
            }
            imgFace.Save(System.IO.Path.GetFullPath(".\\") + "temp.jpg");
            imgFace.Dispose();
            #endregion

            Test.WSFaces wsf = new Test.WSFaces();
            #region 调用公安验证
            FileStream jpgStream = new FileStream(System.IO.Path.GetFullPath(".\\") + "temp.jpg", FileMode.Open);
            byte[]     bytes     = StreamToBytes(jpgStream);
            string     result    = "222";//wsf.AuthenPliceFace(Sidnum, SName, bytes);
            jpgStream.Close();
            jpgStream.Dispose();
            #endregion

            #region 业务逻辑


            if (!result.Contains("error_code"))      //如果识别通过
            {
                if (Convert.ToDouble(result) >= 0.8) //大于等于0.8表明身份验证通过
                {
                    //获取身份证号码和手机号
                    string cardid = Sidnum;
                    string phone  = this.txtOnePhone.Text.Trim();
                    //两步查询确保用户信息唯一
                    LiShuiServer ls       = new LiShuiServer();
                    string       lsresult = ls.YZinfo(cardid, phone);
                    if (lsresult == "身份证号或手机号已被注册!")
                    {
                        Ts_Show("2", lsresult);
                        Empty();
                        //timer4.Start();
                        //string ts1 = txtOneName.Text.Trim();

                        //if (ts1 != "请将您的身份证放置于读卡区域")
                        //{
                        //    timer4.Stop();
                        //}
                        return;
                    }

                    #region 获取基本信息
                    string Sexnum = "";
                    string strSex = "";
                    if (cardid.Length == 18)
                    {
                        Sexnum = cardid.Substring(14, 3);
                    }
                    if (cardid.Length == 15)
                    {
                        Sexnum = cardid.Substring(12, 3);
                    }
                    if (int.Parse(Sexnum) % 2 == 0)
                    {
                        strSex = "2";//女2
                    }
                    else
                    {
                        strSex = "1"; //男1
                    }

                    //丽水RSA加密的公钥
                    //String key = "<RSAKeyValue><Modulus>yiOA0woIRt0KIHv1DauhGRMyxMu/sxKz345ilwJbbRk38tPF+sJzB1+N3C0f5izAtO31nXQ2JO6ekKRneEvhiaiIBk3E2iui20hBPLE+z1Y7ycezCwpKqh4Xr7GMbmi+MDMCvBDGcVaS6xp43cE29swxe+N0VipvFVIcKDRil18=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
                    string jjk = ls.getJKK(SName, strSex, Sidnum, txtOnePhone.Text.Trim());
                    // JObject jsonObj = JsonConvert.DeserializeObject<JObject>(dzjkk);//jsonArrayText必须是带[]数组格式字符串 string str = jArray[0]["a"].ToString();


                    JObject jsonObj    = JsonConvert.DeserializeObject <JObject>(jjk); //jsonArrayText必须是带[]数组格式字符串 string str = jArray[0]["a"].ToString();
                    string  error_code = jsonObj["resultCode"].ToString();             //获取错误代码

                    string dzjkk = jsonObj["entity"].ToString();                       //获取健康卡号
                    #endregion

                    if (lsresult == "更新")//说明是老用户
                    {
                        #region 老用户健康卡更新

                        if (ls.updateJKK(dzjkk, Sidnum) > 0)
                        {
                            #region 通过线程启动图片上传功能,解决了图片上传造成的性能慢的问题
                            Thread t1 = new Thread(new ParameterizedThreadStart(ImgUpdate));//线程
                            t1.Start(Sidnum);
                            #endregion
                            Empty();          //清空文本框内容
                            Ts_Show("0", ""); //显示提示注册成功界面
                            string ts1 = txtOneName.Text.Trim();

                            if (ts1 != "请将您的身份证放置于读卡区域")
                            {
                                timer4.Stop();
                            }
                            return;
                        }
                        else
                        {
                            Mge = "用户已经注册!!";
                            Ts_Show("1", Mge);
                            Empty();
                        }
                        #endregion
                    }
                    else if (lsresult == "注册")
                    {
                        //用户信息没有注册,进行添加操作
                        #region 用户注册
                        if (error_code == "0")
                        {
                            //给Model赋值
                            Models.UserInfoModel.UserInfo user = new Models.UserInfoModel.UserInfo();
                            user.Phone      = phone;
                            user.RealName   = SName;
                            user.IDno       = Sidnum;
                            user.VerifyFlag = 2;
                            user.LoginPass  = "******";
                            user.Address    = Address;
                            user.Healthcard = dzjkk;
                            //user.InsertDate = DateTime.Now;

                            try
                            {
                                int res = ls.UserRegister(bytes, user.Phone, user.IDno, user.RealName, user.LoginPass, user.VerifyFlag, 1, "", user.Address, user.Healthcard);
                                if (res > 0)
                                {
                                    #region 通过线程启动图片上传功能,解决了图片上传造成的性能慢的问题
                                    Thread t1 = new Thread(new ParameterizedThreadStart(ImgUpdate));//线程
                                    t1.Start(Sidnum);
                                    #endregion
                                    Empty();          //清空文本框内容
                                    Ts_Show("0", ""); //显示提示注册成功界面
                                    string ts1 = txtOneName.Text.Trim();

                                    if (ts1 != "请将您的身份证放置于读卡区域")
                                    {
                                        timer4.Stop();
                                    }
                                    return;
                                }
                                else
                                {
                                    Mge = "创建档案失败.";
                                    Ts_Show("2", Mge);
                                    Empty();
                                }
                            }
                            catch (Exception ex)
                            {
                                Mge = "创建档案失败.";
                                Ts_Show("2", Mge);
                                Empty();
                            }
                        }
                        else
                        {
                            JObject jsonObj1    = JsonConvert.DeserializeObject <JObject>(dzjkk); //jsonArrayText必须是带[]数组格式字符串 string str = jArray[0]["a"].ToString();
                            string  error_code1 = jsonObj["entity"].ToString();                   //获取错误代码
                            Ts_Show("2", error_code1);
                            Empty();
                        }
                        #endregion
                    }
                }
                else
                {
                    Double ImNum = Convert.ToDouble(result);
                    ImNum = ImNum * 100;
                    Mge   = "照片与本人的相似度只有" + ImNum.ToString() + "%";
                    //MessageBox.Show(Mge);
                    Ts_Show("2", Mge);//显示提示界面
                    Empty();
                }
            }
            else//如果识别不通过
            {
                JObject jsonObj    = JsonConvert.DeserializeObject <JObject>(result);//jsonArrayText必须是带[]数组格式字符串 string str = jArray[0]["a"].ToString();
                string  error_code = jsonObj["error_code"].ToString();//获取错误代码
                #region 错误代码
                switch (error_code)
                {
                case "4":
                    Mge = "集群超限额";
                    break;

                case "6":
                    Mge = "没有接口权限";
                    break;

                case "17":
                    Mge = "每天流量超限额";
                    break;

                case "18":
                    Mge = "QPS超限额";
                    break;

                case "19":
                    Mge = "请求总量超限额";
                    break;

                case "100":
                    Mge = "无效的access_token参数";
                    break;

                case "110":
                    Mge = "Access Token失效";
                    break;

                case "111":
                    Mge = "Access token过期";
                    break;

                case "216100":
                    Mge = "参数异常,具体异常原因详见error_msg";
                    break;

                case "216101":
                    Mge = "缺少必须的参数,具体异常原因详见error_msg";
                    break;

                case "216102":
                    Mge = "请求了不支持的服务";
                    break;

                case "216103":
                    Mge = "请求超长";
                    break;

                case "216110":
                    Mge = "appid不存在";
                    break;

                case "216111":
                    Mge = "userid信息非法";
                    break;

                case "216200":
                    Mge = "图片为空或者base64解码错误";
                    break;

                case "216201":
                    Mge = "图片格式错误";
                    break;

                case "216202":
                    Mge = "图片大小错误";
                    break;

                case "216300":
                    Mge = "数据库异常";
                    break;

                case "216400":
                    Mge = "后端识别服务异常";
                    break;

                case "216402":
                    Mge = "未找到人脸";
                    break;

                case "216500":
                    Mge = "未知错误";
                    break;

                case "216611":
                    Mge = "用户不存在";
                    break;

                case "216613":
                    Mge = "删除用户图片记录失败";
                    break;

                case "216614":
                    Mge = "两两比对中图片数少于2张,无法比较";
                    break;

                case "216615":
                    Mge = "服务处理该图片失败";
                    break;

                case "216616":
                    Mge = "图片已存在";
                    break;

                case "216617":
                    Mge = "新增用户图片失败";
                    break;

                case "216618":
                    Mge = "组内用户为空";
                    break;

                case "216631":
                    Mge = "本次请求添加的用户数量超限";
                    break;

                case "216501":
                    Mge = "传入的生活照中没有找到人脸";
                    break;

                case "216600":
                    Mge = "身份证格式错误,请检查后重新输入";
                    break;

                case "216601":
                    Mge = "身份证号码与姓名不匹配,或无法找到此身份证号码";
                    break;

                case "216602":
                    Mge = "输入生活照人脸遮挡,质量检测不通过";
                    break;

                case "216603":
                    Mge = "人脸光照不好,质量检测不通过";
                    break;

                case "216604":
                    Mge = "人脸不完整,质量检测不通过";
                    break;

                case "216605":
                    Mge = "质量检测不通过";
                    break;

                case "216606":
                    Mge = "人脸模糊,质量检测不通过";
                    break;

                case "216607":
                    Mge = "公安库无此人图片或公安小图质量不佳";
                    break;

                case "216608":
                    Mge = "输入的生活照活体校验不通过";
                    break;

                case "216609":
                    Mge = "人脸左右角度过大";
                    break;

                case "216610":
                    Mge = "人脸俯仰角度过大	";
                    break;

                default:
                    break;
                }
                #endregion
                Ts_Show("2", Mge);//显示提示界面
            }
            #endregion
            #endregion
        }
Ejemplo n.º 8
0
        int frequency = 0;//刷脸次数
        private void btnFace_Click(object sender, EventArgs e)
        {
            #region 第三次显示手动验证界面
            if (frequency > 1)
            {
                linkLabel1.Visible = true;
            }
            #endregion

            #region 抓取图片
            if (File.Exists(System.IO.Path.GetFullPath(".\\") + "tempface.jpg"))
            {
                File.Delete(System.IO.Path.GetFullPath(".\\") + "tempface.jpg");
            }
            imgFace.Save(System.IO.Path.GetFullPath(".\\") + "tempface.jpg");
            imgFace.Dispose();
            FileStream jpgStream = new FileStream(System.IO.Path.GetFullPath(".\\") + "tempface.jpg", FileMode.Open);
            byte[]     bytes     = StreamToBytes(jpgStream);
            //string base64 = Convert.ToBase64String(bytes);
            //Clipboard.SetDataObject(base64);
            //return;
            #endregion

            #region 一对N验证
            Test.WSFaces wf     = new Test.WSFaces();
            string       result = wf.CheckFacesMore(bytes, "");
            #endregion
            jpgStream.Close();
            jpgStream.Dispose();

            var data = GetData2JArray(result, "result");
            if (data != null && data.Count > 0)
            {
                string uid       = "";
                string scores    = "";
                string user_info = "";
                foreach (var item in data)
                {
                    uid       = item["uid"].ToString();
                    scores    = item["scores"].ToString();
                    user_info = item["user_info"].ToString();
                }
                JObject jsonObj = JsonConvert.DeserializeObject <JObject>(user_info);

                string userId   = jsonObj["UserId"].ToString();
                string realName = jsonObj["RealName"].ToString();
                scores = scores.Replace("[", "").Replace("]", "").Trim();

                if (Convert.ToDouble(scores) > 80)
                {
                    #region Win32
                    IntPtr i = FindWindow(null, "湘潭第一人民医院信息系统门户"); //寻找主窗体

                    SetForegroundWindow(i);                        //窗体前置

                    #region 寻找子窗体
                    IntPtr iBt = FindWindowEx(i, "病人刷卡", true);
                    if (iBt.ToInt32() == 0)
                    {
                        //this.lbMsg.Text = "病人刷卡";
                    }
                    #endregion

                    #region 寻找主窗体
                    IntPtr iss = FindWindow(null, "病人刷卡");
                    if (iss.ToInt32() == 0)
                    {
                        //this.lbMsg.Text = "没有找到0选取病人界面";
                        // return;
                    }
                    #endregion

                    #region 寻找窗体控件
                    //IntPtr la = FindWindowEx(iss, IntPtr.Zero, null, "确定(&O)");
                    //IntPtr laa = FindWindowEx(iss, IntPtr.Zero, null, "");
                    //IntPtr laaa = FindWindowEx(iss, laa, null, "");
                    //IntPtr las = FindWindowEx(iss, IntPtr.Zero, null, "读卡(F1)");
                    #endregion

                    SetCursorPos(22, 115);                    //鼠标定位

                    mouse_event(0x0002 | 0x0004, 0, 0, 0, 0); //鼠标点击

                    Thread.Sleep(200);                        //等待执行

                    Clipboard.SetDataObject("");              //复制到剪切板

                    SendKeys.Send("^V");                      //粘贴

                    SendKeys.Send("{ENTER}");                 //回车
                    #endregion
                }
                else
                {
                    //请先注册
                    MessageBox.Show("请先注册");
                    return;
                }
            }
            else
            {
                //错误代码
                JObject jsonObj    = JsonConvert.DeserializeObject <JObject>(result); //jsonArrayText必须是带[]数组格式字符串 string str = jArray[0]["a"].ToString();
                string  error_code = jsonObj["error_code"].ToString();                //获取错误代码
                String  Mge        = "";
                #region 错误代码
                switch (error_code)
                {
                case "4":
                    Mge = "集群超限额";
                    break;

                case "6":
                    Mge = "没有接口权限";
                    break;

                case "17":
                    Mge = "每天流量超限额";
                    break;

                case "18":
                    Mge = "QPS超限额";
                    break;

                case "19":
                    Mge = "请求总量超限额";
                    break;

                case "100":
                    Mge = "无效的access_token参数";
                    break;

                case "110":
                    Mge = "Access Token失效";
                    break;

                case "111":
                    Mge = "Access token过期";
                    break;

                case "216100":
                    Mge = "参数异常,具体异常原因详见error_msg";
                    break;

                case "216101":
                    Mge = "缺少必须的参数,具体异常原因详见error_msg";
                    break;

                case "216102":
                    Mge = "请求了不支持的服务";
                    break;

                case "216103":
                    Mge = "请求超长";
                    break;

                case "216110":
                    Mge = "appid不存在";
                    break;

                case "216111":
                    Mge = "userid信息非法";
                    break;

                case "216200":
                    Mge = "图片为空或者base64解码错误";
                    break;

                case "216201":
                    Mge = "图片格式错误";
                    break;

                case "216202":
                    Mge = "图片大小错误";
                    break;

                case "216300":
                    Mge = "数据库异常";
                    break;

                case "216400":
                    Mge = "后端识别服务异常";
                    break;

                case "216402":
                    Mge = "未找到人脸";
                    break;

                case "216500":
                    Mge = "未知错误";
                    break;

                case "216611":
                    Mge = "用户不存在";
                    break;

                case "216613":
                    Mge = "删除用户图片记录失败";
                    break;

                case "216614":
                    Mge = "两两比对中图片数少于2张,无法比较";
                    break;

                case "216615":
                    Mge = "服务处理该图片失败";
                    break;

                case "216616":
                    Mge = "图片已存在";
                    break;

                case "216617":
                    Mge = "新增用户图片失败";
                    break;

                case "216618":
                    Mge = "组内用户为空";
                    break;

                case "216631":
                    Mge = "本次请求添加的用户数量超限";
                    break;

                case "216501":
                    Mge = "传入的生活照中没有找到人脸";
                    break;

                case "216600":
                    Mge = "身份证格式错误,请检查后重新输入";
                    break;

                case "216601":
                    Mge = "身份证号码与姓名不匹配,或无法找到此身份证号码";
                    break;

                case "216602":
                    Mge = "输入生活照人脸遮挡,质量检测不通过";
                    break;

                case "216603":
                    Mge = "人脸光照不好,质量检测不通过";
                    break;

                case "216604":
                    Mge = "人脸不完整,质量检测不通过";
                    break;

                case "216605":
                    Mge = "质量检测不通过";
                    break;

                case "216606":
                    Mge = "人脸模糊,质量检测不通过";
                    break;

                case "216607":
                    Mge = "公安库无此人图片或公安小图质量不佳";
                    break;

                case "216608":
                    Mge = "输入的生活照活体校验不通过";
                    break;

                case "216609":
                    Mge = "人脸左右角度过大";
                    break;

                case "216610":
                    Mge = "人脸俯仰角度过大	";
                    break;

                default:
                    break;
                }
                #endregion
                MessageBox.Show(Mge);
            }
            frequency = frequency + 1;
        }