Commit ee75cac4 by ruyun.zhang@suvalue.com

v22.2.10

parents 53a73c08 0c1b045f
using Microsoft.Extensions.Hosting; //using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; //using Microsoft.Extensions.Logging;
using Performance.Services.Queues; //using Performance.Services.Queues;
using System; //using System;
using System.Threading; //using System.Threading;
using System.Threading.Tasks; //using System.Threading.Tasks;
namespace Performance.Api //namespace Performance.Api
{ //{
public class QueuedHostedService : BackgroundService // public class QueuedHostedService : BackgroundService
{ // {
private readonly ILogger<QueuedHostedService> _logger; // private readonly ILogger<QueuedHostedService> _logger;
public QueuedHostedService( // public QueuedHostedService(
IBackgroundTaskQueue taskQueue, // IBackgroundTaskQueue taskQueue,
ILogger<QueuedHostedService> logger) // ILogger<QueuedHostedService> logger)
{ // {
TaskQueue = taskQueue; // TaskQueue = taskQueue;
_logger = logger; // _logger = logger;
} // }
public IBackgroundTaskQueue TaskQueue { get; } // public IBackgroundTaskQueue TaskQueue { get; }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) // protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{ // {
_logger.LogInformation( // _logger.LogInformation(
$"Queued Hosted Service is running.{Environment.NewLine} {Environment.NewLine}Tap W to add a work item to the background queue.{Environment.NewLine}"); // $"Queued Hosted Service is running.{Environment.NewLine} {Environment.NewLine}Tap W to add a work item to the background queue.{Environment.NewLine}");
await BackgroundProcessing(stoppingToken); // await BackgroundProcessing(stoppingToken);
} // }
private async Task BackgroundProcessing(CancellationToken stoppingToken) // private async Task BackgroundProcessing(CancellationToken stoppingToken)
{ // {
while (!stoppingToken.IsCancellationRequested) // while (!stoppingToken.IsCancellationRequested)
{ // {
var workItem = // var workItem =
await TaskQueue.DequeueAsync(stoppingToken); // await TaskQueue.DequeueAsync(stoppingToken);
try // try
{ // {
await workItem(stoppingToken); // await workItem(stoppingToken);
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
_logger.LogError(ex, // _logger.LogError(ex,
"Error occurred executing {WorkItem}.", nameof(workItem)); // "Error occurred executing {WorkItem}.", nameof(workItem));
} // }
} // }
} // }
public override async Task StopAsync(CancellationToken stoppingToken) // public override async Task StopAsync(CancellationToken stoppingToken)
{ // {
_logger.LogInformation("Queued Hosted Service is stopping."); // _logger.LogInformation("Queued Hosted Service is stopping.");
await base.StopAsync(stoppingToken); // await base.StopAsync(stoppingToken);
} // }
} // }
} //}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Performance.DtoModels.AppSettings; using Performance.DtoModels.AppSettings;
using Performance.EntityModels; using Performance.EntityModels;
using System; using System;
namespace Performance.Api.Configurations namespace Performance.Api.Configurations
...@@ -23,6 +23,7 @@ public static void AddDatabaseConfiguration(this IServiceCollection services) ...@@ -23,6 +23,7 @@ public static void AddDatabaseConfiguration(this IServiceCollection services)
optionBuilder => optionBuilder =>
{ {
optionBuilder.EnableStringComparisonTranslations(true); optionBuilder.EnableStringComparisonTranslations(true);
optionBuilder.EnableRetryOnFailure();
}); });
}, ServiceLifetime.Transient); }, ServiceLifetime.Transient);
} }
......
...@@ -46,8 +46,8 @@ public static void AddDependencyInjectionConfiguration(this IServiceCollection s ...@@ -46,8 +46,8 @@ public static void AddDependencyInjectionConfiguration(this IServiceCollection s
#endregion redis #endregion redis
services.AddHostedService<QueuedHostedService>(); //services.AddHostedService<QueuedHostedService>();
services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>(); //services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>();
services.AddSingleton<IHubNotificationQueue, HubNotificationQueue>(); services.AddSingleton<IHubNotificationQueue, HubNotificationQueue>();
services services
......
...@@ -19,20 +19,20 @@ public static void AddSwaggerConfiguration(this IServiceCollection services) ...@@ -19,20 +19,20 @@ public static void AddSwaggerConfiguration(this IServiceCollection services)
{ {
c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1.0", Title = "绩效API接口" }); c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1.0", Title = "绩效API接口" });
//var xmlPath = new string[] var xmlPath = new string[]
//{ {
// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml"),
// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.DtoModels.xml"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.DtoModels.xml"),
// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.EntityModels.xml"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.EntityModels.xml"),
//}; };
//foreach (var item in xmlPath) foreach (var item in xmlPath)
//{ {
// c.IncludeXmlComments(item, true); c.IncludeXmlComments(item, true);
//} }
var xmlPathsss = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml"); //var xmlPathsss = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml");
c.IncludeXmlComments(xmlPathsss, true); //c.IncludeXmlComments(xmlPathsss, true);
// Token绑定到ConfigureServices // Token绑定到ConfigureServices
var security = new OpenApiSecurityRequirement var security = new OpenApiSecurityRequirement
......
...@@ -34,8 +34,9 @@ public class AllotController : Controller ...@@ -34,8 +34,9 @@ public class AllotController : Controller
private ILogger<AllotController> _logger; private ILogger<AllotController> _logger;
private ClaimService _claim; private ClaimService _claim;
private LogManageService _logManageService; private LogManageService _logManageService;
private readonly TaskService _taskService;
private readonly CostTransferService costTransferService; private readonly CostTransferService costTransferService;
private IBackgroundTaskQueue _backgroundTaskQueue; //private IBackgroundTaskQueue _backgroundTaskQueue;
private IServiceScopeFactory _serviceScopeFactory; private IServiceScopeFactory _serviceScopeFactory;
public AllotController(AllotService allotService, public AllotController(AllotService allotService,
...@@ -43,10 +44,11 @@ public class AllotController : Controller ...@@ -43,10 +44,11 @@ public class AllotController : Controller
ConfigService configService, ConfigService configService,
ILogger<AllotController> logger, ILogger<AllotController> logger,
IWebHostEnvironment evn, IWebHostEnvironment evn,
IBackgroundTaskQueue backgroundTaskQueue, //IBackgroundTaskQueue backgroundTaskQueue,
IServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
ClaimService claim, ClaimService claim,
LogManageService logManageService, LogManageService logManageService,
TaskService taskService,
CostTransferService costTransferService) CostTransferService costTransferService)
{ {
_allotService = allotService; _allotService = allotService;
...@@ -55,9 +57,10 @@ public class AllotController : Controller ...@@ -55,9 +57,10 @@ public class AllotController : Controller
_evn = evn; _evn = evn;
_claim = claim; _claim = claim;
_logManageService = logManageService; _logManageService = logManageService;
_taskService = taskService;
this.costTransferService = costTransferService; this.costTransferService = costTransferService;
_configService = configService; _configService = configService;
_backgroundTaskQueue = backgroundTaskQueue; //_backgroundTaskQueue = backgroundTaskQueue;
_serviceScopeFactory = serviceScopeFactory; _serviceScopeFactory = serviceScopeFactory;
} }
...@@ -231,6 +234,7 @@ public ApiResponse ImportExtraction(int allotId) ...@@ -231,6 +234,7 @@ public ApiResponse ImportExtraction(int allotId)
allot.Remark = EnumHelper.GetDescription(AllotStates.FileUploaded); allot.Remark = EnumHelper.GetDescription(AllotStates.FileUploaded);
allot.UploadDate = DateTime.Now; allot.UploadDate = DateTime.Now;
allot.Generate = (int)AllotGenerate.Init; allot.Generate = (int)AllotGenerate.Init;
allot.IsModifyConfig = 1;
if (!_allotService.Update(allot)) if (!_allotService.Update(allot))
return new ApiResponse(ResponseType.Fail, $"上传成功,修改状态失败"); return new ApiResponse(ResponseType.Fail, $"上传成功,修改状态失败");
_configService.Clear(allot.ID); _configService.Clear(allot.ID);
...@@ -252,28 +256,47 @@ public ApiResponse GenerateAsync([CustomizeValidator(RuleSet = "Delete"), FromBo ...@@ -252,28 +256,47 @@ public ApiResponse GenerateAsync([CustomizeValidator(RuleSet = "Delete"), FromBo
var allot = _allotService.GetAllot(request.ID); var allot = _allotService.GetAllot(request.ID);
if (null == allot || string.IsNullOrEmpty(allot.Path)) if (null == allot || string.IsNullOrEmpty(allot.Path))
throw new PerformanceException("当前绩效记录不存在或没有上传数据文件"); throw new PerformanceException("当前绩效记录不存在或没有上传数据文件");
if (allot.States == (int)AllotStates.Wait)
return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成");
_logManageService.WriteMsg("生成绩效准备中", $"准备生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效,请稍等!", 1, allot.ID, "ReceiveMessage", true);
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait), allot.Generate);
//if (_evn.IsEnvironment("Localhost")) //if (_evn.IsEnvironment("Localhost"))
//{ //{
// var tasks = _taskService.GetTasks(-1);
// var status = new int[] { (int)Background.Status.等待, (int)Background.Status.执行中 };
// if (tasks.Any(w => w.Argument == allot.ID.ToString() && w.JobType == (int)Background.JobType.生成测算表 && status.Contains(w.Status)))
// return new ApiResponse(ResponseType.OK, "当前绩效正在生成中,请等待生成完成后重新生成");
// if (allot.States == (int)AllotStates.Wait)
// return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成");
// _logManageService.WriteMsg("生成绩效准备中", $"准备生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效,请稍等!", 1, allot.ID, "ReceiveMessage", true);
// _allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait), allot.Generate);
// _allotService.Generate(allot); // _allotService.Generate(allot);
//} //}
//else //else
//{ //{
_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
{
using (var scope = _serviceScopeFactory.CreateScope())
{
var scopedServices = scope.ServiceProvider.GetRequiredService<AllotService>();
scopedServices.Generate(allot);
await Task.Delay(TimeSpan.FromSeconds(5), token);
}
});
//_publishEndpoint.Publish(allot).Wait(); var tasks = _taskService.GetTasks(-1);
var status = new int[] { (int)Background.Status.等待, (int)Background.Status.执行中 };
if (tasks.Any(w => w.Argument == allot.ID.ToString() && w.JobType == (int)Background.JobType.生成测算表 && status.Contains(w.Status)))
return new ApiResponse(ResponseType.OK, "当前绩效正在生成中,请等待生成完成后重新生成");
if (allot.States == (int)AllotStates.Wait)
return new ApiResponse(ResponseType.OK, "当前绩效正在等待生成");
_logManageService.WriteMsg("生成绩效准备中", $"准备生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效,请稍等!", 1, allot.ID, "ReceiveMessage", true);
_allotService.UpdateAllotStates(allot.ID, (int)AllotStates.Wait, EnumHelper.GetDescription(AllotStates.Wait), allot.Generate);
//_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
//{
// using (var scope = _serviceScopeFactory.CreateScope())
// {
// var scopedServices = scope.ServiceProvider.GetRequiredService<AllotService>();
// scopedServices.Generate(allot);
// await Task.Delay(TimeSpan.FromSeconds(5), token);
// }
//});
_taskService.Add(Background.JobType.生成测算表, allot.ID.ToString());
//} //}
_logManageService.WriteMsg("等待绩效生成", $"等待绩效生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效!", 1, allot.ID, "ReceiveMessage"); _logManageService.WriteMsg("等待绩效生成", $"等待绩效生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效!", 1, allot.ID, "ReceiveMessage");
...@@ -297,15 +320,16 @@ public ApiResponse GenerateReport([CustomizeValidator(RuleSet = "Delete"), FromB ...@@ -297,15 +320,16 @@ public ApiResponse GenerateReport([CustomizeValidator(RuleSet = "Delete"), FromB
if (null == allot || !states.Contains(allot.States)) if (null == allot || !states.Contains(allot.States))
throw new PerformanceException("当前绩效暂未生成,无法统计报表数据。"); throw new PerformanceException("当前绩效暂未生成,无法统计报表数据。");
_backgroundTaskQueue.QueueBackgroundWorkItem(async token => //_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
{ //{
using (var scope = _serviceScopeFactory.CreateScope()) // using (var scope = _serviceScopeFactory.CreateScope())
{ // {
var scopedServices = scope.ServiceProvider.GetRequiredService<AllotService>(); // var scopedServices = scope.ServiceProvider.GetRequiredService<AllotService>();
scopedServices.GenerateReport(allot); // scopedServices.GenerateReport(allot);
await Task.Delay(TimeSpan.FromSeconds(5), token); // await Task.Delay(TimeSpan.FromSeconds(5), token);
} // }
}); //});
_taskService.Add(Background.JobType.报表, allot.ID.ToString());
return new ApiResponse(ResponseType.OK, "统计报表数据任务开始"); return new ApiResponse(ResponseType.OK, "统计报表数据任务开始");
} }
......
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels;
using Performance.Services;
namespace Performance.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CommonController : ControllerBase
{
private readonly CommonService _service;
public CommonController(CommonService service)
{
_service = service;
}
[AllowAnonymous]
[HttpGet("version")]
public ApiResponse Version()
{
var versions = _service.GetVersions();
return new ApiResponse(ResponseType.OK, versions);
}
}
}
...@@ -394,6 +394,20 @@ public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest ...@@ -394,6 +394,20 @@ public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest
#endregion #endregion
/// <summary> /// <summary>
/// 修改列头显示状态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("updateheadersstatus")]
[HttpPost]
public ApiResponse UpdateHeadersStatus([FromBody] ComputerAliasUpdate request)
{
if (_computeService.UpdateHeadersStatus(request))
return new ApiResponse(ResponseType.OK, "修改成功");
return new ApiResponse(ResponseType.OK, "修改失败");
}
/// <summary>
/// 自定义列头 /// 自定义列头
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
......
...@@ -18,11 +18,17 @@ namespace Performance.Api.Controllers ...@@ -18,11 +18,17 @@ namespace Performance.Api.Controllers
[Route("api/[controller]")] [Route("api/[controller]")]
public class ConfigController : Controller public class ConfigController : Controller
{ {
private readonly ClaimService _claim;
private readonly ConfigService _configService; private readonly ConfigService _configService;
private readonly AllotService _allotService; private readonly AllotService _allotService;
private readonly DictionaryService _dictionaryService; private readonly DictionaryService _dictionaryService;
public ConfigController(ConfigService configService, AllotService allotService, DictionaryService dictionaryService) public ConfigController(
ClaimService claim,
ConfigService configService,
AllotService allotService,
DictionaryService dictionaryService)
{ {
_claim = claim;
_configService = configService; _configService = configService;
_allotService = allotService; _allotService = allotService;
_dictionaryService = dictionaryService; _dictionaryService = dictionaryService;
...@@ -620,8 +626,8 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request) ...@@ -620,8 +626,8 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request)
[HttpPost] [HttpPost]
public ApiResponse AccountingInsert([FromBody] cof_accounting request) public ApiResponse AccountingInsert([FromBody] cof_accounting request)
{ {
if (request.AllotId == 0 || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit)) if (request.AllotId == 0 || string.IsNullOrEmpty(request.Code) || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.ParameterError); return new ApiResponse(ResponseType.ParameterError, "参数不允许为空");
var drugprop = _configService.AccountingInsert(request); var drugprop = _configService.AccountingInsert(request);
return new ApiResponse(ResponseType.OK, drugprop); return new ApiResponse(ResponseType.OK, drugprop);
...@@ -672,6 +678,19 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId) ...@@ -672,6 +678,19 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
} }
/// <summary> /// <summary>
/// 核算单元及组别检验
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("BatchCheckAccounting/{allotId}")]
[HttpPost]
public ApiResponse BatchCheckAccounting(int allotId)
{
_configService.BatchCheckAccounting(allotId);
return new ApiResponse(ResponseType.OK, "校验通过");
}
/// <summary>
/// 核算单元及组别批量添加 /// 核算单元及组别批量添加
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
...@@ -882,7 +901,7 @@ public ApiResponse GetCustomList([FromBody] CustomPagingRequest request) ...@@ -882,7 +901,7 @@ public ApiResponse GetCustomList([FromBody] CustomPagingRequest request)
if (allot == null) if (allot == null)
return new ApiResponse(ResponseType.ParameterError, "AllotID错误"); return new ApiResponse(ResponseType.ParameterError, "AllotID错误");
return _configService.QueryCustom(request); return _configService.QueryCustom(_claim.GetUserId(), request);
} }
/// <summary> /// <summary>
...@@ -900,8 +919,8 @@ public ApiResponse BatchSaveCustom([FromBody] SaveCustomData request) ...@@ -900,8 +919,8 @@ public ApiResponse BatchSaveCustom([FromBody] SaveCustomData request)
else if (string.IsNullOrEmpty(request.TableName)) else if (string.IsNullOrEmpty(request.TableName))
return new ApiResponse(ResponseType.ParameterError, "表名为空"); return new ApiResponse(ResponseType.ParameterError, "表名为空");
return _configService.SaveCustomTable(request); return _configService.SaveCustomTable(request);
} }
} }
} }
\ No newline at end of file
...@@ -319,20 +319,21 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request) ...@@ -319,20 +319,21 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any()) if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee
.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new .Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new TitleValue<decimal>
{ {
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key, PersonnelNumber = t.Key.PersonnelNumber,
Value = s.Sum(sum => sum.Amount ?? 0) DoctorName = t.Key.DoctorName,
}) AccountingUnit = t.Key.AccountingUnit,
}); Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0),
Remark = s.FirstOrDefault()?.Remark ?? "",
})
});
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
...@@ -396,8 +397,7 @@ public ApiResponse DeleteApr([FromBody] IdRequest request) ...@@ -396,8 +397,7 @@ public ApiResponse DeleteApr([FromBody] IdRequest request)
public ApiResponse AuditResult([FromBody] AprAmountAuditRequest request) public ApiResponse AuditResult([FromBody] AprAmountAuditRequest request)
{ {
var userid = claim.GetUserId(); var userid = claim.GetUserId();
var result = employeeService.ConfirmAudit(userid, request); return employeeService.ConfirmAudit(userid, request);
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败");
} }
/// <summary> /// <summary>
...@@ -463,20 +463,51 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId) ...@@ -463,20 +463,51 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId)
[HttpPost] [HttpPost]
public ApiResponse AprOverview(int allotId) public ApiResponse AprOverview(int allotId)
{ {
var roleType = new[] { 3, 4, 9, 10 }; //var roleType = new[] { 3, 4, 9, 10 };
//var userid = claim.GetUserId();
//var user = userService.GetUser(userid);
//var role = roleService.GetUserRole(user.UserID);
//var result = new List<Dictionary<string, string>>();
//if (role.Any(t => roleType.Contains(t.Type.Value)))
//result = employeeService.GetOtherPerStats(allotId, user.Department ?? "");
//else
// result = employeeService.GetOtherPerStats(allotId);
//return new ApiResponse(ResponseType.OK, result);
if (allotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employees = employeeService.GetAprList(allotId, "", 3);
if (employees == null || !employees.Any())
return new ApiResponse(ResponseType.OK, "ok", employees);
var roleType = new[] { (int)Role.护士长, (int)Role.科主任, (int)Role.特殊科室, (int)Role.行政科室, };
var userid = claim.GetUserId(); var userid = claim.GetUserId();
var user = userService.GetUser(userid); var user = userService.GetUser(userid);
var role = roleService.GetUserRole(user.UserID); var role = roleService.GetUserRole(user.UserID);
var result = new List<Dictionary<string, string>>();
if (role.Any(t => roleType.Contains(t.Type.Value))) if (role.Any(t => roleType.Contains(t.Type.Value)))
result = employeeService.GetOtherPerStats(allotId, user.Department ?? ""); employees = employees.Where(w => w.AccountingUnit == user.Department).ToList();
else
result = employeeService.GetOtherPerStats(allotId);
return new ApiResponse(ResponseType.OK, result);
var result = employees
.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
.Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Remark = s.FirstOrDefault()?.Remark ?? "",
Value = s.Sum(sum => sum.Amount ?? 0)
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
} }
#endregion #endregion
...@@ -576,18 +607,21 @@ public ApiResponse GetAprHideDetail([FromBody] per_apr_amount request) ...@@ -576,18 +607,21 @@ public ApiResponse GetAprHideDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any()) if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new var result = employee
{ .GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
PersonnelNumber = t.Key.PersonnelNumber, .Select(t => new
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new TitleValue<decimal>
{ {
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key, PersonnelNumber = t.Key.PersonnelNumber,
Value = s.Sum(sum => sum.Amount ?? 0) DoctorName = t.Key.DoctorName,
}) AccountingUnit = t.Key.AccountingUnit,
}); Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0),
Remark = s.FirstOrDefault()?.Remark ?? "",
})
});
return new ApiResponse(ResponseType.OK, "ok", result); return new ApiResponse(ResponseType.OK, "ok", result);
} }
/// <summary> /// <summary>
...@@ -650,8 +684,7 @@ public ApiResponse DeleteAprHide([FromBody] IdRequest request) ...@@ -650,8 +684,7 @@ public ApiResponse DeleteAprHide([FromBody] IdRequest request)
public ApiResponse AuditResultHide([FromBody] AprAmountAuditRequest request) public ApiResponse AuditResultHide([FromBody] AprAmountAuditRequest request)
{ {
var userid = claim.GetUserId(); var userid = claim.GetUserId();
var result = employeeService.ConfirmAuditHide(userid, request); return employeeService.ConfirmAuditHide(userid, request);
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败");
} }
/// <summary> /// <summary>
...@@ -717,8 +750,40 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDictHide([FromRoute] int allot ...@@ -717,8 +750,40 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDictHide([FromRoute] int allot
[HttpPost] [HttpPost]
public ApiResponse AprHideOverview(int allotId) public ApiResponse AprHideOverview(int allotId)
{ {
var relust = employeeService.GetOtherPerStatsHide(allotId); //var relust = employeeService.GetOtherPerStatsHide(allotId);
return new ApiResponse(ResponseType.OK, relust); //return new ApiResponse(ResponseType.OK, relust);
if (allotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employees = employeeService.GetAprHideList(allotId, "", 3);
if (employees == null || !employees.Any())
return new ApiResponse(ResponseType.OK, "ok", employees);
var roleType = new[] { (int)Role.护士长, (int)Role.科主任, (int)Role.特殊科室, (int)Role.行政科室, };
var userid = claim.GetUserId();
var user = userService.GetUser(userid);
var role = roleService.GetUserRole(user.UserID);
if (role.Any(t => roleType.Contains(t.Type.Value)))
employees = employees.Where(w => w.AccountingUnit == user.Department).ToList();
var result = employees
.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName })
.Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Remark = s.FirstOrDefault()?.Remark ?? "",
Value = s.Sum(sum => sum.Amount ?? 0)
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
} }
#endregion #endregion
......
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Performance.DtoModels;
using Performance.Services;
using Performance.Services.OnlineExcel;
namespace Performance.Api.Controllers
{
[Route("api/online/excel")]
[ApiController]
public class OnlineExcelController : Controller
{
private readonly AllotService _allotService;
private readonly OnlineExcelService _excelService;
public OnlineExcelController(
AllotService allotService,
OnlineExcelService excelService)
{
_allotService = allotService;
_excelService = excelService;
}
[Route("sheet/name")]
[HttpGet]
[AllowAnonymous]
public ApiResponse SheetName(int allotId)
{
var allot = _allotService.GetAllot(allotId);
if (allot == null)
return new ApiResponse(ResponseType.Fail, "当前绩效信息无效", "当前绩效信息无效");
var sheetNames = _excelService.GetExcelSheetName(allot);
if (sheetNames == null || sheetNames.Count == 0)
return new ApiResponse(ResponseType.Fail, "未能找到有效[SHEET]", "未能找到有效[SHEET]");
return new ApiResponse(ResponseType.OK, sheetNames);
}
[Route("sheet/data")]
[HttpGet]
[AllowAnonymous]
public ApiResponse SheetName(int allotId, string sheetName)
{
var allot = _allotService.GetAllot(allotId);
if (allot == null)
return new ApiResponse(ResponseType.Fail, "当前绩效信息无效", "当前绩效信息无效");
var s = _excelService.ReadSheet(allot, sheetName);
return new ApiResponse(ResponseType.OK, "", JsonConvert.SerializeObject(s, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
}
[Route("sheet/chanage/{allotId}")]
[HttpPost]
[AllowAnonymous]
public ApiResponse WriteSheet(int allotId, [FromBody] EpChanage chanage)
{
var allot = _allotService.GetAllot(allotId);
if (allot == null)
return new ApiResponse(ResponseType.Fail, "当前绩效信息无效", "当前绩效信息无效");
_excelService.WriteSheet(allot, chanage);
return new ApiResponse(ResponseType.OK);
}
}
}
...@@ -59,9 +59,7 @@ public ApiResponse GetPersons([FromRoute] int allotId, [FromBody] PersonParamsRe ...@@ -59,9 +59,7 @@ public ApiResponse GetPersons([FromRoute] int allotId, [FromBody] PersonParamsRe
public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request) public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request)
{ {
request.CreateUser = claimService.GetUserId(); request.CreateUser = claimService.GetUserId();
var employeee = personService.CreatePerson(request); return personService.CreatePerson(request);
return employeee.Id > 0 ? new ApiResponse(ResponseType.OK, "添加成功!", employeee)
: new ApiResponse(ResponseType.Fail, "添加失败!");
} }
/// <summary> /// <summary>
...@@ -73,9 +71,7 @@ public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request) ...@@ -73,9 +71,7 @@ public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request)
[HttpPost] [HttpPost]
public ApiResponse UpdatePerson([FromBody] PerEmployeeResponse request) public ApiResponse UpdatePerson([FromBody] PerEmployeeResponse request)
{ {
var result = personService.UpdatePerson(request); return personService.UpdatePerson(request);
return result ? new ApiResponse(ResponseType.OK, "修改成功!")
: new ApiResponse(ResponseType.OK, "修改失败!");
} }
/// <summary> /// <summary>
...@@ -93,6 +89,20 @@ public ApiResponse DeletePerson(int employeeId) ...@@ -93,6 +89,20 @@ public ApiResponse DeletePerson(int employeeId)
} }
/// <summary> /// <summary>
/// 删除所有员工
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("person/deleteall/{allotId}")]
[HttpPost]
public ApiResponse DeleteAllPerson(int allotId)
{
var result = personService.DeleteAllPerson(allotId);
return result ? new ApiResponse(ResponseType.OK, "删除成功!")
: new ApiResponse(ResponseType.OK, "删除失败!");
}
/// <summary>
/// 下载当前测算表 /// 下载当前测算表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
...@@ -239,11 +249,7 @@ public ApiResponse GetBatchPersonStructrue(int hospitalId) ...@@ -239,11 +249,7 @@ public ApiResponse GetBatchPersonStructrue(int hospitalId)
[Route("person/{allotId}/BathSavePerson/{hospitalId}")] [Route("person/{allotId}/BathSavePerson/{hospitalId}")]
public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData request) public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData request)
{ {
var result = personService.BathSavePerson(allotId, hospitalId, request); return personService.BathSavePerson(allotId, hospitalId, request);
if (result)
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, "出勤天数或预留比例格式错误");
} }
/// <summary> /// <summary>
......
...@@ -348,7 +348,6 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTime request) ...@@ -348,7 +348,6 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTime request)
public ApiResponse GetWholeHospitalGrantSummary([FromBody] HospitalGrantSummary request) public ApiResponse GetWholeHospitalGrantSummary([FromBody] HospitalGrantSummary request)
{ {
return new ApiResponse(ResponseType.OK, "ok", _computeService.GetPerformanceSummary(request, "view_allot_sign_emp")); return new ApiResponse(ResponseType.OK, "ok", _computeService.GetPerformanceSummary(request, "view_allot_sign_emp"));
} }
/// <summary> /// <summary>
......
...@@ -19,16 +19,19 @@ public class ReportGlobalController : Controller ...@@ -19,16 +19,19 @@ public class ReportGlobalController : Controller
private readonly IWebHostEnvironment env; private readonly IWebHostEnvironment env;
private readonly AllotService allotService; private readonly AllotService allotService;
private readonly ReportGlobalService reportGlobalService; private readonly ReportGlobalService reportGlobalService;
private readonly ClaimService claimService;
public ReportGlobalController( public ReportGlobalController(
IWebHostEnvironment env, IWebHostEnvironment env,
AllotService allotService, AllotService allotService,
ReportGlobalService reportGlobalService ReportGlobalService reportGlobalService,
ClaimService claimService
) )
{ {
this.env = env; this.env = env;
this.allotService = allotService; this.allotService = allotService;
this.reportGlobalService = reportGlobalService; this.reportGlobalService = reportGlobalService;
this.claimService = claimService;
} }
/// <summary> /// <summary>
...@@ -128,16 +131,17 @@ public ApiResponse Import(int hospitalId, [FromForm] IFormCollection form) ...@@ -128,16 +131,17 @@ public ApiResponse Import(int hospitalId, [FromForm] IFormCollection form)
/// 获取人员标签配置 /// 获取人员标签配置
/// </summary> /// </summary>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
[Route("ReportPersonTag")] [Route("ReportPersonTag")]
[HttpPost] [HttpPost]
public ApiResponse ReportPersonTag(int hospitalId) public ApiResponse ReportPersonTag(int hospitalId, int allotId)
{ {
if (hospitalId<=0) if (hospitalId <= 0)
{ {
return new ApiResponse(ResponseType.Fail,"参数错误", "hospitalId无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "hospitalId无效");
} }
var relust = reportGlobalService.GetReportPersonTag(hospitalId); var relust = reportGlobalService.GetReportPersonTag(hospitalId, allotId);
return new ApiResponse(ResponseType.OK, relust); return new ApiResponse(ResponseType.OK, relust);
} }
...@@ -145,18 +149,18 @@ public ApiResponse ReportPersonTag(int hospitalId) ...@@ -145,18 +149,18 @@ public ApiResponse ReportPersonTag(int hospitalId)
/// 保存科室标签配置 /// 保存科室标签配置
/// </summary> /// </summary>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
[Route("saveReportPersonTag")] [Route("saveReportPersonTag/{allotId}")]
[HttpPost] [HttpPost]
public ApiResponse SaveReportPersonTag(int hospitalId,[FromBody] SaveCollectData request) public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, [FromBody] SaveCollectData request)
{ {
if (hospitalId <= 0) if (hospitalId <= 0)
{ {
return new ApiResponse(ResponseType.Fail, "参数错误", "hospitalId无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "hospitalId无效");
} }
reportGlobalService.SaveReportPersonTag(hospitalId,request); return reportGlobalService.SaveReportPersonTag(hospitalId, allotId, claimService.GetUserId(), request);
return new ApiResponse(ResponseType.OK);
} }
/// <summary> /// <summary>
......
...@@ -612,7 +612,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request) ...@@ -612,7 +612,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验 // 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate) if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
...@@ -634,7 +634,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request) ...@@ -634,7 +634,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
List<SecondComputeCheckResultDto> result = new List<SecondComputeCheckResultDto>(); List<SecondComputeCheckResultDto> result = new List<SecondComputeCheckResultDto>();
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var checkData = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkData = _redistributionService.CheckData(allot, second, (ComputeMode)request.ComputeMode, request.Body, loads);
if (checkData != null && checkData.Count > 0) if (checkData != null && checkData.Count > 0)
result.AddRange(checkData); result.AddRange(checkData);
...@@ -681,7 +681,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request) ...@@ -681,7 +681,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验 // 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate) if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
...@@ -701,7 +701,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request) ...@@ -701,7 +701,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
} }
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var checkDatas = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkDatas = _redistributionService.CheckData(allot, second, (ComputeMode)request.ComputeMode, request.Body, loads);
if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString())) if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString())); return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
...@@ -745,14 +745,17 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request) ...@@ -745,14 +745,17 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
var second = secondAllotService.GetSecondAllot(request.SecondId); var second = secondAllotService.GetSecondAllot(request.SecondId);
if (second == null) throw new PerformanceException("参数SecondId无效!"); if (second == null) throw new PerformanceException("参数SecondId无效!");
if (second.Status == (int)SecondAllot.Status.等待审核 || second.Status == (int)SecondAllot.Status.审核通过)
throw new PerformanceException("保存失败,当前二次分配已提交!");
var allot = _allotService.GetAllot(second.AllotId.Value); var allot = _allotService.GetAllot(second.AllotId.Value);
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var checkDatas = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkDatas = _redistributionService.CheckData(allot, second, (ComputeMode)request.ComputeMode, request.Body, loads);
if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString())) if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString())); return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
// 二次分配提交数据格式 校验 // 二次分配提交数据格式 校验
...@@ -766,6 +769,13 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request) ...@@ -766,6 +769,13 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
if (cleanDatas == null || cleanDatas.Count == 0) if (cleanDatas == null || cleanDatas.Count == 0)
throw new PerformanceException("提交参数都是无效数据,请重新填写数据后保存!"); throw new PerformanceException("提交参数都是无效数据,请重新填写数据后保存!");
// 计算提交数据结果
_redistributionService.ResultCompute((ComputeMode)request.ComputeMode, request.Head, cleanDatas, loads, workloadGroups);
// 补充医院其他绩效
_redistributionService.SupplementOtherPerfor(second, cleanDatas);
// 重算部分数据
_redistributionService.RedistributionCompute((ComputeMode)request.ComputeMode, request.Head, cleanDatas);
var result = secondAllotService.RedistributionSave(allot, second, request.Head, cleanDatas); var result = secondAllotService.RedistributionSave(allot, second, request.Head, cleanDatas);
return result ? new ApiResponse(ResponseType.OK) : new ApiResponse(ResponseType.Fail, "保存失败"); return result ? new ApiResponse(ResponseType.OK) : new ApiResponse(ResponseType.Fail, "保存失败");
} }
...@@ -804,11 +814,11 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request) ...@@ -804,11 +814,11 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
if (!new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }.Contains(allot.States)) if (!new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }.Contains(allot.States))
throw new PerformanceException("绩效未下发,无法提交!"); throw new PerformanceException("绩效未下发,无法提交!");
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var checkDatas = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkDatas = _redistributionService.CheckData(allot, second, (ComputeMode)request.ComputeMode, request.Body, loads);
if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString())) if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString())); return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
...@@ -823,9 +833,21 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request) ...@@ -823,9 +833,21 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
if (cleanDatas == null || cleanDatas.Count == 0) if (cleanDatas == null || cleanDatas.Count == 0)
throw new PerformanceException("提交参数都是无效数据,请重新填写数据后查看计算结果!"); throw new PerformanceException("提交参数都是无效数据,请重新填写数据后查看计算结果!");
// 计算提交数据结果
_redistributionService.ResultCompute((ComputeMode)request.ComputeMode, request.Head, cleanDatas, loads, workloadGroups);
// 补充医院其他绩效
_redistributionService.SupplementOtherPerfor(second, cleanDatas);
// 重算部分数据
_redistributionService.RedistributionCompute((ComputeMode)request.ComputeMode, request.Head, cleanDatas);
var saveResult = secondAllotService.RedistributionSave(allot, second, request.Head, cleanDatas); var saveResult = secondAllotService.RedistributionSave(allot, second, request.Head, cleanDatas);
if (saveResult) if (saveResult)
{ {
var res = _redistributionService.ValidationData(second);
if (!string.IsNullOrEmpty(res))
return new ApiResponse(ResponseType.Fail, $"提交数据中存在无效数据,已经被删除,确认正确后请重新提交;删除工号清单如下:{res}");
var userid = claimService.GetUserId(); var userid = claimService.GetUserId();
var result = secondAllotService.AuditSubmit(second, userid); var result = secondAllotService.AuditSubmit(second, userid);
if (result) if (result)
...@@ -833,9 +855,9 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request) ...@@ -833,9 +855,9 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
} }
return new ApiResponse(ResponseType.Fail, "提交失败"); return new ApiResponse(ResponseType.Fail, "提交失败");
} }
catch (PerformanceException ex) catch (PerformanceException)
{ {
throw ex; throw;
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -843,6 +865,21 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request) ...@@ -843,6 +865,21 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
return new ApiResponse(ResponseType.Fail, "提交失败"); return new ApiResponse(ResponseType.Fail, "提交失败");
} }
} }
/// <summary>
/// 二次绩效撤回提交
/// </summary>
/// <returns></returns>
[Route("api/second/redistribution/rollback/{secondId}")]
[HttpPost]
public ApiResponse RedistributionRollback(int secondId)
{
var result = secondAllotService.RollbackSubmit(secondId);
if (result)
return new ApiResponse(ResponseType.OK, "提交成功");
return new ApiResponse(ResponseType.Fail, "提交失败");
}
/// <summary> /// <summary>
/// 二次分配人员字典带出 /// 二次分配人员字典带出
/// </summary> /// </summary>
...@@ -876,7 +913,7 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request) ...@@ -876,7 +913,7 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request)
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验 // 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 返回信息 // 返回信息
......
...@@ -37,6 +37,7 @@ public class TemplateController : Controller ...@@ -37,6 +37,7 @@ public class TemplateController : Controller
private readonly HospitalService hospitalService; private readonly HospitalService hospitalService;
private readonly AllotService allotService; private readonly AllotService allotService;
private readonly LogManageService logService; private readonly LogManageService logService;
private readonly TaskService _taskService;
private readonly IServiceScopeFactory serviceScopeFactory; private readonly IServiceScopeFactory serviceScopeFactory;
private readonly ExtractService extractService; private readonly ExtractService extractService;
...@@ -52,6 +53,7 @@ public class TemplateController : Controller ...@@ -52,6 +53,7 @@ public class TemplateController : Controller
HospitalService hospitalService, HospitalService hospitalService,
AllotService allotService, AllotService allotService,
LogManageService logService, LogManageService logService,
TaskService taskService,
IServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
ExtractService extractService) ExtractService extractService)
{ {
...@@ -66,6 +68,7 @@ public class TemplateController : Controller ...@@ -66,6 +68,7 @@ public class TemplateController : Controller
this.hospitalService = hospitalService; this.hospitalService = hospitalService;
this.allotService = allotService; this.allotService = allotService;
this.logService = logService; this.logService = logService;
_taskService = taskService;
this.serviceScopeFactory = serviceScopeFactory; this.serviceScopeFactory = serviceScopeFactory;
this.extractService = extractService; this.extractService = extractService;
} }
...@@ -209,77 +212,27 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest ...@@ -209,77 +212,27 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
if (allot == null) if (allot == null)
return new ApiResponse(ResponseType.ParameterError, "AllotID错误"); return new ApiResponse(ResponseType.ParameterError, "AllotID错误");
// 判断是那种抽取 // 判断是那种抽取
try
{
bool isSingle = false;
string message = configService.Judge(request.AllotId, request.HospitalId, request.UseScheme, ref isSingle, out string filePath);
if (!string.IsNullOrEmpty(message))
return new ApiResponse(ResponseType.Fail, message);
//if (!string.IsNullOrEmpty(filePath)) bool isSingle = false;
//{ string message = configService.Judge(request.AllotId, request.HospitalId, request.UseScheme, ref isSingle, out string filePath);
// var data = configService.CheckHasNewDepartmentOrCategory(request.AllotId); if (!string.IsNullOrEmpty(message))
// return new ApiResponse(ResponseType.Fail, data); return new ApiResponse(ResponseType.Fail, message);
//}
//检验科室、费用类型是否需要补充 //if (!string.IsNullOrEmpty(filePath))
//{
// var data = configService.CheckHasNewDepartmentOrCategory(request.AllotId);
// return new ApiResponse(ResponseType.Fail, data);
//}
allot.IsExtracting = allot.IsExtracting ?? 0; //检验科室、费用类型是否需要补充
if (allot.IsExtracting == 1 && allot.ExtractTime.HasValue && DateTime.Now.AddHours(-3) < allot.ExtractTime)
return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
allot.IsExtracting = 1;
allot.ExtractTime = DateTime.Now;
allotService.Update(allot);
// string email = claim.GetUserClaim(JwtClaimTypes.Mail);
string email = "";
//if (isSingle) //if (allot.IsExtracting == 1 && allot.ExtractTime.HasValue && DateTime.Now.AddHours(-3) < allot.ExtractTime)
//{ // return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
logger.LogInformation("同一项目中进行提取");
_taskService.Add(Background.JobType.提取数据, JsonHelper.Serialize(new { request.AllotId, request.HospitalId, request.UseScheme, isSingle, filePath }));
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们通知您!", new { IsExtracting = false });
Task.Run(() =>
{
Thread.Sleep(1000);
using (var scope = serviceScopeFactory.CreateScope())
{
var scopedServices = scope.ServiceProvider.GetRequiredService<ExtractService>();
logger.LogInformation("提取绩效数据参数:" + JsonHelper.Serialize(new { allotId = allot.ID, hospitalId = allot.HospitalId }));
string extractFilePath = scopedServices.Main(allot.ID, allot.HospitalId, email, allot.ID.ToString(), filePath, isSingle);
}
});
//}
//else
//{
// logger.LogInformation("多项目进行提取");
// var http = new RestSharpHelper();
// var extractUrl = http.SetUrl(url.HttpPost, "extract/extract");
// var obj = new ExtractRequest
// {
// AllotId = request.AllotId,
// HospitalId = request.HospitalId,
// Email = email
// };
// string json = JsonHelper.Serialize(obj);
// logger.LogInformation("提取绩效数据参数:" + json);
// var parameter = JsonHelper.Deserialize<Dictionary<string, object>>(json);
// var restRequest = string.IsNullOrEmpty(filePath) ? http.CreatePostRequest(json) : http.CreateFileRequest(new string[] { filePath }, parameter);
// Task.Run(() => http.GetResponse(extractUrl, restRequest));
//}
return new ApiResponse(ResponseType.OK, "HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!", new { IsExtracting = false });
}
catch (Exception ex)
{
if (allot != null)
{
allot.IsExtracting = 3;
allotService.Update(allot);
}
logger.LogError("提取绩效数据:" + ex.ToString());
throw new Exception(ex.Message);
}
// A 使用上传绩效作为模板 // A 使用上传绩效作为模板
// A-1 判断上传绩效是否存在,并执行成功 // A-1 判断上传绩效是否存在,并执行成功
// A-2 医院人员名单、1.0.1 额外收入(写出列头)、2.1 成本支出统计表(写出列头)、4.1 临床科室医护绩效测算表、4.2 特殊核算单元绩效测算表(数量、考核得分率、奖罚、其他) // A-2 医院人员名单、1.0.1 额外收入(写出列头)、2.1 成本支出统计表(写出列头)、4.1 临床科室医护绩效测算表、4.2 特殊核算单元绩效测算表(数量、考核得分率、奖罚、其他)
......
using FluentScheduler;
using Microsoft.Extensions.Logging;
using Performance.Infrastructure;
using Performance.Repository;
using Performance.Services;
using System;
using System.Linq;
namespace Performance.Api
{
public class AutoSyncConfigJob : IJob
{
private readonly ILogger logger;
private readonly PerforPerallotRepository perallotRepository;
private readonly ConfigService configService;
public AutoSyncConfigJob(
ILogger<AutoSyncConfigJob> logger,
PerforPerallotRepository perallotRepository,
ConfigService configService
)
{
this.logger = logger;
this.perallotRepository = perallotRepository;
this.configService = configService;
}
public void Execute()
{
try
{
logger.LogInformation("开始同步配置");
var list = perallotRepository.GetEntities();
if (list == null || !list.Any()) return;
var hospitalIds = list.Select(t => t.HospitalId).Distinct().OrderBy(t => t);
foreach (var hospitalId in hospitalIds)
{
var allots = list.Where(w => w.HospitalId == hospitalId)?.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
if (allots == null || !allots.Any()) continue;
while (allots != null && allots.Any(w => w.IsModifyConfig == 0))
{
var prevAllot = allots.FirstOrDefault(t => t.IsModifyConfig == 1);
if (prevAllot == null) continue;
var date = ConvertHelper.To<DateTime>($"{prevAllot.Year}-{prevAllot.Month}");
var needSyncData = allots.Where(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") > date);
if (needSyncData != null && needSyncData.Any())
{
foreach (var item in needSyncData)
configService.CopyCommand(item, prevAllot.ID, true);
}
var noModify = allots.FirstOrDefault(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") < date && w.IsModifyConfig == 0);
if (noModify != null)
date = ConvertHelper.To<DateTime>($"{noModify.Year}-{noModify.Month}");
allots = allots.Where(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") <= date)?.ToList();
}
}
logger.LogInformation("同步配置结束");
}
catch (Exception ex)
{
logger.LogError($"同步配置发生异常:" + ex);
}
}
}
}
using FluentScheduler; using FluentScheduler;
using System;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using System;
using Microsoft.Extensions.Caching.Memory;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Performance.Repository;
using Performance.DtoModels;
using Performance.Services;
namespace Performance.Api namespace Performance.Api
{ {
...@@ -21,6 +13,8 @@ public JobRegistry(IServiceProvider provider) ...@@ -21,6 +13,8 @@ public JobRegistry(IServiceProvider provider)
Schedule(() => provider.GetService<ExtractGenerateJob>()).ToRunEvery(1).Days().At(23, 00); Schedule(() => provider.GetService<ExtractGenerateJob>()).ToRunEvery(1).Days().At(23, 00);
//Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(60).Seconds(); //Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(60).Seconds();
Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(1).Days().At(3, 00); Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(1).Days().At(3, 00);
Schedule(() => provider.GetService<BackgroundJob>()).ToRunNow().AndEvery(10).Seconds();
Schedule(() => provider.GetService<AutoSyncConfigJob>()).ToRunEvery(1).Days().At(0, 00);
} }
} }
} }
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
<Content Update="wwwroot\Performance.Api.xml"> <Content Update="wwwroot\Performance.Api.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\Performance.DtoModels.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\Performance.EntityModels.xml"> <Content Update="wwwroot\Performance.EntityModels.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
......
...@@ -4,13 +4,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121. ...@@ -4,13 +4,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<DeleteExistingFiles>True</DeleteExistingFiles> <DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data> <ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform> <LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider> <PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\publish\jx.suvalue.com2</PublishUrl> <PublishUrl>D:\publish\jx</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod> <WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish /> <SiteUrlToLaunchAfterPublish />
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
......
...@@ -102,6 +102,8 @@ public void ConfigureServices(IServiceCollection services) ...@@ -102,6 +102,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddTransient<ExtractGenerateJob>(); services.AddTransient<ExtractGenerateJob>();
services.AddTransient<ExtractDataJob>(); services.AddTransient<ExtractDataJob>();
services.AddTransient<ClearLoggerJob>(); services.AddTransient<ClearLoggerJob>();
services.AddTransient<BackgroundJob>();
services.AddTransient<AutoSyncConfigJob>();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Debug", "Default": "Information",
"System": "Information", "System": "Information",
"Microsoft": "Information" "Microsoft": "Warning"
} }
}, },
"AppConnection": { "AppConnection": {
"PerformanceConnectionString": "server=192.168.18.166;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=192.168.18.166;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;"
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
}, },
"Application": { "Application": {
//登录过期时间 //登录过期时间
......
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Debug", "Default": "Information",
"System": "Information", "System": "Information"
"Microsoft": "Information"
} }
}, },
"AppConnection": { "AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", //"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_performance_screen;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=192.168.18.166;database=db_performance_screen;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;"
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
}, },
"Application": { "Application": {
//登录过期时间 //登录过期时间
......
...@@ -6,22 +6,7 @@ ...@@ -6,22 +6,7 @@
}, },
//连接字符串 //连接字符串
"AppConnection": { "AppConnection": {
"PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=suvalue;pwd=suvalue2017;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=suvalue;pwd=suvalue2017;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;"
"HangfireConnectionString": "server=116.62.245.55;database=db_hangfire;uid=suvalue;pwd=suvalue2017;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultdatabase=2"
},
//互亿
"HuyiSmsConfig": {
"Url": "http://106.ihuyi.cn/webservice/sms.php?method=Submit",
"Account": "cf_szjk",
"Password": "123456"
},
//阿里邮箱
"EmailOptions": {
"SmtpServer": "smtpdm.aliyun.com",
"Account": "service@email.suvalue.com",
"Password": "SuValue123456",
"IsEnable": false
}, },
"Application": { "Application": {
//登录过期时间 //登录过期时间
...@@ -51,5 +36,16 @@ ...@@ -51,5 +36,16 @@
"ImportFile": "http://localhost:5001/api/", "ImportFile": "http://localhost:5001/api/",
// 抽取uri // 抽取uri
"HttpPost": "http://localhost:50997/api/" "HttpPost": "http://localhost:50997/api/"
},
"RateLimitingConfig": {
"Endpoints": [
"/api/second/savevalue",
"/api/second/savedata",
"/api/second/other/save",
"/api/second/redistribution/save",
"/api/second/redistribution/submit"
],
"Period": "1", // 单位为秒
"Limit": 1
} }
} }
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
layout="日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}==============================================================${newline}" /> layout="日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}==============================================================${newline}" />
<!-- another file log, only own logs. Uses some ASP.NET core renderers --> <!-- another file log, only own logs. Uses some ASP.NET core renderers -->
<target xsi:type="File" name="ownFile-web" fileName="${basedir}/Logs/${shortdate}/${level}.log" <!--<target xsi:type="File" name="ownFile-web" fileName="${basedir}/Logs/${shortdate}/${level}.log"
layout="日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}url: ${aspnet-request-url}${newline}action: ${aspnet-mvc-action}${newline}==============================================================${newline}" /> layout="日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}url: ${aspnet-request-url}${newline}action: ${aspnet-mvc-action}${newline}==============================================================${newline}" />-->
<!-- write log to mongodb--> <!-- write log to mongodb-->
<!--<target xsi:type="Mongo" <!--<target xsi:type="Mongo"
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
<logger name="*" minlevel="Trace" writeTo="allfile" /> <logger name="*" minlevel="Trace" writeTo="allfile" />
<!--Skip non-critical Microsoft logs and so log only own logs--> <!--Skip non-critical Microsoft logs and so log only own logs-->
<logger name="Microsoft.*" maxLevel="Info" final="true" /> <!--<logger name="Microsoft.*" maxLevel="Info" final="true" />-->
<!-- BlackHole without writeTo --> <!-- BlackHole without writeTo -->
<logger name="*" minlevel="Trace" writeTo="ownFile-web" /> <!--<logger name="*" minlevel="Trace" writeTo="ownFile-web" />-->
<!--Add logs to mongodb--> <!--Add logs to mongodb-->
<!--<logger name="*" minlevel="Trace" writeTo="mongo"/>--> <!--<logger name="*" minlevel="Trace" writeTo="mongo"/>-->
......
UvHeSCNjMucE7mxfpB2wK1XQVSrGyXzxtRzclDPX+IoTYesKy64t4LEB4RpXEkF6lr8f9+GFSX0FPokmRGOzmP/Z+1kYdcu1FnA6DKI5izIe8BmL4GrGzyJYfxrPju8UzHiMexCHBxwzg7KrASjQBuzGS8UDvmOM5+ycZgar3h9zuG//kS9am2+a6BnWYk0iEOH7PGqo/QUOzN7hiSTF6y+Bl0ZmwdFy88sfBDccL9oZ4IbiM1I/zZjC1E4f6A97Tdr6h+BJ7e6kClrbk7TbOGMYKi5JY3CKCmVtCEUSvNriiHlazneLYYIDLFtjpor/9xfG+EDjrPANGtijoNi4YQ== l4vo44Pp0mWIrTObcc2fo3aLq2gq2AFd553jQa5BciBcGR0R+L6ubgnGQBbtx7JxTs+kzGnurRVqKQst0ZoIFaXt9P2RXRnhdXAcqrkLr3wZTpO6yD2dZlAKcj6TwIKqoS6klzc/QECX1kOZNVxc7D476x03JP0Uszx/hVfQDlZBHPL+VO6dC1a2Y+izo3Ofys8W+KaIYE8SJdyDgd0a0GPaTNxwxT9tkVSXWG6/7vxc5UCytdhgJzhUf7q3XCnt3AddW6buWdUcPLIY5Hyr1P1GNCS0dbUBwYT1rwjRSMBeTxLFJHuJFl2vLeW0kVCn1LmQlp9qLkZ0O73m2RNuig==
\ No newline at end of file \ No newline at end of file
...@@ -914,11 +914,6 @@ ...@@ -914,11 +914,6 @@
人员工号 人员工号
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.PerData.Annotation">
<summary>
单元格注释
</summary>
</member>
<member name="P:Performance.DtoModels.PerData.Remark"> <member name="P:Performance.DtoModels.PerData.Remark">
<summary> <summary>
单元格备注 单元格备注
......
...@@ -1595,6 +1595,16 @@ ...@@ -1595,6 +1595,16 @@
排序 排序
</summary> </summary>
</member> </member>
<member name="T:Performance.EntityModels.bg_task">
<summary>
考核类别
</summary>
</member>
<member name="P:Performance.EntityModels.bg_task.ID">
<summary>
</summary>
</member>
<member name="T:Performance.EntityModels.cof_accounting"> <member name="T:Performance.EntityModels.cof_accounting">
<summary> <summary>
...@@ -1620,6 +1630,21 @@ ...@@ -1620,6 +1630,21 @@
核算单元 核算单元
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.cof_accounting.Code">
<summary>
核算单元编码
</summary>
</member>
<member name="P:Performance.EntityModels.cof_accounting.IsVerify">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_accounting.VerifyMessage">
<summary>
</summary>
</member>
<member name="T:Performance.EntityModels.cof_again"> <member name="T:Performance.EntityModels.cof_again">
<summary> <summary>
...@@ -1700,6 +1725,11 @@ ...@@ -1700,6 +1725,11 @@
状态 1 求和 0 不求和 状态 1 求和 0 不求和
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.cof_alias.Sort">
<summary>
排序
</summary>
</member>
<member name="T:Performance.EntityModels.cof_check"> <member name="T:Performance.EntityModels.cof_check">
<summary> <summary>
上传excel文件校验配置 上传excel文件校验配置
...@@ -3634,6 +3664,11 @@ ...@@ -3634,6 +3664,11 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ex_script.Name">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ex_script.ExecScript"> <member name="P:Performance.EntityModels.ex_script.ExecScript">
<summary> <summary>
执行sql 执行sql
...@@ -3654,6 +3689,21 @@ ...@@ -3654,6 +3689,21 @@
是否可用 1 可用 2 不可用 是否可用 1 可用 2 不可用
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ex_script.IsExecSuccess">
<summary>
是否执行通过 0 未执行 1 通过 2 失败
</summary>
</member>
<member name="P:Performance.EntityModels.ex_script.Description">
<summary>
执行错误信息
</summary>
</member>
<member name="P:Performance.EntityModels.ex_script.TimeConsuming">
<summary>
语句执行完成所需时间
</summary>
</member>
<member name="T:Performance.EntityModels.ex_special"> <member name="T:Performance.EntityModels.ex_special">
<summary> <summary>
...@@ -5905,6 +5955,11 @@ ...@@ -5905,6 +5955,11 @@
自定义提取绩效数据文件生成路径 自定义提取绩效数据文件生成路径
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_allot.IsModifyConfig">
<summary>
是否修改过配置 1修改过 0未修改
</summary>
</member>
<member name="T:Performance.EntityModels.per_apr_amount"> <member name="T:Performance.EntityModels.per_apr_amount">
<summary> <summary>
...@@ -8320,14 +8375,14 @@ ...@@ -8320,14 +8375,14 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.sys_hospitalconfig.Type"> <member name="P:Performance.EntityModels.sys_hospitalconfig.DataBaseType">
<summary> <summary>
1 标准库 2 绩效库 1、Sql Server 2、Orcale
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.sys_hospitalconfig.DataBaseType"> <member name="P:Performance.EntityModels.sys_hospitalconfig.IsConnectioned">
<summary> <summary>
1、Sql Server 2、Orcale
</summary> </summary>
</member> </member>
<member name="T:Performance.EntityModels.sys_menu"> <member name="T:Performance.EntityModels.sys_menu">
...@@ -8635,6 +8690,11 @@ ...@@ -8635,6 +8690,11 @@
</summary> </summary>
</member> </member>
<member name="T:Performance.EntityModels.sys_version">
<summary>
sys_version
</summary>
</member>
<member name="T:Performance.EntityModels.view_dic_category_factor"> <member name="T:Performance.EntityModels.view_dic_category_factor">
<summary> <summary>
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
using Performance.DtoModels.Request; using Performance.DtoModels.Request;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
namespace Performance.DtoModels.AutoMapper namespace Performance.DtoModels.AutoMapper
{ {
...@@ -255,8 +252,27 @@ public AutoMapperConfigs() ...@@ -255,8 +252,27 @@ public AutoMapperConfigs()
CreateMap<ex_result, ex_result_gather>() CreateMap<ex_result, ex_result_gather>()
.ReverseMap(); .ReverseMap();
CreateMap<ex_type, ExtractConfigResponse>()
.ForMember(dest => dest.TypeId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.EName));
CreateMap<ExtractConfigResponse, ex_type>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.TypeId));
CreateMap<ex_script, ExtractConfigResponse>()
.ForMember(dest => dest.ExScriptId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Name));
CreateMap<ExtractConfigResponse, ex_script>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.ExScriptId));
CreateMap<cof_workitem, WorkItemRequest>() CreateMap<cof_workitem, WorkItemRequest>()
.ReverseMap(); .ReverseMap();
CreateMap<cof_again,CofAgainRequest>().ReverseMap();
} }
} }
} }
...@@ -132,6 +132,37 @@ public enum Role ...@@ -132,6 +132,37 @@ public enum Role
特殊科室 = 9, 特殊科室 = 9,
行政科室 = 10, 行政科室 = 10,
数据收集 = 11, 数据收集 = 11,
绩效查询 = 12, 护理部审核 = 12,
绩效查询 = 13,
}
public class Background
{
public enum JobType
{
生成测算表 = 1,
提取数据 = 2,
报表 = 3,
自定义抽取 = 4,
}
public enum Status
{
等待 = 1,
执行中 = 2,
完成 = 3,
失败 = 10,
无效 = 88,
超时 = 99,
}
}
public class SecondAllot
{
public enum Status
{
未提交 = 1,
等待审核 = 2,
审核通过 = 3,
驳回 = 4,
}
} }
} }
...@@ -30,10 +30,10 @@ public class PerData : IPerData ...@@ -30,10 +30,10 @@ public class PerData : IPerData
/// 人员工号 /// 人员工号
/// </summary> /// </summary>
public string JobNumber { get; set; } public string JobNumber { get; set; }
/// <summary> ///// <summary>
/// 单元格注释 ///// 单元格注释
/// </summary> ///// </summary>
public string Annotation { get; set; } //public string Annotation { get; set; }
/// <summary> /// <summary>
/// 单元格备注 /// 单元格备注
/// </summary> /// </summary>
......
...@@ -54,6 +54,19 @@ public class ComputerAliasRequest ...@@ -54,6 +54,19 @@ public class ComputerAliasRequest
public string[] Heads { get; set; } public string[] Heads { get; set; }
} }
public class ComputerAliasUpdate
{
public int HospitalId { get; set; }
public string Route { get; set; }
public List<ComputerAliasHead> computerAliasHead { get; set; }
}
public class ComputerAliasHead
{
public string Head { get; set; }
public int HeadId { get; set; }
public int Sort { get; set; }
}
public class BeginEndTime public class BeginEndTime
{ {
public string BeginTime { get; set; } // 2021-01 public string BeginTime { get; set; } // 2021-01
......
using System;
namespace Performance.DtoModels
{
public class ConsumeTimeRequest
{
public int Year { get; set; } = DateTime.Now.Year;
public int Month { get; set; } = DateTime.Now.Month;
public int ExScriptId { get; set; }
public int ConfigId { get; set; }
public string ExecScript { get; set; }
}
}
using System.Collections.Generic;
namespace Performance.DtoModels
{
public class ExtractConfigResponse
{
#region Public
public string Title { get; set; }
public int Value { get; set; }
#endregion
#region Type
public int TypeId { get; set; }
public string EName { get; set; }
public int Source { get; set; }
public string Description { get; set; }
public decimal TimeConsuming { get; set; }
#endregion
#region Script
public int ExScriptId { get; set; }
public string Name { get; set; }
public string ExecScript { get; set; }
public int ConfigId { get; set; }
public string ConfigName { get; set; }
public int IsExecSuccess { get; set; }
public int IsEnable { get; set; }
#endregion
public List<ExtractConfigResponse> Children { get; set; } = new List<ExtractConfigResponse>();
}
}
...@@ -74,7 +74,7 @@ public object CellValue ...@@ -74,7 +74,7 @@ public object CellValue
{ {
get get
{ {
var value = ConvertHelper.To<decimal?>(cellValue); var value = ConvertHelper.ToDecimalOrNull(cellValue);
if (value.HasValue && value.Value > 0) if (value.HasValue && value.Value > 0)
return Math.Round(value.Value, 2); return Math.Round(value.Value, 2);
return cellValue; return cellValue;
......
...@@ -15,6 +15,8 @@ public enum ResponseType ...@@ -15,6 +15,8 @@ public enum ResponseType
Disable = 7, Disable = 7,
TooManyRequests = 8, TooManyRequests = 8,
Warning = 9, Warning = 9,
WarningTable = 10,
Expiration = 99, Expiration = 99,
} }
} }
...@@ -57,6 +57,7 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options) ...@@ -57,6 +57,7 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<as_tempassess> as_tempassess { get; set; } public virtual DbSet<as_tempassess> as_tempassess { get; set; }
/// <summary> 考核列头 </summary> /// <summary> 考核列头 </summary>
public virtual DbSet<as_tempcolumns> as_tempcolumns { get; set; } public virtual DbSet<as_tempcolumns> as_tempcolumns { get; set; }
public virtual DbSet<bg_task> bg_task { get; set; }
/// <summary> </summary> /// <summary> </summary>
public virtual DbSet<cof_accounting> cof_accounting { get; set; } public virtual DbSet<cof_accounting> cof_accounting { get; set; }
/// <summary> </summary> /// <summary> </summary>
...@@ -243,5 +244,6 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options) ...@@ -243,5 +244,6 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<sys_user_hospital> sys_user_hospital { get; set; } public virtual DbSet<sys_user_hospital> sys_user_hospital { get; set; }
/// <summary> 用户角色关联表 </summary> /// <summary> 用户角色关联表 </summary>
public virtual DbSet<sys_user_role> sys_user_role { get; set; } public virtual DbSet<sys_user_role> sys_user_role { get; set; }
public virtual DbSet<sys_version> sys_version { get; set; }
} }
} }
//-----------------------------------------------------------------------
// <copyright file=" bg_task.cs">
// * FileName: bg_task.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 考核类别
/// </summary>
[Table("bg_task")]
public class bg_task
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
public string Name { get; set; }
public int JobType { get; set; }
public DateTime CreateTime { get; set; }
public DateTime? BeginTime { get; set; }
public DateTime? EndTime { get; set; }
public int Status { get; set; }
public string Argument { get; set; }
public string Remark { get; set; }
public double ElapsedTime { get; set; }
}
}
...@@ -34,5 +34,20 @@ public class cof_accounting ...@@ -34,5 +34,20 @@ public class cof_accounting
/// 核算单元 /// 核算单元
/// </summary> /// </summary>
public string AccountingUnit { get; set; } public string AccountingUnit { get; set; }
/// <summary>
/// 核算单元编码
/// </summary>
public string Code { get; set; }
/// <summary>
///
/// </summary>
public int IsVerify { get; set; }
/// <summary>
///
/// </summary>
public string VerifyMessage { get; set; }
} }
} }
...@@ -49,10 +49,16 @@ public class cof_alias ...@@ -49,10 +49,16 @@ public class cof_alias
/// <summary> /// <summary>
/// 状态 1 可用 0 禁用 /// 状态 1 可用 0 禁用
/// </summary> /// </summary>
public Nullable<int> States { get; set; } public int States { get; set; }
/// <summary> /// <summary>
/// 状态 1 求和 0 不求和 /// 状态 1 求和 0 不求和
/// </summary> /// </summary>
public Nullable<int> SumStatus { get; set; } public int SumStatus { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }
...@@ -76,9 +76,9 @@ public class ex_result ...@@ -76,9 +76,9 @@ public class ex_result
/// </summary> /// </summary>
public Nullable<DateTime> CreateTime { get; set; } public Nullable<DateTime> CreateTime { get; set; }
/// <summary> // /// <summary>
/// 1 删除 0 未删除 // /// 1 删除 0 未删除
/// </summary> // /// </summary>
// public int IsDelete { get; set; } public int IsDelete { get; set; }
} }
} }
...@@ -46,9 +46,9 @@ public class ex_result_gather ...@@ -46,9 +46,9 @@ public class ex_result_gather
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary> // /// <summary>
/// 1 未通过 2 通过 // /// 1 未通过 2 通过
/// </summary> // /// </summary>
// public int States { get; set; } // public int States { get; set; }
} }
} }
...@@ -21,6 +21,11 @@ public class ex_script ...@@ -21,6 +21,11 @@ public class ex_script
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
///
/// </summary>
public string Name { get; set; }
/// <summary>
/// 执行sql /// 执行sql
/// </summary> /// </summary>
public string ExecScript { get; set; } public string ExecScript { get; set; }
...@@ -39,5 +44,20 @@ public class ex_script ...@@ -39,5 +44,20 @@ public class ex_script
/// 是否可用 1 可用 2 不可用 /// 是否可用 1 可用 2 不可用
/// </summary> /// </summary>
public int IsEnable { get; set; } public int IsEnable { get; set; }
/// <summary>
/// 是否执行通过 0 未执行 1 通过 2 失败
/// </summary>
public int IsExecSuccess { get; set; }
/// <summary>
/// 执行错误信息
/// </summary>
public string Description { get; set; }
/// <summary>
/// 语句执行完成所需时间
/// </summary>
public decimal TimeConsuming { get; set; } = 0;
} }
} }
...@@ -100,5 +100,10 @@ public class per_allot ...@@ -100,5 +100,10 @@ public class per_allot
/// 自定义提取绩效数据文件生成路径 /// 自定义提取绩效数据文件生成路径
/// </summary> /// </summary>
public string CustomExtractPath { get; set; } public string CustomExtractPath { get; set; }
/// <summary>
/// 是否修改过配置 1修改过 0未修改
/// </summary>
public int IsModifyConfig { get; set; }
} }
} }
...@@ -24,7 +24,7 @@ public class sys_hospitalconfig ...@@ -24,7 +24,7 @@ public class sys_hospitalconfig
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<int> HospitalId { get; set; } public int HospitalId { get; set; }
/// <summary> /// <summary>
/// ///
...@@ -52,13 +52,13 @@ public class sys_hospitalconfig ...@@ -52,13 +52,13 @@ public class sys_hospitalconfig
public string DbPassword { get; set; } public string DbPassword { get; set; }
/// <summary> /// <summary>
/// 1 标准库 2 绩效库 /// 1、Sql Server 2、Orcale
/// </summary> /// </summary>
public Nullable<int> Type { get; set; } public int DataBaseType { get; set; }
/// <summary> /// <summary>
/// 1、Sql Server 2、Orcale ///
/// </summary> /// </summary>
public int DataBaseType { get; set; } public bool IsConnectioned { get; set; }
} }
} }
//-----------------------------------------------------------------------
// <copyright file=" sys_version.cs">
// * FileName: sys_version.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// sys_version
/// </summary>
[Table("sys_version")]
public class sys_version
{
[Key]
public int Id { get; set; }
public string VersionCode { get; set; }
public DateTime PublishTime { get; set; }
public string Content { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Performance.EntityModels.Other
{
public class ColumnEntity
{
public string Name { get; set; }
public string Comment { get; set; }
}
}
...@@ -4,25 +4,26 @@ public class view_allot_sign_dept ...@@ -4,25 +4,26 @@ public class view_allot_sign_dept
{ {
public int HospitalId { get; set; } public int HospitalId { get; set; }
public int AllotID { get; set; } public int AllotID { get; set; }
public int Year { get; set; } public string Year { get; set; }
public int Month { get; set; } public string Month { get; set; }
public int UnitType { get; set; } public string Code { get; set; }
public int AccountingUnit { get; set; } public string UnitType { get; set; }
public int PerforFee { get; set; } public string AccountingUnit { get; set; }
public int WorkloadFee { get; set; } public decimal PerforFee { get; set; }
public int AssessBeforeOtherFee { get; set; } public decimal WorkloadFee { get; set; }
public int PerforTotal { get; set; } public decimal AssessBeforeOtherFee { get; set; }
public int ScoringAverage { get; set; } public decimal PerforTotal { get; set; }
public int Extra { get; set; } public decimal ScoringAverage { get; set; }
public int MedicineExtra { get; set; } public decimal Extra { get; set; }
public int MaterialsExtra { get; set; } public decimal MedicineExtra { get; set; }
public int AssessLaterOtherFee { get; set; } public decimal MaterialsExtra { get; set; }
public int AssessLaterPerforTotal { get; set; } public decimal AssessLaterOtherFee { get; set; }
public int AdjustFactor { get; set; } public decimal AssessLaterPerforTotal { get; set; }
public int AdjustLaterOtherFee { get; set; } public decimal AdjustFactor { get; set; }
public int AprPerforAmount { get; set; } public decimal AdjustLaterOtherFee { get; set; }
public int HideAprOtherPerforAmount { get; set; } public decimal AprPerforAmount { get; set; }
public int AssessLaterManagementFee { get; set; } public decimal HideAprOtherPerforAmount { get; set; }
public int RealGiveFee { get; set; } public decimal AssessLaterManagementFee { get; set; }
public decimal RealGiveFee { get; set; }
} }
} }
namespace Performance.DtoModels namespace Performance.DtoModels
{ {
public class view_allot_sign_emp public class view_allot_sign_emp_finance
{ {
public int HospitalID { get; set; } public string HospitalID { get; set; }
public int Year { get; set; } public string Year { get; set; }
public int Month { get; set; } public string Month { get; set; }
public int Source { get; set; } public string AllotId { get; set; }
public int AllotId { get; set; }
public int SecondId { get; set; }
public int States { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public string IsShowManage { get; set; }
public string EmployeeName { get; set; }
public string JobNumber { get; set; } public string JobNumber { get; set; }
public string EmployeeName { get; set; }
public string JobTitle { get; set; } public string JobTitle { get; set; }
public string Emp_UnitType { get; set; } public string Code { get; set; }
public string Emp_AccountingUnit { get; set; } public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public string BankCard { get; set; } public string BankCard { get; set; }
public string Batch { get; set; }
public string JobCategory { get; set; } public string JobCategory { get; set; }
public string Duty { get; set; } public string Duty { get; set; }
public string TitlePosition { get; set; } public string TitlePosition { get; set; }
public string PerforSumFee { get; set; } public decimal PerforSumFee { get; set; }
public decimal PerforManagementFee { get; set; } public decimal PerforManagementFee { get; set; }
public decimal NightWorkPerfor { get; set; } public decimal NightWorkPerfor { get; set; }
public decimal AdjustLaterOtherFee { get; set; } public decimal AdjustLaterOtherFee { get; set; }
...@@ -32,4 +26,15 @@ public class view_allot_sign_emp ...@@ -32,4 +26,15 @@ public class view_allot_sign_emp
public decimal ReservedRatioFee { get; set; } public decimal ReservedRatioFee { get; set; }
public decimal RealGiveFee { get; set; } public decimal RealGiveFee { get; set; }
} }
public class view_allot_sign_emp : view_allot_sign_emp_finance
{
public int Source { get; set; }
public int SecondId { get; set; }
public int States { get; set; }
public string IsShowManage { get; set; }
public string Emp_UnitType { get; set; }
public string Emp_AccountingUnit { get; set; }
public string Batch { get; set; }
}
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Infrastructure
{
public static partial class UtilExtensions
{
/// <summary>
/// 时间戳计时开始时间
/// </summary>
private static DateTime timeStampStartTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// DateTime转换为10位时间戳(单位:秒)
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static long ToTimeStamp(this DateTime dateTime)
{
return (long)(dateTime.ToUniversalTime() - timeStampStartTime).TotalSeconds;
}
/// <summary>
/// DateTime转换为13位时间戳(单位:毫秒)
/// </summary>
/// <param name="dateTime"> DateTime</param>
/// <returns>13位时间戳(单位:毫秒)</returns>
public static long ToLongTimeStamp(this DateTime dateTime)
{
return (long)(dateTime.ToUniversalTime() - timeStampStartTime).TotalMilliseconds;
}
/// <summary>
/// 10位时间戳(单位:秒)转换为DateTime
/// </summary>
/// <param name="timeStamp">10位时间戳(单位:秒)</param>
/// <returns>DateTime</returns>
public static DateTime ToDateTime(this long timeStamp)
{
return timeStampStartTime.AddSeconds(timeStamp).ToLocalTime();
}
/// <summary>
/// 13位时间戳(单位:毫秒)转换为DateTime
/// </summary>
/// <param name="longTimeStamp">13位时间戳(单位:毫秒)</param>
/// <returns>DateTime</returns>
public static DateTime ToDateTimeLongTimeStamp(this long longTimeStamp)
{
return timeStampStartTime.AddMilliseconds(longTimeStamp).ToLocalTime();
}
}
}
...@@ -30,6 +30,23 @@ public static decimal TryDecimal(string inValue, decimal defaultValue = default( ...@@ -30,6 +30,23 @@ public static decimal TryDecimal(string inValue, decimal defaultValue = default(
return ret; return ret;
} }
/// <summary>
/// 转换为128位可空浮点型,并按指定小数位舍入
/// </summary>
/// <param name="input">输入值</param>
/// <param name="digits">小数位数</param>
public static decimal? ToDecimalOrNull(object input)
{
try
{
return decimal.TryParse(input?.ToString(), out decimal tmpvalue) ? tmpvalue : null;
}
catch (Exception ex)
{
throw;
}
}
public static DateTime TryDateTime(string inValue, DateTime defaultValue = default(DateTime)) public static DateTime TryDateTime(string inValue, DateTime defaultValue = default(DateTime))
{ {
DateTime ret = defaultValue; DateTime ret = defaultValue;
...@@ -46,23 +63,28 @@ public static DateTime TryDateTime(string inValue, DateTime defaultValue = defau ...@@ -46,23 +63,28 @@ public static DateTime TryDateTime(string inValue, DateTime defaultValue = defau
/// <returns></returns> /// <returns></returns>
public static T To<T>(object value, T defaultValue = default(T)) public static T To<T>(object value, T defaultValue = default(T))
{ {
try if (value == null)
{ return defaultValue;
var t = typeof(T); if (value is string && string.IsNullOrWhiteSpace(value.ToString()))
//兼容可空类型转换 return defaultValue;
if (t.IsGenericType && t.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
{
if (value == null)
{
return default(T);
}
t = Nullable.GetUnderlyingType(t); var t = typeof(T);
} var type = Nullable.GetUnderlyingType(t) ?? t;
return (T)Convert.ChangeType(value, t); var typeName = type.Name.ToLower();
try
{
if (typeName == "string")
return (T)(object)value.ToString();
if (typeName == "guid")
return (T)(object)new Guid(value.ToString());
if (type.IsEnum)
return (T)Enum.Parse(type, value.ToString());
if (value is IConvertible)
return (T)Convert.ChangeType(value, type);
return (T)value;
} }
catch catch (Exception ex)
{ {
return defaultValue; return defaultValue;
} }
......
...@@ -483,6 +483,8 @@ public static string FileToString(string filePath, Encoding encoding) ...@@ -483,6 +483,8 @@ public static string FileToString(string filePath, Encoding encoding)
/// <param name="filePath">文件的绝对路径</param> /// <param name="filePath">文件的绝对路径</param>
public static string GetFileName(string filePath) public static string GetFileName(string filePath)
{ {
if (string.IsNullOrEmpty(filePath))
return string.Empty;
//获取文件的名称 //获取文件的名称
FileInfo fi = new FileInfo(filePath); FileInfo fi = new FileInfo(filePath);
return fi.Name; return fi.Name;
......
using Performance.EntityModels; using Performance.EntityModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -42,5 +43,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId) ...@@ -42,5 +43,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId)
return new List<view_second_compute_collect>(); return new List<view_second_compute_collect>();
} }
public int Submit(int secondId, int tempId, decimal realGiveFee, int submitType, string remark = "")
{
string sql = "UPDATE ag_secondallot SET UseTempId = @tempId,NursingDeptStatus = @status, Status = @status, SubmitType = @submitType,SubmitTime = @date, Remark = @remark WHERE Id = @secondId AND RealGiveFee = @fee";
return Execute(sql, new { secondId, tempId, status = 2, date = DateTime.Now, fee = realGiveFee, submitType, remark });
}
} }
} }
using Microsoft.EntityFrameworkCore;
using Performance.EntityModels;
using Performance.Infrastructure.Models;
using System.Linq;
namespace Performance.Repository
{
public partial class PerforExtypeRepository
{
public PageList<ex_type> GetPagingData(int hospitalId, int? sheetType, string search, int pageNumber, int pageSize)
{
var query = _context.ex_type.AsNoTracking().Where(w => w.HospitalId == hospitalId);
if (sheetType.HasValue && sheetType.Value > 0)
{
query = query.Where(w => w.Source == sheetType);
}
if (!string.IsNullOrEmpty(search))
{
query = query.Where(w => w.EName.Contains(search));
}
return PageList<ex_type>.Create(query, pageNumber, pageSize);
}
}
}
...@@ -62,7 +62,7 @@ public new PageList<per_employee> GetEntitiesForPaging(int pageNumber, int pageS ...@@ -62,7 +62,7 @@ public new PageList<per_employee> GetEntitiesForPaging(int pageNumber, int pageS
/// <returns></returns> /// <returns></returns>
public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(ComparisonPagingRequest request) public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(ComparisonPagingRequest request)
{ {
var queryData = @" var queryData = $@"
SELECT SELECT
HospitalId,Year,Month,AllotID,UnitType,AccountingUnit,JobNumber,MAX(EmployeeName) AS EmployeeName, HospitalId,Year,Month,AllotID,UnitType,AccountingUnit,JobNumber,MAX(EmployeeName) AS EmployeeName,
SUM(RealGiveFeeExecl) AS RealGiveFeeExecl,SUM(RealGiveFeeCompute) AS RealGiveFeeCompute,SUM(RealGiveFeeExecl) - SUM(RealGiveFeeCompute) AS Diff SUM(RealGiveFeeExecl) AS RealGiveFeeExecl,SUM(RealGiveFeeCompute) AS RealGiveFeeCompute,SUM(RealGiveFeeExecl) - SUM(RealGiveFeeCompute) AS Diff
...@@ -73,7 +73,7 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari ...@@ -73,7 +73,7 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari
) TAB ) TAB
WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm OR if(@searchQuery='','',JobNumber) LIKE @parm OR if(@searchQuery='','',EmployeeName) LIKE @parm WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm OR if(@searchQuery='','',JobNumber) LIKE @parm OR if(@searchQuery='','',EmployeeName) LIKE @parm
GROUP BY HospitalId,Year,Month,AllotID,UnitType,AccountingUnit,JobNumber GROUP BY HospitalId,Year,Month,AllotID,UnitType,AccountingUnit,JobNumber
ORDER BY HospitalId,Year,Month,ABS(SUM(RealGiveFeeExecl) - SUM(RealGiveFeeCompute)) DESC LIMIT @pageSize OFFSET @pageIndex ORDER BY HospitalId,Year,Month,ABS(SUM(RealGiveFeeExecl) - SUM(RealGiveFeeCompute)) DESC LIMIT {(request.PageIndex-1) * request.PageSize},{request.PageSize}
"; ";
var queryCount = @" var queryCount = @"
...@@ -86,7 +86,7 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari ...@@ -86,7 +86,7 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari
"; ";
return new DtoModels.Comparison<view_check_emp>() return new DtoModels.Comparison<view_check_emp>()
{ {
Datas = DapperQuery<view_check_emp>(queryData, new { pageIndex = request.PageIndex-1, pageSize = request.PageSize, allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.ToList() ?? new List<view_check_emp>(), Datas = DapperQuery<view_check_emp>(queryData, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.ToList() ?? new List<view_check_emp>(),
TotalCount = DapperQuery<int>(queryCount, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.FirstOrDefault() ?? 0, TotalCount = DapperQuery<int>(queryCount, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.FirstOrDefault() ?? 0,
}; };
} }
...@@ -96,13 +96,13 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari ...@@ -96,13 +96,13 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari
/// </summary> /// </summary>
public DtoModels.Comparison<view_check_emp> CheckAccountingUnitRealGiveFeeDiff(ComparisonPagingRequest request) public DtoModels.Comparison<view_check_emp> CheckAccountingUnitRealGiveFeeDiff(ComparisonPagingRequest request)
{ {
var queryData = @" var queryData = $@"
SELECT *,IFNULL(RealGiveFeeExecl,0) - IFNULL(RealGiveFeeCompute,0) AS Diff FROM ( SELECT *,IFNULL(RealGiveFeeExecl,0) - IFNULL(RealGiveFeeCompute,0) AS Diff FROM (
SELECT * FROM view_check_dept_account WHERE AllotId = @allotId UNION ALL SELECT * FROM view_check_dept_account WHERE AllotId = @allotId UNION ALL
SELECT * FROM view_check_dept_specialunit WHERE AllotId = @allotId SELECT * FROM view_check_dept_specialunit WHERE AllotId = @allotId
) TAB ) TAB
WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm
ORDER BY HospitalId,Year,Month,ABS(DIFF) DESC LIMIT @pageSize OFFSET @pageIndex ORDER BY HospitalId,Year,Month,ABS(DIFF) DESC LIMIT {(request.PageIndex-1) * request.PageSize},{request.PageSize}
"; ";
var queryCount = @" var queryCount = @"
...@@ -114,7 +114,7 @@ public DtoModels.Comparison<view_check_emp> CheckAccountingUnitRealGiveFeeDiff(C ...@@ -114,7 +114,7 @@ public DtoModels.Comparison<view_check_emp> CheckAccountingUnitRealGiveFeeDiff(C
"; ";
return new DtoModels.Comparison<view_check_emp>() return new DtoModels.Comparison<view_check_emp>()
{ {
Datas = DapperQuery<view_check_emp>(queryData, new { pageIndex = request.PageIndex-1, pageSize = request.PageSize,allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.ToList() ?? new List<view_check_emp>(), Datas = DapperQuery<view_check_emp>(queryData, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.ToList() ?? new List<view_check_emp>(),
TotalCount = DapperQuery<int>(queryCount, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.FirstOrDefault() ?? 0, TotalCount = DapperQuery<int>(queryCount, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.FirstOrDefault() ?? 0,
}; };
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.EntityModels.Other;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
...@@ -417,7 +418,8 @@ public List<dynamic> QueryComputeByDate(string viewName, BeginEndTime request) ...@@ -417,7 +418,8 @@ public List<dynamic> QueryComputeByDate(string viewName, BeginEndTime request)
if (!string.IsNullOrEmpty(request.SortBy)) if (!string.IsNullOrEmpty(request.SortBy))
sql += $" order by {request.SortBy} "; sql += $" order by {request.SortBy} ";
else
sql += $" order by hospitalid,code,unittype,accountingunit";
return DapperQuery<dynamic>(sql, new { beginTime = request.BeginTime, endTime = request.EndTime }).ToList(); return DapperQuery<dynamic>(sql, new { beginTime = request.BeginTime, endTime = request.EndTime }).ToList();
} }
...@@ -431,16 +433,16 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu ...@@ -431,16 +433,16 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
Dictionary<string, List<string>> dict = new Dictionary<string, List<string>> Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>
{ {
{ "view_allot_sign_emp_group", new List<string>{ /* "year", "month", "allotid", "secondid",*/ "hospitalid", "source", "states", "unittype", "accountingunit", "isshowmanage", "employeename", "jobnumber", "jobtitle", "emp_unittype", "emp_accountingunit", "bankcard", "batch", "jobcategory", "duty", "titleposition" } }, { "view_allot_sign_emp_group", new List<string>{ "hospitalid", "code", "unittype", "accountingunit", "source", "jobnumber", "employeename", "jobtitle", "bankcard", "batch", "jobcategory", "duty", "titleposition" } },
{ "view_allot_sign_emp_sum", new List<string>{ "perforsumfee", "performanagementfee", "nightworkperfor", "adjustlaterotherfee", "otherperfor", "hideotherperfor", "shouldgivefee", "reservedratiofee", "realgivefee" } }, { "view_allot_sign_emp_sum", new List<string>{ "perforsumfee", "performanagementfee", "nightworkperfor", "adjustlaterotherfee", "otherperfor", "hideotherperfor", "shouldgivefee", "reservedratiofee", "realgivefee" } },
{ "view_allot_sign_dept_group", new List<string>{ "hospitalid",/* "allotid", "year", "month", */"unittype", "accountingunit" } }, { "view_allot_sign_dept_group", new List<string>{ "hospitalid", "code", "unittype", "accountingunit" } },
{ "view_allot_sign_dept_sum", new List<string>{ "perforfee", "workloadfee", "assessbeforeotherfee", "perfortotal", "scoringaverage", "extra", "medicineextra", "materialsextra", "assesslaterotherfee", "assesslaterperfortotal", "adjustfactor", "adjustlaterotherfee", "aprperforamount", "hideaprotherperforamount", "assesslatermanagementfee", "realgivefee" } }, { "view_allot_sign_dept_sum", new List<string>{ "perforfee", "workloadfee", "assessbeforeotherfee", "perfortotal", "scoringaverage", "extra", "medicineextra", "materialsextra", "assesslaterotherfee", "assesslaterperfortotal", "adjustfactor", "adjustlaterotherfee", "aprperforamount", "hideaprotherperforamount", "assesslatermanagementfee", "realgivefee" } },
{ "view_allot_sign_emp_finance_group", new List<string>{ "hospitalid",/* "year", "month", "allotid",*/ "jobnumber", "employeename", "jobtitle", "unittype", "accountingunit", "bankcard", "jobcategory", "duty", "titleposition" } }, { "view_allot_sign_emp_finance_group", new List<string>{ "hospitalid", "code", "unittype", "accountingunit","jobnumber", "employeename", } },
{ "view_allot_sign_emp_finance_sum", new List<string>{ "perforsumfee", "performanagementfee", "nightworkperfor", "adjustlaterotherfee", "otherperfor", "hideotherperfor", "shouldgivefee", "reservedratiofee", "realgivefee" } }, { "view_allot_sign_emp_finance_sum", new List<string>{ "perforsumfee", "performanagementfee", "nightworkperfor", "adjustlaterotherfee", "otherperfor", "hideotherperfor", "shouldgivefee", "reservedratiofee", "realgivefee" } },
}; };
request.GroupBy.Remove(""); request.GroupBy.Remove("");
if (request.SumBy == null || !request.SumBy.Any(t => !string.IsNullOrEmpty(t))) request.SumBy = dict[viewName + "_sum"]; if (request.SumBy == null || !request.SumBy.Any(t => !string.IsNullOrEmpty(t))) request.SumBy = dict[viewName + "_sum"];
...@@ -452,22 +454,11 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu ...@@ -452,22 +454,11 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
if (!string.IsNullOrEmpty(request.SortBy)) if (!string.IsNullOrEmpty(request.SortBy))
sql += $" order by {request.SortBy} "; sql += $" order by {request.SortBy} ";
else
sql += $" order by hospitalid,code,unittype,accountingunit";
if (request.GroupBy == null || !request.GroupBy.Any(t => !string.IsNullOrEmpty(t))) /*request.GroupBy = dict[viewName + "_group"];*/ if (request.GroupBy == null || !request.GroupBy.Any(t => !string.IsNullOrEmpty(t))) /*request.GroupBy = dict[viewName + "_group"];*/
{ {
switch (viewName) sql = $"select {string.Join(",", dict[viewName + "_group"])}, {string.Join(",", request.SumBy.Select(t => $"sum({t}) {t}"))} from ({sql}) tab group by {string.Join(",", dict[viewName + "_group"])}";
{
case "view_allot_sign_emp":
request.GroupBy.AddRange(new[] { "Source", "UnitType", "AccountingUnit", "JobNumber", "EmployeeName", "JobCategory" });
break;
case "view_allot_sign_dept":
request.GroupBy.AddRange(new[] { "UnitType", "AccountingUnit" });
break;
case "view_allot_sign_emp_finance":
request.GroupBy.AddRange(new[] { "UnitType", "AccountingUnit", "JobNumber", "EmployeeName" });
break;
}
sql = $"select {string.Join(",", dict[viewName + "_group"])}, {string.Join(",", request.SumBy.Select(t => $"sum({t}) {t}"))} from ({sql}) tab group by {string.Join(",", request.GroupBy)}";
} }
else else
{ {
...@@ -495,6 +486,36 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu ...@@ -495,6 +486,36 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
} }
} }
/// <summary>
/// 科室
/// </summary>
/// <param name="tableName"></param>
/// <param name="allotId"></param>
/// <param name="accountingUnit"></param>
/// <param name="unitType"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public CustonPagingData QueryCustom(string tableName, int allotId, string accountingUnit, string[] unitType, int pageIndex = 1, int pageSize = 20)
{
string dataQuery = $@"SELECT * FROM {tableName} WHERE AllotId = @AllotId and AccountingUnit = @accountingUnit and UnitType in @unitType order by UnitType,AccountingUnit LIMIT {(pageIndex - 1) * pageSize},{pageSize} ";
string countQuery = $@"SELECT COUNT(*) FROM {tableName} WHERE AllotId = @AllotId and AccountingUnit = @accountingUnit and UnitType in @unitType ";
var result = new CustonPagingData
{
DataList = DapperQuery<dynamic>(dataQuery, new { allotId, unitType, accountingUnit })?.ToList(),
TotalCount = DapperQuery<int>(countQuery, new { allotId, unitType, accountingUnit })?.FirstOrDefault() ?? 0,
};
return result;
}
/// <summary>
/// 管理员
/// </summary>
/// <param name="request"></param>
/// <param name="IsHead"></param>
/// <returns></returns>
public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead) public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
{ {
var result = new CustonPagingData(); var result = new CustonPagingData();
...@@ -518,12 +539,12 @@ public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead) ...@@ -518,12 +539,12 @@ public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
return result; return result;
} }
public bool QueryIsAllotId(string tableName) public bool QueryIsAllotId(string tableName, params string[] columns)
{ {
var database = context.Database.GetDbConnection().Database; var database = context.Database.GetDbConnection().Database;
var sql = $@"SELECT column_name FROM information_schema.COLUMNS s var sql = $@"SELECT column_name FROM information_schema.COLUMNS s
WHERE table_name = @table_name AND TABLE_SCHEMA = @database AND (column_name='allotId' or column_name='AccountingUnit' or column_name='UnitType');"; WHERE table_name = @table_name AND TABLE_SCHEMA = @database AND column_name in @columns;";
var result = DapperQuery<string>(sql, new { database = database, table_name = tableName }); var result = DapperQuery<string>(sql, new { database = database, table_name = tableName, columns });
var isExist = result?.Count() == 3; var isExist = result?.Count() == 3;
...@@ -531,11 +552,11 @@ public bool QueryIsAllotId(string tableName) ...@@ -531,11 +552,11 @@ public bool QueryIsAllotId(string tableName)
} }
public List<dynamic> QueryCustomColumn(string tableName) public List<ColumnEntity> QueryCustomColumn(string tableName)
{ {
var database = context.Database.GetDbConnection().Database; var database = context.Database.GetDbConnection().Database;
var sql = $@"SELECT column_name,column_comment FROM information_schema.`COLUMNS` WHERE table_schema = @table_schema AND table_name = @table_name AND COLUMN_KEY <> 'PRI' "; var sql = $@"SELECT column_name as Name,ifnull(column_comment,column_name) as comment FROM information_schema.`COLUMNS` WHERE table_schema = @table_schema AND table_name = @table_name AND COLUMN_KEY <> 'PRI' ";
var result = DapperQuery<dynamic>(sql, new { table_schema = database, table_name = tableName })?.ToList(); var result = DapperQuery<ColumnEntity>(sql, new { table_schema = database, table_name = tableName })?.ToList();
return result; return result;
} }
......
//-----------------------------------------------------------------------
// <copyright file=" bg_task.cs">
// * FileName: bg_task.cs
// </copyright>
//-----------------------------------------------------------------------
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// bg_task Repository
/// </summary>
public partial class PerforBgtaskRepository : PerforRepository<bg_task>
{
public PerforBgtaskRepository(PerformanceDbContext context) : base(context)
{
}
}
}
...@@ -12,8 +12,11 @@ namespace Performance.Repository ...@@ -12,8 +12,11 @@ namespace Performance.Repository
/// </summary> /// </summary>
public partial class PerforExtypeRepository : PerforRepository<ex_type> public partial class PerforExtypeRepository : PerforRepository<ex_type>
{ {
private readonly PerformanceDbContext _context;
public PerforExtypeRepository(PerformanceDbContext context) : base(context) public PerforExtypeRepository(PerformanceDbContext context) : base(context)
{ {
_context = context;
} }
} }
} }
//-----------------------------------------------------------------------
// <copyright file=" sys_version.cs">
// * FileName: sys_version.cs
// </copyright>
//-----------------------------------------------------------------------
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// sys_version Repository
/// </summary>
public partial class PerforVersionRepository : PerforRepository<sys_version>
{
public PerforVersionRepository(PerformanceDbContext context) : base(context)
{
}
}
}
...@@ -83,10 +83,10 @@ private List<PerAgainData> SlideRowRead(ISheet sheet, PerHeader header, int r, I ...@@ -83,10 +83,10 @@ private List<PerAgainData> SlideRowRead(ISheet sheet, PerHeader header, int r, I
{ {
var athead = header.Children.ElementAt(c); var athead = header.Children.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
var factorValue = ConvertHelper.To<decimal?>(sheet.GetRow(FactorRow).GetCell(athead.PointCell)?.ToString()); var factorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(FactorRow).GetCell(athead.PointCell)?.ToString());
PerAgainData data = new PerAgainData PerAgainData data = new PerAgainData
{ {
RowNumber = r, RowNumber = r,
...@@ -117,13 +117,13 @@ private static PerAgainEmployee FixatRowRead(List<PerHeader> perHeader, int r, I ...@@ -117,13 +117,13 @@ private static PerAgainEmployee FixatRowRead(List<PerHeader> perHeader, int r, I
RowNumber = r, RowNumber = r,
Name = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "姓名").PointCell)?.ToString(), Name = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "姓名").PointCell)?.ToString(),
JobTitle = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职务").PointCell)?.ToString(), JobTitle = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职务").PointCell)?.ToString(),
JobFactor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职称系数").PointCell)?.ToString()), JobFactor = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职称系数").PointCell)?.ToString()),
Attendance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤").PointCell)?.ToString()), Attendance = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤").PointCell)?.ToString()),
YearFactor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "年资").PointCell)?.ToString()), YearFactor = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "年资").PointCell)?.ToString()),
Award = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "重点奖励").PointCell)?.ToString()), Award = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "重点奖励").PointCell)?.ToString()),
Allowance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "管理津贴").PointCell)?.ToString()), Allowance = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "管理津贴").PointCell)?.ToString()),
AlonePerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "单独核算人员绩效").PointCell)?.ToString()), AlonePerfor = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "单独核算人员绩效").PointCell)?.ToString()),
NightShift = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "夜班费").PointCell)?.ToString()), NightShift = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "夜班费").PointCell)?.ToString()),
}; };
} }
} }
......
...@@ -325,6 +325,7 @@ public void Generate(per_allot allot) ...@@ -325,6 +325,7 @@ public void Generate(per_allot allot)
{ {
logManageService.WriteMsg("绩效开始执行", $"正在生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效!", 1, allot.ID, "ReceiveMessage", true); logManageService.WriteMsg("绩效开始执行", $"正在生成{allot.Year}-{allot.Month.ToString().PadLeft(2, '0')}月份绩效!", 1, allot.ID, "ReceiveMessage", true);
UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
var excel = new PerExcel(); var excel = new PerExcel();
int generate = allot.Generate; int generate = allot.Generate;
if (new int[] { (int)AllotGenerate.OriginalDataEdited, (int)AllotGenerate.PersonnelOffice }.Contains(allot.Generate)) if (new int[] { (int)AllotGenerate.OriginalDataEdited, (int)AllotGenerate.PersonnelOffice }.Contains(allot.Generate))
...@@ -344,7 +345,6 @@ public void Generate(per_allot allot) ...@@ -344,7 +345,6 @@ public void Generate(per_allot allot)
// 导出数据 // 导出数据
excel = importDataService.ReadDataAndSave(allot); 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));
......
using Performance.EntityModels;
using Performance.Repository;
using System.Collections.Generic;
using System.Linq;
namespace Performance.Services
{
public class CommonService : IAutoInjection
{
private readonly PerforVersionRepository _versionRepository;
public CommonService(PerforVersionRepository versionRepository)
{
_versionRepository = versionRepository;
}
public List<sys_version> GetVersions(int take = 50)
{
var vers = _versionRepository.GetEntities() ?? new List<sys_version>();
return vers.OrderByDescending(w => w.PublishTime).Take(take).ToList();
}
}
}
...@@ -2109,13 +2109,13 @@ ...@@ -2109,13 +2109,13 @@
// var value = deptData.FirstOrDefault(t => t.TypeName == headName)?.CellValue ?? "0"; // var value = deptData.FirstOrDefault(t => t.TypeName == headName)?.CellValue ?? "0";
// if (isIncom) // if (isIncom)
// { // {
// var cellvalue = value == "0" ? null : ConvertHelper.To<decimal?>(value); // var cellvalue = value == "0" ? null : ConvertHelper.ToDecimalOrNull(value);
// OutToExcelCell<decimal>(newCell, cellvalue); // OutToExcelCell<decimal>(newCell, cellvalue);
// newCell.CellStyle = style; // newCell.CellStyle = style;
// } // }
// else if (newCell.CellType != CellType.Formula) // else if (newCell.CellType != CellType.Formula)
// { // {
// var cellvalue = value == "0" ? null : ConvertHelper.To<decimal?>(value); // var cellvalue = value == "0" ? null : ConvertHelper.ToDecimalOrNull(value);
// OutToExcelCell<decimal>(newCell, cellvalue); // OutToExcelCell<decimal>(newCell, cellvalue);
// if (header != null && header.Contains(headName)) // if (header != null && header.Contains(headName))
// newCell.CellStyle = style; // newCell.CellStyle = style;
......
...@@ -78,38 +78,35 @@ public List<ex_module> QueryModule(int hospitalId) ...@@ -78,38 +78,35 @@ public List<ex_module> QueryModule(int hospitalId)
DefaultModules(hospitalId); DefaultModules(hospitalId);
var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList(); var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList();
list?.ForEach(t => t.ReadOnly = t.SheetType == (int)SheetType.Income ? 0 : 1);
return list; return list;
} }
public void DefaultModules(int hospitalId) public void DefaultModules(int hospitalId)
{ {
var moduleList = new ex_module[] var moduleList = new List<ex_module>
{ {
new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome }, new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome, ReadOnly = 0 },
new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.1 住院开单收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.2.1 住院开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income }, new ex_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend }, new ex_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend, ReadOnly = 0 },
new ex_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload }, new ex_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload }, new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
}; };
var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId); var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
var inexistence = (data == null || !data.Any()) ? moduleList : moduleList.Where(t => !data.Any(w => w.ModuleName.StartsWith(t.ModuleName.Split(' ')[0]))); var inexistence = (data == null || !data.Any())
? moduleList
: moduleList.Where(t => !data.Any(w => w.ModuleName.StartsWith(t.ModuleName.Split(' ')[0])))?.ToList();
if (inexistence != null && inexistence.Any()) if (inexistence != null && inexistence.Any())
{ {
var modules = inexistence.Select(t => new ex_module inexistence.ForEach(t =>
{ {
HospitalId = hospitalId, t.HospitalId = hospitalId;
ModuleName = t.ModuleName,
SheetType = (int)t.SheetType,
ReadOnly = t.SheetType == (int)SheetType.Income ? 0 : 1,
TypeId = null,
}); });
exmoduleRepository.AddRange(modules.ToArray()); exmoduleRepository.AddRange(inexistence.ToArray());
} }
} }
......
...@@ -95,13 +95,16 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi ...@@ -95,13 +95,16 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
} }
} }
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"开始提取HIS数据", isSingle: isSingle);
var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId); var hisScrips = hisscriptRepository.GetEntities(t => t.HospitalId == hospitalId);
if (hisScrips == null || !hisScrips.Any()) return; if (hisScrips == null || !hisScrips.Any()) return;
foreach (var item in hisScrips) foreach (var item in hisScrips)
{ {
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取{item.SourceType} - {item.Category}数据", isSingle: isSingle); HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, groupName, isSingle);
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, isSingle);
} }
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取HIS数据完成", isSingle: isSingle);
} }
catch (Exception) catch (Exception)
{ {
...@@ -231,10 +234,12 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List< ...@@ -231,10 +234,12 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
} }
} }
private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, bool isSingle) private void HisData(per_allot allot, sys_hospitalconfig config, his_script script, string groupName, bool isSingle)
{ {
try try
{ {
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”数据", isSingle: isSingle);
if (config == null || string.IsNullOrEmpty(script.ExecScript)) return; if (config == null || string.IsNullOrEmpty(script.ExecScript)) return;
var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle); var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle);
...@@ -263,10 +268,12 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri ...@@ -263,10 +268,12 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
}); });
hisdataRepository.AddRange(insertData.ToArray()); hisdataRepository.AddRange(insertData.ToArray());
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”完成", isSingle: isSingle);
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.LogError("获取his_data时发生异常:" + ex.ToString()); logger.LogError("获取his_data时发生异常:" + ex.ToString());
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL错误", $"获取HIS数据“{script.SourceType} - {script.Category}”时发生异常", 3, isSingle);
} }
} }
...@@ -296,6 +303,7 @@ private void ExResult(per_allot allot, sys_hospitalconfig config, string sql, st ...@@ -296,6 +303,7 @@ private void ExResult(per_allot allot, sys_hospitalconfig config, string sql, st
ConfigId = config.Id, ConfigId = config.Id,
AllotId = allot.ID, AllotId = allot.ID,
CreateTime = createTime, CreateTime = createTime,
IsDelete = 0,
}).ToList(); }).ToList();
exresultRepository.AddRange(result.ToArray()); exresultRepository.AddRange(result.ToArray());
} }
......
...@@ -225,6 +225,12 @@ public static string NoBlank(this string @string) ...@@ -225,6 +225,12 @@ public static string NoBlank(this string @string)
return @string.Replace("\n", "").Replace("\r", "").Replace(" ", "").Trim(); return @string.Replace("\n", "").Replace("\r", "").Replace(" ", "").Trim();
} }
public static string GetNo(this string @string)
{
var match = Regex.Match(@string, "^(1.[1-9].[1-9])|(^[1-9]+.[1-9]+)");
return match.Value;
}
public static IWorkbook GetWorkbook(string filePath) public static IWorkbook GetWorkbook(string filePath)
{ {
IWorkbook workbook = null; IWorkbook workbook = null;
...@@ -282,7 +288,9 @@ public static void EvaluateAll(this IWorkbook workbook) ...@@ -282,7 +288,9 @@ public static void EvaluateAll(this IWorkbook workbook)
{ {
try try
{ {
workbook.GetCreationHelper().CreateFormulaEvaluator().EvaluateAll(); var creation = workbook.GetCreationHelper();
var formula = creation?.CreateFormulaEvaluator();
formula?.EvaluateAll();
} }
catch catch
{ {
......
...@@ -54,18 +54,22 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -54,18 +54,22 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
try try
{ {
var sheetNames = workbook.GetAllNames().Select(w => w.SheetName);
foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName)) foreach (var module in modulesList.Where(t => t.SheetType == (int)SheetType.Income)?.OrderBy(t => t.ModuleName))
{ {
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var no = module.ModuleName.GetNo();
var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName;
var sheet = workbook.GetSheet(name) ?? workbook.GetSheet(module.ModuleName);
if (sheet == null) if (sheet == null)
{ {
string[] keyArray = new string[] { "开单", "就诊", "执行" }; string[] keyArray = new string[] { "开单", "就诊", "执行" };
if (keyArray.Any(key => module.ModuleName.Contains(key))) if (keyArray.Any(key => name.Contains(key)))
{ {
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue; if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true); var newSheet = copysheet.CopySheet(name, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
} }
} }
...@@ -73,13 +77,15 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -73,13 +77,15 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName)) foreach (var module in modulesList.Where(t => new int[] { (int)SheetType.OtherWorkload, (int)SheetType.Assess }.Contains(t.SheetType.Value))?.OrderBy(t => t.ModuleName))
{ {
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var no = module.ModuleName.GetNo();
var name = sheetNames.FirstOrDefault(name => name.StartsWith(no)) ?? module.ModuleName;
var sheet = workbook.GetSheet(name) ?? workbook.GetSheet(module.ModuleName);
if (sheet == null) if (sheet == null)
{ {
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue; if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true); var newSheet = copysheet.CopySheet(name, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point; var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
......
...@@ -100,20 +100,21 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -100,20 +100,21 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle); logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle);
queryService.ClearConnectionPools();
queryService.ClearHistoryData(allot.ID, groupName, isSingle); queryService.ClearHistoryData(allot.ID, groupName, isSingle);
employeeService.SyncDataToResult(allotId); employeeService.SyncDataToResult(allotId);
var data = exresultRepository.GetEntities(t => t.AllotId == allotId); var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict)); data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict));
var standData = StandDataFormat(hospitalId, data); var standData = StandDataFormat(hospitalId, allotId, data);
dictionaryService.Handler(hospitalId, allot, groupName, isSingle); dictionaryService.Handler(hospitalId, allot, groupName, isSingle);
var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }; var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath); var templateFilePath = ExtractHelper.GetExtractFile(hospitalId, allot, ref extractFilePath, filePath);
logService.ReturnTheLog(allotId, groupName, 2, "创建文件", $"模板文件: {templateFilePath}", 1, isSingle); logService.ReturnTheLog(allotId, groupName, 2, "创建文件", $"模板文件: {FileHelper.GetFileName(templateFilePath)}", 1, isSingle);
if (!FileHelper.IsExistFile(templateFilePath)) throw new Exception("抽取文件创建失败"); if (!FileHelper.IsExistFile(templateFilePath)) throw new Exception("抽取文件创建失败");
...@@ -232,10 +233,10 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD ...@@ -232,10 +233,10 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
var customer = factory.GetWriteData(sheetType, logger); var customer = factory.GetWriteData(sheetType, logger);
if (customer != null) if (customer != null)
{ {
var collects = collectData?.Where(t => t.SheetName.NoBlank() == sheetName).ToList(); var collects = collectData?.Where(t => t.SheetName.StartsWith(sheetName.GetNo())).ToList();
customer.WriteCollectData(sheet, point, sheetType, style, collects, exdict); customer.WriteCollectData(sheet, point, sheetType, style, collects, exdict);
var exdata = extractDto.Where(t => t.SheetName.NoBlank() == sheetName)?.ToList(); var exdata = extractDto.Where(t => t.SheetName.StartsWith(sheetName.GetNo()))?.ToList();
if (exdata != null) if (exdata != null)
{ {
logger.LogInformation($"{sheetName}: 总金额 - {exdata.Sum(s => s.Value ?? 0)}; 科室 - {string.Join(",", exdata.Select(s => s.Department).Distinct())}"); logger.LogInformation($"{sheetName}: 总金额 - {exdata.Sum(s => s.Value ?? 0)}; 科室 - {string.Join(",", exdata.Select(s => s.Department).Distinct())}");
...@@ -274,10 +275,11 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr ...@@ -274,10 +275,11 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr
/// <summary> /// <summary>
/// 标准数据格式, 匹配科室字典 /// 标准数据格式, 匹配科室字典
/// </summary> /// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="results"></param> /// <param name="results"></param>
/// <returns></returns> /// <returns></returns>
private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> results) private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<ex_result> results)
{ {
if (results == null || !results.Any()) return new List<ExtractTransDto>(); if (results == null || !results.Any()) return new List<ExtractTransDto>();
...@@ -307,44 +309,47 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -307,44 +309,47 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department); t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department);
}); });
var data = results.GroupJoin(dict, outer => new { Department = outer.Department }, inner => new { Department = inner.HISDeptName }, (outer, inner) => new { outer, inner }) var data = new List<ExtractTransDto>();
.Select(t => foreach (var item in results)
{
var firstDic = dict.FirstOrDefault(w => w.HISDeptName == item.Department) ?? dict.FirstOrDefault(w => w.Department == item.Department);
var dept = !string.IsNullOrEmpty(firstDic?.Department) ? firstDic?.Department : item.Department;
var d = new ExtractTransDto
{ {
var dept = !string.IsNullOrEmpty(t.inner.FirstOrDefault()?.Department) ? t.inner.FirstOrDefault()?.Department : t.outer.Department; SheetName = item.Source,
return new ExtractTransDto Department = dept,
{ Category = item.Category,
SheetName = t.outer.Source, DoctorName = item.DoctorName,
Department = dept, PersonnelNumber = item.PersonnelNumber,
Category = t.outer.Category, Value = item.Fee ?? 0,
DoctorName = t.outer.DoctorName, OutDoctorAccounting = firstDic?.OutDoctorAccounting?.AccountingUnit,
PersonnelNumber = t.outer.PersonnelNumber, OutNurseAccounting = firstDic?.OutNurseAccounting?.AccountingUnit,
Value = t.outer.Fee ?? 0, OutTechnicAccounting = firstDic?.OutTechnicAccounting?.AccountingUnit,
OutDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutDoctorAccounting?.AccountingUnit, InpatDoctorAccounting = firstDic?.InpatDoctorAccounting?.AccountingUnit,
OutNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutNurseAccounting?.AccountingUnit, InpatNurseAccounting = firstDic?.InpatNurseAccounting?.AccountingUnit,
OutTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutTechnicAccounting?.AccountingUnit, InpatTechnicAccounting = firstDic?.InpatTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatDoctorAccounting?.AccountingUnit, SpecialAccounting = firstDic?.SpecialAccounting?.AccountingUnit ?? dept,
InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit, EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName,
InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit, };
SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept, data.Add(d);
EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName, }
};
});
var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName }).Select(t => new ExtractTransDto var groupdata = data.GroupBy(t => new { t.Department, t.Category, t.SheetName })
{ .Select(t => new ExtractTransDto
SheetName = t.Key.SheetName, {
Department = t.Key.Department, SheetName = t.Key.SheetName,
Category = t.Key.Category, Department = t.Key.Department,
Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value), Category = t.Key.Category,
OutDoctorAccounting = t.FirstOrDefault()?.OutDoctorAccounting, Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value),
OutNurseAccounting = t.FirstOrDefault()?.OutNurseAccounting, OutDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutDoctorAccounting))?.OutDoctorAccounting,
OutTechnicAccounting = t.FirstOrDefault()?.OutTechnicAccounting, OutNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutNurseAccounting))?.OutNurseAccounting,
InpatDoctorAccounting = t.FirstOrDefault()?.InpatDoctorAccounting, OutTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutTechnicAccounting))?.OutTechnicAccounting,
InpatNurseAccounting = t.FirstOrDefault()?.InpatNurseAccounting, InpatDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatDoctorAccounting))?.InpatDoctorAccounting,
InpatTechnicAccounting = t.FirstOrDefault()?.InpatTechnicAccounting, InpatNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatNurseAccounting))?.InpatNurseAccounting,
SpecialAccounting = t.FirstOrDefault()?.SpecialAccounting, InpatTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatTechnicAccounting))?.InpatTechnicAccounting,
EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName SpecialAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.SpecialAccounting))?.SpecialAccounting,
}); EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName
});
return groupdata.ToList(); return groupdata.ToList();
} }
......
...@@ -62,6 +62,14 @@ PerforPerallotRepository perallotRepository ...@@ -62,6 +62,14 @@ PerforPerallotRepository perallotRepository
private static Dictionary<int, IDbConnection> pools = new Dictionary<int, IDbConnection>(); private static Dictionary<int, IDbConnection> pools = new Dictionary<int, IDbConnection>();
/// <summary> /// <summary>
/// 清理数据库连接池
/// </summary>
public void ClearConnectionPools()
{
pools.Clear();
}
/// <summary>
/// 获取抽取数据 /// 获取抽取数据
/// </summary> /// </summary>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
...@@ -201,7 +209,11 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo ...@@ -201,7 +209,11 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
foreach (var script in scripts.Where(t => t.TypeId == typeId)) foreach (var script in scripts.Where(t => t.TypeId == typeId))
{ {
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId); var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue; if (config == null)
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"未正确配置数据库连接", 2, isSingle);
continue;
}
try try
{ {
...@@ -224,6 +236,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo ...@@ -224,6 +236,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
ConfigId = config.Id, ConfigId = config.Id,
AllotId = allot.ID, AllotId = allot.ID,
CreateTime = CreateTime, CreateTime = CreateTime,
IsDelete = 0,
}).ToList(); }).ToList();
exresultRepository.InsertExecute(result.ToArray()); exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result); data.AddRange(result);
...@@ -275,7 +288,12 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool ...@@ -275,7 +288,12 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
foreach (var script in scripts.Where(t => t.TypeId == typeId)) foreach (var script in scripts.Where(t => t.TypeId == typeId))
{ {
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId); var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue; if (config == null)
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"未正确配置数据库连接", 2, isSingle);
continue;
}
try try
{ {
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle); var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
...@@ -297,6 +315,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool ...@@ -297,6 +315,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
ConfigId = config.Id, ConfigId = config.Id,
AllotId = allot.ID, AllotId = allot.ID,
CreateTime = CreateTime, CreateTime = CreateTime,
IsDelete = 0,
}).ToList(); }).ToList();
exresultRepository.InsertExecute(result.ToArray()); exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result); data.AddRange(result);
...@@ -345,7 +364,12 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -345,7 +364,12 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
foreach (var script in scripts.Where(t => t.TypeId == typeId)) foreach (var script in scripts.Where(t => t.TypeId == typeId))
{ {
var config = configs.FirstOrDefault(t => t.Id == script.ConfigId); var config = configs.FirstOrDefault(t => t.Id == script.ConfigId);
if (config == null) continue; if (config == null)
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"未正确配置数据库连接", 2, isSingle);
continue;
}
try try
{ {
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle); var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
...@@ -366,6 +390,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo ...@@ -366,6 +390,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
ConfigId = config.Id, ConfigId = config.Id,
AllotId = allot.ID, AllotId = allot.ID,
CreateTime = CreateTime, CreateTime = CreateTime,
IsDelete = 0,
}).ToList(); }).ToList();
exresultRepository.InsertExecute(result.ToArray()); exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result); data.AddRange(result);
...@@ -427,15 +452,16 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe ...@@ -427,15 +452,16 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
try try
{ {
logger.LogInformation($"提取绩效数据SQL脚本{execsql}"); logger.LogInformation($"提取绩效数据SQL脚本{execsql}");
var result = connection.Query<T>(execsql, commandTimeout: 20000); var result = connection.Query<T>(execsql, commandTimeout: 60 * 60 * 5);
logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录"); logger.LogInformation($"提取绩效数据执行脚本获取数据{result?.Count() ?? 0}条记录");
return result; return result;
} }
catch (Exception ex) catch (Exception ex)
{ {
logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL执行失败", ex.Message, 3, isSingle); logService.ReturnTheLog(allot.ID, allot.ID.ToString(), 2, "SQL执行错误", ex.Message, 3, isSingle);
throw; throw;
} }
} }
/// <summary> /// <summary>
...@@ -455,6 +481,26 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe ...@@ -455,6 +481,26 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
return pairs; return pairs;
} }
/// <summary>
/// 查询数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="config"></param>
/// <param name="execsql"></param>
/// <param name="param"></param>
/// <returns></returns>
public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, object param)
{
var connection = ConnectionBuilder.Create((DatabaseType)config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword);
if (connection == null) return new List<T>();
if (connection.State == ConnectionState.Closed)
connection.Open();
var result = connection.Query<T>(execsql, param, commandTimeout: 20000);
return result;
}
#endregion QueryData #endregion QueryData
} }
} }
...@@ -39,7 +39,8 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT ...@@ -39,7 +39,8 @@ public void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType sheetT
public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null) public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetType, ExcelStyle style, object data, Dictionary<ExDataDict, object> exdict = null)
{ {
var modules = exdict[ExDataDict.ExModule] as List<ex_module>; var modules = exdict[ExDataDict.ExModule] as List<ex_module>;
var module = modules?.FirstOrDefault(t => t.SheetType == (int)sheetType && t.ModuleName.NoBlank() == sheet.SheetName.NoBlank()); var no = sheet.SheetName.GetNo();
var module = modules?.FirstOrDefault(t => t.SheetType == (int)sheetType && t.ModuleName.StartsWith(no));
if (module == null) return; if (module == null) return;
if (data is List<ExtractTransDto> extractDto && extractDto.Any()) if (data is List<ExtractTransDto> extractDto && extractDto.Any())
......
...@@ -50,7 +50,7 @@ public List<HospitalResponse> GetUserHopital(int userid) ...@@ -50,7 +50,7 @@ public List<HospitalResponse> GetUserHopital(int userid)
var hosList = _hospitalRepository.GetEntities(t => joinList.Select(j => j.HospitalID).Contains(t.ID)); var hosList = _hospitalRepository.GetEntities(t => joinList.Select(j => j.HospitalID).Contains(t.ID));
var hosId = hosList?.Select(item => item.ID).ToList(); var hosId = hosList?.Select(item => item.ID).ToList();
//获取存在数据记录的hospital //获取存在数据记录的hospital
hosId = _hospitalconfigRepository.GetEntities(t => hosId.Contains(t.HospitalId.Value))?.Select(t => t.HospitalId.Value).ToList(); hosId = _hospitalconfigRepository.GetEntities(t => hosId.Contains(t.HospitalId))?.Select(t => t.HospitalId).ToList();
//获取已经上传过模板的hospital //获取已经上传过模板的hospital
var firstId = _perfirstRepository.GetEntities(t => hosId.Contains(t.HospitalId.Value))?.Select(t => t.HospitalId.Value).ToList(); var firstId = _perfirstRepository.GetEntities(t => hosId.Contains(t.HospitalId.Value))?.Select(t => t.HospitalId.Value).ToList();
......
using System.Collections.Generic;
namespace Performance.Services.OnlineExcel
{
public class EpColumn
{
public int row { get; set; }
public int col { get; set; }
public string renderer { get; set; }
}
/// <summary>
/// 单元格Class
/// </summary>
public class EpCellClass
{
private List<string> _className;
public int row { get; set; }
public int col { get; set; }
public bool editor { get; set; }
public string className
{
get
{
if (_className == null)
return "";
return string.Join(" ", _className.ToArray());
}
}
public void AddClassName(string name)
{
if (_className == null)
_className = new List<string>();
_className.Add(name);
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
namespace Performance.Services.OnlineExcel
{
public enum Operation
{
InsertRow = 1,
DeleteRow = 2,
InsertColumn = 3,
DeleteColumn = 4,
}
/// <summary>
/// 操作情况
/// </summary>
public class OperationRecord
{
public DateTime DateTime { get; set; }
public Operation Operation { get; set; }
public int From { get; set; }
public int Count { get; set; }
}
/// <summary>
/// 数据变更提交记录
/// </summary>
public class EpChanage
{
public string SheetName { get; set; }
public string Version { get; set; }
public OperationRecord[] OperationRecord { get; set; }
public List<dynamic> Data { get; set; }
}
}
\ No newline at end of file
namespace Performance.Services.OnlineExcel
{
/// <summary>
/// 边框(弃用 影响性能)
/// </summary>
public class EpCustomBorders
{
public int row { get; set; }
public int col { get; set; }
public Style left { get; set; }
public Style right { get; set; }
public Style top { get; set; }
public Style bottom { get; set; }
public class Style
{
public int width { get; set; }
public string color { get; set; }
}
}
}
\ No newline at end of file
namespace Performance.Services.OnlineExcel
{
/// <summary>
/// 单元格合并
/// </summary>
public class EpMerge
{
public int row { get; set; }
public int col { get; set; }
public int rowspan { get; set; }
public int colspan { get; set; }
}
}
\ No newline at end of file
using System.Collections.Generic;
namespace Performance.Services.OnlineExcel
{
/// <summary>
/// 加载Excel汇总信息
/// </summary>
public class EpSheet
{
public int fixedColumnsLeft { get; set; }
public int fixedRowsTop { get; set; }
public object renders { get; set; }
public object mergeCells { get; set; }
public object data { get; set; }
public object cell { get; set; }
public object colWidths { get; set; }
}
}
\ No newline at end of file
using Performance.DtoModels;
namespace Performance.Services.OnlineExcel
{
public partial class OnlineExcelService
{
public class ExcelSheetInfo
{
public string Name { get; set; }
public int Row { get; set; }
public int Column { get; set; }
public string Version { get; set; }
public string Message
{
get
{
if (Row * Column > 500 * 50)
return "数据量很大,加载需要较长时间";
else if (Row * Column > 100 * 50)
return "数据较多,可能需要较长加载时间";
return "";
}
}
public SheetType SheetType { get; internal set; }
public string ModuleName { get; internal set; }
}
}
}
\ No newline at end of file
using Newtonsoft.Json;
using OfficeOpenXml;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Performance.Services.OnlineExcel
{
public partial class OnlineExcelService
{
public static Dictionary<Operation, Action<ExcelWorksheet, int, int>> OperationMapps = new Dictionary<Operation, Action<ExcelWorksheet, int, int>>
{
{ Operation.InsertRow, (sheet,from,count) => sheet.InsertRow(from, count, from + 1) },
{ Operation.DeleteRow, (sheet,from,count) => sheet.DeleteRow(from, count) },
{ Operation.InsertColumn, (sheet,from,count) => sheet.InsertColumn(from, count, from + 1) },
{ Operation.DeleteColumn, (sheet,from,count) => sheet.DeleteColumn(from, count) },
};
private List<string> GetColumns()
{
var columns = new List<string> { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
List<string> newColumns = new List<string>(columns);
foreach (var column in columns)
{
foreach (var item in columns)
{
newColumns.Add($"{column}{item}");
}
}
return newColumns;
}
public void WriteSheet(per_allot allot, EpChanage chanage)
{
FileInfo file = new FileInfo(allot.Path);
if (file.LastWriteTimeUtc.ToTimeStamp().ToString() != chanage.Version)
throw new PerformanceException("您读取的文件已被其他人更改");
using (ExcelPackage package = new ExcelPackage(file))
{
foreach (var sheet in package.Workbook.Worksheets)
{
if (sheet.Name != chanage.SheetName) continue;
// 新增删除 行 列 信息
if (chanage.OperationRecord != null && chanage.OperationRecord.Length > 0)
{
foreach (var item in chanage.OperationRecord.Where(w => w.Count > 0).OrderBy(w => w.DateTime))
{
OperationMapps[item.Operation].Invoke(sheet, item.From, item.Count);
}
}
// 写入数据
var columns = GetColumns();
for (int row = 0; row < chanage.Data.Count; row++)
{
var tempData = JsonConvert.DeserializeObject<Dictionary<string, object>>(JsonConvert.SerializeObject(chanage.Data[row]));
foreach (var key in tempData.Keys)
{
var col = columns.IndexOf(key);
var cell = sheet.Cells[row + 1, col + 1];
if (!(cell.Value is ExcelErrorValue) && string.IsNullOrEmpty(cell.Formula))
cell.Value = tempData[key];
}
}
_cache.Remove($"SheetData-{chanage.SheetName}:{allot.Path}");
}
package.Save();
}
}
}
}
\ No newline at end of file
...@@ -45,11 +45,11 @@ public static class NopiSevice ...@@ -45,11 +45,11 @@ public static class NopiSevice
// switch (cell.CellType) // switch (cell.CellType)
// { // {
// case CellType.Numeric: // case CellType.Numeric:
// return ConvertHelper.To<decimal?>(cell.NumericCellValue); // return ConvertHelper.ToDecimalOrNull(cell.NumericCellValue);
// case CellType.String: // case CellType.String:
// return ConvertHelper.To<decimal?>(cell.StringCellValue); // return ConvertHelper.ToDecimalOrNull(cell.StringCellValue);
// case CellType.Formula: // case CellType.Formula:
// return ConvertHelper.To<decimal?>(cell.NumericCellValue); // return ConvertHelper.ToDecimalOrNull(cell.NumericCellValue);
// } // }
// } // }
// catch (Exception ex) // catch (Exception ex)
......
...@@ -51,7 +51,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -51,7 +51,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
...@@ -63,7 +63,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -63,7 +63,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value).GetValue(), AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value).GetValue(),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
FactorValue = 1, FactorValue = 1,
IsFactor = true, IsFactor = true,
}; };
......
...@@ -69,7 +69,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -69,7 +69,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
PerData data = new PerData PerData data = new PerData
...@@ -80,9 +80,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -80,9 +80,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(), Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, 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).GetValue()), FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell).GetValue()),
IsFactor = true, IsFactor = true,
}; };
dataList.Add(data); dataList.Add(data);
...@@ -111,9 +111,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -111,9 +111,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = cellValue, Department = cellValue,
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = (dataList.Select(t => (PerData)t)?.Where(t => t.TypeName == athead.CellValue).Sum(t => t.CellValue) ?? 0) / 2, CellValue = (dataList.Select(t => (PerData)t)?.Where(t => t.TypeName == athead.CellValue).Sum(t => t.CellValue) ?? 0) / 2,
Annotation = technicianRow.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = technicianRow.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = tunit.UnitType, //手动匹配 UnitType = tunit.UnitType, //手动匹配
FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(tunit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()), FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(tunit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
IsFactor = true, IsFactor = true,
}; };
dataList.Add(data); dataList.Add(data);
......
...@@ -44,7 +44,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -44,7 +44,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
object @object = row.GetCell(point).GetValue(); object @object = row.GetCell(point).GetValue();
if (item.IsNumber) if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object); @object = ConvertHelper.ToDecimalOrNull(@object);
if (dic.Keys.Contains(item.Field)) if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object; dic[item.Field] = @object;
......
...@@ -46,7 +46,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -46,7 +46,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
...@@ -58,7 +58,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -58,7 +58,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
//Department = NopiSevice.GetCellStringValue(row.GetCell(unit.DeptCellNum.Value)), //Department = NopiSevice.GetCellStringValue(row.GetCell(unit.DeptCellNum.Value)),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = row.GetCell(0)?.ToString(), UnitType = row.GetCell(0)?.ToString(),
FactorValue = 0, FactorValue = 0,
IsFactor = false, IsFactor = false,
......
...@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
object @object = row.GetCell(point).GetValue(); object @object = row.GetCell(point).GetValue();
if (item.IsNumber) if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object); @object = ConvertHelper.ToDecimalOrNull(@object);
if (dic.Keys.Contains(item.Field)) if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object; dic[item.Field] = @object;
......
...@@ -72,7 +72,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -72,7 +72,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
if (!string.IsNullOrEmpty(athead?.CellValue) && athead.CellValue.Contains("备注")) if (!string.IsNullOrEmpty(athead?.CellValue) && athead.CellValue.Contains("备注"))
continue; continue;
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
...@@ -84,9 +84,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -84,9 +84,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(), Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, 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)?.NumericCellValue), FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue),
IsFactor = true, IsFactor = true,
}; };
var lastcell = vhead.OrderByDescending(t => t.PointCell).First(); var lastcell = vhead.OrderByDescending(t => t.PointCell).First();
......
...@@ -68,7 +68,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -68,7 +68,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
PerData data = new PerData PerData data = new PerData
...@@ -79,9 +79,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -79,9 +79,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(), Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, 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)?.NumericCellValue), FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue),
IsFactor = true, IsFactor = true,
}; };
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department)) if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
......
...@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
object @object = row.GetCell(point).GetValue(); object @object = row.GetCell(point).GetValue();
if (item.IsNumber) if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object); @object = ConvertHelper.ToDecimalOrNull(@object);
if (dic.Keys.Contains(item.Field)) if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object; dic[item.Field] = @object;
......
...@@ -68,7 +68,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -68,7 +68,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
PerData data = new PerData PerData data = new PerData
...@@ -79,9 +79,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -79,9 +79,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(), Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, 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)?.NumericCellValue), FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue),
IsFactor = true, IsFactor = true,
}; };
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department)) if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
......
...@@ -51,7 +51,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -51,7 +51,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
var athead = vhead.ElementAt(c); var athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
var cellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
...@@ -63,7 +63,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -63,7 +63,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value).GetValue(), AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value).GetValue(),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
FactorValue = 1, FactorValue = 1,
IsFactor = true, IsFactor = true,
}; };
......
...@@ -55,13 +55,13 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -55,13 +55,13 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
if (NopiSevice.TryGetPoint(perHeader, "量化指标", out point)) if (NopiSevice.TryGetPoint(perHeader, "量化指标", out point))
specialUnit.QuantitativeIndicators = row.GetCell(point).GetValue(); specialUnit.QuantitativeIndicators = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "数量", out point)) if (NopiSevice.TryGetPoint(perHeader, "数量", out point))
specialUnit.Quantity = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue()); specialUnit.Quantity = ConvertHelper.ToDecimalOrNull(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "量化指标绩效分值", out point)) if (NopiSevice.TryGetPoint(perHeader, "量化指标绩效分值", out point))
specialUnit.QuantitativeIndicatorsValue = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue()); specialUnit.QuantitativeIndicatorsValue = ConvertHelper.ToDecimalOrNull(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "人数", out point)) if (NopiSevice.TryGetPoint(perHeader, "人数", out point))
specialUnit.Number = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue()); specialUnit.Number = ConvertHelper.ToDecimalOrNull(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "实发绩效", out point)) if (NopiSevice.TryGetPoint(perHeader, "实发绩效", out point))
specialUnit.RealGiveFee = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue()); specialUnit.RealGiveFee = ConvertHelper.ToDecimalOrNull(row.GetCell(point).GetValue());
ICell cell = null; ICell cell = null;
if (NopiSevice.TryGetPoint(perHeader, "科室", out int kspoint)) if (NopiSevice.TryGetPoint(perHeader, "科室", out int kspoint))
...@@ -84,10 +84,10 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -84,10 +84,10 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
specialUnit.AccountingUnit = accountingUnit; specialUnit.AccountingUnit = accountingUnit;
specialUnit.Department = accountingUnit; specialUnit.Department = accountingUnit;
//specialUnit.ScoringAverage = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue); //specialUnit.ScoringAverage = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue);
//specialUnit.OtherPerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue); //specialUnit.OtherPerfor = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue);
//specialUnit.Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue); //specialUnit.Punishment = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue);
//specialUnit.Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.NumericCellValue); //specialUnit.Adjust = ConvertHelper.ToDecimalOrNull(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);
......
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