Commit 4c41cfe9 by lcx

二次绩效管理绩效

parent 86776b8d
......@@ -52,17 +52,20 @@ public void ConfigureServices(IServiceCollection services)
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
#region appsetting注入
services
.Configure<AppConnection>(Configuration.GetSection("AppConnection"))
.Configure<Application>(Configuration.GetSection("Application"))
.Configure<HuyiSmsConfig>(Configuration.GetSection("HuyiSmsConfig"))
.Configure<EmailOptions>(Configuration.GetSection("EmailOptions"))
.Configure<WebapiUrl>(Configuration.GetSection("WebapiUrl"));
#endregion
#endregion appsetting注入
var connection = services.BuildServiceProvider().GetService<IOptions<AppConnection>>();
#region json & fluentvalidation & filter
services
//筛选器配置
.AddMvc(option =>
......@@ -97,19 +100,23 @@ public void ConfigureServices(IServiceCollection services)
fv.RegisterValidatorsFromAssemblyContaining(type.GetType());
}
});
#endregion
#endregion json & fluentvalidation & filter
#region automapper
Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
services.AddAutoMapper();
#endregion
#endregion automapper
#region service注入 repoitory注入
services
.AddPerformanceService()
.AddPerformanceRepoitory();
#endregion
#endregion service注入 repoitory注入
#region custom util
......@@ -118,7 +125,7 @@ public void ConfigureServices(IServiceCollection services)
//用户身份信息服务
services.AddScoped<ClaimService>();
#endregion
#endregion custom util
#region email
......@@ -132,22 +139,26 @@ public void ConfigureServices(IServiceCollection services)
options.SmtpServer = emailOption.Value.SmtpServer;
});
#endregion
#endregion email
#region redis
//var csredis = new CSRedis.CSRedisClient(connection.Value.RedisConnectionString);
//RedisHelper.Initialization(csredis);
#endregion
#endregion redis
services.AddMemoryCache();
#region hangfire
services.AddHangfire(config =>
{
config.UseFilter(new AutomaticRetryAttribute { Attempts = 0 });
config.UseStorage(new MySqlStorage(connection.Value.HangfireConnectionString));
});
#endregion
//services.AddHangfire(config =>
//{
// config.UseFilter(new AutomaticRetryAttribute { Attempts = 0 });
// config.UseStorage(new MySqlStorage(connection.Value.HangfireConnectionString));
//});
#endregion hangfire
services.AddSignalR();
services.AddCors(options =>
......@@ -158,15 +169,17 @@ public void ConfigureServices(IServiceCollection services)
});
});
#region //ef配置
services.AddDbContext<PerformanceDbContext>(options =>
{
options.UseMySQL(connection.Value.PerformanceConnectionString);
});
#endregion
#endregion //ef配置
#region swagger
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Version = "v1.0", Title = "绩效API接口" });
......@@ -196,10 +209,10 @@ public void ConfigureServices(IServiceCollection services)
In = "HEADER"
});
#endregion
#endregion Token绑定到ConfigureServices
});
#endregion
#endregion swagger
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......@@ -216,6 +229,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
}
#region Swagger
app.UseSwagger();
app.UseSwaggerUI(c =>
{
......@@ -223,14 +237,15 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
//c.SwaggerEndpoint("/swagger/v1/swagger.json", "v1.0");
c.RoutePrefix = "";
});
#endregion
#endregion Swagger
#region hangfire
app.UseHangfireServer();
app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } });
//app.UseHangfireServer();
//app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } });
#endregion
#endregion hangfire
app.UseCors("SignalrCore");
app.UseSignalR(routes => routes.MapHub<AllotLogHub>("/performance/allotLogHub"));
......@@ -250,5 +265,6 @@ public bool Authorize(Hangfire.Dashboard.DashboardContext context)
return true;
}
}
#endregion
#endregion hangfire 权限
}
\ No newline at end of file
......@@ -110,7 +110,6 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
var apramounts = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == 3);
if (pairs.Keys.Any(t => t == type))
{
#region MyRegion
//var employees = _perforImemployeeclinicRepository.GetEntities(t => t.AllotID == allotId && pairs[type].Contains(t.UnitType));
......@@ -160,7 +159,7 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
//data = Mapper.Map<List<ResComputeResponse>>(joinData);
#endregion
#endregion MyRegion
var employees = _perforImemployeeclinicRepository.GetEntities(t => t.AllotID == allotId && pairs[type].Contains(t.UnitType));
if (employees == null || !employees.Any()) return new List<ResComputeResponse>();
......@@ -168,7 +167,6 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
var computes = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && pairs[type].Contains(t.UnitType));
if (computes == null || !computes.Any()) return new List<ResComputeResponse>();
data = Mapper.Map<List<ResComputeResponse>>(computes);
data.ForEach(t =>
......@@ -378,7 +376,6 @@ public DeptDetailResponse GetDepartmentDetail(int allotId, string department, in
return null;
}
/// <summary>
/// 返回科室详情
/// </summary>
......@@ -573,7 +570,7 @@ private List<ComputeResponse> GetSecondPerformance(int allotId)
/// </summary>
/// <param name="allotId"></param>
/// <param name="computes"></param>
private List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> computes)
public List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> computes)
{
if (computes == null || !computes.Any())
return computes;
......@@ -602,7 +599,6 @@ private List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> co
//}
}
return computes;
}
......@@ -667,7 +663,8 @@ private List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> co
// }
// return result;
//}
#endregion
#endregion 绩效发放列表
public res_compute GetComputeSingle(int computeid)
{
......@@ -728,7 +725,6 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == account.AllotID);
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == account.AllotID && t.AccountingUnit == account.AccountingUnit);
DeptDataDetails deptDetails = new DeptDataDetails
{
ShowFormula = allot.ShowFormula,
......@@ -896,7 +892,6 @@ private List<DetailModule> CommonDetailItems(List<im_data> basicData, List<im_he
return dto;
}).ToList();
}
var headerData = headers?.Where(t => t.SheetID == sheet.ID);
if (headerData != null && headerData.Any())
......@@ -1003,6 +998,7 @@ private UnitType TypeConversion(int? unitType)
type = UnitType.护理组;
return type;
}
public DeptDataDetails DeptOfficeDetail(int accountId)
{
var account = perforResaccountRepository.GetEntity(t => t.ID == accountId);
......@@ -1076,7 +1072,6 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
return deptDetails;
}
public DeptDataDetails SpecialDeptDetail(ag_secondallot second)
{
var allot = perforPerallotRepository.GetEntity(t => t.ID == second.AllotId);
......
......@@ -86,6 +86,7 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee
var row = sheet.GetRow(i);
if (row != null)
{
row.ZeroHeight = false; //取消隐藏行
int dataFirstCellRowNum = point.DataFirstCellNum.Value;
//跳过核算单元和科室
for (int j = dataFirstCellRowNum; j < row.LastCellNum; j++)
......
......@@ -37,7 +37,10 @@ public class SecondAllotService : IAutoInjection
private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforResspecialunitRepository resspecialunitRepository;
private readonly PersonService personService;
private readonly ComputeService computeService;
private readonly PerforRescomputeRepository rescomputeRepository;
private readonly PerforPeremployeeRepository peremployeeRepository;
private readonly PerforImemployeeclinicRepository imemployeeclinicRepository;
private readonly List<ag_tempitem> tempitems = new List<ag_tempitem>();
public SecondAllotService(IOptions<Application> application,
......@@ -61,7 +64,10 @@ public class SecondAllotService : IAutoInjection
PerforPerapramountRepository perapramountRepository,
PerforResspecialunitRepository resspecialunitRepository,
PersonService personService,
PerforRescomputeRepository rescomputeRepository)
ComputeService computeService,
PerforRescomputeRepository rescomputeRepository,
PerforPeremployeeRepository peremployeeRepository,
PerforImemployeeclinicRepository imemployeeclinicRepository)
{
this.application = application.Value;
this.hospitalRepository = hospitalRepository;
......@@ -84,7 +90,10 @@ public class SecondAllotService : IAutoInjection
this.perapramountRepository = perapramountRepository;
this.resspecialunitRepository = resspecialunitRepository;
this.personService = personService;
this.computeService = computeService;
this.rescomputeRepository = rescomputeRepository;
this.peremployeeRepository = peremployeeRepository;
this.imemployeeclinicRepository = imemployeeclinicRepository;
this.tempitems = perforAgtempitemRepository.GetEntities();
}
......@@ -1721,9 +1730,11 @@ public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId)
if (user == null)
throw new NotImplementedException("人员ID无效");
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
var isShowManage = computeService.IsShowManage(allotId);
var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
Dictionary<int, string> dict = new Dictionary<int, string>
{
{ application.DirectorRole, AccountUnitType.科主任.ToString() },
......@@ -1733,10 +1744,78 @@ public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId)
if (!dict.Keys.Contains(role.Type.Value)) return new List<SecondPerforResponse>();
var data = rescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == user.Department && t.AccountType == dict[role.Type.Value]);
if (data == null || !data.Any()) return new List<SecondPerforResponse>();
var computes = rescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == user.Department && t.AccountType == dict[role.Type.Value]);
if (computes == null || !computes.Any()) return new List<SecondPerforResponse>();
var data = GetAllotPerformance(allotId, computes, isShowManage);
// 补充医院其他绩效
var result = computeService.AddAprAmount(allotId, data);
// 预留比例
if (result != null)
{
var empDic = peremployeeRepository.GetEntities(w => w.AllotId == allotId);
foreach (var item in result)
{
var perfor = ((item.GiveFee ?? 0) != 0 ? item.GiveFee : item.PerforSumFee) ?? 0;
item.PerforSumFee = Math.Round(item.PerforSumFee ?? 0, 0, MidpointRounding.AwayFromZero);
item.PerforManagementFee = Math.Round(item.PerforManagementFee ?? 0, 0, MidpointRounding.AwayFromZero);
item.GiveFee = Math.Round(perfor, 0, MidpointRounding.AwayFromZero);
item.AdjustLaterOtherFee = Math.Round(item.AdjustLaterOtherFee ?? 0, 0, MidpointRounding.AwayFromZero);
item.OthePerfor = Math.Round(item.OthePerfor ?? 0, 0, MidpointRounding.AwayFromZero);
item.NightWorkPerfor = Math.Round(item.NightWorkPerfor ?? 0, 0, MidpointRounding.AwayFromZero);
item.ShouldGiveFee = Math.Round((perfor + item.AdjustLaterOtherFee + item.NightWorkPerfor) ?? 0, 0, MidpointRounding.AwayFromZero);
item.RealGiveFee = Math.Round((perfor + item.AdjustLaterOtherFee + item.NightWorkPerfor) ?? 0, 0, MidpointRounding.AwayFromZero);
}
}
return Mapper.Map<List<SecondPerforResponse>>(computes);
}
/// <summary>
/// 获取一次次绩效结果
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
private List<ComputeResponse> GetAllotPerformance(int allotId, List<res_compute> computes, int isShowManage)
{
if (computes == null || !computes.Any()) return new List<ComputeResponse>();
return Mapper.Map<List<SecondPerforResponse>>(data);
var types1 = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
var types2 = new List<string> { AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
// 业务中层人员信息
var empolyeeList = imemployeeclinicRepository.GetEntities(t => t.AllotID == allotId);
return computes.Select(t =>
{
var comp = new ComputeResponse("一次绩效", t.AccountingUnit, t.EmployeeName, t.JobNumber, t.JobTitle);
comp.UnitType = t.AccountType;
if (types1.Contains(t.AccountType))
comp.PerforManagementFee = ((t.Efficiency + t.Scale) * t.Grant + t.OtherManagePerfor) * t.Attendance * t.ScoreAverageRate;
else
comp.PerforManagementFee = t.RealGiveFee;
// 行政中层 行政高层 补充 夜班费
if (types2.Contains(t.AccountType))
comp.NightWorkPerfor = t.NightWorkPerfor;
// 获取科主任系数,解决共用科主任重复计算人均问题
var basics = empolyeeList?.FirstOrDefault(w => w.AccountingUnit == t.AccountingUnit && w.DoctorName == t.EmployeeName && w.PersonnelNumber == t.JobNumber)?.Basics;
// 仅显示管理绩效
if (isShowManage == 2)
comp.PerforSumFee = 0;
else
comp.PerforSumFee = Math.Round((t.Avg * (basics ?? 1)) + t.ShouldGiveFee + t.AssessBeforeOtherFee ?? 0);
comp.Punishment = t.Punishment;
comp.ShouldGiveFee = t.ShouldGiveFee;
comp.PerforSumFee = t.PerforSumFee;
comp.GiveFee = t.GiveFee * t.Adjust;
comp.AdjustLaterOtherFee = t.AdjustLaterOtherFee ?? 0;
comp.OthePerfor = t.OtherPerfor;
comp.RealGiveFee = t.RealGiveFee;
return comp;
}).ToList();
}
}
}
\ No newline at end of file
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