Commit 60f511c4 by lcx

绩效人员字典使用personnelnumber替换jobnumber(东方存在两种工号,在二次绩效工作量中联合字典表显示人事工号,其余医院personnelnumber、jobnumber一致)

parent 3667cd9c
...@@ -3637,9 +3637,9 @@ ...@@ -3637,9 +3637,9 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_employee.Id"> <member name="P:Performance.EntityModels.per_employee.Id">
<summary> <summary>
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_employee.HospitalId"> <member name="P:Performance.EntityModels.per_employee.HospitalId">
<summary> <summary>
...@@ -3742,14 +3742,14 @@ ...@@ -3742,14 +3742,14 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_employee.CreateTime"> <member name="P:Performance.EntityModels.per_employee.CreateTime">
<summary> <summary>
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_employee.CreateUser"> <member name="P:Performance.EntityModels.per_employee.CreateUser">
<summary> <summary>
</summary> </summary>
</member> </member>
<member name="T:Performance.EntityModels.per_first"> <member name="T:Performance.EntityModels.per_first">
<summary> <summary>
......
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// <copyright file=" per_employee.cs"> // <copyright file=" per_employee.cs">
// * FileName: 绩效人员表.cs // * FileName: 绩效人员表.cs
// </copyright> // </copyright>
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
using System; using System;
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("per_employee")] [Table("per_employee")]
public class per_employee public class per_employee
{ {
/// <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> HospitalId { get; set; } public Nullable<int> HospitalId { get; set; }
/// <summary> /// <summary>
/// 绩效Id /// 绩效Id
/// </summary> /// </summary>
public Nullable<int> AllotId { get; set; } public Nullable<int> AllotId { get; set; }
/// <summary> /// <summary>
/// 核算单元 /// 核算单元
/// </summary> /// </summary>
public string AccountingUnit { get; set; } public string AccountingUnit { get; set; }
/// <summary> /// <summary>
/// 科室 /// 科室
/// </summary> /// </summary>
public string Department { get; set; } public string Department { get; set; }
/// <summary> /// <summary>
/// 姓名 /// 姓名
/// </summary> /// </summary>
...@@ -60,74 +60,74 @@ public class per_employee ...@@ -60,74 +60,74 @@ public class per_employee
/// 正式/临聘 /// 正式/临聘
/// </summary> /// </summary>
public string JobCategory { get; set; } public string JobCategory { get; set; }
/// <summary> /// <summary>
/// 职务 /// 职务
/// </summary> /// </summary>
public string Duty { get; set; } public string Duty { get; set; }
/// <summary> /// <summary>
/// 职称 /// 职称
/// </summary> /// </summary>
public string JobTitle { get; set; } public string JobTitle { get; set; }
/// <summary> /// <summary>
/// 人员类别 /// 人员类别
/// </summary> /// </summary>
public string UnitType { get; set; } public string UnitType { get; set; }
/// <summary> /// <summary>
/// 出勤率 /// 出勤率
/// </summary> /// </summary>
public Nullable<decimal> Attendance { get; set; } public Nullable<decimal> Attendance { get; set; }
/// <summary> /// <summary>
/// 出勤天数 /// 出勤天数
/// </summary> /// </summary>
public Nullable<int> AttendanceDay { get; set; } public Nullable<int> AttendanceDay { get; set; }
/// <summary> /// <summary>
/// 核算人数 /// 核算人数
/// </summary> /// </summary>
public Nullable<decimal> PermanentStaff { get; set; } public Nullable<decimal> PermanentStaff { get; set; }
/// <summary> /// <summary>
/// 效率人数 /// 效率人数
/// </summary> /// </summary>
public Nullable<decimal> EfficiencyNumber { get; set; } public Nullable<decimal> EfficiencyNumber { get; set; }
/// <summary> /// <summary>
/// 参加工作时间 /// 参加工作时间
/// </summary> /// </summary>
public Nullable<DateTime> WorkTime { get; set; } public Nullable<DateTime> WorkTime { get; set; }
/// <summary> /// <summary>
/// 出生年月 /// 出生年月
/// </summary> /// </summary>
public Nullable<DateTime> BirthDate { get; set; } public Nullable<DateTime> BirthDate { get; set; }
/// <summary> /// <summary>
/// 年龄 /// 年龄
/// </summary> /// </summary>
public Nullable<int> Age { get; set; } public Nullable<int> Age { get; set; }
/// <summary> /// <summary>
/// 预留比例 /// 预留比例
/// </summary> /// </summary>
public Nullable<decimal> ReservedRatio { get; set; } public Nullable<decimal> ReservedRatio { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<DateTime> CreateTime { get; set; } public Nullable<DateTime> CreateTime { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<int> CreateUser { get; set; } public Nullable<int> CreateUser { get; set; }
} }
......
...@@ -76,6 +76,7 @@ public int DeleteAllotData(int allotId) ...@@ -76,6 +76,7 @@ public int DeleteAllotData(int allotId)
"res_compute", "res_compute",
"res_specialunit", "res_specialunit",
"log_check", "log_check",
"per_employee",
}; };
string sql = ""; string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;"); tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
......
...@@ -191,7 +191,7 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo ...@@ -191,7 +191,7 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo
switch (employeeSource) switch (employeeSource)
{ {
case (int)EmployeeSource.Initial: case (int)EmployeeSource.Initial:
return GetEmployeeFromSavedData(secondAllot, savedDataList, otherShowColumns); return GetEmployeeFromSavedData(userId, secondAllot, savedDataList, otherShowColumns);
case (int)EmployeeSource.EmployeeDict: case (int)EmployeeSource.EmployeeDict:
return GetEmployeeFromEmployeeDict(userId, secondAllot, otherShowColumns); return GetEmployeeFromEmployeeDict(userId, secondAllot, otherShowColumns);
...@@ -210,7 +210,7 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo ...@@ -210,7 +210,7 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo
/// <param name="savedDataList"></param> /// <param name="savedDataList"></param>
/// <param name="otherShowColumns"></param> /// <param name="otherShowColumns"></param>
/// <returns></returns> /// <returns></returns>
public List<BodyItem> GetEmployeeFromSavedData(ag_secondallot secondAllot, List<ag_fixatitem> savedDataList, List<HeadItem> otherShowColumns) public List<BodyItem> GetEmployeeFromSavedData(int userId, ag_secondallot secondAllot, List<ag_fixatitem> savedDataList, List<HeadItem> otherShowColumns)
{ {
var tableFixedDataList = new List<BodyItem>(); var tableFixedDataList = new List<BodyItem>();
...@@ -220,6 +220,7 @@ public List<BodyItem> GetEmployeeFromSavedData(ag_secondallot secondAllot, List< ...@@ -220,6 +220,7 @@ public List<BodyItem> GetEmployeeFromSavedData(ag_secondallot secondAllot, List<
var rowNumberList = savedDataList.Where(w => w.RowNumber.HasValue && w.RowNumber > -1)?.Select(w => w.RowNumber.Value).Distinct().OrderBy(t => t).ToList(); var rowNumberList = savedDataList.Where(w => w.RowNumber.HasValue && w.RowNumber > -1)?.Select(w => w.RowNumber.Value).Distinct().OrderBy(t => t).ToList();
if (rowNumberList != null && rowNumberList.Any()) if (rowNumberList != null && rowNumberList.Any())
{ {
var employeeList = personService.GetPersons(secondAllot.AllotId.Value, userId);
foreach (var rowNumber in rowNumberList) foreach (var rowNumber in rowNumberList)
{ {
foreach (var column in otherShowColumns) foreach (var column in otherShowColumns)
...@@ -234,7 +235,7 @@ public List<BodyItem> GetEmployeeFromSavedData(ag_secondallot secondAllot, List< ...@@ -234,7 +235,7 @@ public List<BodyItem> GetEmployeeFromSavedData(ag_secondallot secondAllot, List<
tableFixedDataList.Add(tableFixedData); tableFixedDataList.Add(tableFixedData);
} }
} }
SupplementOtherPerfor(secondAllot, tableFixedDataList); SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList);
} }
return tableFixedDataList; return tableFixedDataList;
} }
...@@ -262,7 +263,7 @@ public List<BodyItem> GetEmployeeFromEmployeeDict(int userId, ag_secondallot sec ...@@ -262,7 +263,7 @@ public List<BodyItem> GetEmployeeFromEmployeeDict(int userId, ag_secondallot sec
var employeeColumns = new List<Tuple<string, string, Func<per_employee, object>>> var employeeColumns = new List<Tuple<string, string, Func<per_employee, object>>>
{ {
new Tuple<string, string, Func<per_employee, object>>("人员工号", "PersonnelNumber", (t) => t.JobNumber), 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>>("姓名", "FullName", (t) => t.DoctorName),
new Tuple<string, string, Func<per_employee, object>>( new Tuple<string, string, Func<per_employee, object>>(
"岗位", "Post", "岗位", "Post",
...@@ -291,7 +292,7 @@ public List<BodyItem> GetEmployeeFromEmployeeDict(int userId, ag_secondallot sec ...@@ -291,7 +292,7 @@ public List<BodyItem> GetEmployeeFromEmployeeDict(int userId, ag_secondallot sec
} }
rowNumber++; rowNumber++;
} }
SupplementOtherPerfor(secondAllot, tableFixedDataList); SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList);
return tableFixedDataList; return tableFixedDataList;
} }
...@@ -348,9 +349,9 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA ...@@ -348,9 +349,9 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA
if (attenItem == null) continue; if (attenItem == null) continue;
var attendance = new BodyItem(attenItem); var attendance = new BodyItem(attenItem);
var jobNumber = savedDataList.FirstOrDefault(w => w.RowNumber == rowNumber && w.ItemName == "人员工号")?.ItemValue; var personnelNumber = savedDataList.FirstOrDefault(w => w.RowNumber == rowNumber && w.ItemName == "人员工号")?.ItemValue;
var personName = savedDataList.FirstOrDefault(w => w.RowNumber == rowNumber && w.ItemName == "姓名")?.ItemValue; var personName = savedDataList.FirstOrDefault(w => w.RowNumber == rowNumber && w.ItemName == "姓名")?.ItemValue;
var employeeAttendance = employeeList.FirstOrDefault(w => w.JobNumber == jobNumber && w.DoctorName == personName)?.AttendanceDay.ToString(); var employeeAttendance = employeeList.FirstOrDefault(w => w.PersonnelNumber == personnelNumber && w.DoctorName == personName)?.AttendanceDay.ToString();
attendance.Value = employeeAttendance; attendance.Value = employeeAttendance;
attendance.RowNumber = rowNumber; attendance.RowNumber = rowNumber;
...@@ -359,7 +360,7 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA ...@@ -359,7 +360,7 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA
#endregion 获取人员字典中录入的出勤 #endregion 获取人员字典中录入的出勤
} }
SupplementOtherPerfor(secondAllot, tableFixedDataList); SupplementOtherPerfor(secondAllot, tableFixedDataList, employeeList);
} }
return tableFixedDataList; return tableFixedDataList;
} }
...@@ -407,7 +408,7 @@ private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> body ...@@ -407,7 +408,7 @@ private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> body
/// 补充 医院其他绩效 /// 补充 医院其他绩效
/// </summary> /// </summary>
/// <param name="result"></param> /// <param name="result"></param>
private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bodyItems) private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bodyItems, List<per_employee> employeeList)
{ {
if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return; if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return;
...@@ -420,9 +421,13 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo ...@@ -420,9 +421,13 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo
var personnelNumber = rowData.FirstOrDefault(w => w.FiledId == "PersonnelNumber")?.Value; var personnelNumber = rowData.FirstOrDefault(w => w.FiledId == "PersonnelNumber")?.Value;
var fullName = rowData.FirstOrDefault(w => w.FiledId == "FullName")?.Value; var fullName = rowData.FirstOrDefault(w => w.FiledId == "FullName")?.Value;
var amount = perapramounts var employee = employeeList.FirstOrDefault(w => w.PersonnelNumber == personnelNumber);
if (employee == null) continue;
var amount = secondAllot.Department == employee.AccountingUnit ? perapramounts
?.Where(w => w.AccountingUnit?.Trim() == secondAllot.Department?.Trim() && w.PersonnelNumber?.Trim() == personnelNumber?.Trim()) ?.Where(w => w.AccountingUnit?.Trim() == secondAllot.Department?.Trim() && w.PersonnelNumber?.Trim() == personnelNumber?.Trim())
?.Sum(w => w.Amount); ?.Sum(w => w.Amount) : 0;
var otherPerfor = rowData.FirstOrDefault(w => w.FiledId == "OtherPerformance"); var otherPerfor = rowData.FirstOrDefault(w => w.FiledId == "OtherPerformance");
if (otherPerfor != null) if (otherPerfor != null)
otherPerfor.Value = amount?.ToString(); otherPerfor.Value = amount?.ToString();
...@@ -551,7 +556,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -551,7 +556,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
result = employees.Select(t => new ag_othersource result = employees.Select(t => new ag_othersource
{ {
SecondId = secondId, SecondId = secondId,
WorkNumber = t.JobNumber /*?? t.PersonnelNumber*/, WorkNumber = t.PersonnelNumber,
Name = t.DoctorName, Name = t.DoctorName,
Department = t.Department, Department = t.Department,
WorkPost = t.JobTitle, WorkPost = t.JobTitle,
...@@ -597,16 +602,16 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -597,16 +602,16 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
return; return;
// 补充医院其他绩效 及 预留比例 // 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3); var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
Func<per_employee, decimal?> getAprAmount = (t) => perapramounts Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit ? perapramounts
?.Where(w => w.AccountingUnit?.Trim() == second.Department?.Trim() && w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim()) ?.Where(w => w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Sum(w => w.Amount); ?.Sum(w => w.Amount) : 0;
var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId && employees.Select(s => s.DoctorName).Contains(t.EmployeeName)); var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId && employees.Select(s => s.DoctorName).Contains(t.EmployeeName));
Func<per_employee, decimal?> getDistPerformance = (t) => 0; Func<per_employee, decimal?> getDistPerformance = (t) => 0;
if (second.UnitType == UnitType.行政后勤.ToString()) if (second.UnitType == UnitType.行政后勤.ToString())
getDistPerformance = (t) => distPerformance getDistPerformance = (t) => second.Department == t.AccountingUnit ? distPerformance
?.Where(w => w.AccountingUnit?.Trim() == second.Department?.Trim() && w.EmployeeName?.Trim() == t.DoctorName?.Trim() && w.JobNumber?.Trim() == t.PersonnelNumber?.Trim()) ?.Where(w => w.EmployeeName?.Trim() == t.DoctorName?.Trim() && w.JobNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Sum(w => w.GiveFee); ?.Sum(w => w.GiveFee) : 0;
foreach (var item in result) foreach (var item in result)
{ {
......
...@@ -581,20 +581,20 @@ public void ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -581,20 +581,20 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="jobNumber"></param> /// <param name="jobNumber"></param>
/// <returns></returns> /// <returns></returns>
public per_apr_amount GetEmployeeMessage(int allotId, string jobNumber, int userId) public per_apr_amount GetEmployeeMessage(int allotId, string personnelNumber, int userId)
{ {
if (string.IsNullOrEmpty(jobNumber)) return new per_apr_amount(); if (string.IsNullOrEmpty(personnelNumber)) return new per_apr_amount();
var user = userRepository.GetEntity(w => w.ID == userId && w.IsDelete == 1); var user = userRepository.GetEntity(w => w.ID == userId && w.IsDelete == 1);
if (user == null) throw new PerformanceException("操作用户不存在或用户信息错误!"); if (user == null) throw new PerformanceException("操作用户不存在或用户信息错误!");
var employee = peremployeeRepository.GetEntity(w => w.AllotId == allotId && w.JobNumber.Trim() == jobNumber.Trim()); var employee = peremployeeRepository.GetEntity(w => w.AllotId == allotId && w.PersonnelNumber.Trim() == personnelNumber.Trim());
if (employee == null) return new per_apr_amount(); if (employee == null) return new per_apr_amount();
return new per_apr_amount return new per_apr_amount
{ {
AllotId = allotId, AllotId = allotId,
PersonnelNumber = employee.JobNumber, PersonnelNumber = employee.PersonnelNumber,
DoctorName = employee.DoctorName, DoctorName = employee.DoctorName,
TypeInDepartment = user.Department, TypeInDepartment = user.Department,
AccountingUnit = employee.AccountingUnit AccountingUnit = employee.AccountingUnit
......
...@@ -88,29 +88,42 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1 ...@@ -88,29 +88,42 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1
int day = DateTime.DaysInMonth(allot.Year, allot.Month); int day = DateTime.DaysInMonth(allot.Year, allot.Month);
var data = persons.Select(t => new per_employee var data = persons.Select(t =>
{ {
AccountingUnit = t.AccountingUnit, var entity = new per_employee
Department = t.Department, {
DoctorName = t.DoctorName, AccountingUnit = t.AccountingUnit,
PersonnelNumber = t.PersonnelNumber, Department = t.Department,
JobNumber = t.JobNumber, DoctorName = t.DoctorName,
JobCategory = t.JobCategory, JobCategory = t.JobCategory,
Duty = t.Duty, Duty = t.Duty,
JobTitle = t.JobTitle, JobTitle = t.JobTitle,
UnitType = t.UnitType, UnitType = t.UnitType,
AttendanceDay = day, AttendanceDay = day,
Attendance = 1, Attendance = 1,
PermanentStaff = t.PermanentStaff, PermanentStaff = t.PermanentStaff,
EfficiencyNumber = t.EfficiencyNumber, EfficiencyNumber = t.EfficiencyNumber,
WorkTime = t.WorkTime, WorkTime = t.WorkTime,
BirthDate = t.BirthDate, BirthDate = t.BirthDate,
Age = t.Age, Age = t.Age,
Remark = t.Remark, Remark = t.Remark,
HospitalId = t.HospitalId, HospitalId = t.HospitalId,
AllotId = allotId, AllotId = allotId,
ReservedRatio = t.ReservedRatio, ReservedRatio = t.ReservedRatio,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
};
if (!string.IsNullOrEmpty(t.PersonnelNumber) && !string.IsNullOrEmpty(t.JobNumber))
{
entity.PersonnelNumber = t.PersonnelNumber;
entity.JobNumber = t.JobNumber;
}
else
{
string number = !string.IsNullOrEmpty(t.PersonnelNumber) ? t.PersonnelNumber : t.JobNumber;
entity.PersonnelNumber = number;
entity.JobNumber = number;
}
return entity;
}).ToList(); }).ToList();
SaveAllotPersons(data); SaveAllotPersons(data);
} }
...@@ -223,6 +236,7 @@ public bool UpdatePerson(PerEmployeeResponse request) ...@@ -223,6 +236,7 @@ public bool UpdatePerson(PerEmployeeResponse request)
employee.Department = request.Department; employee.Department = request.Department;
employee.DoctorName = request.DoctorName; employee.DoctorName = request.DoctorName;
employee.PersonnelNumber = request.PersonnelNumber; employee.PersonnelNumber = request.PersonnelNumber;
//employee.JobNumber = request.JobNumber; // his
employee.JobCategory = request.JobCategory; employee.JobCategory = request.JobCategory;
employee.Duty = request.Duty; employee.Duty = request.Duty;
employee.JobTitle = request.JobTitle; employee.JobTitle = request.JobTitle;
......
...@@ -279,7 +279,7 @@ public List<BodyItem> AutoComplete(SecondEmpRequest request, int userId) ...@@ -279,7 +279,7 @@ public List<BodyItem> AutoComplete(SecondEmpRequest request, int userId)
var headItems = GetHeadItems(request.TempId, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType); var headItems = GetHeadItems(request.TempId, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType);
var employees = personService.GetPerEmployee(second.AllotId.Value); var employees = personService.GetPerEmployee(second.AllotId.Value);
var bodyItems = GetEmployees(employees, second.AllotId.Value, userId, headItems, second.UnitType, request.EmployeeName, request.JobNumber); var bodyItems = GetEmployees(employees, second, userId, headItems, second.UnitType, request.EmployeeName, request.JobNumber);
return bodyItems; return bodyItems;
} }
...@@ -333,7 +333,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId) ...@@ -333,7 +333,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
{ {
//更换模板时,会自动保存顶部数据 //更换模板时,会自动保存顶部数据
var employees = personService.GetPersons(second.AllotId.Value, userId); var employees = personService.GetPersons(second.AllotId.Value, userId);
result.BodyItems.AddRange(GetEmployees(employees, second.AllotId.Value, userId, headItems, second.UnitType)); result.BodyItems.AddRange(GetEmployees(employees, second, userId, headItems, second.UnitType));
} }
} }
else else
...@@ -341,7 +341,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId) ...@@ -341,7 +341,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
//无数据 根据IsBring带出历史二次绩效中需要带出的数据 //无数据 根据IsBring带出历史二次绩效中需要带出的数据
//result.BodyItems = GetBringItems(request, headItems); //result.BodyItems = GetBringItems(request, headItems);
var employees = personService.GetPersons(second.AllotId.Value, userId); var employees = personService.GetPersons(second.AllotId.Value, userId);
result.BodyItems = GetEmployees(employees, second.AllotId.Value, userId, headItems, second.UnitType); result.BodyItems = GetEmployees(employees, second, userId, headItems, second.UnitType);
var bodys = Mapper.Map<List<BodyItem>>(headItems.Where(t => t.Type == 1)); var bodys = Mapper.Map<List<BodyItem>>(headItems.Where(t => t.Type == 1));
if (bodys != null && bodys.Any()) if (bodys != null && bodys.Any())
...@@ -380,7 +380,7 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId) ...@@ -380,7 +380,7 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId)
var fullName = rowData.FirstOrDefault(w => w.FiledId == "FullName")?.Value; var fullName = rowData.FirstOrDefault(w => w.FiledId == "FullName")?.Value;
var amount = perapramounts var amount = perapramounts
?.Where(w => w.AccountingUnit?.Trim() == second.Department?.Trim() && w.DoctorName?.Trim() == fullName?.Trim() && w.PersonnelNumber?.Trim() == personnelNumber?.Trim()) ?.Where(w => w.DoctorName?.Trim() == fullName?.Trim() && w.PersonnelNumber?.Trim() == personnelNumber?.Trim())
?.Sum(w => w.Amount); ?.Sum(w => w.Amount);
var otherPerfor = rowData.FirstOrDefault(w => w.FiledId == "OtherPerformance"); var otherPerfor = rowData.FirstOrDefault(w => w.FiledId == "OtherPerformance");
if (otherPerfor != null) if (otherPerfor != null)
...@@ -389,7 +389,7 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId) ...@@ -389,7 +389,7 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId)
} }
} }
private List<BodyItem> GetEmployees(List<per_employee> employees, int allotId, int userId, List<HeadItem> heads, string unittype, string empName = "", string jobNumber = "") private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot second, int userId, List<HeadItem> heads, string unittype, string empName = "", string jobNumber = "")
{ {
var list = new List<BodyItem>(); var list = new List<BodyItem>();
...@@ -405,17 +405,16 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, int allotId, i ...@@ -405,17 +405,16 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, int allotId, i
if (!string.IsNullOrEmpty(empName)) if (!string.IsNullOrEmpty(empName))
employees = employees?.Where(w => w.DoctorName?.Trim() == empName?.Trim()).ToList(); employees = employees?.Where(w => w.DoctorName?.Trim() == empName?.Trim()).ToList();
if (!string.IsNullOrEmpty(jobNumber)) if (!string.IsNullOrEmpty(jobNumber))
employees = employees?.Where(w => !string.IsNullOrEmpty(w.JobNumber) && w.JobNumber.Trim() == jobNumber.Trim()).ToList(); employees = employees?.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber) && w.PersonnelNumber.Trim() == jobNumber.Trim()).ToList();
var second = perforAgsecondallotRepository.GetEntity(t => t.AllotId == allotId); var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == 3); Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit ? perapramounts
Func<per_employee, decimal?> getAprAmount = (t) => perapramounts ?.Where(w => w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Where(w => w.AccountingUnit?.Trim() == second.Department?.Trim() && w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.JobNumber?.Trim()) ?.Sum(w => w.Amount) : 0;
?.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>>
{ {
{ ("人员工号", "PersonnelNumber"), (t) => t.JobNumber }, { ("人员工号", "PersonnelNumber"), (t) => t.PersonnelNumber },
{ ("姓名", "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 },
...@@ -1542,7 +1541,7 @@ public List<ag_othersource> OtherList(int secondId, int userId) ...@@ -1542,7 +1541,7 @@ public List<ag_othersource> OtherList(int secondId, int userId)
result = employees.Select(t => new ag_othersource result = employees.Select(t => new ag_othersource
{ {
SecondId = secondId, SecondId = secondId,
WorkNumber = t.JobNumber ?? t.PersonnelNumber, WorkNumber = t.PersonnelNumber,
Name = t.DoctorName, Name = t.DoctorName,
Department = t.Department, Department = t.Department,
WorkPost = t.JobTitle, WorkPost = t.JobTitle,
...@@ -1585,7 +1584,7 @@ public List<ag_othersource> OtherAutoComplete(SecondEmpRequest request, int user ...@@ -1585,7 +1584,7 @@ public List<ag_othersource> OtherAutoComplete(SecondEmpRequest request, int user
if (!string.IsNullOrEmpty(request.EmployeeName)) if (!string.IsNullOrEmpty(request.EmployeeName))
employees = employees?.Where(w => w.DoctorName?.Trim() == request.EmployeeName?.Trim()).ToList(); employees = employees?.Where(w => w.DoctorName?.Trim() == request.EmployeeName?.Trim()).ToList();
if (!string.IsNullOrEmpty(request.JobNumber)) if (!string.IsNullOrEmpty(request.JobNumber))
employees = employees?.Where(w => !string.IsNullOrEmpty(w.JobNumber) && w.JobNumber.Trim() == request.JobNumber.Trim()).ToList(); employees = employees?.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber) && w.PersonnelNumber.Trim() == request.JobNumber.Trim()).ToList();
List<ag_othersource> result = employees List<ag_othersource> result = employees
.Select(t => new ag_othersource .Select(t => new ag_othersource
...@@ -1615,16 +1614,16 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -1615,16 +1614,16 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
return; return;
// 补充医院其他绩效 及 预留比例 // 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3); var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
Func<per_employee, decimal?> getAprAmount = (t) => perapramounts Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit ? perapramounts
?.Where(w => w.AccountingUnit?.Trim() == second.Department?.Trim() && w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim()) ?.Where(w => w.DoctorName?.Trim() == t.DoctorName?.Trim() && w.PersonnelNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Sum(w => w.Amount); ?.Sum(w => w.Amount) : 0;
var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId && employees.Select(s => s.DoctorName).Contains(t.EmployeeName)); var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId && employees.Select(s => s.DoctorName).Contains(t.EmployeeName));
Func<per_employee, decimal?> getDistPerformance = (t) => 0; Func<per_employee, decimal?> getDistPerformance = (t) => 0;
if (second.UnitType == UnitType.行政后勤.ToString()) if (second.UnitType == UnitType.行政后勤.ToString())
getDistPerformance = (t) => distPerformance getDistPerformance = (t) => second.Department == t.AccountingUnit ? distPerformance
?.Where(w => w.AccountingUnit?.Trim() == second.Department?.Trim() && w.EmployeeName?.Trim() == t.DoctorName?.Trim() && w.JobNumber?.Trim() == t.PersonnelNumber?.Trim()) ?.Where(w => w.EmployeeName?.Trim() == t.DoctorName?.Trim() && w.JobNumber?.Trim() == t.PersonnelNumber?.Trim())
?.Sum(w => w.GiveFee); ?.Sum(w => w.GiveFee) : 0;
foreach (var item in result) foreach (var item in result)
{ {
......
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