Commit c9cd04b3 by 李承祥

二次绩效添加归档、 取消内五科除以医生的计算方式

parent f0f76924
......@@ -16,6 +16,9 @@ public class UseTempRequest
public string UnitType { get; set; }
public int SecondId { get; set; }
/// <summary> 是否归档 </summary>
public int IsArchive { get; set; }
}
public class UseTempRequestValidator : AbstractValidator<UseTempRequest>
{
......
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class SecondListResponse : ag_secondallot
{
/// <summary> 是否归档 </summary>
public int IsArchive { get; set; }
}
}
......@@ -353,16 +353,20 @@ public void Pigeonhole(per_allot allot)
{
allot.States = 8;
allot.Remark = "归档";
if (_allotRepository.Update(allot))
{
var again = _againallotRepository.GetEntities(t => t.AllotID == allot.ID);
foreach (var item in again)
{
item.Remark = $"原状态:{item.States},归档更改状态";
item.States = 5;
_againallotRepository.Update(item);
}
}
_allotRepository.Update(allot);
//if (_allotRepository.Update(allot))
//{
// var again = _againallotRepository.GetEntities(t => t.AllotID == allot.ID);
// if (again != null && again.Count > 0)
// {
// foreach (var item in again)
// {
// item.Remark = $"原状态:{item.States},归档更改状态";
// item.States = 5;
// _againallotRepository.Update(item);
// }
// }
//}
}
/// <summary>
......
......@@ -179,26 +179,26 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<im_a
//var realAvg = resAccount.Sum(t => t.Number + t.ManagerNumber) == 0 ? 0 : resAccount.Sum(t => t.RealGiveFee) / resAccount.Sum(t => t.Number + t.ManagerNumber);
decimal? realAvg = 0;
bool isAvg = true;
if ("内五科" == accountbasic.DoctorAccountingUnit && isShare)
realAvg = resAccount.Sum(r => r.Number + r.ManagerNumber) == 0 ? 0 : resAccount.Sum(r => r.RealGiveFee) / resAccount.Sum(r => r.Number);
else
//if ("内五科" == accountbasic.DoctorAccountingUnit && isShare)
// realAvg = resAccount.Sum(r => r.Number + r.ManagerNumber) == 0 ? 0 : resAccount.Sum(r => r.RealGiveFee) / resAccount.Sum(r => r.Number);
//else
//{
foreach (var item in resAccount)
{
foreach (var item in resAccount)
if ((item.ManagerNumber + item.Number) == 0)
{
if ((item.ManagerNumber + item.Number) == 0)
{
isAvg = false;
realAvg = resAccount.Sum(r => r.Number + r.ManagerNumber) == 0 ? 0 : resAccount.Sum(r => r.RealGiveFee) / resAccount.Sum(r => r.Number + r.ManagerNumber);
break;
}
else
{
realAvg += item.RealGiveFee / (item.ManagerNumber + item.Number);
}
isAvg = false;
realAvg = resAccount.Sum(r => r.Number + r.ManagerNumber) == 0 ? 0 : resAccount.Sum(r => r.RealGiveFee) / resAccount.Sum(r => r.Number + r.ManagerNumber);
break;
}
else
{
realAvg += item.RealGiveFee / (item.ManagerNumber + item.Number);
}
if (isAvg)
realAvg = realAvg / resAccount.Count();
}
if (isAvg)
realAvg = realAvg / resAccount.Count();
//}
var realGiveFee = resAccount.Sum(t => t.RealGiveFee);
......
......@@ -64,7 +64,7 @@ public class SecondAllotService : IAutoInjection
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public List<ag_secondallot> GetSecondList(int userId)
public List<SecondListResponse> GetSecondList(int userId)
{
var user = perforUserRepository.GetEntity(t => t.ID == userId);
if (user == null)
......@@ -73,7 +73,7 @@ public List<ag_secondallot> GetSecondList(int userId)
var hospital = perforUserhospitalRepository.GetEntity(t => t.UserID == userId);
if (hospital == null)
throw new NotImplementedException("人员未选择医院");
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospital.HospitalID && t.States == 6);
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospital.HospitalID && new List<int> { 6, 8 }.Contains(t.States));
if (allotList == null || allotList.Count == 0)
throw new NotImplementedException("该医院未生成绩效");
......@@ -120,8 +120,10 @@ public List<ag_secondallot> GetSecondList(int userId)
else
secondList.AddRange(newSecond);
}
var list = Mapper.Map<List<SecondListResponse>>(secondList);
return secondList;
list?.ForEach(t => t.IsArchive = allotList.FirstOrDefault(a => a.ID == t.AllotId).States == 8 ? 1 : 0);
return list;
}
/// <summary>
......@@ -382,6 +384,25 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
var result = new SecondResponse { HeadItems = headItems, BodyItems = new List<BodyItem>() };
//获取数据
var fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId && t.RowNumber.HasValue);
if (request.IsArchive == 1)
{
if (fixatList == null || fixatList.Count == 0)
throw new PerformanceException("绩效归档时,尚未添加数据。");
else
{
var existHead = fixatList.Select(t => new { FiledName = t.ItemName, Sort = t.Sort.Value, SourceType = t.SourceType.Value, Type = t.Type.Value, FactorValue = t.FactorValue.Value }).Distinct().ToList();
headItems = existHead.Select(t => new HeadItem
{
FiledId = headItems.FirstOrDefault(h => h.FiledName == t.FiledName && h.Type == t.Type)?.FiledId ?? "无FiledId",
FiledName = t.FiledName,
Sort = t.Sort,
SourceType = t.SourceType,
Type = t.Type,
FactorValue = t.FactorValue
}).ToList();
}
}
if (fixatList != null && fixatList.Count > 0)
{
//补充数据
......
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