预留比例,全院发放表等

parent c3162559
...@@ -192,10 +192,11 @@ public ApiResponse AllCompute([FromBody] ComputerRequest request) ...@@ -192,10 +192,11 @@ public ApiResponse AllCompute([FromBody] ComputerRequest request)
if (null == allot) if (null == allot)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
var isShowManage = _computeService.IsShowManage(request.AllotId); var isShowManage = _computeService.IsShowManage(request.AllotId);
var list = isShowManage == 1 //var list = isShowManage == 1
? _computeService.AllCompute(request.AllotId) // ? _computeService.AllCompute(request.AllotId)
: _computeService.AllManageCompute(request.AllotId); // : _computeService.AllManageCompute(request.AllotId);
var list = _computeService.AllCompute(request.AllotId, isShowManage);
return new ApiResponse(ResponseType.OK, "ok", list); return new ApiResponse(ResponseType.OK, "ok", list);
} }
...@@ -211,7 +212,7 @@ public ApiResponse AllManageCompute([FromBody] ComputerRequest request) ...@@ -211,7 +212,7 @@ public ApiResponse AllManageCompute([FromBody] ComputerRequest request)
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.AllManageCompute(request.AllotId); var list = _computeService.AllCompute(request.AllotId, 1);
return new ApiResponse(ResponseType.OK, "ok", list); return new ApiResponse(ResponseType.OK, "ok", list);
} }
......
...@@ -136,6 +136,18 @@ public ApiResponse SecondDetail([CustomizeValidator(RuleSet = "Refresh"), FromBo ...@@ -136,6 +136,18 @@ public ApiResponse SecondDetail([CustomizeValidator(RuleSet = "Refresh"), FromBo
//} //}
#endregion #endregion
/// <summary>
/// 二次绩效录入页面自动补全
/// </summary>
/// <returns></returns>
[Route("api/second/autocomplete")]
[HttpPost]
public ApiResponse AutoComplete([FromBody] SecondEmpRequest request)
{
var result = secondAllotService.AutoComplete(request, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, result);
}
#region 模板使用 #region 模板使用
/// <summary> /// <summary>
/// 选择二次绩效模板 /// 选择二次绩效模板
......
...@@ -1059,6 +1059,12 @@ ...@@ -1059,6 +1059,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.SecondAllotController.AutoComplete(Performance.DtoModels.SecondEmpRequest)">
<summary>
二次绩效录入页面自动补全
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.Temp(Performance.DtoModels.AllotDeptRequest)"> <member name="M:Performance.Api.Controllers.SecondAllotController.Temp(Performance.DtoModels.AllotDeptRequest)">
<summary> <summary>
选择二次绩效模板 选择二次绩效模板
......
...@@ -2356,6 +2356,21 @@ ...@@ -2356,6 +2356,21 @@
职位 职位
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.ComputeResponse.PerforSumFee">
<summary>
绩效合计
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.OthePerfor">
<summary>
医院其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.NightWorkPerfor">
<summary>
实发绩效工资金额
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.RealGiveFee"> <member name="P:Performance.DtoModels.ComputeResponse.RealGiveFee">
<summary> <summary>
实发绩效 实发绩效
......
...@@ -362,6 +362,16 @@ ...@@ -362,6 +362,16 @@
人员名称 人员名称
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_compute.OthePerfor">
<summary>
医院其他绩效
</summary>
</member>
<member name="P:Performance.EntityModels.ag_compute.NightWorkPerfor">
<summary>
实发绩效工资金额
</summary>
</member>
<member name="P:Performance.EntityModels.ag_compute.RealGiveFee"> <member name="P:Performance.EntityModels.ag_compute.RealGiveFee">
<summary> <summary>
实发金额 实发金额
......
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class SecondEmpRequest
{
public int TempId { get; set; }
public int HospitalId { get; set; }
public string Department { get; set; }
public string UnitType { get; set; }
public int SecondId { get; set; }
public string EmployeeName { get; set; }
public string JobNumber { get; set; }
}
public class SecondEmpRequestValidator : AbstractValidator<SecondEmpRequest>
{
public SecondEmpRequestValidator()
{
RuleFor(x => x.TempId).NotNull().GreaterThan(0);
RuleFor(x => x.HospitalId).NotNull().GreaterThan(0);
RuleFor(x => x.Department).NotNull().NotEmpty();
RuleFor(x => x.UnitType).NotNull().NotEmpty();
RuleFor(x => x.SecondId).NotNull().GreaterThan(0);
}
}
}
...@@ -6,6 +6,19 @@ namespace Performance.DtoModels ...@@ -6,6 +6,19 @@ namespace Performance.DtoModels
{ {
public class ComputeResponse public class ComputeResponse
{ {
public ComputeResponse() { }
public ComputeResponse(string source, string accountingUnit, string employeeName,
string jobNumber, string jobTitle, decimal? perforSumFee)
{
Source = source;
AccountingUnit = accountingUnit;
EmployeeName = employeeName;
JobNumber = jobNumber;
JobTitle = jobTitle;
PerforSumFee = perforSumFee;
}
/// <summary> /// <summary>
/// 来源 /// 来源
/// </summary> /// </summary>
...@@ -33,6 +46,20 @@ public class ComputeResponse ...@@ -33,6 +46,20 @@ public class ComputeResponse
/// </summary> /// </summary>
public string JobTitle { get; set; } public string JobTitle { get; set; }
/// <summary>
/// 绩效合计
/// </summary>
public Nullable<decimal> PerforSumFee { get; set; }
/// <summary>
/// 医院其他绩效
/// </summary>
public Nullable<decimal> OthePerfor { get; set; }
/// <summary>
/// 实发绩效工资金额
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary> /// <summary>
/// 实发绩效 /// 实发绩效
...@@ -42,11 +69,11 @@ public class ComputeResponse ...@@ -42,11 +69,11 @@ public class ComputeResponse
/// <summary> /// <summary>
/// 预留比例 /// 预留比例
/// </summary> /// </summary>
public decimal ReservedRatio { get; set; } public Nullable<decimal> ReservedRatio { get; set; }
/// <summary> /// <summary>
/// 预留比例金额 /// 预留比例金额
/// </summary> /// </summary>
public decimal ReservedRatioFee { get; set; } public Nullable<decimal> ReservedRatioFee { get; set; }
} }
} }
...@@ -7,50 +7,60 @@ ...@@ -7,50 +7,60 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels namespace Performance.EntityModels
{ {
/// <summary> /// <summary>
/// 二次绩效结果表 /// 二次绩效结果表
/// </summary> /// </summary>
[Table("ag_compute")] [Table("ag_compute")]
public class ag_compute public class ag_compute
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// 绩效ID /// 绩效ID
/// </summary> /// </summary>
public Nullable<int> AllotId { get; set; } public Nullable<int> AllotId { get; set; }
/// <summary> /// <summary>
/// 二次绩效ID /// 二次绩效ID
/// </summary> /// </summary>
public Nullable<int> SecondId { get; set; } public Nullable<int> SecondId { get; set; }
/// <summary> /// <summary>
/// 科室 /// 科室
/// </summary> /// </summary>
public string Department { get; set; } public string Department { get; set; }
/// <summary> /// <summary>
/// 职称 /// 职称
/// </summary> /// </summary>
public string WorkPost { get; set; } public string WorkPost { get; set; }
/// <summary> /// <summary>
/// 工号 /// 工号
/// </summary> /// </summary>
public string JobNumber { get; set; } public string JobNumber { get; set; }
/// <summary> /// <summary>
/// 人员名称 /// 人员名称
/// </summary> /// </summary>
public string PersonName { get; set; } public string PersonName { get; set; }
/// <summary>
/// 医院其他绩效
/// </summary>
public Nullable<decimal> OthePerfor { get; set; }
/// <summary>
/// 实发绩效工资金额
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary> /// <summary>
/// 实发金额 /// 实发金额
/// </summary> /// </summary>
......
...@@ -412,121 +412,174 @@ public DeptDetailResponse GetDepartmentDetail(int allotId, int accountId, int ty ...@@ -412,121 +412,174 @@ public DeptDetailResponse GetDepartmentDetail(int allotId, int accountId, int ty
return null; return null;
} }
#region 绩效发放列表
/// <summary> /// <summary>
/// 返回绩效发放列表 /// 返回绩效发放列表
/// </summary> /// </summary>
/// <param name="allotId">绩效ID</param> /// <param name="allotId">绩效ID</param>
/// <param name="isShowManage"> 仅显示管理绩效 isShowManage == 1 </param>
/// <returns></returns> /// <returns></returns>
public List<ComputeResponse> AllCompute(int allotId) public List<ComputeResponse> AllCompute(int allotId, int isShowManage)
{ {
var list = new List<ComputeResponse>(); var list = new List<ComputeResponse>();
var mTypes = new[] { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() }; var mTypes = new[] { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
var types = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
// 一次绩效 获取特定人员绩效结果
var allot = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && mTypes.Contains(t.AccountType))?.OrderByDescending(t => t.AccountingUnit); var allot = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && mTypes.Contains(t.AccountType))?.OrderByDescending(t => t.AccountingUnit);
list = Mapper.Map<List<ComputeResponse>>(allot); list = allot?.Select(t =>
list?.ForEach(t => t.Source = "一次绩效");
var again = _perforAgcomputeRepository.GetEntities(t => t.AllotId == allotId);
if (again != null && again.Any())
{ {
var group = again.GroupBy(t => new { t.Department, t.WorkPost, t.JobNumber, t.PersonName }) // 仅显示管理绩效
.Select(t => new var fee = isShowManage == 1 && types.Contains(t.AccountType) ? t.ShouldGiveFee : t.RealGiveFee;
{ return new ComputeResponse("一次绩效", t.AccountingUnit, t.EmployeeName, t.JobNumber, t.JobTitle, fee);
department = t.Key.Department, }).ToList();
jobtitle = t.Key.WorkPost, // 获取二次绩效结果
jobnumber = t.Key.JobNumber, var seconds = GetSecondPerformance(allotId);
name = t.Key.PersonName, if (seconds != null)
fee = t.Sum(g => g.RealGiveFee) list?.AddRange(seconds);
}); // 补充医院其他绩效
list.AddRange(group.Select(t => new ComputeResponse
{
Source = "二次绩效",
AccountingUnit = t.department,
JobNumber = t.jobnumber,
JobTitle = t.jobtitle,
EmployeeName = t.name,
RealGiveFee = t.fee
}).OrderByDescending(t => t.AccountingUnit));
}
var result = AddAprAmount(allotId, list); var result = AddAprAmount(allotId, list);
// 预留比例
if (result != null) if (result != null)
{ {
var empDic = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId); var empDic = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
foreach (var item in result) foreach (var item in result)
{ {
var temp = item.RealGiveFee ?? 0; var temp = item.PerforSumFee ?? 0;
item.ReservedRatio = empDic?.FirstOrDefault(w => w.DoctorName == item.EmployeeName && w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0; item.ReservedRatio = empDic?.FirstOrDefault(w => w.DoctorName == item.EmployeeName && w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
item.ReservedRatioFee = temp * item.ReservedRatio; item.ReservedRatioFee = temp * item.ReservedRatio;
item.RealGiveFee = temp - item.ReservedRatioFee; item.RealGiveFee = temp * (1 - item.ReservedRatio) + (item.OthePerfor ?? 0) + (item.NightWorkPerfor ?? 0);
} }
} }
return result; return result?.OrderByDescending(t => t.AccountingUnit).ToList();
} }
/// <summary> /// <summary>
/// 返回绩效发放列表 /// 获取二次绩效结果
/// 科主任护士长返回管理绩效
/// </summary> /// </summary>
/// <param name="allotId">绩效ID</param> /// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
public List<ComputeResponse> AllManageCompute(int allotId) private List<ComputeResponse> GetSecondPerformance(int allotId)
{ {
var list = new List<ComputeResponse>();
var mTypes = new[] { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
var allot = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && mTypes.Contains(t.AccountType))?.OrderByDescending(t => t.AccountingUnit);
if (allot != null && allot.Any(t => t.AllotID == allotId))
{
var types = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
list = allot.Select(t => new ComputeResponse
{
Source = "一次绩效",
AccountingUnit = t.AccountingUnit,
EmployeeName = t.EmployeeName,
JobNumber = t.JobNumber,
JobTitle = t.JobTitle,
RealGiveFee = types.Contains(t.AccountType) ? t.ShouldGiveFee : t.RealGiveFee
}).ToList();
}
var again = _perforAgcomputeRepository.GetEntities(t => t.AllotId == allotId); var again = _perforAgcomputeRepository.GetEntities(t => t.AllotId == allotId);
if (again != null && again.Any()) if (again != null && again.Any())
{ {
var group = again.GroupBy(t => new { t.Department, t.WorkPost, t.JobNumber, t.PersonName }) var group = again
.Select(t => new .GroupBy(t => new { t.Department, t.WorkPost, t.JobNumber, t.PersonName })
.Select(t =>
{ {
department = t.Key.Department, var comp = new ComputeResponse("二次绩效", t.Key.Department, t.Key.PersonName, t.Key.JobNumber, t.Key.WorkPost, t.Sum(g => g.RealGiveFee));
jobtitle = t.Key.WorkPost, comp.NightWorkPerfor = t.Sum(g => g.NightWorkPerfor);
jobnumber = t.Key.JobNumber, return comp;
name = t.Key.PersonName,
fee = t.Sum(g => g.RealGiveFee)
}); });
list.AddRange(group.Select(t => new ComputeResponse return group?.ToList();
{
Source = "二次绩效",
AccountingUnit = t.department,
JobNumber = t.jobnumber,
JobTitle = t.jobtitle,
EmployeeName = t.name,
RealGiveFee = t.fee
}).OrderByDescending(t => t.AccountingUnit));
} }
var result = AddAprAmount(allotId, list);
if (result != null) return null;
}
/// <summary>
/// 添加额外绩效金额(基础绩效、其他绩效等)
/// </summary>
/// <param name="allotId"></param>
/// <param name="computes"></param>
private List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> computes)
{
if (computes == null || !computes.Any())
return computes;
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId);
if (list == null || !list.Any())
return computes;
var source = new string[] { "一次绩效", "二次绩效" };
foreach (var item in list.Where(t => t.Amount.HasValue))
{ {
var empDic = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId); foreach (var s in source)
foreach (var item in result)
{ {
var temp = item.RealGiveFee ?? 0; // 全空跳过
item.ReservedRatio = empDic?.FirstOrDefault(w => w.DoctorName == item.EmployeeName && w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0; if (string.IsNullOrEmpty(item.PersonnelNumber) && string.IsNullOrEmpty(item.DoctorName))
item.ReservedRatioFee = temp * item.ReservedRatio; continue;
item.RealGiveFee = temp - item.ReservedRatioFee; // 优先工号和姓名全部匹配 其次是工号 最后是姓名
var emp = computes.FirstOrDefault(t => t.Source == s && t.JobNumber == item.PersonnelNumber && t.EmployeeName == item.DoctorName);
if (emp == null)
emp = computes.FirstOrDefault(t => !string.IsNullOrEmpty(item.PersonnelNumber) && t.Source == s && t.JobNumber == item.PersonnelNumber);
if (emp == null)
emp = computes.FirstOrDefault(t => !string.IsNullOrEmpty(item.DoctorName) && t.Source == s && t.EmployeeName == item.DoctorName);
if (emp != null)
emp.OthePerfor += item.Amount;
} }
} }
return result; return computes;
} }
///// <summary>
///// 返回绩效发放列表
///// 科主任护士长返回管理绩效
///// </summary>
///// <param name="allotId">绩效ID</param>
///// <returns></returns>
//public List<ComputeResponse> AllManageCompute(int allotId)
//{
// var list = new List<ComputeResponse>();
// var mTypes = new[] { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
// var allot = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && mTypes.Contains(t.AccountType))?.OrderByDescending(t => t.AccountingUnit);
// if (allot != null && allot.Any(t => t.AllotID == allotId))
// {
// var types = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
// list = allot.Select(t => new ComputeResponse
// {
// Source = "一次绩效",
// AccountingUnit = t.AccountingUnit,
// EmployeeName = t.EmployeeName,
// JobNumber = t.JobNumber,
// JobTitle = t.JobTitle,
// RealGiveFee = types.Contains(t.AccountType) ? t.ShouldGiveFee : t.RealGiveFee
// }).ToList();
// }
// var again = _perforAgcomputeRepository.GetEntities(t => t.AllotId == allotId);
// if (again != null && again.Any())
// {
// var group = again.GroupBy(t => new { t.Department, t.WorkPost, t.JobNumber, t.PersonName })
// .Select(t => new
// {
// department = t.Key.Department,
// jobtitle = t.Key.WorkPost,
// jobnumber = t.Key.JobNumber,
// name = t.Key.PersonName,
// fee = t.Sum(g => g.RealGiveFee)
// });
// list.AddRange(group.Select(t => new ComputeResponse
// {
// Source = "二次绩效",
// AccountingUnit = t.department,
// JobNumber = t.jobnumber,
// JobTitle = t.jobtitle,
// EmployeeName = t.name,
// RealGiveFee = t.fee
// }).OrderByDescending(t => t.AccountingUnit));
// }
// var result = AddAprAmount(allotId, list);
// if (result != null)
// {
// var empDic = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
// foreach (var item in result)
// {
// var temp = item.RealGiveFee ?? 0;
// item.ReservedRatio = empDic?.FirstOrDefault(w => w.DoctorName == item.EmployeeName && w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
// item.ReservedRatioFee = temp * item.ReservedRatio;
// item.RealGiveFee = temp - item.ReservedRatioFee;
// }
// }
// return result;
//}
#endregion
public res_compute GetComputeSingle(int computeid) public res_compute GetComputeSingle(int computeid)
{ {
return _perforRescomputeRepository.GetEntity(t => t.ID == computeid); return _perforRescomputeRepository.GetEntity(t => t.ID == computeid);
...@@ -860,15 +913,87 @@ public DeptDataDetails SpecialDeptDetail(ag_secondallot second) ...@@ -860,15 +913,87 @@ public DeptDataDetails SpecialDeptDetail(ag_secondallot second)
} }
deptDetails.Detail.Add(detail); deptDetails.Detail.Add(detail);
var extra = new DetailDtos
var persheet = _perforPerSheetRepository.GetEntities(t => t.AllotID == second.AllotId);
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == second.AllotId);
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == second.AllotId && t.AccountingUnit == second.Department);
var sheetType = new List<int>
{ {
ItemName = "医院奖罚", (int)SheetType.AccountExtra, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess
IncomeType = 5,
Amount = deptDetails.Pandect.Extra,
Items = GetExtraDetail(second.AllotId.Value, (int)UnitType.特殊核算组, second.Department),
GroupBasis = 1,
}; };
deptDetails.Detail.Add(extra); Regex reg = new Regex("[0-9]*");
int groupBasis = 0;
foreach (var stype in sheetType)
{
foreach (var sheet in persheet.Where(t => t.SheetType == stype))
{
groupBasis++;
var sheetName = reg.Replace(sheet.SheetName, "", 5).Replace(".", "").Replace(" ", "");
var sheetData = basicData.Where(t => t.SheetID == sheet.ID && t.UnitType == (int)UnitType.特殊核算组 && t.IsTotal != 1).ToList();
if (sheetData == null || !sheetData.Any()) continue;
var headerData = headers?.Where(t => t.SheetID == sheet.ID);
var sheettype = 1; //特殊核算科室 4
var amount = 0m;
if (sheet.SheetType == (int)SheetType.AccountExtra)
{
sheettype = 5;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
}
else if (sheet.SheetType == (int)SheetType.AccountDrugAssess)
{
sheettype = 6;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
}
else if (sheet.SheetType == (int)SheetType.AccountMaterialsAssess)
{
sheettype = 7;
amount = sheetData.Sum(t => t.CellValue ?? 0m);
}
var item = new DetailDtos
{
ItemName = sheetName,
IncomeType = sheettype,
Amount = amount,
GroupBasis = groupBasis,
};
var items = sheetData?.Select(t => new DetailModule
{
ItemName = t.TypeName,
CellValue = t.CellValue,
Factor = sheet.SheetType == (int)SheetType.Workload ? t.FactorValue : t.FactorValue * 100,
ItemValue = t.IsFactor == 1 ? (t.CellValue * (t.FactorValue ?? 0)) : t.CellValue,
}).ToList();
if (items != null && items.Any())
{
items = items.GroupBy(t => t.ItemName).Select(t =>
new DetailModule
{
ItemName = t.Key,
CellValue = t.Sum(group => group.CellValue),
Factor = t.FirstOrDefault().Factor,
ItemValue = t.Sum(group => group.ItemValue),
}
).ToList();
}
if (headerData != null && headerData.Any())
{
items = items
?.OrderBy(t => (headerData.FirstOrDefault(h => h.CellValue == t.ItemName)?.PointCell) ?? 100)
?.ThenBy(t => t.ItemName).ToList();
}
item.Items = items;
deptDetails.Detail.Add(item);
}
}
return deptDetails; return deptDetails;
} }
...@@ -920,52 +1045,5 @@ public ag_secondallot GetSecondByAccountId(int accountId) ...@@ -920,52 +1045,5 @@ public ag_secondallot GetSecondByAccountId(int accountId)
UnitType = UnitType.特殊核算组.ToString() UnitType = UnitType.特殊核算组.ToString()
}; };
} }
/// <summary>
/// 添加额外绩效金额(基础绩效、其他绩效等)
/// </summary>
/// <param name="allotId"></param>
/// <param name="computes"></param>
private List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> computes)
{
if (computes == null || !computes.Any())
return computes;
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId);
if (list == null || !list.Any())
return computes;
var source = new string[] { "一次绩效", "二次绩效" };
foreach (var item in list.Where(t => t.Amount.HasValue))
{
var flag = false;
foreach (var s in source)
{
if (flag) continue;
var emp = computes.FirstOrDefault(t => t.Source == s && t.JobNumber == item.PersonnelNumber && t.EmployeeName == item.DoctorName);
if (emp != null)
{
emp.RealGiveFee += item.Amount;
flag = true;
continue;
}
emp = computes.FirstOrDefault(t => t.Source == s && t.JobNumber == item.PersonnelNumber);
if (emp != null)
{
emp.RealGiveFee += item.Amount;
flag = true;
continue;
}
emp = computes.FirstOrDefault(t => t.Source == s && t.EmployeeName == item.DoctorName);
if (emp != null)
{
emp.RealGiveFee += item.Amount;
flag = true;
continue;
}
}
}
return computes;
}
} }
} }
\ No newline at end of file
...@@ -33,6 +33,7 @@ public class SecondAllotService : IAutoInjection ...@@ -33,6 +33,7 @@ public class SecondAllotService : IAutoInjection
private readonly PerforAgothersourceRepository perforAgothersourceRepository; private readonly PerforAgothersourceRepository perforAgothersourceRepository;
private readonly PerforAgworkloadtypeRepository perforAgworkloadtypeRepository; private readonly PerforAgworkloadtypeRepository perforAgworkloadtypeRepository;
private readonly PerforRoleRepository roleRepository; private readonly PerforRoleRepository roleRepository;
private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforResspecialunitRepository resspecialunitRepository; private readonly PerforResspecialunitRepository resspecialunitRepository;
private readonly PersonService personService; private readonly PersonService personService;
private readonly PerforRescomputeRepository rescomputeRepository; private readonly PerforRescomputeRepository rescomputeRepository;
...@@ -55,6 +56,7 @@ public class SecondAllotService : IAutoInjection ...@@ -55,6 +56,7 @@ public class SecondAllotService : IAutoInjection
PerforAgothersourceRepository perforAgothersourceRepository, PerforAgothersourceRepository perforAgothersourceRepository,
PerforAgworkloadtypeRepository perforAgworkloadtypeRepository, PerforAgworkloadtypeRepository perforAgworkloadtypeRepository,
PerforRoleRepository roleRepository, PerforRoleRepository roleRepository,
PerforPerapramountRepository perapramountRepository,
PerforResspecialunitRepository resspecialunitRepository, PerforResspecialunitRepository resspecialunitRepository,
PersonService personService, PersonService personService,
PerforRescomputeRepository rescomputeRepository) PerforRescomputeRepository rescomputeRepository)
...@@ -76,6 +78,7 @@ public class SecondAllotService : IAutoInjection ...@@ -76,6 +78,7 @@ public class SecondAllotService : IAutoInjection
this.perforAgothersourceRepository = perforAgothersourceRepository; this.perforAgothersourceRepository = perforAgothersourceRepository;
this.perforAgworkloadtypeRepository = perforAgworkloadtypeRepository; this.perforAgworkloadtypeRepository = perforAgworkloadtypeRepository;
this.roleRepository = roleRepository; this.roleRepository = roleRepository;
this.perapramountRepository = perapramountRepository;
this.resspecialunitRepository = resspecialunitRepository; this.resspecialunitRepository = resspecialunitRepository;
this.personService = personService; this.personService = personService;
this.rescomputeRepository = rescomputeRepository; this.rescomputeRepository = rescomputeRepository;
...@@ -271,6 +274,31 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -271,6 +274,31 @@ public List<SecondListResponse> GetSecondList(int userId)
#endregion #endregion
/// <summary>
/// 二次绩效分配录入人员自动补全信息
/// </summary>
/// <param name="request"></param>
/// <param name="userId"></param>
/// <returns></returns>
public List<BodyItem> AutoComplete(SecondEmpRequest request, int userId)
{
var usetemp = perforAgusetempRepository.GetEntity(
t => t.HospitalId == request.HospitalId && t.Department == request.Department && t.UnitType == request.UnitType);
if (usetemp == null)
throw new PerformanceException("当前科室暂未配置绩效模板");
//获取固定模板列 + 工作量列
var headItems = GetHeadItems(request.TempId, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType);
var second = perforAgsecondallotRepository.GetEntity(t => t.Id == request.SecondId);
if (second == null)
throw new PerformanceException("当前科室二次分配绩效信息无效");
var bodyItems = GetEmployees(second.AllotId.Value, userId, headItems, request.EmployeeName, request.JobNumber);
return bodyItems;
}
#region 二次绩效详情-使用中 #region 二次绩效详情-使用中
/// <summary> /// <summary>
/// 二次绩效详情 /// 二次绩效详情
...@@ -340,19 +368,30 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId) ...@@ -340,19 +368,30 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
}; };
} }
private List<BodyItem> GetEmployees(int allotId, int userId, List<HeadItem> heads) private List<BodyItem> GetEmployees(int allotId, int userId, List<HeadItem> heads, string empName = "", string jobNumber = "")
{ {
var list = new List<BodyItem>(); var list = new List<BodyItem>();
var employees = personService.GetPersons(allotId, userId); var employees = personService.GetPersons(allotId, userId);
if (employees == null || !employees.Any()) return list; if (employees == null || !employees.Any()) return list;
if (!string.IsNullOrEmpty(empName))
employees = employees?.Where(w => w.DoctorName == empName).ToList();
if (!string.IsNullOrEmpty(jobNumber))
employees = employees?.Where(w => w.PersonnelNumber == jobNumber).ToList();
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == allotId);
Func<per_employee, decimal?> getAprAmount = (t) => perapramounts
?.Where(w => w.DoctorName == t.DoctorName && w.PersonnelNumber == t.PersonnelNumber)
?.Sum(w => w.Amount);
Dictionary<(string, string), Func<per_employee, object>> dict = new Dictionary<(string, string), Func<per_employee, object>> Dictionary<(string, string), Func<per_employee, object>> dict = new Dictionary<(string, string), Func<per_employee, object>>
{ {
{ ("姓名", "FullName"), (t) => t.DoctorName }, { ("姓名", "FullName"), (t) => t.DoctorName },
{ ("岗位", "Post"), (t) => !string.IsNullOrEmpty(t.Duty) && (t.Duty.IndexOf("主任") > -1 || t.Duty.IndexOf("护士长") > -1) ? "主任" : "其他" }, { ("岗位", "Post"), (t) => !string.IsNullOrEmpty(t.Duty) && (t.Duty.IndexOf("主任") > -1 || t.Duty.IndexOf("护士长") > -1) ? "主任" : "其他" },
{ ("出勤", "ActualAttendance"), (t) => t.AttendanceDay }, { ("出勤", "ActualAttendance"), (t) => t.AttendanceDay },
{ ("预留比例", "ReservedRatio"), (t) => t.ReservedRatio }, { ("预留比例", "ReservedRatio"), (t) => t.ReservedRatio },
{ ("医院其他绩效","OtherPerformance"), (t) => getAprAmount(t)},
}; };
int rowNumber = 1; int rowNumber = 1;
...@@ -1192,6 +1231,8 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1192,6 +1231,8 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
JobNumber = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "人员工号")?.ItemValue, JobNumber = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "人员工号")?.ItemValue,
WorkPost = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "岗位")?.ItemValue, WorkPost = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "岗位")?.ItemValue,
PersonName = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "姓名")?.ItemValue, PersonName = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "姓名")?.ItemValue,
OthePerfor = ConvertHelper.TryDecimal(items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "医院其他绩效")?.ItemValue, 0),
NightWorkPerfor = ConvertHelper.TryDecimal(items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "夜班工作量绩效")?.ItemValue, 0),
RealGiveFee = ConvertHelper.TryDecimal(items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "实发绩效工资金额")?.ItemValue, 0), RealGiveFee = ConvertHelper.TryDecimal(items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "实发绩效工资金额")?.ItemValue, 0),
}); });
} }
......
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