Exemple #1
0
        public void PatCostTotal_Rpt_AddCol(HIS.ZY_BLL.CostItemType cit)
        {
            DataTable dt = null;

            HIS.ZY_BLL.PatDeptAndPatientReport pdapr = new HIS.ZY_BLL.PatDeptAndPatientReport();
            pdapr.costItemType = cit;
            dt = pdapr.GetAddCol;

            DataColumn dc = null;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dc = new DataColumn(dt.Rows[i][0].ToString(), typeof(string), null, MappingType.Element);
                PatCostTotal_Rpt.Columns.Add(dc);
            }
        }
Exemple #2
0
        /// <summary>
        /// 绑定统计数据
        /// </summary>
        /// <param name="IsIn">在院true</param>
        /// <param name="CureDeptCode">科室代码</param>
        /// <param name="Bdate">开始日期</param>
        /// <param name="Edate">结束日期</param>
        /// <param name="cis">统计方式</param>
        /// <param name="cit">统计类型</param>
        public void BindPatItemData(bool IsIn, string CureDeptCode, DateTime?Bdate, DateTime?Edate, HIS.ZY_BLL.CostItemStyle cis, HIS.ZY_BLL.CostItemType cit)
        {
            try
            {
                HIS.ZY_BLL.PatDeptAndPatientReport reportData = new HIS.ZY_BLL.PatDeptAndPatientReport();
                reportData.Bdate         = Bdate;
                reportData.Edate         = Edate;
                reportData.costItemType  = cit;
                reportData.costItemStyle = cis;
                reportData.IsInHis       = IsIn;
                reportData.CureDeptCode  = CureDeptCode;

                DataTable[] dt = reportData.GetReportData();

                DataTable dtFee  = dt[0];
                DataTable dtDept = dt[1];


                decimal SumDec = 0;
                for (int i = 0; i < dtDept.Rows.Count; i++)//循环所有科室
                {
                    DataRow dr = PatCostTotal_Rpt.NewRow();
                    dr[0] = BaseData.GetDeptName(dtDept.Rows[i][0].ToString());
                    dr[1] = "";
                    dr[2] = BaseData.GetPatName(Convert.ToInt32(dtDept.Rows[i][1]));
                    decimal dec = 0;
                    for (int m = 4; m < PatCostTotal_Rpt.Columns.Count; m++) //循环费用列
                    {
                        for (int j = 0; j < dtFee.Rows.Count; j++)           //循环所有费用
                        {
                            if (dtDept.Rows[i][0].ToString() == dtFee.Rows[j][0].ToString() && dtDept.Rows[i][1].ToString() == dtFee.Rows[j][1].ToString())
                            {
                                if (dtFee.Rows[j]["itemname"].ToString() == PatCostTotal_Rpt.Columns[m].ColumnName)
                                {
                                    dec  += Convert.ToDecimal(dtFee.Rows[j]["TOLAL_FEE"]);
                                    dr[m] = Convert.ToDecimal(dtFee.Rows[j]["TOLAL_FEE"]).ToString("0.00");
                                    continue;//找到对应费用项目退出循环
                                }
                            }
                        }
                    }
                    SumDec += dec;
                    dr[3]   = dec.ToString("0.00");
                    PatCostTotal_Rpt.Rows.Add(dr);
                }
                //添加合计
                if (dtDept.Rows.Count > 0)
                {
                    DataRow dr = PatCostTotal_Rpt.NewRow();
                    dr[0] = "合计";
                    dr[1] = "";
                    dr[2] = "";
                    dr[3] = SumDec.ToString("0.00");//合计全部
                    for (int m = 4; m < PatCostTotal_Rpt.Columns.Count; m++)
                    {
                        decimal dec = 0;
                        for (int n = 0; n < PatCostTotal_Rpt.Rows.Count; n++)
                        {
                            dec += Convert.ToDecimal(PatCostTotal_Rpt.Rows[n][m] == DBNull.Value ? 0 : PatCostTotal_Rpt.Rows[n][m]);
                        }
                        dr[m] = dec.ToString("0.00");//合计每个项目
                    }
                    PatCostTotal_Rpt.Rows.Add(dr);
                }
            }
            catch (System.Exception e)
            {
                throw new Exception(e.Message);
            }
        }