Commit f3ef48f6 by lcx

Merge branch 'v2020morge' into v2020morge-graphql

# Conflicts:
#	performance/Performance.Services/CollectService.cs
#	performance/Performance.Services/ExtractExcelService/ExtractService.cs
parents 4d3c2019 8d482b7e
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
}, },
"WebapiUrl": { "WebapiUrl": {
// 抽取结果保存地址 // 抽取结果保存地址
"ImportFile": "http://localhost:5001/api/template/savefile", "ImportFile": "http://localhost:5001/api/",
// 抽取uri // 抽取uri
"HttpPost": "http://localhost:50997/api" "HttpPost": "http://localhost:50997/api/"
} }
} }
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
}, },
"WebapiUrl": { "WebapiUrl": {
// 抽取结果保存地址 // 抽取结果保存地址
"ImportFile": "http://localhost:5001/api/template/savefile", "ImportFile": "http://localhost:5001/api/",
// 抽取uri // 抽取uri
"HttpPost": "http://localhost:50997/api" "HttpPost": "http://localhost:50997/api/"
} }
} }
//-----------------------------------------------------------------------
// <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)
{ {
} }
} }
......
...@@ -26,8 +26,8 @@ public class CollectService : IAutoInjection ...@@ -26,8 +26,8 @@ public class CollectService : IAutoInjection
private readonly PerforImemployeeRepository perforImEmployeeRepository; private readonly PerforImemployeeRepository perforImEmployeeRepository;
private readonly PerforImemployeeclinicRepository perforImemployeeclinicRepository; private readonly PerforImemployeeclinicRepository perforImemployeeclinicRepository;
private readonly PerforImemployeelogisticsRepository perforImemployeelogisticsRepository; private readonly PerforImemployeelogisticsRepository perforImemployeelogisticsRepository;
private readonly PerforCollectdataRepository perforcollectdataRepository; private readonly PerforcollectdataRepository perforcollectdataRepository;
private readonly PerforCollectpermissionRepository perforcollectpermissionRepository; private readonly PerforcollectpermissionRepository perforcollectpermissionRepository;
private readonly PerforUserroleRepository userroleRepository; private readonly PerforUserroleRepository userroleRepository;
private readonly PerforImaccountbasicRepository perforImaccountbasicRepository; private readonly PerforImaccountbasicRepository perforImaccountbasicRepository;
private readonly SheetSevice sheetSevice; private readonly SheetSevice sheetSevice;
...@@ -42,8 +42,8 @@ public class CollectService : IAutoInjection ...@@ -42,8 +42,8 @@ public class CollectService : IAutoInjection
PerforImemployeeRepository perforImEmployeeRepository, PerforImemployeeRepository perforImEmployeeRepository,
PerforImemployeeclinicRepository perforImemployeeclinicRepository, PerforImemployeeclinicRepository perforImemployeeclinicRepository,
PerforImemployeelogisticsRepository perforImemployeelogisticsRepository, PerforImemployeelogisticsRepository perforImemployeelogisticsRepository,
PerforCollectdataRepository perforcollectdataRepository, PerforcollectdataRepository perforcollectdataRepository,
PerforCollectpermissionRepository perforcollectpermissionRepository, PerforcollectpermissionRepository perforcollectpermissionRepository,
PerforUserroleRepository userroleRepository, PerforUserroleRepository userroleRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository, PerforImaccountbasicRepository perforImaccountbasicRepository,
SheetSevice sheetSevice, SheetSevice sheetSevice,
...@@ -122,7 +122,7 @@ into emppmss ...@@ -122,7 +122,7 @@ into emppmss
SheetName = sh.SheetName, SheetName = sh.SheetName,
SheetType = sh.SheetType.Value, SheetType = sh.SheetType.Value,
HeadName = sh.HeadName, HeadName = sh.HeadName,
PermissionId = item?.Id, PermissionId = item?.ID,
Readnoly = item?.Readnoly ?? 0, Readnoly = item?.Readnoly ?? 0,
AttachLast = item?.AttachLast ?? 0, AttachLast = item?.AttachLast ?? 0,
Visible = item?.Visible ?? 0 Visible = item?.Visible ?? 0
...@@ -157,7 +157,7 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects) ...@@ -157,7 +157,7 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
if (data3 != null) if (data3 != null)
{ {
var ids = data3.Select(t => t.PermissionId).ToList(); var ids = data3.Select(t => t.PermissionId).ToList();
var deletes = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.Id)); var deletes = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.ID));
if (deletes != null) if (deletes != null)
perforcollectpermissionRepository.RemoveRange(deletes.ToArray()); perforcollectpermissionRepository.RemoveRange(deletes.ToArray());
} }
...@@ -167,14 +167,14 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects) ...@@ -167,14 +167,14 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
if (data1 != null) if (data1 != null)
{ {
var ids = data1.Select(t => t.PermissionId).ToList(); var ids = data1.Select(t => t.PermissionId).ToList();
var updates = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.Id)); var updates = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.ID));
if (updates != null) if (updates != null)
{ {
foreach (var item in updates) foreach (var item in updates)
{ {
item.AttachLast = data1.FirstOrDefault(w => w.PermissionId == item.Id).AttachLast; item.AttachLast = data1.FirstOrDefault(w => w.PermissionId == item.ID).AttachLast;
item.Readnoly = data1.FirstOrDefault(w => w.PermissionId == item.Id).Readnoly; item.Readnoly = data1.FirstOrDefault(w => w.PermissionId == item.ID).Readnoly;
item.Visible = data1.FirstOrDefault(w => w.PermissionId == item.Id).Visible; item.Visible = data1.FirstOrDefault(w => w.PermissionId == item.ID).Visible;
} }
perforcollectpermissionRepository.UpdateRange(updates.ToArray()); perforcollectpermissionRepository.UpdateRange(updates.ToArray());
} }
...@@ -336,6 +336,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName) ...@@ -336,6 +336,8 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
config = CollectDataConfig.PersonExtra; config = CollectDataConfig.PersonExtra;
else if (sheet.SheetType == (int)SheetType.AccountBasic) else if (sheet.SheetType == (int)SheetType.AccountBasic)
config = CollectDataConfig.AccountBasic; config = CollectDataConfig.AccountBasic;
else if (CollectDataConfig.AccountExrtaType.Contains(sheet.SheetType.Value))
config = CollectDataConfig.AccountExtra;
else else
config = CollectDataConfig.Default; config = CollectDataConfig.Default;
...@@ -371,6 +373,9 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName) ...@@ -371,6 +373,9 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
rowDatas = GetCommonData(sheet); rowDatas = GetCommonData(sheet);
} }
if (rowDatas == null || !rowDatas.Any())
rowDatas = GetAccountExtra(allot, sheet.SheetType.Value);
rowDatas?.RemoveAll(t => !t.CellData.Any(w => !string.IsNullOrEmpty(w.Value?.ToString()))); rowDatas?.RemoveAll(t => !t.CellData.Any(w => !string.IsNullOrEmpty(w.Value?.ToString())));
if (rowDatas != null && rowDatas.Any()) if (rowDatas != null && rowDatas.Any())
rowDatas = rowDatas.OrderBy(t => t.Row).ToList(); rowDatas = rowDatas.OrderBy(t => t.Row).ToList();
...@@ -397,20 +402,20 @@ private List<HandsonRowData> GetCommonData(per_sheet sheet) ...@@ -397,20 +402,20 @@ private List<HandsonRowData> GetCommonData(per_sheet sheet)
var units = rowdata.Where(w => w.UnitType.HasValue).Select(w => new { w.UnitType, w.AccountingUnit }).Distinct(); var units = rowdata.Where(w => w.UnitType.HasValue).Select(w => new { w.UnitType, w.AccountingUnit }).Distinct();
foreach (var item in units) foreach (var item in units)
{ {
if ((new[] {(int) UnitType.医生组, (int) UnitType.其他医生组}).Contains(item.UnitType.Value)) if ((new[] { (int)UnitType.医生组, (int)UnitType.其他医生组 }).Contains(item.UnitType.Value))
{ {
setdata.Add(new HandsonCellData("核算单元(医生组)", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元(医生组)", item.AccountingUnit));
GetUnitClassification(setdata,UnitType.医生组,sheet); GetUnitClassification(setdata, UnitType.医生组, sheet);
} }
else if ((new[] {(int) UnitType.医技组, (int) UnitType.其他医技组}).Contains(item.UnitType.Value)) else if ((new[] { (int)UnitType.医技组, (int)UnitType.其他医技组 }).Contains(item.UnitType.Value))
{ {
setdata.Add(new HandsonCellData("核算单元(医技组)", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元(医技组)", item.AccountingUnit));
GetUnitClassification(setdata,UnitType.医技组,sheet); GetUnitClassification(setdata, UnitType.医技组, sheet);
} }
else if ((new[] {(int) UnitType.护理组, (int) UnitType.其他护理组}).Contains(item.UnitType.Value)) else if ((new[] { (int)UnitType.护理组, (int)UnitType.其他护理组 }).Contains(item.UnitType.Value))
{ {
setdata.Add(new HandsonCellData("核算单元(护理组)", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元(护理组)", item.AccountingUnit));
GetUnitClassification(setdata,UnitType.护理组,sheet); GetUnitClassification(setdata, UnitType.护理组, sheet);
} }
setdata.Add(new HandsonCellData("核算单元", item.AccountingUnit)); setdata.Add(new HandsonCellData("核算单元", item.AccountingUnit));
} }
...@@ -460,6 +465,46 @@ private List<HandsonRowData> GerEmployee(per_sheet sheet) ...@@ -460,6 +465,46 @@ private List<HandsonRowData> GerEmployee(per_sheet sheet)
return new List<HandsonRowData>(); return new List<HandsonRowData>();
} }
private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType)
{
List<HandsonRowData> handsonRows = new List<HandsonRowData>();
if (!CollectDataConfig.AccountExrtaType.Contains(sheetType)) return handsonRows;
List<im_data> basicData = new List<im_data>();
var sheet = perforPersheetRepository.GetEntity(w => w.AllotID == allot.ID && w.SheetType == (int)SheetType.AccountBasic);
if (sheet != null)
{
basicData = perforImdataRepository.GetEntities(t => t.SheetID == sheet.ID);
}
else
{
var allotStates = new int[] { (int)AllotStates.Archive, (int)AllotStates.GenerateSucceed, (int)AllotStates.GenerateAccomplish };
var allots = perforPerallotRepository.GetEntities(t => t.HospitalId == allot.HospitalId && allotStates.Contains(t.States) && t.Year < allot.Year && t.Month < allot.Month);
var prevAllot = allots.LastOrDefault();
if (prevAllot == null) return handsonRows;
sheet = perforPersheetRepository.GetEntity(w => w.AllotID == prevAllot.ID && w.SheetType == (int)SheetType.AccountBasic);
basicData = perforImdataRepository.GetEntities(t => t.SheetID == sheet.ID);
}
if (basicData == null || !basicData.Any()) return handsonRows;
var data = basicData.Select(t => new { t.RowNumber, UnitType = ((UnitType)t.UnitType).ToString(), t.AccountingUnit }).ToDistinct().OrderBy(t => t.RowNumber);
foreach (var item in data)
{
List<HandsonCellData> handsonCells = new List<HandsonCellData>();
handsonCells.Add(new HandsonCellData("核算单元类型", item.UnitType));
handsonCells.Add(new HandsonCellData("核算单元", item.AccountingUnit));
handsonRows.Add(new HandsonRowData(item.RowNumber.Value, handsonCells));
}
return handsonRows;
}
private HandsonRowData CreateRowData(int row, ColumnInfo[] columns, SortedDictionary<string, object> dic) private HandsonRowData CreateRowData(int row, ColumnInfo[] columns, SortedDictionary<string, object> dic)
{ {
var setdata = from cfg in columns var setdata = from cfg in columns
...@@ -476,11 +521,11 @@ private List<HandsonRowData> GetAccountBasic(per_sheet sheet) ...@@ -476,11 +521,11 @@ private List<HandsonRowData> GetAccountBasic(per_sheet sheet)
var groupAccount = perforImdataRepository.GetEntities(t => t.SheetID == sheet.ID); //.OrderBy(c=>c.RowNumber).GroupBy(c => c.RowNumber); var groupAccount = perforImdataRepository.GetEntities(t => t.SheetID == sheet.ID); //.OrderBy(c=>c.RowNumber).GroupBy(c => c.RowNumber);
if (groupAccount != null && groupAccount.Any()) if (groupAccount != null && groupAccount.Any())
{ {
foreach (var rowNumber in groupAccount.Select(t=>t.RowNumber).Distinct()) foreach (var rowNumber in groupAccount.Select(t => t.RowNumber).Distinct())
{ {
var numberData = groupAccount.Where(t => t.RowNumber == rowNumber); var numberData = groupAccount.Where(t => t.RowNumber == rowNumber);
var accountUnit = new HandsonCellData("核算单元",numberData.First().AccountingUnit); var accountUnit = new HandsonCellData("核算单元", numberData.First().AccountingUnit);
var data = numberData?.Select(t => new HandsonCellData(t.TypeName, t.CellValue)).ToList(); var data = numberData?.Select(t => new HandsonCellData(t.TypeName, t.CellValue)).ToList();
data.Add(accountUnit); data.Add(accountUnit);
switch (numberData.First().UnitType) switch (numberData.First().UnitType)
...@@ -489,23 +534,25 @@ private List<HandsonRowData> GetAccountBasic(per_sheet sheet) ...@@ -489,23 +534,25 @@ private List<HandsonRowData> GetAccountBasic(per_sheet sheet)
var unitType = new HandsonCellData("核算单元类型", UnitType.医技组); var unitType = new HandsonCellData("核算单元类型", UnitType.医技组);
data.Add(unitType); data.Add(unitType);
break; break;
case (int)UnitType.医生组: case (int)UnitType.医生组:
unitType = new HandsonCellData("核算单元类型", UnitType.医生组); unitType = new HandsonCellData("核算单元类型", UnitType.医生组);
data.Add(unitType); data.Add(unitType);
break; break;
case (int)UnitType.护理组: case (int)UnitType.护理组:
unitType = new HandsonCellData("核算单元类型", UnitType.护理组); unitType = new HandsonCellData("核算单元类型", UnitType.护理组);
data.Add(unitType); data.Add(unitType);
break; break;
case (int)UnitType.特殊核算组: case (int)UnitType.特殊核算组:
unitType = new HandsonCellData("核算单元类型", UnitType.特殊核算组); unitType = new HandsonCellData("核算单元类型", UnitType.特殊核算组);
data.Add(unitType); data.Add(unitType);
break; break;
} }
var rowData = new HandsonRowData(rowNumber.Value,data); var rowData = new HandsonRowData(rowNumber.Value, data);
result.Add(rowData); result.Add(rowData);
} }
//var temps = accounts.Row.Select(item => new { row = item.Rownumber, dic = JsonHelper.Deserialize(item) }); //var temps = accounts.Row.Select(item => new { row = item.Rownumber, dic = JsonHelper.Deserialize(item) });
...@@ -515,7 +562,7 @@ private List<HandsonRowData> GetAccountBasic(per_sheet sheet) ...@@ -515,7 +562,7 @@ private List<HandsonRowData> GetAccountBasic(per_sheet sheet)
return result; return result;
} }
private void GetUnitClassification(List<HandsonCellData> setdata,UnitType unitType,per_sheet sheet) private void GetUnitClassification(List<HandsonCellData> setdata, UnitType unitType, per_sheet sheet)
{ {
if (sheet.SheetType == (int)SheetType.AccountExtra) if (sheet.SheetType == (int)SheetType.AccountExtra)
setdata.Add(new HandsonCellData("核算组别", unitType)); setdata.Add(new HandsonCellData("核算组别", unitType));
...@@ -529,11 +576,10 @@ private void GetUnitClassification(List<HandsonCellData> setdata,UnitType unitTy ...@@ -529,11 +576,10 @@ private void GetUnitClassification(List<HandsonCellData> setdata,UnitType unitTy
public void SaveCollectData(int allotId, SaveCollectData request) public void SaveCollectData(int allotId, SaveCollectData request)
{ {
var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload, var types = new List<int> { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee, (int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee};
(int)SheetType.AccountExtra, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage,
(int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee, (int)SheetType.AccountAdjustLaterOtherFee, (int)SheetType.WorkloadMedicineProp, types.AddRange(CollectDataConfig.AccountExrtaType);
(int)SheetType.WorkloadCMI, (int)SheetType.WorkloadIncline};
if (!types.Contains(request.SheetType)) if (!types.Contains(request.SheetType))
throw new PerformanceException("当前SHEET页信息错误"); throw new PerformanceException("当前SHEET页信息错误");
...@@ -553,6 +599,8 @@ public void SaveCollectData(int allotId, SaveCollectData request) ...@@ -553,6 +599,8 @@ public void SaveCollectData(int allotId, SaveCollectData request)
config = CollectDataConfig.LogisticsEmployee; config = CollectDataConfig.LogisticsEmployee;
else if (request.SheetType == (int)SheetType.PersonExtra) else if (request.SheetType == (int)SheetType.PersonExtra)
config = CollectDataConfig.PersonExtra; config = CollectDataConfig.PersonExtra;
else if (CollectDataConfig.AccountExrtaType.Contains(request.SheetType))
config = CollectDataConfig.AccountExtra;
else else
config = CollectDataConfig.Default; config = CollectDataConfig.Default;
...@@ -661,6 +709,15 @@ public class CollectDataConfig ...@@ -661,6 +709,15 @@ public class CollectDataConfig
{ nameof(collect_data.EmployeeName), "医生姓名" }, { nameof(collect_data.EmployeeName), "医生姓名" },
}; };
public static Dictionary<string, string> AccountExtra { get; } = new Dictionary<string, string>
{
{ nameof(collect_data.UnitType), "核算单元类型" },
{ nameof(collect_data.AccountingUnitDoctor), "核算单元" },
{ nameof(collect_data.Department), "核算单元" },
{ nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "医生姓名" },
};
public static Dictionary<string, string> AccountBasic { get; } = new Dictionary<string, string> public static Dictionary<string, string> AccountBasic { get; } = new Dictionary<string, string>
{ {
{ nameof(collect_data.UnitType), "核算单元分类" }, { nameof(collect_data.UnitType), "核算单元分类" },
...@@ -680,5 +737,19 @@ public class CollectDataConfig ...@@ -680,5 +737,19 @@ public class CollectDataConfig
{ nameof(collect_data.JobNumber), "人员工号" }, { nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "医生姓名" }, { nameof(collect_data.EmployeeName), "医生姓名" },
}; };
public static List<int> AccountExrtaType = new List<int>
{
(int)SheetType.AccountExtra,
(int)SheetType.AccountDrugAssess,
(int)SheetType.AccountMaterialsAssess,
(int)SheetType.AccountScoreAverage,
(int)SheetType.BudgetRatio,
(int)SheetType.AssessBeforeOtherFee,
(int)SheetType.AccountAdjustLaterOtherFee,
(int)SheetType.WorkloadMedicineProp,
(int)SheetType.WorkloadCMI,
(int)SheetType.WorkloadIncline,
};
} }
} }
...@@ -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);
} }
......
...@@ -20,8 +20,9 @@ public class ExtractService : IAutoInjection ...@@ -20,8 +20,9 @@ public class ExtractService : IAutoInjection
private readonly PerSheetService perSheetService; private readonly PerSheetService perSheetService;
private readonly DictionaryService dictionaryService; private readonly DictionaryService dictionaryService;
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,
...@@ -31,8 +32,9 @@ public class ExtractService : IAutoInjection ...@@ -31,8 +32,9 @@ public class ExtractService : IAutoInjection
PerSheetService perSheetService, PerSheetService perSheetService,
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