Commit 5231f4b6 by 李承祥

获取科室详情参数修改

parent 2e388c4f
......@@ -119,12 +119,20 @@ public ApiResponse<List<DeptResponse>> GetOther([FromBody]ComputerRequest reques
[HttpPost]
public ApiResponse<DeptDataDetails> DeptDetail([FromBody]DeptDetailRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
//var allot = _allotService.GetAllot(request.AllotId);
//if (null == allot)
// throw new PerformanceException("当前绩效记录不存在");
//DeptDetailResponse response = _computeService.GetDepartmentDetail(request.AllotId, request.AccountID, request.Type);
var response = _computeService.DeptDetail(request.AllotId, request.AccountID, request.Type);
if (request.AccountID == 0)
{
if (request.SecondId == 0)
return new ApiResponse<DeptDataDetails>(ResponseType.ParameterError, "参数 AccountID或SecondId 无效");
else
request.AccountID = _computeService.GetAccountId(request.SecondId);
}
var response = _computeService.DeptDetail(request.AccountID);
return new ApiResponse<DeptDataDetails>(ResponseType.OK, response);
}
......
......@@ -16,6 +16,11 @@ public class DeptDetailRequest
public int AllotId { get; set; }
/// <summary>
/// 二次绩效id
/// </summary>
public int SecondId { get; set; }
/// <summary>
/// 绩效类型(1 医生组、 2 护理组)
/// </summary>
public int Type { get; set; }
......@@ -29,9 +34,9 @@ public class DetailRequestValidator : AbstractValidator<DeptDetailRequest>
{
public DetailRequestValidator()
{
RuleFor(x => x.AllotId).NotNull().GreaterThan(0);
RuleFor(x => x.Type).NotNull().InclusiveBetween(1, 5);
RuleFor(x => x.AccountID).NotNull().GreaterThan(0);
//RuleFor(x => x.AllotId).NotNull().GreaterThan(0);
//RuleFor(x => x.Type).NotNull().InclusiveBetween(1, 5);
//RuleFor(x => x.AccountID).NotNull().GreaterThan(0);
}
}
}
......@@ -24,6 +24,7 @@ public class ComputeService : IAutoInjection
private readonly PerforAgemployeeRepository _perforAgemployeeRepository;
private readonly PerforResbaiscnormRepository perforResbaiscnormRepository;
private readonly PerforCofincomeRepository _perforCofincomeRepository;
private readonly PerforAgsecondallotRepository _perforAgsecondallotRepository;
public ComputeService(PerforResaccountRepository perforResaccountRepository,
//PerforResaccountnurseRepository perforResAccountnurseRepository,
......@@ -35,7 +36,8 @@ public class ComputeService : IAutoInjection
PerforUserRepository perforUserRepository,
PerforAgemployeeRepository perforAgemployeeRepository,
PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforCofincomeRepository perforCofincomeRepository)
PerforCofincomeRepository perforCofincomeRepository,
PerforAgsecondallotRepository perforAgsecondallotRepository)
{
this.perforResaccountRepository = perforResaccountRepository;
//this._perforResAccountnurseRepository = perforResAccountnurseRepository;
......@@ -48,6 +50,7 @@ public class ComputeService : IAutoInjection
this._perforAgemployeeRepository = perforAgemployeeRepository;
this.perforResbaiscnormRepository = perforResbaiscnormRepository;
this._perforCofincomeRepository = perforCofincomeRepository;
this._perforAgsecondallotRepository = perforAgsecondallotRepository;
}
/// <summary>
......@@ -306,20 +309,21 @@ public List<res_baiscnorm> GetBaiscnorm(int allotId)
/// <param name="accountId"></param>
/// <param name="type"></param>
/// <returns></returns>
public DeptDataDetails DeptDetail(int allotId, int accountId, int type)
public DeptDataDetails DeptDetail(int accountId)
{
var sheetType = new List<int> { (int)SheetType.Income, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload };
var doctor = perforResaccountRepository.GetEntity(t => t.UnitType == type && t.AllotID == allotId && t.ID == accountId);
string typeValue = EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Value == type).Name.ToString();
var doctor = perforResaccountRepository.GetEntity(t => t.ID == accountId);
string typeValue = EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Value == doctor.UnitType).Name.ToString();
DeptDataDetails deptDetails = new DeptDataDetails
{
Pandect = Mapper.Map<PerDataAccountBaisc>(doctor),
Detail = new List<DetailDtos>()
};
int type = doctor.UnitType.Value;
if (type == (int)UnitType.专家组 || type == (int)UnitType.其他组)
type = 1;
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == allotId && t.UnitType == type && t.AccountingUnit == doctor.AccountingUnit);
var persheet = _perforPerSheetRepository.GetEntities(t => t.AllotID == allotId);
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == doctor.AllotID && t.UnitType == type && t.AccountingUnit == doctor.AccountingUnit);
var persheet = _perforPerSheetRepository.GetEntities(t => t.AllotID == doctor.AllotID);
//科室经济
var sheetEconomic = persheet.FirstOrDefault(t => t.SheetType == (int)SheetType.ComputeEconomic);
......@@ -353,5 +357,18 @@ public DeptDataDetails DeptDetail(int allotId, int accountId, int type)
}
return deptDetails;
}
public int GetAccountId(int secondId)
{
var second = _perforAgsecondallotRepository.GetEntity(t => t.Id == secondId);
if (second != null)
{
var unitType = EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == second.UnitType);
var account = perforResaccountRepository.GetEntity(t => t.AllotID == second.AllotId && t.UnitType == unitType.Value && t.Department == second.Department);
return account?.ID ?? 0;
}
return 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