Commit 64e5c64a by 钟博

Merge branch 'v20201230yubei' into v2020morge

# Conflicts:
#	performance/Performance.Api/appsettings.Localhost.json
#	performance/Performance.DtoModels/HandsonTable.cs
#	performance/Performance.Services/ComputeService.cs
#	performance/Performance.Services/ConfigService.cs
#	performance/Performance.Services/Details/SecondAllotDetails.cs
#	performance/Performance.Services/EmployeeService.cs
#	performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
parents 19e7f588 4ecb8474
......@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Performance.Api.Controllers
......@@ -300,8 +301,21 @@ public ApiResponse AllComputeByPM([FromBody] ComputerRequest request)
OthePerfor = t.Sum(s => s.OthePerfor),
NightWorkPerfor = t.Sum(s => s.NightWorkPerfor),
RealGiveFee = t.Sum(s => s.RealGiveFee),
//ReservedRatio = t.Sum(s => s.ReservedRatio),
//ReservedRatioFee = t.Sum(s => s.ReservedRatioFee),
ReservedRatio = t.Sum(s => s.ReservedRatio),
ReservedRatioFee = t.Sum(s => s.ReservedRatioFee),
}).OrderBy(t =>
{
string value = t.JobNumber;
switch (value)
{
case string val when string.IsNullOrEmpty(val):
break;
case string val when Regex.IsMatch(val, @"^[+-]?\d*$"):
value = value.PadLeft(20, '0');
break;
}
return value;
});
return new ApiResponse(ResponseType.OK, "ok", result);
}
......
......@@ -7,8 +7,13 @@
}
},
"AppConnection": {
<<<<<<< HEAD
"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_yubei;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=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_yubei;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;",
>>>>>>> v20201230yubei
"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"
},
......
......@@ -536,6 +536,11 @@
夜班费
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeEmployee.NeedSecondAllot">
<summary>
是否需要二次分配
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResult.AccountType">
<summary>
科室类别(例如 医技科室 临床科室 其他科室)
......@@ -706,6 +711,11 @@
夜班费
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResult.NeedSecondAllot">
<summary>
是否需要二次分配
</summary>
</member>
<member name="T:Performance.DtoModels.UnitType">
<summary> 核算单元类型 </summary>
</member>
......@@ -1089,6 +1099,11 @@
实发绩效
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataAccountBaisc.NeedSecondAllot">
<summary>
是否需要二次分配
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataClinicEmployee.UnitType">
<summary>
核算单元分类
......@@ -1354,6 +1369,11 @@
调节后其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataLogisticsEmployee.NeedSecondAllot">
<summary>
是否需要二次分配
</summary>
</member>
<member name="P:Performance.DtoModels.PerDataLogisticsEmployee.RowNumber">
<summary>
行号
......@@ -2056,11 +2076,6 @@
是否开启科室CMI占比 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.DtoModels.HospitalRequest.IsOpenLogisticsSecondAllot">
<summary>
是否开启行政后勤二次绩效分配 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.DtoModels.IncomeRequest.SheetNameKeyword">
<summary>
关键字匹配
......
......@@ -717,14 +717,14 @@
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.Id">
<summary>
<summary>
</summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.SecondId">
<summary>
<summary>
</summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.WorkNumber">
<summary>
......@@ -758,7 +758,7 @@
</member>
<member name="P:Performance.EntityModels.ag_othersource.DeptReward">
<summary>
科室单项奖励
科室单项奖励(只读)
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.DistPerformance">
......@@ -791,6 +791,21 @@
预留金额
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.ManagementAllowance">
<summary>
管理津贴
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.IndividualReward">
<summary>
单项奖励
</summary>
</member>
<member name="P:Performance.EntityModels.ag_othersource.AllocationOfKeySpecialty">
<summary>
重点专科分配
</summary>
</member>
<member name="T:Performance.EntityModels.ag_secondallot">
<summary>
二次绩效列表
......@@ -2706,6 +2721,11 @@
调节后其他绩效
</summary>
</member>
<member name="P:Performance.EntityModels.im_employee_logistics.NeedSecondAllot">
<summary>
是否需要二次分配
</summary>
</member>
<member name="T:Performance.EntityModels.im_header">
<summary>
......@@ -4511,6 +4531,11 @@
变更日志
</summary>
</member>
<member name="P:Performance.EntityModels.res_account.NeedSecondAllot">
<summary>
是否需要二次分配
</summary>
</member>
<member name="T:Performance.EntityModels.res_accountdoctor">
<summary>
医生科室核算结果
......@@ -4981,6 +5006,11 @@
调节后其他绩效
</summary>
</member>
<member name="P:Performance.EntityModels.res_compute.NeedSecondAllot">
<summary>
是否需要二次分配 是 否
</summary>
</member>
<member name="T:Performance.EntityModels.res_reserved">
<summary>
......@@ -5386,11 +5416,6 @@
是否显示二次绩效科主任1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenLogisticsSecondAllot">
<summary>
是否开启行政后勤二次绩效分配 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsSingleProject">
<summary>
抽取项目是否在同一环境 1 是 2 否
......
......@@ -124,7 +124,7 @@ public HandsonColumn(string data, bool readOnly = false, DataFormat format = Dat
public bool ReadOnly { get; set; }
public string Type { get; set; }
public string[] Source { get; set; }
public bool Strict { get; set; } = false;
public NumericFormat NumericFormat { get; set; }
}
......
......@@ -160,5 +160,10 @@ public class ComputeEmployee
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary>
/// 是否需要二次分配
/// </summary>
public string NeedSecondAllot { get; set; }
}
}
......@@ -198,5 +198,10 @@ public class ComputeResult
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
/// <summary>
/// 是否需要二次分配
/// </summary>
public string NeedSecondAllot { get; set; }
}
}
......@@ -232,6 +232,11 @@ public class PerDataAccountBaisc : IPerData
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
/// <summary>
/// 是否需要二次分配
/// </summary>
public string NeedSecondAllot { get; set; }
#endregion 由计算得出
}
}
......@@ -67,6 +67,11 @@ public class PerDataLogisticsEmployee : IPerData
public Nullable<decimal> AdjustLaterOtherFee { get; set; }
/// <summary>
/// 是否需要二次分配
/// </summary>
public string NeedSecondAllot { get; set; }
/// <summary>
/// 行号
/// </summary>
public int RowNumber { get; set; }
......
......@@ -60,10 +60,10 @@ public class HospitalRequest
/// </summary>
public Nullable<int> IsOpenCMIPercent { get; set; }
/// <summary>
/// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
///// <summary>
///// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
}
public class HospitalRequestValidator : AbstractValidator<HospitalRequest>
......
//-----------------------------------------------------------------------
// <copyright file=" ag_othersource.cs">
// * FileName: 二次绩效其他绩效来源.cs
// * FileName: 二次绩效其他绩效来源.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
namespace Performance.EntityModels
{
/// <summary>
/// 二次绩效其他绩效来源
/// </summary>
[Table("ag_othersource")]
public class ag_othersource
public class ag_othersource
{
/// <summary>
///
///
/// </summary>
[Key]
public int Id { get; set; }
public int Id { get; set; }
/// <summary>
///
///
/// </summary>
public Nullable<int> SecondId { get; set; }
/// <summary>
/// 工号
/// </summary>
public string WorkNumber { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 职称
/// </summary>
public string WorkPost { get; set; }
/// <summary>
/// 职称绩效
/// </summary>
public Nullable<decimal> TitlePerformance { get; set; }
/// <summary>
/// 工作量绩效工资
/// </summary>
public Nullable<decimal> WorkPerformance { get; set; }
/// <summary>
/// 科室单项奖励
/// 科室单项奖励(只读)
/// </summary>
public Nullable<decimal> DeptReward { get; set; }
/// <summary>
/// 可分配绩效
/// </summary>
public Nullable<decimal> DistPerformance { get; set; }
/// <summary>
/// 医院其他绩效
/// </summary>
public Nullable<decimal> OtherPerformance { get; set; }
/// <summary>
/// 夜班工作量绩效
/// </summary>
public Nullable<decimal> NightWorkPerformance { get; set; }
/// <summary>
/// 实发绩效工资金额
/// </summary>
......@@ -90,5 +90,20 @@ public class ag_othersource
/// 预留金额
/// </summary>
public Nullable<decimal> ReservedAmount { get; set; }
/// <summary>
/// 管理津贴
/// </summary>
public Nullable<decimal> ManagementAllowance { get; set; }
/// <summary>
/// 单项奖励
/// </summary>
public Nullable<decimal> IndividualReward { get; set; }
/// <summary>
/// 重点专科分配
/// </summary>
public Nullable<decimal> AllocationOfKeySpecialty { get; set; }
}
}
......@@ -153,5 +153,10 @@ public class im_employee_logistics
/// 调节后其他绩效
/// </summary>
public Nullable<decimal> AdjustLaterOtherFee { get; set; }
/// <summary>
/// 是否需要二次分配
/// </summary>
public string NeedSecondAllot { get; set; }
}
}
......@@ -187,5 +187,10 @@ public class res_account
/// 变更日志
/// </summary>
public string ChangeLog { get; set; }
/// <summary>
/// 是否需要二次分配
/// </summary>
public string NeedSecondAllot { get; set; }
}
}
......@@ -223,5 +223,9 @@ public class res_compute
/// 调节后其他绩效
/// </summary>
public Nullable<decimal> AdjustLaterOtherFee { get; set; }
/// <summary>
/// 是否需要二次分配 是 否
/// </summary>
public string NeedSecondAllot { get; set; }
}
}
......@@ -101,10 +101,10 @@ public class sys_hospital
/// </summary>
public Nullable<int> IsShowSecondDirector { get; set; }
/// <summary>
/// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
///// <summary>
///// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
/// <summary>
/// 抽取项目是否在同一环境 1 是 2 否
......
......@@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<UserSecretsId>3af57781-f816-4c0e-ab66-9b69387e7d35</UserSecretsId>
</PropertyGroup>
<ItemGroup>
......
......@@ -14,6 +14,8 @@
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>a7ae6d0f-7b11-4eef-9fea-a279001ea54d</ProjectGuid>
<publishUrl>bin\Release\netcoreapp2.2\publish\</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<DeleteExistingFiles>True</DeleteExistingFiles>
<TargetFramework>netcoreapp2.2</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -377,6 +377,7 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
dept.AdjustFactor = (isBudget ? adjust : resAccount?.AdjustFactor) ?? 1;
dept.Income = empolyees.Sum(w => w.PerforTotal ?? 0);
dept.NeedSecondAllot = empolyees.Any(w => w.NeedSecondAllot == "是") ? "是" : "否";
//dept.Extra = (extra ?? 0);
//dept.MedicineExtra = 0;// (drugExtra ?? 0);
//dept.MaterialsExtra = 0;//(materialsExtra ?? 0);
......
......@@ -514,13 +514,18 @@ public void GenerateSecondAllot(per_allot allot)
List<ag_secondallot> insSecond = new List<ag_secondallot>();
List<ag_secondallot> updSecond = new List<ag_secondallot>();
var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层 };
// 获取医院是否开启后勤二次分配
var hospital = hospitalRepository.GetEntity(w => w.ID == allot.HospitalId);
if (hospital?.IsOpenLogisticsSecondAllot != 1)
types.Add((int)UnitType.行政后勤);
var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 };
//// 获取医院是否开启后勤二次分配
//var hospital = hospitalRepository.GetEntity(w => w.ID == allot.HospitalId);
//if (hospital?.IsOpenLogisticsSecondAllot != 1)
// types.Add((int)UnitType.行政后勤);
var accountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && !types.Contains(t.UnitType.Value));
// 查询需要进行二次分配的行政后勤科室
var xzAccountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && t.UnitType.Value == (int)UnitType.行政后勤 && t.NeedSecondAllot == "是");
if (xzAccountUnit != null && xzAccountUnit.Count > 0)
(accountUnit ?? new List<res_account>()).AddRange(xzAccountUnit);
var specialList = perforResspecialunitRepository.GetEntities(t => t.AllotID == allot.ID);
if (accountUnit != null)
......
......@@ -188,6 +188,8 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
else
{
var compute = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == items.FirstOrDefault(p => p.Value == type).Name);
if (type == (int)AccountUnitType.行政工勤)
compute = compute?.Where(w => w.NeedSecondAllot == "否")?.ToList();
if (compute == null || !compute.Any()) return new List<ResComputeResponse>();
......@@ -292,7 +294,7 @@ public List<DeptResponse> GetOfficePerformance(int allotId)
{
var unitType = new List<int> { (int)UnitType.行政后勤 };
var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId)
var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId && t.NeedSecondAllot == "是")
?.OrderBy(t => t.UnitType)
.ThenByDescending(t => t.AccountingUnit);
List<DeptResponse> other = Mapper.Map<List<DeptResponse>>(list);
......@@ -321,6 +323,32 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
result = result.OrderBy(t => t.UnitType).ThenBy(t => t.AccountingUnit).ToList();
}
var specialData = _perforResspecialunitRepository.GetEntities(t => t.AllotID == allotId);
if (specialData != null && specialData.Any())
{
result.AddRange(specialData.Select(t => new DeptResponse
{
UnitName = "特殊核算组",
AccountingUnit = t.AccountingUnit,
Department = t.Department,
PerforFee = t.GiveFee,
WorkloadFee = 0,
AssessBeforeOtherFee = t.AssessBeforeOtherFee,
PerforTotal = t.PerforTotal,
ScoringAverage = t.ScoringAverage,
MedicineExtra = t.MedicineExtra,
MaterialsExtra = t.MaterialsExtra,
Extra = 0,
AssessLaterOtherFee = t.AssessLaterOtherFee,
AssessLaterPerforTotal = Math.Round(((t.PerforTotal * t.ScoringAverage) ?? 0) + (t.MedicineExtra ?? 0) + (t.MaterialsExtra ?? 0) + (t.AssessLaterOtherFee ?? 0)),
AdjustFactor = t.Adjust,
AdjustLaterOtherFee = t.AdjustLaterOtherFee,
AssessLaterManagementFee = 0,
AprPerforAmount = 0,
RealGiveFee = t.RealGiveFee,
}));
}
var list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId);
if (list == null || !list.Any()) return result;
......@@ -334,20 +362,24 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
{ AccountUnitType.行政中层.ToString(), AccountUnitType.行政中层.ToString() },
{ AccountUnitType.行政工勤.ToString(), AccountUnitType.行政工勤.ToString() }
};
var doctors = new string[] { "医生组", "护理组", "医技组" };
List<DeptResponse> adminPerfor = list.GroupBy(t => new { t.AccountingUnit, t.AccountType }).Select(t =>
{
string unitName = result.Where(w => !dict.Values.Contains(w.UnitName)).FirstOrDefault(w => w.AccountingUnit == t.Key.AccountingUnit)?.UnitName ?? "";
return new DeptResponse
var data = new DeptResponse
{
UnitName = !dict.Values.Contains(unitName) && !string.IsNullOrEmpty(unitName) ? unitName : dict.ContainsKey(t.Key.AccountType) ? dict[t.Key.AccountType] : "未知",
AccountingUnit = t.Key.AccountingUnit,
Department = t.Key.AccountingUnit,
Number = t.Count(),
// OtherPerfor1 = t.Sum(group => group.OtherPerfor),
AssessLaterManagementFee = isShowManage == 1 ? t.Sum(group => group.RealGiveFee ?? 0) + t.Sum(group => group.OtherPerfor ?? 0) //实发绩效
: Math.Round((t.Max(m => m.ShouldGiveFee) * t.Max(m => m.ScoreAverageRate) * t.Max(m => m.Attendance) ?? 0.0M) + t.Max(m => m.Punishment ?? 0.0M)) //考核后管理绩效
};
if (doctors.Contains(data.UnitName))
{
data.AssessLaterManagementFee = isShowManage == 1
? t.Sum(group => group.RealGiveFee ?? 0) + t.Sum(group => group.OtherPerfor ?? 0) //实发绩效
: Math.Round((t.Max(m => m.ShouldGiveFee) * t.Max(m => m.ScoreAverageRate) * t.Max(m => m.Attendance) ?? 0.0M) + t.Max(m => m.Punishment ?? 0.0M)); //考核后管理绩效
}
return data;
}).ToList();
result.AddRange(adminPerfor);
......@@ -355,19 +387,22 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
var aprAmounts = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == 3) ?? new List<per_apr_amount>();
var employees = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId) ?? new List<per_employee>();
var otherPerformances = aprAmounts.Join(employees, outer => new { outer.AccountingUnit, outer.PersonnelNumber }, inner => new { inner.AccountingUnit, inner.PersonnelNumber }, (outer, inner) => new
{
AccountingUnit = outer.AccountingUnit,
UnitType = inner.UnitType,
PersonnelNumber = outer.PersonnelNumber,
PersonnelName = inner.DoctorName,
Amount = outer.Amount
})?.GroupBy(t => new { t.AccountingUnit, t.UnitType }).Select(t => new
{
AccountingUnit = t.Key.AccountingUnit,
UnitType = t.Key.UnitType,
Amount = t.Sum(s => s.Amount)
});
var otherPerformances = aprAmounts.Join(employees,
outer => new { outer.AccountingUnit, outer.PersonnelNumber },
inner => new { inner.AccountingUnit, inner.PersonnelNumber },
(outer, inner) => new
{
AccountingUnit = outer.AccountingUnit,
UnitType = inner.UnitType,
PersonnelNumber = inner.PersonnelNumber,
PersonnelName = outer.DoctorName,
Amount = outer.Amount
})?.GroupBy(t => new { t.AccountingUnit, t.UnitType }).Select(t => new
{
AccountingUnit = t.Key.AccountingUnit,
UnitType = t.Key.UnitType,
Amount = t.Sum(s => s.Amount)
});
result = result.GroupBy(t => new { t.AccountingUnit, t.UnitName }).Select(t => new DeptResponse
{
......@@ -381,7 +416,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
MedicineExtra = t.Sum(group => group.MedicineExtra),
Extra = t.Sum(group => group.Extra),
AssessLaterOtherFee = t.Sum(group => group.AssessLaterOtherFee),
AdjustFactor = t.Sum(group => group.AdjustFactor),
AdjustFactor = t.Max(group => group.AdjustFactor),
AdjustLaterOtherFee = t.Sum(group => group.AdjustLaterOtherFee),
PerforTotal = t.Sum(group => group.PerforTotal),
AssessLaterPerforTotal = t.Sum(group => group.AssessLaterPerforTotal),
......@@ -541,15 +576,20 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
/// <returns></returns>
private List<ComputeResponse> GetAllotPerformance(int allotId, int hospitalId, int isShowManage)
{
var mTypes = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
// 获取医院是否开启后勤二次分配
var hospital = hospitalRepository.GetEntity(w => w.ID == hospitalId);
if (hospital?.IsOpenLogisticsSecondAllot != 1)
mTypes.Add(AccountUnitType.行政工勤.ToString());
var mTypes = new List<string>
{
AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(),
AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString(),
AccountUnitType.行政工勤.ToString()
};
//// 获取医院是否开启后勤二次分配
//var hospital = hospitalRepository.GetEntity(w => w.ID == hospitalId);
//if (hospital?.IsOpenLogisticsSecondAllot != 1)
// mTypes.Add(AccountUnitType.行政工勤.ToString());
var types1 = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
var types2 = new List<string> { AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
var types3 = (hospital?.IsOpenLogisticsSecondAllot != 1) ? new List<string> { AccountUnitType.行政工勤.ToString() } : new List<string>();
var types3 = new List<string> { AccountUnitType.行政工勤.ToString() };
//// 业务中层人员信息
//var empolyeeList = _perforImemployeeclinicRepository.GetEntities(t => t.AllotID == allotId);
......@@ -584,7 +624,7 @@ private List<ComputeResponse> GetAllotPerformance(int allotId, int hospitalId, i
comp.PerforSumFee = t.Avg;
}
// 行政工勤
if (types3.Contains(t.AccountType))
if (types3.Contains(t.AccountType) && t.NeedSecondAllot?.Trim() == "是")
{
comp.PerforSumFee = t.GiveFee;
comp.AdjustLaterOtherFee = 0;
......@@ -871,9 +911,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
private decimal? GetFactors(List<per_sheet> persheet, List<im_data> basicData, UnitType type, SheetType sheetType)
{
var sheet = persheet.FirstOrDefault(w => w.SheetType == (int)sheetType);
if (sheet == null)
return null;
return basicData.FirstOrDefault(t => t.SheetID == sheet.ID && t.UnitType == (int)type && t.IsTotal == 1)?.CellValue;
return basicData.FirstOrDefault(t => t.SheetID == sheet?.ID && t.UnitType == (int)type && t.IsTotal == 1)?.CellValue;
}
private (int sheettype, decimal amount) ClinicDepartmentDetail(List<per_sheet> persheet, res_account account, List<im_data> basicData, per_sheet sheet, UnitType type, string sheetName)
......
......@@ -257,7 +257,7 @@ public List<BodyItem> GetEmployeeFromSavedData(int userId, ag_secondallot second
tableFixedDataList.Add(tableFixedData);
}
}
SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList);
SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList, otherShowColumns);
}
return tableFixedDataList;
}
......@@ -293,7 +293,7 @@ public List<BodyItem> GetEmployeeFromEmployeeDict(int userId, ag_secondallot sec
new Tuple<string, string, Func<per_employee, object>>("出勤", "ActualAttendance", (t) => t.AttendanceDay),
new Tuple<string, string, Func<per_employee, object>>("人员系数", "StaffCoefficient", (t) => 1),
new Tuple<string, string, Func<per_employee, object>>("职称", "JobTitle", (t) => t.JobTitle),
new Tuple<string, string, Func<per_employee, object>>("预留比例", "ReservedRatio", (t) => t.ReservedRatio),
new Tuple<string, string, Func<per_employee, object>>("预留年度考核比例", "ReservedRatio", (t) => t.ReservedRatio),
new Tuple<string, string, Func<per_employee, object>>("医院其他绩效", "OtherPerformance", (t) => 0)
};
......@@ -314,7 +314,7 @@ public List<BodyItem> GetEmployeeFromEmployeeDict(int userId, ag_secondallot sec
}
rowNumber++;
}
SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList);
SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList, otherShowColumns);
return tableFixedDataList;
}
......@@ -382,7 +382,7 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA
#endregion 获取人员字典中录入的出勤
}
SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList);
SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList, otherShowColumns);
}
return tableFixedDataList;
}
......@@ -461,11 +461,12 @@ private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> body
/// 补充 医院其他绩效
/// </summary>
/// <param name="result"></param>
private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bodyItems, List<per_employee> employeeList)
private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bodyItems, List<per_employee> employeeList, List<HeadItem> otherShowColumns)
{
if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return;
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == secondAllot.AllotId && t.Status == 3);
if (perapramounts == null || !perapramounts.Any()) return;
var rowNumberList = bodyItems.Where(w => w.RowNumber > -1).Select(w => w.RowNumber).Distinct().OrderBy(t => t).ToList();
foreach (var rownum in rowNumberList)
......@@ -477,14 +478,75 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo
var employee = employeeList.FirstOrDefault(w => w.PersonnelNumber == personnelNumber);
if (employee == null) continue;
var amount = secondAllot.Department == employee.AccountingUnit ? perapramounts
?.Where(w => w.PersonnelNumber?.Trim() == personnelNumber?.Trim())
?.Sum(w => w.Amount) : 0;
var hasAmountData = perapramounts?.Where(w => w.PersonnelNumber?.Trim() == personnelNumber?.Trim());
if (hasAmountData == null || !hasAmountData.Any()) continue;
var amount = secondAllot.Department == employee.AccountingUnit ? hasAmountData.Sum(w => w.Amount) : 0;
perapramounts.RemoveAll(w => w.PersonnelNumber?.Trim() == personnelNumber?.Trim());
var otherPerfor = rowData.FirstOrDefault(w => w.FiledId == "OtherPerformance");
if (otherPerfor != null)
otherPerfor.Value = amount?.ToString();
}
// 补充字典中该科室不存在,但有其它绩效的人员信息
if (perapramounts != null && perapramounts.Any(t => t.AccountingUnit == secondAllot.Department))
{
var groupData = perapramounts.Where(t => t.AccountingUnit == secondAllot.Department).GroupBy(t => t.PersonnelNumber)
.Select(t => new
{
PersonnelNumber = t.Key,
DoctorName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.DoctorName))?.DoctorName,
Amount = t.Sum(w => w.Amount)?.ToString()
});
var lastNumber = rowNumberList.Max() + 1;
var employeeColumns = new List<Tuple<string, string, Func<per_employee, object>>>
{
new Tuple<string, string, Func<per_employee, object>>("人员工号", "PersonnelNumber", (t) => t.PersonnelNumber),
new Tuple<string, string, Func<per_employee, object>>("姓名", "FullName", (t) => t.DoctorName),
new Tuple<string, string, Func<per_employee, object>>(
"岗位", "Post",
(t) => (t.Duty?.IndexOf("主任") > -1 || t.Duty?.IndexOf("护士长") > -1) ? "科主任/护士长" : "其他"),
new Tuple<string, string, Func<per_employee, object>>("出勤", "ActualAttendance", (t) => t.AttendanceDay),
new Tuple<string, string, Func<per_employee, object>>("人员系数", "StaffCoefficient", (t) => 1),
new Tuple<string, string, Func<per_employee, object>>("职称", "JobTitle", (t) => t.JobTitle),
new Tuple<string, string, Func<per_employee, object>>("预留年度考核比例", "ReservedRatio", (t) => t.ReservedRatio),
new Tuple<string, string, Func<per_employee, object>>("医院其他绩效", "OtherPerformance", (t) => 0)
};
var specialColumns = new string[] { "FullName", "OtherPerformance" };
foreach (var item in groupData)
{
foreach (var column in employeeColumns)
{
if (employeeList.Any(t => t.PersonnelNumber == item.PersonnelNumber)
&& employeeList.FirstOrDefault(t => t.PersonnelNumber == item.PersonnelNumber) is per_employee employee
&& employee.UnitType == secondAllot.UnitType)
{
var headItem = otherShowColumns.FirstOrDefault(w => w.FiledName == column.Item1 && w.FiledId == column.Item2 && w.Type == (int)TempColumnType.TableFixedColumns);
if (headItem == null) continue;
var data = new BodyItem(headItem);
data.RowNumber = lastNumber;
if (specialColumns.Contains(column.Item2))
{
data.Value = column.Item2 == "OtherPerformance" ? item.Amount : item.DoctorName;
}
else
{
var value = column.Item3.Invoke(employee);
data.Value = value?.ToString();
}
bodyItems.Add(data);
}
}
lastNumber++;
}
}
}
/// <summary>
......@@ -577,9 +639,10 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
var secondAllot = agsecondallotRepository.GetEntity(t => t.Id == secondId);
var readColumns = new int[] { 2, 3, }.Contains(secondAllot.Status.Value)
? OtherTemp.Select(t => t.Value).ToArray()
: new string[] { "可分配绩效", "医院其他绩效", "预留比例", "预留金额", "实发绩效工资金额" };
var readColumns = new int[] { 2, 3, }.Contains(secondAllot.Status.Value) ?
OtherTemp.Select(t => t.Value).ToArray() :
new string[] { "可分配绩效", "科室单项奖励", "医院其他绩效", "预留年度考核比例", "年度考核发放金额", "预发绩效工资金额" };
var result = new HandsonTable((int)SheetType.Unidentifiable, OtherTemp.Select(t => t.Value).ToArray(), OtherTemp.Select(t => new collect_permission
{
......@@ -615,9 +678,8 @@ public HandsonTable GetOtherTempData(int userId, int secondId, int isArchive, in
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in OtherTemp
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
var cells = (from conf in OtherTemp join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() select new HandsonCellData(conf.Value, fst.Value)).ToList();
cells.Add(new HandsonCellData(nameof(ag_othersource.Id), item.Id));
rowDatas.Add(new HandsonRowData(i, cells));
......@@ -751,34 +813,89 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
if (second.UnitType == UnitType.行政后勤.ToString())
{
item.OtherPerformance = perapramounts?.Where(w => w.AccountingUnit == item.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim())?.Sum(w => w.Amount);
if (string.IsNullOrEmpty(item.WorkNumber))
item.OtherPerformance = perapramounts?.Where(w => w.AccountingUnit == item.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.Trim())?.Sum(w => w.Amount);
{
var hasAmountData = perapramounts?.Where(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.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());
}
else
{
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());
}
}
else if (!string.IsNullOrEmpty(empl?.AccountingUnit))
{
item.OtherPerformance = perapramounts?.Where(w => w.AccountingUnit == empl?.AccountingUnit && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim())?.Sum(w => w.Amount);
if (string.IsNullOrEmpty(item.WorkNumber))
item.OtherPerformance = perapramounts?.Where(w => w.AccountingUnit == empl?.AccountingUnit && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.Trim())?.Sum(w => w.Amount);
{
var hasAmountData = perapramounts?.Where(w => w.AccountingUnit == second.Department && w.PersonnelNumber?.Trim() == item.WorkNumber?.Trim() && w.DoctorName?.Trim() == item.Name?.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());
}
else
{
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());
}
}
}
// 补充字典中该科室不存在,但有其它绩效的人员信息
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 ag_othersource
{
SecondId = second.Id,
WorkNumber = t.Key,
Name = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.DoctorName))?.DoctorName,
OtherPerformance = t.Sum(w => w.Amount)
});
foreach (var item in groupData)
{
if (employees.Any(t => t.PersonnelNumber == item.WorkNumber)
&& employees.FirstOrDefault(t => t.PersonnelNumber == item.WorkNumber) is per_employee employee
&& employee.UnitType == second.UnitType)
{
item.ReservedRatio = employee.ReservedRatio;
item.Department = employee.AccountingUnit;
item.WorkPost = employee.JobTitle;
result.Add(item);
}
}
}
}
public static Dictionary<string, string> OtherTemp { get; } = new Dictionary<string, string>
{
{ nameof(ag_othersource.WorkNumber), "工号" },
{ nameof(ag_othersource.Name), "姓名" },
{ nameof(ag_othersource.Department), "科室" },
{ nameof(ag_othersource.WorkPost), "职称" },
{ nameof(ag_othersource.TitlePerformance), "职称绩效" },
{ nameof(ag_othersource.WorkPerformance), "工作量绩效工资" },
{ nameof(ag_othersource.DeptReward), "科室单项奖励" },
{ nameof(ag_othersource.DistPerformance), "可分配绩效" },
{ nameof(ag_othersource.OtherPerformance), "医院其他绩效" },
{ nameof(ag_othersource.NightWorkPerformance), "夜班工作量绩效" },
{ nameof(ag_othersource.ReservedRatio), "预留比例" },
{ nameof(ag_othersource.ReservedAmount), "预留金额" },
{ nameof(ag_othersource.RealAmount), "实发绩效工资金额" },
{ nameof (ag_othersource.WorkNumber), "工号" },
{ nameof (ag_othersource.Name), "姓名" },
{ nameof (ag_othersource.Department), "科室" },
{ nameof (ag_othersource.WorkPost), "职称" },
{ nameof (ag_othersource.TitlePerformance), "职称绩效" },
{ nameof (ag_othersource.WorkPerformance), "工作量绩效工资" },
{ nameof (ag_othersource.ManagementAllowance), "管理津贴" },
{ nameof (ag_othersource.IndividualReward), "单项奖励" },
{ nameof (ag_othersource.AllocationOfKeySpecialty), "重点专科分配" },
{ nameof (ag_othersource.DeptReward), "科室单项奖励" },
{ nameof (ag_othersource.DistPerformance), "可分配绩效" },
{ nameof (ag_othersource.OtherPerformance), "医院其他绩效" },
{ nameof (ag_othersource.NightWorkPerformance), "夜班工作量绩效" },
{ nameof (ag_othersource.ReservedRatio), "预留年度考核比例" },
{ nameof (ag_othersource.ReservedAmount), "年度考核发放金额" },
{ nameof (ag_othersource.RealAmount), "预发绩效工资金额" },
};
#endregion 其他模板详情
......
......@@ -114,7 +114,6 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee
}
}
}
public static void ClearSheetTemplate(ISheet sheet, PerSheetPoint point, SheetType sheetType)
{
if (sheet == null)
......@@ -155,7 +154,7 @@ public static void ClearSheetTemplate(ISheet sheet, PerSheetPoint point, SheetTy
sheet.ShiftRows(point.DataFirstRowNum.Value, sheet.LastRowNum + 1, -1);
}
}
public static void CloseAutoFilter(string path)
{
try
......@@ -198,5 +197,6 @@ public static bool IsXlsxFile(string filename)
}
return ext.ToLower() == ExcelVersion.xlsx.ToString().ToLower();
}
}
}
......@@ -134,7 +134,7 @@ public HospitalResponse Update(HospitalRequest request)
hospital.IsOpenDrugprop = request.IsOpenDrugprop;
hospital.IsShowManage = request.IsShowManage;
hospital.IsOpenCMIPercent = request.IsOpenCMIPercent;
hospital.IsOpenLogisticsSecondAllot = request.IsOpenLogisticsSecondAllot;
//hospital.IsOpenLogisticsSecondAllot = request.IsOpenLogisticsSecondAllot;
//hospital.IsOpenIncome = request.IsOpenIncome;
if (!_hospitalRepository.Update(hospital))
......
......@@ -512,6 +512,8 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, per_allot
if (AccountUnitType.行政高层.ToString() == involve || AccountUnitType.行政中层.ToString() == involve)
{
// 行政高层、行政中层 默认不需要二次分配
compute.NeedSecondAllot = "否";
// 行政高层 行政中层 夜班费
compute.NightWorkPerfor = item.NightWorkPerfor;
//考核前绩效
......@@ -523,6 +525,8 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, per_allot
}
else if (AccountUnitType.行政工勤.ToString() == involve)
{
// 行政工勤 根据测算表判读是否需要二次分配 默认不需要
compute.NeedSecondAllot = string.IsNullOrWhiteSpace(item.NeedSecondAllot) ? "否" : item.NeedSecondAllot;
//考核前绩效
compute.PerforTotal = Math.Round(compute.BaiscNormValue * compute.PostCoefficient * compute.Attendance + compute.OtherPerfor ?? 0);
//考核后绩效 更加开关来控制显示
......
......@@ -70,6 +70,7 @@ public class ExcelReadConfig
new ColumnInfo(nameof(PerDataLogisticsEmployee.PostCoefficient), "岗位系数", true),
new ColumnInfo(nameof(PerDataLogisticsEmployee.Attendance), "出勤率", true),
new ColumnInfo(nameof(PerDataLogisticsEmployee.OthePerfor), "其他绩效", true),
new ColumnInfo(nameof(PerDataLogisticsEmployee.NeedSecondAllot), "是否需要二次分配"),
//new ColumnInfo(nameof(PerDataLogisticsEmployee.AdjustLaterOtherFee), "调节后其他绩效", true),
};
......
......@@ -1614,9 +1614,9 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
// return;
// 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit ? perapramounts
?.Where(w => w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Sum(w => w.Amount) : 0;
Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit
? perapramounts?.Where(w => w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim())?.Sum(w => w.Amount)
: 0;
var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId && employees.Select(s => s.PersonnelNumber).Contains(t.JobNumber));
Func<per_employee, decimal?> getDistPerformance = (t) => 0;
......@@ -1671,6 +1671,9 @@ public List<ag_othersource> OtherSave(int secondId, List<ag_othersource> request
existEntities.First(t => t.Id == item.Id).OtherPerformance = item.OtherPerformance;
existEntities.First(t => t.Id == item.Id).NightWorkPerformance = item.NightWorkPerformance;
existEntities.First(t => t.Id == item.Id).RealAmount = item.RealAmount;
existEntities.First(t => t.Id == item.Id).ManagementAllowance = item.ManagementAllowance;
existEntities.First(t => t.Id == item.Id).IndividualReward = item.IndividualReward;
existEntities.First(t => t.Id == item.Id).AllocationOfKeySpecialty = item.AllocationOfKeySpecialty;
}
perforAgothersourceRepository.UpdateRange(existEntities.ToArray());
......
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