/// <summary> /// 将列的代码和行的代码转换成中文名称 /// </summary> /// <param name="tbData"></param> /// <param name="style"></param> private static void ConvertCodeToName(BaseReport report) { for (int i = 0; i < report.BaseReportData.Rows.Count; i++) { string id = Convert.IsDBNull(report.BaseReportData.Rows[i]["ID"]) ? "0" : report.BaseReportData.Rows[i]["ID"].ToString( ).Trim( ); id = id.Trim( ) == "" ? "0" : id; string code = Convert.IsDBNull(report.BaseReportData.Rows[i]["CODE"]) ? "0" : report.BaseReportData.Rows[i]["CODE"].ToString( ).Trim( ); if (report is DoctorIncomeReport || report is TollerIncomeReport) { id = PublicDataReader.GetEmployeeNameById(Convert.ToInt32(id)); } else if (report is DepartmentIncomeReport) { id = PublicDataReader.GetDeptNameById(Convert.ToInt32(id)); } else if (report is PatientTypeIncomReport) { id = PublicDataReader.GetPatientTypeNameByCode(id); } id = id.Trim( ) == "" ? "<未指定>" : id; if (report.StatType != StatClassType.收费支付类型) { code = GetItemNameByCode(code, report.StatType); } report.BaseReportData.Rows[i]["ID"] = id; report.BaseReportData.Rows[i]["CODE"] = code; } }
/// <summary> /// 获取挂号统计报表(NAME,DATE,NUM) /// </summary> /// <param name="ViewType">0-按医生 1-按科室</param> /// <param name="beginDate"></param> /// <param name="endDate"></param> /// <returns></returns> public static DataSet GetRegisterReport(int ViewType, DateTime beginDate, DateTime endDate) { DataTable tbReg = GetRegisterData(beginDate, endDate); DataTable tbResultByName = new DataTable( ); tbResultByName.TableName = "TB_A"; tbResultByName.Columns.Add("CODE", Type.GetType("System.String")); tbResultByName.Columns.Add("NAME", Type.GetType("System.String")); tbResultByName.Columns.Add("NUM", Type.GetType("System.Int32")); tbResultByName.Columns.Add("MONEY", Type.GetType("System.Decimal")); DataTable tbResultByDate = new DataTable( ); tbResultByDate.TableName = "TB_B"; tbResultByDate.Columns.Add("DATE", Type.GetType("System.String")); tbResultByDate.Columns.Add("NUM", Type.GetType("System.Int32")); string fileName = ""; if (ViewType == 0) { fileName = "PRESDOCCODE"; } else { fileName = "PRESDEPTCODE"; } for (int i = 0; i < tbReg.Rows.Count; i++) { string code = tbReg.Rows[i][fileName].ToString().Trim(); DataRow[] drs = tbResultByName.Select("CODE='" + code + "'"); if (drs.Length == 0) { DataRow dr = tbResultByName.NewRow( ); dr["CODE"] = code; if (ViewType == 0) { dr["NAME"] = code == "" ? "未指定" : PublicDataReader.GetEmployeeNameById(Convert.ToInt32(code)); } else { dr["NAME"] = code == "" ? "未指定" : PublicDataReader.GetDeptNameById(Convert.ToInt32(code)); } dr["NUM"] = tbReg.Rows[i]["REGNUM"]; tbResultByName.Rows.Add(dr); } else { drs[0]["NUM"] = Convert.ToInt32(tbReg.Rows[i]["REGNUM"]) + (Convert.IsDBNull(drs[0]["NUM"]) ? 0 : Convert.ToInt32(drs[0]["NUM"])); } //日期 drs = tbResultByDate.Select("DATE='" + Convert.ToDateTime(tbReg.Rows[i]["PRESDATE"]).ToString("yyyy-MM-dd") + "'"); if (drs.Length == 0) { DataRow dr = tbResultByDate.NewRow( ); dr["DATE"] = Convert.ToDateTime(tbReg.Rows[i]["PRESDATE"]).ToString("yyyy-MM-dd"); dr["NUM"] = tbReg.Rows[i]["REGNUM"]; tbResultByDate.Rows.Add(dr); } else { int num = Convert.IsDBNull(drs[0]["NUM"]) ? 0 : Convert.ToInt32(drs[0]["NUM"]); int num1 = Convert.IsDBNull(tbReg.Rows[i]["REGNUM"]) ? 0 : Convert.ToInt32(tbReg.Rows[i]["REGNUM"]); num = num + num1; drs[0]["NUM"] = num; } } DataSet dsResult = new DataSet( ); dsResult.Tables.Add(tbResultByName); dsResult.Tables.Add(tbResultByDate); return(dsResult); }