Commit 7dfac4e2 by 钟博

人均界面新增修改

parent 9412cbcf
......@@ -12,6 +12,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Performance.DtoModels.Request;
namespace Performance.Api.Controllers
{
......@@ -252,7 +253,7 @@ public ApiResponse AllComputeAvg([FromBody] ComputerRequest request)
// ? 0 : Math.Round(gc.Sum(s => s.RealGiveFee) / gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() ?? 0)
// }));
return new ApiResponse(ResponseType.OK, "ok", avgs.Select(w => new { w.PositionName, w.TotelNumber, w.TotelValue, w.AvgValue }));
return new ApiResponse(ResponseType.OK, "ok", avgs.Select(w => new {w.ID, w.PositionName, w.TotelNumber, w.TotelValue, w.AvgValue }));
}
/// <summary>
......@@ -352,5 +353,27 @@ public ApiResponse DoctorDetail(int computeId)
var result = _computeService.GetDoctorDetail(computeId);
return new ApiResponse(ResponseType.OK, result);
}
#region 人均绩效修改
/// <summary>
/// 编辑全院绩效平均
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("EditHospitalAvg")]
[HttpPost]
public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest request)
{
var allot = _allotService.GetAllot(request.allotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var result = _computeService.EditHospitalAvg(request);
return new ApiResponse<res_baiscnorm>(ResponseType.OK, result);
}
#endregion
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
using Performance.DtoModels.Request;
namespace Performance.Services
{
......@@ -210,8 +211,15 @@ public List<res_baiscnorm> AllComputeAvg(int allotId, List<ComputeResponse> list
List<res_baiscnorm> avgs = new List<res_baiscnorm>();
var emps = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
var jobCategory = emps?.Select(w => string.IsNullOrEmpty(w.JobCategory) ? "未知" : w.JobCategory).Distinct() ?? new List<string>();
var basicnorm = perforResbaiscnormRepository.GetEntities(t => t.AllotID == allotId);
var position = basicnorm?.Select(t => string.IsNullOrEmpty(t.PositionName) ? "" : t.PositionName).Distinct() ?? new List<string>();
foreach (var item in jobCategory)
{
if (position.Contains(item))
{
avgs.Add(basicnorm.First(t => t.PositionName == item));
continue;
}
var sumfee = (from com in list
join emp in emps?.Where(w => w.JobCategory == item)
on com.JobNumber equals emp.PersonnelNumber
......@@ -1412,5 +1420,31 @@ public DeptDataDetails GetDoctorDetail(int computeId)
}
return doctorDetails;
}
public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request)
{
if (request.Id==0)
{
var baiscnorm = Mapper.Map<res_baiscnorm>(request);
if (!perforResbaiscnormRepository.Add(baiscnorm))
throw new PerformanceException("保存失败");
return Mapper.Map<res_baiscnorm>(baiscnorm);
}
else
{
var baiscnorm = perforResbaiscnormRepository.GetEntity(t => t.ID == request.Id);
if (baiscnorm==null)
throw new PerformanceException($"ID不存在 :{request.Id}");
baiscnorm.TotelNumber = request.TotelNumber;
baiscnorm.TotelValue = request.TotelValue;
baiscnorm.AvgValue = request.AvgValue;
//var baiscnorm = Mapper.Map<res_baiscnorm>(request);
if (!perforResbaiscnormRepository.Update(baiscnorm))
throw new PerformanceException("保存失败");
return Mapper.Map<res_baiscnorm>(baiscnorm);
}
}
}
}
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