示例#1
0
        /// <summary>
        /// 点击返回按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void label4_Click(object sender, EventArgs e)
        {
            FrmYesNoAlert mFrmInfoAlert = new FrmYesNoAlert();

            mFrmInfoAlert.Msg = "如果您已经扫码,请在此界面等待支付结果!是否离开?";
            mFrmInfoAlert.sec = 10;
            mFrmInfoAlert.timer1.Start();

            if (mFrmInfoAlert.ShowDialog() == DialogResult.OK)
            {
                mNetPayPresenter.revokedTrade("-2"); //(-1:支付超时,-2订单撤销或关闭)
                timer2.Stop();
                this.DialogResult = DialogResult.Cancel;
            }


//            if (!ex)
//            {
//                SkyComm.ShowMessageInfo("如果您已经扫码,请在此界面等待支付结果!如您确认离开,请再此点击返回按钮");
//
//                ex = true;
//
//                return;
//            }
//
//            if (ex)
//            {
//                mNetPayPresenter.revokedTrade("-2");//(-1:支付超时,-2订单撤销或关闭)
//                timer2.Stop();
//                this.DialogResult = DialogResult.Cancel;
//            }
        }
        private void PrintListForXM()
        {
            try
            {
                this.ucTime1.Sec = 60;
                this.ucTime1.timer1.Stop();
                this.btnReturn.Enabled = false;
                this.btnExit.Enabled   = false;
                FrmYesNoAlert frmAlert = new FrmYesNoAlert();
                frmAlert.Title = "提示";
                //frmAlert.Msg = "是否确认打印检查报告单?                    注意:如果打印过程结束而自助机未打印报告单,则代表您没有存在检查结果的检查报告单信息!";
                frmAlert.Msg = "是否确认打印?                                如未打印,代表当前没有可打印的报告单!";
                if (frmAlert.ShowDialog() == DialogResult.Cancel)
                {
                    this.ucTime1.timer1.Start();
                    this.btnExit.Enabled   = true;
                    this.btnReturn.Enabled = true;
                    return;
                }

                SystemFramework.Voice.Voice voice = new SystemFramework.Voice.Voice();
                voice.PlayText("正在打印。如果未打印,代表当前没有可打印的报告单!");
                voice.EndJtts();

                this.AnsyWorker(ui =>
                {
                    ui.UpdateTitle("正在打印,请稍等...");

                    ui.SynUpdateUI(() =>
                    {
                        //string printParams = SkyComm.DiagnoseID;
                        string printParams = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString();
                        string[] argsList  = new string[1];
                        argsList[0]        = printParams;
                        string path        = System.IO.Directory.GetCurrentDirectory() + "\\LisPrint_ZF\\";
                        string fileName    = "AutoPrint.exe";
                        StartProcess_New(argsList, path, fileName);
                        Thread.Sleep(100);
                        SkyComm.ShowMessageInfo("检查报告单打印完毕!");
                        this.ucTime1.timer1.Start();
                        this.btnExit.Enabled   = true;
                        this.btnReturn.Enabled = true;
                    });
                });
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        /// <summary>
        /// 点击返回按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void label4_Click(object sender, EventArgs e)
        {
            FrmYesNoAlert mFrmInfoAlert = new FrmYesNoAlert();

            mFrmInfoAlert.Msg = "如果您已经扫码,请在此界面等待结果!是否离开?";
            mFrmInfoAlert.sec = 10;
            mFrmInfoAlert.timer1.Start();

            if (mFrmInfoAlert.ShowDialog() == DialogResult.OK)
            {
                timer1.Stop();
                timer2.Stop();
                this.DialogResult = DialogResult.Cancel;
            }
        }
示例#4
0
        private void lblOK_Click(object sender, EventArgs e)
        {
            this.ucTime1.timer1.Stop();
            SkyComm.GetCardBalance();
            this.lblMzYe.Text = SkyComm.cardBlance.ToString();
            if (!checkData())
            {
                this.ucTime1.Sec = 60;
                this.ucTime1.timer1.Start();
                return;
            }
            FrmYesNoAlert frmAlert = new FrmYesNoAlert();

            frmAlert.Title = "提示";
            frmAlert.Msg   = "是否确认将门诊预交金转至住院预交金,转账金额:" + Convert.ToDecimal(this.lblhm.Text.Trim()).ToString("0.00##") + "元";
            if (frmAlert.ShowDialog() == DialogResult.OK)
            {
                string advanceID = Postprepay();

                if (string.IsNullOrEmpty(advanceID))
                {
                    this.ucTime1.Sec = 60;
                    this.ucTime1.timer1.Start();
                    return;
                }

                SkyComm.ShowMessageInfo("转账成功!转账金额:" + Convert.ToDecimal(this.lblhm.Text.Trim()).ToString("0.00##") + "元。住院预交金余额:" + this.lblZyYe.Text + "元");
                AdvanceRecordFacade theAdvanceRecordFacade = new AdvanceRecordFacade();
                string receiptID = theAdvanceRecordFacade.GetReceiptIDByAdvanceID(advanceID);

                PrintInfo("住院预交金充值凭证", receiptID, this.lblhm.Text, advanceID);
            }
            else
            {
                this.ucTime1.Sec = 60;
                this.ucTime1.timer1.Start();
                return;
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
示例#5
0
        private void lblOK_Click(object sender, EventArgs e)
        {
            #region 增加挂号提示信息
            try
            {
                string registerMsg = SkyComm.getvalue("挂号提示");
                if (!string.IsNullOrEmpty(registerMsg))
                {
                    using (FrmYesNoAlert frmCheck = new FrmYesNoAlert())
                    {
                        frmCheck.Title = "挂号提示";
                        frmCheck.Msg   = registerMsg;
                        frmCheck.sec   = 90;
                        if (frmCheck.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                    }
                }
            }
            catch
            { }
            #endregion

            this.AnsyWorker(ui =>
            {
                ui.UpdateTitle("取号确认中,请稍等...");

                ui.SynUpdateUI(() =>
                {
                    decimal decYE         = Convert.ToDecimal(lblYE.Text);
                    decimal decTotal      = Convert.ToDecimal(lblTotalMoney.Text);
                    decimal decTotalMoney = 0;
                    ucTime1.timer1.Stop();

                    string strMessage = string.Empty;
                    int intRowChange  = 0;
                    foreach (DataRow Row in dsBespeak.Tables[0].Rows)
                    {
                        if (Convert.ToBoolean(Row["SELECT"]) == true)
                        {
                            decTotalMoney += DecimalRound.Round(Convert.ToDecimal(Row["ALLCOST"]), 2);
                        }
                        if (IsQueryBespeakData == true && Row["DIAGNOSEID"].ToString() != SkyComm.DiagnoseID)
                        {
                            intRowChange++;
                            strMessage = Row["OFFICE"].ToString() + "|" + Row["USERNAME"].ToString() + "  第" + Row["QUEUEID"].ToString() + "号" + "\r\n";
                        }
                    }

                    if (!string.IsNullOrEmpty(strMessage))
                    {
                        if (intRowChange < 3)
                        {
                            strMessage += "\r\n";
                        }
                        strMessage      = strMessage + "是否要绑定到当前就诊卡?";
                        MyAlert myalert = new MyAlert(AlertTypeenum.确认取消, strMessage, "预约信息绑卡确认", 30);
                        if (myalert.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            DataSet dsChagnge = dsBespeak.Clone();
                            foreach (DataRow Row in dsBespeak.Tables[0].Rows)
                            {
                                if (Convert.ToBoolean(Row["SELECT"]) == true && Row["DIAGNOSEID"].ToString() != SkyComm.DiagnoseID)
                                {
                                    Row["DIAGNOSEID"] = SkyComm.DiagnoseID;
                                    dsChagnge.Tables[0].ImportRow(Row);
                                }
                            }

                            if (dsChagnge.Tables[0].Rows.Count > 0)
                            {
                                try
                                {
                                    BespeakRegisterFacade bespeakRegisterFacade = new BespeakRegisterFacade();
                                    dsBespeak.Tables[0].TableName = "T_BESPEAK_REGISTER";
                                    bespeakRegisterFacade.updateDiagnoseID(dsChagnge);
                                }
                                catch (Exception ex)
                                {
                                    Skynet.LoggingService.LogService.GlobalInfoMessage("绑卡失败:" + ex.Message);
                                    SkyComm.ShowMessageInfo("绑卡失败:" + ex.Message);
                                    ucTime1.Sec = 60;
                                    ucTime1.timer1.Start();
                                    return;
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    if (decTotal != decTotalMoney)
                    {
                        SkyComm.ShowMessageInfo("请检查您选择的预约记录是否正确!");
                        ucTime1.Sec = 60;
                        ucTime1.timer1.Start();
                        return;
                    }

                    if (decTotal > decYE)
                    {
                        SkyComm.ShowMessageInfo("您的健康卡余额不足,不能进行取号,请在自助预存后再进行确认操作!");
                        ucTime1.Sec = 60;
                        ucTime1.timer1.Start();
                        return;
                    }
                    ucTime1.timer1.Stop();

                    //构造挂号的数据
                    CommonFacade commonFacade = new CommonFacade();
                    DateTime ServerdateTime   = commonFacade.GetServerDateTime();
                    double minutes            = Convert.ToDouble(SystemInfo.SystemConfigs["预约挂号报到延时时间"].DefaultValue);

                    RegisterInfoData registerInfoData = new RegisterInfoData();
                    int registerID = 0;
                    foreach (DataRow Row in dsBespeak.Tables[0].Rows)
                    {
                        if (Convert.ToBoolean(Row["SELECT"]) == true)
                        {
                            if (Convert.ToDateTime(Row["BESPEAKDATE"]).AddMinutes(minutes) < ServerdateTime)
                            {
                                MyAlert frm = new MyAlert(AlertTypeenum.信息, "此预约号的预约时间为:" + Row["BESPEAKDATE"].ToString() + ",预约时间已过,不能使用!");
                                frm.ShowDialog();
                                frm.Dispose();
                                registerInfoData = new RegisterInfoData();
                                ucTime1.Sec      = 60;
                                ucTime1.timer1.Start();
                                return;
                            }

                            registerID++;
                            DataRow Newrow = registerInfoData.Tables[0].NewRow();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_REGISTERID]       = "新增" + registerID.ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_CANCELMARK]       = "0";
                            Newrow[RegisterInfoData.T_REGISTER_INFO_OPERATORID]       = SysOperatorInfo.OperatorID;
                            Newrow[RegisterInfoData.T_REGISTER_INFO_OPERATEDATE]      = ServerdateTime;
                            Newrow[RegisterInfoData.T_REGISTER_INFO_CHARGEMARK]       = 0;
                            Newrow[RegisterInfoData.T_REGISTER_INFO_PATIENTNAME]      = Row["PATIENTNAME"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_SEX]              = Row["SEX"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_REGISTEROFFICEID] = Row["BESPEAKOFFICEID"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_OFFICE]           = Row["OFFICE"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_REGISTERCLASS]    = Row["REGISTERCLASS"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_DOCTORID]         = Row["BESPEAKDOCTORID"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_USERNAME]         = Row["USERNAME"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_CASECOST]         = Row["MEDICALRECORDFEE"]; //工本费
                            Newrow[RegisterInfoData.T_REGISTER_INFO_BESPEAKMONEY]     = Row["BESPEAKMONEY"];     //预约费
                            Newrow[RegisterInfoData.T_REGISTER_INFO_REGISTERFEE]      = Row["REGISTERFEE"];      //挂号费
                            Newrow[RegisterInfoData.T_REGISTER_INFO_EXAMINEMONEY]     = Row["EXAMINEMONEY"];     //诊金
                            Newrow[RegisterInfoData.T_REGISTER_INFO_BESPEAKID]        = Row["BESPEAKID"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_DIAGNOSEID]       = Row["DIAGNOSEID"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_ADDRESS]          = Row["ADDRESS"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_TELEPHONE]        = Row["TELEPHONE"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_OFFICEADDRESS]    = Row["OFFICEADDRESS"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_DIAGNOSESTATE]    = 0;
                            Newrow[RegisterInfoData.T_REGISTER_INFO_WORKTYPE]         = Row["WORKTYPE"].ToString();//班次
                            Newrow[RegisterInfoData.T_REGISTER_INFO_BIRTHDAY]         = Convert.ToDateTime(Row["BIRTHDAY"].ToString()).Date;
                            Newrow[RegisterInfoData.T_REGISTER_INFO_EXECDATE]         = ServerdateTime;
                            Newrow[RegisterInfoData.T_REGISTER_INFO_BALANCEMARK]      = "2";
                            Newrow[RegisterInfoData.T_REGISTER_INFO_CARDID]           = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString();
                            Newrow["BALANCEMODE"] = "预交金";//结算方式
                            Newrow[RegisterInfoData.T_REGISTER_INFO_BALANCESTATE] = 0;
                            Newrow[RegisterInfoData.T_REGISTER_INFO_CHECKFEE]     = Row["PLUSFEE"];
                            //row[RegisterInfoData.T_REGISTER_INFO_BALANCEOPERATOR] = operatorId;
                            //row[RegisterInfoData.T_REGISTER_INFO_BALANCEDATE] = dateTime;

                            //数据传入方式0:门急诊挂号,1:专家挂号,2:门诊医生站读卡挂号,4:医生站急诊划价收费,5:储值卡挂号,6:银医服务,7,自助挂号
                            Newrow[RegisterInfoData.T_REGISTER_INFO_DATAINPUTTYPE]    = 7;//结算状态
                            Newrow[RegisterInfoData.T_REGISTER_INFO_ARRANAGERECORDID] = Row["ARRANAGERECORDID"].ToString();
                            Newrow[RegisterInfoData.T_REGISTER_INFO_QUEUEID]          = Row["QUEUEID"].ToString();


                            registerInfoData.Tables[0].Rows.Add(Newrow);
                        }
                    }

                    RegisterInfoFacade registerFacade = new RegisterInfoFacade();
                    try
                    {
                        DataSet resultDs = registerFacade.insertEntityZj(registerInfoData);

                        SkyComm.GetCardBalance();

                        if (resultDs.Tables[0].Columns.Contains("EXAMINENAME") == false)
                        {
                            DataColumn col = new DataColumn("EXAMINENAME", typeof(System.String));
                            col.Caption    = "EXAMINENAME";
                            resultDs.Tables[0].Columns.Add(col);
                        }

                        // douyaming 2013-6-21 挂号发票输出 诊室位置
                        if (!resultDs.Tables[0].Columns.Contains("EXAMINELOC"))
                        {
                            resultDs.Tables[0].Columns.Add("EXAMINELOC");
                        }

                        UsersFacade uf = new UsersFacade();
                        BespeakRegisterFacade bespeakRegisterFacade = new BespeakRegisterFacade();

                        foreach (DataRow row in resultDs.Tables[0].Rows)
                        {
                            //13470 在挂号发票中输出诊室
                            string keyval = row["DOCTORID"].ToString();
                            if (keyval != "-1")
                            {
                                row["EXAMINENAME"] = uf.FindByUserInfo(keyval).Tables[0].Rows[0]["EXAMINENAME"].ToString();
                            }

                            //douyaming 2013-5-28 挂号发票输出 诊室位置
                            ExamineFacade ef     = new ExamineFacade();
                            string i_EXAMINENAME = uf.FindByPrimaryKeyString(keyval).ToString();
                            if (i_EXAMINENAME == "")
                            {
                                row["EXAMINELOC"] = "";
                            }
                            else
                            {
                                DataRow[] rw = ef.FindAllExamine().Tables[0].Select("EXAMINENAME = '" + i_EXAMINENAME + "' AND OFFICEID = '" + row["REGISTEROFFICEID"].ToString() + "'");
                                if (rw.Length > 0)
                                {
                                    row["EXAMINELOC"] = rw[0]["EXAMINELOC"].ToString();
                                }
                                else
                                {
                                    row["EXAMINELOC"] = "";
                                }
                            }
                        }
                        foreach (DataRow dr in resultDs.Tables[0].Rows)
                        {
                            //打印挂号凭证
                            DataTable dtPrint = resultDs.Tables[0].Clone();
                            dtPrint.ImportRow(dr);
                            DataSet dsPrint = new DataSet();
                            dsPrint.Tables.Add(dtPrint.Copy());
                            PrintReport(dsPrint);
                        }

                        try
                        {
                            Hashtable htPara = new Hashtable();
                            htPara.Add("@预约时间", Convert.ToDateTime(resultDs.Tables[0].Rows[0]["BESPEAKDATE"]).ToString("MM月dd日HH时mm分"));
                            string OfficeAddress = SysOperatorInfo.OperatorAreaname + resultDs.Tables[0].Rows[0]["OFFICEADDRESS"].ToString();
                            htPara.Add("@科室位置", OfficeAddress);
                            htPara.Add("@科室", resultDs.Tables[0].Rows[0][RegisterInfoData.T_REGISTER_INFO_OFFICE].ToString());
                            htPara.Add("@医生", resultDs.Tables[0].Rows[0][RegisterInfoData.T_REGISTER_INFO_USERNAME].ToString());
                            htPara.Add("@排队号", resultDs.Tables[0].Rows[0]["QUEUEID"].ToString());
                            htPara.Add("@预约号", resultDs.Tables[0].Rows[0]["BESPEAKID"].ToString());
                            htPara.Add("@诊室位置", resultDs.Tables[0].Rows[0]["EXAMINELOC"].ToString());
                            htPara.Add("@诊室名称", resultDs.Tables[0].Rows[0]["EXAMINENAME"].ToString());
                            UMSMsgLib.UMSMsg.Instance.SendMsg(resultDs.Tables[0].Rows[0]["TELEPHONE"].ToString(), "取号", htPara);
                        }
                        catch (Exception ex)
                        {
                            Skynet.LoggingService.LogService.GlobalInfoMessage("取号成功后,发短信失败:" + ex.Message);
                        }
                    }
                    catch (Exception ex)
                    {
                        Skynet.LoggingService.LogService.GlobalInfoMessage(SkyComm.DiagnoseID + "取号[" + registerInfoData.Tables[0].Rows.Count + "]条记录,失败:" + ex.Message);
                        SkyComm.ShowMessageInfo("取号失败:" + ex.Message);

                        ucTime1.Sec = 60;
                        ucTime1.timer1.Start();

                        return;
                    }
                    SkyComm.ShowMessageInfo("取号成功,请提前15分钟到达分诊大厅进行等候!");
                    ucTime1.timer1.Stop();
                    //后台直接进行处理挂号操作
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                });
            });

            //DialogResult = System.Windows.Forms.DialogResult.OK;
        }
示例#6
0
        private void lblOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date == DateTime.Now.Date) //如果预约时间为当天,则调用挂号方法,重新组织数据
                {
                    #region 增加挂号提示信息
                    try
                    {
                        string registerMsg = SkyComm.getvalue("挂号提示");
                        if (!string.IsNullOrEmpty(registerMsg))
                        {
                            using (FrmYesNoAlert frmCheck = new FrmYesNoAlert())
                            {
                                frmCheck.Title = "挂号提示";
                                frmCheck.Msg   = registerMsg;
                                frmCheck.sec   = 90;
                                if (frmCheck.ShowDialog() != DialogResult.OK)
                                {
                                    return;
                                }
                            }
                        }
                    }
                    catch
                    { }
                    #endregion

                    if (registerInfoData.Tables.Count > 0 && registerInfoData.Tables[0].Rows.Count > 0)
                    {
                        registerInfoData.Tables[0].Rows.Clear();
                    }
                    DataRow rowReg = registerInfoData.Tables[0].NewRow();
                    int     i      = registerInfoData.Tables[0].Rows.Count + 1;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTERID]       = "新增" + i.ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_CANCELMARK]       = "0";
                    rowReg[RegisterInfoData.T_REGISTER_INFO_OPERATORID]       = SysOperatorInfo.OperatorID;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_OPERATEDATE]      = new CommonFacade().GetServerDateTime();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_CHARGEMARK]       = 0;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_PATIENTNAME]      = patientData.Tables[0].Rows[0]["PATIENTNAME"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_SEX]              = patientData.Tables[0].Rows[0]["SEX"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTEROFFICEID] = BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_OFFICE]           = BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICENAME"].ToString();

                    rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTERCLASS] = REGISTERCLASS;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_DOCTORID]      = BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_USERNAME]      = BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORNAME"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_CASECOST]      = Gbf;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_BESPEAKMONEY]  = 0;//预约费
                    rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTERFEE]   = Ghf;

                    rowReg[RegisterInfoData.T_REGISTER_INFO_EXAMINEMONEY] = Zj;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_BESPEAKID]    = "";
                    rowReg[RegisterInfoData.T_REGISTER_INFO_DIAGNOSEID]   = SkyComm.DiagnoseID;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_AGE]          = patientData.Tables[0].Rows[0]["AGE"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_AGEUNIT]      = patientData.Tables[0].Rows[0]["AGEUNIT"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_ADDRESS]      = patientData.Tables[0].Rows[0]["ADDRESS"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_TELEPHONE]    = patientData.Tables[0].Rows[0]["TELEPHONE"].ToString();

                    OfficeFacade officeFacade = new OfficeFacade();
                    DataSet      officeSet    = officeFacade.QueryByOfficeType(26, "");
                    DataRow      officeRow    = officeSet.Tables[0].AsEnumerable().FirstOrDefault(o => o.Field <string>("OFFICEID") == BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString());
                    rowReg[RegisterInfoData.T_REGISTER_INFO_OFFICEADDRESS] = officeRow["OFFICEADDRESS"].ToString().Trim();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_DIAGNOSESTATE] = 0;

                    rowReg[RegisterInfoData.T_REGISTER_INFO_CHECKFEE]         = jcf;
                    rowReg[RegisterInfoData.T_REGISTER_INFO_WORKTYPE]         = BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_ARRANAGERECORDID] = BespeakDataset.Tables[0].Rows[0]["ARRANAGERECORDID"].ToString();
                    //if (SystemInfo.SystemConfigs["是否启用分时预约"] != null && SystemInfo.SystemConfigs["是否启用分时预约"].DefaultValue == "1")
                    //{
                    rowReg[RegisterInfoData.T_REGISTER_INFO_QUEUEID] = BespeakDataset.Tables[0].Rows[0]["QUEUEID"].ToString();
                    //}
                    rowReg[RegisterInfoData.T_REGISTER_INFO_BIRTHDAY] = patientData.Tables[0].Rows[0]["BIRTHDAY"].ToString();
                    rowReg[RegisterInfoData.T_REGISTER_INFO_EXECDATE] = new CommonFacade().GetServerDateTime();
                    rowReg["BESPEAKDATE"] = Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString());
                    rowReg["BESPEAKMODE"] = "";

                    decimal decMoney = Convert.ToDecimal(Ghf) + Convert.ToDecimal(Zj) + Convert.ToDecimal(Gbf) + Convert.ToDecimal(jcf);
                    rowReg["CASHDEFRAY"]     = decMoney;
                    rowReg["ACCOUNTDEFRAY"]  = 0;
                    rowReg["DISCOUNTDEFRAY"] = 0;
                    rowReg["BALANCEMARK"]    = 2;
                    rowReg["BALANCESTATE"]   = 0;
                    rowReg["BALANCESTATE"]   = 0;
                    rowReg["BALANCEMODE"]    = "预交金";//结算方式
                    registerInfoData.Tables[0].Rows.Add(rowReg);
                    //chenqiang 2017-03-09 add by Case:27423
                    bespeakFac = new BespeakRegisterFacade();

                    //ZHOUHU ADD 20180130  CASE:29222
                    string isRegContr = new OfficeFacade().FindByOfficeID(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString()).Tables[0].Rows[0]["ISREGCONTR"].ToString();

                    if ("1" == SystemInfo.SystemConfigs["挂号、预约限制条件"].DefaultValue && isRegContr == "1")
                    {
                        if (registerFacade.FindNowDateRegisterInfo(patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), DateTime.Now.Date) > 0)
                        {
                            MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,系统不允许挂号");
                            registerInfo.ShowDialog();
                            return;
                        }
                        if (bespeakFac.FindBespeakPatientInfo(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), DateTime.Now.Date, patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString(), patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString()) > 0)
                        {
                            MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,当天已有预约信息,系统不允许挂号");
                            registerInfo.ShowDialog();
                            return;
                        }
                    }
                    //chenqiang 2017.06.16  add by Case:28088
                    if (registerFacade.FindNowDateRegisterInfo(registerInfoData.Tables[0].Rows[0]["DOCTORID"].ToString(), registerInfoData.Tables[0].Rows[0]["REGISTEROFFICEID"].ToString(), registerInfoData.Tables[0].Rows[0]["WORKTYPE"].ToString(), registerInfoData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), Convert.ToDateTime(registerInfoData.Tables[0].Rows[0]["OPERATEDATE"].ToString()).Date) > 0)
                    {
                        MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号");
                        registerInfo.ShowDialog();
                        return;
                    }
                    if (bespeakFac.FindBespeakPatientInfo(registerInfoData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), registerInfoData.Tables[0].Rows[0]["DOCTORID"].ToString(), registerInfoData.Tables[0].Rows[0]["REGISTEROFFICEID"].ToString(), registerInfoData.Tables[0].Rows[0]["WORKTYPE"].ToString(), Convert.ToDateTime(registerInfoData.Tables[0].Rows[0]["OPERATEDATE"].ToString()).Date) > 0)
                    {
                        MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号");
                        registerInfo.ShowDialog();
                        return;
                    }
                    DataSet ds = this.registerFacade.insertEntityForFZBD(this.registerInfoData);

                    MyAlert frmAlter = new MyAlert(AlertTypeenum.信息, "挂号成功!");
                    frmAlter.ShowDialog();

                    //输出挂号凭证
                    if (null == ds.Tables[0].Columns["EXAMINENAME"])
                    {
                        DataColumn col = new DataColumn("EXAMINENAME", typeof(System.String));
                        col.Caption = "EXAMINENAME";
                        ds.Tables[0].Columns.Add(col);
                    }

                    if (!ds.Tables[0].Columns.Contains("EXAMINELOC"))
                    {
                        ds.Tables[0].Columns.Add("EXAMINELOC");
                    }

                    UsersFacade uf = new UsersFacade();
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        string keyval = row["DOCTORID"].ToString();
                        if (keyval != "-1")
                        {
                            row["EXAMINENAME"] = uf.FindByUserInfo(keyval).Tables[0].Rows[0]["EXAMINENAME"].ToString();
                        }

                        ExamineFacade ef            = new ExamineFacade();
                        string        i_EXAMINENAME = uf.FindByPrimaryKeyString(keyval).ToString();
                        if (i_EXAMINENAME == "")
                        {
                            row["EXAMINELOC"] = "";
                        }
                        else
                        {
                            DataRow[] rw = ef.FindAllExamine().Tables[0].Select("EXAMINENAME = '" + i_EXAMINENAME + "' AND OFFICEID = '" + row["REGISTEROFFICEID"].ToString() + "'");
                            if (rw.Length > 0)
                            {
                                row["EXAMINELOC"] = rw[0]["EXAMINELOC"].ToString();
                            }
                            else
                            {
                                row["EXAMINELOC"] = "";
                            }
                        }
                    }

                    SkyComm.GetCardBalance();

                    PrintReport(ds, "自助挂号");
                    // PrintTriageInfo(ds.Tables[0], theServerTime);
                }
                else
                {
                    DataRow dr = BespeakDataset.Tables[0].Rows[0];
                    dr["PATIENTNAME"]  = patientData.Tables[0].Rows[0]["PATIENTNAME"].ToString();
                    dr["TELEPHONE"]    = patientData.Tables[0].Rows[0]["TELEPHONE"].ToString();
                    dr["IDENTITYCARD"] = patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString();
                    dr["SEX"]          = patientData.Tables[0].Rows[0]["SEX"].ToString();

                    //判断是否已经预约
                    DataSet dsBespeak = new DataSet();
                    if (!string.IsNullOrEmpty(patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString()))
                    {
                        dsBespeak = bespeakFac.FindBespeakInfoByIdentityOrDiagnoseId(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString(), "", patientData.Tables[0].Rows[0]["PATIENTNAME"].ToString());
                    }
                    else
                    {
                        dsBespeak = bespeakFac.FindBespeakInfoByIdentityOrDiagnoseId(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), "", patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), "");
                    }
                    if (Convert.ToInt16(dsBespeak.Tables[0].Rows[0][0]) > 0)
                    {
                        MyAlert frm = new MyAlert(AlertTypeenum.信息, Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).ToShortDateString() + "已有预约信息,不能再次预约!");
                        frm.ShowDialog();
                        return;
                    }

                    //ZHOUHU ADD 20180130  CASE:29222
                    string isRegContr = new OfficeFacade().FindByOfficeID(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString()).Tables[0].Rows[0]["ISREGCONTR"].ToString();

                    //chenqiang 2017-03-09 add by Case:27423
                    if ("1" == SystemInfo.SystemConfigs["挂号、预约限制条件"].DefaultValue && isRegContr == "1")
                    {
                        bespeakFac = new BespeakRegisterFacade();
                        if (bespeakFac.FindBespeakPatientInfo(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date, patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString(), patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString()) > 0)
                        {
                            MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,当天已有预约信息,系统不允许挂号");
                            registerInfo.ShowDialog();
                            return;
                        }
                        if (registerFacade.FindNowDateRegisterInfo(patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date) > 0)
                        {
                            MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,当天已有预约信息,系统不允许挂号");
                            registerInfo.ShowDialog();
                            return;
                        }
                    }

                    //chenqiang 2017.06.16  add by Case:28088
                    if (registerFacade.FindNowDateRegisterInfo(BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date) > 0)
                    {
                        MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号");
                        registerInfo.ShowDialog();
                        return;
                    }
                    if (bespeakFac.FindBespeakPatientInfo(patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date) > 0)
                    {
                        MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号");
                        registerInfo.ShowDialog();
                        return;
                    }
                    //chenqiang add case:33511
                    if (SystemInfo.SystemConfigs["是否启用号源云平台接口"].DefaultValue != "0")
                    {
                        if (BespeakDataset.Tables[0].Rows.Count > 1)
                        {
                            MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "在启用号源接口时,同一次只能预约一个医生!");
                            registerInfo.ShowDialog();
                            return;
                        }
                    }

                    BespeakDataset = (BespeakRegisterData)bespeakFac.insertBespeakEntityReturn(BespeakDataset, patientData, 1);
                    //chenqiang add case:33511
                    if (SystemInfo.SystemConfigs["是否启用号源云平台接口"].DefaultValue != "0")
                    {
                        int stepCount = 0;
                        try
                        {
                            if (arrangeSource == "1" && arranageDetailSource == "0" && Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date != new CommonFacade().GetServerDateTime().Date)
                            {
                                RegisterClouldInterface theRegisterClouldInterface = new RegisterClouldInterface();
                                stepCount++;
                                int intResult = theRegisterClouldInterface.BespeakRegisteInfo(BespeakDataset);
                                if (intResult < 0)
                                {
                                    bespeakFac.CancelBespeak(BespeakDataset.Tables[0].Rows[0]["BESPEAKID"].ToString(), SysOperatorInfo.OperatorID);
                                    BespeakDataset.Tables[0].Clear();
                                    patientData.Tables[0].Clear();
                                    SkynetMessage.MsgInfo("调用微信同步号源失败,HIS预约数据已回滚,预约失败!");
                                    return;
                                }
                            }
                        }
                        catch
                        {
                            if (stepCount != 0)
                            {
                                bespeakFac.CancelBespeak(BespeakDataset.Tables[0].Rows[0]["BESPEAKID"].ToString(), SysOperatorInfo.OperatorID);
                                BespeakDataset.Tables[0].Clear();
                                patientData.Tables[0].Clear();
                                SkynetMessage.MsgInfo("调用微信同步号源失败,HIS预约数据已回滚,预约失败!");
                                return;
                            }
                        }
                    }

                    MyAlert frmAlter = new MyAlert(AlertTypeenum.信息, "预约成功!");
                    frmAlter.ShowDialog();
                    PrintReport(BespeakDataset, "自助预约");
                    //预约成功后,发短信
                    try
                    {
                        Hashtable htPara = new Hashtable();
                        htPara.Add("@预约时间", Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"]).ToString("MM月dd日HH时mm分"));
                        string OfficeAddress = SysOperatorInfo.OperatorAreaname + BespeakDataset.Tables[0].Rows[0]["OFFICEADDRESS"].ToString();
                        htPara.Add("@科室位置", OfficeAddress);
                        htPara.Add("@科室", BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICENAME"].ToString());
                        htPara.Add("@医生", BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORNAME"].ToString());
                        htPara.Add("@排队号", BespeakDataset.Tables[0].Rows[0]["QUEUEID"].ToString());
                        htPara.Add("@预约号", BespeakDataset.Tables[0].Rows[0]["BESPEAKID"].ToString());
                        UMSMsgLib.UMSMsg.Instance.SendMsg(BespeakDataset.Tables[0].Rows[0]["TELEPHONE"].ToString(), "预约挂号", htPara);
                    }
                    catch (Exception ex)
                    {
                        Skynet.LoggingService.LogService.GlobalInfoMessage("预约成功后,发短信失败!" + ex.Message);
                    }
                }

                SkyComm.CloseWin(this);
            }
            catch (Exception ex)
            {
                MyAlert frm = new MyAlert(AlertTypeenum.信息, ex.Message);
                frm.ShowDialog();
            }
        }
        private void lblOK_Click(object sender, EventArgs e)
        {
            ucTime1.Sec = 60;
            ucTime1.timer1.Stop();


            if (SendCard.CheckCard() == "1")
            {
                SkyComm.ShowMessageInfo("该自助机没有卡,请在其他自助机上进行补卡操作!");
                ucTime1.timer1.Start();
                return;
            }
            this.lblOK.Enabled = false;
            //this.btnReturn.Enabled = false;
            this.btnExit.Enabled = false;
            //DataSet dsNewInfo = new DataSet();
            int     checkCount = 0;
            DataRow drCard     = ((DataView)this.gdvMain.DataSource).ToTable().NewRow();

            for (int i = 0; i < this.gdvMain.RowCount; i++)
            {
                if (Convert.ToBoolean(gdvMain.GetDataRow(i)["PITCHON1"].ToString()))
                {
                    drCard = gdvMain.GetDataRow(i);
                    checkCount++;
                }
            }
            if (checkCount == 0)
            {
                SkyComm.ShowMessageInfo("请选择一条卡信息进行补卡操作!");
                ucTime1.timer1.Start();
                eLCardAuthorizationData = new CardAuthorizationData();
                this.lblOK.Enabled      = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
                return;
            }
            else if (checkCount > 1)
            {
                SkyComm.ShowMessageInfo("只能选择一条卡信息进行补卡操作!");
                ucTime1.timer1.Start();
                eLCardAuthorizationData = new CardAuthorizationData();
                this.lblOK.Enabled      = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
                return;
            }

            if (SkyComm.eCardAuthorizationData != null && SkyComm.eCardAuthorizationData.Tables.Count != 0 && SkyComm.eCardAuthorizationData.Tables[0].Rows.Count != 0)
            {
                if (drCard["CARDID"].ToString() == SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString())
                {
                    SkyComm.ShowMessageInfo("不能对当前正在使用的就诊卡进行补卡操作!");
                    ucTime1.timer1.Start();
                    eLCardAuthorizationData = new CardAuthorizationData();
                    this.lblOK.Enabled      = true;
                    //this.btnReturn.Enabled = true;
                    this.btnExit.Enabled = true;
                    return;
                }
            }

            FrmYesNoAlert frmAlert = new FrmYesNoAlert();

            frmAlert.Title = "提示";
            frmAlert.Msg   = "是否确认对选择的卡信息进行补卡操作?         【卡号:" + drCard["CARDID"].ToString() + "】【姓名:" + drCard["PATIENTNAME"].ToString() + "】";
            if (frmAlert.ShowDialog() == DialogResult.Cancel)
            {
                this.ucTime1.timer1.Start();
                eLCardAuthorizationData = new CardAuthorizationData();
                this.lblOK.Enabled      = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
                return;
            }
            CardAuthorizationFacade eCardAuthorizationFacade = new CardAuthorizationFacade();

            using (WaitDialogForm form = new WaitDialogForm("正在发卡中,请稍候...", "正在组织发卡数据,请稍候......", new Size(240, 60)))
            {
                #region 补卡

                eLCardAuthorizationData = (CardAuthorizationData)eCardAuthorizationFacade.CancleAndReissueCard(drCard["ACCOUNT_ID"].ToString(), drCard["CARDID"].ToString(), SysOperatorInfo.OperatorID, drCard["CIRCUIT_STATE"].ToString());
                //写卡,如果失败则重试
                bool isSuccess = false;
                form.Caption = "正在写卡中,请稍候...";
                try
                {
                    for (int i = 0; i < 3; i++)
                    {
                        //第一次写卡
                        if (SendCard.WriteCard(eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString()) == false)
                        {
                            //第一次写卡失败,再进行第二次写卡
                            if (SendCard.WriteCard(eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString()) == false)
                            {
                                //第二次写卡失败以后将卡回收
                                SendCard.ReturnCard();
                            }
                            else
                            {
                                isSuccess = true;
                                break;
                            }
                        }
                        else
                        {
                            isSuccess = true;
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Skynet.LoggingService.LogService.GlobalInfoMessage("发卡失败:" + ex.Message);
                    SkyComm.ShowMessageInfo("发卡失败:" + ex.Message);
                    isSuccess = false;
                    //this.btnReturn.Enabled = true;
                    this.btnExit.Enabled = true;
                    this.lblOK.Enabled   = true;
                }

                //写卡失败
                if (isSuccess == false)
                {
                    //撤消已注销挂失并补卡的信息
                    //eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    eCardAuthorizationFacade.TranBackBussiness(drCard["ACCOUNT_ID"].ToString(), eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString(), drCard["CARDID"].ToString(), drCard["CIRCUIT_STATE"].ToString(), eLCardAuthorizationData);
                    SkynetMessage.MsgInfo("写卡失败,请在其他自助机上重试!");
                    this.lblOK.Enabled = true;
                    //this.btnReturn.Enabled = true;
                    this.btnExit.Enabled = true;
                    this.ucTime1.timer1.Start();
                    //第二次写卡失败以后将卡回收
                    SendCard.ReturnCard();
                    return;
                }
                #endregion
                form.Close();
            }
            #region 充值
            try
            {
                SkyComm.eCardAuthorizationData = eLCardAuthorizationData;//暂注释
                SkyComm.DiagnoseID             = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                SkyComm.cardInfoStruct.CardNo  = eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString();
                SkyComm.cardBlance             = 0;
                CardSavingFacade cf = new CardSavingFacade();
                SkyComm.cardallmoney = 0;

                int     Savingsucceed = 0;
                decimal RechargeMoney = 0;
                string  strModeType   = "现金";
                string  projectType   = SkyComm.getvalue("项目版本标识");
                if (!string.IsNullOrEmpty(projectType) && projectType == "锡林郭勒盟医院")
                {
                    //eLCardAuthorizationData.Tables[0].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_MODETYPE] = strModeType;
                    if (!eLCardAuthorizationData.Tables[0].Columns.Contains("OPERATORNAME"))
                    {
                        eLCardAuthorizationData.Tables[0].Columns.Add("OPERATORNAME");

                        eLCardAuthorizationData.Tables[0].Rows[0]["OPERATORNAME"] = SysOperatorInfo.OperatorName;
                    }
                    eCardAuthorizationFacade.updateEntity(eLCardAuthorizationData);
                    //eLCardAuthorizationData.Tables[0].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEY] = RechargeMoney;
                    Savingsucceed = 1;
                    //打印发卡凭证
                    PrintSendCardReport(eLCardAuthorizationData, drCard["PATIENTNAME"].ToString());
                }
                else
                {
                    try
                    {
                        //充值,弹出界面选择是现金充值还是银行卡预存
                        if (!string.IsNullOrEmpty(AutoHostConfig.PosInterfaceType))
                        {
                            FrmCardSavingMain frm = new FrmCardSavingMain();
                            frm.CallType = 2;
                            frm.ShowDialog();
                            Savingsucceed = frm.Savingsucceed;
                            RechargeMoney = frm.RechargeMoney;
                            strModeType   = frm.MODETYPE;
                            frm.Dispose();
                        }
                        else
                        {
                            //拍照
                            switch (AutoHostConfig.ReadCardType)
                            {
                            case "XUHUI":
                            case "XUHUIM1":
                                AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                                camera.TakeCamera(SkyComm.cardInfoStruct.CardNo, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString(), AutoHostConfig.Machineno);
                                break;

                            default:
                                break;
                            }

                            FrmCardSavingCash frm = new FrmCardSavingCash();
                            frm.CallType = 2;
                            frm.ShowDialog();
                            Savingsucceed = frm.Savingsucceed;
                            RechargeMoney = frm.RechargeMoney;
                            frm.Dispose();
                        }
                        if (Savingsucceed == 1)
                        {
                            eLCardAuthorizationData.Tables[0].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_MODETYPE] = strModeType;
                            if (!eLCardAuthorizationData.Tables[0].Columns.Contains("OPERATORNAME"))
                            {
                                eLCardAuthorizationData.Tables[0].Columns.Add("OPERATORNAME");

                                eLCardAuthorizationData.Tables[0].Rows[0]["OPERATORNAME"] = SysOperatorInfo.OperatorName;
                            }
                            eCardAuthorizationFacade.updateEntity(eLCardAuthorizationData);
                            eLCardAuthorizationData.Tables[0].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEY] = RechargeMoney;

                            //打印发卡凭证
                            PrintSendCardReport(eLCardAuthorizationData, drCard["PATIENTNAME"].ToString());
                        }
                    }
                    catch (Exception ex2)
                    {
                        Skynet.LoggingService.LogService.GlobalInfoMessage("补卡充值失败:" + ex2.Message);
                    }
                    finally
                    {
                        //SkyComm.cardInfoStruct = new CardInformationStruct();
                        //SkyComm.eCardAuthorizationData.Tables[0].Clear();
                        //SkyComm.DiagnoseID = string.Empty;
                        //SkyComm.cardBlance = 0;
                        //SkyComm.cardallmoney = 0;
                    }
                }
                if (Savingsucceed == 1)
                {
                    SendCard.OutputCard();

                    SkyComm.ShowMessageInfo("补卡成功,请取走您的就诊卡!");
                }
                else
                {
                    //撤消已注销挂失并补卡的信息
                    Skynet.LoggingService.LogService.GlobalInfoMessage("充值失败,撤消发卡信息");
                    //eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    DataSet dsCardAuthorizationData = (DataSet)eLCardAuthorizationData;
                    eCardAuthorizationFacade.TranBackBussiness(drCard["ACCOUNT_ID"].ToString(), eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString(), drCard["CARDID"].ToString(), drCard["CIRCUIT_STATE"].ToString(), eLCardAuthorizationData);
                    eLCardAuthorizationData = new CardAuthorizationData();
                    this.lblOK.Enabled      = true;
                    //this.btnReturn.Enabled = true;
                    this.btnExit.Enabled = true;

                    //发卡失败以后将卡进行回收
                    SendCard.ReturnCard();
                    ucTime1.timer1.Start();

                    return;
                }
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("发卡失败:" + ex.Message + ",系统回收卡机中的卡");

                //发卡失败以后将卡进行回收
                SendCard.ReturnCard();

                SkynetMessage.MsgInfo("发卡失败:" + ex.Message);
                ucTime1.timer1.Start();

                return;
            }
            finally
            {
                SkyComm.cardInfoStruct = new CardInformationStruct();
                SkyComm.eCardAuthorizationData.Tables[0].Clear();
                SkyComm.DiagnoseID   = string.Empty;
                SkyComm.cardBlance   = 0;
                SkyComm.cardallmoney = 0;

                this.lblOK.Enabled = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
            }
            #endregion

            SystemFramework.Voice.Voice voice = new SystemFramework.Voice.Voice();
            voice.PlayText("请在就诊卡出口取走您的就诊卡!");
            voice.EndJtts();
            ucTime1.timer1.Start();
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }