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