internal virtual IEnumerable <TFormatter> GetFormatters(SheetParameterContainer paramContainer) { foreach (var kv in formatters) { yield return(CreateElementFormatter(paramContainer[kv.Key], kv.Value)); } }
/// <summary> /// 表格格式化器 /// </summary> private static void CreateExcel03() { var temp = ($@"{AppDomain.CurrentDomain.BaseDirectory}3.0\"); var excel = temp + "Template.xls"; var xml = temp + "Template.xml"; Parse(excel).Save(xml); var workbookParameterContainer = new WorkbookParameterContainer(); workbookParameterContainer.Load(xml); SheetParameterContainer sheetParameterContainer = workbookParameterContainer["表格格式化器"]; int num = 0; ExportHelper.ExportToLocal(excel, temp + "3.0demo.xls", new SheetFormatter("表格格式化器", new TableFormatter <StudentInfo>(sheetParameterContainer["No"], StudentLogic.GetList(), new CellFormatter <StudentInfo>(sheetParameterContainer["No"], t => num++), new CellFormatter <StudentInfo>(sheetParameterContainer["Name"], t => t.Name), new CellFormatter <StudentInfo>(sheetParameterContainer["Gender"], t => t.Gender ? "男" : "女"), new CellFormatter <StudentInfo>(sheetParameterContainer["Class"], t => t.Class), new CellFormatter <StudentInfo>(sheetParameterContainer["RecordNo"], t => t.RecordNo), new CellFormatter <StudentInfo>(sheetParameterContainer["Phone"], t => t.Phone), new CellFormatter <StudentInfo>(sheetParameterContainer["Email"], t => t.Email) ) ) ); }
IEnumerable <ElementFormatter> IElementFormatterBuilder.GetElementFormatters(SheetParameterContainer paramContainer) { foreach (var item in pictureInfos) { yield return(new PictureWithShapeFormatter(item)); } }
/// <summary> /// 由SheetFormatterContainer集合导出基于多工作薄的EXCEL模板的文件 /// </summary> /// <param name="templatePath">模板路径</param> /// <param name="formatterContainers">模板数据格式化容器字典(Key:Sheet名称,Value:模板数据格式化容器对象)</param> /// <param name="filePath">导出路径,可选</param> /// <returns></returns> public static string ToExcelWithTemplate(string templatePath, IDictionary <string, SheetFormatterContainer> formatterContainers, string filePath = null) { Common.CheckTemplateAndExportPath(templatePath, ref filePath); if (string.IsNullOrEmpty(filePath)) { return(null); } string templateConfigFilePath = Common.GetTemplateConfigFilePath(templatePath, false); var workbookParameterContainer = new WorkbookParameterContainer(); workbookParameterContainer.Load(templateConfigFilePath); List <SheetFormatter> sheetFormatterList = new List <SheetFormatter>(); foreach (var item in formatterContainers) { SheetParameterContainer sheetParameterContainer = workbookParameterContainer[item.Key]; sheetFormatterList.Add(new SheetFormatter(item.Key, item.Value.GetFormatters(sheetParameterContainer))); } ExportHelper.ExportToLocal(templatePath, filePath, sheetFormatterList.ToArray()); return(filePath); }
private void btnExport_Click(object sender, EventArgs e) { var saveFileDlg = new SaveFileDialog { Filter = Resources.SaveFileFilter }; if (DialogResult.OK.Equals(saveFileDlg.ShowDialog())) { var workbookParameterContainer = new WorkbookParameterContainer(); workbookParameterContainer.Load(@"Template\Template.xml"); SheetParameterContainer sheetParameterContainer = workbookParameterContainer["重复单元格式化器"]; ExportHelper.ExportToLocal(@"Template\Template.xls", saveFileDlg.FileName, new SheetFormatter("重复单元格式化器", new RepeaterFormatter <StudentInfo>(sheetParameterContainer["rptStudentInfo_Start"], sheetParameterContainer["rptStudentInfo_End"], StudentLogic.GetList(), new CellFormatter <StudentInfo>(sheetParameterContainer["Name"], t => t.Name), new CellFormatter <StudentInfo>(sheetParameterContainer["Gender"], t => t.Gender ? "男" : "女"), new CellFormatter <StudentInfo>(sheetParameterContainer["Class"], t => t.Class), new CellFormatter <StudentInfo>(sheetParameterContainer["RecordNo"], t => t.RecordNo), new CellFormatter <StudentInfo>(sheetParameterContainer["Phone"], t => t.Phone), new CellFormatter <StudentInfo>(sheetParameterContainer["Email"], t => t.Email) ) ) ); } }
protected override void CreatFormatter() { IReportService reporService = IOCContainer.Instance.Resolve <IReportService>(); var data = reporService.GetFeeByRegionReport(StartTime, EndTime); var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); SheetParameterContainer sheetContainer = parameterContainer["Sheet1"]; var dataFormatter = new List <ElementFormatter>(); dataFormatter.Add(new CellFormatter(sheetContainer["StartDate"], data.StartDate)); dataFormatter.Add(new CellFormatter(sheetContainer["EndDate"], data.EndDate)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurResNum"], data.SumCurrent.ResNum)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurHospDay"], data.SumCurrent.HospDay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurFee"], data.SumCurrent.Fee)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurMedFee"], data.SumCurrent.MedFee)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurNciPay"], data.SumCurrent.NciPay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurSvcDep"], data.SumCurrent.SvcDep)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurDecut"], data.SumCurrent.Decut)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurAccNciPay"], data.SumCurrent.AccNciPay)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalResNum"], data.SumTotal.ResNum)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalHospDay"], data.SumTotal.HospDay)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalFee"], data.SumTotal.Fee)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalMedFee"], data.SumTotal.MedFee)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalNciPay"], data.SumTotal.NciPay)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalSvcDep"], data.SumTotal.SvcDep)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalDecut"], data.SumTotal.Decut)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalAccNciPay"], data.SumTotal.AccNciPay)); var indexNum = 1; var tableFormatter = new TableFormatter <FeeReportComDetail>(sheetContainer["Index"], data.DataDetail, new CellFormatter <FeeReportComDetail>(sheetContainer["Index"], t => indexNum++), new CellFormatter <FeeReportComDetail>(sheetContainer["OrgName"], t => t.GroupColumn1), new CellFormatter <FeeReportComDetail>(sheetContainer["CurResNum"], t => t.Current.ResNum), new CellFormatter <FeeReportComDetail>(sheetContainer["CurHospDay"], t => t.Current.HospDay), new CellFormatter <FeeReportComDetail>(sheetContainer["CurFee"], t => t.Current.Fee), new CellFormatter <FeeReportComDetail>(sheetContainer["CurMedFee"], t => t.Current.MedFee), new CellFormatter <FeeReportComDetail>(sheetContainer["CurNciPay"], t => t.Current.NciPay), new CellFormatter <FeeReportComDetail>(sheetContainer["CurSvcDep"], t => t.Current.SvcDep), new CellFormatter <FeeReportComDetail>(sheetContainer["CurDecut"], t => t.Current.Decut), new CellFormatter <FeeReportComDetail>(sheetContainer["CurAccNciPay"], t => t.Current.AccNciPay) //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalResNum"], t => t.Total.ResNum), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalHospDay"], t => t.Total.HospDay), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalFee"], t => t.Total.Fee), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalMedFee"], t => t.Total.MedFee), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalNciPay"], t => t.Total.NciPay), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalSvcDep"], t => t.Total.SvcDep), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalDecut"], t => t.Total.Decut), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalAccNciPay"], t => t.Total.AccNciPay) ); dataFormatter.Add(tableFormatter); Formatter = new SheetFormatter("Sheet1", dataFormatter.ToArray()); }
internal ElementFormatter[] GetFormatters(SheetParameterContainer paramContainer) { List <ElementFormatter> formatters = new List <ElementFormatter>(); for (var i = 0; i < FormatterBuilders.Count; i++) { var builder = FormatterBuilders[i]; formatters.AddRange(builder.GetElementFormatters(paramContainer)); } return(formatters.ToArray()); }
protected override void CreatFormatter() { IReportService reporService = IOCContainer.Instance.Resolve <IReportService>(); var data = reporService.GetFeeByCareTypeMainReport(StartTime, EndTime); var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); SheetParameterContainer sheetContainer = parameterContainer["Sheet1"]; var dataFormatter = new List <ElementFormatter>(); dataFormatter.Add(new CellFormatter(sheetContainer["StartDate"], data.StartDate + " - ")); dataFormatter.Add(new CellFormatter(sheetContainer["EndDate"], data.EndDate)); dataFormatter.Add(new CellFormatter(sheetContainer["SumSpecCareResNum"], data.SumTotal.SpecCareResNum)); dataFormatter.Add(new CellFormatter(sheetContainer["SumSpecCareHospDay"], data.SumTotal.SpecCareHospDay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumSpecCareFee"], data.SumTotal.SpecCareFee)); dataFormatter.Add(new CellFormatter(sheetContainer["SumSpecCareNciPay"], data.SumTotal.SpecCareNciPay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumOrgCareResNum"], data.SumTotal.OrgCareResNum)); dataFormatter.Add(new CellFormatter(sheetContainer["SumOrgCareHospDay"], data.SumTotal.OrgCareHospDay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumOrgCareFee"], data.SumTotal.OrgCareFee)); dataFormatter.Add(new CellFormatter(sheetContainer["SumOrgCareNciPay"], data.SumTotal.OrgCareNciPay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurResNum"], data.SumTotal.ResNum)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurFee"], data.SumTotal.Fee)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurNciPay"], data.SumTotal.NciPay)); var indexNum = 1; var tableFormatter = new TableFormatter <FeeByCareTypeDetail>(sheetContainer["Index"], data.Detail, new CellFormatter <FeeByCareTypeDetail>(sheetContainer["Index"], t => indexNum++), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["OrgName"], t => t.OrgName), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["SpecCareResNum"], t => t.SpecCareResNum), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["SpecCareHospDay"], t => t.SpecCareHospDay), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["SpecCareFee"], t => t.SpecCareFee), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["SpecCareNciPay"], t => t.SpecCareNciPay), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["OrgCareResNum"], t => t.OrgCareResNum), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["OrgCareHospDay"], t => t.OrgCareHospDay), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["OrgCareFee"], t => t.OrgCareFee), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["OrgCareNciPay"], t => t.OrgCareNciPay), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["CurResNum"], t => t.ResNum), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["CurFee"], t => t.Fee), new CellFormatter <FeeByCareTypeDetail>(sheetContainer["CurNciPay"], t => t.NciPay) ); dataFormatter.Add(tableFormatter); Formatter = new SheetFormatter("Sheet1", dataFormatter.ToArray()); }
internal override IEnumerable <ElementFormatter> GetFormatters(SheetParameterContainer paramContainer) { this.paramContainer = paramContainer; List <EmbeddedFormatter <T> > cellFormatters = new List <EmbeddedFormatter <T> >(); foreach (var kv in formatters) { cellFormatters.Add(new CellFormatter <T>(paramContainer[kv.Key], kv.Value)); } if (otherFormatterBuilders.Count > 0) { foreach (var item in otherFormatterBuilders) { cellFormatters.AddRange(item.GetEmbeddedFormatters(paramContainer) as IEnumerable <EmbeddedFormatter <T> >); } } return(new[] { CreateElementFormatter(paramContainer[startParamName], cellFormatters.ToArray()) }); }
/// <summary> ///由SheetFormatterContainer导出基于EXCEL模板的文件 /// </summary> /// <param name="templatePath">模板路径</param> /// <param name="sheetName">模板中使用的工作薄名称</param> /// <param name="formatterContainer">模板数据格式化容器</param> /// <param name="filePath">导出路径,可选</param> /// <returns></returns> public static string ToExcelWithTemplate(string templatePath, string sheetName, SheetFormatterContainer formatterContainer, string filePath = null) { Common.CheckTemplateAndExportPath(templatePath, ref filePath); if (string.IsNullOrEmpty(filePath)) { return(null); } string templateConfigFilePath = Common.GetTemplateConfigFilePath(templatePath, false); var workbookParameterContainer = new WorkbookParameterContainer(); workbookParameterContainer.Load(templateConfigFilePath); SheetParameterContainer sheetParameterContainer = workbookParameterContainer[sheetName]; ExportHelper.ExportToLocal(templatePath, filePath, new SheetFormatter(sheetName, formatterContainer.GetFormatters(sheetParameterContainer))); return(filePath); }
public static void resolveExcel(string temlateFile, string saveExcel, List <chestInfo> list) { sheetName = "Sheet1"; var workbookParameterContainer = Parse(temlateFile); SheetParameterContainer sheetParameterContainer = workbookParameterContainer[sheetName]; Stream excelStrem = Export.ExportToStream(temlateFile, new SheetFormatter(sheetName, new RepeaterFormatter <chestInfo>(sheetParameterContainer["repeat_start"], sheetParameterContainer["repeat_end"], list, new CellFormatter <chestInfo>(sheetParameterContainer["Group"], t => t.Group), new CellFormatter <chestInfo>(sheetParameterContainer["total"], t => t.total), new CellFormatter <chestInfo>(sheetParameterContainer["ChestTitle"], t => t.ChestTitle) ) ) ); ExportHelper.ExportToLocal(temlateFile, saveExcel, new SheetFormatter(sheetName, new RepeaterFormatter <chestInfo>(sheetParameterContainer["repeat1_start"], sheetParameterContainer["repeat1_end"], list, new CellFormatter <chestInfo>(sheetParameterContainer["IncNum"], t => t.IncNum), new CellFormatter <chestInfo>(sheetParameterContainer["Parts"], t => t.Parts), new CellFormatter <chestInfo>(sheetParameterContainer["Materials"], t => t.Materials), new CellFormatter <chestInfo>(sheetParameterContainer["Color"], t => t.Color), new CellFormatter <chestInfo>(sheetParameterContainer["Brand"], t => t.Brand), new CellFormatter <chestInfo>(sheetParameterContainer["H"], t => t.H), new CellFormatter <chestInfo>(sheetParameterContainer["W"], t => t.W), new CellFormatter <chestInfo>(sheetParameterContainer["D"], t => t.D), new CellFormatter <chestInfo>(sheetParameterContainer["Count"], t => t.Count), new CellFormatter <chestInfo>(sheetParameterContainer["Unit"], t => t.Unit), new CellFormatter <chestInfo>(sheetParameterContainer["Area"], t => t.Area), new CellFormatter <chestInfo>(sheetParameterContainer["Price"], t => t.Price), new CellFormatter <chestInfo>(sheetParameterContainer["Amount"], t => t.Amount), new CellFormatter <chestInfo>(sheetParameterContainer["Remark"], t => t.Remark), new CellFormatter <chestInfo>(sheetParameterContainer["Rprice"], t => t.Rprice), new CellFormatter <chestInfo>(sheetParameterContainer["Ramount"], t => t.Ramount) ) ) ); }
public static WorkbookParameterContainer Parse(string templatePath) { var workbookParameterContainer = new WorkbookParameterContainer(); string templateConfig = Path.ChangeExtension(templatePath, ".xml"); if (File.Exists(templateConfig)) { workbookParameterContainer.Load(templateConfig); return(workbookParameterContainer); } IWorkbook workbook = NPOIHelper.LoadWorkbook(templatePath); ISheet sheet = workbook.GetSheetAt(0); sheetName = sheet.SheetName; workbookParameterContainer[sheetName] = new SheetParameterContainer { SheetName = sheetName }; foreach (IRow row in sheet) { foreach (ICell cell in row.Cells) { if (cell.CellType.Equals(CellType.String)) { MatchCollection matches = new Regex(@"(?<=\$\[)([\w]*)(?=\])").Matches(cell.StringCellValue); foreach (Match match in matches) { workbookParameterContainer[sheet.SheetName][match.Value] = new Parameter { Name = match.Value, RowIndex = cell.RowIndex, ColumnIndex = cell.ColumnIndex }; } } } } workbookParameterContainer.Save(templateConfig); return(workbookParameterContainer); }
protected override void CreatFormatter() { //IReportService reporService = IOCContainer.Instance.Resolve<IReportService>(); //var data = reporService.GetFeeDetailReport(StartTime, EndTime); var resultContent = new BaseResponse <IList <RegInHosStatusListEntity> >(); resultContent = GetSLTCRegInHosStatus(); IRegInHosStatusListService service = IOCContainer.Instance.Resolve <IRegInHosStatusListService>(); var response = new BaseResponse <RegInHosStatusDtlData>(); response = service.QueryRegInHosStatustList(Name, IdNo, NsId, Status, resultContent); var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); SheetParameterContainer sheetContainer = parameterContainer["Sheet1"]; var dataFormatter = new List <ElementFormatter>(); var indexNum = 1; var tableFormatter = new TableFormatter <RegInHosStatusDtlEntity>(sheetContainer["Index"], response.Data.RegInHosStatusDtl, new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["Index"], t => indexNum++), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["Name"], t => t.Name), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["IDNo"], t => t.IdNo), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["NCINo"], t => t.SsNo), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["Sex"], t => t.Gender), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["Age"], t => t.Age), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["InHosStatus"], t => t.InHosStatus.ToString().Replace("0", "在院").Replace("1", "未入院").Replace("2", "请假").Replace("3", "出院")), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["HospInDate"], t => t.InDate == null ? "" : t.InDate.Value.ToString("yyyy-MM-dd HH:mm:ss")), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["HospOutDate"], t => t.OutDate == null ? "" : t.OutDate.Value.ToString("yyyy-MM-dd HH:mm:ss")), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["StartDate"], t => t.StartDate == null ? "" : t.StartDate.Value.ToString("yyyy-MM-dd HH:mm:ss")), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["ReturnDate"], t => t.ReturnDate == null ? "" : t.ReturnDate.Value.ToString("yyyy-MM-dd HH:mm:ss")), new CellFormatter <RegInHosStatusDtlEntity>(sheetContainer["LeHour"], t => t.LeHour)); dataFormatter.Add(tableFormatter); Formatter = new SheetFormatter("Sheet1", dataFormatter.ToArray()); }
protected override void CreatFormatter() { IReportService reporService = IOCContainer.Instance.Resolve <IReportService>(); var data = reporService.GetFeeDetailReport(StartTime, EndTime); var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); SheetParameterContainer sheetContainer = parameterContainer["Sheet1"]; var dataFormatter = new List <ElementFormatter>(); var indexNum = 1; var tableFormatter = new TableFormatter <FeeDetail>(sheetContainer["Index"], data.DataDetail, new CellFormatter <FeeDetail>(sheetContainer["Index"], t => indexNum++), new CellFormatter <FeeDetail>(sheetContainer["Name"], t => t.Name), new CellFormatter <FeeDetail>(sheetContainer["Sex"], t => t.Sex), new CellFormatter <FeeDetail>(sheetContainer["Age"], t => t.Age), new CellFormatter <FeeDetail>(sheetContainer["NCINo"], t => t.NCINo), new CellFormatter <FeeDetail>(sheetContainer["HospNo"], t => t.HospNo), new CellFormatter <FeeDetail>(sheetContainer["IDNo"], t => t.IDNo), new CellFormatter <FeeDetail>(sheetContainer["Phone"], t => t.Phone), new CellFormatter <FeeDetail>(sheetContainer["Address"], t => t.Address), new CellFormatter <FeeDetail>(sheetContainer["NSName"], t => t.NSName), new CellFormatter <FeeDetail>(sheetContainer["McType"], t => t.McType), new CellFormatter <FeeDetail>(sheetContainer["CareType"], t => t.CareType), new CellFormatter <FeeDetail>(sheetContainer["HospInDate"], t => t.HospInDate), new CellFormatter <FeeDetail>(sheetContainer["HospOutDate"], t => t.HospOutDate), new CellFormatter <FeeDetail>(sheetContainer["HospDay"], t => t.HospDay), new CellFormatter <FeeDetail>(sheetContainer["Disease"], t => t.Disease), new CellFormatter <FeeDetail>(sheetContainer["DrugFee"], t => t.DrugFee), new CellFormatter <FeeDetail>(sheetContainer["NCIDrugFee"], t => t.NCIDrugFee), new CellFormatter <FeeDetail>(sheetContainer["TotalAmount"], t => t.TotalAmount), new CellFormatter <FeeDetail>(sheetContainer["NCILevel"], t => t.NCILevel), new CellFormatter <FeeDetail>(sheetContainer["NCIScale"], t => t.NCIScale)); dataFormatter.Add(tableFormatter); Formatter = new SheetFormatter("Sheet1", dataFormatter.ToArray()); }
protected override void CreatFormatter() { IReportService reporService = IOCContainer.Instance.Resolve <IReportService>(); var data = reporService.GetFeeByDiseaseReport(StartTime, EndTime); var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); SheetParameterContainer sheetContainer = parameterContainer["Sheet1"]; var dataFormatter = new List <ElementFormatter>(); dataFormatter.Add(new CellFormatter(sheetContainer["StartDate"], data.StartDate)); dataFormatter.Add(new CellFormatter(sheetContainer["EndDate"], data.EndDate)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCountyResNum"], data.DataDetail.Sum(m => m.ResNum))); dataFormatter.Add(new CellFormatter(sheetContainer["SumCountyFee"], data.DataDetail.Sum(m => m.Fee))); dataFormatter.Add(new CellFormatter(sheetContainer["SumCountyNciPay"], data.DataDetail.Sum(m => m.NciPay))); dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalResNum"], data.DataDetail.Sum(m => m.ResNum))); dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalFee"], data.DataDetail.Sum(m => m.Fee))); dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalNciPay"], data.DataDetail.Sum(m => m.NciPay))); var indexNum = 1; var tableFormatter = new TableFormatter <FeeByDiseaseReportItem>(sheetContainer["Index"], data.DataDetail, new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["Index"], t => indexNum++), new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["Disease"], t => t.Disease), new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["CountyResNum"], t => t.ResNum), new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["CountyFee"], t => t.Fee), new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["CountyNciPay"], t => t.NciPay), new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["TotalResNum"], t => t.ResNum), new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["TotalFee"], t => t.Fee), new CellFormatter <FeeByDiseaseReportItem>(sheetContainer["TotalNciPay"], t => t.NciPay) ); dataFormatter.Add(tableFormatter); Formatter = new SheetFormatter("Sheet1", dataFormatter.ToArray()); }
protected async override System.Threading.Tasks.Task CreatFormatter() { IPersonStatusReportService service = IOCContainer.Instance.Resolve <IPersonStatusReportService>(); var response = new BaseResponse <PersonStatusReportModel>(); response = service.QueryPersonStatusInfo(StartTime, EndTime.AddDays(1).AddSeconds(-1)); var request = new PersonStatusFilter(); request.startDate = StartTime; request.endDate = EndTime.AddDays(1).AddSeconds(-1); try { var http = HttpClientHelper.NciHttpClient; var result = await http.PostAsJsonAsync("/api/PersonStatusReport", request); var resultContent = await result.Content.ReadAsStringAsync(); var ltcInfo = JsonConvert.DeserializeObject <PersonStatusReportModel>(resultContent); response.Data.DrugEntryNum = ltcInfo.DrugEntryNum; response.Data.NSCPLNum = ltcInfo.NSCPLNum; response.Data.BillV2Num = ltcInfo.BillV2Num; response.Data.CostNum = ltcInfo.CostNum; response.Data.InHospNum = ltcInfo.InHospNum; response.Data.OutHospOfOtherNum = ltcInfo.OutHospOfOtherNum; response.Data.OutHospOfDeadNum = ltcInfo.OutHospOfDeadNum; response.Data.LeaveHospNum = ltcInfo.LeaveHospNum; } catch (Exception ex) { throw ex; } finally { response.ResultCode = -1; } var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); #region 资格证待遇申请统计(期间) SheetParameterContainer sheetContainer = parameterContainer["资格证待遇申请统计(期间)"]; var dataFormatter = new List <ElementFormatter>(); #region 截止2016年年12月31日 #region 申请数量 dataFormatter.Add(new CellFormatter(sheetContainer["xlan"], response.Data.AppCertlastYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qlan"], response.Data.AppCertlastYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jlan"], response.Data.AppCertlastYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tlan"], response.Data.AppCertlastYearNum.TotalNum)); #endregion #region 通过数量 dataFormatter.Add(new CellFormatter(sheetContainer["xlbn"], response.Data.ByCertlastYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qlbn"], response.Data.ByCertlastYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jlbn"], response.Data.ByCertlastYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tlbn"], response.Data.ByCertlastYearNum.TotalNum)); #endregion #region 未通过数量 dataFormatter.Add(new CellFormatter(sheetContainer["xlun"], response.Data.UnAppCertlastYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qlun"], response.Data.UnAppCertlastYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jlun"], response.Data.UnAppCertlastYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tlun"], response.Data.UnAppCertlastYearNum.TotalNum)); #endregion #region 取消数量 dataFormatter.Add(new CellFormatter(sheetContainer["xlcn"], response.Data.CancelCertlastYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qlcn"], response.Data.CancelCertlastYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jlcn"], response.Data.CancelCertlastYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tlcn"], response.Data.CancelCertlastYearNum.TotalNum)); #endregion #endregion #region 截止2017年3月31日 #region 申请数量 dataFormatter.Add(new CellFormatter(sheetContainer["xan"], response.Data.AppCertYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qan"], response.Data.AppCertYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jan"], response.Data.AppCertYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tan"], response.Data.AppCertYearNum.TotalNum)); #endregion #region 通过数量 dataFormatter.Add(new CellFormatter(sheetContainer["xbn"], response.Data.ByCertYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qbn"], response.Data.ByCertYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jbn"], response.Data.ByCertYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tbn"], response.Data.ByCertYearNum.TotalNum)); #endregion #region 未通过数量 dataFormatter.Add(new CellFormatter(sheetContainer["xun"], response.Data.UnAppCertYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qun"], response.Data.UnAppCertYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jun"], response.Data.UnAppCertYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tun"], response.Data.UnAppCertYearNum.TotalNum)); #endregion #region 取消数量 dataFormatter.Add(new CellFormatter(sheetContainer["xcn"], response.Data.CancelCertYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qcn"], response.Data.CancelCertYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jcn"], response.Data.CancelCertYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tcn"], response.Data.CancelCertYearNum.TotalNum)); #endregion #endregion #region 查询期间 #region 申请数量 dataFormatter.Add(new CellFormatter(sheetContainer["xasn"], response.Data.AppCertSearchYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qasn"], response.Data.AppCertSearchYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jasn"], response.Data.AppCertSearchYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tasn"], response.Data.AppCertSearchYearNum.TotalNum)); #endregion #region 通过数量 dataFormatter.Add(new CellFormatter(sheetContainer["xsbn"], response.Data.ByCertSearchYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qsbn"], response.Data.ByCertSearchYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jsbn"], response.Data.ByCertSearchYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tsbn"], response.Data.ByCertSearchYearNum.TotalNum)); #endregion #region 未通过数量 dataFormatter.Add(new CellFormatter(sheetContainer["xsun"], response.Data.UnAppCertSearchYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qsun"], response.Data.UnAppCertSearchYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jsun"], response.Data.UnAppCertSearchYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tsun"], response.Data.UnAppCertSearchYearNum.TotalNum)); #endregion #region 取消数量 dataFormatter.Add(new CellFormatter(sheetContainer["xscn"], response.Data.CancelCertSearchYearNum.XyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["qscn"], response.Data.CancelCertSearchYearNum.QkyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["jscn"], response.Data.CancelCertSearchYearNum.JmyyNum)); dataFormatter.Add(new CellFormatter(sheetContainer["tscn"], response.Data.CancelCertSearchYearNum.TotalNum)); #endregion #endregion Formatter = new SheetFormatter("资格证待遇申请统计(期间)", dataFormatter.ToArray()); #endregion #region 操作数据(期间) SheetParameterContainer billsheetContainer = parameterContainer["操作数据(期间)"]; var billdataFormatter = new List <ElementFormatter>(); #region 药品导入数 billdataFormatter.Add(new CellFormatter(billsheetContainer["xden"], response.Data.DrugEntryNum.XyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["qden"], response.Data.DrugEntryNum.QkyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["jden"], response.Data.DrugEntryNum.JmyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["tden"], response.Data.DrugEntryNum.TotalNum)); #endregion #region 护理计划 billdataFormatter.Add(new CellFormatter(billsheetContainer["xnspn"], response.Data.NSCPLNum.XyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["qnspn"], response.Data.NSCPLNum.QkyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["jnspn"], response.Data.NSCPLNum.JmyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["tnspn"], response.Data.NSCPLNum.TotalNum)); #endregion #region 账单数量 billdataFormatter.Add(new CellFormatter(billsheetContainer["xbilln"], response.Data.BillV2Num.XyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["qbilln"], response.Data.BillV2Num.QkyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["jbilln"], response.Data.BillV2Num.JmyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["tbilln"], response.Data.BillV2Num.TotalNum)); #endregion #region 总费用 billdataFormatter.Add(new CellFormatter(billsheetContainer["xcostn"], response.Data.CostNum.XyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["qcostn"], response.Data.CostNum.QkyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["jcostn"], response.Data.CostNum.JmyyNum)); billdataFormatter.Add(new CellFormatter(billsheetContainer["tcostn"], response.Data.CostNum.TotalNum)); #endregion Formatter1 = new SheetFormatter("操作数据(期间)", billdataFormatter.ToArray()); #endregion #region 在院不在院情况统计(状态) SheetParameterContainer hospsheetContainer = parameterContainer["在院不在院情况统计(状态)"]; var hospdataFormatter = new List <ElementFormatter>(); #region 在院人数 hospdataFormatter.Add(new CellFormatter(hospsheetContainer["xinhospn"], response.Data.InHospNum.XyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["qinhospn"], response.Data.InHospNum.QkyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["jinhospn"], response.Data.InHospNum.JmyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["tinhospn"], response.Data.InHospNum.TotalNum)); #endregion #region 出院人数 - 其他 hospdataFormatter.Add(new CellFormatter(hospsheetContainer["xotherhospn"], response.Data.OutHospOfOtherNum.XyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["qotherhospn"], response.Data.OutHospOfOtherNum.QkyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["jotherhospn"], response.Data.OutHospOfOtherNum.JmyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["totherhospn"], response.Data.OutHospOfOtherNum.TotalNum)); #endregion #region 出院人数 - 死亡 hospdataFormatter.Add(new CellFormatter(hospsheetContainer["xdeadhospn"], response.Data.OutHospOfDeadNum.XyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["qdeadhospn"], response.Data.OutHospOfDeadNum.QkyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["jdeadhospn"], response.Data.OutHospOfDeadNum.JmyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["tdeadhospn"], response.Data.OutHospOfDeadNum.TotalNum)); #endregion #region 请假天数 hospdataFormatter.Add(new CellFormatter(hospsheetContainer["xleahospn"], response.Data.LeaveHospNum.XyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["qleahospn"], response.Data.LeaveHospNum.QkyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["jleahospn"], response.Data.LeaveHospNum.JmyyNum)); hospdataFormatter.Add(new CellFormatter(hospsheetContainer["tleahospn"], response.Data.LeaveHospNum.TotalNum)); #endregion Formatter2 = new SheetFormatter("在院不在院情况统计(状态)", hospdataFormatter.ToArray()); #endregion }
public void DownloadInfectionStatisticsFile(int year, string templateFile) { var response = this.GetInfectionStatisticsData(year); SheetParameterContainer sheetParameterContainer = new SheetParameterContainer() { SheetName = "统计总表" }; dynamic[] categorys = new dynamic[] { new { category = "001", rowIndex = 7 }, //上呼吸道感染人次 new { category = "002", rowIndex = 9 }, //下呼吸道感染人次 new { category = "003", rowIndex = 14 }, //使用导尿管感染人次 new { category = "004", rowIndex = 17 }, //未使用导尿管感染人次 new { category = "005", rowIndex = 19 }, //疥疮感染人次 // new { category = "usedPipe", rowIndex = 13 }, //使用导尿管人日数 }; List <ElementFormatter> elementFormatters = new List <ElementFormatter>(); // 生成年份参数 sheetParameterContainer.ParameterList.Add(new Parameter() { Name = "year", RowIndex = 0, ColumnIndex = 1 }); elementFormatters.Add(new CellFormatter(sheetParameterContainer["year"], year)); for (int i = 0; i < categorys.Length; i++) { var item = categorys[i]; elementFormatters.Add(NewTableFormatter(response, sheetParameterContainer, item.rowIndex, item.category)); } #region 住民总人日数 int row = 2, col = 0; int queryMonth = 0; IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>(); var dbSet = unitOfWork.GetRepository <LTC_IPDREG>().dbSet.Where(o => o.ORGID == orgId && (o.IPDFLAG == "I") && o.INDATE.HasValue && ((DateTime)o.INDATE).Year == year).AsQueryable(); var ipd = (from a in dbSet let Year = SqlFunctions.DatePart("Year", (DateTime)a.INDATE) let Month = SqlFunctions.DatePart("Month", (DateTime)a.INDATE) group a by new { Year, Month } into g where g.Key.Year == year select new StatisticItem { Year = g.Key.Year, Month = g.Key.Month, Total = g.Count() }); var ipdRegList = ipd.ToList(); int maxMonth = 0; if (ipdRegList != null && ipdRegList.Count > 0) { maxMonth = ipdRegList.OrderByDescending(s => s.Month).FirstOrDefault().Month; } for (int j = 1; j <= 12; j++) { decimal leaveHospTotal = 0; decimal unPlanIpdTotal = 0; col = j; if (col > maxMonth) { queryMonth = 0; } else { queryMonth = col; } decimal total = unitOfWork.GetRepository <LTC_IPDREG>() .dbSet.Count( o => o.ORGID == orgId && (o.IPDFLAG == "I") && o.INDATE.HasValue && ((DateTime)o.INDATE).Year == year && ((DateTime)o.INDATE).Month <= queryMonth); decimal ipdRegInTotal = total * DateTime.DaysInMonth(year, j); //当月在院住民总人日数 decimal ipdRegOutTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetIpdOutTotal(year)); //当月结案的人日次数 if (ipdRegInTotal == 0 && ipdRegOutTotal == 0) { leaveHospTotal = 0; unPlanIpdTotal = 0; } else { leaveHospTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetLeaveHospTotal(year)); // 当月请假的人日次数 unPlanIpdTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetUnPlanIpdTotal(year)); //当月非计划住院人日次数 } decimal ipdRegCount = ipdRegInTotal + ipdRegOutTotal - leaveHospTotal - unPlanIpdTotal; //当月住民总人日数 elementFormatters.Add(new CellFormatter(new Parameter() { Name = string.Format("{0}_{1}", row, col), RowIndex = row, ColumnIndex = col }, ipdRegCount)); } #endregion #region 使用导尿管人日数 row = 13; for (int j = 1; j <= 12; j++) { decimal sTotal = 0; col = j; if (col <= maxMonth) { sTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetUsedPipeDaysTotal(year)); } else { sTotal = 0; } elementFormatters.Add(new CellFormatter(new Parameter() { Name = string.Format("{0}_{1}", row, col), RowIndex = row, ColumnIndex = col }, sTotal)); } #endregion ExportHelper.ExportToWeb(templateFile, Path.GetFileName(templateFile), new SheetFormatter("统计总表", elementFormatters.Where(it => it != null).ToArray())); }
public void DownloadPrsSoreRisk(string templateFile, long feeNo, DateTime?startDate, DateTime?endDate) { //List<ElementFormatter> elementFormatters = new List<ElementFormatter> //{ // new CellFormatter(new Parameter() {Name = "BedNo", RowIndex = 2, ColumnIndex = 1}, "BedNo"), // new CellFormatter(new Parameter() {Name = "Name", RowIndex = 2, ColumnIndex = 4}, "Name"), // new CellFormatter(new Parameter() {Name = "Sex", RowIndex = 2, ColumnIndex = 7}, "Sex") //}; //ExportHelper.ExportToWeb(templateFile, Path.GetFileName(templateFile), new SheetFormatter("Sheet1", elementFormatters.Where(it => it != null).ToArray())); SheetParameterContainer sheetParameterContainer = new SheetParameterContainer() { SheetName = "Sheet1" }; List <ElementFormatter> elementFormatters = new List <ElementFormatter>(); var residend = GetResidentInfo(feeNo); if (residend == null) { ExportHelper.ExportToWeb(templateFile, Path.GetFileName(templateFile), new SheetFormatter("Sheet1", elementFormatters.Where(it => it != null).ToArray())); return; } sheetParameterContainer.ParameterList.Add(new Parameter() { Name = "BedNo", RowIndex = 2, ColumnIndex = 1 }); elementFormatters.Add(new CellFormatter(sheetParameterContainer["BedNo"], residend.BedNo)); sheetParameterContainer.ParameterList.Add(new Parameter() { Name = "Name", RowIndex = 2, ColumnIndex = 4 }); elementFormatters.Add(new CellFormatter(sheetParameterContainer["Name"], residend.Name)); sheetParameterContainer.ParameterList.Add(new Parameter() { Name = "Sex", RowIndex = 2, ColumnIndex = 7 }); elementFormatters.Add(new CellFormatter(sheetParameterContainer["Sex"], residend.Sex)); //var surveys = from a in unitOfWork.GetRepository<LTC_REGQUESTION>().dbSet.Where(o => o.QUESTIONID == 10 && o.FEENO == 10) // join b in unitOfWork.GetRepository<LTC_EMPFILE>().dbSet on a.EVALUATEBY equals b.EMPNO into reqEmp // from ab in reqEmp.DefaultIfEmpty() // select new Survey() // { // Id = a.RECORDID, // CreateDate = a.EVALDATE, // Result = a.ENVRESULTS, // Score = a.SCORE, // NursingBy = ab != null ? ab.EMPNAME : null, // }; var surveys = unitOfWork.GetRepository <LTC_REGQUESTION>().dbSet.Where(o => o.QUESTIONID == 10 && o.FEENO == feeNo && o.EVALDATE.HasValue && o.EVALDATE >= startDate && o.EVALDATE <= endDate) .OrderByDescending(o => o.EVALDATE).Select(o => new Survey() { Id = o.RECORDID, Score = o.SCORE, Result = o.ENVRESULTS, CreateDate = o.EVALDATE }).ToList(); surveys = surveys.GetRange(0, surveys.Count > 16 ? 16 : surveys.Count); if (surveys.Count <= 0) { ExportHelper.ExportToWeb(templateFile, Path.GetFileName(templateFile), new SheetFormatter("Sheet1", elementFormatters.Where(it => it != null).ToArray())); return; } var recordIds = surveys.Select(o => o.Id).ToArray(); var answers = (from a in unitOfWork.GetRepository <LTC_REGQUESTIONDATA>().dbSet.Where(o => recordIds.Contains(o.RECORDID.Value) && o.MAKERID.HasValue && o.RECORDID.HasValue) join b in unitOfWork.GetRepository <LTC_MAKERITEMLIMITEDVALUE>().dbSet.Where(o => o.LIMITEDVALUE.HasValue) on a.LIMITEDVALUEID equals b.LIMITEDVALUEID select new Answer() { Id = a.MAKERID, SurveyId = a.RECORDID.Value, Score = b.LIMITEDVALUE }).ToList(); if (answers.Count <= 0) { ExportHelper.ExportToWeb(templateFile, Path.GetFileName(templateFile), new SheetFormatter("Sheet1", elementFormatters.Where(it => it != null).ToArray())); return; } for (var col = 0; col < surveys.Count; col++) { for (var row = 0; row < 11; row++) { sheetParameterContainer.ParameterList.Add(new Parameter() { Name = string.Format("{0}_{1}", col, row), RowIndex = row + 3, ColumnIndex = col + 3 }); switch (row) { case 0: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], surveys[col].CreateDate.HasValue ? ((DateTime)surveys[col].CreateDate).ToShortDateString() : "")); break; case 1: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], surveys[col].Score)); break; case 3: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], answers.Where(o => o.SurveyId == surveys[col].Id && o.Id == 123).Select(o => o.Score).FirstOrDefault())); break; case 4: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], answers.Where(o => o.SurveyId == surveys[col].Id && o.Id == 124).Select(o => o.Score).FirstOrDefault())); break; case 5: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], answers.Where(o => o.SurveyId == surveys[col].Id && o.Id == 125).Select(o => o.Score).FirstOrDefault())); break; case 6: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], answers.Where(o => o.SurveyId == surveys[col].Id && o.Id == 126).Select(o => o.Score).FirstOrDefault())); break; case 7: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], answers.Where(o => o.SurveyId == surveys[col].Id && o.Id == 127).Select(o => o.Score).FirstOrDefault())); break; case 8: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], answers.Where(o => o.SurveyId == surveys[col].Id && o.Id == 128).Select(o => o.Score).FirstOrDefault())); break; case 9: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], surveys[col].Score)); break; case 10: elementFormatters.Add(new CellFormatter(sheetParameterContainer[string.Format("{0}_{1}", col, row)], surveys[col].Result)); break; } } } ExportHelper.ExportToWeb(templateFile, Path.GetFileName(templateFile), new SheetFormatter("Sheet1", elementFormatters.Where(it => it != null).ToArray())); }
protected override void CreatFormatter() { IReportService reporService = IOCContainer.Instance.Resolve <IReportService>(); var data = reporService.GetFeeByCareTypeReport(StartTime, EndTime); var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); SheetParameterContainer sheetContainer = parameterContainer["Sheet1"]; var dataFormatter = new List <ElementFormatter>(); dataFormatter.Add(new CellFormatter(sheetContainer["StartDate"], data.StartDate)); dataFormatter.Add(new CellFormatter(sheetContainer["EndDate"], data.EndDate)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurResNum"], data.SumCurrent.ResNum)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurHospDay"], data.SumCurrent.HospDay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurFee"], data.SumCurrent.Fee)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurMedFee"], data.SumCurrent.MedFee)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurNciPay"], data.SumCurrent.NciPay)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurSvcDep"], data.SumCurrent.SvcDep)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurDecut"], data.SumCurrent.Decut)); dataFormatter.Add(new CellFormatter(sheetContainer["SumCurAccNciPay"], data.SumCurrent.AccNciPay)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalResNum"], data.SumTotal.ResNum)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalHospDay"], data.SumTotal.HospDay)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalFee"], data.SumTotal.Fee)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalMedFee"], data.SumTotal.MedFee)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalNciPay"], data.SumTotal.NciPay)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalSvcDep"], data.SumTotal.SvcDep)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalDecut"], data.SumTotal.Decut)); //dataFormatter.Add(new CellFormatter(sheetContainer["SumTotalAccNciPay"], data.SumTotal.AccNciPay)); //var dtl = new FeeReportComItem() //{ // ResNum = 12, // HospDay = 10, // Fee = 120, // MedFee = 100, // NciPay = 80, // SvcDep = 12, // Decut = 10, // AccNciPay = 2 //}; //for (int i = 0; i < 10; i++) //{ // data.DataDetail.Add(new FeeReportComDetail() // { // CareType = "zh", // OrgName = "dsfs", // Current = dtl, // Total = dtl // }); //} var indexNum = 1; var tableFormatter = new TableFormatter <FeeReportComDetail>(sheetContainer["Index"], data.DataDetail, new CellFormatter <FeeReportComDetail>(sheetContainer["Index"], t => indexNum++), new CellFormatter <FeeReportComDetail>(sheetContainer["OrgName"], t => t.GroupColumn1), new CellFormatter <FeeReportComDetail>(sheetContainer["CareType"], t => t.GroupColumn2), new CellFormatter <FeeReportComDetail>(sheetContainer["CurResNum"], t => t.Current.ResNum), new CellFormatter <FeeReportComDetail>(sheetContainer["CurHospDay"], t => t.Current.HospDay), new CellFormatter <FeeReportComDetail>(sheetContainer["CurFee"], t => t.Current.Fee), new CellFormatter <FeeReportComDetail>(sheetContainer["CurMedFee"], t => t.Current.MedFee), new CellFormatter <FeeReportComDetail>(sheetContainer["CurNciPay"], t => t.Current.NciPay), new CellFormatter <FeeReportComDetail>(sheetContainer["CurSvcDep"], t => t.Current.SvcDep), new CellFormatter <FeeReportComDetail>(sheetContainer["CurDecut"], t => t.Current.Decut), new CellFormatter <FeeReportComDetail>(sheetContainer["CurAccNciPay"], t => t.Current.AccNciPay) //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalResNum"], t => t.Total.ResNum), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalHospDay"], t => t.Total.HospDay), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalFee"], t => t.Total.Fee), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalMedFee"], t => t.Total.MedFee), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalNciPay"], t => t.Total.NciPay), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalSvcDep"], t => t.Total.SvcDep), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalDecut"], t => t.Total.Decut), //new CellFormatter<FeeReportComDetail>(sheetContainer["TotalAccNciPay"], t => t.Total.AccNciPay) ); dataFormatter.Add(tableFormatter); Formatter = new SheetFormatter("Sheet1", dataFormatter.ToArray()); }
protected async override System.Threading.Tasks.Task CreatFormatter() { Dictionary <string, string> dic = new Dictionary <string, string>() { { "1", "巨鹿县医院" }, { "3", "巨鹿祈康医院" }, { "2", "巨鹿健民医院" } }; IReportService service = IOCContainer.Instance.Resolve <IReportService>(); ILtcService ltcService = IOCContainer.Instance.Resolve <ILtcService>(); var sDate = StartTime.ToString("yyyy-MM"); var eDate = EndTime.ToString("yyyy-MM"); BaseResponse <IList <TreatmentAccount> > res = new BaseResponse <IList <TreatmentAccount> >(); BaseRequest request = new BaseRequest() { CurrentPage = 1, PageSize = 1000 }; res = ltcService.GetResMonthData(request, sDate, eDate, NsId) as BaseResponse <IList <TreatmentAccount> >; List <PrintMonthFee> list = new List <PrintMonthFee>(); List <Ipdregout> resIpd = new List <Ipdregout>(); try { var result = await HttpClientHelper.NciHttpClient.GetAsync("/api/Ipd?nsno=" + NsId); resIpd = result.Content.ReadAsAsync <List <Ipdregout> >().Result; } catch { throw new NOContactException(); } try { list = service.GetPrintData(res, resIpd); } catch { throw new NoDataException(); } var parameterContainer = new WorkbookParameterContainer(); parameterContainer.Load(TemplateFormatterPath); SheetParameterContainer sheetContainer = parameterContainer["Sheet1"]; var dataFormatter = new List <ElementFormatter>(); dataFormatter.Add(new CellFormatter(sheetContainer["Org"], "单位:" + dic[SecurityHelper.CurrentPrincipal.OrgId] + " " + GetOrgName(SecurityHelper.CurrentPrincipal.OrgId))); dataFormatter.Add(new CellFormatter(sheetContainer["Date"], "核算时间:" + DictHelper.GetFeeIntervalByYearMonth(StartTime.ToString("yyyy-MM")).StartDate + "-" + DictHelper.GetFeeIntervalByYearMonth(EndTime.ToString("yyyy-MM")).EndDate)); dataFormatter.Add(new CellFormatter(sheetContainer["THospDay"], list.Sum(s => s.HospDay))); dataFormatter.Add(new CellFormatter(sheetContainer["TTotalAmount"], list.Sum(s => s.TotalAmount))); dataFormatter.Add(new CellFormatter(sheetContainer["TNCIPay"], list.Sum(s => s.NCIPay))); var indexNum = 1; var tableFormatter = new TableFormatter <PrintMonthFee>(sheetContainer["Index"], list, new CellFormatter <PrintMonthFee>(sheetContainer["Index"], t => indexNum++), new CellFormatter <PrintMonthFee>(sheetContainer["Name"], t => t.Name), new CellFormatter <PrintMonthFee>(sheetContainer["Sex"], t => t.Sex), new CellFormatter <PrintMonthFee>(sheetContainer["ResidentSSId"], t => t.ResidentSSId), new CellFormatter <PrintMonthFee>(sheetContainer["BrithPlace"], t => t.BrithPlace), new CellFormatter <PrintMonthFee>(sheetContainer["RsStatus"], t => t.RsStatus), new CellFormatter <PrintMonthFee>(sheetContainer["DiseaseDiag"], t => t.DiseaseDiag), new CellFormatter <PrintMonthFee>(sheetContainer["CareType"], t => t.CareTypeId), new CellFormatter <PrintMonthFee>(sheetContainer["CertStartTime"], t => t.EvaluationTime.Value.ToString("yyyy-MM-dd")), new CellFormatter <PrintMonthFee>(sheetContainer["InDate"], t => t.InDate.Value.ToString("yyyy-MM-dd")), new CellFormatter <PrintMonthFee>(sheetContainer["OutDate"], t => t.OutDate.Value.ToString("yyyy-MM-dd")), new CellFormatter <PrintMonthFee>(sheetContainer["HospDay"], t => t.HospDay), new CellFormatter <PrintMonthFee>(sheetContainer["TotalAmount"], t => t.TotalAmount), new CellFormatter <PrintMonthFee>(sheetContainer["NCIPayLevel"], t => t.NCIPayLevel), new CellFormatter <PrintMonthFee>(sheetContainer["NCIPay"], t => t.NCIPay)); dataFormatter.Add(tableFormatter); Formatter = new SheetFormatter("Sheet1", dataFormatter.ToArray()); }
IEnumerable <ElementFormatter> IElementFormatterBuilder.GetElementFormatters(SheetParameterContainer paramContainer) { return(this.GetFormatters(paramContainer)); }