Commit 8c17444c by 钟博

绩效测算完成对实发绩效数据进修核对,下发提示受影响影响科室

parent 625ec8e8
......@@ -425,10 +425,13 @@ public ApiResponse Issued([FromBody] AllotRequest request)
throw new PerformanceException("当前绩效记录不存在");
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
// 科室下发
_resultComputeService.GenerateSecondAllot(allot);
bool isIssued = false;
var result = _resultComputeService.IssuedPrompt(allot, request, ref isIssued);
//绩效划拨,下发驳回
costTransferService.RejectedApplicat(allot.ID);
return new ApiResponse(ResponseType.OK);
if (request.isIssued == 1 && isIssued)
costTransferService.RejectedApplicat(allot.ID);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
......
......@@ -719,5 +719,25 @@ public ApiResponse AprHideOverview(int allotId)
return new ApiResponse(ResponseType.OK, relust);
}
#endregion
/// <summary>
/// 实发绩效比对
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("getComparison")]
[HttpPost]
public ApiResponse GetDeptComparison([FromBody] ComparisonPagingRequest request)
{
var allot = allotService.GetAllot(request.AllotId);
if (allot == null)
return new ApiResponse(ResponseType.ParameterError, "allotId无效");
var relust = employeeService.GetComparison(request);
return new ApiResponse(ResponseType.OK, relust);
}
}
}
......@@ -1165,6 +1165,14 @@
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetDeptComparison(Performance.DtoModels.ComparisonPagingRequest)">
<summary>
实发绩效比对
</summary>
<param name="allotId"></param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ExConfigController.Extract(Performance.DtoModels.ModModuleRequest)">
<summary>
绩效数据抽取模板
......
......@@ -3492,6 +3492,11 @@
有效收入占比
</summary>
</member>
<member name="P:Performance.DtoModels.IssuedPromptResponse.Status">
<summary>
1 修改 2 删除
</summary>
</member>
<member name="P:Performance.DtoModels.MenuResponse.MenuName">
<summary>
菜单名称
......
......@@ -1170,6 +1170,11 @@
科室实发金额
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.PreRealGiveFee">
<summary>
预发金额
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.Efficiency">
<summary>
效率绩效
......
......@@ -247,6 +247,9 @@ public AutoMapperConfigs()
CreateMap<view_allot_result, OwnerPerformanceDto>()
.ReverseMap();
CreateMap<ag_secondallot, IssuedPromptResponse>()
.ReverseMap();
}
}
}
......@@ -33,6 +33,10 @@ public class AllotRequest
/// 路径
/// </summary>
public string Path { get; set; }
public int isIssued { get; set; }
public string SearchQuery { get; set; }
}
public class AllotRequestValidator : AbstractValidator<AllotRequest>
......
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class ComparisonResponse
{
public List<Heads> Heads { get; set; }
public Comparison Datas { get; set; }
}
public class Heads
{
public string Cloumon { get; set; }
public string Name { get; set; }
}
public class Comparison
{
public List<view_check_emp> Datas { get; set; }
public int TotalCount { get; set; }
}
public class ComparisonPagingRequest
{
public int AllotId { get; set; }
public string ViewName { get; set; }
public string SearchQuery { get; set; }
public int PageIndex { get; set; } = 1;
public int PageSize { get; set; } = 20;
}
}
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class IssuedPromptResponse : ag_secondallot
{
public decimal? Diff { get; set; }
/// <summary>
/// 1 删除 2 驳回 3 修改 4 新增
/// </summary>
public new int Status { get; set; }
}
}
......@@ -57,6 +57,10 @@ public class ag_secondallot
public Nullable<decimal> RealGiveFee { get; set; }
/// <summary>
/// 预发金额
/// </summary>
public Nullable<decimal> PreRealGiveFee { get; set; }
/// <summary>
/// 效率绩效
/// </summary>
public Nullable<decimal> Efficiency { get; set; }
......
using Microsoft.EntityFrameworkCore;
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Performance.EntityModels
{
public class view_check_dept
{
public int HospitalId { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int AllotID { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public decimal? RealGiveFeeExecl { get; set; }
public decimal? RealGiveFeeCompute { get; set; }
public decimal? Diff { get; set; }
}
public class view_check_emp : view_check_dept
{
public string JobNumber { get; set; }
public string EmployeeName { get; set; }
}
}
......@@ -3,9 +3,13 @@
// * FileName: per_employee.cs
// </copyright>
//-----------------------------------------------------------------------
using Microsoft.EntityFrameworkCore;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure.Models;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
......@@ -16,11 +20,39 @@ namespace Performance.Repository
/// </summary>
public partial class PerforPeremployeeRepository : PerforRepository<per_employee>
{
public new PageList<per_employee> GetEntitiesForPaging(int pageNumber, int pageSize, Expression<Func<per_employee, bool>> exp)
{
IQueryable<per_employee> queryableAuthors = context.Set<per_employee>().Where(exp).OrderBy(w => w.IsVerify).ThenBy(t => t.Id);
return PageList<per_employee>.Create(queryableAuthors, pageNumber, pageSize);
}
public Comparison GetComparison(ComparisonPagingRequest request)
{
var search = "";
if (string.IsNullOrEmpty(request.SearchQuery))
search = " 1=1 ";
else
{
if (request.ViewName == "view_check_dept")
search = $" ( AccountingUnit like '%{request.SearchQuery}%' )";
else
search = $" ( AccountingUnit like '%{request.SearchQuery}%' or JobNumber like '%{request.SearchQuery}%' or EmployeeName like '%{request.SearchQuery}%') ";
}
var result = new Comparison();
var sql = $@"SELECT COUNT(*) FROM {request.ViewName} WHERE AllotId = @AllotId and {search}";
result.TotalCount = DapperQuery<int>(sql, new { request.AllotId })?.FirstOrDefault() ?? 0;
sql = $@"SELECT * FROM {request.ViewName} WHERE AllotId = @AllotId and {search} LIMIT {(request.PageIndex - 1) * request.PageSize},{request.PageSize}; ";
result.Datas = DapperQuery<view_check_emp>(sql, new { request.AllotId })?.ToList();
return result;
}
}
}
......@@ -556,7 +556,7 @@ public void GenerateSecondAllot(per_allot allot)
UnitType = ((UnitType)item.UnitType).ToString(),
Department = item.AccountingUnit,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
RealGiveFee = item.RealGiveFee,
PreRealGiveFee = item.RealGiveFee,
});
}
}
......@@ -575,7 +575,7 @@ public void GenerateSecondAllot(per_allot allot)
UnitType = UnitType.特殊核算组.ToString(),
Department = item.AccountingUnit,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
RealGiveFee = item.RealGiveFee,
PreRealGiveFee = item.RealGiveFee,
});
}
}
......@@ -595,7 +595,7 @@ public void GenerateSecondAllot(per_allot allot)
Month = allot.Month,
UnitType = item.UnitType,
Department = item.Department,
RealGiveFee = item.RealGiveFee,
PreRealGiveFee = item.PreRealGiveFee,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
Status = 1,
NursingDeptStatus = 1,
......@@ -603,7 +603,8 @@ public void GenerateSecondAllot(per_allot allot)
}
else
{
var backResult = Math.Abs((second.RealGiveFee ?? 0) - (item.RealGiveFee ?? 0)) >= 0.5m
/*
var backResult = Math.Abs((second.PreRealGiveFee ?? 0) - (item.RealGiveFee ?? 0)) >= 0.5m
|| Math.Abs((second.NightShiftWorkPerforFee ?? 0) - (item.NightShiftWorkPerforFee ?? 0)) >= 0.5m;
if (backResult && second.Status > 1)
{
......@@ -612,7 +613,8 @@ public void GenerateSecondAllot(per_allot allot)
second.NursingDeptStatus = 4;
second.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交";
}
second.RealGiveFee = item.RealGiveFee;
*/
second.PreRealGiveFee = item.PreRealGiveFee;
second.NightShiftWorkPerforFee = item.NightShiftWorkPerforFee;
updSecond.Add(second);
}
......@@ -636,7 +638,7 @@ public void GenerateSecondAllot(per_allot allot)
if (updSecond.Any())
{
perforAgsecondallotRepository.UpdateRange(updSecond.ToArray());
/*
foreach (var item in updSecond.Where(w => w.Status == 4))
{
// 自动驳回,需要清空该科室历史数据
......@@ -644,11 +646,149 @@ public void GenerateSecondAllot(per_allot allot)
if (histories != null && histories.Any())
perforAgcomputeRepository.RemoveRange(histories.ToArray());
}
*/
}
/*
if (delSecond.Any())
{
perforAgsecondallotRepository.RemoveRange(delSecond.ToArray());
}
*/
}
public List<IssuedPromptResponse> IssuedPrompt(per_allot allot, AllotRequest request, ref bool isIssued)
{
List<ag_secondallot> tempSecond = new List<ag_secondallot>();
var promptSeconds = new List<IssuedPromptResponse>();
var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 };
var accountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && !types.Contains(t.UnitType.Value));
// 查询需要进行二次分配的行政后勤科室
var xzAccountUnit = perforResaccountRepository.GetEntities(t => t.AllotID == allot.ID && t.UnitType.Value == (int)UnitType.行政后勤 && t.NeedSecondAllot == "是");
if (xzAccountUnit != null && xzAccountUnit.Count > 0)
(accountUnit ?? new List<res_account>()).AddRange(xzAccountUnit);
var specialList = perforResspecialunitRepository.GetEntities(t => t.AllotID == allot.ID);
if (accountUnit != null)
{
foreach (var item in accountUnit)
{
if (!tempSecond.Any(f => f.UnitType == ((UnitType)item.UnitType).ToString() && f.Department == item.AccountingUnit))
{
tempSecond.Add(new ag_secondallot
{
AllotId = allot.ID,
Year = allot.Year,
Month = allot.Month,
UnitType = ((UnitType)item.UnitType).ToString(),
Department = item.AccountingUnit,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
PreRealGiveFee = item.RealGiveFee,
});
}
}
}
if (specialList != null)
{
foreach (var item in specialList.Select(w => new { w.AccountingUnit, w.NightShiftWorkPerforFee, w.RealGiveFee }).Distinct())
{
if (!tempSecond.Any(f => f.UnitType == UnitType.特殊核算组.ToString() && f.Department == item.AccountingUnit))
{
tempSecond.Add(new ag_secondallot
{
AllotId = allot.ID,
Year = allot.Year,
Month = allot.Month,
UnitType = UnitType.特殊核算组.ToString(),
Department = item.AccountingUnit,
NightShiftWorkPerforFee = item.NightShiftWorkPerforFee,
PreRealGiveFee = item.RealGiveFee,
});
}
}
}
var secondList = perforAgsecondallotRepository.GetEntities(t => t.AllotId == allot.ID && t.Year == allot.Year && t.Month == allot.Month);
foreach (var item in secondList)
{
var second = secondList?.FirstOrDefault(f => f.UnitType == item.UnitType && f.Department == item.Department);
if ((item.RealGiveFee ?? 0) != (item.PreRealGiveFee ?? 0) && second.Status > 1)
{
var promptSecond = Mapper.Map<IssuedPromptResponse>(item);
promptSecond.Diff = (item.RealGiveFee ?? 0) - (item.PreRealGiveFee ?? 0);
promptSecond.Status = 1;
promptSeconds.Add(promptSecond);
}
}
if (secondList != null && secondList.Any())
{
foreach (var item in secondList)
{
var second = tempSecond?.FirstOrDefault(f => f.UnitType == item.UnitType && f.Department == item.Department);
if (second == null)
{
var promptSecond = Mapper.Map<IssuedPromptResponse>(item);
promptSecond.Diff = (item.RealGiveFee ?? 0) - (item.PreRealGiveFee ?? 0);
promptSecond.Status = 1;
promptSeconds.Add(promptSecond);
}
}
}
if (!string.IsNullOrEmpty(request.SearchQuery))
promptSeconds = promptSeconds.Where(t => t.Department.Contains(request.SearchQuery))?.ToList();
if (request.isIssued == 1)
isIssued = Issued(promptSeconds, secondList);
return promptSeconds;
}
public bool Issued(List<IssuedPromptResponse> issueds, List<ag_secondallot> secondallots)
{
if (issueds == null || !issueds.Any() || secondallots == null || !secondallots.Any()) return true;
if (issueds.Any(w => w.Status == 1))
{
var updSecondQuery = issueds.Where(t => t.Status == 1);
var updSeconds = secondallots.Where(w => updSecondQuery.Select(t => t.Id).Contains(w.Id)) ?? new List<ag_secondallot>();
foreach (var item in updSeconds)
{
item.Status = 4;
item.Remark = "科室绩效结果发生变更,需要重新提交";
item.NursingDeptStatus = 4;
item.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交";
item.RealGiveFee = item.PreRealGiveFee;
}
perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray());
foreach (var item in updSeconds.Where(w => w.Status == 4))
{
// 自动驳回,需要清空该科室历史数据
var histories = perforAgcomputeRepository.GetEntities(w => w.SecondId == item.Id);
if (histories != null && histories.Any())
perforAgcomputeRepository.RemoveRange(histories.ToArray());
}
}
if (issueds.Any(w => w.Status == 2))
{
//删除
var delSecondQuery = issueds.Where(t => t.Status == 2);
var delSecond = secondallots.Where(w => delSecondQuery.Select(t => t.Id).Contains(w.Id)) ?? new List<ag_secondallot>();
perforAgsecondallotRepository.RemoveRange(delSecond.ToArray());
}
return true;
}
}
}
......@@ -14,6 +14,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
namespace Performance.Services
{
......@@ -1097,5 +1098,41 @@ public List<TitleValue> GetPerforTypeDictHide(int allotId)
return others;
}
#endregion
public ComparisonResponse GetComparison(ComparisonPagingRequest request)
{
var result = new ComparisonResponse();
if (request.ViewName == "view_check_dept")
result.Heads = ComparisonConfig.DeptHeads;
else
result.Heads = ComparisonConfig.EmpHeads;
result.Datas = peremployeeRepository.GetComparison(request);
return result;
}
}
public class ComparisonConfig
{
public static List<Heads> DeptHeads { get; } = new List<Heads>
{
new Heads{Cloumon="科室类别",Name=nameof(view_check_dept.UnitType)},
new Heads{Cloumon="核算单元",Name=nameof(view_check_dept.AccountingUnit)},
new Heads{Cloumon="预发绩效",Name=nameof(view_check_dept.RealGiveFeeExecl)},
new Heads{Cloumon="实发绩效",Name=nameof(view_check_dept.RealGiveFeeCompute)},
new Heads{Cloumon="差额",Name=nameof(view_check_dept.Diff)},
};
public static List<Heads> EmpHeads { get; } = new List<Heads>
{
new Heads{Cloumon="科室类别",Name=nameof(view_check_emp.UnitType)},
new Heads{Cloumon="核算单元",Name=nameof(view_check_emp.AccountingUnit)},
new Heads{Cloumon="人员工号",Name=nameof(view_check_emp.JobNumber)},
new Heads{Cloumon="姓名",Name=nameof(view_check_emp.EmployeeName)},
new Heads{Cloumon="预发绩效",Name=nameof(view_check_emp.RealGiveFeeExecl)},
new Heads{Cloumon="实发绩效",Name=nameof(view_check_emp.RealGiveFeeCompute)},
new Heads{Cloumon="差额",Name=nameof(view_check_emp.Diff)},
};
}
}
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