Пример #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            backgroundWorker1.RunWorkerAsync();
            if (MoneyServer.OpenPort(SkyComm.cardInfoStruct.CardNo) == true)
            {
                //拍照
                switch (AutoHostConfig.ReadCardType)
                {
                case "XUHUI":
                case "XUHUIM1":
                    AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                    camera.TakeCameraStart(SkyComm.cardInfoStruct.CardNo, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString(), AutoHostConfig.Machineno);

                    camera.DoorLightOpen(LightTypeenum.纸币器, LightOpenTypeenum.闪烁);
                    break;

                default:
                    break;
                }

                ucTime1.timer1.Stop();
                btnStart.Enabled = false;
                lblTime.Visible  = true;
                timer1.Start();
                timer2.Start();
                this.timer3.Start();
                this.btnClose.Enabled = false;
                this.btnExit.Enabled  = false;
            }
            else
            {
                SkynetMessage.MsgInfo("钞箱设置没有初始化失败,请在窗口充值或者银行卡充值!");
            }
        }
Пример #2
0
        //挂号
        public bool Register(int dataindex, bool iszhuanjia)//挂号(专家)
        {
            try
            {
                if (Settings.Default.运行模式 == "RUN")
                {
                    LogService.GlobalInfoMessage("调用挂号存储过程");
                    SkyComm skyComm = new SkyComm();
                    skyComm.Register(FrmMain.cardInfoStruct.CardNo, officeID, dt.Rows[dataindex - 1]["医生编号"].ToString(), Convert.ToDecimal(dt.Rows[dataindex - 1]["挂号金额"]));
                }

                MyMsg.MsgInfo("恭喜您已挂号成功,请取走您的就诊卡!");

                #region 打印

                //Print cp = new Print();
                //cp.PrintRegister("李新华");
                #endregion
            }
            catch (Exception ex)
            {
                SkynetMessage.MsgInfo(ex.Message);
                return(false);
            }

            return(true);
        }
Пример #3
0
        /// <summary>
        /// 打印自助挂号
        /// </summary>
        private void PrintReport(DataSet ds)
        {
            ds.WriteXml(Application.StartupPath + @"\\ReportXml\\自助挂号" + ds.Tables[0].Rows[0]["REGISTERID"].ToString() + ".xml");
            string path = Application.StartupPath + @"\\Reports\\自助挂号.frx";

            if (System.IO.File.Exists(path) == false)
            {
                SkynetMessage.MsgInfo("自助挂号票据不存在,请联系管理员!");
                return;
            }
            //Common_XH theCamera_XH = new Common_XH();
            //theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
            PrintManager print = new PrintManager();

            print.InitReport("自助挂号");
            print.AddParam("医院名称", SysOperatorInfo.CustomerName);
            print.AddParam("姓名", SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString());
            print.AddParam("卡余额", SkyComm.cardBlance);
            print.AddParam("操作员", SysOperatorInfo.OperatorCode);
            print.AddParam("操作员姓名", SysOperatorInfo.OperatorName);
            print.AddData(ds.Tables[0], "report");
            PrintManager.CanDesign = false;
            //print.PreView();
            print.Print();
            print.Dispose();
            Thread.Sleep(100);
        }
Пример #4
0
        public static bool Init()
        {
            BusinessFacade.His.Common.CommonFacade cf = new BusinessFacade.His.Common.CommonFacade();
            cf.RemotingLogin();
            int zone = cf.GetServerDateZone();

            LogService.GlobalDebugMessage("时区:" + zone);
            Skynet.Framework.Common.TimeSync.SyncTime(cf.GetServerDateTime(), zone);

            UpdateSystemConfig();

            //return true;
            //初始化硬件
            switch (AutoHostConfig.ReadCardType)
            {
            case "XUHUI":
                //Thread.Sleep(200);
                StringBuilder sbinput   = new StringBuilder("<invoke name=\"READCARDALLOWCARDIN\"><arguments></arguments></invoke>");
                string        strResult = AutoServiceSDK.SDK.XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp允许进卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                break;

            default:
                break;
            }

            //卡类型
            CardTypesFacade cardTypesFacade = new CardTypesFacade();

            dsCardType = cardTypesFacade.FindByTypeName(SkyComm.getvalue("发卡卡类型"));
            if (dsCardType == null || dsCardType.Tables[0].Rows.Count == 0)
            {
                SkynetMessage.MsgInfo("发卡机的卡类型维护不正确,请与管理员联系!");
            }

            //费用类别
            ChargeKindFacade cktype = new ChargeKindFacade();

            FeeType = SkyComm.getvalue("发卡费用类别");
            DataSet dscktype = cktype.FindChargeKindByName(SkyComm.getvalue("发卡费用类别"));

            if (dscktype.Tables[0].Rows.Count < 0)
            {
                SkynetMessage.MsgInfo("发卡机的卡类型维护不正确,请与管理员联系!");
            }
            else
            {
                FeeTypeID = dscktype.Tables[0].Rows[0]["CHARGEKINDID"].ToString();
            }

            //获取银行卡预存,现金预存的配置
            AddMoneyCashMode = SkyComm.getvalue("现金预存充值方式");
            AddMoneyPosMode  = SkyComm.getvalue("银行预存充值方式");
            return(login());
        }
Пример #5
0
        private void PrintInfo(string ReportName, string strTRANSACTION_ID, string Money, string advanceid)
        {
            try
            {
                MoneyTransferPresenter moneyTransferPresenter = new MoneyTransferPresenter();



                //CardSavingFacade cardSavingFacade = new CardSavingFacade();
                //DataSet cardSavingData = cardSavingFacade.FindByPrimaryKey(strTRANSACTION_ID);
                if (inHosData.Tables[0].Rows.Count > 0)
                {
                    moneyTransferPresenter.addDatas(inHosData, advanceid, "现金");
                    inHosData.WriteXml(Application.StartupPath + @"\\ReportXml\\" + ReportName + SkyComm.DiagnoseID + "_" + strTRANSACTION_ID + ".xml");
                    if (!File.Exists(Application.StartupPath + @"\\Reports\\" + ReportName + ".frx"))
                    {
                        SkynetMessage.MsgInfo(ReportName + ".frx报表文件不存在,无法打印.");
                        return;
                    }
                    decimal old_YE  = Convert.ToDecimal(inHosData.Tables[0].Rows[0]["BALANCEMONEY"].ToString());
                    decimal reMoney = Convert.ToDecimal(Money);

                    //Common_XH theCamera_XH = new Common_XH();
                    //theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
                    PrintManager print = new PrintManager();
                    print.InitReport(ReportName);
                    print.AddParam("医院名称", SysOperatorInfo.CustomerName);
                    print.AddParam("收据号", strTRANSACTION_ID);
                    print.AddParam("姓名", SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString());
                    print.AddParam("预交金余额", (old_YE + reMoney).ToString("0.00##"));
                    print.AddParam("充值金额", Money);
                    print.AddParam("操作员", SysOperatorInfo.OperatorCode);
                    print.AddParam("操作员姓名", SysOperatorInfo.OperatorName);
                    print.AddData(inHosData.Tables[0], "report");

                    //PrintManager.CanDesign = true;

                    print.Print();
                    print.Dispose();
                    Thread.Sleep(100);
                }
            }
            catch (Exception lex)
            {
                if (lex.Message.IndexOf("灾难性") > 0)
                {
                    SkynetMessage.MsgInfo(lex.Message + ": 打印机连接失败,请检查!");
                }
                else
                {
                    SkynetMessage.MsgInfo(lex.Message);
                }
            }
        }
Пример #6
0
        private void PrintInfo(string ReportName, string strTRANSACTION_ID, string Money)
        {
            try
            {
                CardAuthorizationData   eCardAuthorizationData   = new CardAuthorizationData();
                CardAuthorizationFacade eCardAuthorizationFacade = new CardAuthorizationFacade();
                eCardAuthorizationData = (CardAuthorizationData)eCardAuthorizationFacade.SelectPatientAndCardInfoByCardID(SkyComm.cardInfoStruct.CardNo);
                string           identity         = eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_IDENTITYCARD].ToString();
                CardSavingFacade cardSavingFacade = new CardSavingFacade();
                DataSet          cardSavingData   = cardSavingFacade.FindByPrimaryKey(strTRANSACTION_ID);

                cardSavingData.Tables[0].Columns.Add("身份证", typeof(string));

                if (cardSavingData.Tables[0].Rows.Count > 0)
                {
                    cardSavingData.Tables[0].Rows[0]["身份证"] = identity;
                    cardSavingData.WriteXml(Application.StartupPath + @"\\ReportXml\\" + ReportName + SkyComm.DiagnoseID + "_" + strTRANSACTION_ID + ".xml");
                    if (!File.Exists(Application.StartupPath + @"\\Reports\\" + ReportName + ".frx"))
                    {
                        SkynetMessage.MsgInfo(ReportName + ".frx报表文件不存在,无法打印.");
                        return;
                    }
                    PrintManager print = new PrintManager();
                    print.InitReport(ReportName);
                    print.AddParam("医院名称", SysOperatorInfo.CustomerName);
                    print.AddParam("收据号", strTRANSACTION_ID);
                    print.AddParam("姓名", SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString());
                    print.AddParam("卡余额", SkyComm.cardBlance);
                    print.AddParam("充值金额", Money);
                    print.AddParam("操作员", SysOperatorInfo.OperatorCode);
                    print.AddParam("操作员姓名", SysOperatorInfo.OperatorName);
                    print.AddData(cardSavingData.Tables[0], "report");

                    PrintManager.CanDesign = true;

                    print.Print();
                    print.Dispose();
                    Thread.Sleep(100);
                }
            }
            catch (Exception lex)
            {
//                if (lex.Message.IndexOf("灾难性") > 0)
//                {
//                    SkynetMessage.MsgInfo(lex.Message + ": 打印机连接失败,请检查!");
//                }
//                else
//                {
//                    SkynetMessage.MsgInfo(lex.Message);
//                }
            }
        }
Пример #7
0
 private void FrmRecharge_Load(object sender, EventArgs e)
 {
     if (FrmMain.patientInfoData != null && FrmMain.patientInfoData.Tables[0].Rows.Count > 0)
     {
         this.lblName.Text   = FrmMain.patientInfoData.Tables[0].Rows[0]["XingMing"] == null ? "" : FrmMain.patientInfoData.Tables[0].Rows[0]["XingMing"].ToString();
         this.lblAge.Text    = "";// FrmMain.patientInfoData.Tables[0].Rows[0]["AGE"] == null ? "" : FrmMain.patientInfoData.Tables[0].Rows[0]["AGE"].ToString();
         this.lblcardNo.Text = FrmMain.patientInfoData.Tables[0].Rows[0]["ShenFenZheng"] == null ? "" : FrmMain.patientInfoData.Tables[0].Rows[0]["ShenFenZheng"].ToString();
         this.lblMoney.Text  = FrmMain.patientInfoData.Tables[0].Rows[0]["LeftJinE"] == null ? "" : FrmMain.patientInfoData.Tables[0].Rows[0]["LeftJinE"].ToString();
     }
     else
     {
         SkynetMessage.MsgInfo("病人信息不存在!");
         this.Close();
         return;
     }
 }
        private void PrintInfo(string ReportName, string strTRANSACTION_ID, string Money)
        {
            try
            {
                CardSavingFacade cardSavingFacade = new CardSavingFacade();
                DataSet          cardSavingData   = cardSavingFacade.FindByPrimaryKey(strTRANSACTION_ID);
                if (cardSavingData.Tables[0].Rows.Count > 0)
                {
                    cardSavingData.WriteXml(Application.StartupPath + @"\\ReportXml\\" + ReportName + SkyComm.DiagnoseID + "_" + strTRANSACTION_ID + ".xml");
                    if (!File.Exists(Application.StartupPath + @"\\Reports\\" + ReportName + ".frx"))
                    {
                        SkynetMessage.MsgInfo(ReportName + ".frx报表文件不存在,无法打印.");
                        return;
                    }
                    //Common_XH theCamera_XH = new Common_XH();
                    //theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
                    PrintManager print = new PrintManager();
                    print.InitReport(ReportName);
                    print.AddParam("医院名称", SysOperatorInfo.CustomerName);
                    print.AddParam("收据号", strTRANSACTION_ID);
                    print.AddParam("姓名", SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString());
                    print.AddParam("卡余额", SkyComm.cardBlance);
                    print.AddParam("充值金额", Money);
                    print.AddParam("操作员", SysOperatorInfo.OperatorCode);
                    print.AddParam("操作员姓名", SysOperatorInfo.OperatorName);
                    print.AddData(cardSavingData.Tables[0], "report");

                    PrintManager.CanDesign = true;

                    print.Print();
                    print.Dispose();
                    Thread.Sleep(100);
                }
            }
            catch (Exception lex)
            {
                if (lex.Message.IndexOf("灾难性") > 0)
                {
                    SkynetMessage.MsgInfo(lex.Message + ": 打印机连接失败,请检查!");
                }
                else
                {
                    SkynetMessage.MsgInfo(lex.Message);
                }
            }
        }
        public FrmCardSavingCash()
        {
            InitializeComponent();

            switch (AutoHostConfig.CashBoxType)
            {
            case "XUHUIMEI":
                MoneyServer = new CashCodeMoney_XH();
                break;

            default:
                SkynetMessage.MsgInfo("纸币器的配置不正确,请与管理员联系!");
                //MoneyServer = new CashMoneyTest();
                break;
            }
            btnEnd.Enabled  = false;
            lblTime.Visible = false;
        }
Пример #10
0
 //确认
 private void lblOK_Click(object sender, EventArgs e)
 {
     //MyAlert m = new MyAlert();
     //m.alerttype = "确认取消";
     //m.Msg = String.Format("本次充值金额:{0}元\n请核对您的充值金额是否正确?",sum.ToString ());
     //if (m.ShowDialog() == DialogResult.Cancel)
     //{
     //    return;
     //}
     this.timer1.Stop();
     try
     {
         backgroundWorker2.RunWorkerAsync();
     }
     catch (Exception ex)
     {
         SkynetMessage.MsgInfo(ex.Message);
         return;
     }
     //调用充值业务
 }
        private void PrintSendCardReport(DataSet eLCardAuthorizationData, string patientName)
        {
            eLCardAuthorizationData.WriteXml(Application.StartupPath + @"\\ReportXml\\自助发卡凭证" + eLCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString() + ".xml");
            string path = Application.StartupPath + @"\\Reports\\自助发卡凭证.frx";

            if (System.IO.File.Exists(path) == false)
            {
                SkynetMessage.MsgInfo("自助发卡凭证不存在,请联系管理员!");
                return;
            }
            Skynet.LoggingService.LogService.GlobalInfoMessage("打印发卡证证");

            decimal decYJ = 0;
            string  stryj = SkyComm.getvalue("发卡工本费");

            if (string.IsNullOrEmpty(stryj) || stryj == "0")
            {
                decYJ = Convert.ToDecimal(SkyComm.dsCardType.Tables[0].Rows[0]["FEES"].ToString());
            }
            else
            {
                decYJ = Convert.ToDecimal(stryj);
            }

            //Common_XH theCamera_XH = new Common_XH();
            //theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
            PrintManager print = new PrintManager();

            print.InitReport("自助发卡凭证");
            print.AddParam("医院名称", SysOperatorInfo.CustomerName);
            print.AddParam("姓名", patientName);
            print.AddParam("卡押金", decYJ);
            print.AddParam("操作员", SysOperatorInfo.OperatorCode);
            print.AddParam("操作员姓名", SysOperatorInfo.OperatorName);
            print.AddData(eLCardAuthorizationData.Tables[0], "report");
            //PrintManager.CanDesign = true;
            print.Print();
            print.Dispose();
            Thread.Sleep(100);
        }
Пример #12
0
        //开始充值
        private void lblOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(FrmMain.cardInfoStruct.CardNo))
            {
                MyMsg.MsgInfo("请刷卡进入!");
                this.Close();
                return;
            }
            if (backgroundWorker1.IsBusy)
            {
                SkynetMessage.MsgInfo("业务处理中,请稍候。。。");
                return;
            }
            //ReckonAccountTimeFacade reckonAccountsTimeFacade = new ReckonAccountTimeFacade();
            //DateTime accountTime = reckonAccountsTimeFacade.GetEndTime(SysOperatorInfo.OperatorID, "门诊");
            //if (DateTime.Now < accountTime)
            //{
            //    SkynetMessage.MsgInfo("该时间段已经结帐,不能办理预交金业务,请重试!");
            //    return;
            //}
            //if (FrmMain.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows.Count <= 0)
            //{
            //    SkynetMessage.MsgInfo("此操作没有找到所要充值的卡信息!");
            //    return;
            //}
            MyAlert m = new MyAlert();

            m.alerttype = "开始充值";
            if (m.ShowDialog() == DialogResult.OK)
            {
                this.backgroundWorker1.RunWorkerAsync();
            }
            else
            {
                //退卡
                this.Close();
            }
        }
Пример #13
0
        private void BeginPay(Hashtable htParams)
        {
            String strErrorMsg = string.Empty;

            try
            {
                #region 组织请求入参
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic.Add("TransCode", "01");
                dic.Add("TransMoney", CheckMoney(htParams, "MONEY"));
                dic.Add("TransNo", PadRight("", 6));
                dic.Add("MachineID", PadRight("", 10));
                dic.Add("OperatorID", PadRight(SysOperatorInfo.OperatorID, 10));
                dic.Add("ReferenceNo", PadRight("", 15));
                dic.Add("AuthNo", PadRight("", 6));
                dic.Add("OldTransDate", PadRight("", 8));
                dic.Add("CardType", "H");
                dic.Add("IndexNo", PadRight(htParams["POSNO"].ToString(), 76));
                dic.Add("Track2", PadRight("", 37));
                dic.Add("Track3", PadRight("", 104));
                dic.Add("OldTransCode", PadRight("", 2));
                dic.Add("OldTerminalID", PadRight("", 15));
                dic.Add("OldAuthNo", PadRight("", 15));
                dic.Add("PayAccountID", PadRight("", 3));
                dic.Add("StoreID", PadRight("", 20));
                dic.Add("ReceiptID", PadRight("", 30));
                dic.Add("OrderID", PadRight("", 15));
                dic.Add("OldBatchNo", PadRight("", 6));
                dic.Add("OldTransTime", PadRight("", 6));
                dic.Add("OldTransMoney", PadRight("", 12));
                dic.Add("ServerIP", PadRight("", 15));
                dic.Add("ListenPort", PadRight("", 6));
                string strInput = dic.GetValueString();
                #endregion

                #region 平台接口调用
                LogService.GlobalInfoMessage("消费交易调用入参:" + strInput);
                StringBuilder sb = new StringBuilder(1000);
                //int iResult = SingleeMethods.CardTransCBK(strInput, sb, new SingleeMethods.EnterPasswordCallBack(EnterPasswordHandler), frmPwd.Handle);
                int    iResult   = SingleeMethods.CardTransDllWin(strInput, sb);
                string strOutput = sb.ToString();
                LogService.GlobalInfoMessage("消费交易调用出参:" + strOutput);
                #endregion

                #region 解析请求出参

                byte[] bytes   = System.Text.Encoding.Default.GetBytes(strOutput);
                string retCode = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 0, 6));
                string retMsg  = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 6, 40));

                #endregion

                #region 交易结果处理
                if (retCode == "000000")
                {
                    string transNo          = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 46, 6));
                    string authNo           = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 52, 6));
                    string batchNo          = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 58, 6));
                    string bankCardID       = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 64, 19));
                    string expDate          = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 83, 4));
                    string bankNo           = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 87, 2));
                    string referenceNo      = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 89, 12));
                    string terminalNo       = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 101, 15));
                    string merchantID       = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 116, 15));
                    string transMoney       = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 131, 12));
                    string indexNo          = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 143, 16));
                    string customField      = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 159, 74));
                    string sendCardBankCode = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 234, 7));
                    string bankDate         = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 241, 8));
                    string bankTime         = System.Text.Encoding.Default.GetString(SingleeMethods.SubByte(bytes, 249, 6));

                    #region 交易成功
                    LogService.GlobalInfoMessage("消费交易调用成功。" + retMsg);

                    #region 广播出参
                    htParams.Add("REFERENCENO", referenceNo);
                    htParams.Add("BANKCARDID", bankCardID);
                    htParams.Add("BANKSEQNO", transNo);
                    #endregion


                    #region 把交易数据写入数据库
                    string seqNo      = htParams["SEQNO"].ToString();
                    string diagnoseID = htParams["DIAGNOSEID"].ToString();
                    string cardID     = htParams["CARDID"].ToString();

                    //string strDateTime = DateTime.Now.ToString();
                    //if (!string.IsNullOrEmpty(bankDate.Trim()))
                    //{
                    //    strDateTime=bankDate.Substring(0, 4) + "-" + bankDate.Substring(4, 2) + "-" + bankDate.Substring(6, 2) + " " + bankTime.Substring(0, 2) + ":" + bankTime.Substring(2, 2) + ":" + bankTime.Substring(4, 2);

                    //}
                    //DateTime payDateTime = Convert.ToDateTime(strDateTime);
                    try
                    {
                        DateTime dtn;
                        string   strDate = string.Empty;
                        if (!string.IsNullOrEmpty(bankDate.Trim()))
                        {
                            strDate = bankDate.Substring(0, 4) + "-" + bankDate.Substring(4, 2) + "-" + bankDate.Substring(6, 2) + " " + bankTime.Substring(0, 2) + ":" + bankTime.Substring(2, 2);
                        }
                        DateTime payDateTime = DateTime.TryParse(strDate, out dtn) ? dtn : DateTime.Now;

                        decimal payMoney = decimal.Parse(transMoney.TrimStart('0'));

                        TBankhisexchangeTransData dataPayment = new TBankhisexchangeTransData()
                        {
                            InterfaceName = "锡盟新利银医接口",
                            Hisseqno      = seqNo,
                            Hisstate      = "0",
                            Bankseqno     = transNo,
                            Bankstate     = "1",
                            DIAGNOSEID    = diagnoseID,
                            Hisid         = cardID,
                            Usetype       = "消费",
                            DataSources   = "自助",
                            BusinessType  = "POS扣款",
                            Operatorid    = SysOperatorInfo.OperatorID,
                            Operatetime   = payDateTime,
                            TerminalNo    = terminalNo,
                            Trfamt        = payMoney.ToString("0.##"),
                            ITEM1         = bankCardID,
                            ITEM2         = batchNo,
                            ITEM3         = string.Empty,
                            Ohisseqno     = referenceNo,
                            MerchantID    = merchantID,
                        };

                        TBankhisexchangeTransFacade facBankTrans = new TBankhisexchangeTransFacade();
                        facBankTrans.Insert(dataPayment);
                        LogService.GlobalInfoMessage("消费交易数据保存完成。");
                    }
                    catch (Exception ex)
                    {
                        LogService.GlobalInfoMessage("消费交易数据保存失败");
                        #region 打印交易凭证
                        //PrintInfo(htParams);
                        SkynetMessage.MsgInfo("预交金充值失败,需要撤销银行交易,请按POS机提示操作,点击确定后,请重新插入银行卡");
                        Revoke(htParams);
                        #endregion
                        //throw new Exception(string.Format("消费交易数据保存失败!已调用撤销方法!,错误:{0}",ex.Message));
                        throw new Exception(string.Format("银行交易失败,充值金额已退回卡,请重新充值!"));
                    }

                    #endregion
                    #endregion
                }
                #region 交易失败
                else if (retCode == "C41003")
                {
                    strErrorMsg = "取消交易,请重新操作!";
                }
                else if (retCode == "C85006")
                {
                    strErrorMsg = "密码错误,请重新操作!";
                }
                else if (retCode == "C40006")
                {
                    strErrorMsg = "读卡错误,请检查卡片是否插错!";
                }
                else if (retCode == "C99999")
                {
                    strErrorMsg = "银行卡余额不足,交易失败!";
                }
                else
                {
                    strErrorMsg = string.Format("消费交易调用失败:{0}", retMsg);
                }
                if (!string.IsNullOrEmpty(strErrorMsg))
                {
                    LogService.GlobalInfoMessage(strErrorMsg);
                    //SkynetMessage.MsgInfo(strErrorMsg);

                    //Voice voice = new Voice();
                    //voice.PlayText(strErrorMsg);
                    //voice.EndJtts();
                    throw new Exception(strErrorMsg);
                }
                #endregion
                #endregion
            }
            catch (Exception e)
            {
                LogService.GlobalInfoMessage(e.Message);
                //SkynetMessage.MsgInfo(e.Message);
                throw new Exception(string.Format("{0}", e.Message));
            }
        }
        private void PrintInfo(string ReportName, string strTRANSACTION_ID, string Money, string advanceID, string HisSeqNo)
        {
            try
            {
                MoneyTransferPresenter moneyTransferPresenter = new MoneyTransferPresenter();

//                DataSet dataSet = moneyTransferPresenter.getBankInfo(SkyComm.DiagnoseID);

                if (inHosData.Tables[0].Rows.Count > 0)
                {
                    moneyTransferPresenter.addDatas(inHosData, advanceID, "银行卡");
                    inHosData.WriteXml(Application.StartupPath + @"\\ReportXml\\" + ReportName + SkyComm.DiagnoseID + "_" + strTRANSACTION_ID + ".xml");
                    if (!File.Exists(Application.StartupPath + @"\\Reports\\" + ReportName + ".frx"))
                    {
                        SkynetMessage.MsgInfo(ReportName + ".frx报表文件不存在,无法打印.");
                        return;
                    }
                    decimal old_YE  = Convert.ToDecimal(inHosData.Tables[0].Rows[0]["BALANCEMONEY"].ToString());
                    decimal reMoney = Convert.ToDecimal(Money);
                    //Common_XH theCamera_XH = new Common_XH();
                    //theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
                    PrintManager print = new PrintManager();
                    print.InitReport(ReportName);
                    print.AddParam("医院名称", SysOperatorInfo.CustomerName);
                    print.AddParam("收据号", strTRANSACTION_ID);
                    print.AddParam("姓名", SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString());
                    print.AddParam("预交金余额", (old_YE + reMoney).ToString("0.00##"));
                    print.AddParam("充值金额", Money);
                    print.AddParam("操作员", SysOperatorInfo.OperatorCode);
                    print.AddParam("操作员姓名", SysOperatorInfo.OperatorName);

                    if (AutoHostConfig.PosInterfaceType.Equals("锡盟新利"))//锡盟新利增加输出参数
                    {
                        //锡盟自助机打印增加哦交易参考号
                        DataSet dataSet = moneyTransferPresenter.getBankInfo(SkyComm.DiagnoseID, HisSeqNo);
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            print.AddParam("交易参考号", (dataSet.Tables[0]).Rows[0]["OHISSEQNO"].ToString());
                        }
                    }
                    print.AddData(inHosData.Tables[0], "report");

                    //PrintManager.CanDesign = true;

                    print.Print();
                    print.Dispose();
                    Thread.Sleep(100);
                }
            }
            catch (Exception lex)
            {
                if (lex.Message.IndexOf("灾难性") > 0)
                {
                    SkynetMessage.MsgInfo(lex.Message + ": 打印机连接失败,请检查!");
                }
                else
                {
                    SkynetMessage.MsgInfo(lex.Message);
                }
            }
        }
Пример #15
0
        private static bool login()
        {
            string      HostName  = Dns.GetHostName();
            IPHostEntry hostEntry = Dns.GetHostByName(HostName);
            string      IpAddress = hostEntry.AddressList[0].ToString();

            //通过计算机名和IP地址查询自助机信息表的相关配置
            AutoServiceMachineInfoFacade AutoServiceFac  = new AutoServiceMachineInfoFacade();
            AutoServiceMachineInfoData   AutoServiceData = AutoServiceFac.GetByIPAddressHostName(IpAddress, HostName);

            if (AutoServiceData == null)
            {
                SkynetMessage.MsgInfo("该自助机IP地址和计算名没有登记,请与管理员联系!");
                return(false);
            }
            if (AutoServiceData.Stopflag == 1)
            {
                SkynetMessage.MsgInfo("该自助机已被停用,不能正常使用");
                return(false);
            }
            AutoHostConfig.SendCardType = AutoServiceData.Sendcardtype;
            AutoHostConfig.SendCardPort = AutoServiceData.Sendcardport;
            AutoHostConfig.ReadCardType = AutoServiceData.Readcardtype;

            LogService.GlobalInfoMessage("读卡机类型:" + AutoServiceData.Readcardtype);

            AutoHostConfig.ReadCardPort = AutoServiceData.Readcardport;

            AutoHostConfig.CashBoxType      = AutoServiceData.Cashboxtype;
            AutoHostConfig.CashBoxPort      = AutoServiceData.Cashboxport;
            AutoHostConfig.IDCardType       = AutoServiceData.Idcardtype;
            AutoHostConfig.IDCardPort       = AutoServiceData.Idcardport;
            AutoHostConfig.MachineType      = AutoServiceData.Machinetype;
            AutoHostConfig.Machineno        = AutoServiceData.Machineno;
            AutoHostConfig.PosInterfaceType = AutoServiceData.PosInterfaceType;
            AutoHostConfig.PosNo            = AutoServiceData.PosNo;
            AutoHostConfig.BankName         = AutoServiceData.BankName;
            AutoHostConfig.ClosePassword    = AutoServiceData.Closepassword;
            AutoHostConfig.OpenDoorPassword = AutoServiceData.Opendoorpassword;


            //登陆HIS操作系统
            OperatorFacade operatorFacade = new OperatorFacade();
            DataSet        opds           = operatorFacade.GetLoginOperatorInfo(AutoServiceData.Operatorcodeno);

            if (opds.Tables[0].Rows.Count == 0)
            {
                SkynetMessage.MsgInfo("自助机对应的用户在系统中找不到!");
                return(false);
            }

            //根据查询的结果给AutoHostConfig中变量赋值,保存操作员的相关信息,以及设备的相关信息
            DataRow OperatorRow = opds.Tables[0].Rows[0];

            SysOperatorInfo.OperatorID       = OperatorRow["OPERATORID"].ToString();
            SysOperatorInfo.OperatorCode     = AutoServiceData.Operatorcodeno;
            SysOperatorInfo.OperatorName     = OperatorRow["OPERATORNAME"].ToString();
            SysOperatorInfo.OperatorWorkkind = OperatorRow["WORKKIND"].ToString();
            SysOperatorInfo.UserID           = OperatorRow["USERID"].ToString();

            SysOperatorInfo.OperatorOfficeID = OperatorRow["OFFICEID"].ToString();
            DataSet dsofficeArea = new OfficeFacade().FindHospitalAreaInfoByOfficeID(SysOperatorInfo.OperatorOfficeID);

            if (dsofficeArea.Tables.Count > 0 && dsofficeArea.Tables[0].Rows.Count > 0)
            {
                SysOperatorInfo.OperatorAreaid   = dsofficeArea.Tables[0].Rows[0]["AREAID"].ToString();
                SysOperatorInfo.OperatorAreaname = dsofficeArea.Tables[0].Rows[0]["AREANAME"].ToString();
            }
            else
            {
                SysOperatorInfo.OperatorAreaid   = string.Empty;
                SysOperatorInfo.OperatorAreaname = string.Empty;
            }

            OfficeAttachFacade officeAttachFacade = new OfficeAttachFacade();

            SysOperatorInfo.CustomerName = officeAttachFacade.GetCustomName();

            return(true);
        }
Пример #16
0
        /// <summary>
        ///chenqiang 2018.04.20 add by Case:31026   打印电子健康卡二维码
        /// </summary>
        /// <param name="imgData">电子健康卡二维码base64数据</param>
        private void printVirtualCard(HealthCardInfoStruct Entity)

        {
            try
            {
                string       path  = Application.StartupPath + @"\\Reports\\电子卡二维码.frx";
                PrintManager print = new PrintManager();
                if (System.IO.File.Exists(path) == true)
                {
                    using (PrintManager report = new PrintManager())
                    {
                        DataTable dtQRCode = new DataTable("reportQR");
                        if (Entity.imgData != "" && Entity.imgData != null)
                        {
                            byte[] bytesImg = Convert.FromBase64String(Entity.imgData);//字符串转换为字节
                            dtQRCode.Columns.Add("QRCode", typeof(byte[]));
                            DataRow drQrCode = dtQRCode.NewRow();
                            drQrCode["QRCode"] = bytesImg;
                            dtQRCode.Rows.Add(drQrCode);
                        }
                        else
                        {
                            dtQRCode.Columns.Add("QRCode", typeof(string));
                            DataRow drQrCode = dtQRCode.NewRow();
                            drQrCode["QRCode"] = Entity.QRCode;
                            dtQRCode.Rows.Add(drQrCode);
                        }
                        string cardType = string.Empty;
                        if (Entity.QRCode.IndexOf("EH") == 0)
                        {
                            cardType = "1";
                        }
                        else if (Entity.QRCode.IndexOf("EM") == 0)
                        {
                            cardType = "2";
                        }
                        else
                        {
                            cardType = "0";
                        }
                        print.InitReport("电子卡二维码");
                        print.AddParam("二维码", Entity.QRCode);
                        print.AddDataSet(dtQRCode, "电子卡二维码");
                        print.AddVariable("姓名", IdInfo.Name);
                        print.AddVariable("性别", IdInfo.Sex);
                        print.AddVariable("年龄", "");
                        print.AddVariable("出生日期", IdInfo.Birthday);
                        string idNumber = IdInfo.Number;
                        print.AddVariable("身份证号", idNumber);
                        print.AddVariable("卡类型", cardType);
                        PrintManager.CanDesign = true;
                        //print.PreView();
                        print.Print();
                        print.Dispose();
                    }
                }
                else
                {
                    SkynetMessage.MsgInfo("系统没有找到报表文件“电子卡二维码.frx”!");
                }
            }
            catch (Exception lex)
            {
                if (lex.Message.IndexOf("灾难性") > 0)
                {
                    SkynetMessage.MsgInfo(lex.Message + ": 打印机连接失败,请检查!");
                }
                else
                {
                    SkynetMessage.MsgInfo(lex.Message);
                }
            }
        }
Пример #17
0
        /// <summary>
        /// 电子卡注册签约条件判断
        /// </summary>
        /// <returns></returns>
        private bool cardRegulation(out string cardType, out string cardTypeId)
        {
            getElectronicCardType(out cardType, out cardTypeId);



            DateTime GetServerDateTime = new CommonFacade().GetServerDateTime();


            if (!CheckLicenseConfi())
            {
                return(false);
            }                                          //his内部发卡条件判断
            if (cardType == "2")
            {
                return(true);
            }
            PatientInfoFacade pfacade            = new PatientInfoFacade();
            string            electronicCardType = SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue;

            if (electronicCardType == "0")
            {
                #region  验证该患者是否已有院内卡
                string ConditionStr = cardType == "0" ? " AND A.IDENTITYCARD='" + IdInfo.Number + "' " : " AND A.GUARDIANIDNUMBER='" + IdInfo.Number + "' ";
                ConditionStr += " AND A.PATIENTNAME='" + IdInfo.Name + "' AND B.CIRCUIT_STATE IN (0,1)  ORDER BY  A.DIAGNOSEID DESC ";
                DataSet dsState = pfacade.FindCardPatientinfoByCondition(ConditionStr);
                if (dsState.Tables.Count > 0 && dsState.Tables[0].Rows.Count > 0)//已办理院内卡
                {
                    if (dsState.Tables[0].Rows[0]["CARDTYPENAME"].ToString() != "身份证" && cardType == "0")
                    {
                        SkynetMessage.MsgInfo("患者[" + IdInfo.Name + "]已于" + Convert.ToDateTime(dsState.Tables[0].Rows[0]["PROVIDECARDDATE"].ToString()).ToShortDateString() + "办过卡,请先注销");
                        return(false);
                    }
                    else
                    {
                        if (dsState.Tables[0].Rows[0]["CIRCUIT_STATE"].ToString() == "1")//院内卡已挂失
                        {
                            SkynetMessage.MsgInfo("患者[" + IdInfo.Name + "]已于" + Convert.ToDateTime(dsState.Tables[0].Rows[0]["PROVIDECARDDATE"].ToString()).ToShortDateString() + "办过卡,此卡已挂失,请先补发卡!");
                            return(false);
                        }
                        cardNub       = dsState.Tables[0].Rows[0]["CARDID"].ToString();
                        strDiagnoseid = dsState.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                        //isHadCard = true;
                    }
                }
                #endregion
            }
            else
            {
                #region 验证患者是否有用身份证签约的院内卡

                DataSet dsState = pfacade.FindIsCardTypeIdentity(IdInfo.Number);
                if (dsState.Tables.Count > 0 && dsState.Tables[0].Rows.Count > 0)     //已办理院内卡
                {
                    if (dsState.Tables[0].Rows[0]["CIRCUIT_STATE"].ToString() == "1") //院内卡已挂失
                    {
                        SkynetMessage.MsgInfo("患者[" + IdInfo.Name + "]已于" + Convert.ToDateTime(dsState.Tables[0].Rows[0]["PROVIDECARDDATE"].ToString()).ToShortDateString() + "办过卡,此卡已挂失,请先补发卡!");
                        return(false);
                    }
                    cardNub       = dsState.Tables[0].Rows[0]["CARDID"].ToString();
                    strDiagnoseid = dsState.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                    //isHadCard = true;
                }
                #endregion
            }
            return(true);
        }
Пример #18
0
        private void lblOK_Click(object sender, EventArgs e)
        {
            if (lbltel.Text.Length != 11)
            {
                lblErr.Text    = "手机号长度必须是11位!";
                lblErr.Visible = true;
                return;
            }


            this.lblOK.Enabled     = false;
            this.btnReturn.Enabled = false;
            this.btnExit.Enabled   = false;
            panel2.Enabled         = false;
            _telphone = this.lbltel.Text.Trim();
            string CardNo = string.Empty;

            CardAuthorizationFacade eCardAuthorizationFacade = new CardAuthorizationFacade();


            try
            {
                isHadCard = false;
                cardNub   = string.Empty;
                string cardType, cardTypeId;
                HealthCardInfoStruct Entity = new HealthCardInfoStruct();
                if (!cardRegulation(out cardType, out cardTypeId))//电子卡注册签约条件判断
                {
                    return;
                }

                #region 卡管平台电子卡注册

                HealthCardBase _healthcardBase = HealthCardBase.CreateEhealthCardInstance(this);

                HealthCardInfoStruct patientInfo = new HealthCardInfoStruct();
                patientInfo.XM   = IdInfo.Name;
                patientInfo.XB   = IdInfo.Sex;
                patientInfo.LXDH = _telphone;
                patientInfo.CSRQ = IdInfo.Birthday;
                patientInfo.SFZH = IdInfo.Number;
                patientInfo.DZ   = IdInfo.Address;
                patientInfo.MZ   = IdInfo.People;

                Entity = _healthcardBase.registerEHC(patientInfo);



                #endregion

                #region  HIS业务机制处理
                PatientInfoFacade pfacade      = new PatientInfoFacade();
                string            ConditionStr = cardType == "0" ? " AND A.IDENTITYCARD='" + IdInfo.Number + "' " : " AND A.GUARDIANIDNUMBER='" + IdInfo.Number + "' ";
                ConditionStr += " AND A.PATIENTNAME='" + IdInfo.Name + "'  ORDER BY  A.DIAGNOSEID DESC ";
                DataSet dsState = pfacade.FindCardPatientinfoByCondition(ConditionStr);
                if (dsState != null && dsState.Tables[0].Rows.Count > 0)
                {
                    strDiagnoseid = dsState.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                }
                virtualCardId = Entity.ehealthCardId;


                if (string.IsNullOrEmpty(strDiagnoseid))
                {
                    BindHis(virtualCardId);
                    eCardAuthorizationFacade.updateViceCardIdByCardId(IdInfo.Number, virtualCardId);//根据卡号修改电子健康卡号
                }
                else
                {
                    string    sql = "select * from t_card_authorization where DIAGNOSEID = @DIAGNOSEID and CIRCUIT_STATE = 0 and CARDID = @CARDID and TYPEID = 3";
                    Hashtable ht  = new Hashtable();
                    ht.Add("@DIAGNOSEID", strDiagnoseid);
                    ht.Add("@CARDID", IdInfo.Number);
                    DataSet dataSet = query.ExeQuery(sql, ht);
                    if (dataSet.Tables[0].Rows.Count > 0)
                    {
                        bool flag = true;
                        foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                        {
                            if (!string.IsNullOrEmpty(dataRow["VICECARDID"].ToString()))
                            {
                                flag = false;
                                string    sql1      = "update t_card_authorization set VICECARDID = @VICECARDID where ACCOUNT_ID = @ACCOUNT_ID";
                                Hashtable hashtable = new Hashtable();
                                hashtable.Add("@ACCOUNT_ID", dataRow["ACCOUNT_ID"].ToString());
                                hashtable.Add("@VICECARDID", virtualCardId);
                                query.ExeQuery(sql1, hashtable);
                            }
                        }

                        if (flag)
                        {
                            BindHis(virtualCardId);
                            eCardAuthorizationFacade.updateViceCardIdByCardId(IdInfo.Number, virtualCardId);//根据卡号修改电子健康卡号
                        }
                    }
                    else
                    {
                        BindHis(virtualCardId);
                        eCardAuthorizationFacade.updateViceCardIdByCardId(IdInfo.Number, virtualCardId);//根据卡号修改电子健康卡号
                    }
                }



                if (eLCardAuthorizationData != null)
                {
                    cardNub = eLCardAuthorizationData.Tables[0].Rows.Count > 0 ? eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID].ToString() : "";
                }


                if (strDiagnoseid != "")
                {
                    //eCardAuthorizationFacade.updateViceCardIdByCardId(cardNub, virtualCardId);//根据卡号修改电子健康卡号
                }
                printVirtualCard(Entity);//打印二维码
                #endregion
            }
            catch (Exception ex)
            {
                SkynetMessage.MsgInfo(ex.Message);
            }



            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Пример #19
0
        private bool BindPage()
        {
            try
            {
                LeaveHosRecordFacade lhFacade             = new LeaveHosRecordFacade();
                LeaveHosRecordFacade leaveHosRecordFacade = new LeaveHosRecordFacade();

                DataSet dsLeaveHos = lhFacade.QuaryLeaveHosInfoLastByDiagnoseID(SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString());
                //DataSet dsLeaveHos = lhFacade.QuaryLeaveHosInfoLastByDiagnoseID("0000643764");

                if (dsLeaveHos == null || dsLeaveHos.Tables[0].Rows.Count == 0)
                {
                    SkyComm.ShowMessageInfo("未找到您的出院记录信息,点击关闭后返回!");
                    return(false);
                }

                string inHosID   = dsLeaveHos.Tables[0].Rows[0]["INHOSID"].ToString();
                int    inhostime = Convert.ToInt32(dsLeaveHos.Tables[0].Rows[0]["CURRENTINHOSMARK"].ToString());
                _inhosID   = inHosID;
                _inhosTime = inhostime;

                string             startDate      = "2010-01-01 00:00:00";
                string             endDate        = new CommonFacade().GetServerDateTime().ToString("yyyy-MM-dd 23:59:59");
                LeaveHosRecordData childInhosData = (LeaveHosRecordData)leaveHosRecordFacade.FindChildInfoByMotherID(_inhosID, _inhosTime);
                List <string>      allInHosID     = new List <string>();
                allInHosID.Add(inHosID);
                foreach (DataRow drInhos in childInhosData.Tables[0].Rows)
                {
                    allInHosID.Add(drInhos["INHOSID"].ToString().Trim());
                }
                foreach (string tempID in allInHosID)
                {
                    DataSet dsDetail = new DataSet();
                    DataSet dsSum    = new DataSet();
                    inHosID = tempID;
                    #region 查询列表
                    Hashtable inParamListDetail = new Hashtable(); //输入参数名及参数值
                    Hashtable inParamListSum    = new Hashtable(); //输入参数名及参数值
                    Hashtable outParamList      = new Hashtable(); //输出参数名及参数类型
                    ArrayList keys    = new ArrayList();           //输入参数名
                    ArrayList keysSum = new ArrayList();           //输入参数名

                    inParamListDetail.Add("InPatientID", inHosID);
                    inParamListDetail.Add("InHosOffice", 0);
                    inParamListSum.Add("InPatientID", inHosID);
                    inParamListSum.Add("InHosOffice", 0);

                    inParamListDetail.Add("StartTime", startDate);
                    inParamListDetail.Add("EndTime", endDate);
                    inParamListSum.Add("StartTime", startDate);
                    inParamListSum.Add("EndTime", endDate);

                    inParamListDetail.Add("StatisticExpenseDetail", 0);  //统计明细
                    inParamListDetail.Add("StatisticLeechdomDetail", 0); //统计明细
                    inParamListDetail.Add("TotalRollExpense", 0);        //统计明细
                    inParamListDetail.Add("StatisticRefund", 0);         //统计明细
                    inParamListDetail.Add("TotalExpense", 0);            //统计明细
                    inParamListDetail.Add("ShowZeroExpense", 1);

                    inParamListDetail.Add("InHosTime", inhostime);
                    inParamListSum.Add("InHosTime", inhostime);
                    //加入所有的参数
                    keys.Add("InPatientID");
                    keys.Add("InHosOffice");
                    keys.Add("StartTime");
                    keys.Add("EndTime");
                    keys.Add("StatisticRefund");
                    keys.Add("StatisticExpenseDetail");
                    keys.Add("StatisticLeechdomDetail");
                    keys.Add("TotalRollExpense");
                    keys.Add("TotalExpense");
                    keys.Add("ShowZeroExpense");
                    keys.Add("InHosTime");

                    keysSum.Add("InPatientID");
                    keysSum.Add("InHosOffice");
                    keysSum.Add("StartTime");
                    keysSum.Add("EndTime");
                    keysSum.Add("InHosTime");


                    ReportSolutionFacade reportSolutionFacade = new ReportSolutionFacade();

                    //程序实现存储过程  明细和汇总
                    BusinessFacade.His.ReportDesign.LeavePatientSpendDetailFacade reportLeavePatientSpendDetailFacade = new BusinessFacade.His.ReportDesign.LeavePatientSpendDetailFacade();
                    BusinessFacade.His.ReportDesign.LeavePatientSpendSumFacade    reportLeavePatientSpendSumFacade    = new BusinessFacade.His.ReportDesign.LeavePatientSpendSumFacade();

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

                        //ui.SynUpdateUI(() =>
                        //{

                        dsSum    = reportSolutionFacade.ExecStoredProc("PH_LeavePatientSpendSum", keysSum, inParamListSum, outParamList);
                        dsDetail = reportSolutionFacade.ExecStoredProc("PH_LeavePatientSpendDetail", keys, inParamListDetail, outParamList);

                        DataTable dtMaster = new DataTable("MASTER");
                        dtMaster.Columns.Add("住院号", typeof(string));
                        dtMaster.Columns.Add("住院次数", typeof(System.Int32));
                        dtMaster.Columns.Add("费用类别", typeof(string));
                        dtMaster.Columns.Add("预交款", typeof(System.Decimal));
                        dtMaster.Columns.Add("总花费", typeof(System.Decimal));
                        dtMaster.Columns.Add("现金退款", typeof(System.Decimal));//pzj 2009-05-19 added
                        dtMaster.Columns.Add("姓名", typeof(string));
                        dtMaster.Columns.Add("入院日期", typeof(string));
                        dtMaster.Columns.Add("出院日期", typeof(string));
                        dtMaster.Columns.Add("住院科室", typeof(string));
                        dtMaster.Columns.Add("科床号", typeof(string));
                        dtMaster.Columns.Add("入科日期", typeof(string));

                        InHosInvoiceFacade invoiceFacade = new InHosInvoiceFacade();
                        DataSet            dsInvoice     = invoiceFacade.FindAll();
                        foreach (DataRow dr in dsInvoice.Tables[0].Rows)
                        {
                            dtMaster.Columns.Add(dr["INVOICEITEM"].ToString(), typeof(System.Decimal));
                        }
                        foreach (DataRow drMaster in dsSum.Tables[0].Rows)
                        {
                            DataRow[] drs = dtMaster.Select("住院号='" + drMaster["INHOSID"].ToString() + "' and 住院次数 = " + drMaster["CURRENTINHOSMARK"].ToString());//yuanxiaoxia 21166 明细按照住院次数分开打印
                            if (drs.Length == 0)
                            {
                                DataRow drNew = dtMaster.NewRow();
                                drNew["住院号"]  = drMaster["INHOSID"];
                                drNew["住院次数"] = drMaster["CURRENTINHOSMARK"];
                                drNew["费用类别"] = drMaster["FEETYPE"];
                                drNew["预交款"]  = drMaster["ADVANCE"];
                                drNew["总花费"]  = drMaster["TOTALMONEY"];
                                drNew["现金退款"] = drMaster["CASHREFUND"];//pzj 2009-05-19 added
                                drNew["姓名"]   = drMaster["PATIENTNAME"];
                                drNew["入院日期"] = drMaster["InHosDate"];
                                drNew["出院日期"] = drMaster["leaveHosDate"];
                                drNew["住院科室"] = drMaster["InHosOffice"];
                                drNew["科床号"]  = drMaster["BedID"];
                                int inhostime1 = Convert.ToInt32(drMaster["CURRENTINHOSMARK"].ToString());//yuanxiaoxia 2015-4-30 case21166 新增参数inhostime
                                LeaveHosRecordData leaveHosRecordData1 = (LeaveHosRecordData) new LeaveHosRecordFacade().FindLeaveHosInfoByInHosIDAndCurrentInhosMark(drMaster["INHOSID"].ToString(), inhostime1);
                                if (leaveHosRecordData1.Tables.Count > 0 && leaveHosRecordData1.Tables[0].Rows.Count > 0 && leaveHosRecordData1.Tables[0].Rows[0]["ENTEROFFICEDATE"].ToString().Trim() != string.Empty)
                                {
                                    drNew["入科日期"] = Convert.ToDateTime(leaveHosRecordData1.Tables[0].Rows[leaveHosRecordData1.Tables[0].Rows.Count - 1]["ENTEROFFICEDATE"]).ToString("yyyy-MM-dd HH:mm:ss");
                                }

                                drNew[drMaster["INVOICEITEM"].ToString()] = drMaster["MONEY"];
                                dtMaster.Rows.Add(drNew);
                            }
                            else
                            {
                                DataRow drUpdate = drs[0];
                                drUpdate.BeginEdit();
                                drUpdate[drMaster["INVOICEITEM"].ToString()] = drMaster["MONEY"];
                                drUpdate.EndEdit();
                            }
                        }
                        dsDetail.Tables.Add(dtMaster);
                        dsDetail.AcceptChanges();

                        foreach (DataRow dr in dsDetail.Tables[0].Rows)
                        {
                            if (dsDetail.Tables[1].Select("住院号 = '" + dr["INHOSID"].ToString() + "'").Length <= 0)
                            {
                                SkynetMessage.MsgInfo(dr["INHOSID"].ToString());
                            }
                        }

                        DataColumn[] parentColumns = new DataColumn[2];
                        DataColumn[] childColumns  = new DataColumn[2];
                        parentColumns[0] = dsDetail.Tables[1].Columns["住院号"];
                        parentColumns[1] = dsDetail.Tables[1].Columns["住院次数"];//yuanxiaoxia 21166 明细按照住院次数分开打印
                        childColumns[0]  = dsDetail.Tables[0].Columns["INHOSID"];
                        childColumns[1]  = dsDetail.Tables[0].Columns["CURRENTINHOSMARK"];
                        DataRelation relation = new DataRelation("MastDetail", parentColumns, childColumns);
                        dsDetail.Relations.Add(relation);
                        //    });
                        //});
                    }
                    catch (Exception err)
                    {
                        SkyComm.ShowMessageInfo("数据生成失败!" + err.Message);
                        return(false);
                    }

                    SUniteChargeFacade sUniteChargeFacade = new SUniteChargeFacade();
                    DataSet            sUnitCharge        = new DataSet();
                    DataSet            medicareClassData  = new MedicareClassFacade().FindAll();
                    DataRow[]          medicareClassRows;
                    foreach (DataRow dr in dsDetail.Tables[0].Rows)
                    {
                        if (dr["NMEDICARETYPE"].ToString().Trim() != string.Empty)
                        {
                            medicareClassRows = medicareClassData.Tables[0].Select("MEDICAREID='" + dr["NMEDICARETYPE"] + "'");
                            if (medicareClassRows.Length > 0)
                            {
                                dr["NMEDICARETYPE"] = medicareClassRows[0]["MEDICARECLASS"];
                            }
                            else
                            {
                                dr["NMEDICARETYPE"] = "农合药";
                            }
                        }
                    }
                    #endregion
                    dsAllSum.Add(dsSum.Copy());
                    dsAllDetail.Add(dsDetail.Copy());
                }
                DataTable dtMain = null;
                foreach (DataSet dsTemp in dsAllDetail)
                {
                    if (dtMain == null)
                    {
                        dtMain = dsTemp.Tables[0].Copy();
                    }
                    else
                    {
                        object[] obj = new object[dtMain.Columns.Count];
                        for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
                        {
                            dsTemp.Tables[0].Rows[i].ItemArray.CopyTo(obj, 0);
                            dtMain.Rows.Add(obj);
                        }
                    }
                }
                if (dtMain == null || dsAllSum[0].Tables.Count == 0)
                {
                    SkyComm.ShowMessageInfo("未找到您的住院费用清单信息!");
                    return(false);
                }
                if (dtMain.Rows.Count == 0)
                {
                    SkyComm.ShowMessageInfo("未找到您的住院费用清单信息!");
                    return(false);
                }

                gdcMain.DataSource = dtMain;
                return(true);
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("住院费用清单查询异常:" + ex.Message);
                SkyComm.ShowMessageInfo("未找到您的住院费用清单信息!");
                return(false);
            }
        }
        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;
        }
Пример #21
0
 private void EnterPasswordHandler(IntPtr pConf, char chKey)
 {
     SkynetMessage.MsgInfo(chKey.ToString());
     frmPwd = new FrmPasswordBox();
     frmPwd.AcceptPwdInput(pConf, chKey);
 }
        private void Saving(decimal money)
        {
            if (eCardSavingFacade == null)
            {
                eCardSavingFacade = new CardSavingFacade();
            }

            if (SkyComm.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows.Count <= 0)
            {
                MyAlert frm = new MyAlert(AlertTypeenum.信息, "此操作没有找到所要充值的卡信息!");
                frm.ShowDialog();
                return;
            }

            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0].BeginEdit();
            //卡号
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID] = SkyComm.cardInfoStruct.CardNo;
            //充值时间
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_OPERATETIME] = new CommonFacade().GetServerDateTime();
            ////操作员
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_OPERATOR] = SysOperatorInfo.OperatorID;
            ////充值类型
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_SAVINGMODE] = 1;

            Skynet.LoggingService.LogService.GlobalInfoMessage("发卡保存数据设置押金之前");
            ////Add money
            if (CallType == 2)
            {
                Decimal deposit = Convert.ToDecimal(SkyComm.getvalue("发卡工本费"));
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEY] = money - Convert.ToDecimal(SkyComm.dsCardType.Tables[0].Rows[0]["FEES"]) - deposit;
            }
            else
            {
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEY] = money;  //此处需调接口
            }
            Skynet.LoggingService.LogService.GlobalInfoMessage("发卡保存数据设置押金之后");
            //业务类型
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BUSSNESSTYPE] = "充值";
            //支付方式
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_MODETYPE] = SkyComm.AddMoneyPosMode;
            //单位
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_UNIT] = "";
            //支票号
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CHECKLOT] = "";

            //充值数据来源
            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEYSOURCE] = AutoHostConfig.BankName;

            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0].EndEdit();

            ReckonAccountTimeFacade reckonAccountsTimeFacade = new ReckonAccountTimeFacade();
            DateTime accountTime = reckonAccountsTimeFacade.GetEndTime(SysOperatorInfo.OperatorID, "门诊");

            if (Convert.ToDateTime(eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_OPERATETIME]) < accountTime)
            {
                SkyComm.ShowMessageInfo("该时间段已经结帐,不能办理预交金业务,请重试!");
                return;
            }
            DataSet cardSavingData = new DataSet();
            POSBase Posfac         = IPOSFactory.CreateIPOS(AutoHostConfig.PosInterfaceType);

            if (Posfac == null)
            {
                SkyComm.ShowMessageInfo("银联POS接口配置不正确,请与管理员联系!");
                return;
            }
            ValidateCode vc       = new ValidateCode();
            string       HisSeqNo = string.Empty;

            HisSeqNo = DateTime.Now.ToString("yyMMddHHmmss") + SysOperatorInfo.OperatorID + vc.GenValidateCode(4);
            Hashtable BankTranht = new Hashtable();

            BankTranht.Add("SEQNO", HisSeqNo);
            BankTranht.Add("MONEY", money);
            BankTranht.Add("OPERATORID", SysOperatorInfo.OperatorCode);
            BankTranht.Add("POSNO", AutoHostConfig.PosNo);
            BankTranht.Add("DIAGNOSEID", SkyComm.DiagnoseID);
            BankTranht.Add("CARDID", SkyComm.cardInfoStruct.CardNo);
            Posfac.Trans("1", BankTranht);
            if (BankTranht["CARDNO"] != null)
            {
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CHECKLOT]    = BankTranht["CARDNO"].ToString();
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BANKCARDNO]  = BankTranht["CARDNO"].ToString();
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BANKTRANSNO] = BankTranht["BANKSEQNO"].ToString();
            }

            try
            {
                //if (SkynetMessage.MsgInfo("是否要充值成功?", true) == false)
                //{
                //    throw new Exception("操作操作测试放弃充值!");
                //}
                cardSavingData = eCardSavingFacade.insertEntity(eCardAuthorizationData);
                Posfac.Trans("2", BankTranht);
                Savingsucceed = 1;
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("POS接口调用成功,HIS保存失败:" + ex.Message + "\r\n开始调用撤消方法");
                SkynetMessage.MsgInfo("HIS充值失败,需要撤消银行交易,请按POS机提示操作!");
                Posfac.Trans("-2", BankTranht);
                Skynet.LoggingService.LogService.GlobalInfoMessage("POS接口调用成功,HIS失败,调用银行撤消完成!");
                //SkynetMessage.MsgInfo("HIS充值失败:"+ex.Message);
                return;
            }
            SkyComm.GetCardBalance();

            if (CallType != 2)
            {
                //打印充值凭证
                PrintInfo("自助充值凭证", cardSavingData.Tables[0].Rows[0]["TRANSACTION_ID"].ToString(), money.ToString());

                if (CallType == 0)
                {
                    FrmRechargeSuccessful frmRecharge = new FrmRechargeSuccessful();
                    frmRecharge.RechargeMoney = money;
                    frmRecharge.ShowDialog(this);
                    frmRecharge.Dispose();
                    SkyComm.CloseWin(this);
                }
                else
                {
                    SkyComm.ShowMessageInfo("您成功充值" + money + "元!卡中余额" + SkyComm.cardBlance.ToString() + "");
                    SkyComm.CloseWin(this);
                }
            }
            else
            {
                DialogResult = System.Windows.Forms.DialogResult.OK;
                SkyComm.CloseWin(this);
            }
            //GetMoeny();
        }
        private void Saving(decimal money)
        {
            if (eCardSavingFacade == null)
            {
                eCardSavingFacade = new CardSavingFacade();
            }

            if (SkyComm.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows.Count <= 0)
            {
                MyAlert frm = new MyAlert(AlertTypeenum.信息, "此操作没有找到所需要的患者信息!");
                frm.ShowDialog();
                return;
            }

            DataSet cardSavingData = new DataSet();
            POSBase Posfac         = IPOSFactory.CreateIPOS(AutoHostConfig.PosInterfaceType);

            if (Posfac == null)
            {
                SkyComm.ShowMessageInfo("银联POS接口配置不正确,请与管理员联系!");
                return;
            }

            ValidateCode vc       = new ValidateCode();
            string       HisSeqNo = string.Empty;

            HisSeqNo = DateTime.Now.ToString("yyMMddHHmmss") + SysOperatorInfo.OperatorID + vc.GenValidateCode(4);

            #region 住院预交金充值
            AdvanceRecordData AdvData = new AdvanceRecordData();
            DataRow           dr      = AdvData.Tables[0].NewRow();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_ADVANCEID]        = "新增";
            dr[AdvanceRecordData.H_ADVANCE_RECORD_BUSINESSBANK]     = HisSeqNo;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CANCELMARK]       = 0;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CHEQUEID]         = "";
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CURRENTINHOSMARK] = inHosData.Tables[0].Rows[0]["CURRENTINHOSMARK"].ToString();;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_INHOSID]          = inHosData.Tables[0].Rows[0]["INHOSID"].ToString();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OFFICEID]         = inHosData.Tables[0].Rows[0]["INHOSOFFICEID"].ToString();//this.txtZyks.Text;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATEDATE]      = new CommonFacade().GetServerDateTime();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATORID]       = SysOperatorInfo.OperatorID;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMODEID]        = SkyComm.getvalue("住院预交金充值方式_银行卡").ToString();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMONEY]         = RechargeMoney;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_RECEIPTID]        = string.Empty;
            AdvData.Tables[0].Rows.Add(dr);
            AdvanceRecordFacade theAdvanceRecordFacade = new AdvanceRecordFacade();
            #endregion
            string    advanceid  = string.Empty;
            Hashtable BankTranht = new Hashtable();
            BankTranht.Add("SEQNO", HisSeqNo);
            BankTranht.Add("MONEY", money);
            BankTranht.Add("OPERATORID", SysOperatorInfo.OperatorCode);
            BankTranht.Add("POSNO", AutoHostConfig.PosNo);
            BankTranht.Add("DIAGNOSEID", SkyComm.DiagnoseID);
            BankTranht.Add("CARDID", SkyComm.cardInfoStruct.CardNo);

            if (AutoHostConfig.PosInterfaceType.Equals("锡盟新利"))//锡盟新利 弹出错误提示
            {
                try
                {
                    Posfac.Trans("1", BankTranht);
                }
                catch (Exception ex)
                {
                    SkyComm.ShowMessageInfo(ex.Message.ToString());
                    return;
                }
            }
            else
            {
                Posfac.Trans("1", BankTranht);
            }


            if (BankTranht["CARDNO"] != null)
            {
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CHECKLOT]    = BankTranht["CARDNO"].ToString();
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BANKCARDNO]  = BankTranht["CARDNO"].ToString();
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BANKTRANSNO] = BankTranht["BANKSEQNO"].ToString();
            }

            try
            {
                advanceid = theAdvanceRecordFacade.insertEntity(AdvData, false);
                Posfac.Trans("2", BankTranht);
                Savingsucceed = 1;
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("POS接口调用成功,HIS保存失败:" + ex.Message + "\r\n开始调用撤消方法");
                SkyComm.ShowMessageInfo("预交金充值失败,需要撤销银行交易,请按POS机提示操作,点击确定后,请重新插入银行卡!");
                Posfac.Trans("-2", BankTranht);
                Skynet.LoggingService.LogService.GlobalInfoMessage("POS接口调用成功,HIS失败,调用银行撤消完成!");
                SkyComm.ShowMessageInfo("银行交易失败,充值金额已退回卡,请重新充值!");
                //SkynetMessage.MsgInfo("HIS充值失败:"+ex.Message);
                return;
            }
            //SkyComm.GetCardBalance();

            if (Savingsucceed == 1)
            {
                string receiptID = theAdvanceRecordFacade.GetReceiptIDByAdvanceID(advanceid);
                //打印充值凭证
                PrintInfo("住院预交金充值凭证", receiptID, money.ToString(), advanceid, HisSeqNo);



                decimal old_YE = Convert.ToDecimal(inHosData.Tables[0].Rows[0]["BALANCEMONEY"].ToString());
                SkyComm.ShowMessageInfo("您成功充值" + money + "元!卡中余额" + (old_YE + money).ToString("0.00##") + "元!");
                string _isPrint = SkyComm.getvalue("锡盟预交款打印凭证");  //Case 31629 锡盟预交款打印凭证
                _isPrint = string.IsNullOrEmpty(_isPrint) ? "0" : "1";

                if (_isPrint.Equals("0"))
                {
                    try
                    {
                        MoneyTransferPresenter moneyTransferPresenter = new MoneyTransferPresenter();

                        DataSet dataSet = moneyTransferPresenter.getBankInfo(SkyComm.DiagnoseID, HisSeqNo);
                        dataSet.WriteXml(Application.StartupPath + @"\\ReportXml\\" + "银行pos凭证" + SkyComm.DiagnoseID + ".xml");
                        if (!File.Exists(Application.StartupPath + @"\\Reports\\" + "银行pos凭证" + ".frx"))
                        {
                            SkynetMessage.MsgInfo("银行pos凭证" + ".frx报表文件不存在,无法打印.");
                            return;
                        }
                        //Common_XH theCamera_XH = new Common_XH();
                        //theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
                        PrintManager print = new PrintManager();
                        print.InitReport("银行pos凭证");
                        print.AddData(dataSet.Tables[0], "pos");
                        print.Print();
                        print.Dispose();
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            SkyComm.CloseWin(this);
        }
        /// <summary>
        /// 获取卡余额
        /// </summary>
        private void GetMoeny()
        {
            //获取诊疗号
            string diagnoseId = SkyComm.DiagnoseID;

            //预交金
            if (eCardSavingFacade == null)
            {
                eCardSavingFacade = new CardSavingFacade();
            }

            string yje = string.Empty;

            if (SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue.ToString() != "2")
            {
                yje = eCardSavingFacade.FindBalanceMoneyByDiagnoseID(diagnoseId).ToString("0.00");
            }
            else
            {
                yje = eCardSavingFacade.FindBalanceMoneyByDiagnoseID_New(diagnoseId, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["ACCOUNT_ID"].ToString()).ToString("0.00");
            }
            //门诊未结
            //string wj = eCardAuthorizationFacade.FindClinicNoCheckoutMoney(diagnoseId).ToString("0.00");

            //门诊未缴费
            #region 查询未缴费的金额
            QuerySolutionFacade query = new QuerySolutionFacade();
            Hashtable           ht    = new Hashtable();
            string wj     = "0.00";
            string strsql = " SELECT COALESCE(SUM(TOTALMONEY),0) TOTALMONEY FROM (" +
                            " select SUM(C.TOTALMONEY) TOTALMONEY" +
                            " from CLINICPHYSICIANRECIPE C" +
                            " where C.DIAGNOSEID=:DIAGNOSEID AND RECIPESTATE = 0 and OPERATETIME >= :YPDATE " +
                            " AND C.RECIPETYPE IN ('药品费','中草药','医材')" +
                            " union all " +
                            " SELECT SUM(D_SUMMARY_INFO.UNITPRICE * CLINICPHYSICIANRECIPE.AMOUNT * S_MEDORD_DETAIL.AMOUNT) AS TOTALMONEY" +
                            " FROM CLINICPHYSICIANRECIPE,D_SUMMARY_INFO,S_MEDORD_DETAIL,S_MEDORD_MAIN " +
                            " WHERE CLINICPHYSICIANRECIPE.RECIPECONTENT = S_MEDORD_DETAIL.MEDORDID AND S_MEDORD_DETAIL.ITEMID = D_SUMMARY_INFO.ITEMID AND" +
                            "  CLINICPHYSICIANRECIPE.DIAGNOSEID=:DIAGNOSEID AND RECIPESTATE = 0 AND" +
                            "  CLINICPHYSICIANRECIPE.RECIPETYPE <> '附加'  AND CLINICPHYSICIANRECIPE.RECIPECONTENT = S_MEDORD_MAIN.MEDORDID " +
                            "  AND OPERATETIME >=:JZFDATE AND (ISCHANGEPRICE<> 1 OR ISCHANGEPRICE IS NULL)" +
                            " union all " +
                            " SELECT SUM(CLINICPHYSICIANRECIPE.UNITPRICE * CLINICPHYSICIANRECIPE.AMOUNT) AS TOTALMONEY" +
                            " FROM CLINICPHYSICIANRECIPE " +
                            " WHERE CLINICPHYSICIANRECIPE.DIAGNOSEID=:DIAGNOSEID AND RECIPESTATE = 0 AND" +
                            "  CLINICPHYSICIANRECIPE.RECIPETYPE <> '附加' " +
                            "  AND OPERATETIME >=:JZFDATE AND ISCHANGEPRICE = 1" +
                            " union all  " +
                            " select SUM(CLINICPHYSICIANRECIPE.UNITPRICE * CLINICPHYSICIANRECIPE.AMOUNT) TOTALMONEY" +
                            " from CLINICPHYSICIANRECIPE  " +
                            " where  RECIPESTATE = 0  AND CLINICPHYSICIANRECIPE.RECIPETYPE = '附加' " +
                            "  AND CLINICPHYSICIANRECIPE.DIAGNOSEID=:DIAGNOSEID and OPERATETIME >=:JZFDATE ) AA ";

            string ypDate  = SystemInfo.SystemConfigs["药品处方有效期"].DefaultValue;
            string jzfDate = SystemInfo.SystemConfigs["检治费处方有效期"].DefaultValue;

            CommonFacade commonFacade = new CommonFacade();
            DateTime     dtCurrent    = commonFacade.GetServerDateTime();

            ht.Add(":DIAGNOSEID", diagnoseId);
            ht.Add(":YPDATE", dtCurrent.Date.AddDays(Convert.ToInt32(ypDate) * -1));
            ht.Add(":JZFDATE", dtCurrent.Date.AddDays(Convert.ToInt32(jzfDate) * -1));

            try
            {
                lblNoPaymentCharge.Visible = false;
                decimal decNoCharge = 0;
                DataSet ds          = query.ExeQuery(strsql, ht);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    decNoCharge = DecimalRound.Round(Convert.ToDecimal(ds.Tables[0].Rows[0]["TOTALMONEY"]), 2);
                }
                wj          = decNoCharge.ToString();
                lblwjf.Text = decNoCharge.ToString();

                if (decNoCharge != 0)
                {
                    lblNoPaymentCharge.Visible = true;
                }
                else
                {
                    lblNoPaymentCharge.Visible = false;
                }
            }
            catch (Exception ex)
            {
                SkynetMessage.MsgInfo("获取未交费信息出错:" + ex.Message);
            }

            #endregion

            lblwjf.Text = wj + "元";
            //余额
            lblye.Text = SkyComm.cardBlance.ToString();
        }
        private void lblOK_Click(object sender, EventArgs e)
        {
            if (!checkInput())
            {
                return;
            }

            if (SendCard.CheckCard() == "1")
            {
                SkyComm.ShowMessageInfo("该自助机没有卡,请在其他自助机上继续发卡!");
                return;
            }
            this.lblOK.Enabled     = false;
            this.btnReturn.Enabled = false;
            this.btnExit.Enabled   = false;
            panel2.Enabled         = false;
            _telphone      = this.txtTel.Text.Trim();
            _childName     = this.txtName.Text.Trim();
            _childSex      = this.rbtnBoy.Checked ? "男" : "女";
            _childBirthDay = this.txtYear.Text.Trim() + "-" + this.txtMonth.Text.Trim() + "-" + this.txtDay.Text.Trim();
            string CardNo = string.Empty;

            string strDiagnoseid = string.Empty;
            CardAuthorizationFacade eCardAuthorizationFacade = new CardAuthorizationFacade();

            using (WaitDialogForm form = new WaitDialogForm("正在发卡中,请稍候...", "正在组织发卡数据,请稍候......", new Size(240, 60)))
            {
                #region 办理就诊卡
                if (eLCardAuthorizationData != null)
                {
                    eLCardAuthorizationData.Tables[0].Rows.Clear();
                }

                SetCardInfo(IdInfo, _telphone);
                eLCardAuthorizationData = (CardAuthorizationData)eCardAuthorizationFacade.insertEntity(eLCardAuthorizationData);
                strDiagnoseid           = eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_DIAGNOSEID].ToString();
                CardNo = eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID].ToString();
                //写卡,如果失败则重试
                bool isSuccess = false;
                form.Caption = "正在写卡中,请稍候...";
                try
                {
                    for (int i = 0; i < 3; i++)
                    {
                        //第一次写卡
                        if (SendCard.WriteCard(CardNo) == false)
                        {
                            //第一次写卡失败,再进行第二次写卡
                            if (SendCard.WriteCard(CardNo) == 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;
                    panel2.Enabled         = true;
                }

                //写卡失败
                if (isSuccess == false)
                {
                    //撤消已发卡的信息
                    eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    eLCardAuthorizationData = new CardAuthorizationData();
                    strDiagnoseid           = string.Empty;
                    SkynetMessage.MsgInfo("写卡失败,请在其他自助机上重试!");
                    this.lblOK.Enabled     = true;
                    this.btnReturn.Enabled = true;
                    this.btnExit.Enabled   = true;
                    panel2.Enabled         = true;

                    //第二次写卡失败以后将卡回收
                    SendCard.ReturnCard();
                    return;
                }
                #endregion
                form.Close();
            }
            #region 充值
            try
            {
                SkyComm.eCardAuthorizationData = eLCardAuthorizationData;
                SkyComm.DiagnoseID             = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                SkyComm.cardInfoStruct.CardNo  = CardNo;
                SkyComm.cardBlance             = 0;
                CardSavingFacade cf = new CardSavingFacade();
                SkyComm.cardallmoney = 0;

                int     Savingsucceed = 0;
                decimal RechargeMoney = 0;
                string  strModeType   = "现金";
                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":
                            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);
                    }
                }
                catch (Exception ex2)
                {
                    Skynet.LoggingService.LogService.GlobalInfoMessage("发卡充值失败:" + ex2.Message);
                }
                finally
                {
                }

                if (Savingsucceed == 1)
                {
                    SendCard.OutputCard();
                    try
                    {
                        Common_XH theCamera_XH = new Common_XH();
                        theCamera_XH.DoorLightOpen(LightTypeenum.出卡槽, LightOpenTypeenum.闪烁);
                        theCamera_XH.DoorLightOpen(LightTypeenum.发卡器, LightOpenTypeenum.闪烁);
                        theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
                    }
                    catch (Exception exception)
                    {
                    }
                    SkyComm.ShowMessageInfo("发卡成功,请取走您的就诊卡!");
                }
                else
                {
                    //回收卡信息并且注册卡
                    //撤消已发卡的信息
                    Skynet.LoggingService.LogService.GlobalInfoMessage("充值失败,撤消发卡信息");
                    eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    eLCardAuthorizationData = new CardAuthorizationData();
                    strDiagnoseid           = string.Empty;
                    this.lblOK.Enabled      = true;
                    this.btnReturn.Enabled  = true;
                    this.btnExit.Enabled    = true;
                    panel2.Enabled          = true;

                    //发卡失败以后将卡进行回收
                    SendCard.ReturnCard();
                    return;
                }
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("发卡失败:" + ex.Message + ",系统回收卡机中的卡");

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

                SkynetMessage.MsgInfo("发卡失败:" + ex.Message);
                return;
            }
            finally
            {
                this.lblOK.Enabled     = true;
                this.btnReturn.Enabled = true;
                this.btnExit.Enabled   = true;
                panel2.Enabled         = true;

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

            SystemFramework.Voice.Voice voice = new SystemFramework.Voice.Voice();
            voice.PlayText("请在就诊卡出口取走您的就诊卡!");
            voice.EndJtts();


            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Пример #26
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();
            }
        }
Пример #27
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                isHadCard = false;
                cardNub   = string.Empty;
                string cardType, cardTypeId;
                HealthCardInfoStruct Entity = new HealthCardInfoStruct();
                if (!cardRegulation(out cardType, out cardTypeId))//电子卡注册签约条件判断
                {
                    return;
                }
                decimal decMoney = 0;

                #region 卡管平台电子卡注册
                LogService.GlobalInfoMessage("HIS组织调用电子卡数据");
                HealthCardBase _healthcardBase = HealthCardBase.CreateEhealthCardInstance(this);
                LogService.GlobalInfoMessage("电子XML加载完成");
                HealthCardInfoStruct patientInfo = new HealthCardInfoStruct();
                patientInfo.XM   = patientName;
                patientInfo.XB   = gender;
                patientInfo.LXDH = phoneNo;
                patientInfo.CSRQ = birthday;
                patientInfo.SFZH = cbxCertificateNO;
                patientInfo.DZ   = address;
                patientInfo.MZ   = nation;

                Entity = _healthcardBase.registerEHC(patientInfo);
                if (cardType == "0")
                {
                    //Entity = _healthcardBase.registerEHC(patientInfo);
                }
                else if (cardType == "1")
                {
                    //FrmMaxCard frm = new FrmMaxCard();
                    //frm.labelText = "请扫描家长电子卡......";
                    //if (frm.ShowDialog() == DialogResult.OK)
                    //    patientInfo.ehealthCardId = frm.VirtualNub.Substring(0, frm.VirtualNub.Length - 2);
                    //else
                    //    return;
                    //Entity = _healthcardBase.registerEHC_Child(patientInfo);
                }
                else
                {
                    //if (strDiagnoseid == "")
                    //{
                    //    BindHis("00000000000000000");
                    //    strDiagnoseid = eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_DIAGNOSEID].ToString();
                    //    cardNub = eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID].ToString();
                    //    this.txtCureID.Text = cardNub;
                    //}
                    //patientInfo.diagnoseId = strDiagnoseid;
                    //patientInfo.cardId = cardNub;
                    //Entity = _healthcardBase.registerEHC_medicalCard(patientInfo);
                }

                #endregion

                #region  HIS业务机制处理
                //if (cardType != "2")
                //{
                //    PatientInfoFacade pfacade = new PatientInfoFacade();
                //    string ConditionStr = cardType == "0" ? " AND A.IDENTITYCARD='" + cbxCertificateNO.Text.Trim() + "' " : " AND A.GUARDIANIDNUMBER='" + txtGudrdianIDNumber.Text.Trim() + "' ";
                //    ConditionStr += " AND A.PATIENTNAME='" + this.tbxName.Text + "'  ORDER BY  A.DIAGNOSEID DESC ";
                //    DataSet dsState = pfacade.FindCardPatientinfoByCondition(ConditionStr);
                //    if (dsState != null && dsState.Tables[0].Rows.Count > 0)
                //    {
                //        this.txtCureID.Text = dsState.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                //    }
                //}
                //virtualCardId = cardType == "1" ? Entity.childEhealthCardId : Entity.ehealthCardId;
                //if (strDiagnoseid == "")//未办卡,办卡完成后获取患者院内卡号
                //{
                //    LogService.GlobalInfoMessage("患者未办理院内卡");

                //    BindHis(virtualCardId);
                //    if (eLCardAuthorizationData != null)
                //    {
                //        cardNub = eLCardAuthorizationData.Tables[0].Rows.Count > 0 ? eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID].ToString() : "";
                //    }
                //}

                //if (cardNub != "")
                //{
                //    LogService.GlobalInfoMessage("患者已办理院内卡");
                //    eCardAuthorizationFacade.updateViceCardIdByCardId(cardNub, virtualCardId);//根据卡号修改电子健康卡号
                //    printVirtualCard(Entity);//打印二维码
                //}
                #endregion
            }
            catch (Exception ex)
            {
                SkynetMessage.MsgInfo(ex.Message);
            }
        }
        public void printInfo(Hashtable hashtable, string type)
        {
            try
            {
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add("凭证名称", typeof(string));
                dataTable.Columns.Add("医院名称", typeof(string));
                dataTable.Columns.Add("收据号", typeof(string));
                dataTable.Columns.Add("姓名", typeof(string));
                dataTable.Columns.Add("卡余额", typeof(string));
                dataTable.Columns.Add("充值金额", typeof(string));
                dataTable.Columns.Add("操作员", typeof(string));
                dataTable.Columns.Add("操作员姓名", typeof(string));
                dataTable.Columns.Add("支付订单号", typeof(string));
                dataTable.Columns.Add("住院预交款余额", typeof(string));


                DataRow dataRow = dataTable.NewRow();

                dataRow["凭证名称"] = "网络支付凭证";
                dataRow["医院名称"] = SysOperatorInfo.CustomerName;
                dataRow["收据号"]  = this.hisSerialNo;
                dataRow["姓名"]   = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString();
                if (type.Equals("住院"))
                {
                    dataRow["卡余额"] = SkyComm.cardBlance;
                    decimal mInhosMoney = Convert.ToDecimal(hashtable["住院预交款余额"]) + Convert.ToDecimal(hashtable["充值金额"].ToString());
                    dataRow["住院预交款余额"] = mInhosMoney.ToString();
                }
                else
                {
                    decimal m = Convert.ToDecimal(SkyComm.cardBlance) + Convert.ToDecimal(hashtable["充值金额"].ToString());

                    dataRow["卡余额"] = m.ToString();
                }

                dataRow["充值金额"]  = hashtable["充值金额"].ToString();
                dataRow["操作员"]   = SysOperatorInfo.OperatorCode;
                dataRow["操作员姓名"] = SysOperatorInfo.OperatorName;
                dataRow["支付订单号"] = this.bankSerialNo;

                dataTable.Rows.Add(dataRow);
                dataTable.TableName = "cardSavingTable";
                dataTable.WriteXml(Application.StartupPath + @"\\ReportXml\\" + "网络支付凭证" + SkyComm.DiagnoseID +
                                   "_" + this.hisSerialNo + ".xml");
                if (!File.Exists(Application.StartupPath + @"\\Reports\\" + "网络支付凭证" + ".frx"))
                {
//                    SkynetMessage.MsgInfo(hashtable["凭证名称"] + ".frx报表文件不存在,无法打印.");
                    return;
                }
                PrintManager print = new PrintManager();
                print.InitReport("网络支付凭证");

                print.AddData(dataTable, "cardSavingTable");

                PrintManager.CanDesign = true;

                print.Print();
                print.Dispose();
                Thread.Sleep(100);
            }
            catch (Exception lex)
            {
                if (lex.Message.IndexOf("灾难性") > 0)
                {
                    SkynetMessage.MsgInfo(lex.Message + ": 打印机连接失败,请检查!");
                }
                else
                {
                    SkynetMessage.MsgInfo(lex.Message);
                }
            }
        }