Commit fdcb6efb by zry

compute

parent faf62dd4
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.Infrastructure;
using Performance.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api.Controllers
{
[Route("api/[controller]")]
public class SheetController : Controller
{
private UserService _userService;
private RoleService _roleService;
private IMemoryCache _memoryCache;
private Application _options;
private ClaimService _claim;
private HospitalService _hospitalService;
public SheetController(UserService userService,
HospitalService hospitalService,
RoleService roleService,
IMemoryCache memoryCache,
IOptions<Application> options,
ClaimService claim)
{
_userService = userService;
_roleService = roleService;
_memoryCache = memoryCache;
_hospitalService = hospitalService;
_options = options.Value;
_claim = claim;
}
}
}
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="8.0.0" /> <PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="FluentValidation.AspNetCore" Version="8.1.3" /> <PackageReference Include="FluentValidation.AspNetCore" Version="8.1.3" />
<PackageReference Include="Hangfire" Version="1.6.22" /> <PackageReference Include="Hangfire" Version="1.6.22" />
<PackageReference Include="Hangfire.Redis.StackExchange" Version="1.8.0" /> <PackageReference Include="Hangfire.Redis.StackExchange" Version="1.8.0" />
......
...@@ -108,10 +108,15 @@ public void ConfigureServices(IServiceCollection services) ...@@ -108,10 +108,15 @@ public void ConfigureServices(IServiceCollection services)
//ef配置 //ef配置
var connection = services.BuildServiceProvider().GetService<IOptions<AppConnection>>(); var connection = services.BuildServiceProvider().GetService<IOptions<AppConnection>>();
//redis
var csredis = new CSRedis.CSRedisClient(connection.Value.RedisConnectionString);
RedisHelper.Initialization(csredis);
//后台任务调度 //后台任务调度
services.AddHangfire(config => services.AddHangfire(config =>
{ {
config.UseRedisStorage(connection.Value.RedisConnectionString); config.UseRedisStorage(connection.Value.HangfireRedisConnectionString);
}); });
services.AddDbContext<PerformanceDbContext>(options => services.AddDbContext<PerformanceDbContext>(options =>
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
//连接字符串 //连接字符串
"AppConnection": { "AppConnection": {
"PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=suvalue;pwd=suvalue2017;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=suvalue;pwd=suvalue2017;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=1" "HangfireRedisConnectionString": "116.62.245.55:6379,defaultDatabase=1",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
}, },
//互亿 //互亿
"HuyiSmsConfig": { "HuyiSmsConfig": {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
</ItemGroup> </ItemGroup>
......
using Performance.Services; using Performance.DtoModels;
using Performance.Infrastructure;
using Performance.Services;
using System; using System;
using System.Collections.Generic;
using System.IO;
namespace Performance.ConsoleApp namespace Performance.ConsoleApp
{ {
...@@ -7,11 +11,49 @@ class Program ...@@ -7,11 +11,49 @@ class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
Console.WriteLine($"{(21555 / 1000.0).ToString("f2")}");
Console.WriteLine("Hello World!"); Console.WriteLine("Hello World!");
PerHeaderService perHeaderService = new PerHeaderService(); PerHeaderService perHeaderService = new PerHeaderService();
PerSheetService perSheetService = new PerSheetService(perHeaderService); PerSheetService perSheetService = new PerSheetService(perHeaderService);
PerExcelService perExcelService = new PerExcelService(perSheetService); PerExcelService perExcelService = new PerExcelService(perSheetService, perHeaderService);
var excel = perExcelService.Import(@"E:\code_git\performance\performance\Performance.Api\Files\9\201911\医院绩效分配系统数据收集模板V120190307133444707.xlsx"); //var excel = perExcelService.Import(@"E:\code_git\performance\performance\Performance.Api\Files\9\201911\医院绩效分配系统数据收集模板V120190307133444707.xlsx");
// 拷贝配置信息
//perExcelService.Copy(allot.ID);
string path = @"E:\code_git\performance\performance\Performance.Api\Files\9\201911\医院绩效分配系统数据收集模板V120190307133444707.xlsx";
// 导出数据
var excel = perExcelService.Import(path);
var workbook1 = perExcelService.ExportCompute(excel.PerSheet);
using (FileStream file = new FileStream($@"F:\myworkbook\org_{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx", FileMode.Create))
{
workbook1.Write(file);
}
// 保存数据
//perExcelService.ImportSave(excel);
// 计算合并数据
List<PerSheet> list = perExcelService.ProcessCompute(excel);
// 保存过程数据
//perExcelService.ProcessSave(excel);
// 生成结果excel
var workbook2 = perExcelService.ExportCompute(list);
using (FileStream file = new FileStream($@"F:\myworkbook\comp_{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx", FileMode.Create))
{
workbook2.Write(file);
}
// 计算最总数据
perExcelService.Compute(excel);
Console.ReadKey(); Console.ReadKey();
} }
......
...@@ -11,5 +11,6 @@ public class AppConnection ...@@ -11,5 +11,6 @@ public class AppConnection
{ {
public string PerformanceConnectionString { get; set; } public string PerformanceConnectionString { get; set; }
public string RedisConnectionString { get; set; } public string RedisConnectionString { get; set; }
public string HangfireRedisConnectionString { get; set; }
} }
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Performance.DtoModels namespace Performance.DtoModels
{ {
public class PerDataExpend : PerData public interface IPerData
{ {
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class PerComputeData
{
/// <summary>
/// sheet模板类型
/// </summary>
public SheetType SheetType { get; set; }
/// <summary>
/// 核算单元类别 (医生组/护理组)
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元名称
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 列头类型名称
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 单元格value
/// </summary>
public decimal? CellValue { get; set; }
}
}
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
namespace Performance.DtoModels namespace Performance.DtoModels
{ {
public interface IPerData
{
}
public class PerData : IPerData public class PerData : IPerData
{ {
/// <summary> /// <summary>
...@@ -26,10 +23,14 @@ public class PerData : IPerData ...@@ -26,10 +23,14 @@ public class PerData : IPerData
/// </summary> /// </summary>
public string TypeName { get; set; } public string TypeName { get; set; }
/// <summary> /// <summary>
/// 单元格备注 /// 单元格注释
/// </summary> /// </summary>
public string Annotation { get; set; } public string Annotation { get; set; }
/// <summary> /// <summary>
/// 单元格备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 单元格value /// 单元格value
/// </summary> /// </summary>
public decimal? CellValue { get; set; } public decimal? CellValue { get; set; }
...@@ -37,5 +38,21 @@ public class PerData : IPerData ...@@ -37,5 +38,21 @@ public class PerData : IPerData
/// 系数值 /// 系数值
/// </summary> /// </summary>
public decimal? FactorValue { get; set; } public decimal? FactorValue { get; set; }
/// <summary>
/// 是否带入系数计算
/// </summary>
public bool IsFactor { get; set; }
/// <summary>
/// 行号
/// </summary>
public int RowNumber { get; set; }
/// <summary>
/// 行坐标
/// </summary>
public int PointRow { get; set; }
/// <summary>
/// 列坐标
/// </summary>
public int PointCell { get; set; }
} }
} }
...@@ -80,5 +80,10 @@ public class PerDataEmployee : IPerData ...@@ -80,5 +80,10 @@ public class PerDataEmployee : IPerData
/// 发放系数 /// 发放系数
/// </summary> /// </summary>
public Nullable<decimal> Grant { get; set; } public Nullable<decimal> Grant { get; set; }
/// <summary>
/// 行号
/// </summary>
public int RowNumber { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class PerDataOtherIncome : PerData
{
}
}
...@@ -75,5 +75,9 @@ public class PerDataUnifyUnit : IPerData ...@@ -75,5 +75,9 @@ public class PerDataUnifyUnit : IPerData
/// 考核对分率 /// 考核对分率
/// </summary> /// </summary>
public Nullable<decimal> NurseScoringAverage { get; set; } public Nullable<decimal> NurseScoringAverage { get; set; }
/// <summary>
/// 行号
/// </summary>
public int RowNumber { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class PerDataWorkload : PerData
{
}
}
...@@ -22,5 +22,18 @@ public class PerHeader ...@@ -22,5 +22,18 @@ public class PerHeader
public bool IsHasChildren => Children != null && Children.Any(); public bool IsHasChildren => Children != null && Children.Any();
public List<PerHeader> Children { get; set; } public List<PerHeader> Children { get; set; }
public PerHeader Parent { get; set; } public PerHeader Parent { get; set; }
public PerHeader() { }
public PerHeader(int pointRow, int pointCell, string cellName, int level, int mergeRow, int mergeCell, List<PerHeader> children)
{
PointRow = pointRow;
PointCell = pointCell;
CellName = cellName;
Level = level;
MergeRow = mergeRow;
MergeCell = mergeCell;
Children = children;
}
} }
} }
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="PerExcel\PerComputeData.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="8.0.0" /> <PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="8.1.3" /> <PackageReference Include="FluentValidation.AspNetCore" Version="8.1.3" />
</ItemGroup> </ItemGroup>
......
//-----------------------------------------------------------------------
// <copyright file=" im_data.cs">
// * FileName: im_data.cs
// * history : 2019-03-14 10:25:59
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
namespace Performance.EntityModels
{
/// <summary>
/// im_data Entity Model
/// </summary>
public class im_data
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> SheetID { get; set; }
/// <summary>
/// 核算单元类别 1 医生组 2护理组
/// </summary>
public Nullable<int> UnitType { get; set; }
/// <summary>
/// 行号
/// </summary>
public Nullable<int> RowNumber { get; set; }
/// <summary>
/// 核算单元名称
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 科室名称
/// </summary>
public string Department { get; set; }
/// <summary>
/// 列头类型名称
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 单元格value
/// </summary>
public Nullable<decimal> CellValue { get; set; }
/// <summary>
/// 是否带入系数计算 1 带入 2 不带入
/// </summary>
public Nullable<int> IsFactor { get; set; }
/// <summary>
/// 系数值
/// </summary>
public Nullable<decimal> FactorValue { get; set; }
/// <summary>
/// 单元格注释
/// </summary>
public string Annotation { get; set; }
/// <summary>
/// 单元格备注
/// </summary>
public string Remark { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" im_header.cs">
// * FileName: im_header.cs
// * history : 2019-03-14 10:25:59
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
namespace Performance.EntityModels
{
/// <summary>
/// im_header Entity Model
/// </summary>
public class im_header
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> SheetID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> ParentID { get; set; }
/// <summary>
/// 行坐标
/// </summary>
public Nullable<int> PointRow { get; set; }
/// <summary>
/// 列坐标
/// </summary>
public Nullable<int> PointCell { get; set; }
/// <summary>
/// 是否合并 1 合并 2 不合并
/// </summary>
public Nullable<int> IsMerge { get; set; }
/// <summary>
/// 合并行
/// </summary>
public Nullable<int> MergeRow { get; set; }
/// <summary>
/// 合并列
/// </summary>
public Nullable<int> MergeCell { get; set; }
/// <summary>
/// 单元格内容
/// </summary>
public string CellValue { get; set; }
}
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// <copyright file=" im_sheetdata.cs"> // <copyright file=" im_sheet.cs">
// * FileName: im_sheetdata.cs // * FileName: im_sheet.cs
// * history : 2019-03-08 14:31:00 // * history : 2019-03-14 10:25:59
// </copyright> // </copyright>
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
using System; using System;
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
namespace Performance.EntityModels namespace Performance.EntityModels
{ {
/// <summary> /// <summary>
/// im_sheetdata Entity Model /// im_sheet Entity Model
/// </summary> /// </summary>
public class im_sheetdata public class im_sheet
{ {
/// <summary> /// <summary>
/// ID /// ID
......
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// <copyright file=" im_sheetdata.cs"> // <copyright file=" im_data.cs">
// * FileName: im_sheetdata.cs // * FileName: im_data.cs
// * history : Created by T4 2019-03-08 14:31:25 // * history : Created by T4 2019-03-14 10:26:02
// </copyright> // </copyright>
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
using System; using System;
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
namespace Performance.Repository namespace Performance.Repository
{ {
/// <summary> /// <summary>
/// im_sheetdata Repository /// im_data Repository
/// </summary> /// </summary>
public class PerforImSheetDataRepository : PerforRepository<im_sheetdata> public class PerforImDataRepository : PerforRepository<im_data>
{ {
public PerforImSheetDataRepository(PerformanceDbContext context) : base(context) public PerforImDataRepository(PerformanceDbContext context) : base(context)
{ {
} }
} }
......
//-----------------------------------------------------------------------
// <copyright file=" im_header.cs">
// * FileName: im_header.cs
// * history : Created by T4 2019-03-14 10:26:02
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// im_header Repository
/// </summary>
public class PerforImHeaderRepository : PerforRepository<im_header>
{
public PerforImHeaderRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//-----------------------------------------------------------------------
// <copyright file=" im_sheet.cs">
// * FileName: im_sheet.cs
// * history : Created by T4 2019-03-14 10:26:02
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// im_sheet Repository
/// </summary>
public class PerforImSheetRepository : PerforRepository<im_sheet>
{
public PerforImSheetRepository(PerformanceDbContext context) : base(context)
{
}
}
}
...@@ -12,9 +12,9 @@ namespace Performance.Repository ...@@ -12,9 +12,9 @@ namespace Performance.Repository
/// <summary> /// <summary>
/// im_employee Repository /// im_employee Repository
/// </summary> /// </summary>
public class PerforImemployeeRepository : PerforRepository<im_employee> public class PerforImEmployeeRepository : PerforRepository<im_employee>
{ {
public PerforImemployeeRepository(PerformanceDbContext context) : base(context) public PerforImEmployeeRepository(PerformanceDbContext context) : base(context)
{ {
} }
} }
......
using NPOI.HSSF.UserModel; using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel; using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
...@@ -14,9 +15,12 @@ namespace Performance.Services ...@@ -14,9 +15,12 @@ namespace Performance.Services
public class PerExcelService : IAutoInjection public class PerExcelService : IAutoInjection
{ {
private PerSheetService _perSheetService; private PerSheetService _perSheetService;
public PerExcelService(PerSheetService perSheetService) private PerHeaderService _perHeaderService;
public PerExcelService(PerSheetService perSheetService,
PerHeaderService perHeaderService)
{ {
_perSheetService = perSheetService; _perSheetService = perSheetService;
_perHeaderService = perHeaderService;
} }
/// <summary> /// <summary>
...@@ -51,57 +55,118 @@ public PerExcel Import(string path) ...@@ -51,57 +55,118 @@ public PerExcel Import(string path)
} }
} }
//private List<im_employee> C(List<PerData> dataList)
//{
// List<im_employee> result = new List<im_employee>();
// var empList = dataList.GroupBy(t => new { t.AccountingUnit, t.Department })
// .Select(t => new { t.Key, Employee = t.Select(p => (PerDataEmployee)p) });
// foreach (var gkey in empList)
// {
// im_employee employee = new im_employee
// {
// AccountingUnit = gkey.Key.AccountingUnit,
// Department = gkey.Key.Department,
// DoctorName = gkey.Employee.FirstOrDefault(t => t.TypeName == "医生姓名").CellValue,
// FitPeople = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "绩效基数核算参考对象")?.CellValue),
// JobTitle = gkey.Employee.FirstOrDefault(t => t.TypeName == "职称")?.CellValue,
// PostCoefficient = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "岗位系数")?.CellValue),
// WorkTime = ConvertHelper.To<DateTime?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "考核得分率")?.CellValue),
// ScoreAverageRate = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "医生姓名")?.CellValue),
// Attendance = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "出勤率")?.CellValue),
// PeopleNumber = ConvertHelper.To<int?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "核算单元医生数")?.CellValue),
// Workload = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "工作量绩效")?.CellValue),
// OthePerfor = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "其他绩效")?.CellValue),
// Punishment = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "医院奖罚")?.CellValue),
// Adjust = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "调节系数")?.CellValue),
// Grant = ConvertHelper.To<decimal?>(gkey.Employee.FirstOrDefault(t => t.TypeName == "发放系数")?.CellValue)
// };
// result.Add(employee);
// }
// return result;
//}
/// <summary>
/// 复制报表基础配置
/// </summary>
/// <param name="iD"></param>
public void Copy(int iD) public void Copy(int iD)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
/// <summary>
/// 保存excel导出数据
/// </summary>
/// <param name="excel"></param>
public void ImportSave(PerExcel excel) public void ImportSave(PerExcel excel)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void ProcessCompute(PerExcel excel) /// <summary>
/// 计算绩效
/// </summary>
/// <param name="excel"></param>
public List<PerSheet> ProcessCompute(PerExcel excel)
{ {
throw new NotImplementedException(); return _perSheetService.ProcessCompute(excel);
} }
/// <summary>
/// 保存绩效结果
/// </summary>
/// <param name="excel"></param>
public void ProcessSave(PerExcel excel) public void ProcessSave(PerExcel excel)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public IWorkbook ExportCompute(List<PerSheet> sheetList)
{
IWorkbook workbook = new XSSFWorkbook();
var cellstyle = workbook.CreateCellStyle();
cellstyle.VerticalAlignment = VerticalAlignment.Center;
cellstyle.Alignment = HorizontalAlignment.Center;
foreach (var sheet in sheetList)
{
ISheet exportSheet = workbook.CreateSheet(sheet.SheetName);
//创建列头行
IRow row = null, childRow = null;
foreach (var header in sheet.PerHeader.OrderBy(t => t.PointCell))
{
row = CreateRow(cellstyle, exportSheet, row, header);
//创建二级列头
if (header.IsHasChildren)
{
foreach (var child in header.Children.OrderBy(t => t.PointCell))
{
childRow = CreateRow(cellstyle, exportSheet, childRow, child);
}
}
}
//反转列头
var headList = _perHeaderService.GetPerHeaderReverse(sheet.PerHeader);
var dataList = sheet.PerData.Select(t => (PerData)t);
var maxrow = headList.Max(t => t.PointRow);
//循环核算单元 创建数据行
var accountingUnitList = dataList.OrderBy(t => t.RowNumber).Select(t => t.AccountingUnit).Distinct();
for (int i = 0; i < accountingUnitList.Count(); i++)
{
var accountingUnit = accountingUnitList.ElementAt(i);
IRow dataRow = exportSheet.CreateRow(i + maxrow + 2);
dataRow.CreateCell(0).SetCellValue(accountingUnit);
dataRow.GetCell(0).CellStyle = cellstyle;
foreach (var header in headList.OrderBy(t => t.PointCell))
{
var cellValue = dataList.FirstOrDefault(t => t.AccountingUnit == accountingUnit && t.TypeName == header.CellName)?.CellValue;
if (cellValue.HasValue && cellValue.Value > 0)
{
dataRow.CreateCell(header.PointCell).SetCellValue(Convert.ToDouble(cellValue.Value));
dataRow.GetCell(header.PointCell).CellStyle = cellstyle;
}
}
}
}
return workbook;
}
/// <summary>
/// 创建行
/// </summary>
/// <param name="cellstyle"></param>
/// <param name="exportSheet"></param>
/// <param name="row"></param>
/// <param name="header"></param>
/// <returns></returns>
private IRow CreateRow(ICellStyle cellstyle, ISheet exportSheet, IRow row, PerHeader header)
{
if (header.IsMerge)
{
var cellRange = new CellRangeAddress(header.PointRow, header.PointRow + header.MergeRow - 1, header.PointCell, header.PointCell + header.MergeCell - 1);
exportSheet.AddMergedRegion(cellRange);
}
row = row ?? exportSheet.CreateRow(header.PointRow);
row.CreateCell(header.PointCell).SetCellValue(header.CellName);
row.GetCell(header.PointCell).CellStyle = cellstyle;
return row;
}
/// <summary>
/// 计算最终数据
/// </summary>
/// <param name="excel"></param>
public void Compute(PerExcel excel) public void Compute(PerExcel excel)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
......
...@@ -104,7 +104,7 @@ public List<PerHeader> GetPerHeaderReverse(ISheet sheet, PerSheetPoint point) ...@@ -104,7 +104,7 @@ public List<PerHeader> GetPerHeaderReverse(ISheet sheet, PerSheetPoint point)
var sheetHeaders = GetPerHeader(sheet, point); var sheetHeaders = GetPerHeader(sheet, point);
if (sheetHeaders == null || !sheetHeaders.Any()) if (sheetHeaders == null || !sheetHeaders.Any())
return null; return null;
return LastLevel(sheetHeaders); return GetPerHeaderReverse(sheetHeaders);
} }
/// <summary> /// <summary>
...@@ -112,7 +112,7 @@ public List<PerHeader> GetPerHeaderReverse(ISheet sheet, PerSheetPoint point) ...@@ -112,7 +112,7 @@ public List<PerHeader> GetPerHeaderReverse(ISheet sheet, PerSheetPoint point)
/// </summary> /// </summary>
/// <param name="sheetHeaders"></param> /// <param name="sheetHeaders"></param>
/// <returns></returns> /// <returns></returns>
private List<PerHeader> LastLevel(List<PerHeader> sheetHeaders) public List<PerHeader> GetPerHeaderReverse(List<PerHeader> sheetHeaders)
{ {
if (sheetHeaders == null || !sheetHeaders.Any()) if (sheetHeaders == null || !sheetHeaders.Any())
return null; return null;
...@@ -122,7 +122,7 @@ private List<PerHeader> LastLevel(List<PerHeader> sheetHeaders) ...@@ -122,7 +122,7 @@ private List<PerHeader> LastLevel(List<PerHeader> sheetHeaders)
{ {
if (cell.IsHasChildren) if (cell.IsHasChildren)
{ {
headList.AddRange(LastLevel(cell.Children)); headList.AddRange(GetPerHeaderReverse(cell.Children));
} }
else else
{ {
......
...@@ -44,5 +44,33 @@ public static IPerSheetDataRead GetDataRead(SheetType sheetType) ...@@ -44,5 +44,33 @@ public static IPerSheetDataRead GetDataRead(SheetType sheetType)
} }
return dataread; return dataread;
} }
/// <summary>
/// 构建excel计算
/// </summary>
/// <param name="sheetType"></param>
/// <returns></returns>
public static IPerSheetDataCompute GetDataCompute(SheetType sheetType)
{
IPerSheetDataCompute dataCompute = null;
switch (sheetType)
{
case SheetType.Income:
case SheetType.OtherIncome:
case SheetType.Expend:
dataCompute = new PerSheetDataComputeEconomic();
break;
case SheetType.Workload:
dataCompute = new PerSheetDataComputeWorkload();
break;
//case SheetType.Overtime:
// dataCompute = new PerSheetDataReadOvertime();
// break;
//case SheetType.UnifyUnit:
// dataread = new PerSheetDataReadUnifyUnit();
// break;
}
return dataCompute;
}
} }
} }
...@@ -32,8 +32,9 @@ public PerSheet Sheet(ISheet sheet) ...@@ -32,8 +32,9 @@ public PerSheet Sheet(ISheet sheet)
return null; return null;
var sheetRead = PerSheetDataFactory.GetDataRead(perSheet.SheetType); var sheetRead = PerSheetDataFactory.GetDataRead(perSheet.SheetType);
perSheet.PerHeader = _perHeader.GetPerHeaderReverse(sheet, sheetRead.Point); perSheet.PerHeader = _perHeader.GetPerHeader(sheet, sheetRead.Point);
perSheet.PerData = sheetRead.ReadData(sheet, perSheet.PerHeader); var headerReverse = _perHeader.GetPerHeaderReverse(sheet, sheetRead.Point);
perSheet.PerData = sheetRead.ReadData(sheet, headerReverse);
return perSheet; return perSheet;
} }
...@@ -44,40 +45,35 @@ public PerSheet Sheet(ISheet sheet) ...@@ -44,40 +45,35 @@ public PerSheet Sheet(ISheet sheet)
/// <returns></returns> /// <returns></returns>
public SheetType GetSheetType(string sheetName) public SheetType GetSheetType(string sheetName)
{ {
if (sheetName.StartsWith("医院人员名单")) //if (sheetName.StartsWith("医院人员名单"))
return SheetType.Employee; // return SheetType.Employee;
else if (sheetName.StartsWith("1.0")) //else
if (sheetName.StartsWith("1.0"))
return SheetType.OtherIncome; return SheetType.OtherIncome;
else if (sheetName.StartsWith("1.")) else if (sheetName.StartsWith("1.1"))
return SheetType.Income; return SheetType.Income;
//else if (sheetName.StartsWith("2.")) else if (sheetName.StartsWith("2."))
// return SheetType.Expend; return SheetType.Expend;
else if (sheetName.StartsWith("3.")) else if (sheetName.StartsWith("3."))
return SheetType.Workload; return SheetType.Workload;
else if (sheetName.StartsWith("4.1")) //else if (sheetName.StartsWith("4.1"))
return SheetType.UnifyUnit; // return SheetType.UnifyUnit;
return SheetType.Unidentifiable; return SheetType.Unidentifiable;
} }
//public List<PerData> AnalyzeData(ISheet sheet, IPerSheetDataRead sheetRead, List<PerHeader> headList) internal List<PerSheet> ProcessCompute(PerExcel excel)
//{ {
// List<PerData> dataList = new List<PerData>(); List<PerSheet> perSheet = new List<PerSheet>();
var economicCompute = new PerSheetDataComputeEconomic();
var economic = economicCompute.ProcessCompute(excel);
perSheet.Add(economic);
// foreach (var unit in sheetRead.Point.AccountingUnit) var workloadCompute = new PerSheetDataComputeWorkload();
// { var workload = workloadCompute.ProcessCompute(excel);
// var vhead = headList.Where(t => t.PointCell != unit.AccountingUnitCellNum && t.PointCell != unit.DeptCellNum).OrderBy(t => t.PointCell); perSheet.Add(workload);
// for (int r = sheetRead.Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++) return perSheet;
// { }
// var row = sheet.GetRow(r);
// for (int c = 0; c < vhead.Count(); c++)
// {
// PerData data = sheetRead.GetPerData(row, vhead.ElementAt(c));
// dataList.Add(data);
// }
// }
// }
// return dataList;
//}
} }
} }
using Performance.DtoModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Services
{
public interface IPerSheetDataCompute
{
/// <summary>
/// 计算
/// </summary>
/// <param name="sheet"></param>
/// <returns></returns>
PerSheet ProcessCompute(PerExcel excel);
}
}
using Performance.DtoModels;
using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Performance.Services
{
/// <summary>
/// 科室经济核算汇总表 (收入/其他收入/支出)
/// </summary>
public class PerSheetDataComputeEconomic : IPerSheetDataCompute
{
/// <summary>
/// 计算科室经济核算汇总表
/// </summary>
/// <param name="excel"></param>
/// <returns></returns>
public PerSheet ProcessCompute(PerExcel excel)
{
PerSheet compSheet = new PerSheet
{
SheetName = "科室经济核算汇总表",
ModuleName = "科室经济核算汇总表",
PerHeader = new List<PerHeader>(),
PerData = new List<IPerData>()
};
//初始核算单元列头
compSheet.PerHeader.Add(new PerHeader { CellName = "核算单元", Level = 0, MergeCell = 1, MergeRow = 2, PointCell = 0, PointRow = 0 });
//起始列
int pointCell = 1;
//计算需从以下sheet中拿取数据
SheetType[] types = { SheetType.Income, SheetType.OtherIncome, SheetType.Expend };
foreach (var type in types)
{
//取出当前sheet类型数据
var sheetList = excel.PerSheet.Where(t => t.SheetType == type);
if (sheetList.Any())
{
List<PerHeader> headList = new List<PerHeader>();
//子集列号为父级列号
int childPointCell = pointCell;
foreach (var sheet in sheetList)
{
var dataList = sheet.PerData.Select(t => (PerData)t);
foreach (var group in dataList.GroupBy(t => t.UnitType))
{
var typeName = $"{GetCleanSheetName(sheet.SheetName)}({ group.Key})";
var ds = group.GroupBy(t => t.AccountingUnit).Select(t => new PerData
{
UnitType = group.Key,
AccountingUnit = t.Key,
CellValue = t.Sum(s => s.IsFactor ? (s.CellValue * (s.FactorValue ?? 0)) : s.CellValue),
TypeName = typeName,
RowNumber = dataList.FirstOrDefault(s => s.AccountingUnit == t.Key && s.UnitType == group.Key)?.RowNumber ?? 0
});
compSheet.PerData.AddRange(ds);
//创建子集头部信息
PerHeader childHeader = new PerHeader(1, childPointCell, typeName, 1, 1, 1, null);
headList.Add(childHeader);
childPointCell++;
}
}
PerHeader header = new PerHeader(0, pointCell, EnumHelper.GetDescription(type), 1, 1, headList.Count, headList);
compSheet.PerHeader.Add(header);
//父级列号为当前列号+子集个数
pointCell = pointCell + headList.Count;
}
}
return compSheet;
}
private string GetCleanSheetName(string sheetName)
{
sheetName = sheetName
.Replace("医生组", "")
.Replace("护理组", "")
.Replace(".", "");
sheetName = Regex.Replace(sheetName, @"\d", "");
return sheetName;
}
}
}
using Performance.DtoModels;
using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Performance.Services
{
/// <summary>
/// 工作量
/// </summary>
public class PerSheetDataComputeWorkload : IPerSheetDataCompute
{
public PerSheet ProcessCompute(PerExcel excel)
{
PerSheet compSheet = new PerSheet
{
SheetName = "工作量绩效测算表",
ModuleName = "工作量绩效测算表",
PerHeader = new List<PerHeader>(),
PerData = new List<IPerData>()
};
//初始核算单元列头
compSheet.PerHeader.Add(new PerHeader { CellName = "核算单元", Level = 0, MergeCell = 1, MergeRow = 2, PointCell = 0, PointRow = 0 });
//起始列
int pointCell = 1;
//计算需从以下sheet中拿取数据
SheetType[] types = { SheetType.Workload };
foreach (var type in types)
{
//取出当前sheet类型数据
var sheetList = excel.PerSheet.Where(t => t.SheetType == type);
if (sheetList.Any())
{
List<PerHeader> headList = new List<PerHeader>();
//子集列号为父级列号
int childPointCell = pointCell;
foreach (var sheet in sheetList)
{
var dataList = sheet.PerData.Select(t => (PerData)t);
foreach (var group in dataList.GroupBy(t => t.UnitType))
{
var typeName = $"{GetCleanSheetName(sheet.SheetName)}({ group.Key})";
var ds = group.GroupBy(t => t.AccountingUnit).Select(t => new PerData
{
UnitType = group.Key,
AccountingUnit = t.Key,
CellValue = t.Sum(s => s.IsFactor ? (s.CellValue * (s.FactorValue ?? 0)) : s.CellValue),
TypeName = typeName,
RowNumber = dataList.FirstOrDefault(s => s.AccountingUnit == t.Key && s.UnitType == group.Key)?.RowNumber ?? 0
});
compSheet.PerData.AddRange(ds);
//创建子集头部信息
PerHeader childHeader = new PerHeader(1, childPointCell, typeName, 1, 1, 1, null);
headList.Add(childHeader);
childPointCell++;
}
}
PerHeader header = new PerHeader(0, pointCell, EnumHelper.GetDescription(type), 1, 1, headList.Count, headList);
compSheet.PerHeader.Add(header);
//父级列号为当前列号+子集个数
pointCell = pointCell + headList.Count;
}
}
return compSheet;
}
private string GetCleanSheetName(string sheetName)
{
sheetName = sheetName
.Replace("医生组", "")
.Replace("护理组", "")
.Replace(".", "");
sheetName = Regex.Replace(sheetName, @"\d", "");
return sheetName;
}
}
}
...@@ -21,7 +21,6 @@ public class PerSheetDataReadEmployee : IPerSheetDataRead ...@@ -21,7 +21,6 @@ public class PerSheetDataReadEmployee : IPerSheetDataRead
DataFirstRowNum = 1, DataFirstRowNum = 1,
}; };
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
List<IPerData> dataList = new List<IPerData>(); List<IPerData> dataList = new List<IPerData>();
...@@ -34,6 +33,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -34,6 +33,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
continue; continue;
PerDataEmployee employee = new PerDataEmployee PerDataEmployee employee = new PerDataEmployee
{ {
RowNumber = r,
AccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "核算单元").PointCell).ToString(), AccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "核算单元").PointCell).ToString(),
Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "科室").PointCell).ToString(), Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "科室").PointCell).ToString(),
DoctorName = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "医生姓名").PointCell).ToString(), DoctorName = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "医生姓名").PointCell).ToString(),
......
using NPOI.SS.UserModel; using NPOI.SS.UserModel;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.Infrastructure;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -18,15 +19,72 @@ public class PerSheetDataReadExpend : IPerSheetDataRead ...@@ -18,15 +19,72 @@ public class PerSheetDataReadExpend : IPerSheetDataRead
HeaderLastRowNum = 2, HeaderLastRowNum = 2,
HeaderFirstCellNum = 0, HeaderFirstCellNum = 0,
DataFirstRowNum = 3, DataFirstRowNum = 3,
//FactorRow = 5, AccountingUnit = new List<AccountingUnit>
//AccountingUnitCellNum = 3, {
//DeptCellNum = 4 new AccountingUnit
{
AccountingUnitCellNum = 0,
UnitType = "医生组",
DeptCellNum = 2
},
new AccountingUnit
{
AccountingUnitCellNum = 1,
UnitType = "护理组",
DeptCellNum = 2
},
}
}; };
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
//throw new NotImplementedException(); List<IPerData> dataList = new List<IPerData>();
return null;
//循环 当前有几个核算单元
foreach (var unit in Point.AccountingUnit)
{
//查询除了 核算单元 科室名称 有效数据列头位置
var vhead = perHeader.Where(t => !Point.AccountingUnit.Select(p => p.AccountingUnitCellNum).Contains(t.PointCell)
&& !Point.AccountingUnit.Select(p => p.DeptCellNum).Contains(t.PointCell)).OrderBy(t => t.PointCell);
for (int r = Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++)
{
var row = sheet.GetRow(r);
for (int c = 0; c < vhead.Count(); c++)
{
//获取当前核算单元名称
var accountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value)?.ToString();
//核算单元空值跳过
if (string.IsNullOrEmpty(accountingUnit))
continue;
var athead = vhead.ElementAt(c);
if (!string.IsNullOrEmpty(athead?.CellName)
&& Point.AccountingUnit.Any(t => athead.CellName.Contains(t.UnitType))
&& !athead.CellName.Contains(unit.UnitType))
continue;
if (!string.IsNullOrEmpty(athead?.CellName) && athead.CellName.Contains("备注"))
continue;
PerData data = new PerData
{
RowNumber = r,
AccountingUnit = accountingUnit,
Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(),
TypeName = athead?.CellName,
CellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell)?.ToString()),
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配
IsFactor = false,
};
var lastcell = vhead.OrderByDescending(t => t.PointCell).First();
if (lastcell.CellName.Contains("备注"))
data.Remark = row.GetCell(lastcell.PointCell)?.ToString();
dataList.Add(data);
}
}
}
return dataList;
} }
} }
} }
...@@ -40,7 +40,6 @@ public class PerSheetDataReadIncome : IPerSheetDataRead ...@@ -40,7 +40,6 @@ public class PerSheetDataReadIncome : IPerSheetDataRead
} }
}; };
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
List<IPerData> dataList = new List<IPerData>(); List<IPerData> dataList = new List<IPerData>();
...@@ -62,8 +61,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -62,8 +61,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
if (string.IsNullOrEmpty(accountingUnit)) if (string.IsNullOrEmpty(accountingUnit))
continue; continue;
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
PerData data = new PerDataIncome PerData data = new PerData
{ {
RowNumber = r,
AccountingUnit = accountingUnit, AccountingUnit = accountingUnit,
Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(), Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(),
TypeName = athead?.CellName, TypeName = athead?.CellName,
...@@ -71,6 +71,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -71,6 +71,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配 UnitType = unit.UnitType, //手动匹配
FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()), FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
IsFactor = true,
}; };
dataList.Add(data); dataList.Add(data);
} }
......
...@@ -13,6 +13,7 @@ namespace Performance.Services ...@@ -13,6 +13,7 @@ namespace Performance.Services
/// </summary> /// </summary>
public class PerSheetDataReadOtherIncome : IPerSheetDataRead public class PerSheetDataReadOtherIncome : IPerSheetDataRead
{ {
public PerSheetPoint Point => new PerSheetPoint public PerSheetPoint Point => new PerSheetPoint
{ {
HeaderFirstRowNum = 1, HeaderFirstRowNum = 1,
...@@ -48,14 +49,16 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -48,14 +49,16 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
if (string.IsNullOrEmpty(accountingUnit)) if (string.IsNullOrEmpty(accountingUnit))
continue; continue;
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
PerData data = new PerDataOtherIncome PerData data = new PerData
{ {
RowNumber = r,
AccountingUnit = accountingUnit, AccountingUnit = accountingUnit,
Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(), Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(),
TypeName = athead?.CellName, TypeName = athead?.CellName,
CellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell)?.ToString()), CellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell)?.ToString()),
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = GetUnitType(sheet.SheetName, perHeader) UnitType = GetUnitType(sheet.SheetName, perHeader),
IsFactor = false,
}; };
dataList.Add(data); dataList.Add(data);
......
...@@ -13,6 +13,10 @@ namespace Performance.Services ...@@ -13,6 +13,10 @@ namespace Performance.Services
/// </summary> /// </summary>
public class PerSheetDataReadUnifyUnit : IPerSheetDataRead public class PerSheetDataReadUnifyUnit : IPerSheetDataRead
{ {
public PerSheetDataReadUnifyUnit()
{
}
public PerSheetPoint Point => new PerSheetPoint public PerSheetPoint Point => new PerSheetPoint
{ {
HeaderFirstRowNum = 0, HeaderFirstRowNum = 0,
...@@ -21,7 +25,6 @@ public class PerSheetDataReadUnifyUnit : IPerSheetDataRead ...@@ -21,7 +25,6 @@ public class PerSheetDataReadUnifyUnit : IPerSheetDataRead
DataFirstRowNum = 2, DataFirstRowNum = 2,
}; };
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
List<IPerData> dataList = new List<IPerData>(); List<IPerData> dataList = new List<IPerData>();
...@@ -35,6 +38,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -35,6 +38,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
continue; continue;
PerDataUnifyUnit unifyUnit = new PerDataUnifyUnit PerDataUnifyUnit unifyUnit = new PerDataUnifyUnit
{ {
RowNumber = r,
AccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "核算单元").PointCell).ToString(), AccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "核算单元").PointCell).ToString(),
Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "科室").PointCell).ToString(), Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "科室").PointCell).ToString(),
DoctorNumber = ConvertHelper.To<int?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "核算单元医生数量" && p.Parent.CellName == "医生组").PointCell).ToString()), DoctorNumber = ConvertHelper.To<int?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellName == "核算单元医生数量" && p.Parent.CellName == "医生组").PointCell).ToString()),
......
...@@ -51,8 +51,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -51,8 +51,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
PerData data = new PerDataWorkload PerData data = new PerData
{ {
RowNumber = r,
AccountingUnit = accountingUnit, AccountingUnit = accountingUnit,
Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(), Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(),
TypeName = athead?.CellName, TypeName = athead?.CellName,
...@@ -60,6 +61,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -60,6 +61,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, UnitType = unit.UnitType,
FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()), FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
IsFactor = true,
}; };
if (sheet.SheetName.Contains("医生组")) if (sheet.SheetName.Contains("医生组"))
data.UnitType = "医生组"; data.UnitType = "医生组";
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="DotNetCore.NPOI" Version="1.2.1" /> <PackageReference Include="DotNetCore.NPOI" Version="1.2.1" />
</ItemGroup> </ItemGroup>
......
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Performance.DtoModels namespace Performance.Services
{ {
public class PerDataIncome : PerData /// <summary>
/// 提供sheet数据查询服务
/// </summary>
public class SheetSevice : IAutoInjection
{ {
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment