Commit 791c5481 by 纪旭 韦

Merge branch 'develop' of http://192.168.18.110:8880/zry/performance into develop

parents 5d13d9c6 96a30536
...@@ -268,40 +268,46 @@ public ApiResponse Audit(int allotid) ...@@ -268,40 +268,46 @@ public ApiResponse Audit(int allotid)
/// <returns></returns> /// <returns></returns>
[Route("apr/getlist")] [Route("apr/getlist")]
[HttpPost] [HttpPost]
public ApiResponse GetAprList([FromBody] AllotIdRequest request) public ApiResponse GetAprList([FromBody] AprAmountAuditRequest request)
{ {
if (request.AllotId == 0) if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprList(request.AllotId, claim.GetUserId()); var employee = employeeService.GetAprByTypeInDepartment(request.AllotId, request.TypeInDepartment, request.CreateDate);
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
} }
/// <summary> /// <summary>
/// 医院其他绩效审核 /// 医院其他绩效审核
/// </summary> /// </summary>
/// <param name="isAudit">0 其他绩效列表 1 审核列表</param>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
[Route("apr/getdeptlist")] [Route("apr/getdeptlist/{isAudit}")]
[HttpPost] [HttpPost]
public ApiResponse GetAprGroupList([FromBody] AllotIdRequest request) public ApiResponse GetAprGroupList([FromRoute] int isAudit, [FromBody] AllotIdRequest request)
{ {
if (request.AllotId == 0) if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprList(request.AllotId, claim.GetUserId()); var employee = employeeService.GetAprList(request.AllotId, claim.GetUserId(), isAudit);
if (employee == null || !employee.Any()) if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "" }) var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "", t.CreateDate })
.Select(t => new OhterAmountAuditResponse .Select(t => new OhterAmountAuditResponse
{ {
TypeInDepartment = t.Key.TypeInDepartment, TypeInDepartment = t.Key.TypeInDepartment,
CreateDate = t.Key.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
Amount = t.Sum(s => s.Amount ?? 0), Amount = t.Sum(s => s.Amount ?? 0),
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status, Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
PerforType = string.Join("/", t.Select(w => w.PerforType).Distinct()),
AuditTime = t.Any(s => s.Status == 2) ? "" : t.Max(w => w.AuditTime)?.ToString("yyyy-MM-dd HH:mm:ss"), AuditTime = t.Any(s => s.Status == 2) ? "" : t.Max(w => w.AuditTime)?.ToString("yyyy-MM-dd HH:mm:ss"),
Remark = t.Any(s => !s.MarkStatus.HasValue) ? "" : $"已审计{t.Max(w => w.MarkTime)?.ToString("(yyyy-MM-dd HH:mm:ss)")}" Remark = t.Any(s => !s.MarkStatus.HasValue) ? "" : $"已审计{t.Max(w => w.MarkTime)?.ToString("(yyyy-MM-dd HH:mm:ss)")}",
ShowCommit = t.FirstOrDefault(t => t.CreateUser.HasValue).CreateUser == claim.GetUserId(),
}); });
if (result != null && result.Any())
result = result.OrderByDescending(o => o.CreateDate).ToList();
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
...@@ -312,12 +318,12 @@ public ApiResponse GetAprGroupList([FromBody] AllotIdRequest request) ...@@ -312,12 +318,12 @@ public ApiResponse GetAprGroupList([FromBody] AllotIdRequest request)
/// <returns></returns> /// <returns></returns>
[Route("apr/getdeptdetail")] [Route("apr/getdeptdetail")]
[HttpPost] [HttpPost]
public ApiResponse GetAprDetail([FromBody] per_apr_amount request) public ApiResponse GetAprDetail([FromBody] AprAmountAuditRequest request)
{ {
if (request.AllotId == 0) if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprList(request.AllotId, request.TypeInDepartment); var employee = employeeService.GetAprList(request.AllotId, request.TypeInDepartment, date: request.CreateDate);
if (employee == null || !employee.Any()) if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
...@@ -393,6 +399,21 @@ public ApiResponse DeleteApr([FromBody] IdRequest request) ...@@ -393,6 +399,21 @@ public ApiResponse DeleteApr([FromBody] IdRequest request)
} }
/// <summary> /// <summary>
/// 医院其他绩效提交、撤销
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("apr/commit")]
public ApiResponse CommitResult([FromBody] AprAmountAuditRequest request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var result = employeeService.CommitApr(request.AllotId, request.TypeInDepartment, request.Status, request.CreateDate);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 医院其他绩效审核;驳回、成功 /// 医院其他绩效审核;驳回、成功
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
...@@ -454,8 +475,10 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -454,8 +475,10 @@ public ApiResponse Import([FromForm] IFormCollection form)
if (!FileHelper.CreateFile(path, bytes)) if (!FileHelper.CreateFile(path, bytes))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败"); return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败");
} }
var result = employeeService.ImpoerAprEmployees(allotid, path, claim.GetUserId()); var result = employeeService.ImportAprEmployees(allotid, path, claim.GetUserId());
return result == "" ? new ApiResponse(ResponseType.OK) : new ApiResponse(ResponseType.ParameterError, result); return result != null && result.Count > 0
? new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", result)
: new ApiResponse(ResponseType.OK);
} }
/// <summary> /// <summary>
...@@ -525,6 +548,19 @@ public ApiResponse AprOverview(int allotId) ...@@ -525,6 +548,19 @@ public ApiResponse AprOverview(int allotId)
}); });
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
/// <summary>
/// 清理该科室录入数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("apr/clear")]
public ApiResponse<List<TitleValue>> ClearAprData([FromBody] AprAmountAuditRequest request)
{
var result = employeeService.ClearAprData(request);
return result ? new ApiResponse<List<TitleValue>>(ResponseType.OK, "删除成功")
: new ApiResponse<List<TitleValue>>(ResponseType.OK, "删除失败");
}
#endregion #endregion
/// <summary> /// <summary>
...@@ -572,40 +608,48 @@ public ApiResponse GetDeptAssessment(int allotId) ...@@ -572,40 +608,48 @@ public ApiResponse GetDeptAssessment(int allotId)
/// <returns></returns> /// <returns></returns>
[Route("apr/hide/getlist")] [Route("apr/hide/getlist")]
[HttpPost] [HttpPost]
public ApiResponse GetAprHideList([FromBody] AllotIdRequest request) public ApiResponse GetAprHideList([FromBody] AprAmountAuditRequest request)
{ {
if (request.AllotId == 0) if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprHideList(request.AllotId, claim.GetUserId()); var employee = employeeService.GetAprHideByTypeInDepartment(request.AllotId, request.TypeInDepartment, request.CreateDate);
if (employee != null && employee.Any())
employee = employee.OrderByDescending(o => o.CreateDate).ToList();
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
} }
/// <summary> /// <summary>
/// 不公示其他绩效审核 /// 不公示其他绩效审核
/// </summary> /// </summary>
/// <param name="isAudit"></param>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
[Route("apr/hide/getdeptlist")] [Route("apr/hide/getdeptlist/{isAudit}")]
[HttpPost] [HttpPost]
public ApiResponse GetAprHideGroupList([FromBody] AllotIdRequest request) public ApiResponse GetAprHideGroupList([FromRoute] int isAudit, [FromBody] AllotIdRequest request)
{ {
if (request.AllotId == 0) if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprHideList(request.AllotId, claim.GetUserId()); var employee = employeeService.GetAprHideList(request.AllotId, claim.GetUserId(), isAudit);
if (employee == null || !employee.Any()) if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "" }) var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "", t.CreateDate })
.Select(t => new OhterAmountAuditResponse .Select(t => new OhterAmountAuditResponse
{ {
TypeInDepartment = t.Key.TypeInDepartment, TypeInDepartment = t.Key.TypeInDepartment,
CreateDate = t.Key.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
Amount = t.Sum(s => s.Amount ?? 0), Amount = t.Sum(s => s.Amount ?? 0),
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status, Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
PerforType = string.Join("/", t.Select(w => w.PerforType).Distinct()),
AuditTime = t.Any(s => s.Status == 2) ? "" : t.Max(w => w.AuditTime)?.ToString("yyyy-MM-dd HH:mm:ss"), AuditTime = t.Any(s => s.Status == 2) ? "" : t.Max(w => w.AuditTime)?.ToString("yyyy-MM-dd HH:mm:ss"),
Remark = t.Any(s => !s.MarkStatus.HasValue) ? "" : $"已审计{t.Max(w => w.MarkTime)?.ToString("(yyyy-MM-dd HH:mm:ss)")}" Remark = t.Any(s => !s.MarkStatus.HasValue) ? "" : $"已审计{t.Max(w => w.MarkTime)?.ToString("(yyyy-MM-dd HH:mm:ss)")}",
ShowCommit = t.FirstOrDefault(t => t.CreateUser.HasValue).CreateUser == claim.GetUserId(),
}); });
if (result != null && result.Any())
result = result.OrderByDescending(o => o.CreateDate).ToList();
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
...@@ -621,7 +665,7 @@ public ApiResponse GetAprHideDetail([FromBody] per_apr_amount request) ...@@ -621,7 +665,7 @@ public ApiResponse GetAprHideDetail([FromBody] per_apr_amount request)
if (request.AllotId == 0) if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!"); return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprHideList(request.AllotId, request.TypeInDepartment); var employee = employeeService.GetAprHideList(request.AllotId, request.TypeInDepartment, date: request.CreateDate);
if (employee == null || !employee.Any()) if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
...@@ -695,6 +739,22 @@ public ApiResponse DeleteAprHide([FromBody] IdRequest request) ...@@ -695,6 +739,22 @@ public ApiResponse DeleteAprHide([FromBody] IdRequest request)
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
/// <summary>
/// 医院其他绩效提交、撤销
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("apr/hide/commit")]
public ApiResponse CommitResultHide([FromBody] AprAmountAuditRequest request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var result = employeeService.CommitAprHide(request.AllotId, request.TypeInDepartment, request.Status, request.CreateDate);
return new ApiResponse(ResponseType.OK);
}
/// <summary> /// <summary>
/// 不公示其他绩效审核;驳回、成功 /// 不公示其他绩效审核;驳回、成功
/// </summary> /// </summary>
...@@ -757,8 +817,10 @@ public ApiResponse ImportAprHide([FromForm] IFormCollection form) ...@@ -757,8 +817,10 @@ public ApiResponse ImportAprHide([FromForm] IFormCollection form)
if (!FileHelper.CreateFile(path, bytes)) if (!FileHelper.CreateFile(path, bytes))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败"); return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败");
} }
employeeService.ImpoerAprHideEmployees(allotid, path, claim.GetUserId()); var result = employeeService.ImportAprHideEmployees(allotid, path, claim.GetUserId());
return new ApiResponse(ResponseType.OK); return result != null && result.Count > 0
? new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", result)
: new ApiResponse(ResponseType.OK);
} }
/// <summary> /// <summary>
...@@ -817,6 +879,19 @@ public ApiResponse AprHideOverview(int allotId) ...@@ -817,6 +879,19 @@ public ApiResponse AprHideOverview(int allotId)
}); });
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
/// <summary>
/// 清理该科室录入不公示数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("apr/hide/clear")]
public ApiResponse<List<TitleValue>> ClearAprHideData([FromBody] AprAmountAuditRequest request)
{
var result = employeeService.ClearAprHideData(request);
return result ? new ApiResponse<List<TitleValue>>(ResponseType.OK, "删除成功")
: new ApiResponse<List<TitleValue>>(ResponseType.OK, "删除失败");
}
#endregion #endregion
/// <summary> /// <summary>
...@@ -916,7 +991,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe ...@@ -916,7 +991,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
[HttpPost] [HttpPost]
public ApiResponse GetGather([FromBody] Gather gather) public ApiResponse GetGather([FromBody] Gather gather)
{ {
if (gather.AllotId <= 0 || string.IsNullOrEmpty(gather.Source) || string.IsNullOrEmpty(gather.Category) || string.IsNullOrEmpty(gather.Department) ) if (gather.AllotId <= 0 || string.IsNullOrEmpty(gather.Source) || string.IsNullOrEmpty(gather.Category) || string.IsNullOrEmpty(gather.Department))
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,source,category,department是否正确"); return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,source,category,department是否正确");
var result = employeeService.GetGather(gather); var result = employeeService.GetGather(gather);
...@@ -955,7 +1030,7 @@ public ApiResponse DeleteGather([FromBody] Gather gather) ...@@ -955,7 +1030,7 @@ public ApiResponse DeleteGather([FromBody] Gather gather)
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,source,category,department是否正确"); return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,source,category,department是否正确");
var result = employeeService.DeleteGather(gather); var result = employeeService.DeleteGather(gather);
if(result) return new ApiResponse(ResponseType.OK, "删除成功"); if (result) return new ApiResponse(ResponseType.OK, "删除成功");
else return new ApiResponse(ResponseType.Fail, "删除失败"); else return new ApiResponse(ResponseType.Fail, "删除失败");
} }
...@@ -970,7 +1045,7 @@ public ApiResponse DeleteGather([FromBody] Gather gather) ...@@ -970,7 +1045,7 @@ public ApiResponse DeleteGather([FromBody] Gather gather)
public ApiResponse AuditGather([FromBody] List<Gather> gather) public ApiResponse AuditGather([FromBody] List<Gather> gather)
{ {
employeeService.AuditGather(gather); employeeService.AuditGather(gather);
return new ApiResponse(ResponseType.OK,""); return new ApiResponse(ResponseType.OK, "");
} }
#endregion #endregion
} }
......
...@@ -1136,21 +1136,22 @@ ...@@ -1136,21 +1136,22 @@
<param name="allotid"></param> <param name="allotid"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprList(Performance.DtoModels.AllotIdRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetAprList(Performance.DtoModels.AprAmountAuditRequest)">
<summary> <summary>
获取医院其他绩效列表 获取医院其他绩效列表
</summary> </summary>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprGroupList(Performance.DtoModels.AllotIdRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetAprGroupList(System.Int32,Performance.DtoModels.AllotIdRequest)">
<summary> <summary>
医院其他绩效审核 医院其他绩效审核
</summary> </summary>
<param name="isAudit">0 其他绩效列表 1 审核列表</param>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprDetail(Performance.EntityModels.per_apr_amount)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetAprDetail(Performance.DtoModels.AprAmountAuditRequest)">
<summary> <summary>
医院其他绩效审核详情 医院其他绩效审核详情
</summary> </summary>
...@@ -1178,6 +1179,12 @@ ...@@ -1178,6 +1179,12 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.CommitResult(Performance.DtoModels.AprAmountAuditRequest)">
<summary>
医院其他绩效提交、撤销
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.AuditResult(Performance.DtoModels.AprAmountAuditRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.AuditResult(Performance.DtoModels.AprAmountAuditRequest)">
<summary> <summary>
医院其他绩效审核;驳回、成功 医院其他绩效审核;驳回、成功
...@@ -1211,6 +1218,13 @@ ...@@ -1211,6 +1218,13 @@
<param name="allotId"></param> <param name="allotId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.ClearAprData(Performance.DtoModels.AprAmountAuditRequest)">
<summary>
清理该科室录入数据
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetEmployeeMessage(Performance.EntityModels.per_apr_amount)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetEmployeeMessage(Performance.EntityModels.per_apr_amount)">
<summary> <summary>
自动获取人员信息 自动获取人员信息
...@@ -1234,17 +1248,18 @@ ...@@ -1234,17 +1248,18 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprHideList(Performance.DtoModels.AllotIdRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetAprHideList(Performance.DtoModels.AprAmountAuditRequest)">
<summary> <summary>
获取不公示其他绩效列表 获取不公示其他绩效列表
</summary> </summary>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprHideGroupList(Performance.DtoModels.AllotIdRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetAprHideGroupList(System.Int32,Performance.DtoModels.AllotIdRequest)">
<summary> <summary>
不公示其他绩效审核 不公示其他绩效审核
</summary> </summary>
<param name="isAudit"></param>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
...@@ -1276,6 +1291,12 @@ ...@@ -1276,6 +1291,12 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.CommitResultHide(Performance.DtoModels.AprAmountAuditRequest)">
<summary>
医院其他绩效提交、撤销
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.AuditResultHide(Performance.DtoModels.AprAmountAuditRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.AuditResultHide(Performance.DtoModels.AprAmountAuditRequest)">
<summary> <summary>
不公示其他绩效审核;驳回、成功 不公示其他绩效审核;驳回、成功
...@@ -1309,6 +1330,13 @@ ...@@ -1309,6 +1330,13 @@
<param name="allotId"></param> <param name="allotId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.ClearAprHideData(Performance.DtoModels.AprAmountAuditRequest)">
<summary>
清理该科室录入不公示数据
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetDeptComparison(Performance.DtoModels.ComparisonPagingRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetDeptComparison(Performance.DtoModels.ComparisonPagingRequest)">
<summary> <summary>
实发绩效比对 实发绩效比对
......
...@@ -1909,6 +1909,15 @@ ...@@ -1909,6 +1909,15 @@
<member name="P:Performance.DtoModels.AprAmountAuditRequest.AllotId"> <member name="P:Performance.DtoModels.AprAmountAuditRequest.AllotId">
<summary> 绩效ID </summary> <summary> 绩效ID </summary>
</member> </member>
<member name="P:Performance.DtoModels.AprAmountAuditRequest.TypeInDepartment">
<summary> 录入科室 </summary>
</member>
<member name="P:Performance.DtoModels.AprAmountAuditRequest.CreateDate">
<summary> 创建时间 </summary>
</member>
<member name="P:Performance.DtoModels.AprAmountAuditRequest.Status">
<summary> 提交 1、撤销 2、提交 </summary>
</member>
<member name="P:Performance.DtoModels.AprAmountAuditRequest.IsPass"> <member name="P:Performance.DtoModels.AprAmountAuditRequest.IsPass">
<summary> 审核结果 1、审核通过 2、驳回 </summary> <summary> 审核结果 1、审核通过 2、驳回 </summary>
</member> </member>
......
...@@ -7,24 +7,30 @@ namespace Performance.DtoModels ...@@ -7,24 +7,30 @@ namespace Performance.DtoModels
{ {
public class AprAmountAuditRequest public class AprAmountAuditRequest
{ {
public class Member
{
public string PersonnelNumber { get; set; }
public string DoctorName { get; set; }
}
/// <summary> 绩效ID </summary> /// <summary> 绩效ID </summary>
public int AllotId { get; set; } public int AllotId { get; set; }
public List<Member> Members { get; set; }
/// <summary> 录入科室 </summary>
public string TypeInDepartment { get; set; }
/// <summary> 创建时间 </summary>
public DateTime CreateDate { get; set; }
/// <summary> 提交 1、撤销 2、提交 </summary>
public int Status { get; set; }
/// <summary> 审核结果 1、审核通过 2、驳回 </summary> /// <summary> 审核结果 1、审核通过 2、驳回 </summary>
public int IsPass { get; set; } public int IsPass { get; set; }
/// <summary> 备注 </summary> /// <summary> 备注 </summary>
public string Remark { get; set; } public string Remark { get; set; }
public List<Member> Members { get; set; }
} }
public class AprAmountAuditRequestValidator : AbstractValidator<AprAmountAuditRequest>
{ public class Member
public AprAmountAuditRequestValidator()
{ {
RuleFor(x => x.IsPass).NotNull().NotEmpty().InclusiveBetween(1, 2); public string PersonnelNumber { get; set; }
} public string DoctorName { get; set; }
} }
} }
...@@ -11,7 +11,10 @@ public class OhterAmountAuditResponse ...@@ -11,7 +11,10 @@ public class OhterAmountAuditResponse
public string TypeInDepartment { get; set; } public string TypeInDepartment { get; set; }
public decimal Amount { get; set; } public decimal Amount { get; set; }
public int? Status { get; set; } public int? Status { get; set; }
public string CreateDate { get; set; }
public string PerforType { get; set; }
public string AuditTime { get; set; } public string AuditTime { get; set; }
public string Remark { get; set; } public string Remark { get; set; }
public bool ShowCommit { get; set; }
} }
} }
...@@ -74,7 +74,7 @@ public class per_apr_amount ...@@ -74,7 +74,7 @@ public class per_apr_amount
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<DateTime> CreateDate { get; set; } public DateTime CreateDate { get; set; }
/// <summary> /// <summary>
/// ///
......
...@@ -69,7 +69,7 @@ public class per_apr_amount_hide ...@@ -69,7 +69,7 @@ public class per_apr_amount_hide
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<DateTime> CreateDate { get; set; } public DateTime CreateDate { get; set; }
/// <summary> /// <summary>
/// ///
......
...@@ -64,7 +64,7 @@ public partial class PerforPerapramountRepository : PerforRepository<per_apr_amo ...@@ -64,7 +64,7 @@ public partial class PerforPerapramountRepository : PerforRepository<per_apr_amo
//} //}
public List<view_per_apr_amount> GetFullAmount(int? allotId, int? status, string typeInDepartment = "") public List<view_per_apr_amount> GetFullAmount(int? allotId, int? status, string typeInDepartment = "", DateTime? date = null)
{ {
string sql = "select AllotId, PersonnelNumber, Trim(AccountingUnit) AccountingUnit, UnitType, DoctorName, PerforType, Amount, TypeInDepartment, Status, Remark from view_other_amount where ifnull(amount,0)<>0 "; string sql = "select AllotId, PersonnelNumber, Trim(AccountingUnit) AccountingUnit, UnitType, DoctorName, PerforType, Amount, TypeInDepartment, Status, Remark from view_other_amount where ifnull(amount,0)<>0 ";
...@@ -85,6 +85,11 @@ public List<view_per_apr_amount> GetFullAmount(int? allotId, int? status, string ...@@ -85,6 +85,11 @@ public List<view_per_apr_amount> GetFullAmount(int? allotId, int? status, string
sql += " and typeInDepartment = @typeInDepartment"; sql += " and typeInDepartment = @typeInDepartment";
parameters.Add(name: "typeInDepartment", typeInDepartment); parameters.Add(name: "typeInDepartment", typeInDepartment);
} }
if (date.HasValue)
{
sql += " and createDate = @createDate";
parameters.Add(name: "createDate", date);
}
return DapperQuery<view_per_apr_amount>(sql, parameters).ToList(); return DapperQuery<view_per_apr_amount>(sql, parameters).ToList();
} }
......
...@@ -430,31 +430,37 @@ public bool Audit(int allotId) ...@@ -430,31 +430,37 @@ public bool Audit(int allotId)
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <returns></returns> /// <returns></returns>
public List<per_apr_amount> GetAprList(int allotId, int userId) public List<per_apr_amount> GetAprList(int allotId, int userId, int isAudit)
{ {
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
var list = new List<per_apr_amount>(); Expression<Func<per_apr_amount, bool>> expression = t => t.AllotId == allotId && (t.Amount ?? 0) != 0;
var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 }; var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办、院领导查看所有科室的数据 if (!roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办、院领导查看所有科室的数据
list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0); expression = expression.And(t => t.CreateUser == userId);
else
list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId); if (isAudit == 1)
expression = expression.And(t => new int[] { 2, 3 }.Contains(t.Status ?? 1));
var list = perapramountRepository.GetEntities(expression);
if (list != null && list.Any()) if (list != null && list.Any())
list = list.OrderBy(w => w.IsVerify).ThenBy(t => t.DoctorName).ToList(); list = list.OrderBy(w => w.IsVerify).ThenBy(t => t.DoctorName).ToList();
return list; return list;
} }
/// <summary> /// <summary>
/// 医院其他绩效审核详情 /// 医院其他绩效审核详情
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="department"></param> /// <param name="department"></param>
/// <param name="status"></param>
/// <param name="date"></param>
/// <returns></returns> /// <returns></returns>
public List<view_per_apr_amount> GetAprList(int allotId, string department, int? status = null) public List<view_per_apr_amount> GetAprList(int allotId, string department, int? status = null, DateTime? date = null)
{ {
var list = perapramountRepository.GetFullAmount(allotId, status, department); var list = perapramountRepository.GetFullAmount(allotId, status, department, date);
if (list != null && list.Any()) if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList(); list = list.OrderBy(t => t.DoctorName).ToList();
...@@ -481,8 +487,7 @@ public bool InsertApr(per_apr_amount request, int userId) ...@@ -481,8 +487,7 @@ public bool InsertApr(per_apr_amount request, int userId)
throw new PerformanceException("工号在字典中不存在"); throw new PerformanceException("工号在字典中不存在");
request.TypeInDepartment = GetTypeInDepartment(userId); request.TypeInDepartment = GetTypeInDepartment(userId);
request.Status = 2; request.Status = 1;
request.CreateDate = DateTime.Now;
request.CreateUser = userId; request.CreateUser = userId;
return perapramountRepository.Add(request); return perapramountRepository.Add(request);
} }
...@@ -505,7 +510,7 @@ public bool UpdateApr(per_apr_amount request) ...@@ -505,7 +510,7 @@ public bool UpdateApr(per_apr_amount request)
if (data == null) if (data == null)
throw new PerformanceException("修改数据无效"); throw new PerformanceException("修改数据无效");
data.Status = 2; data.Status = 1;
data.PersonnelNumber = request.PersonnelNumber; data.PersonnelNumber = request.PersonnelNumber;
data.DoctorName = request.DoctorName; data.DoctorName = request.DoctorName;
data.PerforType = request.PerforType; data.PerforType = request.PerforType;
...@@ -515,6 +520,7 @@ public bool UpdateApr(per_apr_amount request) ...@@ -515,6 +520,7 @@ public bool UpdateApr(per_apr_amount request)
return perapramountRepository.Update(data); return perapramountRepository.Update(data);
} }
/// <summary> /// <summary>
/// 删除医院其他绩效 /// 删除医院其他绩效
/// </summary> /// </summary>
...@@ -530,6 +536,25 @@ public bool DeleteApr(int id) ...@@ -530,6 +536,25 @@ public bool DeleteApr(int id)
} }
/// <summary> /// <summary>
/// 提交、撤销医院其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <param name="department">录入科室</param>
/// <param name="status">1.撤销 2.提交</param>
/// <returns></returns>
public bool CommitApr(int allotId, string department, int status, DateTime date)
{
var list = status == 1
? GetAprByTypeInDepartment(allotId, department, date, 2) // 撤销操作,获取已提交等待审核的数据
: GetAprByTypeInDepartment(allotId, department, date, 1, 4); // 提交操作,获取未提交、驳回的数据
if (list == null) return true;
list.ForEach(t => t.Status = status);
perapramountRepository.UpdateRange(list.ToArray());
return true;
}
/// <summary>
/// 审核医院其他绩效 /// 审核医院其他绩效
/// </summary> /// </summary>
/// <param name="userid"></param> /// <param name="userid"></param>
...@@ -560,7 +585,9 @@ public ApiResponse ConfirmAudit(int userid, AprAmountAuditRequest request) ...@@ -560,7 +585,9 @@ public ApiResponse ConfirmAudit(int userid, AprAmountAuditRequest request)
if (error.Count > 0) if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error); return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
var allApramounts = perapramountRepository.GetEntities(t => t.AllotId == request.AllotId); var allApramounts = request.IsPass == 1
? GetAprByTypeInDepartment(request.AllotId, request.TypeInDepartment, request.CreateDate, 2) // 获取等待审核的数据
: GetAprByTypeInDepartment(request.AllotId, request.TypeInDepartment, request.CreateDate, 2, 3); // 获取等待审核、审核通过的数据
foreach (var member in request.Members) foreach (var member in request.Members)
{ {
var apramounts = allApramounts?.Where(t => (t.PersonnelNumber ?? "") == member.PersonnelNumber); var apramounts = allApramounts?.Where(t => (t.PersonnelNumber ?? "") == member.PersonnelNumber);
...@@ -606,21 +633,14 @@ public ApiResponse AprMark(int userid, AprAmountMarkRequest request) ...@@ -606,21 +633,14 @@ public ApiResponse AprMark(int userid, AprAmountMarkRequest request)
/// <param name="allotid"></param> /// <param name="allotid"></param>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="userid"></param> /// <param name="userid"></param>
public string ImpoerAprEmployees(int allotid, string path, int userid) public List<Dictionary<string, string>> ImportAprEmployees(int allotid, string path, int userid)
{ {
var userrole = userroleRepository.GetEntity(t => t.UserID == userid); var userrole = userroleRepository.GetEntity(t => t.UserID == userid);
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
var data = new List<per_apr_amount>(); List<Dictionary<string, string>> errors = new List<Dictionary<string, string>>();
var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据
data = perapramountRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0);
else
data = perapramountRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0 && t.CreateUser == userid);
if (data != null && data.Any())
perapramountRepository.RemoveRange(data.ToArray());
var typeIn = GetTypeInDepartment(userid);
try try
{ {
IWorkbook workbook = null; IWorkbook workbook = null;
...@@ -628,11 +648,9 @@ public string ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -628,11 +648,9 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
var version = FileHelper.GetExtension(path) == ".xlsx" ? ExcelVersion.xlsx : ExcelVersion.xls; var version = FileHelper.GetExtension(path) == ".xlsx" ? ExcelVersion.xlsx : ExcelVersion.xls;
using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate)) using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
{ {
workbook = (version == ExcelVersion.xlsx) workbook = version == ExcelVersion.xlsx ? new XSSFWorkbook(fs) : new HSSFWorkbook(fs);
? (IWorkbook)(new XSSFWorkbook(fs))
: (IWorkbook)(new HSSFWorkbook(fs));
} }
if (workbook == null) return ""; if (workbook == null) return errors;
var sheet = workbook.GetSheetAt(0); var sheet = workbook.GetSheetAt(0);
var firstRow = sheet.GetRow(0); var firstRow = sheet.GetRow(0);
...@@ -660,7 +678,6 @@ public string ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -660,7 +678,6 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
var entities = new List<per_apr_amount>(); var entities = new List<per_apr_amount>();
var createtime = DateTime.Now; var createtime = DateTime.Now;
var typeIn = GetTypeInDepartment(userid);
var employees = peremployeeRepository.GetEntities(t => t.AllotId == allotid); var employees = peremployeeRepository.GetEntities(t => t.AllotId == allotid);
for (int rowindex = 1; rowindex < sheet.LastRowNum + 1; rowindex++) for (int rowindex = 1; rowindex < sheet.LastRowNum + 1; rowindex++)
...@@ -670,7 +687,7 @@ public string ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -670,7 +687,7 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
var entity = new per_apr_amount var entity = new per_apr_amount
{ {
Status = 2, Status = 1,
PersonnelNumber = dict["人员工号"] < 0 ? "" : row.GetCell(dict["人员工号"]).GetValue(), PersonnelNumber = dict["人员工号"] < 0 ? "" : row.GetCell(dict["人员工号"]).GetValue(),
DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(), DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(), PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
...@@ -681,34 +698,43 @@ public string ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -681,34 +698,43 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
CreateDate = createtime, CreateDate = createtime,
CreateUser = userid, CreateUser = userid,
}; };
entities.Add(entity);
}
//var numbers = entities.Select(t => t.PersonnelNumber).Except(employees.Select(w => w.PersonnelNumber));
//if (numbers?.Count() > 0 && numbers?.Count() <= 5)
// return $@"以下工号在字典中不存在:{JsonHelper.Serialize(numbers.ToArray())}";
//else if (numbers?.Count() > 5)
// return $@"以下工号在字典中不存在:{JsonHelper.Serialize(numbers.Take(5)).Replace("]", ",...]")}";
if (string.IsNullOrEmpty(entity.DoctorName) || string.IsNullOrEmpty(entity.PersonnelNumber))
errors.Add(new Dictionary<string, string>
{
{ "行号", $"第{rowindex}行" },
{ "人员工号", entity.PersonnelNumber },
{ "姓名", entity.DoctorName },
{ "来源", "上传文件" },
{ "错误原因", "“关键信息缺失”请补全或删除" },
});
// 补充核算单元 var employee = employees.FirstOrDefault(w => w.PersonnelNumber == entity.PersonnelNumber);
if (entities.Any()) if (employee == null)
errors.Add(new Dictionary<string, string>
{ {
if (entities.Any(w => string.IsNullOrEmpty(w.PersonnelNumber) && w.Amount != 0)) { "行号", $"第{rowindex}行" },
throw new PerformanceException("文件中存在“工号”为空的数据"); { "人员工号", entity.PersonnelNumber },
if (entities.Any(w => string.IsNullOrEmpty(w.PerforType) && w.Amount != 0)) { "姓名", entity.DoctorName },
throw new PerformanceException("文件中存在“绩效类型”为空的数据"); { "来源", "上传文件" },
//if (entities.Any(w => string.IsNullOrEmpty(w.TypeInDepartment) && w.Amount != 0)) { "错误原因","“人员工号”错误,请修改或删除" },
// throw new PerformanceException("文件中存在“录入科室”为空的数据"); });
else if (employee.DoctorName != entity.DoctorName)
errors.Add(new Dictionary<string, string>
{
{ "行号", $"第{rowindex}行" },
{ "人员工号", entity.PersonnelNumber },
{ "姓名", entity.DoctorName },
{ "来源", "上传文件" },
{ "错误原因", "“姓名”错误,请修改或删除" },
});
//var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotid); entities.Add(entity);
//foreach (var item in entities.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber)))
//{
// item.AccountingUnit = employees?.FirstOrDefault(w => w.PersonnelNumber == item.PersonnelNumber)?.AccountingUnit ?? "";
//}
perapramountRepository.AddRange(entities.ToArray());
} }
return "";
// 补充核算单元
if (errors.Count == 0 && entities.Any())
perapramountRepository.AddRange(entities.ToArray());
} }
catch (PerformanceException ex) catch (PerformanceException ex)
{ {
...@@ -717,8 +743,8 @@ public string ImpoerAprEmployees(int allotid, string path, int userid) ...@@ -717,8 +743,8 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
catch (Exception ex) catch (Exception ex)
{ {
logger.LogError(ex.ToString()); logger.LogError(ex.ToString());
return "上传失败";
} }
return errors;
} }
/// <summary> /// <summary>
...@@ -875,18 +901,20 @@ public string GetTypeInDepartment(int userId) ...@@ -875,18 +901,20 @@ public string GetTypeInDepartment(int userId)
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <returns></returns> /// <returns></returns>
public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId) public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId, int isAudit)
{ {
var userrole = userroleRepository.GetEntity(t => t.UserID == userId); var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
Expression<Func<per_apr_amount_hide, bool>> expression = t => t.AllotId == allotId && (t.Amount ?? 0) != 0;
var list = new List<per_apr_amount_hide>();
var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 }; var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据 if (!roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据
list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0); expression = expression.And(t => t.CreateUser == userId);
else
list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId); if (isAudit == 1)
expression = expression.And(t => new int[] { 2, 3 }.Contains(t.Status ?? 1));
var list = _hideRepository.GetEntities(expression);
if (list != null && list.Any()) if (list != null && list.Any())
list = list.OrderBy(w => w.IsVerify).ThenBy(t => t.DoctorName).ToList(); list = list.OrderBy(w => w.IsVerify).ThenBy(t => t.DoctorName).ToList();
...@@ -898,7 +926,7 @@ public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId) ...@@ -898,7 +926,7 @@ public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId)
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="department"></param> /// <param name="department"></param>
/// <returns></returns> /// <returns></returns>
public List<view_per_apr_amount> GetAprHideList(int allotId, string department, int? status = null) public List<view_per_apr_amount> GetAprHideList(int allotId, string department, int? status = null, DateTime? date = null)
{ {
Expression<Func<per_apr_amount_hide, bool>> predicate = w => w.AllotId == allotId && w.Amount.HasValue && w.Amount != 0; Expression<Func<per_apr_amount_hide, bool>> predicate = w => w.AllotId == allotId && w.Amount.HasValue && w.Amount != 0;
if (!string.IsNullOrEmpty(department)) if (!string.IsNullOrEmpty(department))
...@@ -907,6 +935,9 @@ public List<view_per_apr_amount> GetAprHideList(int allotId, string department, ...@@ -907,6 +935,9 @@ public List<view_per_apr_amount> GetAprHideList(int allotId, string department,
if (status.HasValue) if (status.HasValue)
predicate = predicate.And(w => w.Status == status); predicate = predicate.And(w => w.Status == status);
if (date.HasValue)
predicate = predicate.And(w => w.CreateDate == date);
var list = _hideRepository.GetFullAmount(predicate); var list = _hideRepository.GetFullAmount(predicate);
if (list != null && list.Any()) if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList(); list = list.OrderBy(t => t.DoctorName).ToList();
...@@ -934,8 +965,7 @@ public bool InsertAprHide(per_apr_amount_hide request, int userId) ...@@ -934,8 +965,7 @@ public bool InsertAprHide(per_apr_amount_hide request, int userId)
throw new PerformanceException("工号在字典中不存在"); throw new PerformanceException("工号在字典中不存在");
request.TypeInDepartment = GetTypeInDepartment(userId); request.TypeInDepartment = GetTypeInDepartment(userId);
request.Status = 2; request.Status = 1;
request.CreateDate = DateTime.Now;
request.CreateUser = userId; request.CreateUser = userId;
return _hideRepository.Add(request); return _hideRepository.Add(request);
} }
...@@ -958,7 +988,7 @@ public bool UpdateAprHide(per_apr_amount_hide request) ...@@ -958,7 +988,7 @@ public bool UpdateAprHide(per_apr_amount_hide request)
if (data == null) if (data == null)
throw new PerformanceException("修改数据无效"); throw new PerformanceException("修改数据无效");
data.Status = 2; data.Status = 1;
data.PersonnelNumber = request.PersonnelNumber; data.PersonnelNumber = request.PersonnelNumber;
data.DoctorName = request.DoctorName; data.DoctorName = request.DoctorName;
data.PerforType = request.PerforType; data.PerforType = request.PerforType;
...@@ -982,6 +1012,26 @@ public bool DeleteAprHide(int id) ...@@ -982,6 +1012,26 @@ public bool DeleteAprHide(int id)
return true; return true;
} }
/// <summary>
/// 提交、撤销医院不公示其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <param name="department">录入科室</param>
/// <param name="status">1.撤销 2.提交</param>
/// <returns></returns>
public bool CommitAprHide(int allotId, string department, int status, DateTime date)
{
var list = status == 1
? GetAprHideByTypeInDepartment(allotId, department, date, 2) // 撤销操作,获取已提交等待审核的数据
: GetAprHideByTypeInDepartment(allotId, department, date, 1, 4); // 提交操作,获取未提交、驳回的数据
if (list == null) return true;
list.ForEach(t => t.Status = status);
_hideRepository.UpdateRange(list.ToArray());
return true;
}
/// <summary> /// <summary>
/// 审核医院其他绩效 /// 审核医院其他绩效
/// </summary> /// </summary>
...@@ -1014,7 +1064,9 @@ public ApiResponse ConfirmAuditHide(int userid, AprAmountAuditRequest request) ...@@ -1014,7 +1064,9 @@ public ApiResponse ConfirmAuditHide(int userid, AprAmountAuditRequest request)
if (error.Count > 0) if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error); return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
var allApramounts = _hideRepository.GetEntities(t => t.AllotId == request.AllotId); var allApramounts = request.IsPass == 1
? GetAprHideByTypeInDepartment(request.AllotId, request.TypeInDepartment, request.CreateDate, 2) // 获取等待审核的数据
: GetAprHideByTypeInDepartment(request.AllotId, request.TypeInDepartment, request.CreateDate, 2, 3); // 获取等待审核、审核通过的数据
foreach (var member in request.Members) foreach (var member in request.Members)
{ {
var apramounts = allApramounts?.Where(t => (t.PersonnelNumber ?? "") == member.PersonnelNumber); var apramounts = allApramounts?.Where(t => (t.PersonnelNumber ?? "") == member.PersonnelNumber);
...@@ -1059,21 +1111,14 @@ public ApiResponse AprMarkHide(int userid, AprAmountMarkRequest request) ...@@ -1059,21 +1111,14 @@ public ApiResponse AprMarkHide(int userid, AprAmountMarkRequest request)
/// <param name="allotid"></param> /// <param name="allotid"></param>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="userid"></param> /// <param name="userid"></param>
public void ImpoerAprHideEmployees(int allotid, string path, int userid) public List<Dictionary<string, string>> ImportAprHideEmployees(int allotid, string path, int userid)
{ {
var userrole = userroleRepository.GetEntity(t => t.UserID == userid); var userrole = userroleRepository.GetEntity(t => t.UserID == userid);
if (userrole == null) throw new PerformanceException("用户未绑定角色"); if (userrole == null) throw new PerformanceException("用户未绑定角色");
var data = new List<per_apr_amount_hide>(); List<Dictionary<string, string>> errors = new List<Dictionary<string, string>>();
var roles = new int[] { (int)Role.绩效管理员, (int)Role.医院管理员, (int)Role.绩效核算办, (int)Role.院领导, (int)Role.审计 };
if (roles.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据
data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0);
else
data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0 && t.CreateUser == userid);
if (data != null && data.Any())
_hideRepository.RemoveRange(data.ToArray());
var typeIn = GetTypeInDepartment(userid);
try try
{ {
IWorkbook workbook = null; IWorkbook workbook = null;
...@@ -1081,11 +1126,9 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid) ...@@ -1081,11 +1126,9 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
var version = FileHelper.GetExtension(path) == ".xlsx" ? ExcelVersion.xlsx : ExcelVersion.xls; var version = FileHelper.GetExtension(path) == ".xlsx" ? ExcelVersion.xlsx : ExcelVersion.xls;
using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate)) using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
{ {
workbook = (version == ExcelVersion.xlsx) workbook = version == ExcelVersion.xlsx ? new XSSFWorkbook(fs) : new HSSFWorkbook(fs);
? (IWorkbook)(new XSSFWorkbook(fs))
: (IWorkbook)(new HSSFWorkbook(fs));
} }
if (workbook == null) return; if (workbook == null) return errors;
var sheet = workbook.GetSheetAt(0); var sheet = workbook.GetSheetAt(0);
var firstRow = sheet.GetRow(0); var firstRow = sheet.GetRow(0);
...@@ -1111,9 +1154,9 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid) ...@@ -1111,9 +1154,9 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
dict[key] = excelheader.First(w => w.Value == key).Key; dict[key] = excelheader.First(w => w.Value == key).Key;
} }
var employees = peremployeeRepository.GetEntities(t => t.AllotId == allotid);
var entities = new List<per_apr_amount_hide>(); var entities = new List<per_apr_amount_hide>();
var createtime = DateTime.Now; var createtime = DateTime.Now;
var typeIn = GetTypeInDepartment(userid);
for (int rowindex = 1; rowindex < sheet.LastRowNum + 1; rowindex++) for (int rowindex = 1; rowindex < sheet.LastRowNum + 1; rowindex++)
{ {
var row = sheet.GetRow(rowindex); var row = sheet.GetRow(rowindex);
...@@ -1121,7 +1164,7 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid) ...@@ -1121,7 +1164,7 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
var entity = new per_apr_amount_hide var entity = new per_apr_amount_hide
{ {
Status = 2, Status = 1,
PersonnelNumber = dict["人员工号"] < 0 ? "" : row.GetCell(dict["人员工号"]).GetValue(), PersonnelNumber = dict["人员工号"] < 0 ? "" : row.GetCell(dict["人员工号"]).GetValue(),
DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(), DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(), PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
...@@ -1132,19 +1175,43 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid) ...@@ -1132,19 +1175,43 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
CreateDate = createtime, CreateDate = createtime,
CreateUser = userid, CreateUser = userid,
}; };
if (string.IsNullOrEmpty(entity.DoctorName) || string.IsNullOrEmpty(entity.PersonnelNumber))
errors.Add(new Dictionary<string, string>
{
{ "行号", $"第{rowindex}行" },
{ "人员工号", entity.PersonnelNumber },
{ "姓名", entity.DoctorName },
{ "来源", "上传文件" },
{ "错误原因", "“关键信息缺失”请补全或删除" },
});
var employee = employees.FirstOrDefault(w => w.PersonnelNumber == entity.PersonnelNumber);
if (employee == null)
errors.Add(new Dictionary<string, string>
{
{ "行号", $"第{rowindex}行" },
{ "人员工号", entity.PersonnelNumber },
{ "姓名", entity.DoctorName },
{ "来源", "上传文件" },
{ "错误原因","“人员工号”错误,请修改或删除" },
});
else if (employee.DoctorName != entity.DoctorName)
errors.Add(new Dictionary<string, string>
{
{ "行号", $"第{rowindex}行" },
{ "人员工号", entity.PersonnelNumber },
{ "姓名", entity.DoctorName },
{ "来源", "上传文件" },
{ "错误原因", "“姓名”错误,请修改或删除" },
});
entities.Add(entity); entities.Add(entity);
} }
// 补充核算单元 if (errors.Count == 0 && entities.Any())
if (entities.Any())
{
if (entities.Any(w => string.IsNullOrEmpty(w.PersonnelNumber) && w.Amount != 0))
throw new PerformanceException("文件中存在“工号”为空的数据");
if (entities.Any(w => string.IsNullOrEmpty(w.PerforType) && w.Amount != 0))
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
_hideRepository.AddRange(entities.ToArray()); _hideRepository.AddRange(entities.ToArray());
} }
}
catch (PerformanceException ex) catch (PerformanceException ex)
{ {
throw ex; throw ex;
...@@ -1153,6 +1220,7 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid) ...@@ -1153,6 +1220,7 @@ public void ImpoerAprHideEmployees(int allotid, string path, int userid)
{ {
logger.LogError(ex.ToString()); logger.LogError(ex.ToString());
} }
return errors;
} }
/// <summary> /// <summary>
...@@ -1836,6 +1904,78 @@ public void AuditGather(List<Gather> gather) ...@@ -1836,6 +1904,78 @@ public void AuditGather(List<Gather> gather)
_service.SyncDataToResult(gatherFirst.AllotId); _service.SyncDataToResult(gatherFirst.AllotId);
} }
} }
/// <summary>
/// 清理该科室录入数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool ClearAprData(AprAmountAuditRequest request)
{
var data = perapramountRepository.GetEntities(t => t.AllotId == request.AllotId
&& t.TypeInDepartment == request.TypeInDepartment && t.CreateDate == request.CreateDate);
if (data == null || !data.Any()) return true;
return perapramountRepository.RemoveRange(data.ToArray());
}
/// <summary>
/// 清理该科室录入不公示数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool ClearAprHideData(AprAmountAuditRequest request)
{
var data = _hideRepository.GetEntities(t => t.AllotId == request.AllotId
&& t.TypeInDepartment == request.TypeInDepartment && t.CreateDate == request.CreateDate);
if (data == null || !data.Any()) return true;
return _hideRepository.RemoveRange(data.ToArray());
}
/// <summary>
/// 根据录入科室获取其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <param name="department">录入科室</param>
/// <param name="date"></param>
/// <param name="status">1.未提交 2.等待审核 3.审核通过 4.驳回</param>
/// <returns></returns>
public List<per_apr_amount> GetAprByTypeInDepartment(int allotId, string department, DateTime date, params int[] status)
{
Expression<Func<per_apr_amount, bool>> exp = (w) => w.AllotId == allotId && w.TypeInDepartment == department && w.CreateDate == date;
//if (!string.IsNullOrEmpty(date))
// exp = exp.And((w) => w.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") == date);
if (status != null && status.Any())
exp = exp.And((w) => status.Contains(w.Status ?? 1));
var data = perapramountRepository.GetEntities(exp);
return data;
}
/// <summary>
/// 根据录入科室获取不公示其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <param name="department">录入科室</param>
/// <param name="date"></param>
/// <param name="status">1.未提交 2.等待审核 3.审核通过 4.驳回</param>
/// <returns></returns>
public List<per_apr_amount_hide> GetAprHideByTypeInDepartment(int allotId, string department, DateTime date, params int[] status)
{
Expression<Func<per_apr_amount_hide, bool>> exp = (w) => w.AllotId == allotId && w.TypeInDepartment == department && w.CreateDate == date;
//if (!string.IsNullOrEmpty(date))
// exp = exp.And((w) => w.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") == date);
if (status != null && status.Any())
exp = exp.And((w) => status.Contains(w.Status ?? 1));
var data = _hideRepository.GetEntities(exp);
return data;
}
} }
public class ComparisonConfig public class ComparisonConfig
......
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