Commit 6b98dbdb by lcx

添加日志,收入全导,其他(非公式)全导;二次绩效加载根据unittype判断

parent 38a07311
...@@ -160,8 +160,9 @@ public ApiResponse AddItem([FromBody]ItemListRequest request) ...@@ -160,8 +160,9 @@ public ApiResponse AddItem([FromBody]ItemListRequest request)
[HttpPost] [HttpPost]
public ApiResponse Items([FromBody]ModItemRequest request) public ApiResponse Items([FromBody]ModItemRequest request)
{ {
logger.LogInformation($"请求地址 {url.HttpPost}/modextract/items"); logger.LogInformation($"绩效收入模板配置项列表 : 请求地址 {url.HttpPost}/modextract/items");
HttpHelper.HttpPost(url.HttpPost + "/modextract/items", JsonHelper.Serialize(request), true); HttpHelper.HttpPost(url.HttpPost + "/modextract/items", JsonHelper.Serialize(request), true);
logger.LogInformation($"绩效收入模板配置项列表在{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss完成请求")}");
var list = modExtractService.Items(request.ModuleId.Value); var list = modExtractService.Items(request.ModuleId.Value);
return new ApiResponse(ResponseType.OK, list); return new ApiResponse(ResponseType.OK, list);
} }
......
...@@ -683,6 +683,11 @@ ...@@ -683,6 +683,11 @@
绩效ID 绩效ID
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.UseTempId">
<summary>
使用模板
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.UnitType"> <member name="P:Performance.EntityModels.ag_secondallot.UnitType">
<summary> <summary>
科室类型 科室类型
...@@ -1393,6 +1398,11 @@ ...@@ -1393,6 +1398,11 @@
科室 科室
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.im_accountbasic.IncludeAvgCalculate">
<summary>
是否带入平均计算 是 否
</summary>
</member>
<member name="P:Performance.EntityModels.im_accountbasic.PermanentStaff"> <member name="P:Performance.EntityModels.im_accountbasic.PermanentStaff">
<summary> <summary>
定科人数 定科人数
...@@ -2518,6 +2528,11 @@ ...@@ -2518,6 +2528,11 @@
科室 科室
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.res_account.IncludeAvgCalculate">
<summary>
是否带入平均计算 是 否
</summary>
</member>
<member name="P:Performance.EntityModels.res_account.PermanentStaff"> <member name="P:Performance.EntityModels.res_account.PermanentStaff">
<summary> <summary>
定科人数 定科人数
......
...@@ -358,10 +358,12 @@ private ICell GetOrCreate(IRow row, int index) ...@@ -358,10 +358,12 @@ private ICell GetOrCreate(IRow row, int index)
private void WriteOtherIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true) private void WriteOtherIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true)
{ {
logger.LogInformation($"{sheet.SheetName}开始提取.");
var module = modules.FirstOrDefault(t => t.SheetType == (int)SheetType.OtherIncome); var module = modules.FirstOrDefault(t => t.SheetType == (int)SheetType.OtherIncome);
if (module == null) return; if (module == null) return;
var itemList = items.Where(t => t.ModuleId == module.Id).ToList(); var itemList = items.Where(t => t.ModuleId == module.Id).ToList();
logger.LogInformation($"item有{itemList?.Count ?? 0}个.");
if (itemList == null || !itemList.Any()) return; if (itemList == null || !itemList.Any()) return;
if (IsWriteHead) if (IsWriteHead)
...@@ -390,15 +392,18 @@ private void WriteOtherIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<Ac ...@@ -390,15 +392,18 @@ private void WriteOtherIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<Ac
} }
} }
WriteSheetData(sheet, sheetRead, unitList, allExtract); WriteSheetData(sheet, sheetRead, unitList, allExtract, itemList.Select(t => t.ItemName));
logger.LogInformation($"{sheet.SheetName}提取结束.");
} }
private void WriteIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true) private void WriteIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true)
{ {
var module = modules.FirstOrDefault(t => t.ModuleName == sheet.SheetName); logger.LogInformation($"{sheet.SheetName}开始提取.");
var module = modules.FirstOrDefault(t => t.ModuleName.Replace(" ", "") == sheet.SheetName.Replace(" ", ""));
if (module == null) return; if (module == null) return;
var itemList = items.Where(t => t.ModuleId == module.Id).ToList(); var itemList = items.Where(t => t.ModuleId == module.Id).ToList();
logger.LogInformation($"item有{itemList?.Count ?? 0}个.");
if (itemList == null || !itemList.Any()) return; if (itemList == null || !itemList.Any()) return;
if (IsWriteHead) if (IsWriteHead)
...@@ -421,15 +426,18 @@ private void WriteIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<Account ...@@ -421,15 +426,18 @@ private void WriteIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<Account
allExtract.AddRange(result); allExtract.AddRange(result);
} }
WriteSheetData(sheet, sheetRead, unitList, allExtract); WriteSheetData(sheet, sheetRead, unitList, allExtract, itemList.Select(t => t.ItemName), true);
logger.LogInformation($"{sheet.SheetName}提取结束.");
} }
private void WriteExpend(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true) private void WriteExpend(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true)
{ {
logger.LogInformation($"{sheet.SheetName}开始提取.");
var module = modules.FirstOrDefault(t => t.SheetType == (int)SheetType.Expend); var module = modules.FirstOrDefault(t => t.SheetType == (int)SheetType.Expend);
if (module == null) return; if (module == null) return;
var itemList = items.Where(t => t.ModuleId == module.Id).ToList(); var itemList = items.Where(t => t.ModuleId == module.Id).ToList();
logger.LogInformation($"item有{itemList?.Count ?? 0}个.");
if (itemList == null || !itemList.Any()) return; if (itemList == null || !itemList.Any()) return;
if (IsWriteHead) if (IsWriteHead)
...@@ -458,15 +466,18 @@ private void WriteExpend(ISheet sheet, IPerSheetDataRead sheetRead, List<Account ...@@ -458,15 +466,18 @@ private void WriteExpend(ISheet sheet, IPerSheetDataRead sheetRead, List<Account
} }
} }
WriteSheetData(sheet, sheetRead, unitList, allExtract); WriteSheetData(sheet, sheetRead, unitList, allExtract, itemList.Select(t => t.ItemName));
logger.LogInformation($"{sheet.SheetName}提取结束.");
} }
private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true) private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<sys_hospitalconfig> configs, List<mod_module> modules, List<mod_item> items, List<mod_extract> extracts, bool IsWriteHead = true)
{ {
var module = modules.FirstOrDefault(t => t.ModuleName == sheet.SheetName); logger.LogInformation($"{sheet.SheetName}开始提取.");
var module = modules.FirstOrDefault(t => t.ModuleName.Replace(" ", "") == sheet.SheetName.Replace(" ", ""));
if (module == null) return; if (module == null) return;
var itemList = items.Where(t => t.ModuleId == module.Id).ToList(); var itemList = items.Where(t => t.ModuleId == module.Id).ToList();
logger.LogInformation($"item有{itemList?.Count ?? 0}个.");
if (itemList == null || !itemList.Any()) return; if (itemList == null || !itemList.Any()) return;
var head = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value + 0); var head = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value + 0);
...@@ -527,11 +538,11 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou ...@@ -527,11 +538,11 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 2; var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 2;
foreach (var department in allExtract.Select(t => t.Department).Distinct()) foreach (var department in allExtract.Select(t => t.Department).Distinct())
{ {
var row = sheet.CreateRow(rowIndex); var row = GetOrCreate(sheet, rowIndex);
for (int i = head.FirstCellNum; i < head.LastCellNum; i++) for (int i = head.FirstCellNum; i < head.LastCellNum; i++)
{ {
var headName = head.GetCell(i).StringCellValue; var headName = head.GetCell(i).StringCellValue;
var newCell = row.CreateCell(i); var newCell = GetOrCreate(row, i);
if (headName == "核算单元") if (headName == "核算单元")
{ {
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department)?.AccountingUnit; var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department)?.AccountingUnit;
...@@ -543,7 +554,7 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou ...@@ -543,7 +554,7 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou
newCell.SetCellValue(department ?? ""); newCell.SetCellValue(department ?? "");
newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认); newCell.CellStyle = CellStyle.CreateCellStyle(workbook, StyleType.默认);
} }
else else if (newCell.CellType != CellType.Formula)
{ {
var extract = allExtract.FirstOrDefault(t => t.Department == department && t.Category == headName); var extract = allExtract.FirstOrDefault(t => t.Department == department && t.Category == headName);
var value = extract?.Value == 0 ? null : extract?.Value; var value = extract?.Value == 0 ? null : extract?.Value;
...@@ -554,6 +565,7 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou ...@@ -554,6 +565,7 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou
} }
rowIndex++; rowIndex++;
} }
logger.LogInformation($"{sheet.SheetName}提取结束.");
} }
#region WriteAccountBasic #region WriteAccountBasic
...@@ -609,6 +621,7 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou ...@@ -609,6 +621,7 @@ private void WriteWorkload(ISheet sheet, IPerSheetDataRead sheetRead, List<Accou
private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sys_hospitalconfig> configs, List<mod_special> specials, List<mod_extract> extracts, bool IsWriteHead = true, per_allot lastAllot = null) private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sys_hospitalconfig> configs, List<mod_special> specials, List<mod_extract> extracts, bool IsWriteHead = true, per_allot lastAllot = null)
{ {
logger.LogInformation($"{sheet.SheetName}开始提取.");
var dictionary = new Dictionary<string, Func<mod_special, List<im_specialunit>, object>> var dictionary = new Dictionary<string, Func<mod_special, List<im_specialunit>, object>>
{ {
{ "科室", (special,lastallot) => special.Department }, { "科室", (special,lastallot) => special.Department },
...@@ -619,6 +632,7 @@ private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sy ...@@ -619,6 +632,7 @@ private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sy
}; };
var speaialList = specials?.OrderBy(t => t.Department).ToList(); var speaialList = specials?.OrderBy(t => t.Department).ToList();
logger.LogInformation($"item有{speaialList?.Count ?? 0}个.");
if (speaialList == null || !speaialList.Any()) return; if (speaialList == null || !speaialList.Any()) return;
List<im_specialunit> allotDataList = new List<im_specialunit>(); List<im_specialunit> allotDataList = new List<im_specialunit>();
...@@ -720,6 +734,7 @@ private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sy ...@@ -720,6 +734,7 @@ private void WriteSpecialUnit(ISheet sheet, IPerSheetDataRead sheetRead, List<sy
} }
mergedBegin = mergedEnd + 1; mergedBegin = mergedEnd + 1;
} }
logger.LogInformation($"{sheet.SheetName}提取结束.");
} }
private void WriteHeaderAndFactor(ISheet sheet, IPerSheetDataRead sheetRead, List<mod_item> items) private void WriteHeaderAndFactor(ISheet sheet, IPerSheetDataRead sheetRead, List<mod_item> items)
...@@ -754,7 +769,7 @@ private void WriteHeaderAndFactor(ISheet sheet, IPerSheetDataRead sheetRead, Lis ...@@ -754,7 +769,7 @@ private void WriteHeaderAndFactor(ISheet sheet, IPerSheetDataRead sheetRead, Lis
} }
} }
private void WriteSheetData(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<ExtractDto> allExtract) private void WriteSheetData(ISheet sheet, IPerSheetDataRead sheetRead, List<AccountUnitEntity> unitList, List<ExtractDto> allExtract, IEnumerable<string> header, bool isIncom = false)
{ {
logManageService.WriteMsg("提取绩效数据", $"填充数据 -- {sheet.SheetName}", 1, Allot.ID, "ReceiveMessage"); logManageService.WriteMsg("提取绩效数据", $"填充数据 -- {sheet.SheetName}", 1, Allot.ID, "ReceiveMessage");
logger.LogInformation($"提取绩效数据 填充数据 -- {sheet.SheetName}"); logger.LogInformation($"提取绩效数据 填充数据 -- {sheet.SheetName}");
...@@ -763,11 +778,11 @@ private void WriteSheetData(ISheet sheet, IPerSheetDataRead sheetRead, List<Acco ...@@ -763,11 +778,11 @@ private void WriteSheetData(ISheet sheet, IPerSheetDataRead sheetRead, List<Acco
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 1; var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 1;
foreach (var department in allExtract.Select(t => t.Department).Distinct()) foreach (var department in allExtract.Select(t => t.Department).Distinct())
{ {
var row = sheet.CreateRow(rowIndex); var row = GetOrCreate(sheet, rowIndex);
for (int i = head.FirstCellNum; i < head.LastCellNum; i++) for (int i = head.FirstCellNum; i < head.LastCellNum; i++)
{ {
var headName = head.GetCell(i).StringCellValue; var headName = head.GetCell(i).StringCellValue;
var newCell = row.CreateCell(i); var newCell = GetOrCreate(row, i);
if (headName.Replace("\n", "") == "核算单元(医生组)") if (headName.Replace("\n", "") == "核算单元(医生组)")
{ {
var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit; var dept = unitList.FirstOrDefault(t => t.SheetName == sheet.SheetName && t.Department == department && t.UnitType == 1)?.AccountingUnit;
...@@ -794,9 +809,19 @@ private void WriteSheetData(ISheet sheet, IPerSheetDataRead sheetRead, List<Acco ...@@ -794,9 +809,19 @@ private void WriteSheetData(ISheet sheet, IPerSheetDataRead sheetRead, List<Acco
else else
{ {
var value = allExtract.FirstOrDefault(t => t.Department == department && t.Category == headName)?.Value; var value = allExtract.FirstOrDefault(t => t.Department == department && t.Category == headName)?.Value;
value = value == 0 ? null : value; if (isIncom)
OutToExcelCell(newCell, value); {
newCell.CellStyle = style; value = value == 0 ? null : value;
OutToExcelCell(newCell, value);
newCell.CellStyle = style;
}
else if (newCell.CellType != CellType.Formula)
{
value = value == 0 ? null : value;
OutToExcelCell(newCell, value);
if (header != null && header.Contains(headName))
newCell.CellStyle = style;
}
} }
} }
rowIndex++; rowIndex++;
...@@ -820,8 +845,9 @@ private List<ExtractDto> QueryDatabase(sys_hospitalconfig config, mod_extract ex ...@@ -820,8 +845,9 @@ private List<ExtractDto> QueryDatabase(sys_hospitalconfig config, mod_extract ex
executeScript = Regex.Replace(executeScript, item.Key, item.Value, RegexOptions.IgnoreCase); executeScript = Regex.Replace(executeScript, item.Key, item.Value, RegexOptions.IgnoreCase);
} }
//logManageService.WriteMsg("提取绩效数据", $"SQL脚本:{executeScript}", 1, AllotId, "ReceiveMessage"); //logManageService.WriteMsg("提取绩效数据", $"SQL脚本:{executeScript}", 1, AllotId, "ReceiveMessage");
logger.LogInformation($"提取绩效数据 SQL脚本{executeScript}"); logger.LogInformation($"提取绩效数据 {category ?? ""}SQL脚本{executeScript}");
var result = connection.Query<ExtractDto>(executeScript, commandTimeout: 20000); var result = connection.Query<ExtractDto>(executeScript, commandTimeout: 20000);
logger.LogInformation($"提取绩效数据 {category ?? ""} 执行脚本获取数据{result?.Count() ?? 0}条记录");
if (result != null && result.Count() > 0) if (result != null && result.Count() > 0)
{ {
if (extract.ExecuteType == 2) if (extract.ExecuteType == 2)
......
...@@ -440,9 +440,12 @@ public void AddItems(int moduleId) ...@@ -440,9 +440,12 @@ public void AddItems(int moduleId)
throw new PerformanceException($"医院配置信息未设置"); throw new PerformanceException($"医院配置信息未设置");
} }
var connection = ConnectionBuilder.Create(DatabaseType.SqlServer, hospitalConfig.DbSource, hospitalConfig.DbName, hospitalConfig.DbUser, hospitalConfig.DbPassword); logger.LogInformation("创建数据库连接");
var connection = ConnectionBuilder.Create(DatabaseType.Oracle, hospitalConfig.DbSource, hospitalConfig.DbName, hospitalConfig.DbUser, hospitalConfig.DbPassword);
string sql = sqlconfig.Content; string sql = sqlconfig.Content;
logger.LogInformation($"执行sql:{sql}");
var dataList = perforExtractRepository.ExecuteScript(connection, sql, null); var dataList = perforExtractRepository.ExecuteScript(connection, sql, null);
logger.LogInformation($"获取数据{dataList?.Count ?? 0}条");
if (dataList != null && dataList.Any()) if (dataList != null && dataList.Any())
{ {
var itemList = dataList.Select(t => new mod_item var itemList = dataList.Select(t => new mod_item
......
...@@ -84,7 +84,13 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -84,7 +84,13 @@ public List<SecondListResponse> GetSecondList(int userId)
throw new NotImplementedException("该医院未生成绩效"); throw new NotImplementedException("该医院未生成绩效");
var allotListId = allotList.Select(t => t.ID).ToList(); var allotListId = allotList.Select(t => t.ID).ToList();
var secondList = perforAgsecondallotRepository.GetEntities(t => allotListId.Contains(t.AllotId.Value) && t.Department == user.Department);
Expression<Func<ag_secondallot, bool>> exp = t => allotListId.Contains(t.AllotId.Value) && t.Department == user.Department;
if (role.RoleID == application.NurseRole)
exp = exp.And(t => t.UnitType == "护理组");
else
exp = exp.And(t => t.UnitType != "护理组");
var secondList = perforAgsecondallotRepository.GetEntities(exp);
//各科室绩效分配结果 //各科室绩效分配结果
var accountList = perforResaccountRepository.GetEntities(t => allotListId.Contains(t.AllotID.Value) && t.Department == user.Department); var accountList = perforResaccountRepository.GetEntities(t => allotListId.Contains(t.AllotID.Value) && t.Department == user.Department);
//取得未生成二次绩效的绩效id //取得未生成二次绩效的绩效id
......
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