Commit 8e140206 by ruyun.zhang@suvalue.com

Merge branch 'release/v22.2.10-Beta-ninghai' into develop

parents 477996d8 8a346089
......@@ -767,6 +767,9 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
var second = secondAllotService.GetSecondAllot(request.SecondId);
if (second == null) throw new PerformanceException("参数SecondId无效!");
if (second.Status == (int)SecondAllot.Status.等待审核 || second.Status == (int)SecondAllot.Status.审核通过)
throw new PerformanceException("保存失败,当前二次分配已提交!");
var allot = _allotService.GetAllot(second.AllotId.Value);
if (allot == null)
throw new PerformanceException("绩效记录不存在!");
......
......@@ -149,31 +149,6 @@
</summary>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.AgainAllotController">
<summary>
科室二次分配
</summary>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.AllotList">
<summary>
返回当前用户医院下绩效列表
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.Import(Microsoft.AspNetCore.Http.IFormCollection)">
<summary>
上传文件
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AgainAllotController.Detail(Performance.DtoModels.AgainAllotRequest)">
<summary>
查看绩效详情
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.List(Performance.DtoModels.AllotRequest)">
<summary>
绩效列表
......
......@@ -156,6 +156,7 @@ public enum Status
超时 = 99,
}
}
public class Attendance
{
public enum Type
......@@ -169,6 +170,16 @@ public enum Deduction
核减 = 1,
不核减 = 2,
}
}
public class SecondAllot
{
public enum Status
{
未提交 = 1,
等待审核 = 2,
审核通过 = 3,
驳回 = 4,
}
}
}
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -42,5 +43,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId)
return new List<view_second_compute_collect>();
}
public int Submit(int secondId, int tempId, decimal realGiveFee, int submitType, string remark = "")
{
string sql = "UPDATE ag_secondallot SET UseTempId = @tempId,NursingDeptStatus = @status, Status = @status, SubmitType = @submitType,SubmitTime = @date, Remark = @remark WHERE Id = @secondId AND RealGiveFee = @fee";
return Execute(sql, new { secondId, tempId, status = 2, date = DateTime.Now, fee = realGiveFee, submitType, remark });
}
}
}
......@@ -306,7 +306,9 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
if (UnitType.医技组 == unitType && workDoctor == null)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit);
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
// 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift;
//dept.MedicineFactor = workDoctor?.MedicineFactor;
......@@ -388,7 +390,9 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
if (UnitTypeUtil.IsOffice(resAccount?.UnitType) && dept.NeedSecondAllot == "是")
{
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == resAccount?.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
// 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift;
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
......
......@@ -167,7 +167,9 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//var scoreAverage = accountScoreAverages?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept?.UnitType && w.AccountingUnit == dept?.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
// 2022-03-16 wufeifei
string[] nightShiftTexts = new string[] { "夜班绩效", "夜班工作量", "夜班工作量奖励" };
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && nightShiftTexts.Contains(w.TypeName?.Trim()))?.CellValue ?? 0;
decimal? headcount = null;
if (typeList.Any(o => o.Description == item.QuantitativeIndicators))
......
......@@ -1549,7 +1549,7 @@ public void CheckGatherData(int allotId, SaveGatherData saveGather)
var departments = perdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId);
if (departments == null || !departments.Any()) throw new PerformanceException("未配置科室字典");
var notExistsDeptData = data.Where(w => !departments.Select(t => t.Department).Contains(w[0]));
var notExistsDeptData = data.Where(w => !departments.Select(t => t.HISDeptName).Contains(w[0]));
if (notExistsDeptData != null && notExistsDeptData.Any())
throw new PerformanceException($"科室字典中不存在科室[{string.Join(",", notExistsDeptData.Select(t => t[0]).Distinct())}]");
......
......@@ -91,13 +91,16 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
}
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取HIS数据", isSingle: isSingle);
var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId);
if (hisScrips == null || !hisScrips.Any()) return;
foreach (var item in hisScrips)
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取{item.SourceType} - {item.Category}数据", isSingle: isSingle);
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, isSingle);
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, groupName, isSingle);
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取HIS数据完成", isSingle: isSingle);
}
catch (Exception)
{
......@@ -227,10 +230,12 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
}
}
private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, bool isSingle)
private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, string groupName, bool isSingle)
{
try
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”数据", isSingle: isSingle);
if (config == null || string.IsNullOrEmpty(script.ExecScript)) return;
var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle);
......@@ -259,10 +264,12 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
CreateTime = DateTime.Now,
});
hisdataRepository.AddRange(insertData.ToArray());
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”完成", isSingle: isSingle);
}
catch (Exception ex)
{
logger.LogError("获取his_data时发生异常:" + ex.ToString());
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL错误", $"获取HIS数据“{script.SourceType} - {script.Category}”时发生异常", 3, isSingle);
}
}
......
......@@ -225,6 +225,12 @@ public static string NoBlank(this string @string)
return @string.Replace("\n", "").Replace("\r", "").Replace(" ", "").Trim();
}
public static string GetNo(this string @string)
{
var match = Regex.Match(@string, "^(1.[1-9].[1-9])|(^[1-9]+.[1-9]+)");
return match.Value;
}
public static IWorkbook GetWorkbook(string filePath)
{
IWorkbook workbook = null;
......
......@@ -54,38 +54,38 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
try
{
var sheetNames = workbook.GetAllNames().Select(w => w.SheetName);
foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName))
{
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
var no = module.ModuleName.GetNo();
var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName;
var sheet = workbook.GetSheet(name) ?? workbook.GetSheet(module.ModuleName);
if (sheet == null)
{
string[] keyArray = new string[] { "开单", "就诊", "执行" };
if (keyArray.Any(key => module.ModuleName.Contains(key)))
if (keyArray.Any(key => name.Contains(key)))
{
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue;
try
{
var newSheet = copysheet.CopySheet(module.ModuleName, true);
var newSheet = copysheet.CopySheet(name, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
}
catch (Exception)
{
}
}
}
}
foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName))
{
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
var no = module.ModuleName.GetNo();
var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName;
var sheet = workbook.GetSheet(name) ?? workbook.GetSheet(module.ModuleName);
if (sheet == null)
{
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true);
var newSheet = copysheet.CopySheet(name, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
......
......@@ -157,12 +157,15 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
if (row == null) continue;
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue;
if (rowIndex >= dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData == null || !deptData.Any(t => t.Value.HasValue && t.Value != 0)) continue;
#region 写入数据
if (sheetType == SheetType.Income && !string.IsNullOrEmpty(department))
if (sheetType == SheetType.Income)
{
if (!incomes.Any(t => t.Department == department))
incomes.Add(GetIncomeRowMessage(row, dataFirstCellNum, department, rowIndex));
......@@ -175,25 +178,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var cell = row.GetOrCreate(cellIndex);
if (string.IsNullOrEmpty(column)) continue;
decimal? value = 0m;
if (!string.IsNullOrEmpty(department))
{
var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData != null && deptData.Any(t => t.Value.HasValue && t.Value != 0))
value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
}
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
// 22.3.29 ry 只要是提取的列头全部覆盖数据
//if (value.HasValue && value != 0)
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column))
{
cell.SetCellValue<decimal>(value ?? 0);
cell.CellStyle = cellStyle;
}
}
#endregion
......@@ -235,7 +227,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")"); ;
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")");
var cell = row.CreateCell(cellIndex);
if (filed.ContainsKey(column))
......@@ -301,15 +293,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
var value = (deptData != null && deptData.Any())
? deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value
: 0;
//if (cell.CellType != CellType.Formula)
//{
// cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
......
......@@ -107,7 +107,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict));
var standData = StandDataFormat(hospitalId, data);
var standData = StandDataFormat(hospitalId, allotId, data);
dictionaryService.Handler(hospitalId, allot, groupName, isSingle);
......@@ -233,10 +233,10 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
var customer = factory.GetWriteData(sheetType, logger);
if (customer != null)
{
var collects = collectData?.Where(t => t.SheetName.NoBlank() == sheetName).ToList();
var collects = collectData?.Where(t => t.SheetName.StartsWith(sheetName.GetNo())).ToList();
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.StartsWith(sheetName.GetNo()))?.ToList();
if (exdata != null)
{
logger.LogInformation($"{sheetName}: 总金额 - {exdata.Sum(s => s.Value ?? 0)}; 科室 - {string.Join(",", exdata.Select(s => s.Department).Distinct())}");
......@@ -275,10 +275,11 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr
/// <summary>
/// 标准数据格式, 匹配科室字典
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="results"></param>
/// <returns></returns>
private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> results)
private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<ex_result> results)
{
if (results == null || !results.Any()) return new List<ExtractTransDto>();
......@@ -305,45 +306,48 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
dict.ForEach(t =>
{
t.Department = WriteDataHelper.HasValue(t.HISDeptName, t.Department);
t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department);
});
var data = results.GroupJoin(dict, outer => new { Department = outer.Department }, inner => new { Department = inner.HISDeptName }, (outer, inner) => new { outer, inner })
.Select(t =>
var data = new List<ExtractTransDto>();
foreach (var item in results)
{
var dept = !string.IsNullOrEmpty(t.inner.FirstOrDefault()?.Department) ? t.inner.FirstOrDefault()?.Department : t.outer.Department;
return new ExtractTransDto
var firstDic = dict.FirstOrDefault(w => w.HISDeptName == item.Department) ?? dict.FirstOrDefault(w => w.Department == item.Department);
var dept = !string.IsNullOrEmpty(firstDic?.Department) ? firstDic?.Department : item.Department;
var d = new ExtractTransDto
{
SheetName = t.outer.Source,
SheetName = item.Source,
Department = dept,
Category = t.outer.Category,
DoctorName = t.outer.DoctorName,
PersonnelNumber = t.outer.PersonnelNumber,
Value = t.outer.Fee ?? 0,
OutDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutDoctorAccounting?.AccountingUnit,
OutNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutNurseAccounting?.AccountingUnit,
OutTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatDoctorAccounting?.AccountingUnit,
InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName,
Category = item.Category,
DoctorName = item.DoctorName,
PersonnelNumber = item.PersonnelNumber,
Value = item.Fee ?? 0,
OutDoctorAccounting = firstDic?.OutDoctorAccounting?.AccountingUnit,
OutNurseAccounting = firstDic?.OutNurseAccounting?.AccountingUnit,
OutTechnicAccounting = firstDic?.OutTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = firstDic?.InpatDoctorAccounting?.AccountingUnit,
InpatNurseAccounting = firstDic?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = firstDic?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = firstDic?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName,
};
});
data.Add(d);
}
var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName }).Select(t => new ExtractTransDto
var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName })
.Select(t => new ExtractTransDto
{
SheetName = t.Key.SheetName,
Department = t.Key.Department,
Category = t.Key.Category,
Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value),
OutDoctorAccounting = t.FirstOrDefault()?.OutDoctorAccounting,
OutNurseAccounting = t.FirstOrDefault()?.OutNurseAccounting,
OutTechnicAccounting = t.FirstOrDefault()?.OutTechnicAccounting,
InpatDoctorAccounting = t.FirstOrDefault()?.InpatDoctorAccounting,
InpatNurseAccounting = t.FirstOrDefault()?.InpatNurseAccounting,
InpatTechnicAccounting = t.FirstOrDefault()?.InpatTechnicAccounting,
SpecialAccounting = t.FirstOrDefault()?.SpecialAccounting,
OutDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutDoctorAccounting))?.OutDoctorAccounting,
OutNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutNurseAccounting))?.OutNurseAccounting,
OutTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutTechnicAccounting))?.OutTechnicAccounting,
InpatDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatDoctorAccounting))?.InpatDoctorAccounting,
InpatNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatNurseAccounting))?.InpatNurseAccounting,
InpatTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatTechnicAccounting))?.InpatTechnicAccounting,
SpecialAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.SpecialAccounting))?.SpecialAccounting,
EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName
});
......
......@@ -438,7 +438,7 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
if (connection == null) return Enumerable.Empty<T>();
if (connection.State == ConnectionState.Closed)
if (connection.State != ConnectionState.Open)
connection.Open();
}
catch
......@@ -446,12 +446,20 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle);
}
try
{
logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
var result = connection.Query<T>(execsql, commandTimeout: 20000);
var result = connection.Query<T>(execsql, commandTimeout: 60 * 60 * 5);
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录");
return result;
}
catch (Exception ex)
{
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL执行错误", ex.Message, 3, isSingle);
throw;
}
}
/// <summary>
/// 获取参数
......
......@@ -39,7 +39,8 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{
var modules = exdict[ExDataDict.ExModule] as List<ex_module>;
var module = modules?.FirstOrDefault(t => t.SheetType == (int)sheetType && t.ModuleName.NoBlank() == sheet.SheetName.NoBlank());
var no = sheet.SheetName.GetNo();
var module = modules?.FirstOrDefault(t => t.SheetType == (int)sheetType && t.ModuleName.StartsWith(no));
if (module == null) return;
if (data is List<ExtractTransDto> extractDto && extractDto.Any())
......
......@@ -39,6 +39,7 @@ public class RedistributionService : IAutoInjection
private readonly PerforAgworkloadRepository _agworkloadRepository;
private readonly PerforAgworkloadsourceRepository _agworkloadsourceRepository;
private readonly PerforAgworkloadtypeRepository _agworkloadtypeRepository;
private readonly PerforImemployeeclinicRepository _imemployeeclinicRepository;
private readonly PerforImemployeelogisticsRepository _imemployeelogisticsRepository;
public RedistributionService(
......@@ -59,6 +60,7 @@ public class RedistributionService : IAutoInjection
PerforAgworkloadRepository agworkloadRepository,
PerforAgworkloadsourceRepository agworkloadsourceRepository,
PerforAgworkloadtypeRepository agworkloadtypeRepository,
PerforImemployeeclinicRepository imemployeeclinicRepository,
PerforImemployeelogisticsRepository imemployeelogisticsRepository)
{
_logger = logger;
......@@ -78,6 +80,7 @@ public class RedistributionService : IAutoInjection
_agworkloadRepository = agworkloadRepository;
_agworkloadsourceRepository = agworkloadsourceRepository;
_agworkloadtypeRepository = agworkloadtypeRepository;
_imemployeeclinicRepository = imemployeeclinicRepository;
_imemployeelogisticsRepository = imemployeelogisticsRepository;
}
#endregion
......@@ -433,6 +436,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
head.AddOrUpdate(nameof(second.UnitType), second.UnitType);
head.AddOrUpdate(nameof(ComputeMode), computeMode);
head.AddOrUpdate("ComputeModeDescription", EnumHelper.GetDescription(computeMode));
var allotStates = new int[] { (int)AllotStates.绩效下发, (int)AllotStates.归档 };
head.AddOrUpdate(nameof(ag_headsource.SecondId), second.Id);
head.AddOrUpdate(nameof(ag_headsource.PaymentOfTheMonth), $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月");
......@@ -446,7 +450,10 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
var refAvg = 0m;
if (Enum.TryParse(typeof(UnitType), second.UnitType, true, out object unittype))
{
var rescompute = _resaccountRepository.GetEntity(w => w.AccountingUnit == second.Department && w.UnitType == (int)((UnitType)unittype));
// 优先取 业务中层实际人均绩效 否则 取 科室人均
var empolyee = _imemployeeclinicRepository.GetEntity(w => w.AllotID == allot.ID && w.AccountingUnit == second.Department && w.UnitType == second.UnitType);
var rescompute = _resaccountRepository.GetEntity(w => w.AllotID == allot.ID && w.AccountingUnit == second.Department && w.UnitType == (int)((UnitType)unittype));
var avg = (empolyee != null && empolyee.FitPeopleValue.HasValue) ? empolyee.FitPeopleValue : rescompute?.Avg ?? 0;
refAvg = rescompute?.Avg ?? 0;
}
head.AddOrUpdate("RefAvg", Math.Round(refAvg, 0, MidpointRounding.AwayFromZero));
......
......@@ -1621,14 +1621,11 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码");
second.UseTempId = temp.UseTempId;
second.Status = 2;
second.NursingDeptStatus = 2;
second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
return agsecondallotRepository.Update(second);
var submitType = temp.UseTempId == 6 ? 2 : 1;
var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total, submitType);
if (res == 0)
throw new PerformanceException($"提交失败,当前绩效分配可能发生改变!");
return true;
}
else if (new int[] { 7, 8 }.Contains(temp.UseTempId.Value))
{
......@@ -1641,14 +1638,11 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码");
second.UseTempId = temp.UseTempId;
second.Status = 2;
second.NursingDeptStatus = 2;
second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
return agsecondallotRepository.Update(second);
var submitType = temp.UseTempId == 6 ? 2 : 1;
var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total, submitType);
if (res == 0)
throw new PerformanceException($"提交失败,当前绩效分配可能发生改变请刷新后重试!");
return true;
}
else /*if (new int[] { 9, 10 }.Contains(temp.UseTempId.Value))*/
{
......@@ -1657,25 +1651,23 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
throw new PerformanceException("提交时未检测到数据!");
else
{
var nightShiftWorkPerforFee = data?.Sum(w => w.NightWorkPerformance ?? 0);
var total = data?.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0));
var nightShiftWorkPerforFee = data.Sum(w => w.NightWorkPerformance ?? 0);
var total = data.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0));
if (!VerifySubmissioAmount(nightShiftWorkPerforFee, second.NightShiftWorkPerforFee))
throw new PerformanceException($"夜班绩效金额不一致!夜班绩效金额:{second.NightShiftWorkPerforFee ?? 0:0.####},提交金额:{nightShiftWorkPerforFee:0.####}");
else if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee:0.####},提交金额:{total:0.####}");
else
{
// 这段逻辑是为了监测 验证失败后继续修改状态而特意加入的
second.UseTempId = temp.UseTempId;
second.Status = 2;
second.NursingDeptStatus = 2;
second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
return agsecondallotRepository.Update(second);
var submitType = temp.UseTempId == 6 ? 2 : 1;
var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total, submitType);
if (res == 0)
throw new PerformanceException($"提交失败,当前绩效分配可能发生改变,请刷新后重试!");
return true;
}
}
}
//logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码");
}
/// <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