签字表静态存储

parent cf6c3e46
...@@ -1871,26 +1871,6 @@ ...@@ -1871,26 +1871,6 @@
发放银行 发放银行
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.Request.BatchDetail.UnitType">
<summary>
核算单元分类
</summary>
</member>
<member name="P:Performance.DtoModels.Request.BatchDetail.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.DtoModels.Request.BatchDetail.EmployeeName">
<summary>
人员姓名
</summary>
</member>
<member name="P:Performance.DtoModels.Request.BatchDetail.JobNumber">
<summary>
工号
</summary>
</member>
<member name="P:Performance.DtoModels.Request.ComputerAvgRequest.PositionName"> <member name="P:Performance.DtoModels.Request.ComputerAvgRequest.PositionName">
<summary> <summary>
绩效核算人群 绩效核算人群
......
...@@ -5,16 +5,10 @@ namespace Performance.DtoModels.Request ...@@ -5,16 +5,10 @@ namespace Performance.DtoModels.Request
{ {
public class BatchCancelRequest public class BatchCancelRequest
{ {
public int HospitalId { get; set; } public List<int> Details { get; set; }
public int AllotId { get; set; }
public List<BatchDetail> Details { get; set; }
} }
public class BatchRequest public class BatchRequest
{ {
public int HospitalId { get; set; }
public int AllotId { get; set; } public int AllotId { get; set; }
/// <summary> /// <summary>
/// 批次号 /// 批次号
...@@ -29,29 +23,6 @@ public class BatchRequest ...@@ -29,29 +23,6 @@ public class BatchRequest
/// </summary> /// </summary>
public string BankName { get; set; } public string BankName { get; set; }
public List<BatchDetail> Details { get; set; } public List<int> Details { get; set; }
}
public class BatchDetail
{
/// <summary>
/// 核算单元分类
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 人员姓名
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// 工号
/// </summary>
public string JobNumber { get; set; }
} }
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
{ {
public class view_allot_sign_emp_finance public class view_allot_sign_emp_finance
{ {
public int ID { get; set; }
public string HospitalID { get; set; } public string HospitalID { get; set; }
public string Year { get; set; } public string Year { get; set; }
public string Month { get; set; } public string Month { get; set; }
...@@ -29,7 +30,7 @@ public class view_allot_sign_emp_finance ...@@ -29,7 +30,7 @@ public class view_allot_sign_emp_finance
public class view_allot_sign_emp : view_allot_sign_emp_finance public class view_allot_sign_emp : view_allot_sign_emp_finance
{ {
public int Source { get; set; } public string Source { get; set; }
public int SecondId { get; set; } public int SecondId { get; set; }
public int States { get; set; } public int States { get; set; }
public string IsShowManage { get; set; } public string IsShowManage { get; set; }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
using Dapper; using Dapper;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.EntityModels.Other; using Performance.EntityModels.Other;
using System; using System;
...@@ -373,5 +374,62 @@ public void AccoungtingVerify(int allotId) ...@@ -373,5 +374,62 @@ public void AccoungtingVerify(int allotId)
} }
} }
} }
/// <summary>
/// 查询人员字典
/// </summary>
/// <param name="allotId"></param>
/// <param name="secondId">二次分配ID 0 代表一次分配</param>
/// <param name="status"> status = true 二次分配审核通过 false 二次分配驳回 </param>
/// <returns></returns>
public void FreezeAllot(int allotId, int secondId = 0, bool status = true)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string sql = $@"call proc_freeze_allot({allotId},{secondId},{(status ? 3 : 4)})";
connection.Execute(sql, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
}
public IEnumerable<view_allot_sign_emp> GetFreezeAllot(int allotId)
{
var connection = context.Database.GetDbConnection();
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string query = $@"SELECT * FROM view_allot_sign_emp where allotId = @allotId";
return connection.Query<view_allot_sign_emp>(query, new { allotId }, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
public void Batch(int[] ids, string batch, DateTime? batchDate, string bankName)
{
var connection = context.Database.GetDbConnection();
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string udpate = $@"UPDATE freeze_allot_sign_emp SET Batch = @batch,BatchDate = @batchDate,BankName = @bankName where ID IN @ids";
var x = connection.Execute(udpate, new { ids, batch, batchDate, bankName }, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
} }
} }
\ No newline at end of file
...@@ -210,7 +210,7 @@ public int SaveEmployee(PerSheet sheet, per_allot allot, List<per_allot> allotLi ...@@ -210,7 +210,7 @@ public int SaveEmployee(PerSheet sheet, per_allot allot, List<per_allot> allotLi
} }
} }
List<im_employee> addList = new List<im_employee>(); List<im_employee> addList = new List<im_employee>();
foreach (var data in dataList.GroupBy(w => w.PersonnelNumber).Select(w => w.First())) foreach (var data in dataList)
{ {
var imdata = _mapper.Map<im_employee>(data); var imdata = _mapper.Map<im_employee>(data);
imdata.SheetID = imsheet.ID; imdata.SheetID = imsheet.ID;
...@@ -282,7 +282,7 @@ public int SaveClinicEmployee(PerSheet sheet, per_allot allot, List<per_allot> a ...@@ -282,7 +282,7 @@ public int SaveClinicEmployee(PerSheet sheet, per_allot allot, List<per_allot> a
} }
} }
List<im_employee_clinic> addList = new List<im_employee_clinic>(); List<im_employee_clinic> addList = new List<im_employee_clinic>();
foreach (var data in dataList.GroupBy(w => new { w.PersonnelNumber, w.UnitType, w.AccountingUnit }).Select(w => w.First())) foreach (var data in dataList)
{ {
var imdata = _mapper.Map<im_employee_clinic>(data); var imdata = _mapper.Map<im_employee_clinic>(data);
imdata.SheetID = imsheet.ID; imdata.SheetID = imsheet.ID;
...@@ -323,7 +323,7 @@ public int SaveLogisticsEmployee(PerSheet sheet, per_allot allot, List<per_allot ...@@ -323,7 +323,7 @@ public int SaveLogisticsEmployee(PerSheet sheet, per_allot allot, List<per_allot
} }
} }
List<im_employee_logistics> addList = new List<im_employee_logistics>(); List<im_employee_logistics> addList = new List<im_employee_logistics>();
foreach (var data in dataList.GroupBy(w => w.PersonnelNumber).Select(w => w.First())) foreach (var data in dataList)
{ {
var imdata = _mapper.Map<im_employee_logistics>(data); var imdata = _mapper.Map<im_employee_logistics>(data);
imdata.SheetID = imsheet.ID; imdata.SheetID = imsheet.ID;
......
...@@ -17,6 +17,7 @@ namespace Performance.Services.AllotCompute ...@@ -17,6 +17,7 @@ namespace Performance.Services.AllotCompute
public class ResultComputeService : IAutoInjection public class ResultComputeService : IAutoInjection
{ {
private readonly IMapper _mapper; private readonly IMapper _mapper;
private readonly PerforPerallotRepository _perforPerallotRepository;
private readonly BaiscNormService baiscNormService; private readonly BaiscNormService baiscNormService;
private readonly ComputeDirector computeDirector; private readonly ComputeDirector computeDirector;
private readonly BudgetService budgetService; private readonly BudgetService budgetService;
...@@ -34,6 +35,7 @@ public class ResultComputeService : IAutoInjection ...@@ -34,6 +35,7 @@ public class ResultComputeService : IAutoInjection
public ResultComputeService( public ResultComputeService(
IMapper mapper, IMapper mapper,
PerforPerallotRepository perforPerallotRepository,
PerforHospitalRepository hospitalRepository, PerforHospitalRepository hospitalRepository,
PerforImemployeeRepository perforImEmployeeRepository, PerforImemployeeRepository perforImEmployeeRepository,
PerforRescomputeRepository perforRescomputeRepository, PerforRescomputeRepository perforRescomputeRepository,
...@@ -48,6 +50,7 @@ public class ResultComputeService : IAutoInjection ...@@ -48,6 +50,7 @@ public class ResultComputeService : IAutoInjection
ILogger<ResultComputeService> logger) ILogger<ResultComputeService> logger)
{ {
_mapper = mapper; _mapper = mapper;
_perforPerallotRepository = perforPerallotRepository;
this.baiscNormService = baiscNormService; this.baiscNormService = baiscNormService;
this.computeDirector = computeDirector; this.computeDirector = computeDirector;
this.hospitalRepository = hospitalRepository; this.hospitalRepository = hospitalRepository;
...@@ -539,7 +542,7 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -539,7 +542,7 @@ public void GenerateSecondAllot(per_allot allot)
{ {
foreach (var item in accountUnit) foreach (var item in accountUnit)
{ {
if (!tempSecond.Any(f => f.UnitType == ((UnitType)item.UnitType).ToString() && f.Department == item.AccountingUnit)) if (!tempSecond.Any(f => UnitTypeUtil.IsEqualsUnitType(f.UnitType, item.UnitType) && f.Department == item.AccountingUnit))
{ {
tempSecond.Add(new ag_secondallot tempSecond.Add(new ag_secondallot
{ {
...@@ -693,6 +696,7 @@ public bool IssuedChangeSecond(per_allot allot, List<ag_secondallot> secondList) ...@@ -693,6 +696,7 @@ public bool IssuedChangeSecond(per_allot allot, List<ag_secondallot> secondList)
second.NursingDeptStatus = 4; second.NursingDeptStatus = 4;
second.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交"; second.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交";
} }
_perforPerallotRepository.FreezeAllot(allot.ID, second.Id, false);
} }
} }
perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray()); perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray());
......
...@@ -448,6 +448,7 @@ public void Generate(per_allot allot) ...@@ -448,6 +448,7 @@ public void Generate(per_allot allot)
// 科室创建但不下发 // 科室创建但不下发
resultComputeService.GenerateSecondAllot(allot); resultComputeService.GenerateSecondAllot(allot);
_allotRepository.FreezeAllot(allot.ID);
UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate); UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate);
perforCofdirectorRepository.SupplementaryData(allot.ID); perforCofdirectorRepository.SupplementaryData(allot.ID);
......
...@@ -529,7 +529,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId) ...@@ -529,7 +529,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
AssessLaterPerforTotal = t.AssessLaterPerforTotal, AssessLaterPerforTotal = t.AssessLaterPerforTotal,
AdjustFactor = t.AdjustFactor, AdjustFactor = t.AdjustFactor,
AdjustLaterOtherFee = t.AdjustLaterOtherFee, AdjustLaterOtherFee = t.AdjustLaterOtherFee,
AssessLaterManagementFee = clinicalComputes?.Where(w => w.AccountingUnit == t.AccountingUnit && w.UnitType == ((UnitType)t.UnitType).ToString())?.Sum(c => c.RealGiveFee), AssessLaterManagementFee = clinicalComputes?.Where(w => w.AccountingUnit == t.AccountingUnit && UnitTypeUtil.IsEqualsUnitType(w.UnitType, t.UnitType))?.Sum(c => c.RealGiveFee),
RealGiveFee = t.RealGiveFee, RealGiveFee = t.RealGiveFee,
}); });
...@@ -583,7 +583,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId) ...@@ -583,7 +583,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
AssessLaterPerforTotal = t.AssessLaterPerforTotal, AssessLaterPerforTotal = t.AssessLaterPerforTotal,
AdjustFactor = t.AdjustFactor, AdjustFactor = t.AdjustFactor,
AdjustLaterOtherFee = t.AdjustLaterOtherFee, AdjustLaterOtherFee = t.AdjustLaterOtherFee,
AssessLaterManagementFee = clinicalComputes?.Where(w => w.AccountingUnit == t.AccountingUnit && w.UnitType == ((UnitType)t.UnitType).ToString())?.Sum(c => c.RealGiveFee), AssessLaterManagementFee = clinicalComputes?.Where(w => w.AccountingUnit == t.AccountingUnit && UnitTypeUtil.IsEqualsUnitType(w.UnitType, t.UnitType))?.Sum(c => c.RealGiveFee),
RealGiveFee = t.RealGiveFee, RealGiveFee = t.RealGiveFee,
}); });
...@@ -2164,32 +2164,21 @@ public ApiResponse Batch(BatchRequest request) ...@@ -2164,32 +2164,21 @@ public ApiResponse Batch(BatchRequest request)
if (string.IsNullOrEmpty(request.Batch)) if (string.IsNullOrEmpty(request.Batch))
throw new PerformanceException("“批次信息”空白,当前操作已拒绝"); throw new PerformanceException("“批次信息”空白,当前操作已拒绝");
var batchs = perforPerbatchRepository.GetEntities(w => w.AllotId == request.AllotId) ?? new List<per_batch>(); var freezeAllot = perforPerallotRepository.GetFreezeAllot(request.AllotId) ?? new List<view_allot_sign_emp>();
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>(); List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
foreach (var item in request.Details) foreach (var item in request.Details)
{ {
var bt = batchs.FirstOrDefault(w => !string.IsNullOrEmpty(w.Batch) && w.UnitType == item.UnitType && w.AccountingUnit == item.AccountingUnit && w.PersonnelNumber == item.JobNumber); var data = freezeAllot.FirstOrDefault(w => w.ID == item && !string.IsNullOrEmpty(w.Batch));
if (bt != null) if (data != null)
{ {
error.Add(new Dictionary<string, string> error.Add(new Dictionary<string, string>
{ {
{ "核算组别", item.UnitType??"" }, { "核算组别", data.UnitType??"" },
{ "核算单元", item.AccountingUnit??"" }, { "核算单元", data.AccountingUnit??"" },
{ "人员工号", item.JobNumber??"" }, { "人员工号", data.JobNumber??"" },
{ "姓名", item.EmployeeName??"" }, { "姓名", data.EmployeeName??"" },
{ "错误原因",$"已经标记;请取消标记后重试;批次“{bt.Batch}”" }, { "错误原因",$"已经标记;请取消标记后重试;批次“{data.Batch}”" },
});
}
if (string.IsNullOrEmpty(item.UnitType) || string.IsNullOrEmpty(item.AccountingUnit) || string.IsNullOrEmpty(item.JobNumber))
{
error.Add(new Dictionary<string, string>
{
{ "核算组别", item.UnitType??"" },
{ "核算单元", item.AccountingUnit??"" },
{ "人员工号", item.JobNumber??"" },
{ "姓名", item.EmployeeName??"" },
{ "错误原因",$"关键信息缺失" },
}); });
} }
} }
...@@ -2197,20 +2186,7 @@ public ApiResponse Batch(BatchRequest request) ...@@ -2197,20 +2186,7 @@ public ApiResponse Batch(BatchRequest request)
if (error.Count > 0) if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error); return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
var data = request.Details.Select(t => new per_batch perforPerallotRepository.Batch(request.Details.ToArray(), request.Batch, request.BatchDate, request.BankName);
{
HospitalId = request.HospitalId,
AllotId = request.AllotId,
Batch = request.Batch,
BatchDate = request.BatchDate ?? DateTime.Now,
BankName = request.BankName,
UnitType = t.UnitType,
AccountingUnit = t.AccountingUnit,
PersonnelNumber = t.JobNumber,
PersonnelName = t.EmployeeName
});
perforPerbatchRepository.AddRange(data.ToArray());
return new ApiResponse(ResponseType.OK, "标记成功"); return new ApiResponse(ResponseType.OK, "标记成功");
} }
...@@ -2224,36 +2200,7 @@ public ApiResponse BatchCancel(BatchCancelRequest request) ...@@ -2224,36 +2200,7 @@ public ApiResponse BatchCancel(BatchCancelRequest request)
{ {
if (request == null || request.Details == null || !request.Details.Any()) if (request == null || request.Details == null || !request.Details.Any())
throw new PerformanceException("提交了空白的人员信息,当前操作已拒绝"); throw new PerformanceException("提交了空白的人员信息,当前操作已拒绝");
perforPerallotRepository.Batch(request.Details.ToArray(), "", null, "");
List<Dictionary<string, string>> error = new List<Dictionary<string, string>>();
var batchs = perforPerbatchRepository.GetEntities(w => w.AllotId == request.AllotId) ?? new List<per_batch>();
var deletes = new List<per_batch>();
foreach (var item in request.Details)
{
if (string.IsNullOrEmpty(item.UnitType) || string.IsNullOrEmpty(item.AccountingUnit) || string.IsNullOrEmpty(item.JobNumber))
{
error.Add(new Dictionary<string, string>
{
{ "核算组别", item.UnitType??"" },
{ "核算单元", item.AccountingUnit??"" },
{ "人员工号", item.JobNumber??"" },
{ "姓名", item.EmployeeName??"" },
{ "错误原因",$"关键信息缺失" },
});
}
var bt = batchs.FirstOrDefault(w => w.UnitType == item.UnitType && w.AccountingUnit == item.AccountingUnit && w.PersonnelNumber == item.JobNumber);
if (bt != null)
{
deletes.Add(bt);
}
}
if (error.Count > 0)
return new ApiResponse(ResponseType.WarningTable, "验证不通过,当前操作已拒绝", error);
if (deletes.Count > 0)
perforPerbatchRepository.RemoveRange(deletes.ToArray());
return new ApiResponse(ResponseType.OK, "取消标记操作成功"); return new ApiResponse(ResponseType.OK, "取消标记操作成功");
} }
......
...@@ -330,8 +330,8 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<PerS ...@@ -330,8 +330,8 @@ public List<ComputeResult> Compute(List<ComputeEmployee> empolyeeList, List<PerS
unitType = unit.FirstOrDefault(t => t.UnitType.ToString() == empolyee.UnitType)?.NewUnitType; unitType = unit.FirstOrDefault(t => t.UnitType.ToString() == empolyee.UnitType)?.NewUnitType;
} }
var resAccount = dataList.FirstOrDefault(t => ((UnitType)t.UnitType).ToString() == empolyee.UnitType && t.AccountingUnit == empolyee.AccountingUnit) var resAccount = dataList.FirstOrDefault(t => UnitTypeUtil.IsEqualsUnitType(empolyee.UnitType, t.UnitType) && t.AccountingUnit == empolyee.AccountingUnit)
?? dataList.FirstOrDefault(t => ((UnitType)t.UnitType).ToString() == unitType && t.AccountingUnit == empolyee.AccountingUnit); ?? dataList.FirstOrDefault(t => UnitTypeUtil.IsEqualsUnitType(unitType, t.UnitType) && t.AccountingUnit == empolyee.AccountingUnit);
if (resAccount == null && empolyees.Count() > 1) if (resAccount == null && empolyees.Count() > 1)
{ {
// 如果没有找到科室,则找相同用户的其他核算单元类型 // 如果没有找到科室,则找相同用户的其他核算单元类型
......
...@@ -586,8 +586,8 @@ private List<BodyItem> GetBringItems(UseTempRequest request, List<HeadItem> head ...@@ -586,8 +586,8 @@ private List<BodyItem> GetBringItems(UseTempRequest request, List<HeadItem> head
private void FillData(ag_secondallot second, List<BodyItem> bodyItems) private void FillData(ag_secondallot second, List<BodyItem> bodyItems)
{ {
if (bodyItems == null || !bodyItems.Any()) return; if (bodyItems == null || !bodyItems.Any()) return;
var unitType = UnitTypeUtil.GetUnitTypeValue(second.UnitType);
var account = resaccountRepository.GetEntity(t => t.AllotID == second.AllotId && t.AccountingUnit == second.Department && ((UnitType)t.UnitType).ToString() == second.UnitType); var account = resaccountRepository.GetEntity(t => t.AllotID == second.AllotId && t.AccountingUnit == second.Department && t.UnitType == unitType);
var keyValue = new Dictionary<string, string> var keyValue = new Dictionary<string, string>
{ {
...@@ -1545,7 +1545,7 @@ private List<ag_secondallot> SecondList(per_allot allot, List<res_account> accou ...@@ -1545,7 +1545,7 @@ private List<ag_secondallot> SecondList(per_allot allot, List<res_account> accou
var secondList = agsecondallotRepository.GetEntities(t => t.AllotId == allot.ID && t.Year == allot.Year && t.Month == allot.Month); var secondList = agsecondallotRepository.GetEntities(t => t.AllotId == allot.ID && t.Year == allot.Year && t.Month == allot.Month);
var result = temps.Select(t => var result = temps.Select(t =>
{ {
var second = secondList?.FirstOrDefault(f => f.UnitType == ((UnitType)t.UnitType).ToString() && f.Department == t.AccountingUnit); var second = secondList?.FirstOrDefault(f => UnitTypeUtil.IsEqualsUnitType(f.UnitType, t.UnitType) && f.Department == t.AccountingUnit);
if (second != null) return second; if (second != null) return second;
return new ag_secondallot return new ag_secondallot
{ {
......
...@@ -67,6 +67,26 @@ public static bool IsEqualsUnitType(string left, string right) ...@@ -67,6 +67,26 @@ public static bool IsEqualsUnitType(string left, string right)
{ {
return left?.Replace("行政后勤", "行政工勤") == right?.Replace("行政后勤", "行政工勤"); return left?.Replace("行政后勤", "行政工勤") == right?.Replace("行政后勤", "行政工勤");
} }
/// <summary>
/// 核算单元类型是否相同
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
public static bool IsEqualsUnitType(string left, int? right)
{
if (!Enum.IsDefined(typeof(UnitType), right))
return false;
return left?.Replace("行政后勤", "行政工勤") == ((UnitType)right).ToString()?.Replace("行政后勤", "行政工勤");
}
public static int GetUnitTypeValue(string unitType)
{
if (Enum.TryParse(typeof(UnitType), unitType, true, out object value))
return (int)value;
return 0;
}
public static bool Is(string unit, params UnitType[] types) public static bool Is(string unit, params UnitType[] types)
{ {
......
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