Commit c950d818 by lcx

Merge branch 'develop' into feature/抽取时添加抽取时间

parents 4b53dbf8 dccc03bb
......@@ -313,16 +313,8 @@ public ApiResponse GenerateReport([CustomizeValidator(RuleSet = "Delete"), FromB
[HttpPost]
public ApiResponse AccountingVerify([FromRoute] int allotId)
{
_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
{
using (var scope = _serviceScopeFactory.CreateScope())
{
var scopedServices = scope.ServiceProvider.GetRequiredService<AllotService>();
scopedServices.AccoungtingVerify(allotId);
await Task.Delay(TimeSpan.FromSeconds(5), token);
}
});
return new ApiResponse(ResponseType.OK, "核算单元及组别数据验证任务开始");
_allotService.AccoungtingVerify(allotId);
return new ApiResponse(ResponseType.OK, "核算单元及组别数据验证结束,请刷新页面。");
}
/*
......
......@@ -533,19 +533,24 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
[HttpPost]
public ApiResponse GetAccountingList([FromBody] AccoungingRequest request)
{
if (request.AllotId == 0 || !new int[] { 1, 2, 3 }.Contains(request.Type))
var enumItems = EnumHelper.GetItems<AccountTypeEnum>();
if (request.AllotId == 0 || !enumItems.Select(t => t.Value).Contains(request.Type))
return new ApiResponse(ResponseType.ParameterError);
var list = _configService.GetAccountingList(request) ?? new List<cof_accounting>();
var result = _configService.GetAccountingList(request);
switch (request.Type)
{
case 1:
default: //返回accounting列表
return new ApiResponse(ResponseType.OK, "ok", list);
case 2: //返回核算单元类型
return new ApiResponse(ResponseType.OK, "ok", list.Select(t => new TitleValue { Title = t.UnitType, Value = t.UnitType }).ToDistinct());
case 3: //返回核算单元
return new ApiResponse(ResponseType.OK, "ok", list.Select(t => new TitleValue { Title = t.AccountingUnit, Value = t.AccountingUnit }).ToDistinct());
case (int)AccountTypeEnum.List: //返回accounting列表
default:
return new ApiResponse(ResponseType.OK, AccountTypeEnum.List.ToString(), result);
case (int)AccountTypeEnum.UnitType: //返回核算单元类型
var unittypes = result.Select(t => new TitleValue { Title = t.UnitType, Value = t.UnitType }).ToDistinct();
return new ApiResponse(ResponseType.OK, AccountTypeEnum.UnitType.ToString(), unittypes);
case (int)AccountTypeEnum.AccountingUnit: //返回核算单元
var accountingunits = result.Select(t => new TitleValue { Title = t.AccountingUnit, Value = t.AccountingUnit }).ToDistinct();
return new ApiResponse(ResponseType.OK, AccountTypeEnum.AccountingUnit.ToString(), accountingunits);
}
}
......
......@@ -17,4 +17,13 @@ public class AccoungingRequest
/// </summary>
public string UnitType { get; set; }
}
public enum AccountTypeEnum
{
List = 1,
UnitType = 2,
AccountingUnit = 3
}
}
......@@ -90,6 +90,9 @@ public class DetailModule
/// <summary> 结算值 </summary>
public decimal? ItemValue { get; set; }
public decimal? OtherPerfor { get; set; }
public decimal? Attendance { get; set; }
public decimal? PostCoefficient { get; set; }
}
public class DetailModuleExtend : DetailModule
......
......@@ -761,12 +761,13 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
item.ReservedRatio = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
item.ReservedRatioFee = Math.Round(real * (item.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero);
item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero);
// 姓名始终按人员字典显示
item.EmployeeName = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.DoctorName ?? "";
// 人员信息使用人员字典中数据
if (isEmpDic)
{
item.AccountingUnit = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.AccountingUnit ?? "";
item.UnitType = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.UnitType ?? "";
item.EmployeeName = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.DoctorName ?? "";
}
}
}
......@@ -898,10 +899,8 @@ public List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> com
foreach (var item in computes.GroupBy(w => new { w.AccountingUnit, w.JobNumber }))
{
// 补充过一次就不在补充了
var emp = computes.Where(w => w.AccountingUnit == item.Key.AccountingUnit && w.JobNumber == item.Key.JobNumber)
.OrderByDescending(w => w.Source).FirstOrDefault();
var apramount = list.Where(t => t.AccountingUnit == emp.AccountingUnit
&& !string.IsNullOrEmpty(t.PersonnelNumber) && emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
var emp = computes.Where(w => w.AccountingUnit == item.Key.AccountingUnit && w.JobNumber == item.Key.JobNumber).OrderByDescending(w => w.Source).FirstOrDefault();
var apramount = list.Where(t => t.AccountingUnit == emp.AccountingUnit && !string.IsNullOrEmpty(t.PersonnelNumber) && emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
// 如果医院其他绩效 已经被使用,则不再多次带出,防止单个人多次出现造成金额叠加
var tag = $"{(emp.AccountingUnit ?? "")}-{(emp.JobNumber ?? "")}";
if (apramount != null && !uses.Contains(tag))
......@@ -1374,12 +1373,6 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
Detail = new List<DetailDtos>()
};
var sheetType = new List<int>
{
(int)SheetType.AccountExtra, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess,
(int)SheetType.AccountScoreAverage, (int)SheetType.AccountAdjustLaterOtherFee
};
var detail = new DetailDtos
{
ItemName = "后勤人员",
......@@ -1397,7 +1390,10 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
{
JobNumber = item.JobNumber,
ItemName = item.EmployeeName,
ItemValue = Math.Round(item.PerforTotal ?? 0, 2)
ItemValue = Math.Round(item.PerforTotal ?? 0, 2),
OtherPerfor = item.OtherPerfor,
Attendance = item.Attendance,
PostCoefficient = item.PostCoefficient,
});
}
}
......@@ -1406,6 +1402,11 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
if (basicData == null || !basicData.Any()) return deptDetails;
var sheetType = new List<int>
{
(int)SheetType.AccountExtra, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess,
(int)SheetType.AccountScoreAverage, (int)SheetType.AccountAdjustLaterOtherFee
};
int groupBasis = 0;
foreach (var stype in sheetType)
{
......@@ -1427,6 +1428,31 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
}
}
}
// 特殊 6.11个人岗位系数
var postSheet = persheet.FirstOrDefault(t => t.SheetType == (int)SheetType.PersonPostCoefficient);
if (postSheet != null)
{
groupBasis++;
var postDatas = basicData?.Where(w => w.SheetID == postSheet.ID && w.AccountingUnit == account?.AccountingUnit);
foreach (var post in postDatas?.GroupBy(w => new { w.JobNumber }))
{
var amount = post.FirstOrDefault(w => w.IsTotal == 1)?.CellValue ?? 0;
var items = post.Where(w => w.SheetID == postSheet.ID && w.IsTotal != 1)?.Select(t => new DetailModule
{
ItemName = t.TypeName,
CellValue = t.CellValue,
Factor = t.FactorValue,
ItemValue = t.IsFactor == 1 ? (t.CellValue * (t.FactorValue ?? 0)) : t.CellValue,
}).ToList();
if (items != null && items.Count > 0)
{
var itemName = $"个人系数({post.Key.JobNumber} {post.FirstOrDefault()?.EmployeeName})";
var item = new DetailDtos { ItemName = itemName, IncomeType = 5, OriginalType = postSheet.SheetType ?? 0, Amount = amount, GroupBasis = groupBasis, Items = items };
deptDetails.Detail.Add(item);
}
}
}
// 展示额外处理,根据禅道057
deptDetails.Pandect.ScoringAverage = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountScoreAverage)?.Amount ?? deptDetails.Pandect.ScoringAverage;
deptDetails.Pandect.Extra = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountExtra)?.Amount ?? deptDetails.Pandect.Extra;
......@@ -1791,7 +1817,7 @@ public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request)
if (!emp.Any())
dicData.Add(type, "0");
else
dicData.Add(type, Math.Round(Convert.ToDecimal(emp?.First()?.Amount), 0).ToString());
dicData.Add(type, Math.Round(Convert.ToDecimal(emp?.Sum(c => c.Amount))).ToString());
}
var sum = employees.Where(c => c.PersonnelNumber == num)?.Sum(t => t.Amount);
......
......@@ -11,6 +11,7 @@
using System.Text;
using Performance.EntityModels.Entity;
using Performance.Repository.Repository;
using System.Linq.Expressions;
namespace Performance.Services
{
......@@ -643,15 +644,11 @@ public bool AgainDelete(CofAgainRequest request)
/// <returns></returns>
public List<cof_accounting> GetAccountingList(AccoungingRequest request)
{
switch (request.Type)
{
case 1: //返回accounting列表
case 2: //返回核算单元类型
default:
return cofaccountingRepository.GetEntities(t => t.AllotId == request.AllotId)?.OrderBy(t=>t.AccountingUnit).ThenBy(t=>t.UnitType).ToList();
case 3: //返回核算单元
return cofaccountingRepository.GetEntities(t => t.AllotId == request.AllotId && t.UnitType == request.UnitType)?.OrderBy(t=>t.AccountingUnit).ThenBy(t=>t.UnitType).ToList();
}
Expression<Func<cof_accounting, bool>> exp = t => t.AllotId == request.AllotId;
if (request.Type == (int)AccountTypeEnum.AccountingUnit && !string.IsNullOrEmpty(request.UnitType))
exp = exp.And(t => t.UnitType == request.UnitType);
return cofaccountingRepository.GetEntities(exp) ?? new List<cof_accounting>();
}
/// <summary>
......@@ -743,7 +740,7 @@ public bool BatchSaveAccounting(int allotId, SaveCollectData request)
if (!unitType.Contains(data?.UnitType) && !string.IsNullOrEmpty(data?.UnitType)) return false;
if (getAccounts != null)
if (getAccounts.Any(t => t.AccountingUnit == data?.AccountingUnit && t.UnitType == data?.UnitType))continue;
if (getAccounts.Any(t => t.AccountingUnit == data?.AccountingUnit && t.UnitType == data?.UnitType)) continue;
var any = accounts.Any(t => t.AccountingUnit == data?.AccountingUnit && t.UnitType == data?.UnitType);
if (!string.IsNullOrEmpty(data.AccountingUnit) && !string.IsNullOrEmpty(data.UnitType) && !any)
......
......@@ -464,8 +464,10 @@ public bool UpdateDeptDic(DeptdicResponse request)
/// <returns></returns>
public bool DeleteDeptDic(DeptdicResponse request)
{
var deptdics = perdeptdicRepository.GetEntities(t => (t.HISDeptName ?? "") == request.HISDeptName
&& (t.Department ?? "") == request.Department && t.HospitalId == request.HospitalId);
if (request == null)
throw new PerformanceException("科室记录不存在!");
var deptdics = perdeptdicRepository.GetEntities(t => t.HISDeptName == request.HISDeptName && t.Department == request.Department && t.HospitalId == request.HospitalId);
if (deptdics == null || !deptdics.Any())
throw new PerformanceException("科室记录不存在!");
......
......@@ -820,18 +820,20 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
{
item.WorkPerformance = distPerformance?.Where(w => w.AccountingUnit == item.Department && w.JobNumber?.Trim() == item.WorkNumber?.Trim())?.Sum(w => w.GiveFee);
if (string.IsNullOrEmpty(item.WorkNumber))
item.WorkPerformance = distPerformance?.Where(w => w.AccountingUnit == item.Department && w.JobNumber?.Trim() == item.WorkNumber?.Trim() && w.EmployeeName?.Trim() == item.Name?.Trim())?.Sum(w => w.GiveFee);
item.WorkPerformance = distPerformance?.Where(w => w.AccountingUnit == item.Department && w.JobNumber?.Trim() == item.WorkNumber?.Trim())?.Sum(w => w.GiveFee);
}
// 必须是相同核算单元类型才能带出医院其他绩效
if (second.UnitType.Replace("其他", "").Replace("医技", "医生")
== empl.UnitType.Replace("其他", "").Replace("医技", "医生"))
{
if (second.UnitType == UnitType.行政后勤.ToString())
{
if (string.IsNullOrEmpty(item.WorkNumber))
{
var hasAmountData = perapramounts?.Where(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.Trim());
var hasAmountData = perapramounts?.Where(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim());
if (hasAmountData == null || !hasAmountData.Any()) continue;
item.OtherPerformance = hasAmountData.Sum(w => w.Amount);
perapramounts.RemoveAll(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.Trim());
perapramounts.RemoveAll(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim());
}
else
{
......@@ -845,10 +847,10 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
{
if (string.IsNullOrEmpty(item.WorkNumber))
{
var hasAmountData = perapramounts?.Where(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.Trim());
var hasAmountData = perapramounts?.Where(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim());
if (hasAmountData == null || !hasAmountData.Any()) continue;
item.OtherPerformance = hasAmountData.Sum(w => w.Amount);
perapramounts.RemoveAll(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.Trim());
perapramounts.RemoveAll(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim());
}
else
{
......@@ -860,6 +862,7 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
}
}
}
}
// 补充字典中该科室不存在,但有其它绩效的人员信息
......
......@@ -2082,14 +2082,13 @@ public List<SecPrintResponse> Print(int secondId)
//var computes = agcomputeRepository.GetEntities(t => t.SecondId == secondId);
//if (computes == null || !computes.Any())
// return new List<SecPrintResponse>();
List<SecPrintResponse> result = new List<SecPrintResponse>();
if (second.UseTempId.HasValue && second.UseTempId == 6)
{
var data = agothersourceRepository.GetEntities(t => t.SecondId == secondId);
if (data == null || !data.Any()) return new List<SecPrintResponse>();
var result = Mapper.Map<List<SecPrintResponse>>(data);
return result.OrderBy(t => t.JobNumber).ThenBy(t => t.PersonName).ToList();
result = Mapper.Map<List<SecPrintResponse>>(data);
}
else if (second.UseTempId.HasValue && (new int[] { 9, 10 }).Contains(second.UseTempId.Value))
{
......@@ -2099,7 +2098,7 @@ public List<SecPrintResponse> Print(int secondId)
var bodyDynamic = agworkloadsourceRepository.GetEntities(t => data.Select(w => w.Id).Contains(t.BodyId));
if (data == null || !data.Any()) return new List<SecPrintResponse>();
var result = data.Select(w => new SecPrintResponse
result = data.Select(w => new SecPrintResponse
{
JobNumber = w.WorkNumber,
PersonName = w.Name,
......@@ -2113,8 +2112,6 @@ public List<SecPrintResponse> Print(int secondId)
OtherPerformance = w.OtherPerformance,
NightWorkPerformance = w.NightWorkPerformance,
}).ToList();
return result.OrderBy(t => t.JobNumber).ThenBy(t => t.PersonName).ToList();
}
else
{
......@@ -2124,7 +2121,7 @@ public List<SecPrintResponse> Print(int secondId)
if (fixaitems == null || !fixaitems.Any(t => t.RowNumber.HasValue && t.RowNumber != -1)) return new List<SecPrintResponse>();
var rownumbers = fixaitems.Where(t => t.RowNumber.HasValue && t.RowNumber != -1).Select(t => t.RowNumber.Value).Distinct().OrderBy(t => t).ToList();
var result = new List<SecPrintResponse>();
foreach (var rownumber in rownumbers)
{
var distperfor = ConvertHelper.To<decimal?>(fixaitems.FirstOrDefault(t => t.RowNumber == rownumber && t.ItemName == "可分配绩效")?.ItemValue);
......@@ -2145,8 +2142,39 @@ public List<SecPrintResponse> Print(int secondId)
sec.NightWorkPerformance = nightworkperfor;
result.Add(sec);
}
return result.OrderBy(t => t.RowNumber).ToList();
}
// 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
var employees = personService.GetPerEmployee(second.AllotId.Value);
// 补充字典中该科室不存在,但有其它绩效的人员信息
if (perapramounts != null && perapramounts.Any(t => t.AccountingUnit == second.Department))
{
var groupData = perapramounts.Where(t => t.AccountingUnit == second.Department).GroupBy(t => t.PersonnelNumber)
.Select(t => new SecPrintResponse
{
JobNumber = t.Key,
PersonName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.DoctorName))?.DoctorName,
OtherPerformance = t.Sum(w => w.Amount),
RealAmount = t.Sum(w => w.Amount),
});
foreach (var item in groupData)
{
if (!result.Any(w => w.JobNumber == item.JobNumber))
{
per_employee employee = employees?.FirstOrDefault(t => t.PersonnelNumber == item.JobNumber);
if (employee != null && employee.UnitType == second.UnitType)
{
item.Department = employee.AccountingUnit;
item.WorkPost = employee.JobTitle;
result.Add(item);
}
}
}
}
return result.OrderBy(t => t.JobNumber).ThenBy(t => t.PersonName).ToList();
}
#endregion 打印
......
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