Commit 4ec73196 by ruyun.zhang@suvalue.com

Merge branch 'feature/二次分配自动匹配优化响应速度' into develop

parents 1c94729e cc267f4c
...@@ -367,12 +367,14 @@ public JArray AutoComplete(int secodId, SecondEmployeeRequest request) ...@@ -367,12 +367,14 @@ public JArray AutoComplete(int secodId, SecondEmployeeRequest request)
if (usetemp == null) if (usetemp == null)
throw new PerformanceException("当前科室暂未配置绩效模板"); throw new PerformanceException("当前科室暂未配置绩效模板");
var employees = personService.GetPerEmployee(second.AllotId.Value); #region 接口响应速度优化
var employees = new List<per_employee>();
if (!string.IsNullOrEmpty(request?.EmployeeName)) if (!string.IsNullOrEmpty(request?.EmployeeName))
employees = employees?.Where(w => w.DoctorName?.Trim() == request?.EmployeeName?.Trim()).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.DoctorName == request.EmployeeName);
if (!string.IsNullOrEmpty(request?.JobNumber)) if (!string.IsNullOrEmpty(request?.JobNumber))
employees = employees?.Where(w => w.PersonnelNumber.Trim() == request?.JobNumber.Trim()).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.PersonnelNumber == request.JobNumber);
#endregion
employees = employees?.OrderBy(t => t.PersonnelNumber).ThenByDescending(t => t.DoctorName).ToList(); employees = employees?.OrderBy(t => t.PersonnelNumber).ThenByDescending(t => t.DoctorName).ToList();
if (employees == null || !employees.Any()) return new JArray(); if (employees == null || !employees.Any()) return new JArray();
......
...@@ -307,8 +307,8 @@ public List<BodyItem> AutoComplete(SecondEmpRequest request, int userId) ...@@ -307,8 +307,8 @@ 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, userId, headItems, second.UnitType, request.EmployeeName, request.JobNumber); var bodyItems = GetEmployees(second, userId, headItems, second.UnitType, request.EmployeeName, request.JobNumber);
return bodyItems; return bodyItems;
} }
...@@ -361,16 +361,16 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId) ...@@ -361,16 +361,16 @@ public SecondResponse GetSecondDetail(UseTempRequest request, int userId)
if (fixatList.Where(t => t.RowNumber != -1) == null || !fixatList.Where(t => t.RowNumber != -1).Any()) if (fixatList.Where(t => t.RowNumber != -1) == null || !fixatList.Where(t => t.RowNumber != -1).Any())
{ {
//更换模板时,会自动保存顶部数据 //更换模板时,会自动保存顶部数据
var employees = personService.GetPersons(second.AllotId.Value, userId); //var employees = personService.GetPersons(second.AllotId.Value, userId);
result.BodyItems.AddRange(GetEmployees(employees, second, userId, headItems, second.UnitType)); result.BodyItems.AddRange(GetEmployees(second, userId, headItems, second.UnitType));
} }
} }
else else
{ {
//无数据 根据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, userId, headItems, second.UnitType); result.BodyItems = GetEmployees(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())
...@@ -418,23 +418,20 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId) ...@@ -418,23 +418,20 @@ private void SupplementOtherPerfor(SecondResponse result, int allotId)
} }
} }
private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot second, int userId, List<HeadItem> heads, string unittype, string empName = "", string jobNumber = "") private List<BodyItem> GetEmployees(ag_secondallot second, int userId, List<HeadItem> heads, string unittype, string empName = "", string jobNumber = "")
{ {
var list = new List<BodyItem>(); #region 接口响应速度优化
var employees = new List<per_employee>();
//var employees = personService.GetPersons(allotId, userId);
if (employees == null || !employees.Any()) return list;
var hospital = hospitalRepository.GetEntity(t => t.ID == employees.First().HospitalId);
if (hospital == null) return list;
if (string.IsNullOrEmpty(empName) && string.IsNullOrEmpty(jobNumber)) if (string.IsNullOrEmpty(empName) && string.IsNullOrEmpty(jobNumber))
employees = employees.Where(t => t.UnitType == unittype).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.UnitType == unittype);
if (!string.IsNullOrEmpty(empName)) if (!string.IsNullOrEmpty(empName))
employees = employees?.Where(w => w.DoctorName?.Trim() == empName?.Trim()).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.DoctorName == empName);
if (!string.IsNullOrEmpty(jobNumber)) if (!string.IsNullOrEmpty(jobNumber))
employees = employees?.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber) && w.PersonnelNumber.Trim() == jobNumber.Trim()).ToList(); employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.PersonnelNumber == jobNumber);
#endregion
if (employees == null || !employees.Any()) return new List<BodyItem>();
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) => second.Department == t.AccountingUnit && second.UnitType == t.UnitType Func<per_employee, decimal?> getAprAmount = (t) => second.Department == t.AccountingUnit && second.UnitType == t.UnitType
...@@ -452,6 +449,7 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot ...@@ -452,6 +449,7 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot
{ ("医院其他绩效","OtherPerformance"), (t) => getAprAmount(t)}, { ("医院其他绩效","OtherPerformance"), (t) => getAprAmount(t)},
}; };
var list = new List<BodyItem>();
int rowNumber = 1; int rowNumber = 1;
foreach (var employee in employees) foreach (var employee in employees)
{ {
...@@ -469,6 +467,8 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot ...@@ -469,6 +467,8 @@ private List<BodyItem> GetEmployees(List<per_employee> employees, ag_secondallot
rowNumber++; rowNumber++;
} }
var hospital = hospitalRepository.GetEntity(t => t.ID == employees.First().HospitalId);
if (hospital == null) return list;
if (hospital.IsShowSecondDirector == 2) if (hospital.IsShowSecondDirector == 2)
list = list.Where(t => t.FiledName == "岗位" && t.FiledId == "Post" && t.Value == "其他")?.ToList(); list = list.Where(t => t.FiledName == "岗位" && t.FiledId == "Post" && t.Value == "其他")?.ToList();
...@@ -1921,14 +1921,17 @@ public List<ag_othersource> OtherAutoComplete(SecondEmpRequest request, int user ...@@ -1921,14 +1921,17 @@ public List<ag_othersource> OtherAutoComplete(SecondEmpRequest request, int user
//获取固定模板列 + 工作量列 //获取固定模板列 + 工作量列
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); #region 接口响应速度优化
var employees = new List<per_employee>();
if (!string.IsNullOrEmpty(request?.EmployeeName))
employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.DoctorName == request.EmployeeName);
if (!string.IsNullOrEmpty(request?.JobNumber))
employees = peremployeeRepository.GetEntities(w => w.AllotId == second.AllotId.Value && w.PersonnelNumber == request.JobNumber);
#endregion
if (employees == null) return new List<ag_othersource>(); if (employees == null) return new List<ag_othersource>();
if (!string.IsNullOrEmpty(request.EmployeeName))
employees = employees?.Where(w => w.DoctorName?.Trim() == request.EmployeeName?.Trim()).ToList();
if (!string.IsNullOrEmpty(request.JobNumber))
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
...@@ -2194,7 +2197,7 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out ...@@ -2194,7 +2197,7 @@ public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out
if (computes == null || !computes.Any()) return new List<DeptDataDetails>(); if (computes == null || !computes.Any()) return new List<DeptDataDetails>();
foreach (var item in computes) foreach (var item in computes)
{ {
if (item.AccountType==AccountUnitType.行政中层.ToString()) if (item.AccountType == AccountUnitType.行政中层.ToString())
deptDatas.Add(computeService.GetAdministration(item.ID)); deptDatas.Add(computeService.GetAdministration(item.ID));
else else
deptDatas.Add(computeService.GetDoctorDetail(item.ID)); deptDatas.Add(computeService.GetDoctorDetail(item.ID));
......
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