Commit a9fa3be3 by lcx

Merge branch 'feature/自动执行“加载上月”' into develop

# Conflicts:
#	performance/Performance.Api/Job/JobRegistry.cs
#	performance/Performance.Api/Startup.cs
parents a708b1e2 5928d132
......@@ -234,6 +234,7 @@ public ApiResponse ImportExtraction(int allotId)
allot.Remark = EnumHelper.GetDescription(AllotStates.FileUploaded);
allot.UploadDate = DateTime.Now;
allot.Generate = (int)AllotGenerate.Init;
allot.IsModifyConfig = 1;
if (!_allotService.Update(allot))
return new ApiResponse(ResponseType.Fail, $"上传成功,修改状态失败");
_configService.Clear(allot.ID);
......
......@@ -394,6 +394,20 @@ public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest
#endregion
/// <summary>
/// 修改列头显示状态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("updateheadersstatus")]
[HttpPost]
public ApiResponse UpdateHeadersStatus([FromBody] ComputerAliasUpdate request)
{
if (_computeService.UpdateHeadersStatus(request))
return new ApiResponse(ResponseType.OK, "修改成功");
return new ApiResponse(ResponseType.OK, "修改失败");
}
/// <summary>
/// 自定义列头
/// </summary>
/// <param name="request"></param>
......
......@@ -128,16 +128,17 @@ public ApiResponse Import(int hospitalId, [FromForm] IFormCollection form)
/// 获取人员标签配置
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("ReportPersonTag")]
[HttpPost]
public ApiResponse ReportPersonTag(int hospitalId)
public ApiResponse ReportPersonTag(int hospitalId, int allotId)
{
if (hospitalId<=0)
if (hospitalId <= 0)
{
return new ApiResponse(ResponseType.Fail,"参数错误", "hospitalId无效");
return new ApiResponse(ResponseType.Fail, "参数错误", "hospitalId无效");
}
var relust = reportGlobalService.GetReportPersonTag(hospitalId);
var relust = reportGlobalService.GetReportPersonTag(hospitalId, allotId);
return new ApiResponse(ResponseType.OK, relust);
}
......@@ -145,17 +146,20 @@ public ApiResponse ReportPersonTag(int hospitalId)
/// 保存科室标签配置
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("saveReportPersonTag")]
[Route("saveReportPersonTag/{allotId}")]
[HttpPost]
public ApiResponse SaveReportPersonTag(int hospitalId,[FromBody] SaveCollectData request)
public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, [FromBody] SaveCollectData request)
{
if (hospitalId <= 0)
{
return new ApiResponse(ResponseType.Fail, "参数错误", "hospitalId无效");
}
reportGlobalService.SaveReportPersonTag(hospitalId,request);
var result = reportGlobalService.SaveReportPersonTag(hospitalId, allotId, request);
if (result != null && result.Any())
return new ApiResponse(ResponseType.Fail, $"保存失败:工号{string.Join(", ", result)}不存在");
return new ApiResponse(ResponseType.OK);
}
......
using FluentScheduler;
using Microsoft.Extensions.Logging;
using Performance.Infrastructure;
using Performance.Repository;
using Performance.Services;
using System;
using System.Linq;
namespace Performance.Api
{
public class AutoSyncConfigJob : IJob
{
private readonly ILogger logger;
private readonly PerforPerallotRepository perallotRepository;
private readonly ConfigService configService;
public AutoSyncConfigJob(
ILogger<AutoSyncConfigJob> logger,
PerforPerallotRepository perallotRepository,
ConfigService configService
)
{
this.logger = logger;
this.perallotRepository = perallotRepository;
this.configService = configService;
}
public void Execute()
{
try
{
logger.LogInformation("开始同步配置");
var list = perallotRepository.GetEntities();
if (list == null || !list.Any()) return;
var hospitalIds = list.Select(t => t.HospitalId).Distinct().OrderBy(t => t);
foreach (var hospitalId in hospitalIds)
{
var allots = list.Where(w => w.HospitalId == hospitalId)?.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
if (allots == null || !allots.Any()) continue;
while (allots != null && allots.Any(w => w.IsModifyConfig == 0))
{
var prevAllot = allots.FirstOrDefault(t => t.IsModifyConfig == 1);
if (prevAllot == null) continue;
var date = ConvertHelper.To<DateTime>($"{prevAllot.Year}-{prevAllot.Month}");
var needSyncData = allots.Where(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") > date);
if (needSyncData != null && needSyncData.Any())
{
foreach (var item in needSyncData)
configService.CopyCommand(item, prevAllot.ID, true);
}
var noModify = allots.FirstOrDefault(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") < date && w.IsModifyConfig == 0);
if (noModify != null)
date = ConvertHelper.To<DateTime>($"{noModify.Year}-{noModify.Month}");
allots = allots.Where(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") <= date)?.ToList();
}
}
logger.LogInformation("同步配置结束");
}
catch (Exception ex)
{
logger.LogError($"同步配置发生异常:" + ex);
}
}
}
}
......@@ -14,6 +14,7 @@ public JobRegistry(IServiceProvider provider)
//Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(60).Seconds();
Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(1).Days().At(3, 00);
Schedule(() => provider.GetService<BackgroundJob>()).ToRunNow().AndEvery(10).Seconds();
Schedule(() => provider.GetService<AutoSyncConfigJob>()).ToRunEvery(1).Days().At(0, 00);
}
}
}
......@@ -103,6 +103,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddTransient<ExtractDataJob>();
services.AddTransient<ClearLoggerJob>();
services.AddTransient<BackgroundJob>();
services.AddTransient<AutoSyncConfigJob>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
......@@ -545,6 +545,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.UpdateHeadersStatus(Performance.DtoModels.ComputerAliasUpdate)">
<summary>
修改列头显示状态
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.CustomColumnHeaders(Performance.DtoModels.ComputerAliasRequest)">
<summary>
自定义列头
......@@ -1785,18 +1792,20 @@
<param name="form"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportGlobalController.ReportPersonTag(System.Int32)">
<member name="M:Performance.Api.Controllers.ReportGlobalController.ReportPersonTag(System.Int32,System.Int32)">
<summary>
获取人员标签配置
</summary>
<param name="hospitalId"></param>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportGlobalController.SaveReportPersonTag(System.Int32,Performance.DtoModels.SaveCollectData)">
<member name="M:Performance.Api.Controllers.ReportGlobalController.SaveReportPersonTag(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
保存科室标签配置
</summary>
<param name="hospitalId"></param>
<param name="allotId"></param>
<param name="request"></param>
<returns></returns>
</member>
......
......@@ -1715,6 +1715,11 @@
状态 1 求和 0 不求和
</summary>
</member>
<member name="P:Performance.EntityModels.cof_alias.Sort">
<summary>
排序
</summary>
</member>
<member name="T:Performance.EntityModels.cof_check">
<summary>
上传excel文件校验配置
......@@ -5940,6 +5945,11 @@
自定义提取绩效数据文件生成路径
</summary>
</member>
<member name="P:Performance.EntityModels.per_allot.IsModifyConfig">
<summary>
是否修改过配置 1修改过 0未修改
</summary>
</member>
<member name="T:Performance.EntityModels.per_apr_amount">
<summary>
......
......@@ -54,6 +54,19 @@ public class ComputerAliasRequest
public string[] Heads { get; set; }
}
public class ComputerAliasUpdate
{
public int HospitalId { get; set; }
public string Route { get; set; }
public List<ComputerAliasHead> computerAliasHead { get; set; }
}
public class ComputerAliasHead
{
public string Head { get; set; }
public int HeadId { get; set; }
public int Sort { get; set; }
}
public class BeginEndTime
{
public string BeginTime { get; set; } // 2021-01
......
......@@ -49,10 +49,16 @@ public class cof_alias
/// <summary>
/// 状态 1 可用 0 禁用
/// </summary>
public Nullable<int> States { get; set; }
public int States { get; set; }
/// <summary>
/// 状态 1 求和 0 不求和
/// </summary>
public Nullable<int> SumStatus { get; set; }
public int SumStatus { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
}
}
......@@ -100,5 +100,10 @@ public class per_allot
/// 自定义提取绩效数据文件生成路径
/// </summary>
public string CustomExtractPath { get; set; }
/// <summary>
/// 是否修改过配置 1修改过 0未修改
/// </summary>
public int IsModifyConfig { get; set; }
}
}
......@@ -2002,20 +2002,99 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
return Math.Round(value.Value, decimals, MidpointRounding.AwayFromZero);
}
/// <summary>
/// 发放表自定义列头
/// 自定义列头显示状态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params string[] heads)
public bool UpdateHeadersStatus(ComputerAliasUpdate request)
{
var init = new List<cof_alias>();
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId) ?? new List<cof_alias>();
alias = alias.Where(t => t.Route.Equals(route, StringComparison.OrdinalIgnoreCase)).OrderBy(w => w.Id).ToList() ?? new List<cof_alias>();
var heads = CustomColumnHeaders(request.HospitalId, request.Route);
var list = cofaliasRepository.GetEntities(w => w.HospitalId == request.HospitalId && w.Route == request.Route);
var hasreq = request.computerAliasHead != null && request.computerAliasHead.Any();
var hasdata = list != null && list.Any();
// 数据库中无数据
if (hasreq && !hasdata)
{
var items = request.computerAliasHead.Select(t => t.Head.ToLower());
var data = heads.Select(t => new cof_alias
{
Route = request.Route,
Alias = t.Alias,
OriginalName = t.Alias,
HospitalId = request.HospitalId,
Name = t.Name,
States = items.Contains(t.Alias ?? "") ? 1 : 0,
SumStatus = t.SumStatus,
Sort = request.computerAliasHead.FirstOrDefault(w => w.Head == t.Alias).Sort
});
cofaliasRepository.AddRange(data.ToArray());
}
// 未提交数据
else if (!hasreq && hasdata)
{
list.ForEach(t => t.States = 0);
cofaliasRepository.UpdateRange(list.ToArray());
}
if (alias == null || alias.Count == 0)
// 修改 && 新增
else if (hasreq && hasdata)
{
var pairs = new Dictionary<string, List<cof_alias>>
var headIds = request.computerAliasHead.Select(t => t.HeadId);
if (list.Any(w => headIds.Contains(w.Id)))
{
list.ForEach(t =>
{
if (headIds.Contains(t.Id))
{
var item = request.computerAliasHead.FirstOrDefault(w => w.HeadId == t.Id);
t.States = 1;
t.Alias = item.Head;
t.Sort = item.Sort;
}
else
t.States = 0;
});
cofaliasRepository.UpdateRange(list.ToArray());
}
if (headIds.Any(w => w == 0))
{
var table = cofaliasRepository.GetEntities(w => w.Route == request.Route);
var items = heads.Where(w => request.computerAliasHead.Where(w => w.HeadId == 0).Select(t => t.Head).Contains(w.Alias));
var data = items.Select(t => new cof_alias
{
Route = request.Route,
Alias = t.Alias,
OriginalName = t.Alias,
HospitalId = request.HospitalId,
Name = t.Name,
States = 1,
SumStatus = t.SumStatus,
Sort = request.computerAliasHead.FirstOrDefault(w => w.Head == t.Alias).Sort
});
cofaliasRepository.AddRange(data.ToArray());
}
}
return true;
}
/// <summary>
/// 发放表自定义列头
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params string[] heads)
{
var pairs = new Dictionary<string, List<cof_alias>>
{
{ "/result/compute" , ComputeConfig.AllComputeView },
{ "/result/wholehospital" , ComputeConfig.AllComputePersonView },
......@@ -2030,28 +2109,34 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params
{ "/report/wholehospital_finance_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) },
};
init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
}
var init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
if (alias != null && alias.Count > 0)
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId && t.Route.Equals(route, StringComparison.OrdinalIgnoreCase))?.OrderBy(w => w.Sort).ToList()
?? new List<cof_alias>();
if (alias == null || !alias.Any()) return init;
foreach (var item in alias)
{
foreach (var item in alias)
var x = init.FirstOrDefault(w => w.Name.Equals(item.Name, StringComparison.OrdinalIgnoreCase));
if (x == null)
{
var x = init.FirstOrDefault(w => w.Name.Equals(item.Name, StringComparison.OrdinalIgnoreCase));
if (x == null)
{
init.Add(item);
}
else
{
x.HospitalId = hospitalId;
x.Route = route;
x.Alias = item.Alias;
x.States = item.States;
}
init.Add(item);
}
}
return init;
else
{
x.Id = item.Id;
x.HospitalId = hospitalId;
x.Route = route;
x.OriginalName = item.OriginalName;
x.Alias = item.Alias;
x.States = item.States;
x.SumStatus = item.SumStatus;
x.Sort = item.Sort;
}
};
return init?.OrderBy(t => t.Sort).ToList();
}
public bool Batch(BatchRequest request)
......@@ -2181,33 +2266,35 @@ public static List<cof_alias> PerformanceTotal(string route, string[] heads)
return AllComputePersonView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
return null;
}
public static List<cof_alias> AllComputeView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "来源", Name = nameof(view_allot_sign_emp.Source), States = 1, SumStatus = 0},
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0},
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0},
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0},
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0},
new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1, SumStatus = 0},
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1, SumStatus = 0},
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1, SumStatus = 0},
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1, SumStatus = 0},
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1, SumStatus = 0},
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "来源", Name = nameof(view_allot_sign_emp.Source), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0, Sort = 3 },
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0, Sort = 4 },
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0, Sort = 5 },
new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1, SumStatus = 0, Sort = 6 },
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1, SumStatus = 0, Sort = 7 },
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1, SumStatus = 0, Sort = 8 },
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1, SumStatus = 0, Sort = 9 },
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1, SumStatus = 0, Sort = 10 },
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 13 },
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1, Sort = 14 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1, Sort = 15 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1, Sort = 16 },
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1, Sort = 17 },
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1, Sort = 18 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1, Sort = 19 },
};
private static List<cof_alias> _allComputeViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeViewByDate
{
get
......@@ -2222,28 +2309,25 @@ public static List<cof_alias> AllComputeViewByDate
}
}
public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0},
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0},
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0},
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0},
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0, Sort = 3 },
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0, Sort = 4 },
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1, Sort = 5 },
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1, Sort = 6 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 7 },
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1, Sort = 8 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1, Sort = 9 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1, Sort = 10 },
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1, Sort = 13 },
};
private static List<cof_alias> _allComputePersonViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputePersonViewByDate
{
get
......@@ -2257,28 +2341,31 @@ public static List<cof_alias> AllComputePersonViewByDate
return _allComputePersonViewByDate;
}
}
public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_dept.UnitType), States = 1, SumStatus = 0},
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_dept.AccountingUnit), States = 1, SumStatus = 0},
new cof_alias{ Alias = "业绩绩效", Name = nameof(view_allot_sign_dept.PerforFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "工作量绩效", Name = nameof(view_allot_sign_dept.WorkloadFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核前其他绩效", Name = nameof(view_allot_sign_dept.AssessBeforeOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核前绩效合计", Name = nameof(view_allot_sign_dept.PerforTotal), States = 1, SumStatus = 1},
new cof_alias{ Alias = "科室考核得分", Name = nameof(view_allot_sign_dept.ScoringAverage), States = 1, SumStatus = 1},
new cof_alias{ Alias = "药占比奖罚", Name = nameof(view_allot_sign_dept.MedicineExtra), States = 1, SumStatus = 1},
new cof_alias{ Alias = "材料占比奖罚", Name = nameof(view_allot_sign_dept.MaterialsExtra), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院奖罚", Name = nameof(view_allot_sign_dept.Extra), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核后其他绩效", Name = nameof(view_allot_sign_dept.AssessLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核后绩效", Name = nameof(view_allot_sign_dept.AssessLaterPerforTotal), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节系数", Name = nameof(view_allot_sign_dept.AdjustFactor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_dept.AdjustLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "科主任实发管理绩效", Name = nameof(view_allot_sign_dept.AssessLaterManagementFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_dept.AprPerforAmount), States = 1, SumStatus = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1, SumStatus = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_dept.UnitType), States = 1, SumStatus = 0, Sort = 1 },
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_dept.AccountingUnit), States = 1, SumStatus = 0, Sort = 2 },
new cof_alias{ Alias = "业绩绩效", Name = nameof(view_allot_sign_dept.PerforFee), States = 1, SumStatus = 1, Sort = 3 },
new cof_alias{ Alias = "工作量绩效", Name = nameof(view_allot_sign_dept.WorkloadFee), States = 1, SumStatus = 1, Sort = 4 },
new cof_alias{ Alias = "考核前其他绩效", Name = nameof(view_allot_sign_dept.AssessBeforeOtherFee), States = 1, SumStatus = 1, Sort = 5 },
new cof_alias{ Alias = "考核前绩效合计", Name = nameof(view_allot_sign_dept.PerforTotal), States = 1, SumStatus = 1, Sort = 6 },
new cof_alias{ Alias = "科室考核得分", Name = nameof(view_allot_sign_dept.ScoringAverage), States = 1, SumStatus = 1, Sort = 7 },
new cof_alias{ Alias = "药占比奖罚", Name = nameof(view_allot_sign_dept.MedicineExtra), States = 1, SumStatus = 1, Sort = 8 },
new cof_alias{ Alias = "材料占比奖罚", Name = nameof(view_allot_sign_dept.MaterialsExtra), States = 1, SumStatus = 1, Sort = 9 },
new cof_alias{ Alias = "医院奖罚", Name = nameof(view_allot_sign_dept.Extra), States = 1, SumStatus = 1, Sort = 10 },
new cof_alias{ Alias = "考核后其他绩效", Name = nameof(view_allot_sign_dept.AssessLaterOtherFee), States = 1, SumStatus = 1, Sort = 11 },
new cof_alias{ Alias = "考核后绩效", Name = nameof(view_allot_sign_dept.AssessLaterPerforTotal), States = 1, SumStatus = 1, Sort = 12 },
new cof_alias{ Alias = "调节系数", Name = nameof(view_allot_sign_dept.AdjustFactor), States = 1, SumStatus = 1, Sort = 13 },
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_dept.AdjustLaterOtherFee), States = 1, SumStatus = 1, Sort = 14 },
new cof_alias{ Alias = "科主任实发管理绩效", Name = nameof(view_allot_sign_dept.AssessLaterManagementFee), States = 1, SumStatus = 1, Sort = 15 },
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_dept.AprPerforAmount), States = 1, SumStatus = 1, Sort = 16 },
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1, SumStatus = 1, Sort = 17 },
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1, SumStatus = 1, Sort = 18 },
};
private static List<cof_alias> _allComputeDepartmentViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeDepartmentViewByDate
{
get
......
......@@ -940,6 +940,11 @@ public void Copy(per_allot allot)
int allotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID;
if (allotId == allot.ID) allotId = -1;
CopyCommand(allot, allotId);
}
public void CopyCommand(per_allot allot, int prevAllotId, bool delHistotyData = false)
{
#region 弃用
//var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
......@@ -992,13 +997,17 @@ public void Copy(per_allot allot)
#endregion
personService.CreateAllotPersons(allot.HospitalId, allot.ID, allotId);
var flag = delHistotyData;
personService.CreateAllotPersons(allot.HospitalId, allot.ID, prevAllotId);
logger.LogInformation($"copy workItems");
var workItems = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
if (workItems == null || !workItems.Any())
if (delHistotyData && workItems != null && workItems.Any())
flag = _workitemRepository.RemoveRange(workItems.ToArray());
if (flag || workItems == null || !workItems.Any())
{
workItems = _workitemRepository.GetEntities(t => t.AllotID == allotId) ?? _workitemRepository.GetEntities(t => t.AllotID == -1);
workItems = _workitemRepository.GetEntities(t => t.AllotID == prevAllotId) ?? _workitemRepository.GetEntities(t => t.AllotID == -1);
if (workItems != null && workItems.Any())
{
var newWorkItems = workItems.Select(t => new cof_workitem { AllotID = allot.ID, Type = t.Type, Item = t.Item });
......@@ -1008,9 +1017,11 @@ public void Copy(per_allot allot)
logger.LogInformation($"copy drugTypes");
var drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID);
if (drugTypes == null || !drugTypes.Any())
if (delHistotyData && drugTypes != null && drugTypes.Any())
flag = _drugtypeRepository.RemoveRange(drugTypes.ToArray());
if (flag || drugTypes == null || !drugTypes.Any())
{
drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == prevAllotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
if (drugTypes != null && drugTypes.Any())
{
var newDrugTypes = drugTypes.Select(t => new cof_drugtype { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
......@@ -1020,9 +1031,11 @@ public void Copy(per_allot allot)
logger.LogInformation($"copy drugTypeDisburses");
var drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == allot.ID);
if (drugTypeDisburses == null || !drugTypeDisburses.Any())
if (delHistotyData && drugTypeDisburses != null && drugTypeDisburses.Any())
flag = drugtypeDisburseRepository.RemoveRange(drugTypeDisburses.ToArray());
if (flag || drugTypeDisburses == null || !drugTypeDisburses.Any())
{
drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == allotId) ?? drugtypeDisburseRepository.GetEntities(t => t.AllotID == -1);
drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == prevAllotId) ?? drugtypeDisburseRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeDisburses != null && drugTypeDisburses.Any())
{
var newDrugTypeDisburses = drugTypeDisburses.Select(t => new cof_drugtype_disburse { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
......@@ -1032,9 +1045,11 @@ public void Copy(per_allot allot)
logger.LogInformation($"copy drugTypeFactors");
var drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == allot.ID);
if (drugTypeFactors == null || !drugTypeFactors.Any())
if (delHistotyData && drugTypeFactors != null && drugTypeFactors.Any())
flag = cofdrugtypefactorRepository.RemoveRange(drugTypeFactors.ToArray());
if (flag || drugTypeFactors == null || !drugTypeFactors.Any())
{
drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == allotId) ?? cofdrugtypefactorRepository.GetEntities(t => t.AllotID == -1);
drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == prevAllotId) ?? cofdrugtypefactorRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeFactors != null && drugTypeFactors.Any())
{
var newDrugtypeFactors = drugTypeFactors.Select(t => new cof_drugtype_factor
......@@ -1053,9 +1068,11 @@ public void Copy(per_allot allot)
logger.LogInformation($"copy deptTypes");
var deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allot.ID);
if (deptTypes == null || !deptTypes.Any())
if (delHistotyData && deptTypes != null && deptTypes.Any())
flag = perforCofdepttypeRepository.RemoveRange(deptTypes.ToArray());
if (flag || deptTypes == null || !deptTypes.Any())
{
deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allotId) ?? perforCofdepttypeRepository.GetEntities(t => t.AllotID == -1);
deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == prevAllotId) ?? perforCofdepttypeRepository.GetEntities(t => t.AllotID == -1);
if (deptTypes != null && deptTypes.Any())
{
var newDeptTypes = deptTypes.Select(t => new cof_depttype { AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
......@@ -1065,9 +1082,11 @@ public void Copy(per_allot allot)
logger.LogInformation($"copy agains");
var agains = _againRepository.GetEntities(t => t.AllotID == allot.ID);
if (agains == null || !agains.Any())
if (delHistotyData && agains != null && agains.Any())
flag = _againRepository.RemoveRange(agains.ToArray());
if (flag || agains == null || !agains.Any())
{
agains = _againRepository.GetEntities(t => t.AllotID == allotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
agains = _againRepository.GetEntities(t => t.AllotID == prevAllotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
if (agains != null && agains.Any())
{
var days = DateTime.DaysInMonth(allot.Year, allot.Month);
......@@ -1078,9 +1097,11 @@ public void Copy(per_allot allot)
logger.LogInformation($"copy accountings");
var accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allot.ID);
if (accountings == null || !accountings.Any())
if (delHistotyData && accountings != null && accountings.Any())
flag = cofaccountingRepository.RemoveRange(accountings.ToArray());
if (flag || accountings == null || !accountings.Any())
{
accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allotId) ?? cofaccountingRepository.GetEntities(t => t.AllotId == -1);
accountings = cofaccountingRepository.GetEntities(t => t.AllotId == prevAllotId) ?? cofaccountingRepository.GetEntities(t => t.AllotId == -1);
if (accountings != null && accountings.Any())
{
var newAccountings = accountings.Select(t => new cof_accounting { AllotId = allot.ID, UnitType = t.UnitType, AccountingUnit = t.AccountingUnit });
......
......@@ -748,12 +748,12 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<per_employee>(json);
if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"]))
{
decimal attendanceDay = ConvertHelper.To<decimal>(item["AttendanceDay"]), reservedRatio = ConvertHelper.To<decimal>(item["ReservedRatio"]);
if ((!Regex.IsMatch(item["AttendanceDay"], "^(?:[0-2]*[0-9]?|30|31)$")) || (!Regex.IsMatch(item["ReservedRatio"], @"^(0.\d{1,2}|0|1)?$")))
return false;
}
//if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"]))
//{
// decimal attendanceDay = ConvertHelper.To<decimal>(item["AttendanceDay"]), reservedRatio = ConvertHelper.To<decimal>(item["ReservedRatio"]);
// if ((!Regex.IsMatch(item["AttendanceDay"], "^(?:[0-2]*[0-9]?|30|31)$")) || (!Regex.IsMatch(item["ReservedRatio"], @"^(0.\d{1,2}|0|1)?$")))
// return false;
//}
var any = employees.Any(w => w.Department?.Trim() == data.Department?.Trim() && w.DoctorName?.Trim() == data.DoctorName?.Trim());
......@@ -944,15 +944,15 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
(nameof(PersonePassword.Department), "科室名称", t => t.Department),
(nameof(PersonePassword.DoctorName), "姓名" ,t => t.DoctorName),
(nameof(PersonePassword.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
(nameof(PersonePassword.JobCategory), "正式/临聘", t => t.JobCategory),
(nameof(PersonePassword.Duty), "职务", t => t.Duty),
(nameof(PersonePassword.JobTitle), "职称", t => t.JobTitle),
//(nameof(PersonePassword.JobCategory), "正式/临聘", t => t.JobCategory),
//(nameof(PersonePassword.Duty), "职务", t => t.Duty),
//(nameof(PersonePassword.JobTitle), "职称", t => t.JobTitle),
(nameof(PersonePassword.UnitType), "人员类别", t => t.UnitType),
(nameof(PersonePassword.AttendanceDay), "出勤天数", t => t.AttendanceDay),
(nameof(PersonePassword.ReservedRatio), "预留比例", t => t.ReservedRatio),
(nameof(PersonePassword.BankCard), "银行卡号", t => t.BankCard),
(nameof(PersonePassword.Password), "密码", t => t.Password),
(nameof(PersonePassword.Remark), "备注", t => t.Remark),
//(nameof(PersonePassword.AttendanceDay), "出勤天数", t => t.AttendanceDay),
//(nameof(PersonePassword.ReservedRatio), "预留比例", t => t.ReservedRatio),
//(nameof(PersonePassword.BankCard), "银行卡号", t => t.BankCard),
//(nameof(PersonePassword.Password), "密码", t => t.Password),
//(nameof(PersonePassword.Remark), "备注", t => t.Remark),
};
public static List<(string, string, Func<per_employee, object>)> Person { get; } = new List<(string, string, Func<per_employee, object>)>
......@@ -961,14 +961,14 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
(nameof(per_employee.Department), "科室名称", t => t.Department),
(nameof(per_employee.DoctorName), "姓名" ,t => t.DoctorName),
(nameof(per_employee.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
(nameof(per_employee.JobCategory), "正式/临聘", t => t.JobCategory),
(nameof(per_employee.Duty), "职务", t => t.Duty),
(nameof(per_employee.JobTitle), "职称", t => t.JobTitle),
//(nameof(per_employee.JobCategory), "正式/临聘", t => t.JobCategory),
//(nameof(per_employee.Duty), "职务", t => t.Duty),
//(nameof(per_employee.JobTitle), "职称", t => t.JobTitle),
(nameof(per_employee.UnitType), "人员类别", t => t.UnitType),
(nameof(per_employee.AttendanceDay), "出勤天数", t => t.AttendanceDay),
(nameof(per_employee.ReservedRatio), "预留比例", t => t.ReservedRatio),
(nameof(per_employee.BankCard), "银行卡号", t => t.BankCard),
(nameof(per_employee.Remark), "备注", t => t.Remark),
//(nameof(per_employee.AttendanceDay), "出勤天数", t => t.AttendanceDay),
//(nameof(per_employee.ReservedRatio), "预留比例", t => t.ReservedRatio),
//(nameof(per_employee.BankCard), "银行卡号", t => t.BankCard),
//(nameof(per_employee.Remark), "备注", t => t.Remark),
};
private static Dictionary<string, string> DeptDic { get; } = new Dictionary<string, string>
......
......@@ -24,6 +24,7 @@ public class ReportGlobalService : IAutoInjection
private readonly PerforHisimportbaiscnormRepository hisimportbaiscnormRepository;
private readonly PerforReportperformancetagsRepository reportperformancetagsRepository;
private readonly PerforReportperformancepersontagsRepository reportperformancepersontagsRepository;
private readonly PerforPeremployeeRepository perforPeremployeeRepository;
public ReportGlobalService(
ILogger<ReportGlobalService> logger,
......@@ -34,7 +35,8 @@ public class ReportGlobalService : IAutoInjection
PerforHisimportclinicRepository hisimportclinicRepository,
PerforHisimportbaiscnormRepository hisimportbaiscnormRepository,
PerforReportperformancetagsRepository reportperformancetagsRepository,
PerforReportperformancepersontagsRepository reportperformancepersontagsRepository
PerforReportperformancepersontagsRepository reportperformancepersontagsRepository,
PerforPeremployeeRepository perforPeremployeeRepository
)
{
this.logger = logger;
......@@ -46,6 +48,7 @@ PerforReportperformancepersontagsRepository reportperformancepersontagsRepositor
this.hisimportbaiscnormRepository = hisimportbaiscnormRepository;
this.reportperformancetagsRepository = reportperformancetagsRepository;
this.reportperformancepersontagsRepository = reportperformancepersontagsRepository;
this.perforPeremployeeRepository = perforPeremployeeRepository;
}
#region Report_Global
......@@ -523,7 +526,7 @@ private T GetCellValue<T>(IRow row, List<string> columns, string key)
#region 人员、科室标签配置
public HandsonTable GetReportPersonTag(int hospitalId)
public HandsonTable GetReportPersonTag(int hospitalId, int allotId)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, PersonTag.Select(t => t.Value).ToArray(), PersonTag.Select(t => new collect_permission
{
......@@ -531,8 +534,33 @@ public HandsonTable GetReportPersonTag(int hospitalId)
Visible = 1
}).ToList());
var data = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => ConvertHelper.To<long>(t.PersonnelNumber));
if (data == null) return result;
var pdata = perforPeremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == allotId);
var tdata = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId)?.OrderBy(t => ConvertHelper.To<long>(t.PersonnelNumber));
var data = (from t1 in pdata
join t2 in tdata
on t1.PersonnelNumber equals t2.PersonnelNumber into temp
from t in temp.DefaultIfEmpty()
select new
{
PersonnelNumber = t1.PersonnelNumber,
DoctorName = t1.DoctorName,
JobCategory = t1.JobCategory,
Duty = t1.Duty,
JobTitle = t1.JobTitle,
AttendanceDay = t1.AttendanceDay,
ReservedRatio = t1.ReservedRatio,
BankCard = t1.BankCard,
Remark = t1.Remark,
Tag1 = t?.Tag1,
Tag2 = t?.Tag2,
Tag3 = t?.Tag3,
Tag4 = t?.Tag4,
Tag5 = t?.Tag5,
}).Distinct()?.ToList();
if (data == null || !data.Any()) return result;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
......@@ -546,28 +574,104 @@ public HandsonTable GetReportPersonTag(int hospitalId)
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
//List<HandsonRowData> rowDatas2 = new List<HandsonRowData>();
//foreach (var item in rowDatas)
//{
// if (rowDatas2.Count == 0)
// rowDatas2.Add(item);
// var flag = true;
// foreach (var item2 in rowDatas2)
// {
// if (item.CellData.ToList()[1].Value.Equals(item2.CellData.ToList()[1].Value))
// flag = false;
// }
// if (flag)
// rowDatas2.Add(item);
//}
result.SetRowData(rowDatas, rowDatas != null);
result.Columns?.ForEach(t => t.Type = "text");
return result;
}
public void SaveReportPersonTag(int hospitalId, SaveCollectData request)
public List<string> SaveReportPersonTag(int hospitalId, int allotId, SaveCollectData request)
{
var employees = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId);
if (employees == null || !employees.Any()) throw new PerformanceException("人员字典中未保存数据");
var dicData = CreateDataRow(hospitalId, request, PersonTag);
var tags = reportperformancepersontagsRepository.GetEntities(t => t.HospitalId == hospitalId);
//工号不存在
List<string> personnelNumber = dicData.Select(item => item["PersonnelNumber"])?.ToList();
var notIn = personnelNumber.Except(employees.Select(t => t.PersonnelNumber).ToList())?.ToList();
if (notIn != null && notIn.Count > 0)
return notIn;
var upEmployees = new List<per_employee>();
var newTags = new List<report_performance_person_tags>();
var upTags = new List<report_performance_person_tags>();
List<report_performance_person_tags> personTags = new List<report_performance_person_tags>();
foreach (var item in dicData)
{
if (!item.ContainsKey("PersonnelNumber") || string.IsNullOrEmpty(item["PersonnelNumber"]))
continue;
var employee = employees.FirstOrDefault(t => t.PersonnelNumber == item["PersonnelNumber"]);
if (employee == null) continue;
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<report_performance_person_tags>(json);
if (!string.IsNullOrEmpty(data.UnitType) && !string.IsNullOrEmpty(data.AccountingUnit) && !string.IsNullOrEmpty(data.PersonnelName) && !string.IsNullOrEmpty(data.PersonnelNumber) && !string.IsNullOrEmpty(data.Tag1) && !string.IsNullOrEmpty(data.Tag2))
#region 人员字典表
var pdata = JsonHelper.Deserialize<per_employee>(json);
employee.PersonnelNumber = pdata.PersonnelNumber;
employee.DoctorName = pdata.DoctorName;
employee.JobCategory = pdata.JobCategory;
employee.Duty = pdata.Duty;
employee.JobTitle = pdata.JobTitle;
employee.AttendanceDay = pdata.AttendanceDay;
employee.ReservedRatio = pdata.ReservedRatio;
employee.BankCard = pdata.BankCard;
employee.Remark = pdata.Remark;
upEmployees.Add(employee);
#endregion
#region 人员标签表
var tdata = JsonHelper.Deserialize<report_performance_person_tags>(json);
tdata.PersonnelName = item["DoctorName"]?.ToString();
tdata.CreateTime = DateTime.Now;
tdata.AccountingUnit = employee.AccountingUnit;
tdata.UnitType = employee.UnitType;
var tag = tags.FirstOrDefault(t => t.PersonnelNumber == item["PersonnelNumber"]);
if (tag != null)
{
data.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
personTags.Add(data);
tag.AccountingUnit = employee.AccountingUnit;
tag.UnitType = employee.UnitType;
tag.PersonnelName = tdata.PersonnelName;
tag.PersonnelNumber = tdata.PersonnelNumber;
tag.Tag1 = tdata.Tag1;
tag.Tag2 = tdata.Tag2;
tag.Tag3 = tdata.Tag3;
tag.Tag4 = tdata.Tag4;
tag.Tag5 = tdata.Tag5;
upTags.Add(tag);
}
else
newTags.Add(tdata);
#endregion
}
reportperformancepersontagsRepository.Execute("delete from report_performance_person_tags where HospitalId=@hospitalId", new { hospitalId });
reportperformancepersontagsRepository.AddRange(personTags.ToArray());
if (upEmployees != null && upEmployees.Any())
perforPeremployeeRepository.UpdateRange(upEmployees.ToArray());
if (newTags != null && newTags.Any())
reportperformancepersontagsRepository.AddRange(newTags.ToArray());
if (upTags != null && upTags.Any())
reportperformancepersontagsRepository.UpdateRange(upTags.ToArray());
return new List<string>();
}
public HandsonTable GetReportTag(int hospitalId)
......@@ -619,11 +723,20 @@ public void SaveReportTag(int hospitalId, SaveCollectData request)
private static Dictionary<string, string> PersonTag { get; } = new Dictionary<string, string>
{
{nameof(report_performance_person_tags.UnitType), "核算单元类型"},
{nameof(report_performance_person_tags.AccountingUnit), "科室"},
{nameof(report_performance_person_tags.PersonnelNumber), "工号"},
{nameof(report_performance_person_tags.PersonnelName), "姓名"},
{nameof(report_performance_person_tags.Tag1), "绩效发放情况"},
//{nameof(report_performance_person_tags.UnitType), "核算单元类型"},
//{nameof(report_performance_person_tags.AccountingUnit), "科室"},
//{nameof(per_employee.Id), "Id"},
{nameof(per_employee.PersonnelNumber), "工号"},
{nameof(per_employee.DoctorName), "姓名"},
{nameof(per_employee.JobCategory), "正式/临聘" },
{nameof(per_employee.Duty), "职务" },
{nameof(per_employee.JobTitle), "职称" },
{nameof(per_employee.AttendanceDay), "出勤天数" },
{nameof(per_employee.ReservedRatio), "预留比例" },
{nameof(per_employee.BankCard), "银行卡号" },
{nameof(per_employee.Remark), "备注" },
{ nameof(report_performance_person_tags.Tag1), "绩效发放情况"},
{nameof(report_performance_person_tags.Tag2), "当月绩效权重"},
{nameof(report_performance_person_tags.Tag3), "重点群体对比1"},
{nameof(report_performance_person_tags.Tag4), "重点群体对比2"},
......
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