Example #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DataTable table = new DataTable("table");

            table.Columns.AddRange(new DataColumn[]
            {
                new DataColumn("area", typeof(string)),
                new DataColumn("waitCount", typeof(string)),
                new DataColumn("unitName", typeof(string)),
                new DataColumn("busyName", typeof(string)),
                new DataColumn("ticketNumber", typeof(string)),
                new DataColumn("reserveSeq", typeof(string)),
            });
            DataRow row = table.NewRow();

            row["area"]         = "测试地区";
            row["waitCount"]    = "2";
            row["unitName"]     = "测试单位";
            row["busyName"]     = "测试业务";
            row["ticketNumber"] = "C008";
            row["reserveSeq"]   = "002";
            table.Rows.Add(row);
            PrintManager print = new PrintManager();

            PrintManager.CanDesign = true;
            print.InitReport("排队小票");
            print.AddData(table, "QueueBill");
            print.PreView();
            print.Dispose();
        }
Example #2
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);
                }
            }
        }
Example #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            DataTable table = GetQueue("第一大厅", 15);
            //print.Print(model, area, wait);
            PrintManager print = new PrintManager();

            PrintManager.CanDesign = true;
            print.InitReport("排队小票");
            print.AddData(table, "QueueBill");
            print.Print();
            print.Dispose();
        }
Example #4
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);
//                }
            }
        }
        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);
                }
            }
        }
 /// <summary>
 /// 根据检查单信息
 /// </summary>
 /// <param name="rowList">进行打印</param>
 public void PrintPDF(string PdfPath)
 {
     try
     {
         DataTable    dtPrint  = ConvertPDF2Image(PdfPath, 1, 30, ImageFormat.Jpeg, Definition.Five);
         PrintManager PrintPDF = new PrintManager();
         PrintPDF.InitReport("遗传报告单");
         PrintPDF.AddData(dtPrint, "IMGPrintData");
         //PrintManager.CanDesign = true;
         //PrintPDF.PreView();
         PrintPDF.Print();
         PrintPDF.Dispose();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        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);
        }
Example #8
0
        private void PrintReport(DataSet ds, string strCK, DataSet ds1)
        {
            for (int i = ds1.Tables[0].Rows.Count - 1; i >= 0; i--)
            {
                if ("False" == ds1.Tables[0].Rows[i]["PITCHON1"].ToString())
                {
                    ds1.Tables[0].Rows.RemoveAt(i);
                }
            }



            ds1.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("自助挂号票据不存在,请联系管理员!");
                SkyComm.ShowMessageInfo("自助扣费凭证不存在,请联系管理员!");
                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("姓名", lblxm.Text);
            print.AddParam("卡余额", SkyComm.cardBlance);
            print.AddParam("操作员", SysOperatorInfo.OperatorCode);
            print.AddParam("操作员姓名", SysOperatorInfo.OperatorName);
            print.AddParam("窗口号", strCK);
            print.AddData(ds1.Tables[0], "report");
            PrintManager.CanDesign = true;
            print.Print();
            print.Dispose();
            Thread.Sleep(100);
        }
        private void btnBalance_Click(object sender, EventArgs e)
        {
            QuerySolutionFacade querySolutionFacade = new QuerySolutionFacade();
            DetailAccountFacade detailAccountFacade = new DetailAccountFacade();
            string mechinNo = string.Empty;

            try
            {
                #region 获取ip
                string ipAddress = null;
                try
                {
                    string      hostName = Dns.GetHostName();
                    IPHostEntry ipEntry  = Dns.GetHostEntry(hostName);
                    for (int i = 0; i < ipEntry.AddressList.Length; i++)
                    {
                        if (ipEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
                        {
                            ipAddress = ipEntry.AddressList[i].ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    SkyComm.ShowMessageInfo(ex.Message);
                    return;
                }

                #endregion
                #region 获取机器码
                string    sql1       = "select * from T_AUTOSERVICEMACHINE_INFO where IPADDRESS = @IPADDRESS";
                Hashtable hashtable1 = new Hashtable();
                hashtable1.Add("@IPADDRESS", ipAddress);
                DataSet dataSet = querySolutionFacade.ExeQuery(sql1, hashtable1);

                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    mechinNo = dataSet.Tables[0].Rows[0]["MACHINENO"].ToString();
                }
                #endregion


                #region 判断结算


                Hashtable hashtablejs = new Hashtable();

                string sqljs = "select * from SETTLEMENT_RECORD where MECHINNO = @MECHINNO";// and BANKSTATE = '1'
                hashtablejs.Add("@MECHINNO", mechinNo);



                DataSet dataSet1 = querySolutionFacade.ExeQuery(sqljs, hashtablejs);

                if (dataSet1.Tables[0].Rows.Count > 0)
                {
                    if (dataSet1.Tables[0].Rows[0]["SETTLEMENT_TIME"].ToString().Equals(DateTime.Now.ToString("yyyy-MM-dd")))
                    {
                        SkyComm.ShowMessageInfo("此台机器已经结算过");
                        return;
                    }
                    else
                    {
                    }
                }

                #endregion



                #region 获取结算时间
                string MBeginTime = DateTime.Now.ToLocalTime().ToString();;
                string MEndTime   = DateTime.Now.ToLocalTime().ToString();;

                string    sql3       = "select * from SETTLEMENT_TIME where M_NO = @M_NO";
                Hashtable hashtable3 = new Hashtable();
                hashtable3.Add("@M_NO", mechinNo);
                DataSet dataSet3 = querySolutionFacade.ExeQuery(sql3, hashtable3);
                if (dataSet3.Tables[0].Rows.Count > 0)
                {
                    MBeginTime = dataSet3.Tables[0].Rows[0]["TIMES"].ToString();
                }



                #endregion


                #region 获取现金记录
                string    sql2       = "select * from T_AUTOINMONEY_RECORD where MACHINENO = @MACHINENO and OPERATORTIME between @starttime and @endtime";
                Hashtable hashtable2 = new Hashtable();
                hashtable2.Add("@MACHINENO", mechinNo);

                hashtable2.Add("@starttime", MBeginTime);
                hashtable2.Add("@endtime", MEndTime);
                DataSet dataSet2 = querySolutionFacade.ExeQuery(sql2, hashtable2);

                if (dataSet2.Tables[0].Rows.Count == 0)
                {
                    SkyComm.ShowMessageInfo("此台机器没有结算信息,已经记录结算时间");
                }
                else
                {
                    dataSet2.WriteXml(Application.StartupPath + @"\\ReportXml\\自助机结算.xml");
                    string       path  = Application.StartupPath + @"\\Reports\\自助机结算.frx";
                    PrintManager print = new PrintManager();
                    print.InitReport("自助机结算");
                    print.AddParam("结算时间", DateTime.Now.ToLocalTime().ToString());
                    print.AddData(dataSet2.Tables[0], "report");
                    PrintManager.CanDesign = true;
                    print.Print();
                    print.Dispose();
                }


                #endregion
            }
            catch (Exception e1)
            {
                SkyComm.ShowMessageInfo(e1.Message);
                return;
            }


            #region 记录结算



            DataSet data = new DataSet();

            Hashtable hashtable = new Hashtable();

            string mSql = "delete from SETTLEMENT_RECORD where MECHINNO = @MECHINNO";// and BANKSTATE = '1'
            hashtable.Add("@MECHINNO", mechinNo);



            querySolutionFacade.ExeNonQuery(mSql, hashtable);



            string sql = "insert into SETTLEMENT_RECORD values (@SETTLEMENT_TIME,'已结算',@MECHINNO);";
            hashtable.Add("@SETTLEMENT_TIME", DateTime.Now.ToString("yyyy-MM-dd"));


            data = querySolutionFacade.ExeQuery(sql, hashtable);
            #endregion


            #region 记录结算时间
            string    sql4       = "delete from SETTLEMENT_TIME where M_NO = @M_NO";
            Hashtable hashtable4 = new Hashtable();
            hashtable4.Add("@M_NO", mechinNo);
            int       a          = querySolutionFacade.ExeNonQuery(sql4, hashtable4);
            string    sql5       = "insert into SETTLEMENT_TIME values (@TIMES,@M_NO)";
            Hashtable hashtable5 = new Hashtable();
            hashtable5.Add("@TIMES", DateTime.Now.ToLocalTime().ToString());
            hashtable5.Add("@M_NO", mechinNo);
            int b = querySolutionFacade.ExeNonQuery(sql5, hashtable5);

            #endregion



            SkyComm.ShowMessageInfo("现金结算成功");

            //_mSquareAccountsPresenter = new SquareAccountsPresenter(this);

            //_mSquareAccountsPresenter.GetSquareAccount();
        }
Example #10
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);
                }
            }
        }
        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);
                }
            }
        }
        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);
                }
            }
        }
Example #13
0
        private void lblInhosCostListPrint_Click(object sender, EventArgs e)
        {
            try
            {
                this.ucTime1.timer1.Stop();
                //if (!checkPrintCount())
                //{
                //    SkyComm.ShowMessageInfo("此住院费用清单已被打印过,不可再次打印!");
                //    ucTime1.Sec = 60;
                //    ucTime1.timer1.Start();
                //    return;
                //}

                if (false == System.IO.File.Exists(Application.StartupPath + @"\\Reports\\住院费用清单.frx"))
                {
                    SkyComm.ShowMessageInfo("系统没有找到报表文件“住院费用清单.frx”!");
                    ucTime1.Sec = 60;
                    ucTime1.timer1.Start();
                    return;
                }
                this.AnsyWorker(ui =>
                {
                    ui.UpdateTitle("正在打印,请稍等...");

                    ui.SynUpdateUI(() =>
                    {
                        foreach (DataSet dsDetail1 in dsAllDetail)
                        {
                            DataSet dsDetail = dsDetail1.Copy();
                            if (dsDetail.Tables.Count == 0 || dsDetail.Tables[0].Rows.Count == 0)
                            {
                                continue;
                            }
                            dsDetail.WriteXml(Application.StartupPath + @"\\ReportXml\\住院费用清单.xml");
                            dsDetail.Tables[1].Columns.Add("结算日期", typeof(string));
                            dsDetail.Tables[1].Columns.Add("住院天数", typeof(string));
                            dsDetail.Tables[1].Columns.Add("性别", typeof(string));
                            dsDetail.Tables[1].Columns.Add("年龄", typeof(string));
                            dsDetail.Tables[1].Columns.Add("年龄单位", typeof(string));
                            foreach (DataRow dr in dsDetail.Tables[1].Rows)
                            {
                                if (dr["住院号"].ToString().Contains("d"))
                                {
                                    continue;
                                }
                                DataSet dsAccount = new AccountBalanceFacade().FindAccountBalanceInfo(dr["住院号"].ToString(), Convert.ToInt32(dr["住院次数"]));
                                dr["结算日期"]        = Convert.ToDateTime(dsAccount.Tables[0].Rows[0]["LEAVEHOSDATE"]).ToString("yyyy-MM-dd HH:mm:ss");
                                dr["住院天数"]        = dsAccount.Tables[0].Rows[0]["INHOSDAYS"];

                                DataSet dsInhosrecord = new LeaveHosRecordFacade().FindByInHosID(dr["住院号"].ToString(), Convert.ToInt32(dr["住院次数"]));
                                dr["性别"]   = dsInhosrecord.Tables[0].Rows[0]["SEX"];
                                dr["年龄"]   = dsInhosrecord.Tables[0].Rows[0]["AGE"];
                                dr["年龄单位"] = dsInhosrecord.Tables[0].Rows[0]["AGEUNIT"];
                            }
                            PrintManager print = new PrintManager();
                            print.InitReport("住院费用清单");
                            print.AddData(dsDetail.Tables[1], "report1");
                            print.AddData(dsDetail.Tables[0], "report2");

                            print.AddParam("医院名称", SysOperatorInfo.CustomerName);
                            print.AddParam("DATE", new CommonFacade().GetServerDateTime().ToString());
                            print.AddParam("操作员", SysOperatorInfo.OperatorID);
                            print.AddParam("操作员代码", SysOperatorInfo.OperatorCode);
                            PrintManager.CanDesign = true;
                            //print.PreView();
                            print.Print();
                            print.Dispose();
                        }
                        insertPrintCount();
                        Thread.Sleep(100);
                        ucTime1.Sec = 60;
                        ucTime1.timer1.Start();
                    });
                });
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("住院费用清单打印异常:" + ex.Message);
                ucTime1.Sec = 60;
                ucTime1.timer1.Start();
            }
            finally
            {
                //ucTime1.Sec = 60;
                //ucTime1.timer1.Start();
            }
        }
        private void Publish()
        {
            string      prop             = cbRevisions.SelectedItem.ToString();
            int         selectedSequence = RevisionSequenceNumber(prop);
            Transaction trans            = new Transaction(myRevitDoc, "Publish");

            dInfo = new DirectoryInfo(txtPrintLocation.Text);

            try
            {
                #region CreateSheetSet

                set = new ViewSet();

                foreach (ViewSheet vss in viewSheets)
                {
                    IList <ElementId> revisionIds = vss.GetAllRevisionIds();

                    foreach (ElementId i in revisionIds)
                    {
                        Element  elem = myRevitDoc.GetElement(i);
                        Revision r    = elem as Revision;

                        int    sequenceNumber = r.SequenceNumber;
                        string num            = vss.GetRevisionNumberOnSheet(i);
                        string date           = r.RevisionDate;

                        set.Insert(vss);
                    }
                }

                PrintManager print = myRevitDoc.PrintManager;
                print.PrintRange = PrintRange.Select;
                ViewSheetSetting viewSheetSetting = print.ViewSheetSetting;
                viewSheetSetting.CurrentViewSheetSet.Views = set;

                trans.Start();
                viewSheetSetting.SaveAs(prop);
                trans.Commit();

                #endregion

                // Create a file listener and wait until all the files have been printed before renaming
                w              = new FileSystemWatcher();
                w.Path         = dInfo.FullName;
                w.NotifyFilter = NotifyFilters.LastAccess
                                 | NotifyFilters.LastWrite
                                 | NotifyFilters.FileName
                                 | NotifyFilters.DirectoryName;

                w.Filter   = "*.pdf";
                w.Created += OnCreated;

                w.EnableRaisingEvents = true;

                // Print the newly created sheet set
                print.SubmitPrint();
                print.Dispose();
            }
            catch (Exception ex)
            {
                TaskDialog error = new TaskDialog("Publish");
                error.MainInstruction = "Failed to publish " + prop;
                error.MainContent     = ex.Message;
                trans.RollBack();
                error.Show();
            }
        }
        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);
        }
        private void lblClinicEmrPrint_Click(object sender, EventArgs e)
        {
            try
            {
                this.ucTime1.timer1.Stop();
                ClinicBriefemrData emr = listEmr.Find(a => a.PITCHON == true);
                if (emr == null)
                {
                    SkyComm.ShowMessageInfo("请选择您要打印的门诊病历信息");
                    return;
                }
                if (false == System.IO.File.Exists(Application.StartupPath + @"\\Reports\\门诊病历.frx"))
                {
                    SkyComm.ShowMessageInfo("系统没有找到报表文件“门诊病历.frx”!");
                    return;
                }
                ClinicPhysicianRecipeFacade recipeFacade = new ClinicPhysicianRecipeFacade();
                ClinicPhysicianRecipeData   RecipeData   = (ClinicPhysicianRecipeData)recipeFacade.FindRecipeInfoRepForReprint(emr.DiagnoseId, emr.Registerid);
                ClinicPhysicianRecipeData   dsTmp        = (ClinicPhysicianRecipeData)RecipeData.Clone();
                ClinicPhysicianRecipeData   dsTmpCheck   = (ClinicPhysicianRecipeData)RecipeData.Clone();
                string          item_Tmp    = string.Empty;
                string          item        = string.Empty;
                string          item2       = string.Empty;
                string          item3       = string.Empty;
                string          item4       = string.Empty;
                ClinicEmrFacade cef         = new ClinicEmrFacade();
                DataSet         CEFData     = cef.GetSchedulInfo(emr.DiagnoseId, emr.Registerid);
                string          ACCEPTSTIME = string.Empty;
                foreach (DataRow dsr in CEFData.Tables[0].Rows)
                {
                    if (dsr["ACCEPTSTIME"].ToString() != "")
                    {
                        ACCEPTSTIME = dsr["ACCEPTSTIME"].ToString();
                    }
                    else
                    {
                        ACCEPTSTIME = "";
                    }
                }
                foreach (DataRow datarow in RecipeData.Tables[0].Rows)
                {
                    if (Convert.ToInt32(datarow["RECIPESTATE"]) == 2)
                    { //过滤退过费
                        continue;
                    }

                    switch (datarow["RECIPETYPE"].ToString())
                    {
                    case "中草药":
                    case "药品费":
                        dsTmp.Tables[0].ImportRow(datarow);
                        break;

                    case "检查":
                        item += datarow["NAME"].ToString() + "    ";
                        dsTmpCheck.Tables[0].ImportRow(datarow);
                        break;

                    case "化验":
                        item2 += datarow["NAME"].ToString() + "    ";
                        dsTmpCheck.Tables[0].ImportRow(datarow);
                        break;

                    case "手术":
                        item3 += datarow["NAME"].ToString() + "    ";
                        dsTmpCheck.Tables[0].ImportRow(datarow);
                        break;

                    case "治疗":
                        datarow["RECIPETYPE"] = "治疗";
                        item4 += datarow["NAME"].ToString() + "    ";
                        dsTmpCheck.Tables[0].ImportRow(datarow);
                        break;
                    }
                }

                dsTmp = Facada(dsTmp);

                item_Tmp = (item == "" ? "" : item + "\r\n") + (item2 == "" ? "" : item2 + "\r\n") + (item3 == "" ? "" : item3 + "\r\n") + (item4 == "" ? "" : item4);
                if (!dsTmp.Tables[0].Columns.Contains("Type"))
                {
                    dsTmp.Tables[0].Columns.Add("Type", typeof(System.String)).DefaultValue = "";
                }


                foreach (DataRow row in dsTmp.Tables[0].Rows)
                {
                    DataSet ds = new MedUsageFacade().FindByMedUsage(row["MEDUSAGE"].ToString());
                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["TYPE"].ToString().Contains("静滴"))
                    {
                        row["Type"] = "静滴";
                    }
                    if (row["RECIPETYPE"].ToString() == "中草药")
                    {
                        row["DOSE"] = row["AMOUNT"];
                    }
                    foreach (DataColumn dc in dsTmp.Tables[0].Columns)
                    {
                        if (dc.DataType == typeof(System.Decimal))
                        {
                            double decValue = 0;
                            if (double.TryParse(row[dc.ColumnName].ToString(), out decValue))
                            {
                                row[dc.ColumnName] = Convert.ToDouble(decValue).ToString("0.######");
                            }
                        }
                    }
                }

                DataTable tb = dsTmp.Tables[0];
                if (dsTmp.Tables[0].Rows.Count > 0)
                {
                    tb = dsTmp.Tables[0].Select("", "CLINICRECIPEID,GROUPNUM").CopyToDataTable();
                }


                dsTmp.WriteXml(Application.StartupPath + @"\\ReportXML\\门诊病历or治疗建议YP.xml");
                dsTmpCheck.WriteXml(Application.StartupPath + @"\\ReportXML\\门诊病历or治疗建议ZL.xml");

                PatientInfoFacade patientinfo = new PatientInfoFacade();
                DataSet           dataset     = patientinfo.FindPateintByDiagnoseID(emr.DiagnoseId);

                F_DIAGNOSEFacade diagnose = new F_DIAGNOSEFacade();
                DataSet          dataset1 = diagnose.FindByCustomID(emr.DiagnoseId, "DIAGNOSEID");

                PrintManager print = new PrintManager();
                print.InitReport("门诊病历");
                print.AddParam("诊疗号", emr.DiagnoseId);
                print.AddParam("挂号号", emr.Registerid);
                print.AddParam("PATIENTNAME", emr.PATIENTNAME); //姓名  PATIENTNAME
                print.AddParam("SEX", emr.SEX);                 //性别   SEX
                print.AddParam("AVOIRDUPOIS", emr.AVOIRDUPOIS); //体重   AVOIRDUPOIS
                print.AddParam("AGE", emr.AGE);                 //年龄   AGE
                print.AddParam("AGEUNIT", emr.AGEUNIT);         //年龄单位
                print.AddParam("费用类别", "");                     //费用类别
                print.AddParam("OPERATETIME", emr.VisitTime);   //就诊时间  VisitTime
                print.AddParam("REGISTEROFFIC", emr.Office);    //就诊科室  office
                print.AddParam("主诉", emr == null ? "" : emr.CaseinChief);
                print.AddParam("病史", emr == null ? "" : emr.Emrcontent);
                print.AddParam("查体", emr == null ? "" : emr.Physical);
                print.AddParam("治疗建议", emr == null ? "" : emr.Notice);
                print.AddParam("临床诊断", emr.DiagResult);                                             //门诊诊断  DiagResult
                print.AddParam("医生", emr.VisitDoctorName);                                          //接诊医生  VisitDoctorName
                print.AddParam("检查", item_Tmp);                                                     //检查
                print.AddParam("过敏史", emr.Allergen);                                                //过敏史
                print.AddParam("TELEPHONE", emr.TELEPHONE);                                         //联系电话
                print.AddParam("ADDRESS", emr.ADDRESS);                                             //地址
                print.AddParam("EMPLOYMENT", emr.EMPLOYMENT);                                       //职业
                print.AddParam("监护人", emr.Guardian);                                                //监护人
                print.AddParam("血压", emr.SystolicPressure + "/" + emr.DiastolicPressure + " mmHg"); //血压
                print.AddParam("ACCEPTSTIME", ACCEPTSTIME.ToString());                              //就诊开始时间 17417
                print.AddParam("医院名称", SysOperatorInfo.CustomerName);                               //医院名称
                print.AddParam("OPERATETIME", emr.VisitTime == null ? "" : emr.VisitTime.ToString());

                if (dataset != null && dataset.Tables[0].Rows.Count > 0)
                {
                    print.AddParam("BIRTHDAY", dataset.Tables[0].Rows[0]["BIRTHDAY"].ToString());             //出生日期
                    print.AddParam("EMPLOYMENT", dataset.Tables[0].Rows[0]["EMPLOYMENT"].ToString());         //职业
                    print.AddParam("MARRIAGESTATUS", dataset.Tables[0].Rows[0]["MARRIAGESTATUS"].ToString()); //婚姻状况
                    print.AddParam("NATION", dataset.Tables[0].Rows[0]["NATION"].ToString());                 //民族
                    //  print.AddParam("ACCEPTSTIME", dataset.Tables[0].Rows[0]["ACCEPTSTIME"].ToString());   //就诊开始时间
                }
                else
                {
                    print.AddParam("BIRTHDAY", "");       //出生日期
                    print.AddParam("EMPLOYMENT", "");     //职业
                    print.AddParam("MARRIAGESTATUS", ""); //婚姻状况
                    print.AddParam("NATION", "");         //民族
                }

                if (dataset1 != null && dataset1.Tables.Count > 0 && dataset1.Tables[0].Rows.Count > 0)
                {
                    print.AddParam("病名", dataset1.Tables[0].Rows[0]["SICKNESSNAME3"].ToString()); //病名
                    print.AddParam("证型", dataset1.Tables[0].Rows[0]["SICKNESS2"].ToString());     //证型
                }
                else
                {
                    print.AddParam("病名", "");   //病名
                    print.AddParam("证型", "");   //证型
                }
                print.AddData(dsTmpCheck.Tables[0], "report1");

                #region 构造病历数据集

                DataTable dt = new DataTable("reportemr");
                dt.Columns.Add("主诉");
                dt.Columns.Add("病史");
                dt.Columns.Add("查体");
                dt.Columns.Add("治疗建议");
                dt.Columns.Add("临床诊断");
                dt.Columns.Add("病名");
                dt.Columns.Add("证型");
                dt.Columns.Add("医生");
                dt.Columns.Add("检查");

                dt.Columns.Add("病生状态");
                dt.Columns.Add("过敏史");
                dt.Columns.Add("TELEPHONE");
                dt.Columns.Add("ADDRESS");
                dt.Columns.Add("EMPLOYMENT");
                dt.Columns.Add("监护人");

                DataRow theNewRow = dt.NewRow();
                theNewRow["主诉"]   = emr == null ? "" : emr.CaseinChief;
                theNewRow["病史"]   = emr == null ? "" : emr.Emrcontent;
                theNewRow["查体"]   = emr == null ? "" : emr.Physical;
                theNewRow["治疗建议"] = emr == null ? "" : emr.Notice;
                theNewRow["临床诊断"] = emr.DiagResult;
                if (dataset1 != null && dataset1.Tables[0].Rows.Count > 0)
                {
                    theNewRow["病名"] = dataset1.Tables[0].Rows[0]["SICKNESSNAME3"].ToString();
                    theNewRow["证型"] = dataset1.Tables[0].Rows[0]["SICKNESS2"].ToString();
                }
                theNewRow["医生"]         = SysOperatorInfo.OperatorName;
                theNewRow["检查"]         = item;
                theNewRow["病生状态"]       = emr.Morbidity;
                theNewRow["过敏史"]        = emr.Allergen;
                theNewRow["TELEPHONE"]  = emr.TELEPHONE;
                theNewRow["ADDRESS"]    = emr.ADDRESS;
                theNewRow["EMPLOYMENT"] = emr.EMPLOYMENT;
                theNewRow["监护人"]        = emr.Guardian;

                dt.Rows.Add(theNewRow);

                dt.WriteXml(Application.StartupPath + @"\\ReportXML\\门诊病历打印病历数据集.xml");

                print.AddData(dt, "reportemr");

                #endregion

                EPadidiographFacade eFacade = new EPadidiographFacade();
                DataSet             eData   = eFacade.GetByUserid(emr.VisitDoctor);
                print.AddData(eData.Tables[0], "dsPic"); //电子签名
                print.AddData(tb, "report");

                PrintManager.CanDesign = true;

                print.Print();
                print.Dispose();
                Thread.Sleep(100);
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("门诊病历打印异常:" + ex.Message);
            }
            finally
            {
                ucTime1.Sec = 60;
                ucTime1.timer1.Start();
            }
        }
        private void lblClinicEmrPrint_Click(object sender, EventArgs e)
        {
            try
            {
                this.ucTime1.timer1.Stop();
                if (false == System.IO.File.Exists(Application.StartupPath + @"\\Reports\\门诊费用清单.frx"))
                {
                    SkyComm.ShowMessageInfo("系统没有找到报表文件“门诊费用清单.frx”!");
                    return;
                }

                this.AnsyWorker(ui =>
                {
                    ui.UpdateTitle("正在准备数据,请稍等...");

                    ui.SynUpdateUI(() =>
                    {
                        #region 查询列表
                        string[] Condition         = { "", "", "", SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), "", "", "" };
                        DetailAccountFacade facade = new DetailAccountFacade();
                        DateTime dtStart           = Convert.ToDateTime("2016-01-01");
                        DateTime dtEnd             = Convert.ToDateTime("2016-10-11");
                        DataSet ds = facade.QueryPatientPayList(Condition, dtStart, dtEnd);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow row in ds.Tables[0].Rows)
                            {
                                row["MONEY"] = decimal.Round(decimal.Parse(row["MONEY"].ToString()), 2);
                            }
                        }
                        #endregion
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                            SkyComm.ShowMessageInfo("所选时间段内未找到门诊费用信息!");
                            return;
                        }

                        ui.UpdateTitle("正在打印,请稍等...");
                        ds.WriteXml(Application.StartupPath + @"\\ReportXml\\门诊费用清单.xml");
                        PrintManager print = new PrintManager();
                        print.InitReport("门诊费用清单");
                        print.AddData(ds.Tables[0], "report");

                        Hashtable MedType = new Hashtable();
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            if (dr["MEDICARETYPE"].ToString().Trim() != string.Empty)
                            {
                                if (MedType.ContainsKey("医保" + dr["MEDICARETYPE"].ToString()) == false)
                                {
                                    MedType.Add("医保" + dr["MEDICARETYPE"].ToString(), Convert.ToDecimal(dr["MONEY"]));
                                }
                                else
                                {
                                    MedType["医保" + dr["MEDICARETYPE"].ToString()] = Convert.ToDecimal(MedType["医保" + dr["MEDICARETYPE"].ToString()]) + Convert.ToDecimal(dr["MONEY"]);
                                }
                            }

                            if (dr["NMEDICARETYPE"].ToString().Trim() != string.Empty)
                            {
                                if (MedType.ContainsKey("农保" + dr["NMEDICARETYPE"].ToString()) == false)
                                {
                                    MedType.Add("农保" + dr["NMEDICARETYPE"].ToString(), Convert.ToDecimal(dr["MONEY"]));
                                }
                                else
                                {
                                    MedType["农保" + dr["NMEDICARETYPE"].ToString()] = Convert.ToDecimal(MedType["农保" + dr["NMEDICARETYPE"].ToString()]) + Convert.ToDecimal(dr["MONEY"]);
                                }
                            }
                        }

                        foreach (DictionaryEntry de in MedType)
                        {
                            print.AddParam(de.Key.ToString(), de.Value.ToString());
                        }

                        PrintManager.CanDesign = true;
                        //print.PreView();
                        print.Print();
                        print.Dispose();
                        Thread.Sleep(100);
                    });
                });
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("门诊费用清单打印异常:" + ex.Message);
            }
            finally
            {
                ucTime1.Sec = 60;
                ucTime1.timer1.Start();
            }
        }