Commit f3e391c2 by ruyun.zhang@suvalue.com

Merge branch 'feature/signalr' into develop

parents 372166f5 0e79b004
......@@ -218,5 +218,21 @@ public ApiResponse AllotCheckResult([CustomizeValidator(RuleSet = "Delete"), Fro
var list = _allotService.AllotCheckResult(allot);
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 绩效历史日志
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allotlog")]
[HttpPost]
public ApiResponse AllotLog([CustomizeValidator(RuleSet = "Delete"), FromBody]AllotRequest request)
{
var allot = _allotService.GetAllot(request.ID);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _allotService.AllotLog(allot);
return new ApiResponse(ResponseType.OK, list);
}
}
}
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Performance.Services;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -11,11 +13,19 @@ namespace Performance.Api.Controllers
[ApiController]
public class ValuesController : ControllerBase
{
private readonly IHubContext<AllotLogHub> hubContext;
public ValuesController(IHubContext<AllotLogHub> hubContext)
{
this.hubContext = hubContext;
}
// GET api/values
[HttpGet]
[AllowAnonymous]
public ActionResult<IEnumerable<string>> Get()
{
hubContext.Clients.Group("aaaa").SendAsync("ReceiveMessage", "绩效开始执行", "绩效开始执行");
//var excel = _excelService.Analyze(@"C:\Users\ry\Desktop\文件\测试.xlsx");
return new string[] { "value1", "value2" };
}
......
......@@ -14,12 +14,16 @@
<ItemGroup>
<Compile Remove="aaa\**" />
<Compile Remove="Files\**" />
<Compile Remove="Hubs\**" />
<Content Remove="aaa\**" />
<Content Remove="Files\**" />
<Content Remove="Hubs\**" />
<EmbeddedResource Remove="aaa\**" />
<EmbeddedResource Remove="Files\**" />
<EmbeddedResource Remove="Hubs\**" />
<None Remove="aaa\**" />
<None Remove="Files\**" />
<None Remove="Hubs\**" />
</ItemGroup>
<ItemGroup>
......@@ -41,6 +45,7 @@
<PackageReference Include="NLog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Microsoft.AspNet.SignalR" Version="2.4.1" />
</ItemGroup>
<ItemGroup>
......
......@@ -147,6 +147,16 @@ public void ConfigureServices(IServiceCollection services)
});
#endregion
services.AddSignalR();
services.AddCors(options =>
{
options.AddPolicy("SignalrCore", policy =>
{
policy.SetIsOriginAllowed(origin => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials();
});
});
#region //ef配置
services.AddDbContext<PerformanceDbContext>(options =>
{
......@@ -219,6 +229,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } });
#endregion
app.UseCors("SignalrCore");
app.UseSignalR(routes => routes.MapHub<AllotLogHub>("/performance/allotLogHub"));
loggerFactory.CreateLogger<Startup>().LogDebug(env.EnvironmentName);
app.UseMvc();
}
......
......@@ -34,11 +34,16 @@ public class log_dbug
/// <summary>
///
/// </summary>
public string Titile { get; set; }
public string Title { get; set; }
/// <summary>
///
/// </summary>
public string Message { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> Level { get; set; }
}
}
......@@ -135,6 +135,7 @@ public class res_account
/// 实发绩效
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
/// <summary>
/// 备注
/// </summary>
......
////-----------------------------------------------------------------------
//// <copyright file=" res_accountdoctor.cs">
//// * FileName: 医生科室核算结果.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
//namespace Performance.EntityModels
//{
// /// <summary>
// /// 医生科室核算结果
// /// </summary>
// [Table("res_accountdoctor")]
// public class res_accountdoctor
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int ID { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> AllotID { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> SheetID { get; set; }
// /// <summary>
// /// 核算单元
// /// </summary>
// public string AccountingUnit { get; set; }
// /// <summary>
// /// 科室
// /// </summary>
// public string Department { get; set; }
// /// <summary>
// /// 科主任/护士长数量
// /// </summary>
// public Nullable<int> ManagerNumber { get; set; }
// /// <summary>
// /// 核算单元医生数量
// /// </summary>
// public Nullable<decimal> Number { get; set; }
// /// <summary>
// /// 医生基础系数
// /// </summary>
// public Nullable<decimal> BasicFactor { get; set; }
// /// <summary>
// /// 倾斜系数
// /// </summary>
// public Nullable<decimal> SlopeFactor { get; set; }
// /// <summary>
// /// 其他绩效1
// /// </summary>
// public Nullable<decimal> OtherPerfor1 { get; set; }
// /// <summary>
// /// 其他绩效2
// /// </summary>
// public Nullable<decimal> OtherPerfor2 { get; set; }
// /// <summary>
// /// 医院奖罚
// /// </summary>
// public Nullable<decimal> Extra { get; set; }
// /// <summary>
// /// 考核对分率
// /// </summary>
// public Nullable<decimal> ScoringAverage { get; set; }
// /// <summary>
// /// 调节系数
// /// </summary>
// public Nullable<decimal> AdjustFactor { get; set; }
// /// <summary>
// /// 科室业绩
// /// </summary>
// public Nullable<decimal> Income { get; set; }
// /// <summary>
// /// 业绩绩效
// /// </summary>
// public Nullable<decimal> PerforFee { get; set; }
// /// <summary>
// /// 工作量绩效
// /// </summary>
// public Nullable<decimal> WorkloadFee { get; set; }
// /// <summary>
// /// 绩效合计
// /// </summary>
// public Nullable<decimal> PerforTotal { get; set; }
// /// <summary>
// /// 人均绩效
// /// </summary>
// public Nullable<decimal> Avg { get; set; }
// /// <summary>
// /// 实发绩效
// /// </summary>
// public Nullable<decimal> RealGiveFee { get; set; }
// /// <summary>
// /// 变更日志
// /// </summary>
// public string ChangeLog { get; set; }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" res_accountdoctor.cs">
// * FileName: 医生科室核算结果.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 医生科室核算结果
/// </summary>
[Table("res_accountdoctor")]
public class res_accountdoctor
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> SheetID { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 科主任/护士长数量
/// </summary>
public Nullable<int> ManagerNumber { get; set; }
/// <summary>
/// 核算单元医生数量
/// </summary>
public Nullable<decimal> Number { get; set; }
/// <summary>
/// 医生基础系数
/// </summary>
public Nullable<decimal> BasicFactor { get; set; }
/// <summary>
/// 倾斜系数
/// </summary>
public Nullable<decimal> SlopeFactor { get; set; }
/// <summary>
/// 其他绩效1
/// </summary>
public Nullable<decimal> OtherPerfor1 { get; set; }
/// <summary>
/// 其他绩效2
/// </summary>
public Nullable<decimal> OtherPerfor2 { get; set; }
/// <summary>
/// 医院奖罚
/// </summary>
public Nullable<decimal> Extra { get; set; }
/// <summary>
/// 考核对分率
/// </summary>
public Nullable<decimal> ScoringAverage { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> AdjustFactor { get; set; }
/// <summary>
/// 科室业绩
/// </summary>
public Nullable<decimal> Income { get; set; }
/// <summary>
/// 业绩绩效
/// </summary>
public Nullable<decimal> PerforFee { get; set; }
/// <summary>
/// 工作量绩效
/// </summary>
public Nullable<decimal> WorkloadFee { get; set; }
/// <summary>
/// 绩效合计
/// </summary>
public Nullable<decimal> PerforTotal { get; set; }
/// <summary>
/// 人均绩效
/// </summary>
public Nullable<decimal> Avg { get; set; }
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
/// <summary>
/// 变更日志
/// </summary>
public string ChangeLog { get; set; }
}
}
////-----------------------------------------------------------------------
//// <copyright file=" res_accountnurse.cs">
//// * FileName: 护理科室核算结果.cs
//// </copyright>
////-----------------------------------------------------------------------
//using System;
//using System.ComponentModel.DataAnnotations;
//using System.ComponentModel.DataAnnotations.Schema;
//namespace Performance.EntityModels
//{
// /// <summary>
// /// 护理科室核算结果
// /// </summary>
// [Table("res_accountnurse")]
// public class res_accountnurse
// {
// /// <summary>
// ///
// /// </summary>
// [Key]
// public int ID { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> AllotID { get; set; }
// /// <summary>
// ///
// /// </summary>
// public Nullable<int> SheetID { get; set; }
// /// <summary>
// /// 核算单元
// /// </summary>
// public string AccountingUnit { get; set; }
// /// <summary>
// /// 科室
// /// </summary>
// public string Department { get; set; }
// /// <summary>
// /// 科主任/护士长数量
// /// </summary>
// public Nullable<int> ManagerNumber { get; set; }
// /// <summary>
// /// 护士人数
// /// </summary>
// public Nullable<decimal> Number { get; set; }
// /// <summary>
// /// 护理基础系数
// /// </summary>
// public Nullable<decimal> BasicFactor { get; set; }
// /// <summary>
// /// 倾斜系数
// /// </summary>
// public Nullable<decimal> SlopeFactor { get; set; }
// /// <summary>
// /// 其他绩效1
// /// </summary>
// public Nullable<decimal> OtherPerfor1 { get; set; }
// /// <summary>
// /// 其他绩效2
// /// </summary>
// public Nullable<decimal> OtherPerfor2 { get; set; }
// /// <summary>
// /// 医院奖罚
// /// </summary>
// public Nullable<decimal> Extra { get; set; }
// /// <summary>
// /// 考核对分率
// /// </summary>
// public Nullable<decimal> ScoringAverage { get; set; }
// /// <summary>
// /// 调节系数
// /// </summary>
// public Nullable<decimal> AdjustFactor { get; set; }
// /// <summary>
// /// 科室业绩
// /// </summary>
// public Nullable<decimal> Income { get; set; }
// /// <summary>
// /// 业绩绩效
// /// </summary>
// public Nullable<decimal> PerforFee { get; set; }
// /// <summary>
// /// 工作量绩效
// /// </summary>
// public Nullable<decimal> WorkloadFee { get; set; }
// /// <summary>
// /// 绩效合计
// /// </summary>
// public Nullable<decimal> PerforTotal { get; set; }
// /// <summary>
// /// 人均绩效
// /// </summary>
// public Nullable<decimal> Avg { get; set; }
// /// <summary>
// /// 实发绩效
// /// </summary>
// public Nullable<decimal> RealGiveFee { get; set; }
// }
//}
//-----------------------------------------------------------------------
// <copyright file=" res_accountnurse.cs">
// * FileName: 护理科室核算结果.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 护理科室核算结果
/// </summary>
[Table("res_accountnurse")]
public class res_accountnurse
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> SheetID { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 科主任/护士长数量
/// </summary>
public Nullable<int> ManagerNumber { get; set; }
/// <summary>
/// 护士人数
/// </summary>
public Nullable<decimal> Number { get; set; }
/// <summary>
/// 护理基础系数
/// </summary>
public Nullable<decimal> BasicFactor { get; set; }
/// <summary>
/// 倾斜系数
/// </summary>
public Nullable<decimal> SlopeFactor { get; set; }
/// <summary>
/// 其他绩效1
/// </summary>
public Nullable<decimal> OtherPerfor1 { get; set; }
/// <summary>
/// 其他绩效2
/// </summary>
public Nullable<decimal> OtherPerfor2 { get; set; }
/// <summary>
/// 医院奖罚
/// </summary>
public Nullable<decimal> Extra { get; set; }
/// <summary>
/// 考核对分率
/// </summary>
public Nullable<decimal> ScoringAverage { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> AdjustFactor { get; set; }
/// <summary>
/// 科室业绩
/// </summary>
public Nullable<decimal> Income { get; set; }
/// <summary>
/// 业绩绩效
/// </summary>
public Nullable<decimal> PerforFee { get; set; }
/// <summary>
/// 工作量绩效
/// </summary>
public Nullable<decimal> WorkloadFee { get; set; }
/// <summary>
/// 绩效合计
/// </summary>
public Nullable<decimal> PerforTotal { get; set; }
/// <summary>
/// 人均绩效
/// </summary>
public Nullable<decimal> Avg { get; set; }
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
}
}
......@@ -99,6 +99,11 @@ public void ConfigureServices(IServiceCollection services)
services.AddAutoMapper();
#endregion
#region redis
var csredis = new CSRedis.CSRedisClient(connection.Value.RedisConnectionString);
RedisHelper.Initialization(csredis);
#endregion
#region email
//阿里邮箱配置
......@@ -119,6 +124,15 @@ public void ConfigureServices(IServiceCollection services)
options.UseMySQL(connection.Value.PerformanceConnectionString);
});
#endregion
services.AddSignalR();
services.AddCors(options =>
{
options.AddPolicy("SignalrCore", policy =>
{
policy.SetIsOriginAllowed(origin => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials();
});
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......@@ -130,6 +144,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app.UseDeveloperExceptionPage();
}
app.UseCors("SignalrCore");
app.UseSignalR(routes => routes.MapHub<AllotLogHub>("/allotLogHub"));
loggerFactory.CreateLogger<Startup>().LogDebug(env.EnvironmentName);
app.UseMvc();
}
......
......@@ -32,6 +32,7 @@ public int DeleteData(int allotId)
"res_compute",
"res_specialunit",
"log_check",
"log_dbug",
};
string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
......
......@@ -13,9 +13,9 @@ public partial class PerforLogdbugRepository
/// <param name="title"></param>
/// <param name="message"></param>
/// <returns></returns>
public bool Add(int allotId, string title, string message)
public bool Add(int allotId, string title, string message, int level)
{
return Add(new EntityModels.log_dbug { AllotID = allotId, CreateTime = DateTime.Now, Titile = title, Message = message });
return Add(new EntityModels.log_dbug { AllotID = allotId, CreateTime = DateTime.Now, Title = title, Message = message, Level = level });
}
}
}
......@@ -15,16 +15,19 @@ public class CheckDataService : IAutoInjection
private PerforCofcheckRepository perforCofcheckRepository;
private PerforLogcheckRepository perforLogcheckRepository;
private PerforCofdrugtypeRepository perforCofdrugtypeRepository;
private LogManageService logManageService;
public CheckDataService(PerSheetService perSheetService,
PerforCofcheckRepository perforCofcheckRepository,
PerforLogcheckRepository perforLogcheckRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository
PerforCofdrugtypeRepository perforCofdrugtypeRepository,
LogManageService logManageService
)
{
this.perSheetService = perSheetService;
this.perforCofcheckRepository = perforCofcheckRepository;
this.perforLogcheckRepository = perforLogcheckRepository;
this.perforCofdrugtypeRepository = perforCofdrugtypeRepository;
this.logManageService = logManageService;
}
internal bool Check(PerExcel excel, per_allot allot)
{
......@@ -232,6 +235,7 @@ public void InsertLog(int allotId, int type, int level, string title, string mes
Message = message
};
perforLogcheckRepository.Add(model);
logManageService.WriteMsg("绩效数据校验", $"{title} - {message}", level, allotId, "ReceiveMessage", true);
}
#endregion
}
......
......@@ -27,7 +27,8 @@ public class ImportDataService : IAutoInjection
private PerforImemployeeRepository perforImEmployeeRepository;
private PerforImaccountbasicRepository perforImaccountbasicRepository;
private PerforImspecialunitRepository perforImspecialunitRepository;
private PerforLogdbugRepository logdbug;
//private PerforLogdbugRepository logdbug;
private readonly LogManageService logManageService;
public ImportDataService(PerSheetService perSheetService,
PerforPersheetRepository perforPerSheetRepository,
PerforPerallotRepository perforPerallotRepository,
......@@ -36,7 +37,8 @@ public class ImportDataService : IAutoInjection
PerforImemployeeRepository perforImEmployeeRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforImspecialunitRepository perforImspecialunitRepository,
PerforLogdbugRepository logdbug)
//PerforLogdbugRepository logdbug
LogManageService logManageService)
{
this.perSheetService = perSheetService;
this.perforPerSheetRepository = perforPerSheetRepository;
......@@ -46,7 +48,8 @@ public class ImportDataService : IAutoInjection
this.perforImEmployeeRepository = perforImEmployeeRepository;
this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.perforImspecialunitRepository = perforImspecialunitRepository;
this.logdbug = logdbug;
//this.logdbug = logdbug;
this.logManageService = logManageService;
}
/// <summary>
......@@ -86,13 +89,14 @@ private PerExcel Import(per_allot allot)
var sheet = workbook.GetSheetAt(i);
var sheetType = perSheetService.GetSheetType(sheet.SheetName);
logdbug.Add(allot.ID, "开始读取excel文件", JsonHelper.Serialize(new { sheetType, Description = EnumHelper.GetDescription(sheetType), name = sheet.SheetName }));
if (SheetType.Unidentifiable != sheetType)
{
logManageService.WriteMsg("开始读取excel文件", $"开始读取sheet -- {sheet.SheetName}", 1, allot.ID, "ReceiveMessage", true);
var st = perSheetService.Sheet(sheet);
excel.PerSheet.Add(st);
}
}
logManageService.WriteMsg("开始读取excel文件", $"excel文件基础数据读取完成!", 1, allot.ID, "ReceiveMessage", true);
return excel;
}
}
......@@ -231,27 +235,25 @@ private bool Save(PerExcel excel, int allotId)
{
foreach (var sheet in excel.PerSheet)
{
logManageService.WriteMsg("保存基础数据", $"开始保存数据 -- {sheet.SheetName}", 1, allotId, "ReceiveMessage", true);
if (sheet.SheetType == SheetType.Employee)
{
logdbug.Add(allotId, "开始保存人员数据数据", sheet.SheetName);
SaveEmployee(sheet, allotId);
}
else if (sheet.SheetType == SheetType.AccountBasic)
{
logdbug.Add(allotId, "开始保存临床科室医护绩效测算基础数据", sheet.SheetName);
SaveAccountBasic(sheet, allotId);
}
else if (sheet.SheetType == SheetType.SpecialUnit)
{
logdbug.Add(allotId, "开始保存特殊核算单元数据", sheet.SheetName);
SaveSpecialUnit(sheet, allotId);
}
else
{
logdbug.Add(allotId, "开始保存统一格式数据", sheet.SheetName);
SaveCommon(sheet, allotId);
}
}
logManageService.WriteMsg("保存基础数据", $"基础数据保存完成!", 1, allotId, "ReceiveMessage", true);
return true;
}
}
......
......@@ -25,6 +25,7 @@ public class ProcessComputService : IAutoInjection
private PerforResaccountRepository perforResaccountRepository;
private PerforResbaiscnormRepository perforResbaiscnormRepository;
private PerforCofdrugtypeRepository perforCofdrugtypeRepository;
private readonly LogManageService logManageService;
public ProcessComputService(PerforCofincomeRepository perforCofincomeRepository,
PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforPersheetRepository perforPerSheetRepository,
......@@ -33,7 +34,8 @@ public class ProcessComputService : IAutoInjection
PerforImemployeeRepository perforImEmployeeRepository,
PerforResaccountRepository perforResaccountRepository,
PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository)
PerforCofdrugtypeRepository perforCofdrugtypeRepository,
LogManageService logManageService)
{
this.perforCofincomeRepository = perforCofincomeRepository;
this.perforCofdrugpropRepository = perforCofdrugpropRepository;
......@@ -44,6 +46,7 @@ public class ProcessComputService : IAutoInjection
this.perforResaccountRepository = perforResaccountRepository;
this.perforResbaiscnormRepository = perforResbaiscnormRepository;
this.perforCofdrugtypeRepository = perforCofdrugtypeRepository;
this.logManageService = logManageService;
}
/// <summary>
......@@ -160,6 +163,7 @@ private void Save(List<PerSheet> perSheets, int allotId)
{
foreach (var sheet in perSheets)
{
logManageService.WriteMsg("正在生成绩效", $"保存核算数据 - {sheet.SheetName}", 1, allotId, "ReceiveMessage");
if (sheet.SheetType == SheetType.ComputeDoctorAccount)
{
SaveComputeDoctorAccount(sheet, allotId);
......@@ -187,25 +191,31 @@ private List<PerSheet> MergeCompute(PerExcel excel, int allotid)
//合并科室收入、支出
var incomeconfs = perforCofincomeRepository.GetEntities();
var economicCompute = new PerSheetDataComputeEconomic();
logManageService.WriteMsg("正在生成绩效", "计算科室经济核算汇总表", 1, allotid, "ReceiveMessage");
var mergeResult = economicCompute.MergeCompute(excel, incomeconfs);
//一次计算
logManageService.WriteMsg("正在生成绩效", "计算科室经济核算汇总表 -- 第一次计算", 1, allotid, "ReceiveMessage");
var onceEconomic = economicCompute.OnceCompute(mergeResult);
//二次计算
logManageService.WriteMsg("正在生成绩效", "计算科室经济核算汇总表 -- 第二次计算", 1, allotid, "ReceiveMessage");
var twiceEconomicResult = economicCompute.TwiceCompute(onceEconomic);
twiceEconomicResult.Sheet.SheetType = SheetType.ComputeEconomic;
perSheet.Add(twiceEconomicResult.Sheet);
logManageService.WriteMsg("正在生成绩效", "计算科室经济核算汇总表 -- 计算完成", 1, allotid, "ReceiveMessage");
//工作量
var workloadCompute = new PerSheetDataComputeWorkload();
var workload1 = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Workload && t.SheetName.Contains("医生组"));
workload1.SheetName = "医生组工作量绩效测算表";
logManageService.WriteMsg("正在生成绩效", "获取药品费用分割比例", 1, allotid, "ReceiveMessage");
var confs = GetDrugConfig(excel, allotid);
//医生组 一次计算
//var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs);
//医生组 二次计算
logManageService.WriteMsg("正在生成绩效", "医生组工作量计算", 1, allotid, "ReceiveMessage");
var twiceWorkloadResult1 = workloadCompute.TwiceCompute(workload1);
twiceWorkloadResult1.Sheet.SheetType = SheetType.ComputeDoctorWorkload;
......@@ -216,6 +226,7 @@ private List<PerSheet> MergeCompute(PerExcel excel, int allotid)
//护理组 一次计算
//var onceWorkload2 = workloadCompute.OnceCompute(workload2);
//护理组 二次计算
logManageService.WriteMsg("正在生成绩效", "护理组工作量计算", 1, allotid, "ReceiveMessage");
var twiceWorkloadResult2 = workloadCompute.TwiceCompute(workload2);
twiceWorkloadResult2.Sheet.SheetType = SheetType.ComputeNurseWorkload;
......@@ -224,8 +235,10 @@ private List<PerSheet> MergeCompute(PerExcel excel, int allotid)
var deptAccounting = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic);
var dataList = deptAccounting.PerData.Select(t => (PerDataAccountBaisc)t);
logManageService.WriteMsg("正在生成绩效", "计算保底绩效参考标准", 1, allotid, "ReceiveMessage");
var baiscnormList = ComputeMinimum(dataList, twiceEconomicResult.PerData, twiceWorkloadResult1.PerData, twiceWorkloadResult2.PerData, allotid);
logManageService.WriteMsg("正在生成绩效", "计算科室绩效", 1, allotid, "ReceiveMessage");
var sheet = Compute(dataList, twiceEconomicResult.PerData, twiceWorkloadResult1.PerData, twiceWorkloadResult2.PerData, baiscnormList);
perSheet.AddRange(sheet);
......
......@@ -22,6 +22,7 @@ public class ResultComputeService : IAutoInjection
private readonly PerforResbaiscnormRepository perforResbaiscnormRepository;
private readonly PerforResspecialunitRepository perforResspecialunitRepository;
private readonly PerforImaccountbasicRepository perforImaccountbasicRepository;
private readonly LogManageService logManageService;
public ResultComputeService(
PerforImemployeeRepository perforImEmployeeRepository,
......@@ -29,7 +30,8 @@ public class ResultComputeService : IAutoInjection
PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforResspecialunitRepository perforResspecialunitRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
BaiscNormService baiscNormService, ComputeDirector computeDirector)
BaiscNormService baiscNormService, ComputeDirector computeDirector,
LogManageService logManageService)
{
this.baiscNormService = baiscNormService;
this.computeDirector = computeDirector;
......@@ -38,6 +40,7 @@ public class ResultComputeService : IAutoInjection
this.perforResbaiscnormRepository = perforResbaiscnormRepository;
this.perforResspecialunitRepository = perforResspecialunitRepository;
this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.logManageService = logManageService;
}
/// <summary>
......@@ -52,12 +55,14 @@ public List<res_baiscnorm> Compute(per_allot allot, PerExcel excel, List<PerShee
List<ComputeEmployee> computeEmployees = Mapper.Map<List<ComputeEmployee>>(empolyeeList);
logManageService.WriteMsg("正在生成绩效", "临床科室主任、临床科室副主任、临床科室护士长 最终绩效数据计算", 1, allot.ID, "ReceiveMessage");
var computResult = computeDirector.Compute(computeEmployees, accountbasicList, allot);
//计算 绩效标准 基数(科主任、副主任、护士长 =>> 平均值)
List<res_baiscnorm> baiscnormList = new List<res_baiscnorm>();
baiscNormService.ComputeAvg(baiscnormList, accountbasicList, computResult);
baiscNormService.DocterNurseBaiscnorm(baiscnormList, accountbasicList, perSheets);
logManageService.WriteMsg("正在生成绩效", "院领导、业务中层、工勤人员 最终绩效数据计算", 1, allot.ID, "ReceiveMessage");
var computResult2 = computeDirector.Compute(computeEmployees, allot, baiscnormList);
//计算 行政人员 平均值
baiscNormService.ComputeOtherAvg(baiscnormList, computResult2, empolyeeList);
......@@ -68,6 +73,7 @@ public List<res_baiscnorm> Compute(per_allot allot, PerExcel excel, List<PerShee
perforRescomputeRepository.AddRange(computes.ToArray());
baiscnormList.ForEach(t => t.AllotID = allot.ID);
logManageService.WriteMsg("正在生成绩效", "保存最终绩效数据", 1, allot.ID, "ReceiveMessage");
perforResbaiscnormRepository.AddRange(baiscnormList.ToArray());
return baiscnormList;
......
using AutoMapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels;
......@@ -24,7 +25,6 @@ public class AllotService : IAutoInjection
private ProcessComputService processComputService;
private ResultComputeService resultComputeService;
private PerforLogdbugRepository logdbug;
private ConfigService configService;
private IHostingEnvironment _evn;
private ILogger<AllotService> _logger;
......@@ -34,6 +34,8 @@ public class AllotService : IAutoInjection
private PerforPeragainallotRepository _againallotRepository;
private PerforLogcheckRepository perforLogcheckRepository;
private readonly PerforHospitalRepository perforHospitalRepository;
//private readonly IHubContext<AllotLogHub> hubContext;
private readonly LogManageService logManageService;
public AllotService(PerforPerallotRepository allotRepository,
BaiscNormService baiscNormService,
......@@ -48,7 +50,9 @@ public class AllotService : IAutoInjection
IOptions<Application> options,
PerforPeragainallotRepository againallotRepository,
PerforLogcheckRepository perforLogcheckRepository,
PerforHospitalRepository perforHospitalRepository)
PerforHospitalRepository perforHospitalRepository,
//IHubContext<AllotLogHub> hubContext
LogManageService logManageService)
{
_allotRepository = allotRepository;
_againallotRepository = againallotRepository;
......@@ -65,6 +69,8 @@ public class AllotService : IAutoInjection
this.logdbug = logdbug;
this.perforLogcheckRepository = perforLogcheckRepository;
this.perforHospitalRepository = perforHospitalRepository;
//this.hubContext = hubContext;
this.logManageService = logManageService;
}
#region 基础功能
......@@ -197,6 +203,7 @@ public void UpdateAllotStates(int allotId, int states, string remark)
{
_allotRepository.UpdateAllotStates(allotId, states, remark);
}
/// <summary>
/// 生成绩效
/// </summary>
......@@ -207,40 +214,46 @@ public void Generate(per_allot allot, string mail)
DateTime time = DateTime.Now;
try
{
logdbug.Add(allot.ID, "绩效开始执行", JsonHelper.Serialize(allot));
logManageService.WriteMsg("绩效开始执行", $"正在生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效!", 1, allot.ID, "ReceiveMessage", true);
configService.Clear(allot.ID);
UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
// 导出数据
var excel = importDataService.ReadDataAndSave(allot);
UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
if (!checkDataService.Check(excel, allot))
{
UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
SendEmail(allot, mail, 3, time);
logdbug.Add(allot.ID, "绩效数据校验失败", JsonHelper.Serialize(allot));
logManageService.WriteMsg("绩效数据校验失败", "详情可至“更多 -- 查看日志”查看", 3, allot.ID, "ReceiveMessage", true);
return;
}
UpdateAllotStates(allot.ID, (int)AllotStates.InGenerate, EnumHelper.GetDescription(AllotStates.InGenerate));
// 计算合并数据
logdbug.Add(allot.ID, "计算合并数据", JsonHelper.Serialize(allot));
logManageService.WriteMsg("正在生成绩效", "计算合并数据", 1, allot.ID, "ReceiveMessage", true);
List<PerSheet> list = processComputService.MergeAndSave(excel, allot);
//var baiscnorm = baiscNormService.NurseBaiscnorm(list);
//logdbug.Add(allot.ID, "护士平均绩效", JsonHelper.Serialize(baiscnorm));
// 计算最总数据
logdbug.Add(allot.ID, "绩效结果计算数据开始", "");
logManageService.WriteMsg("正在生成绩效", "计算最终绩效数据", 1, allot.ID, "ReceiveMessage", true);
var baiscnormList = resultComputeService.Compute(allot, excel, list);
logManageService.WriteMsg("正在生成绩效", "计算最终特殊科室绩效数据", 1, allot.ID, "ReceiveMessage", true);
resultComputeService.SpecialUnitCompute(excel, allot, baiscnormList);
logManageService.WriteMsg("正在生成绩效", "保存最终特殊科室绩效数据", 1, allot.ID, "ReceiveMessage", true);
UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
//发送邮件
SendEmail(allot, mail, 1, time);
logdbug.Add(allot.ID, "绩效开始执行", "绩效生成成功");
//logdbug.Add(allot.ID, "绩效开始执行", "绩效生成成功");
logManageService.WriteMsg("绩效生成结束", "绩效生成成功", 5, allot.ID, "ReceiveMessage", true);
}
catch (Exception ex)
{
logManageService.WriteMsg("绩效生成失败", "程序异常,请重新尝试。", 4, allot.ID, "ReceiveMessage");
logdbug.Add(allot.ID, "绩效开始执行", ex.ToString(), 4);
UpdateAllotStates(allot.ID, (int)AllotStates.GenerateFail, EnumHelper.GetDescription(AllotStates.GenerateFail));
SendEmail(allot, mail, 2, time);
logdbug.Add(allot.ID, "绩效开始执行", ex.ToString());
//throw ex;
}
}
......@@ -271,7 +284,7 @@ private void SendEmail(per_allot allot, string mail, int type, DateTime time)
$"{hospital.HosName}{allot.Year}{allot.Month}月的绩效生成任务<strong><span style=\"color:#E53333;\">“执行失败”</span></strong>," +
$"执行过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!</p>";
}
else if (type == 1)
else if (type == 3)
{
message.Body = $"<p>尊敬的用户!</p><p>&nbsp;&nbsp;&nbsp;&nbsp;数值健康提醒您,您在{time.ToString("yyyy-MM-dd hh:mm:ss")}发布" +
$"{hospital.HosName}{allot.Year}{allot.Month}月的绩效生成任务<strong><span style=\"color:#E53333;\">“校验失败”</span></strong>," +
......@@ -328,5 +341,18 @@ public List<log_check> AllotCheckResult(per_allot allot)
list = list.OrderBy(t => t.Titile).ThenBy(t => t.ID).ToList();
return list;
}
/// <summary>
/// 绩效历史日志
/// </summary>
/// <param name="allot"></param>
/// <returns></returns>
public List<log_dbug> AllotLog(per_allot allot)
{
var list = logdbug.GetEntities(t => t.AllotID == allot.ID);
if (list != null)
list = list.OrderBy(t => t.CreateTime).ToList();
return list;
}
}
}
......@@ -13,6 +13,7 @@ namespace Performance.Services
{
public class ConfigService : IAutoInjection
{
#region
private PerforCofdirectorRepository _directorRepository;
private PerforCofdrugpropRepository _drugpropRepository;
private PerforCofincomeRepository _incomeRepository;
......@@ -22,7 +23,8 @@ public class ConfigService : IAutoInjection
private PerforPerallotRepository perforPerAllotRepository;
private PerforPeragainallotRepository perforPeragainallotRepository;
private PerforHospitalRepository perforHospitalRepository;
private PerforLogdbugRepository logdbug;
//private PerforLogdbugRepository logdbug;
private readonly LogManageService logManageService;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
PerforCofdrugpropRepository cofdrugpropRepository,
PerforCofincomeRepository cofincomeRepository,
......@@ -32,7 +34,8 @@ public class ConfigService : IAutoInjection
PerforPerallotRepository perforPerAllotRepository,
PerforPeragainallotRepository perforPeragainallotRepository,
PerforHospitalRepository perforHospitalRepository,
PerforLogdbugRepository logdbug)
//PerforLogdbugRepository logdbug
LogManageService logManageService)
{
this._directorRepository = cofdirectorRepository;
this._drugpropRepository = cofdrugpropRepository;
......@@ -43,8 +46,10 @@ public class ConfigService : IAutoInjection
this.perforPerAllotRepository = perforPerAllotRepository;
this.perforPeragainallotRepository = perforPeragainallotRepository;
this.perforHospitalRepository = perforHospitalRepository;
this.logdbug = logdbug;
//this.logdbug = logdbug;
this.logManageService = logManageService;
}
#endregion
#region cof_director 规模/效率绩效配置
/// <summary>
......@@ -343,16 +348,6 @@ public bool WorkDelete(WorkyearRequest request)
}
#endregion
/// <summary>
/// 清楚无效数据
/// </summary>
/// <param name="allotId"></param>
public void Clear(int allotId)
{
var count = _directorRepository.DeleteData(allotId);
logdbug.Add(allotId, "清理无效数据", $"受影响行数:{count}");
}
#region Copy
/// <summary>
/// 复制报表基础配置
......@@ -486,6 +481,16 @@ public bool AgainDelete(CofAgainRequest request)
}
#endregion
#region 清楚无效数据 Clear
/// <summary>
/// 清楚无效数据
/// </summary>
/// <param name="allotId"></param>
public void Clear(int allotId)
{
var count = _directorRepository.DeleteData(allotId);
logManageService.WriteMsg("清理无效数据", $"清理无效数据,受影响行数:{count}", 1, allotId, "ReceiveMessage", true);
}
/// <summary>
/// 清除二次绩效中无效数据
......@@ -494,7 +499,8 @@ public bool AgainDelete(CofAgainRequest request)
public void ClearAgain(int againId)
{
var count = _directorRepository.DelAgain(againId);
logdbug.Add(againId, "清除二次绩效中无效数据", $"受影响行数:{count}");
logManageService.WriteMsg("清理无效数据", $"清除二次绩效中无效数据,受影响行数:{count}", 1, againId, "ReceiveMessage", true);
}
#endregion
}
}
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Services
{
public class AllotLogHub : Hub
{
public override Task OnConnectedAsync()
{
return base.OnConnectedAsync();
}
public override Task OnDisconnectedAsync(Exception exception)
{
var connectionId = Context.ConnectionId;
//1 查询用户分组信息
var groupName = "";
//2 删除数据库中用户分组数据
if (RedisHelper.HExists("AllotLogGroup", connectionId))
{
groupName = RedisHelper.HGet("AllotLogGroup", connectionId);
RedisHelper.HDel("AllotLogGroup", connectionId);
}
//3 分组中删除用户
Groups.RemoveFromGroupAsync(connectionId, groupName);
return base.OnDisconnectedAsync(exception);
}
public async Task AddGroup(string token, string groupName)
{
var connectionId = Context.ConnectionId;
if (!RedisHelper.HExists("AllotLogGroup", connectionId))
{
//1 向数据库中插入用户及分组信息
RedisHelper.HSet("AllotLogGroup", connectionId, groupName);
//2 将用户插入分组
await Groups.AddToGroupAsync(connectionId, groupName);
}
}
public async Task SendMessage(string groupName, string message)
{
await Clients.Group(groupName).SendAsync("ReceiveMessage", "测试", message);
}
}
}
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.SignalR;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Services
{
public class LogManageService : IAutoInjection
{
private readonly IHubContext<AllotLogHub> hubContext;
private PerforLogdbugRepository logdbug;
public LogManageService(IHubContext<AllotLogHub> hubContext,
PerforLogdbugRepository logdbug)
{
this.hubContext = hubContext;
this.logdbug = logdbug;
}
/// <summary>
///
/// </summary>
/// <param name="tag">标签</param>
/// <param name="message">内容</param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
/// <param name="allotId">绩效Id</param>
/// <param name="method">方法名称</param>
public void WriteMsg(string tag, string message, int level, int allotId, string method, bool isDebug = false)
{
hubContext.Clients.Group(allotId.ToString()).SendAsync(method, tag, message, level);
if (isDebug)
{
logdbug.Add(allotId, tag, message, level);
}
}
}
}
using Dapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NPOI.HSSF.UserModel;
......@@ -43,9 +44,11 @@ public class NewExtractService : IAutoInjection
private readonly PerforImaccountbasicRepository perforImaccountbasicRepository;
private readonly PerforImspecialunitRepository perforImspecialunitRepository;
private readonly PerforImdataRepository perforImdataRepository;
private readonly LogManageService logManageService;
private IWorkbook workbook = null;
private ICellStyle style;
private int AllotId;
public NewExtractService(ILogger<ExtractService> logger,
IHostingEnvironment environment,
......@@ -62,7 +65,8 @@ public class NewExtractService : IAutoInjection
PerforImemployeeRepository perforImemployeeRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforImspecialunitRepository perforImspecialunitRepository,
PerforImdataRepository perforImdataRepository)
PerforImdataRepository perforImdataRepository,
LogManageService logManageService)
{
this.logger = logger;
this.environment = environment;
......@@ -80,6 +84,7 @@ public class NewExtractService : IAutoInjection
this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.perforImspecialunitRepository = perforImspecialunitRepository;
this.perforImdataRepository = perforImdataRepository;
this.logManageService = logManageService;
}
#endregion
......@@ -87,6 +92,8 @@ public class NewExtractService : IAutoInjection
public string ExtractData(int allotId, string email, int hospitalId)
{
AllotId = allotId;
// 获取绩效信息
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
// 获取医院信息
......@@ -157,12 +164,14 @@ public string ExtractData(int allotId, string email, int hospitalId)
{
workbook.Write(file);
}
logManageService.WriteMsg("提取绩效数据", $"{hospital.HosName}HIS数据提取成功,文件路径:{newPath}。", 5, allotId, "ReceiveMessage");
LogHelper.Information($"{hospital.HosName}HIS数据提取成功,文件路径:{newPath}。", "提取绩效数据");
SendEmail(email, newPath, $"{hospital.HosName}HIS数据提取成功", $"{hospital.HosName}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}成功提取。");
return newPath;
}
catch (Exception ex)
{
logManageService.WriteMsg("提取数据异常", $"数据写入出现异常", 4, allotId, "ReceiveMessage");
LogHelper.Error($"数据写入出现异常{ex.ToString()}", "提取绩效数据", "异常");
SendEmail(email, "", $"{hospital.HosName}HIS数据提取失败", $"{hospital.HosName}提取数据过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!");
throw ex;
......@@ -219,6 +228,7 @@ private void WriteOtherIncome(ISheet sheet, int hospitalId, IPerSheetDataRead sh
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 4;
logManageService.WriteMsg("提取绩效数据", $"写入列头信息 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"写入列头信息 -- {module.ModuleName}", "提取绩效数据");
//写入列头信息
foreach (var item in itemList)
......@@ -255,6 +265,7 @@ private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> u
var technicianFactor = sheet.GetRow(sheetRead.Point.AccountingUnit.First(t => t.UnitType == "医技组").FactorRow.Value);
var head = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value);
logManageService.WriteMsg("提取绩效数据", $"写入列头信息 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"写入列头信息 -- {module.ModuleName}", "提取绩效数据");
//写入列头信息
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 4;
......@@ -284,12 +295,14 @@ private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> u
List<ExtractDto> allExtract = new List<ExtractDto>();
foreach (var item in extractList)
{
LogHelper.Information($"执行SQL脚本获取数据 -- {module.ModuleName},", "提取绩效数据");
logManageService.WriteMsg("提取绩效数据", $"执行SQL脚本获取数据 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"执行SQL脚本获取数据 -- {module.ModuleName}", "提取绩效数据");
var result = QueryDatabase(hospitalConfigList, item, allot);
if (result != null)
allExtract.AddRange(result);
}
logManageService.WriteMsg("提取绩效数据", $"填充数据 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"填充数据 -- {module.ModuleName}", "提取绩效数据");
//写入数据
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 1;
......@@ -378,6 +391,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
var head = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value + 0);
var factor = GetOrCreate(sheet, sheetRead.Point.HeaderFirstRowNum.Value + 1);
logManageService.WriteMsg("提取绩效数据", $"写入列头信息 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"写入列头信息 -- {module.ModuleName}", "提取绩效数据");
//写入列头信息
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 2;
......@@ -404,7 +418,8 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
if (category == null || category.Count() == 0) continue;
foreach (var moditem in category)
{
LogHelper.Information($"执行SQL脚本获取数据 -- {moditem.ItemName},", "提取绩效数据");
logManageService.WriteMsg("提取绩效数据", $"执行SQL脚本获取数据 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"执行SQL脚本获取数据 -- {module.ModuleName},", "提取绩效数据");
var result = QueryDatabase(hospitalConfigList, item, allot, moditem.ItemName);
if (result != null)
allExtract.AddRange(result);
......@@ -418,6 +433,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
specialHead = itemList.Select(t => t.ItemName).Intersect(extractHead.Distinct())?.ToList();
}
logManageService.WriteMsg("提取绩效数据", $"填充数据 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"填充数据 -- {module.ModuleName}", "提取绩效数据");
//写入数据
var rowIndex = sheetRead.Point.HeaderFirstRowNum.Value + 2;
......@@ -463,6 +479,7 @@ private List<ExtractDto> QueryDatabase(List<sys_hospitalconfig> hospitalConfigLi
{
executeScript = Regex.Replace(executeScript, item.Key, item.Value, RegexOptions.IgnoreCase);
}
//logManageService.WriteMsg("提取绩效数据", $"SQL脚本:{executeScript}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"SQL脚本{executeScript},", "提取绩效数据");
var result = connection.Query<ExtractDto>(executeScript, commandTimeout: 20000);
if (result != null && result.Count() > 0)
......@@ -493,6 +510,7 @@ private void WriteExpend(ISheet sheet, int hospitalId, IPerSheetDataRead sheetRe
int cellStartIndex = sheetRead.Point.HeaderFirstCellNum.Value + 4;
logManageService.WriteMsg("提取绩效数据", $"写入列头信息 -- {module.ModuleName}", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"写入列头信息 -- {module.ModuleName}", "提取绩效数据");
//写入列头信息
foreach (var item in itemList)
......@@ -530,7 +548,6 @@ private void WriteExpend(ISheet sheet, int hospitalId, IPerSheetDataRead sheetRe
private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead sheetRead)
{
LogHelper.Information($"填充数据 -- 人员信息", "提取绩效数据");
var dictionary = new Dictionary<string, Func<im_employee, object>>
{
{ "核算单元", (t) => t.AccountingUnit },
......@@ -548,6 +565,8 @@ private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead shee
{ "调节系数", (t) => t.Adjust },
};
logManageService.WriteMsg("提取绩效数据", $"填充数据 -- 人员信息", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"填充数据 -- 人员信息", "提取绩效数据");
var dataList = perforImemployeeRepository.GetEntities(t => t.AllotID == allotLastId)?.OrderBy(t => t.AccountType).ToList();
for (int i = 0; i < dataList.Count; i++)
{
......@@ -570,7 +589,6 @@ private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead shee
private void WriteSpecialUnit(ISheet sheet, int hospitalId, per_allot allotLast, IPerSheetDataRead sheetRead)
{
LogHelper.Information($"填充数据 -- 特殊核算单元绩效测算表", "提取绩效数据");
var dictionary = new Dictionary<string, Func<mod_special, List<im_specialunit>, object>>
{
{ "科室", (special,lastAllot) => special.Department },
......@@ -605,6 +623,8 @@ private void WriteSpecialUnit(ISheet sheet, int hospitalId, per_allot allotLast,
int mergedBegin = sheetRead.Point.DataFirstRowNum.Value;
int mergedEnd = sheetRead.Point.DataFirstRowNum.Value;
logManageService.WriteMsg("提取绩效数据", $"填充数据 -- 特殊核算单元绩效测算表", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"填充数据 -- 特殊核算单元绩效测算表", "提取绩效数据");
for (int i = 0; i < modDataList.Count; i++)
{
var headIndex = sheetRead.Point.HeaderFirstRowNum;
......@@ -650,7 +670,6 @@ private void WriteSpecialUnit(ISheet sheet, int hospitalId, per_allot allotLast,
private void WriteAccountBasic(ISheet sheet, int allotLastId, IPerSheetDataRead sheetRead)
{
LogHelper.Information($"填充数据 -- 临床科室医护绩效测算表", "提取绩效数据");
var dictionary = new Dictionary<string, Func<im_accountbasic, object>>
{
{ "核算单元类型", (t) => t.UnitType },
......@@ -672,6 +691,8 @@ private void WriteAccountBasic(ISheet sheet, int allotLastId, IPerSheetDataRead
{ "调节系数", (t) => t.DoctorAdjustFactor },
};
logManageService.WriteMsg("提取绩效数据", $"填充数据 -- 临床科室医护绩效测算表", 1, AllotId, "ReceiveMessage");
LogHelper.Information($"填充数据 -- 临床科室医护绩效测算表", "提取绩效数据");
var dataList = perforImaccountbasicRepository.GetEntities(t => t.AllotID == allotLastId)?.OrderBy(t => t.UnitType).ThenBy(t => t.DoctorAccountingUnit).ToList();
for (int i = 0; i < dataList.Count; i++)
{
......
......@@ -33,22 +33,22 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
PerDataEmployee employee = new PerDataEmployee
{
RowNumber = r,
AccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell)?.ToString(),
Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell)?.ToString(),
DoctorName = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医生姓名").PointCell)?.ToString(),
JobTitle = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职称").PointCell)?.ToString(),
FitPeople = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算参考对象").PointCell)?.ToString(),
FitPeopleRatio = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算系数").PointCell)?.ToString()),
AccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell)?.StringCellValue,
Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell)?.StringCellValue,
DoctorName = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医生姓名").PointCell)?.StringCellValue,
JobTitle = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职称").PointCell)?.StringCellValue,
FitPeople = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算参考对象").PointCell)?.StringCellValue,
FitPeopleRatio = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算系数").PointCell)?.NumericCellValue),
AccountType = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人员分类").PointCell)?.ToString(),
PostCoefficient = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "岗位系数").PointCell)?.ToString()),
PostCoefficient = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "岗位系数").PointCell)?.NumericCellValue),
WorkTime = NopiSevice.GetCellDatetimeValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "参加工作时间").PointCell)),
ScoreAverageRate = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.ToString()),
Attendance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤率").PointCell)?.ToString()),
ScoreAverageRate = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue),
Attendance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤率").PointCell)?.NumericCellValue),
//PeopleNumber = ConvertHelper.To<int?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元医生数").PointCell)?.ToString()),
//Workload = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "工作量绩效").PointCell)?.ToString()),
OthePerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.ToString()),
Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.ToString()),
Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.ToString()),
OthePerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue),
Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue),
Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.NumericCellValue),
//Grant = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "发放系数").PointCell)?.ToString()),
};
dataList.Add(employee);
......
......@@ -81,7 +81,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value)?.ToString(),
Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(),
TypeName = athead?.CellValue,
CellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell)?.ToString()),
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配
FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
......
......@@ -35,17 +35,17 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
RowNumber = r,
//AccountingUnit = accountingUnit,
//Department = accountingUnit,
QuantitativeIndicators = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "量化指标").PointCell)?.ToString(),
Quantity = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "数量").PointCell)?.ToString()),
QuantitativeIndicatorsValue = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "量化指标绩效分值").PointCell)?.ToString()),
QuantitativeIndicators = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "量化指标").PointCell)?.StringCellValue,
Quantity = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "数量").PointCell)?.NumericCellValue),
QuantitativeIndicatorsValue = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "量化指标绩效分值").PointCell)?.NumericCellValue),
};
var cell = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "科室").PointCell);//?.ToString();
var accountingUnit = cell?.ToString();
var accountingUnit = cell?.StringCellValue;
if (cell != null && IsMergeCell(cell, out Point start, out Point end) && r != start.X)
{
row = sheet.GetRow(start.X);
cell = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "科室").PointCell);
accountingUnit = cell.ToString();
accountingUnit = cell?.StringCellValue;
}
if (string.IsNullOrEmpty(accountingUnit))
accountingUnit = lastAccount;
......@@ -55,11 +55,11 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
specialUnit.AccountingUnit = accountingUnit;
specialUnit.Department = accountingUnit;
specialUnit.Number = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人数").PointCell)?.ToString());
specialUnit.ScoringAverage = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.ToString());
specialUnit.OtherPerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.ToString());
specialUnit.Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.ToString());
specialUnit.Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.ToString());
specialUnit.Number = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人数").PointCell)?.NumericCellValue);
specialUnit.ScoringAverage = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue);
specialUnit.OtherPerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue);
specialUnit.Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue);
specialUnit.Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.NumericCellValue);
//}
if (!string.IsNullOrEmpty(specialUnit.QuantitativeIndicators) && specialUnit.QuantitativeIndicatorsValue != null)
dataList.Add(specialUnit);
......
......@@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="DotNetCore.NPOI" Version="1.2.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
......
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