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()); }
private void btnFillTemplate_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtExcelTemplatePath.Text.Trim())) { MessageBox.Show("请选择Excel模板文件!", "提示"); return; } WorkbookParameterContainer workbookParameter = ParseTemplate.Parse(txtExcelTemplatePath.Text); workbookParameter.Save(Path.ChangeExtension(txtExcelTemplatePath.Text, ".xml")); }
/// <summary> /// 获取模板文件对应的模板格式配置XML文件路径(当不存在或较旧时,将会重新生成) /// </summary> /// <param name="templatePath"></param> /// <param name="newGenerate"></param> /// <returns></returns> public static string GetTemplateConfigFilePath(string templatePath, bool newGenerate = false) { string templateConfigFilePath = Path.ChangeExtension(templatePath, ".xml"); if (newGenerate || !File.Exists(templateConfigFilePath) || File.GetLastWriteTime(templatePath) > File.GetLastWriteTime(templateConfigFilePath)) { WorkbookParameterContainer workbookParameter = ParseTemplate.Parse(templatePath); workbookParameter.Save(templateConfigFilePath); } return(templateConfigFilePath); }
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()); }
/// <summary> /// 局部格式化器 /// </summary> private static void CreateExcel01() { var temp = ($@"{AppDomain.CurrentDomain.BaseDirectory}1.0\"); var excel = temp + "Template.xls"; var xml = temp + "Template.xml"; Parse(excel).Save(xml); var workbookParameterContainer = new WorkbookParameterContainer(); workbookParameterContainer.Load(xml); var sheetParameterContainer = workbookParameterContainer["局部格式化器"]; ExportHelper.ExportToLocal(excel, temp + "1.0demo.xls", new SheetFormatter("局部格式化器", new PartFormatter(sheetParameterContainer["UserName"], "Jensen"), new PartFormatter(sheetParameterContainer["GroupNo"], "116476496") ) ); }
/// <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); }
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"); var sheetParameterContainer = workbookParameterContainer["局部格式化器"]; ExportHelper.ExportToLocal(@"Template\Template.xls", saveFileDlg.FileName, new SheetFormatter("局部格式化器", new PartFormatter(sheetParameterContainer["UserName"], "Jensen"), new PartFormatter(sheetParameterContainer["GroupNo"], "116476496") ) ); } }
private void btnFillTemplate_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtExcelTemplatePath.Text.Trim())) { MessageBox.Show("请选择Excel模板文件!", "提示"); return; } string xmlFilePath = Path.ChangeExtension(txtExcelTemplatePath.Text, ".xml"); try { WorkbookParameterContainer workbookParameter = ParseTemplate.Parse(txtExcelTemplatePath.Text); workbookParameter.Save(xmlFilePath); } catch (Exception ex) { MessageBox.Show("生成失败" + ex.Message); return; } MessageBox.Show("生成成功:" + xmlFilePath); }
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 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.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()); }
/// <summary> /// 单元格格式化器 /// </summary> private static void CreateExcel02() { var temp = ($@"{AppDomain.CurrentDomain.BaseDirectory}2.0\"); var excel = temp + "Template.xls"; var xml = temp + "Template.xml"; Parse(excel).Save(xml); var workbookParameterContainer = new WorkbookParameterContainer(); workbookParameterContainer.Load(xml); var sheetParameterContainer = workbookParameterContainer["单元格格式化器"]; ExportHelper.ExportToLocal(excel, temp + "2.0demo.xls", new SheetFormatter("单元格格式化器", new CellFormatter(sheetParameterContainer["String"], "Hello World!"), new CellFormatter(sheetParameterContainer["Boolean"], true), new CellFormatter(sheetParameterContainer["DateTime"], DateTime.Now), new CellFormatter(sheetParameterContainer["Double"], 3.14), new CellFormatter(sheetParameterContainer["Image"], Image.FromFile(temp + "C#高级编程.jpg").ToBuffer()) ) ); }
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"); var sheetParameterContainer = workbookParameterContainer["单元格格式化器"]; ExportHelper.ExportToLocal(@"Template\Template.xls", saveFileDlg.FileName, new SheetFormatter("单元格格式化器", new CellFormatter(sheetParameterContainer["String"], "Hello World!"), new CellFormatter(sheetParameterContainer["Boolean"], true), new CellFormatter(sheetParameterContainer["DateTime"], DateTime.Now), new CellFormatter(sheetParameterContainer["Double"], 3.14), new CellFormatter(sheetParameterContainer["Image"], Image.FromFile("Image/C#高级编程.jpg").ToBuffer()) ) ); } }
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() { 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()); }
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() { 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 }