Commit 990bdfad by lcx

科主任/护士长 应发绩效 (乘以 出勤率), 增加菜单 其他业务中层绩效

parent d61a092a
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
} }
}, },
"AppConnection": { "AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=192.168.18.166;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;", "HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2" "RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
......
using AutoMapper; using AutoMapper;
using NPOI.SS.Formula.Functions;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
...@@ -26,6 +27,7 @@ public class ComputeService : IAutoInjection ...@@ -26,6 +27,7 @@ public class ComputeService : IAutoInjection
private readonly PerforCofincomeRepository _perforCofincomeRepository; private readonly PerforCofincomeRepository _perforCofincomeRepository;
private readonly PerforAgsecondallotRepository _perforAgsecondallotRepository; private readonly PerforAgsecondallotRepository _perforAgsecondallotRepository;
private readonly PerforAgcomputeRepository _perforAgcomputeRepository; private readonly PerforAgcomputeRepository _perforAgcomputeRepository;
private readonly PerforImemployeeclinicRepository _perforImemployeeclinicRepository;
public ComputeService(PerforResaccountRepository perforResaccountRepository, public ComputeService(PerforResaccountRepository perforResaccountRepository,
//PerforResaccountnurseRepository perforResAccountnurseRepository, //PerforResaccountnurseRepository perforResAccountnurseRepository,
...@@ -39,7 +41,8 @@ public class ComputeService : IAutoInjection ...@@ -39,7 +41,8 @@ public class ComputeService : IAutoInjection
PerforResbaiscnormRepository perforResbaiscnormRepository, PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforCofincomeRepository perforCofincomeRepository, PerforCofincomeRepository perforCofincomeRepository,
PerforAgsecondallotRepository perforAgsecondallotRepository, PerforAgsecondallotRepository perforAgsecondallotRepository,
PerforAgcomputeRepository perforAgcomputeRepository) PerforAgcomputeRepository perforAgcomputeRepository,
PerforImemployeeclinicRepository perforImemployeeclinicRepository)
{ {
this.perforResaccountRepository = perforResaccountRepository; this.perforResaccountRepository = perforResaccountRepository;
//this._perforResAccountnurseRepository = perforResAccountnurseRepository; //this._perforResAccountnurseRepository = perforResAccountnurseRepository;
...@@ -54,6 +57,7 @@ public class ComputeService : IAutoInjection ...@@ -54,6 +57,7 @@ public class ComputeService : IAutoInjection
this._perforCofincomeRepository = perforCofincomeRepository; this._perforCofincomeRepository = perforCofincomeRepository;
this._perforAgsecondallotRepository = perforAgsecondallotRepository; this._perforAgsecondallotRepository = perforAgsecondallotRepository;
this._perforAgcomputeRepository = perforAgcomputeRepository; this._perforAgcomputeRepository = perforAgcomputeRepository;
this._perforImemployeeclinicRepository = perforImemployeeclinicRepository;
} }
/// <summary> /// <summary>
...@@ -70,12 +74,69 @@ public List<ResComputeResponse> GetCompute(int allotId, int type) ...@@ -70,12 +74,69 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
if (!items.Any(t => t.Value == type)) if (!items.Any(t => t.Value == type))
throw new PerformanceException("参数错误,type无效"); throw new PerformanceException("参数错误,type无效");
var conpute = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == items.FirstOrDefault(p => p.Value == type).Name) Dictionary<int, List<string>> pairs = new Dictionary<int, List<string>>
?.OrderByDescending(t => t.RealGiveFee).ThenBy(t => t.FitPeople).ThenBy(t => t.AccountingUnit).ToList(); {
{ (int)AccountUnitType.科主任, new List<string>{ UnitType.医生组.ToString(), UnitType.医技组.ToString() } },
{ (int)AccountUnitType.护士长, new List<string>{ UnitType.护理组.ToString() } },
{ (int)AccountUnitType.Null, new List<string>{ UnitType.特殊核算组.ToString(), UnitType.其他.ToString() } },
};
if (pairs.Keys.Any(t => t == type))
{
var employees = _perforImemployeeclinicRepository.GetEntities(t => t.AllotID == allotId && pairs[type].Contains(t.UnitType));
if (employees == null || !employees.Any()) return new List<ResComputeResponse>();
var computes = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId);
if (computes == null || !computes.Any()) return new List<ResComputeResponse>();
data = Mapper.Map<List<ResComputeResponse>>(conpute); var joinData = employees.Join(computes, outer => new { outer.AccountingUnit, EmployeeName = outer.DoctorName },
data?.ForEach(t => t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd")); inner => new { inner.AccountingUnit, inner.EmployeeName }, (outer, inner) => inner).ToList();
return data?.OrderByDescending(t => t.AccountingUnit).ToList(); if (joinData == null || !joinData.Any()) return new List<ResComputeResponse>();
if (type != (int)AccountUnitType.Null)
{
var accountUnit = computes.Where(t => t.AccountType == ((AccountUnitType)type).ToString() && joinData.Select(join => join.EmployeeName).Contains(t.EmployeeName));
if (accountUnit != null && accountUnit.Any())
{
accountUnit.ToList().ForEach(t =>
{
var compute = joinData.First(join => join.EmployeeName == t.EmployeeName);
if (compute.AccountingUnit != t.AccountingUnit)
joinData.Add(t);
});
}
}
else
{
var accountUnit = computes.Where(t => joinData.Select(join => join.EmployeeName).Contains(t.EmployeeName));
if (accountUnit != null && accountUnit.Any())
{
var delData = new List<res_compute>();
foreach (var item in joinData)
{
accountUnit.Where(join => join.EmployeeName == item.EmployeeName).ToList().ForEach(t =>
{
if (item.AccountType == t.AccountType && item.AccountingUnit != t.AccountingUnit)
delData.Add(item);
});
}
if (delData.Count > 0)
joinData.RemoveAll(t => delData.Select(d => d.ID).Contains(t.ID));
}
}
data = Mapper.Map<List<ResComputeResponse>>(joinData);
data?.ForEach(t => t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd"));
return data?.OrderByDescending(t => t.AccountingUnit).ToList();
}
else
{
var compute = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == items.FirstOrDefault(p => p.Value == type).Name)
?.OrderByDescending(t => t.RealGiveFee).ThenBy(t => t.FitPeople).ThenBy(t => t.AccountingUnit).ToList();
data = Mapper.Map<List<ResComputeResponse>>(compute);
data?.ForEach(t => t.WorkTime = string.IsNullOrEmpty(t.WorkTime) ? null : Convert.ToDateTime(t.WorkTime).ToString("yyyy-MM-dd"));
return data?.OrderByDescending(t => t.AccountingUnit).ToList();
}
} }
/// <summary> /// <summary>
......
...@@ -42,7 +42,7 @@ public override Task OnDisconnectedAsync(Exception exception) ...@@ -42,7 +42,7 @@ public override Task OnDisconnectedAsync(Exception exception)
//1 查询用户分组信息 //1 查询用户分组信息
var groupName = ""; var groupName = "";
//2 删除数据库中用户分组数据 //2 删除数据库中用户分组数据
if (cache.TryGetValue(key, out groupName)) if (cache.TryGetValue(key, out string value))
{ {
cache.Remove(key); cache.Remove(key);
} }
...@@ -57,7 +57,7 @@ public override Task OnDisconnectedAsync(Exception exception) ...@@ -57,7 +57,7 @@ public override Task OnDisconnectedAsync(Exception exception)
{ {
var connectionId = Context.ConnectionId; var connectionId = Context.ConnectionId;
string key = $"AllotLogGroup_{connectionId}"; string key = $"AllotLogGroup_{connectionId}";
if (cache.TryGetValue(key, out groupName)) if (cache.TryGetValue(key, out string value))
{ {
cache.Remove(key); cache.Remove(key);
} }
......
...@@ -364,16 +364,19 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a ...@@ -364,16 +364,19 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a
Grant = empolyee.Management, Grant = empolyee.Management,
ManagerNumber = resAccount.ManagerNumber, ManagerNumber = resAccount.ManagerNumber,
MedicalNumber = resAccount.Number, MedicalNumber = resAccount.Number,
PermanentStaff = resAccount.PermanentStaff PermanentStaff = resAccount.PermanentStaff,
Attendance = empolyee.Attendance
}; };
//应发管理绩效 //应发管理绩效
compute.ShouldGiveFee = (compute.Efficiency + compute.Scale) * (empolyee.Management ?? 0); compute.ShouldGiveFee = (compute.Efficiency + compute.Scale) * (empolyee.Management ?? 0);
//绩效合计 //绩效合计
compute.PerforSumFee = (compute.Avg * (empolyee.Basics ?? 0)) + compute.ShouldGiveFee; compute.PerforSumFee = (compute.Avg * (empolyee.Basics ?? 0)) + compute.ShouldGiveFee;
//应发绩效 //应发绩效
compute.GiveFee = compute.PerforSumFee; //compute.GiveFee = compute.PerforSumFee;
compute.GiveFee = compute.PerforSumFee * compute.ScoreAverageRate * (compute.Attendance ?? 0) + (compute.Punishment ?? 0) + (compute.OtherPerfor ?? 0);
//实发绩效 //实发绩效
compute.RealGiveFee = (compute.GiveFee * compute.ScoreAverageRate + (compute.Punishment ?? 0) + (compute.OtherPerfor ?? 0)) * (compute.Adjust ?? 1m); //compute.RealGiveFee = (compute.GiveFee * compute.ScoreAverageRate * (compute.Attendance ?? 0) + (compute.Punishment ?? 0) + (compute.OtherPerfor ?? 0)) * (compute.Adjust ?? 1m);
compute.RealGiveFee = compute.GiveFee * (compute.Adjust ?? 1m);
// 参考基数专用绩效合计 // 参考基数专用绩效合计
compute.BaiscNormPerforTotal = compute.RealGiveFee; compute.BaiscNormPerforTotal = compute.RealGiveFee;
......
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