Commit 5231f4b6 by 李承祥

获取科室详情参数修改

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