Commit dd56fe37 by lcx

Merge branch '4.1write' into v2020morge

parents b9125776 93716191
//-----------------------------------------------------------------------
// <copyright file=" per_dept_dic.cs">
// * FileName: per_dept_dic.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// per_dept_dic Repository
/// </summary>
public partial class PerforPerdeptdicRepository : PerforRepository<per_dept_dic>
{
public IEnumerable<per_dept_dic> GetAccountBasicAccountingUnit(int hospitalId)
{
string sql = @"select * from
(
select distinct
unittype,
ifnull
(
max(case when source = '门诊' then accountingunit end),
max(case when source = '住院' then accountingunit end)
) accountingunit
from per_dept_dic
where hospitalid = @hospitalId
group by unittype,department,hisdeptname
) t
where ifnull(accountingunit, '无')<>'无'
order by unittype,accountingunit;";
return DapperQuery<per_dept_dic>(sql, new { hospitalId });
}
}
}
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// </copyright> // </copyright>
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic;
using Performance.EntityModels; using Performance.EntityModels;
namespace Performance.Repository namespace Performance.Repository
...@@ -13,7 +14,7 @@ namespace Performance.Repository ...@@ -13,7 +14,7 @@ namespace Performance.Repository
/// </summary> /// </summary>
public partial class PerforPerdeptdicRepository : PerforRepository<per_dept_dic> public partial class PerforPerdeptdicRepository : PerforRepository<per_dept_dic>
{ {
public PerforPerdeptdicRepository(PerformanceDbContext context) : base(context) public PerforPerdeptdicRepository(PerformanceDbContext context) : base(context)
{ {
} }
} }
......
...@@ -203,11 +203,7 @@ public static string GetDecodeEscapes(this ICell cell) ...@@ -203,11 +203,7 @@ public static string GetDecodeEscapes(this ICell cell)
if (cell == null) return ""; if (cell == null) return "";
cell.SetCellType(CellType.String); cell.SetCellType(CellType.String);
string value = cell.StringCellValue; return cell.StringCellValue.NoBlank();
if (!string.IsNullOrEmpty(value))
value = value.Replace("\n", "").Replace("\r", "").Replace(" ", "").Trim();
return value;
} }
catch catch
{ {
......
...@@ -38,7 +38,7 @@ private static (string TempPath, string FilePath) CopyOriginalFile(int hospitalI ...@@ -38,7 +38,7 @@ private static (string TempPath, string FilePath) CopyOriginalFile(int hospitalI
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
string tempPath = Path.Combine(dpath, $"Template{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}"); string tempPath = Path.Combine(dpath, $"Template{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}");
FileHelper.Copy(originalPath, tempPath); FileHelper.Copy(originalPath, tempPath);
string filePath = Path.Combine(dpath, $"绩效提取数据{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xls"); string filePath = Path.Combine(dpath, $"绩效提取数据{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{ext}");
return (tempPath, filePath); return (tempPath, filePath);
} }
......
...@@ -22,6 +22,7 @@ public class ExtractService : IAutoInjection ...@@ -22,6 +22,7 @@ public class ExtractService : IAutoInjection
private readonly PerforPerallotRepository perallotRepository; private readonly PerforPerallotRepository perallotRepository;
private readonly PerforcollectdataRepository collectdataRepository; private readonly PerforcollectdataRepository collectdataRepository;
private readonly PerforPeremployeeRepository peremployeeRepository; private readonly PerforPeremployeeRepository peremployeeRepository;
private readonly PerforPerdeptdicRepository perdeptdicRepository;
public ExtractService( public ExtractService(
ILogger<ExtractService> logger, ILogger<ExtractService> logger,
...@@ -32,7 +33,8 @@ public class ExtractService : IAutoInjection ...@@ -32,7 +33,8 @@ public class ExtractService : IAutoInjection
DictionaryService dictionaryService, DictionaryService dictionaryService,
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
PerforcollectdataRepository collectdataRepository, PerforcollectdataRepository collectdataRepository,
PerforPeremployeeRepository peremployeeRepository PerforPeremployeeRepository peremployeeRepository,
PerforPerdeptdicRepository perdeptdicRepository
) )
{ {
this.logger = logger; this.logger = logger;
...@@ -44,6 +46,7 @@ PerforPeremployeeRepository peremployeeRepository ...@@ -44,6 +46,7 @@ PerforPeremployeeRepository peremployeeRepository
this.perallotRepository = perallotRepository; this.perallotRepository = perallotRepository;
this.collectdataRepository = collectdataRepository; this.collectdataRepository = collectdataRepository;
this.peremployeeRepository = peremployeeRepository; this.peremployeeRepository = peremployeeRepository;
this.perdeptdicRepository = perdeptdicRepository;
} }
/// <summary> /// <summary>
...@@ -87,7 +90,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -87,7 +90,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
workbook = ExcelHelper.GetWorkbook(templateFilePath); workbook = ExcelHelper.GetWorkbook(templateFilePath);
if (workbook == null) throw new PerformanceException("文件读取失败"); if (workbook == null) throw new PerformanceException("文件读取失败");
WriteDataToFile(workbook, allotId, dict, standData, groupName, isSingle); WriteDataToFile(workbook, allot, dict, standData, groupName, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle); logService.ReturnTheLog(allotId, groupName, 2, "提取完成", $"绩效数据提取成功", 5, isSingle);
allot.IsExtracting = isSingle ? 2 : 0; allot.IsExtracting = isSingle ? 2 : 0;
...@@ -118,25 +121,25 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -118,25 +121,25 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
/// 数据写入 /// 数据写入
/// </summary> /// </summary>
/// <param name="workbook"></param> /// <param name="workbook"></param>
/// <param name="allotId"></param> /// <param name="allot"></param>
/// <param name="exdict"></param> /// <param name="exdict"></param>
/// <param name="extractDto"></param> /// <param name="extractDto"></param>
/// <param name="groupName"></param> /// <param name="groupName"></param>
/// <param name="isSingle"></param> /// <param name="isSingle"></param>
private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataDict, object> exdict, List<ExtractTransDto> extractDto, string groupName, bool isSingle) private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExDataDict, object> exdict, List<ExtractTransDto> extractDto, string groupName, bool isSingle)
{ {
ExcelStyle style = new ExcelStyle(workbook); ExcelStyle style = new ExcelStyle(workbook);
var models = exdict[ExDataDict.ExModule] as List<ex_module>; var models = exdict[ExDataDict.ExModule] as List<ex_module>;
ExtractHelper.CreateNotExistSheet(models, workbook); ExtractHelper.CreateNotExistSheet(models, workbook);
var employeeDict = peremployeeRepository.GetEntities(t => t.AllotId == allotId); var employeeDict = peremployeeRepository.GetEntities(t => t.AllotId == allot.ID);
var collectData = collectdataRepository.GetEntities(t => t.AllotID == allotId); var collectData = collectdataRepository.GetEntities(t => t.AllotID == allot.ID);
logger.LogInformation($"allotId: {allotId}: 总金额 - {extractDto?.Sum(s => s.Value ?? 0)}"); logger.LogInformation($"allotId: {allot.ID}: 总金额 - {extractDto?.Sum(s => s.Value ?? 0)}");
WriteDataFactory factory = new WriteDataFactory(); WriteDataFactory factory = new WriteDataFactory();
var types = new List<SheetType> { SheetType.OtherIncome, SheetType.Income, SheetType.Expend, SheetType.Workload, SheetType.OtherWorkload }; var types = new List<SheetType> { SheetType.OtherIncome, SheetType.Income, SheetType.Expend, SheetType.Workload, SheetType.OtherWorkload, SheetType.AccountBasic };
decimal ratio = 60m; decimal ratio = 60m;
for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++) for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++)
{ {
...@@ -146,8 +149,8 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD ...@@ -146,8 +149,8 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD
var sheetType = perSheetService.GetSheetType(sheet.SheetName); var sheetType = perSheetService.GetSheetType(sheet.SheetName);
if (sheetType == SheetType.Unidentifiable) continue; if (sheetType == SheetType.Unidentifiable) continue;
logService.ReturnTheLog(allotId, groupName, 3, "", ratio > 99 ? 99 : ratio, 1, isSingle); logService.ReturnTheLog(allot.ID, groupName, 3, "", ratio > 99 ? 99 : ratio, 1, isSingle);
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”开始写入数据", 1, isSingle); logService.ReturnTheLog(allot.ID, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”开始写入数据", 1, isSingle);
var point = PerSheetDataFactory.GetDataRead(sheetType)?.Point; var point = PerSheetDataFactory.GetDataRead(sheetType)?.Point;
if (sheetType == SheetType.OtherWorkload) point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point; if (sheetType == SheetType.OtherWorkload) point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
...@@ -161,30 +164,32 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD ...@@ -161,30 +164,32 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD
string sheetName = sheet.SheetName.NoBlank(); string sheetName = sheet.SheetName.NoBlank();
var collects = collectData?.Where(t => t.SheetName.NoBlank() == sheetName).ToList(); var collects = collectData?.Where(t => t.SheetName.NoBlank() == sheetName).ToList();
customer.WriteCollectData(sheet, point, sheetType, style, collects); customer.WriteCollectData(sheet, point, sheetType, style, collects, exdict);
var exdata = extractDto.Where(t => t.SheetName.NoBlank() == sheetName)?.ToList(); var exdata = extractDto.Where(t => t.SheetName.NoBlank() == sheetName)?.ToList();
if (exdata != null) if (exdata != null)
{ {
logger.LogInformation($"{sheetName}: 总金额 - {exdata.Sum(s => s.Value ?? 0)}; 科室 - {string.Join(",", exdata.Select(s => s.Department).Distinct())}"); logger.LogInformation($"{sheetName}: 总金额 - {exdata.Sum(s => s.Value ?? 0)}; 科室 - {string.Join(",", exdata.Select(s => s.Department).Distinct())}");
} }
var data = GetDataBySheetType(sheetType, exdata, employeeDict); var data = GetDataBySheetType(allot.HospitalId, sheetType, exdata, employeeDict);
customer.WriteSheetData(sheet, point, sheetType, style, data, exdict); customer.WriteSheetData(sheet, point, sheetType, style, data, exdict);
} }
logService.ReturnTheLog(allotId, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”已完成数据写入", 1, isSingle); logService.ReturnTheLog(allot.ID, groupName, 2, "写入数据", $"sheet“{sheet.SheetName}”已完成数据写入", 1, isSingle);
} }
} }
private object GetDataBySheetType(SheetType sheetType, List<ExtractTransDto> extractDto, List<per_employee> employeeDict) private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<ExtractTransDto> extractDto, List<per_employee> employeeDict)
{ {
switch (sheetType) switch (sheetType)
{ {
case SheetType.Employee: case SheetType.Employee:
case SheetType.ClinicEmployee: case SheetType.ClinicEmployee:
case SheetType.AccountBasic:
return employeeDict; return employeeDict;
case SheetType.AccountBasic:
return perdeptdicRepository.GetAccountBasicAccountingUnit(hospitalId);
default: default:
return extractDto; return extractDto;
} }
......
...@@ -16,6 +16,7 @@ public enum ExDataDict ...@@ -16,6 +16,7 @@ public enum ExDataDict
ExModule = 1, ExModule = 1,
ExItem = 2, ExItem = 2,
ExSpecial = 3, ExSpecial = 3,
AccountingBasic = 4,
} }
public class QueryService : IAutoInjection public class QueryService : IAutoInjection
......
using NPOI.SS.UserModel; using Microsoft.Extensions.Logging;
using NPOI.SS.UserModel;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
namespace Performance.Services.ExtractExcelService.SheetDataWrite namespace Performance.Services.ExtractExcelService.SheetDataWrite
{ {
class AccountBasicDataWrite : ISheetDataWrite public class AccountBasicDataWrite : ISheetDataWrite
{ {
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) private readonly ILogger logger;
public AccountBasicDataWrite(ILogger logger)
{ {
this.logger = logger;
}
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{
} }
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null) public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{ {
if (data is List<per_dept_dic> departments && departments.Any())
{
int dataFirstRowNum = point.DataFirstRowNum.Value;
var accountingUnits = departments.Select(t => new Account
{
UnitType = t.UnitType.NoBlank(),
AccountingUnit = t.AccountingUnit.NoBlank()
}).ToList();
var tuples = GetAccountingUnitDataNonexistent(sheet, point, accountingUnits);
if (accountingUnits == null || !accountingUnits.Any()) return;
WriteAccountingUnitDataNonexistent(sheet, point, style, accountingUnits, tuples);
var accountBasic = new List<Account>();
for (int i = point.DataFirstRowNum.Value; i < sheet.LastRowNum + accountingUnits.Count + 1; i++)
{
var row = sheet.GetRow(i);
if (row == null) continue;
accountBasic.Add(new Account
{
UnitType = row.GetCell(point.DataFirstCellNum.Value - 2).GetDecodeEscapes(),
AccountingUnit = row.GetCell(point.DataFirstCellNum.Value - 1).GetDecodeEscapes()
});
}
exdict.Add(ExDataDict.AccountingBasic, accountBasic);
}
}
private List<Account> GetAccountingUnitDataNonexistent(ISheet sheet, PerSheetPoint point, List<Account> accountingUnits)
{
var tuples = new List<Account>();
for (int i = point.DataFirstRowNum.Value; i < sheet.LastRowNum + 1; i++)
{
var row = sheet.GetRow(i);
if (row == null) continue;
var unittype = row.GetCell(point.DataFirstCellNum.Value - 2).GetDecodeEscapes();
var accountingunit = row.GetCell(point.DataFirstCellNum.Value - 1).GetDecodeEscapes();
if (!tuples.Any())
tuples.Add(new Account(unittype, i, i));
else
{
var last = tuples.Last();
if (last.UnitType == unittype)
last.EndIndex = i;
else
tuples.Add(new Account(unittype, i, i));
}
var account = accountingUnits.FirstOrDefault(t => t.AccountingUnit == accountingunit && t.UnitType == unittype);
if (account != null) accountingUnits.Remove(account);
}
return tuples;
}
private void WriteAccountingUnitDataNonexistent(ISheet sheet, PerSheetPoint point, ExcelStyle style, List<Account> accountingUnits, List<Account> tuples)
{
int number = 0;
var deptStyle = style.GetCellStyle();
foreach (var unitType in tuples.Select(t => t.UnitType).Distinct())
{
var accountingList = accountingUnits.Where(t => t.UnitType == unitType)?.ToList();
if (accountingList == null || !accountingList.Any()) continue;
var tuple = tuples.First(t => t.UnitType == unitType);
sheet.ShiftRows(tuple.EndIndex + 1 + number, sheet.LastRowNum + number, accountingList.Count);
int index = tuple.EndIndex + 1 + number;
foreach (var acccount in accountingList)
{
var row = sheet.GetOrCreate(index);
var unitTypeCell = row.GetOrCreate(point.DataFirstCellNum.Value - 2);
unitTypeCell.SetCellValue<string>(acccount.UnitType);
unitTypeCell.CellStyle = deptStyle;
var accountingUnitCell = row.GetOrCreate(point.DataFirstCellNum.Value - 1);
accountingUnitCell.SetCellValue<string>(acccount.AccountingUnit);
accountingUnitCell.CellStyle = deptStyle;
index++;
}
number += accountingList.Count;
}
}
}
public class Account
{
public Account()
{
}
public Account(string unitType, int beginIndex, int endIndex)
{
UnitType = unitType;
BeginIndex = beginIndex;
EndIndex = endIndex;
} }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public int BeginIndex { get; set; }
public int EndIndex { get; set; }
} }
} }
using Microsoft.Extensions.Logging;
using NPOI.SS.UserModel;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Services.ExtractExcelService.SheetDataWrite
{
public class AccountExtraDataWrite : ISheetDataWrite
{
private readonly ILogger logger;
public AccountExtraDataWrite(ILogger logger)
{
this.logger = logger;
}
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{
point = new PerSheetPoint
{
HeaderFirstRowNum = 1,
HeaderFirstCellNum = 0,
DataFirstRowNum = 2,
DataFirstCellNum = 0
};
var accounts = new List<Account>();
if (exdict != null && exdict.ContainsKey(ExDataDict.AccountingBasic) && exdict[ExDataDict.AccountingBasic] != null)
accounts = exdict[ExDataDict.AccountingBasic] as List<Account> ?? new List<Account>();
ExtractHelper.ClearSheetPartialData(sheet, point, sheetType);
var columns = new List<string>();
if (collects != null && collects.Any(t => !string.IsNullOrEmpty(t.TypeName)))
{
columns = collects.Where(t => !string.IsNullOrEmpty(t.TypeName)).Select(t => t.TypeName).Distinct().OrderBy(t => t).ToList();
var headers = columns.Select(t => new ExcelHeader
{
ColumnName = t.NoBlank(),
DoctorFactor = 0,
NurseFactor = 0,
TechnicianFactor = 0
}).ToList();
WriteSheetHeader(sheet, point, sheetType, style, headers);
}
WriteCollectData(sheet, point, sheetType, style, columns, collects, accounts);
}
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{
}
private void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<ExcelHeader> headers)
{
if (headers == null || !headers.Any()) return;
var columns = headers.Select(t => t).ToList();
// 费用类型
var columnHeader = sheet.GetOrCreate(point.HeaderFirstRowNum.Value);
// 去除excel中已存在的列
int headerFirstCellNum = point.DataFirstCellNum.Value;
if (columnHeader.LastCellNum > point.DataFirstCellNum.Value)
{
for (int index = point.DataFirstCellNum.Value; index < columnHeader.LastCellNum; index++)
{
var column = columnHeader.GetCell(index).GetDecodeEscapes();
if (string.IsNullOrEmpty(column)) continue;
if (index > headerFirstCellNum) headerFirstCellNum = index;
columns.RemoveAll(t => t.ColumnName.NoBlank() == column);
}
if (headerFirstCellNum > point.DataFirstCellNum.Value)
headerFirstCellNum += 1;
}
if (columns == null || !columns.Any()) return;
var columnStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头);
// 补充excel中不存在的列
foreach (var item in columns)
{
var columnCell = columnHeader.GetOrCreate(headerFirstCellNum);
columnCell.SetCellValue(item.ColumnName);
columnCell.CellStyle = columnStyle;
headerFirstCellNum++;
}
}
private void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<string> headers, List<collect_data> data, List<Account> accounts)
{
var columnHeader = sheet.GetOrCreate(point.HeaderFirstRowNum.Value);
int dataFirstRowNum = point.DataFirstRowNum.Value;
data = data ?? new List<collect_data>();
accounts = accounts.Any() ? accounts : data.Select(s => new Account { AccountingUnit = s.Department, UnitType = s.UnitType })
.Where(w => !string.IsNullOrEmpty(w.AccountingUnit)).ToDistinct().ToList();
var deptStyle = style.GetCellStyle();
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
headers = headers.Select(t => t.NoBlank()).ToList();
foreach (var account in accounts)
{
var deptData = data.Where(t => t.AccountingUnitDoctor == account.AccountingUnit && t.UnitType == account.UnitType);
var hasData = deptData != null && deptData.Any();
var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
if (collectExtra.ContainsKey(column))
{
cell.SetCellOValue(collectExtra[column]?.Invoke(account));
cell.CellStyle = deptStyle;
}
else if (hasData && headers != null && headers.Contains(column))
{
var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue;
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
}
dataFirstRowNum++;
}
}
/// <summary> 收入固定列 </summary>
private static readonly Dictionary<string, Func<Account, string>> collectExtra = new Dictionary<string, Func<Account, string>>
{
{ "核算单元类型", (dto) => dto.UnitType },
{ "核算单元", (dto) => dto.AccountingUnit },
};
}
}
...@@ -7,16 +7,14 @@ ...@@ -7,16 +7,14 @@
namespace Performance.Services.ExtractExcelService.SheetDataWrite namespace Performance.Services.ExtractExcelService.SheetDataWrite
{ {
class ClinicEmployeeDataWrite : ISheetDataWrite internal class ClinicEmployeeDataWrite : ISheetDataWrite
{ {
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{ {
} }
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null) public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{ {
} }
} }
} }
...@@ -18,7 +18,7 @@ public DepartmentDataWrite(ILogger logger) ...@@ -18,7 +18,7 @@ public DepartmentDataWrite(ILogger logger)
this.logger = logger; this.logger = logger;
} }
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{ {
if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return; if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return;
...@@ -26,7 +26,7 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT ...@@ -26,7 +26,7 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT
var headers = columns.Select(t => new ExcelHeader var headers = columns.Select(t => new ExcelHeader
{ {
ColumnName = t.Trim(), ColumnName = t.NoBlank(),
DoctorFactor = 0, DoctorFactor = 0,
NurseFactor = 0, NurseFactor = 0,
TechnicianFactor = 0 TechnicianFactor = 0
......
...@@ -10,9 +10,8 @@ namespace Performance.Services.ExtractExcelService.SheetDataWrite ...@@ -10,9 +10,8 @@ namespace Performance.Services.ExtractExcelService.SheetDataWrite
{ {
public class EmployeeDataWrite : ISheetDataWrite public class EmployeeDataWrite : ISheetDataWrite
{ {
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{ {
} }
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict) public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict)
...@@ -68,7 +67,6 @@ private void ClearSheetPartialData(ISheet sheet, List<per_employee> employees, L ...@@ -68,7 +67,6 @@ private void ClearSheetPartialData(ISheet sheet, List<per_employee> employees, L
var employee = employees.FirstOrDefault(t => t.AccountingUnit == accountingUnit && t.PersonnelNumber == personnel && t.DoctorName == doctorName); var employee = employees.FirstOrDefault(t => t.AccountingUnit == accountingUnit && t.PersonnelNumber == personnel && t.DoctorName == doctorName);
if (employee == null) if (employee == null)
{ {
} }
else else
{ {
......
...@@ -17,7 +17,7 @@ public interface ISheetDataWrite ...@@ -17,7 +17,7 @@ public interface ISheetDataWrite
/// <param name="sheetType"></param> /// <param name="sheetType"></param>
/// <param name="style"></param> /// <param name="style"></param>
/// <param name="collects">采集数据</param> /// <param name="collects">采集数据</param>
void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects); void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null);
/// <summary> /// <summary>
/// 写入抽取数据 /// 写入抽取数据
......
...@@ -18,7 +18,7 @@ public IncomeDataWrite(ILogger logger) ...@@ -18,7 +18,7 @@ public IncomeDataWrite(ILogger logger)
this.logger = logger; this.logger = logger;
} }
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{ {
if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return; if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return;
......
...@@ -18,7 +18,7 @@ public OtherIncomeDataWrite(ILogger logger) ...@@ -18,7 +18,7 @@ public OtherIncomeDataWrite(ILogger logger)
this.logger = logger; this.logger = logger;
} }
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{ {
if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return; if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return;
......
...@@ -20,7 +20,7 @@ public SpecialUnitDataWrite(ILogger logger) ...@@ -20,7 +20,7 @@ public SpecialUnitDataWrite(ILogger logger)
this.logger = logger; this.logger = logger;
} }
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{ {
} }
......
...@@ -18,7 +18,7 @@ public WorkloadDataWrite(ILogger logger) ...@@ -18,7 +18,7 @@ public WorkloadDataWrite(ILogger logger)
this.logger = logger; this.logger = logger;
} }
public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects) public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, List<collect_data> collects, Dictionary<ExDataDict, object> exdict = null)
{ {
if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return; if (collects == null || !collects.Any(t => !string.IsNullOrEmpty(t.TypeName))) return;
......
...@@ -36,20 +36,33 @@ public ISheetDataWrite GetWriteData(SheetType sheetType, ILogger logger) ...@@ -36,20 +36,33 @@ public ISheetDataWrite GetWriteData(SheetType sheetType, ILogger logger)
factory = new WorkloadDataWrite(logger); factory = new WorkloadDataWrite(logger);
break; break;
//case SheetType.AccountBasic: case SheetType.AccountBasic:
// factory = new AccountBasicDataWrite(); factory = new AccountBasicDataWrite(logger);
// break; break;
case SheetType.SpecialUnit: case SheetType.SpecialUnit:
factory = new SpecialUnitDataWrite(logger); factory = new SpecialUnitDataWrite(logger);
break; break;
//case SheetType.AccountExtra:
//case SheetType.PersonExtra:
//case SheetType.AccountScoreAverage:
//case SheetType.BudgetRatio:
//case SheetType.AssessBeforeOtherFee:
// factory = new DepartmentDataWrite(logger);
// break;
case SheetType.AccountExtra: case SheetType.AccountExtra:
case SheetType.PersonExtra: case SheetType.AccountDrugAssess:
case SheetType.AccountMaterialsAssess:
case SheetType.AccountScoreAverage: case SheetType.AccountScoreAverage:
case SheetType.BudgetRatio: case SheetType.BudgetRatio:
case SheetType.AssessBeforeOtherFee: case SheetType.AssessBeforeOtherFee:
factory = new DepartmentDataWrite(logger); case SheetType.AccountAdjustLaterOtherFee:
case SheetType.WorkloadMedicineProp:
case SheetType.WorkloadCMI:
case SheetType.WorkloadIncline:
factory = new AccountExtraDataWrite(logger);
break; break;
default: default:
......
...@@ -19,6 +19,7 @@ public class PerSheetDataReadDeptAccounting : IPerSheetDataRead ...@@ -19,6 +19,7 @@ public class PerSheetDataReadDeptAccounting : IPerSheetDataRead
HeaderLastRowNum = 1, HeaderLastRowNum = 1,
HeaderFirstCellNum = 0, HeaderFirstCellNum = 0,
DataFirstRowNum = 2, DataFirstRowNum = 2,
DataFirstCellNum = 2,
}; };
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
......
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