Commit b86bc909 by 李承祥

收入、工作量的核算单元,数据填充

parent 8aa2b332
...@@ -27,6 +27,10 @@ public IEnumerable<TEntity> DapperQuery(string sql, object param) ...@@ -27,6 +27,10 @@ public IEnumerable<TEntity> DapperQuery(string sql, object param)
{ {
return context.Database.GetDbConnection().Query<TEntity>(sql, param); return context.Database.GetDbConnection().Query<TEntity>(sql, param);
} }
public IEnumerable<TEntity> DapperQuery(string sql, object param, int? commandTimeout = null)
{
return context.Database.GetDbConnection().Query<TEntity>(sql, param, commandTimeout: commandTimeout);
}
public int Execute(string sql, object param) public int Execute(string sql, object param)
{ {
......
...@@ -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,8 +14,15 @@ namespace Performance.Repository ...@@ -13,8 +14,15 @@ namespace Performance.Repository
/// </summary> /// </summary>
public partial class PerforImdataRepository : PerforRepository<im_data> public partial class PerforImdataRepository : PerforRepository<im_data>
{ {
public PerforImdataRepository(PerformanceDbContext context) : base(context) public PerforImdataRepository(PerformanceDbContext context) : base(context)
{ {
} }
public IEnumerable<im_data> GetAccountingUnit(List<int> sheetList, List<string> deptList)
{
string sql = "select distinct accountingUnit,department,unittype from im_data " +
"where sheetid in @sheetList and department in @deptList";
return DapperQuery(sql, new { sheetList, deptList }, 1000 * 60 * 5);
}
} }
} }
...@@ -32,6 +32,7 @@ public class ExtractService : IAutoInjection ...@@ -32,6 +32,7 @@ public class ExtractService : IAutoInjection
private readonly PerforPersheetRepository perforPersheetRepository; private readonly PerforPersheetRepository perforPersheetRepository;
private readonly PerforImheaderRepository perforImheaderRepository; private readonly PerforImheaderRepository perforImheaderRepository;
private readonly PerforImemployeeRepository perforImemployeeRepository; private readonly PerforImemployeeRepository perforImemployeeRepository;
private readonly PerforImdataRepository perforImdataRepository;
private readonly PerforImaccountbasicRepository perforImaccountbasicRepository; private readonly PerforImaccountbasicRepository perforImaccountbasicRepository;
private readonly PerforExtractRepository perforExtractRepository; private readonly PerforExtractRepository perforExtractRepository;
private readonly PerforPerfirstRepository perforPerfirstRepository; private readonly PerforPerfirstRepository perforPerfirstRepository;
...@@ -46,6 +47,7 @@ public class ExtractService : IAutoInjection ...@@ -46,6 +47,7 @@ public class ExtractService : IAutoInjection
PerforPersheetRepository perforPersheetRepository, PerforPersheetRepository perforPersheetRepository,
PerforImheaderRepository perforImheaderRepository, PerforImheaderRepository perforImheaderRepository,
PerforImemployeeRepository perforImemployeeRepository, PerforImemployeeRepository perforImemployeeRepository,
PerforImdataRepository perforImdataRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository, PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforExtractRepository perforExtractRepository, PerforExtractRepository perforExtractRepository,
PerforPerfirstRepository perforPerfirstRepository, PerforPerfirstRepository perforPerfirstRepository,
...@@ -60,6 +62,7 @@ public class ExtractService : IAutoInjection ...@@ -60,6 +62,7 @@ public class ExtractService : IAutoInjection
this.perforPersheetRepository = perforPersheetRepository; this.perforPersheetRepository = perforPersheetRepository;
this.perforImheaderRepository = perforImheaderRepository; this.perforImheaderRepository = perforImheaderRepository;
this.perforImemployeeRepository = perforImemployeeRepository; this.perforImemployeeRepository = perforImemployeeRepository;
this.perforImdataRepository = perforImdataRepository;
this.perforImaccountbasicRepository = perforImaccountbasicRepository; this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.perforExtractRepository = perforExtractRepository; this.perforExtractRepository = perforExtractRepository;
this.perforPerfirstRepository = perforPerfirstRepository; this.perforPerfirstRepository = perforPerfirstRepository;
...@@ -262,7 +265,7 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee ...@@ -262,7 +265,7 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
} }
//临床科室医护绩效测算表 //临床科室医护绩效测算表
else if (SheetType.AccountBasic == sheet.SheetType /*&& sheet.PerData != null && sheet.PerData.Any()*/) else if (SheetType.AccountBasic == sheet.SheetType && sheet.PerData != null && sheet.PerData.Any())
{ {
LogHelper.Information($"填充临床科室医护绩效测算表,", "提取绩效数据"); LogHelper.Information($"填充临床科室医护绩效测算表,", "提取绩效数据");
var dataList = sheet.PerData.ConvertAll(new Converter<IPerData, PerDataAccountBaisc>(t => (PerDataAccountBaisc)t)); var dataList = sheet.PerData.ConvertAll(new Converter<IPerData, PerDataAccountBaisc>(t => (PerDataAccountBaisc)t));
...@@ -331,6 +334,12 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee ...@@ -331,6 +334,12 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
var connection = ConnectionBuilder.Create(DatabaseType.SqlServer, hospitalConfig.DbSource, hospitalConfig.DbName, hospitalConfig.DbUser, hospitalConfig.DbPassword); var connection = ConnectionBuilder.Create(DatabaseType.SqlServer, hospitalConfig.DbSource, hospitalConfig.DbName, hospitalConfig.DbUser, hospitalConfig.DbPassword);
var dataList = perforExtractRepository.ExecuteScript(connection, script.ExecuteScript, null); var dataList = perforExtractRepository.ExecuteScript(connection, script.ExecuteScript, null);
LogHelper.Information($"写入SQL脚本执行结果", "提取绩效数据"); LogHelper.Information($"写入SQL脚本执行结果", "提取绩效数据");
//用于查询核算单元
var deptList = dataList.Where(t => t.ColumnName == "科室名称").Select(t => t.Value.ToString()).Distinct().ToList();
var sheetIdList = perforPersheetRepository.GetEntities(t => t.SheetType == (int)sheet.SheetType).Select(t => t.ID).ToList();
var imdata = perforImdataRepository.GetAccountingUnit(sheetIdList, deptList);
//创建数据行 //创建数据行
foreach (var pointRow in dataList.Select(t => t.RowNumber).Distinct().OrderBy(t => t)) foreach (var pointRow in dataList.Select(t => t.RowNumber).Distinct().OrderBy(t => t))
{ {
...@@ -344,6 +353,34 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee ...@@ -344,6 +353,34 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
{ {
importRow.CreateCell(headInfo.PointCell).SetCellValue(Verify(data.Value.ToString())); importRow.CreateCell(headInfo.PointCell).SetCellValue(Verify(data.Value.ToString()));
} }
if (data.ColumnName == "科室名称")
{
//补充核算单元
if (sheet.SheetType == SheetType.Income)
{
var doctor = imdata.FirstOrDefault(t => t.UnitType == 1 && t.Department == data.Value.ToString());
if (doctor != null)
importRow.CreateCell(0).SetCellValue(doctor.AccountingUnit);
var nurse = imdata.FirstOrDefault(t => t.UnitType == 2 && t.Department == data.Value.ToString());
if (nurse != null)
importRow.CreateCell(1).SetCellValue(nurse.AccountingUnit);
}
else if (sheet.SheetType == SheetType.Workload)
{
if (sheet.SheetName.Contains("医生"))
{
var doctor = imdata.FirstOrDefault(t => t.UnitType == 1 && t.Department == data.Value.ToString());
if (doctor != null)
importRow.CreateCell(0).SetCellValue(doctor.AccountingUnit);
}
else
{
var nurse = imdata.FirstOrDefault(t => t.UnitType == 2 && t.Department == data.Value.ToString());
if (nurse != null)
importRow.CreateCell(0).SetCellValue(nurse.AccountingUnit);
}
}
}
} }
} }
} }
...@@ -416,7 +453,7 @@ private List<PerSheet> GetRepositoryData(int allotId) ...@@ -416,7 +453,7 @@ private List<PerSheet> GetRepositoryData(int allotId)
} }
return sheetList; return sheetList;
} }
/// <summary> /// <summary>
/// 获取sheet及列头 /// 获取sheet及列头
/// </summary> /// </summary>
......
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