Esempio n. 1
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;
        }
Esempio n. 2
0
        private void lblOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date == DateTime.Now.Date) //如果预约时间为当天,则调用挂号方法,重新组织数据
                {
                    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_CARDID]        = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString();
                    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);

                    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();

                    //chenqiang 2017-03-09 add by Case:27423
                    if ("1" == SystemInfo.SystemConfigs["挂号、预约限制条件"].DefaultValue && isRegContr == "1")
                    {
                        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;
                        }
                        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;
                        }
                    }

                    //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;
                    }
                    string ss = SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue.ToString();

                    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 (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;
                        }
                        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;
                        }
                    }
                    //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]["OPERATEDATE"].ToString()).Date) > 0)
                    {
                        MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号");
                        registerInfo.ShowDialog();
                        return;
                    }
                    //chenqiang add by 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 by case:33511
                    if (SystemInfo.SystemConfigs["是否启用号源云平台接口"].DefaultValue != "0")
                    {
                        if (arrangeSource == "1" && Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date != new CommonFacade().GetServerDateTime().Date)
                        {
                            RegisterClouldInterface theRegisterClouldInterface = new RegisterClouldInterface();
                            int intResult = theRegisterClouldInterface.BespeakRegisteInfo(BespeakDataset);
                            if (intResult < 0)
                            {
                                bespeakFac.CancelBespeak(BespeakDataset.Tables[0].Rows[0]["BESPEAKID"].ToString());
                                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();
            }
        }