Commit 06d1887e by lcx

特殊核算 角色相关数据调整

parent d48c18ad
...@@ -110,7 +110,7 @@ public ApiResponse SelfInfo() ...@@ -110,7 +110,7 @@ public ApiResponse SelfInfo()
user.Role = _roleService.GetUserRole(user.UserID); user.Role = _roleService.GetUserRole(user.UserID);
user.Hospital = _hospitalService.GetUserHopital(user.UserID); user.Hospital = _hospitalService.GetUserHopital(user.UserID);
int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole }; int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole };
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false; user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false;
return new ApiResponse(ResponseType.OK, user); return new ApiResponse(ResponseType.OK, user);
} }
......
...@@ -37,7 +37,7 @@ public class ComputeController : Controller ...@@ -37,7 +37,7 @@ public class ComputeController : Controller
/// <returns></returns> /// <returns></returns>
[Route("getcompute")] [Route("getcompute")]
[HttpPost] [HttpPost]
public ApiResponse GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody]ComputerRequest request) public ApiResponse GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -53,7 +53,7 @@ public ApiResponse GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody] ...@@ -53,7 +53,7 @@ public ApiResponse GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody]
/// <returns></returns> /// <returns></returns>
[Route("getspecial")] [Route("getspecial")]
[HttpPost] [HttpPost]
public ApiResponse<List<res_specialunit>> GetSpecial([FromBody]ComputerRequest request) public ApiResponse<List<res_specialunit>> GetSpecial([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -69,7 +69,7 @@ public ApiResponse<List<res_specialunit>> GetSpecial([FromBody]ComputerRequest r ...@@ -69,7 +69,7 @@ public ApiResponse<List<res_specialunit>> GetSpecial([FromBody]ComputerRequest r
/// <returns></returns> /// <returns></returns>
[Route("getdoctordata")] [Route("getdoctordata")]
[HttpPost] [HttpPost]
public ApiResponse<List<DeptResponse>> GetDoctor([FromBody]ComputerRequest request) public ApiResponse<List<DeptResponse>> GetDoctor([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -85,7 +85,7 @@ public ApiResponse<List<DeptResponse>> GetDoctor([FromBody]ComputerRequest reque ...@@ -85,7 +85,7 @@ public ApiResponse<List<DeptResponse>> GetDoctor([FromBody]ComputerRequest reque
/// <returns></returns> /// <returns></returns>
[Route("getnursedata")] [Route("getnursedata")]
[HttpPost] [HttpPost]
public ApiResponse<List<DeptResponse>> GetNurse([FromBody]ComputerRequest request) public ApiResponse<List<DeptResponse>> GetNurse([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -101,7 +101,7 @@ public ApiResponse<List<DeptResponse>> GetNurse([FromBody]ComputerRequest reques ...@@ -101,7 +101,7 @@ public ApiResponse<List<DeptResponse>> GetNurse([FromBody]ComputerRequest reques
/// <returns></returns> /// <returns></returns>
[Route("getotherdata")] [Route("getotherdata")]
[HttpPost] [HttpPost]
public ApiResponse<List<DeptResponse>> GetOther([FromBody]ComputerRequest request) public ApiResponse<List<DeptResponse>> GetOther([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -117,7 +117,7 @@ public ApiResponse<List<DeptResponse>> GetOther([FromBody]ComputerRequest reques ...@@ -117,7 +117,7 @@ public ApiResponse<List<DeptResponse>> GetOther([FromBody]ComputerRequest reques
/// <returns></returns> /// <returns></returns>
[Route("gethosdata")] [Route("gethosdata")]
[HttpPost] [HttpPost]
public ApiResponse<List<DeptResponse>> GetAdminPerformance([FromBody]ComputerRequest request) public ApiResponse<List<DeptResponse>> GetAdminPerformance([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -133,23 +133,30 @@ public ApiResponse<List<DeptResponse>> GetAdminPerformance([FromBody]ComputerReq ...@@ -133,23 +133,30 @@ public ApiResponse<List<DeptResponse>> GetAdminPerformance([FromBody]ComputerReq
/// <returns></returns> /// <returns></returns>
[Route("deptdetail")] [Route("deptdetail")]
[HttpPost] [HttpPost]
public ApiResponse<DeptDataDetails> DeptDetail([FromBody]DeptDetailRequest request) public ApiResponse DeptDetail([FromBody] DeptDetailRequest request)
{ {
//var allot = _allotService.GetAllot(request.AllotId); ag_secondallot second = null;
//if (null == allot)
// throw new PerformanceException("当前绩效记录不存在");
//DeptDetailResponse response = _computeService.GetDepartmentDetail(request.AllotId, request.AccountID, request.Type);
if (request.AccountID == 0) if (request.AccountID == 0)
{ {
if (request.SecondId == 0) if (request.SecondId == 0)
return new ApiResponse<DeptDataDetails>(ResponseType.ParameterError, "参数 AccountID或SecondId 无效"); return new ApiResponse(ResponseType.ParameterError, "参数 AccountID或SecondId 无效");
else else
request.AccountID = _computeService.GetAccountId(request.SecondId); {
second = _computeService.GetAccountId(request.SecondId, out int accountId);
request.AccountID = accountId;
}
} }
var response = _computeService.DeptDetail(request.AccountID); if (second != null && second.UnitType == UnitType.特殊核算组.ToString())
return new ApiResponse<DeptDataDetails>(ResponseType.OK, response); {
var response = _computeService.SpecialDeptDetail(second);
return new ApiResponse(ResponseType.OK, response);
}
else
{
var response = _computeService.DeptDetail(request.AccountID);
return new ApiResponse(ResponseType.OK, response);
}
} }
/// <summary> /// <summary>
...@@ -159,7 +166,7 @@ public ApiResponse<DeptDataDetails> DeptDetail([FromBody]DeptDetailRequest reque ...@@ -159,7 +166,7 @@ public ApiResponse<DeptDataDetails> DeptDetail([FromBody]DeptDetailRequest reque
/// <returns></returns> /// <returns></returns>
[Route("allcompute")] [Route("allcompute")]
[HttpPost] [HttpPost]
public ApiResponse AllCompute([FromBody]ComputerRequest request) public ApiResponse AllCompute([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -176,7 +183,7 @@ public ApiResponse AllCompute([FromBody]ComputerRequest request) ...@@ -176,7 +183,7 @@ public ApiResponse AllCompute([FromBody]ComputerRequest request)
/// <returns></returns> /// <returns></returns>
[Route("allcompute/management")] [Route("allcompute/management")]
[HttpPost] [HttpPost]
public ApiResponse AllManageCompute([FromBody]ComputerRequest request) public ApiResponse AllManageCompute([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
...@@ -210,7 +217,7 @@ public ApiResponse UpdateRealfee([CustomizeValidator(RuleSet = "UpdateReal"), Fr ...@@ -210,7 +217,7 @@ public ApiResponse UpdateRealfee([CustomizeValidator(RuleSet = "UpdateReal"), Fr
/// <returns></returns> /// <returns></returns>
[Route("getbaiscnorm")] [Route("getbaiscnorm")]
[HttpPost] [HttpPost]
public ApiResponse GetBaiscnorm([FromBody]ComputerRequest request) public ApiResponse GetBaiscnorm([FromBody] ComputerRequest request)
{ {
var allot = _allotService.GetAllot(request.AllotId); var allot = _allotService.GetAllot(request.AllotId);
if (null == allot) if (null == allot)
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
"NurseRole": "3", "NurseRole": "3",
//科主任二次绩效管理员 //科主任二次绩效管理员
"DirectorRole": "4", "DirectorRole": "4",
//特殊科室二次绩效管理员
"SpecialRole": "9",
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com", "AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
"HttpPath": "http://testjx.suvalue.com:81" "HttpPath": "http://testjx.suvalue.com:81"
}, },
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
"NurseRole": "3", "NurseRole": "3",
//科主任二次绩效管理员 //科主任二次绩效管理员
"DirectorRole": "4", "DirectorRole": "4",
//特殊科室二次绩效管理员
"SpecialRole": "9",
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com", "AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
"HttpPath": "http://testjx.suvalue.com:81", "HttpPath": "http://testjx.suvalue.com:81",
"SwaggerEndpoint": "/swagger/v1/swagger.json" "SwaggerEndpoint": "/swagger/v1/swagger.json"
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
"NurseRole": "3", "NurseRole": "3",
//科主任二次绩效管理员 //科主任二次绩效管理员
"DirectorRole": "4", "DirectorRole": "4",
//特殊科室二次绩效管理员
"SpecialRole": "9",
//邮件指定接收人 //邮件指定接收人
"Receiver": [ "chengxiang.li@suvalue.com", "486035085@qq.com" ], "Receiver": [ "chengxiang.li@suvalue.com", "486035085@qq.com" ],
"AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com", "AbsolutePath": "E:\\wwwroot\\testjx.suvalue.com",
......
...@@ -44,6 +44,11 @@ ...@@ -44,6 +44,11 @@
科主任二次绩效管理员 科主任二次绩效管理员
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.AppSettings.Application.SpecialRole">
<summary>
特殊科室二次绩效管理员
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.Application.Receiver"> <member name="P:Performance.DtoModels.AppSettings.Application.Receiver">
<summary> <summary>
邮件指定接收人 邮件指定接收人
...@@ -2316,6 +2321,15 @@ ...@@ -2316,6 +2321,15 @@
实发绩效 实发绩效
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.DeptDataDetails`1.Pandect">
<summary> 概览</summary>
</member>
<member name="P:Performance.DtoModels.DeptDataDetails`1.Detail">
<summary> 收入明细 </summary>
</member>
<member name="P:Performance.DtoModels.DeptDataDetails`1.ShowFormula">
<summary> 0 不显示 1 显示 </summary>
</member>
<member name="P:Performance.DtoModels.DeptDataDetails.Pandect"> <member name="P:Performance.DtoModels.DeptDataDetails.Pandect">
<summary> 概览</summary> <summary> 概览</summary>
</member> </member>
...@@ -2325,18 +2339,21 @@ ...@@ -2325,18 +2339,21 @@
<member name="P:Performance.DtoModels.DeptDataDetails.ShowFormula"> <member name="P:Performance.DtoModels.DeptDataDetails.ShowFormula">
<summary> 0 不显示 1 显示 </summary> <summary> 0 不显示 1 显示 </summary>
</member> </member>
<member name="P:Performance.DtoModels.DetailDtos.ItemName"> <member name="P:Performance.DtoModels.DetailDtos`1.ItemName">
<summary> 收入项名称 </summary> <summary> 收入项名称 </summary>
</member> </member>
<member name="P:Performance.DtoModels.DetailDtos.IncomeType"> <member name="P:Performance.DtoModels.DetailDtos`1.IncomeType">
<summary> 1、收入 2、支出 3、工作量 </summary> <summary> 1、收入 2、支出 3、工作量 4、特殊科室 </summary>
</member> </member>
<member name="P:Performance.DtoModels.DetailDtos.Amount"> <member name="P:Performance.DtoModels.DetailDtos`1.Amount">
<summary> 金额 </summary> <summary> 金额 </summary>
</member> </member>
<member name="P:Performance.DtoModels.DetailDtos.Items"> <member name="P:Performance.DtoModels.DetailDtos`1.Items">
<summary> 详情 </summary> <summary> 详情 </summary>
</member> </member>
<member name="P:Performance.DtoModels.DetailDtos`1.GroupBasis">
<summary> 分组依据 </summary>
</member>
<member name="P:Performance.DtoModels.DetailModule.ItemName"> <member name="P:Performance.DtoModels.DetailModule.ItemName">
<summary> 明细项 </summary> <summary> 明细项 </summary>
</member> </member>
...@@ -2349,6 +2366,15 @@ ...@@ -2349,6 +2366,15 @@
<member name="P:Performance.DtoModels.DetailModule.ItemValue"> <member name="P:Performance.DtoModels.DetailModule.ItemValue">
<summary> 结算值 </summary> <summary> 结算值 </summary>
</member> </member>
<member name="P:Performance.DtoModels.DetailModuleExtend.CellValue2">
<summary> 原始值 </summary>
</member>
<member name="P:Performance.DtoModels.DetailModuleExtend.Factor2">
<summary> 系数 </summary>
</member>
<member name="P:Performance.DtoModels.DetailModuleExtend.ItemValue2">
<summary> 结算值 </summary>
</member>
<member name="P:Performance.DtoModels.DeptResponse.ID"> <member name="P:Performance.DtoModels.DeptResponse.ID">
<summary> <summary>
......
...@@ -27,6 +27,10 @@ public class Application ...@@ -27,6 +27,10 @@ public class Application
/// </summary> /// </summary>
public int DirectorRole { get; set; } public int DirectorRole { get; set; }
/// <summary> /// <summary>
/// 特殊科室二次绩效管理员
/// </summary>
public int SpecialRole { get; set; }
/// <summary>
/// 邮件指定接收人 /// 邮件指定接收人
/// </summary> /// </summary>
public string[] Receiver { get; set; } public string[] Receiver { get; set; }
......
...@@ -18,6 +18,18 @@ public class DeptDetail ...@@ -18,6 +18,18 @@ public class DeptDetail
} }
public class DeptDataDetails<T>
{
/// <summary> 概览</summary>
public PerDataAccountBaisc Pandect { get; set; }
/// <summary> 收入明细 </summary>
public List<DetailDtos<T>> Detail { get; set; }
/// <summary> 0 不显示 1 显示 </summary>
public int ShowFormula { get; set; }
}
public class DeptDataDetails public class DeptDataDetails
{ {
/// <summary> 概览</summary> /// <summary> 概览</summary>
...@@ -30,19 +42,27 @@ public class DeptDataDetails ...@@ -30,19 +42,27 @@ public class DeptDataDetails
public int ShowFormula { get; set; } public int ShowFormula { get; set; }
} }
public class DetailDtos public class DetailDtos<T>
{ {
/// <summary> 收入项名称 </summary> /// <summary> 收入项名称 </summary>
public string ItemName { get; set; } public string ItemName { get; set; }
/// <summary> 1、收入 2、支出 3、工作量 </summary> /// <summary> 1、收入 2、支出 3、工作量 4、特殊科室 </summary>
public int IncomeType { get; set; } public int IncomeType { get; set; }
/// <summary> 金额 </summary> /// <summary> 金额 </summary>
public decimal Amount { get; set; } public decimal Amount { get; set; }
/// <summary> 详情 </summary> /// <summary> 详情 </summary>
public List<DetailModule> Items { get; set; } public List<T> Items { get; set; }
/// <summary> 分组依据 </summary>
public int GroupBasis { get; set; }
}
public class DetailDtos : DetailDtos<DetailModule>
{
} }
public class DetailModule public class DetailModule
...@@ -59,4 +79,17 @@ public class DetailModule ...@@ -59,4 +79,17 @@ public class DetailModule
/// <summary> 结算值 </summary> /// <summary> 结算值 </summary>
public decimal? ItemValue { get; set; } public decimal? ItemValue { get; set; }
} }
public class DetailModuleExtend : DetailModule
{
/// <summary> 原始值 </summary>
public decimal? CellValue2 { get; set; }
/// <summary> 系数 </summary>
public decimal? Factor2 { get; set; }
/// <summary> 结算值 </summary>
public decimal? ItemValue2 { get; set; }
}
} }
...@@ -513,7 +513,7 @@ public List<res_baiscnorm> GetBaiscnorm(int allotId) ...@@ -513,7 +513,7 @@ 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 accountId) public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
{ {
var doctor = perforResaccountRepository.GetEntity(t => t.ID == accountId); var doctor = perforResaccountRepository.GetEntity(t => t.ID == accountId);
...@@ -550,13 +550,18 @@ public DeptDataDetails DeptDetail(int accountId) ...@@ -550,13 +550,18 @@ public DeptDataDetails DeptDetail(int accountId)
else if (type == (int)UnitType.其他护理组) else if (type == (int)UnitType.其他护理组)
type = 2; type = 2;
int groupbasis = 1;
string single = "";
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 };
foreach (var stype in sheetType) foreach (var stype in sheetType)
{ {
if (type == 3 && stype == (int)SheetType.Workload) type = 1; if (type == 3 && stype == (int)SheetType.Workload) type = 1;
foreach (var sheet in persheet.Where(t => t.SheetType == stype)) foreach (var sheet in persheet.Where(t => t.SheetType == stype))
{ {
if (single != "" && sheet.SheetName.Substring(0, 3) != single)
groupbasis += 1;
single = sheet.SheetName.Substring(0, 3);
var sheetName = reg.Replace(sheet.SheetName, "", 5).Replace(".", "").Replace(" ", ""); var sheetName = reg.Replace(sheet.SheetName, "", 5).Replace(".", "").Replace(" ", "");
var sheetData = basicData.Where(t => t.SheetID == sheet.ID && t.UnitType == type).ToList(); var sheetData = basicData.Where(t => t.SheetID == sheet.ID && t.UnitType == type).ToList();
if (sheetData == null || !sheetData.Any()) continue; if (sheetData == null || !sheetData.Any()) continue;
...@@ -569,6 +574,7 @@ public DeptDataDetails DeptDetail(int accountId) ...@@ -569,6 +574,7 @@ public DeptDataDetails DeptDetail(int accountId)
IncomeType = sheet.SheetType == (int)SheetType.Expend ? 2 : sheet.SheetType == (int)SheetType.Workload ? 3 : 1, IncomeType = sheet.SheetType == (int)SheetType.Expend ? 2 : sheet.SheetType == (int)SheetType.Workload ? 3 : 1,
Amount = (sheet.SheetType == (int)SheetType.Workload ? doctor.WorkloadFee Amount = (sheet.SheetType == (int)SheetType.Workload ? doctor.WorkloadFee
: economic.FirstOrDefault(t => t.ItemName.Contains(sheetName) && t.UnitType == type)?.ItemValue) ?? 0m, : economic.FirstOrDefault(t => t.ItemName.Contains(sheetName) && t.UnitType == type)?.ItemValue) ?? 0m,
GroupBasis = groupbasis,
}; };
var items = sheetData?.Select(t => new DetailModule var items = sheetData?.Select(t => new DetailModule
...@@ -601,20 +607,143 @@ public DeptDataDetails DeptDetail(int accountId) ...@@ -601,20 +607,143 @@ public DeptDataDetails DeptDetail(int accountId)
deptDetails.Detail.Add(item); deptDetails.Detail.Add(item);
} }
} }
return MergeDetails(deptDetails);
//return deptDetails;
}
private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details)
{
if (details == null) return new DeptDataDetails<DetailModuleExtend>();
var result = new DeptDataDetails<DetailModuleExtend>()
{
ShowFormula = details.ShowFormula,
Pandect = details.Pandect,
Detail = new List<DetailDtos<DetailModuleExtend>>(),
};
if (details.Detail == null || !details.Detail.Any(t => t.IncomeType == 1)) return result;
foreach (var groupbasis in details.Detail.Select(t => t.GroupBasis).Distinct())
{
var items = new List<DetailModuleExtend>();
var data = details.Detail.Where(t => t.GroupBasis == groupbasis).ToList();
if (data.Count() > 1)
{
var depts = new List<string>();
data.ForEach(t =>
{
depts.AddRange(t.Items.Select(o => o.ItemName));
});
var billing = data.FirstOrDefault(t => t.ItemName.Replace("就诊", "开单").IndexOf("开单") > -1);
var execute = data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1);
foreach (var dept in depts.Distinct().OrderBy(t => t))
{
var item1 = billing.Items.FirstOrDefault(t => t.ItemName == dept);
var item2 = execute.Items.FirstOrDefault(t => t.ItemName == dept);
items.Add(new DetailModuleExtend
{
ItemName = dept,
ItemValue = item1?.ItemValue,
ItemValue2 = item2?.ItemValue,
CellValue = item1?.CellValue,
CellValue2 = item2?.CellValue,
Factor = item1?.Factor,
Factor2 = item2?.Factor,
});
}
}
else
{
items = data.First().Items.Select(t => new DetailModuleExtend
{
ItemName = t.ItemName,
ItemValue = t.ItemValue,
CellValue = t.CellValue,
Factor = t.Factor,
}).ToList();
}
result.Detail.Add(new DetailDtos<DetailModuleExtend>
{
ItemName = data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1) is null ? data.First().ItemName :
data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1).ItemName?.Replace("执行", "开单/执行"),
IncomeType = data.First().IncomeType,
Amount = data.First().Amount,
GroupBasis = groupbasis,
Items = items
});
}
return result;
}
public DeptDataDetails SpecialDeptDetail(ag_secondallot second)
{
var allot = perforPerallotRepository.GetEntity(t => t.ID == second.AllotId);
var special = _perforResspecialunitRepository.GetEntities(t => t.AllotID == second.AllotId && t.Department == second.Department);
if (special == null || !special.Any())
return new DeptDataDetails();
DeptDataDetails deptDetails = new DeptDataDetails
{
ShowFormula = allot.ShowFormula,
Pandect = new PerDataAccountBaisc
{
UnitType = second.UnitType,
AccountingUnit = second.Department,
Department = second.Department,
ScoringAverage = special.First().ScoringAverage.Value,
OtherPerfor1 = special.First().OtherPerfor.Value,
AdjustFactor = special.First().Adjust.Value,
Avg = special.First().Avg.Value,
RealGiveFee = special.First().RealGiveFee.Value,
Number = special.First().Number.Value,
PerforFee = special.First().GiveFee.Value,
PerforTotal = special.First().ResultsTotalFee.Value,
Income = special.First().ResultsTotalFee.Value,
Extra = special.First().Punishment.Value,
},
Detail = new List<DetailDtos>(),
};
var detail = new DetailDtos
{
ItemName = "特殊核算单元绩效测算表",
IncomeType = 4,
Amount = special.First().ResultsTotalFee.Value,
Items = new List<DetailModule>(),
GroupBasis = 1,
};
foreach (var item in special)
{
detail.Items.Add(new DetailModule
{
ItemName = item.QuantitativeIndicators,
CellValue = item.Quantity,
Factor = item.QuantitativeIndicatorsValue,
ItemValue = Math.Round(item.Quantity * item.QuantitativeIndicatorsValue ?? 0, 2)
});
}
deptDetails.Detail.Add(detail);
return deptDetails; return deptDetails;
} }
public int GetAccountId(int secondId) public ag_secondallot GetAccountId(int secondId, out int accountId)
{ {
accountId = 0;
var second = _perforAgsecondallotRepository.GetEntity(t => t.Id == secondId); var second = _perforAgsecondallotRepository.GetEntity(t => t.Id == secondId);
if (second != null) if (second != null)
{ {
var unitType = EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == second.UnitType); 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); var account = perforResaccountRepository.GetEntity(t => t.AllotID == second.AllotId && t.UnitType == unitType.Value && t.Department == second.Department);
return account?.ID ?? 0; if (account == null && second.UnitType != UnitType.特殊核算组.ToString())
throw new PerformanceException("科室信息错误");
accountId = account?.ID ?? 0;
} }
return 0; return second;
} }
} }
} }
...@@ -33,6 +33,7 @@ public class SecondAllotService : IAutoInjection ...@@ -33,6 +33,7 @@ public class SecondAllotService : IAutoInjection
private readonly PerforAgothersourceRepository perforAgothersourceRepository; private readonly PerforAgothersourceRepository perforAgothersourceRepository;
private readonly PerforAgworkloadtypeRepository perforAgworkloadtypeRepository; private readonly PerforAgworkloadtypeRepository perforAgworkloadtypeRepository;
private readonly PerforRoleRepository roleRepository; private readonly PerforRoleRepository roleRepository;
private readonly PerforResspecialunitRepository resspecialunitRepository;
private readonly List<ag_tempitem> tempitems = new List<ag_tempitem>(); private readonly List<ag_tempitem> tempitems = new List<ag_tempitem>();
public SecondAllotService(IOptions<Application> application, public SecondAllotService(IOptions<Application> application,
...@@ -51,7 +52,8 @@ public class SecondAllotService : IAutoInjection ...@@ -51,7 +52,8 @@ public class SecondAllotService : IAutoInjection
PerforCofagainRepository perforCofagainRepository, PerforCofagainRepository perforCofagainRepository,
PerforAgothersourceRepository perforAgothersourceRepository, PerforAgothersourceRepository perforAgothersourceRepository,
PerforAgworkloadtypeRepository perforAgworkloadtypeRepository, PerforAgworkloadtypeRepository perforAgworkloadtypeRepository,
PerforRoleRepository roleRepository) PerforRoleRepository roleRepository,
PerforResspecialunitRepository resspecialunitRepository)
{ {
this.application = application.Value; this.application = application.Value;
this.perforUserRepository = perforUserRepository; this.perforUserRepository = perforUserRepository;
...@@ -70,6 +72,7 @@ public class SecondAllotService : IAutoInjection ...@@ -70,6 +72,7 @@ public class SecondAllotService : IAutoInjection
this.perforAgothersourceRepository = perforAgothersourceRepository; this.perforAgothersourceRepository = perforAgothersourceRepository;
this.perforAgworkloadtypeRepository = perforAgworkloadtypeRepository; this.perforAgworkloadtypeRepository = perforAgworkloadtypeRepository;
this.roleRepository = roleRepository; this.roleRepository = roleRepository;
this.resspecialunitRepository = resspecialunitRepository;
this.tempitems = perforAgtempitemRepository.GetEntities(); this.tempitems = perforAgtempitemRepository.GetEntities();
} }
...@@ -99,6 +102,8 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -99,6 +102,8 @@ public List<SecondListResponse> GetSecondList(int userId)
exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.UnitType)); exp = exp.And(t => new List<string> { UnitType.医生组.ToString(), UnitType.医技组.ToString() }.Contains(t.UnitType));
else if (role.Type == application.NurseRole) else if (role.Type == application.NurseRole)
exp = exp.And(t => t.UnitType == UnitType.护理组.ToString()); exp = exp.And(t => t.UnitType == UnitType.护理组.ToString());
else if (role.Type == application.SpecialRole)
exp = exp.And(t => t.UnitType == UnitType.特殊核算组.ToString());
var secondList = perforAgsecondallotRepository.GetEntities(exp); var secondList = perforAgsecondallotRepository.GetEntities(exp);
//各科室绩效分配结果 //各科室绩效分配结果
...@@ -106,6 +111,8 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -106,6 +111,8 @@ public List<SecondListResponse> GetSecondList(int userId)
//取得未生成二次绩效的绩效id //取得未生成二次绩效的绩效id
var exceptListId = secondList == null ? allotListId : allotListId.Except(secondList.Select(t => t.AllotId.Value)); var exceptListId = secondList == null ? allotListId : allotListId.Except(secondList.Select(t => t.AllotId.Value));
var specialList = resspecialunitRepository.GetEntities(t => allotListId.Contains(t.AllotID.Value) && t.Department == user.Department);
#region 初始化二次绩效 #region 初始化二次绩效
List<ag_secondallot> newSecond = new List<ag_secondallot>(); List<ag_secondallot> newSecond = new List<ag_secondallot>();
foreach (var item in exceptListId) foreach (var item in exceptListId)
...@@ -114,12 +121,15 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -114,12 +121,15 @@ public List<SecondListResponse> GetSecondList(int userId)
if (allot == null) continue; if (allot == null) continue;
res_account account = null; res_account account = null;
res_specialunit special = null;
if (role.Type == application.DirectorRole) if (role.Type == application.DirectorRole)
account = accountList.FirstOrDefault(t => t.AllotID == item && (t.UnitType == (int)UnitType.医生组 || t.UnitType == (int)UnitType.医技组)); account = accountList?.FirstOrDefault(t => t.AllotID == item && (t.UnitType == (int)UnitType.医生组 || t.UnitType == (int)UnitType.医技组));
else if (role.Type == application.NurseRole) else if (role.Type == application.NurseRole)
account = accountList.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.护理组); account = accountList?.FirstOrDefault(t => t.AllotID == item && t.UnitType == (int)UnitType.护理组);
else if (role.Type == application.SpecialRole)
special = specialList?.FirstOrDefault(t => t.AllotID == item);
if (account == null) continue; if (account == null && special == null) continue;
var second = new ag_secondallot var second = new ag_secondallot
{ {
...@@ -127,8 +137,8 @@ public List<SecondListResponse> GetSecondList(int userId) ...@@ -127,8 +137,8 @@ public List<SecondListResponse> GetSecondList(int userId)
Year = allot.Year, Year = allot.Year,
Month = allot.Month, Month = allot.Month,
Department = user.Department, Department = user.Department,
UnitType = ((UnitType)account.UnitType).ToString(), UnitType = role.Type == application.SpecialRole ? UnitType.特殊核算组.ToString() : ((UnitType)account.UnitType).ToString(),
RealGiveFee = account.RealGiveFee, RealGiveFee = role.Type == application.SpecialRole ? special.RealGiveFee : account.RealGiveFee,
Status = 1 Status = 1
}; };
newSecond.Add(second); newSecond.Add(second);
......
...@@ -26,6 +26,7 @@ public class UserService : IAutoInjection ...@@ -26,6 +26,7 @@ public class UserService : IAutoInjection
private PerforImemployeeRepository _employeeRepository; private PerforImemployeeRepository _employeeRepository;
private PerforPerallotRepository _perforPerallotRepository; private PerforPerallotRepository _perforPerallotRepository;
private PerforImaccountbasicRepository _perforImaccountbasicRepository; private PerforImaccountbasicRepository _perforImaccountbasicRepository;
private PerforImspecialunitRepository _imspecialunitRepository;
public UserService(IOptions<Application> application, public UserService(IOptions<Application> application,
PerforSmsRepository smsRepository, PerforSmsRepository smsRepository,
PerforUserRepository userRepository, PerforUserRepository userRepository,
...@@ -35,7 +36,8 @@ public class UserService : IAutoInjection ...@@ -35,7 +36,8 @@ public class UserService : IAutoInjection
PerforUserroleRepository userroleRepository, PerforUserroleRepository userroleRepository,
PerforImemployeeRepository employeeRepository, PerforImemployeeRepository employeeRepository,
PerforPerallotRepository perforPerallotRepository, PerforPerallotRepository perforPerallotRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository) PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforImspecialunitRepository imspecialunitRepository)
{ {
this.application = application.Value; this.application = application.Value;
this._userRepository = userRepository; this._userRepository = userRepository;
...@@ -47,6 +49,7 @@ public class UserService : IAutoInjection ...@@ -47,6 +49,7 @@ public class UserService : IAutoInjection
this._employeeRepository = employeeRepository; this._employeeRepository = employeeRepository;
this._perforPerallotRepository = perforPerallotRepository; this._perforPerallotRepository = perforPerallotRepository;
this._perforImaccountbasicRepository = perforImaccountbasicRepository; this._perforImaccountbasicRepository = perforImaccountbasicRepository;
this._imspecialunitRepository = imspecialunitRepository;
} }
/// <summary> /// <summary>
...@@ -341,6 +344,12 @@ public List<TitleValue> Department(int hospitalID) ...@@ -341,6 +344,12 @@ public List<TitleValue> Department(int hospitalID)
var department = _perforImaccountbasicRepository.GetEntities(t => !string.IsNullOrEmpty(t.DoctorAccountingUnit) && idList.Contains(t.AllotID.Value)).Select(t => t.DoctorAccountingUnit); var department = _perforImaccountbasicRepository.GetEntities(t => !string.IsNullOrEmpty(t.DoctorAccountingUnit) && idList.Contains(t.AllotID.Value)).Select(t => t.DoctorAccountingUnit);
if (department != null && department.Count() > 0) if (department != null && department.Count() > 0)
result.AddRange(department); result.AddRange(department);
// 特殊科室
department = _imspecialunitRepository.GetEntities(t => !string.IsNullOrEmpty(t.AccountingUnit) && idList.Contains(t.AllotID.Value)).Select(t => t.AccountingUnit);
if (department != null && department.Count() > 0)
result.AddRange(department);
if (result != null && result.Any()) if (result != null && result.Any())
{ {
result = result.Distinct().OrderBy(t => t).ToList(); result = result.Distinct().OrderBy(t => t).ToList();
......
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