Commit ee75cac4 by ruyun.zhang@suvalue.com

v22.2.10

parents 53a73c08 0c1b045f
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Performance.Services.Queues;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Performance.Api
{
public class QueuedHostedService : BackgroundService
{
private readonly ILogger<QueuedHostedService> _logger;
public QueuedHostedService(
IBackgroundTaskQueue taskQueue,
ILogger<QueuedHostedService> logger)
{
TaskQueue = taskQueue;
_logger = logger;
}
public IBackgroundTaskQueue TaskQueue { get; }
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_logger.LogInformation(
$"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);
}
private async Task BackgroundProcessing(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
var workItem =
await TaskQueue.DequeueAsync(stoppingToken);
try
{
await workItem(stoppingToken);
}
catch (Exception ex)
{
_logger.LogError(ex,
"Error occurred executing {WorkItem}.", nameof(workItem));
}
}
}
public override async Task StopAsync(CancellationToken stoppingToken)
{
_logger.LogInformation("Queued Hosted Service is stopping.");
await base.StopAsync(stoppingToken);
}
}
}
//using Microsoft.Extensions.Hosting;
//using Microsoft.Extensions.Logging;
//using Performance.Services.Queues;
//using System;
//using System.Threading;
//using System.Threading.Tasks;
//namespace Performance.Api
//{
// public class QueuedHostedService : BackgroundService
// {
// private readonly ILogger<QueuedHostedService> _logger;
// public QueuedHostedService(
// IBackgroundTaskQueue taskQueue,
// ILogger<QueuedHostedService> logger)
// {
// TaskQueue = taskQueue;
// _logger = logger;
// }
// public IBackgroundTaskQueue TaskQueue { get; }
// protected override async Task ExecuteAsync(CancellationToken stoppingToken)
// {
// _logger.LogInformation(
// $"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);
// }
// private async Task BackgroundProcessing(CancellationToken stoppingToken)
// {
// while (!stoppingToken.IsCancellationRequested)
// {
// var workItem =
// await TaskQueue.DequeueAsync(stoppingToken);
// try
// {
// await workItem(stoppingToken);
// }
// catch (Exception ex)
// {
// _logger.LogError(ex,
// "Error occurred executing {WorkItem}.", nameof(workItem));
// }
// }
// }
// public override async Task StopAsync(CancellationToken stoppingToken)
// {
// _logger.LogInformation("Queued Hosted Service is stopping.");
// await base.StopAsync(stoppingToken);
// }
// }
//}
......@@ -23,6 +23,7 @@ public static void AddDatabaseConfiguration(this IServiceCollection services)
optionBuilder =>
{
optionBuilder.EnableStringComparisonTranslations(true);
optionBuilder.EnableRetryOnFailure();
});
}, ServiceLifetime.Transient);
}
......
......@@ -46,8 +46,8 @@ public static void AddDependencyInjectionConfiguration(this IServiceCollection s
#endregion redis
services.AddHostedService<QueuedHostedService>();
services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>();
//services.AddHostedService<QueuedHostedService>();
//services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>();
services.AddSingleton<IHubNotificationQueue, HubNotificationQueue>();
services
......
......@@ -19,20 +19,20 @@ public static void AddSwaggerConfiguration(this IServiceCollection services)
{
c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1.0", Title = "绩效API接口" });
//var xmlPath = new string[]
//{
// 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.EntityModels.xml"),
//};
var xmlPath = new string[]
{
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.EntityModels.xml"),
};
//foreach (var item in xmlPath)
//{
// c.IncludeXmlComments(item, true);
//}
foreach (var item in xmlPath)
{
c.IncludeXmlComments(item, true);
}
var xmlPathsss = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml");
c.IncludeXmlComments(xmlPathsss, true);
//var xmlPathsss = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml");
//c.IncludeXmlComments(xmlPathsss, true);
// Token绑定到ConfigureServices
var security = new OpenApiSecurityRequirement
......
......@@ -34,8 +34,9 @@ public class AllotController : Controller
private ILogger<AllotController> _logger;
private ClaimService _claim;
private LogManageService _logManageService;
private readonly TaskService _taskService;
private readonly CostTransferService costTransferService;
private IBackgroundTaskQueue _backgroundTaskQueue;
//private IBackgroundTaskQueue _backgroundTaskQueue;
private IServiceScopeFactory _serviceScopeFactory;
public AllotController(AllotService allotService,
......@@ -43,10 +44,11 @@ public class AllotController : Controller
ConfigService configService,
ILogger<AllotController> logger,
IWebHostEnvironment evn,
IBackgroundTaskQueue backgroundTaskQueue,
//IBackgroundTaskQueue backgroundTaskQueue,
IServiceScopeFactory serviceScopeFactory,
ClaimService claim,
LogManageService logManageService,
TaskService taskService,
CostTransferService costTransferService)
{
_allotService = allotService;
......@@ -55,9 +57,10 @@ public class AllotController : Controller
_evn = evn;
_claim = claim;
_logManageService = logManageService;
_taskService = taskService;
this.costTransferService = costTransferService;
_configService = configService;
_backgroundTaskQueue = backgroundTaskQueue;
//_backgroundTaskQueue = backgroundTaskQueue;
_serviceScopeFactory = serviceScopeFactory;
}
......@@ -231,6 +234,7 @@ public ApiResponse ImportExtraction(int allotId)
allot.Remark = EnumHelper.GetDescription(AllotStates.FileUploaded);
allot.UploadDate = DateTime.Now;
allot.Generate = (int)AllotGenerate.Init;
allot.IsModifyConfig = 1;
if (!_allotService.Update(allot))
return new ApiResponse(ResponseType.Fail, $"上传成功,修改状态失败");
_configService.Clear(allot.ID);
......@@ -252,28 +256,47 @@ public ApiResponse GenerateAsync([CustomizeValidator(RuleSet = "Delete"), FromBo
var allot = _allotService.GetAllot(request.ID);
if (null == allot || string.IsNullOrEmpty(allot.Path))
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"))
//{
// 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);
//}
//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");
......@@ -297,15 +320,16 @@ public ApiResponse GenerateReport([CustomizeValidator(RuleSet = "Delete"), FromB
if (null == allot || !states.Contains(allot.States))
throw new PerformanceException("当前绩效暂未生成,无法统计报表数据。");
_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
{
using (var scope = _serviceScopeFactory.CreateScope())
{
var scopedServices = scope.ServiceProvider.GetRequiredService<AllotService>();
scopedServices.GenerateReport(allot);
await Task.Delay(TimeSpan.FromSeconds(5), token);
}
});
//_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
//{
// using (var scope = _serviceScopeFactory.CreateScope())
// {
// var scopedServices = scope.ServiceProvider.GetRequiredService<AllotService>();
// scopedServices.GenerateReport(allot);
// await Task.Delay(TimeSpan.FromSeconds(5), token);
// }
//});
_taskService.Add(Background.JobType.报表, allot.ID.ToString());
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
#endregion
/// <summary>
/// 修改列头显示状态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("updateheadersstatus")]
[HttpPost]
public ApiResponse UpdateHeadersStatus([FromBody] ComputerAliasUpdate request)
{
if (_computeService.UpdateHeadersStatus(request))
return new ApiResponse(ResponseType.OK, "修改成功");
return new ApiResponse(ResponseType.OK, "修改失败");
}
/// <summary>
/// 自定义列头
/// </summary>
/// <param name="request"></param>
......
......@@ -18,11 +18,17 @@ namespace Performance.Api.Controllers
[Route("api/[controller]")]
public class ConfigController : Controller
{
private readonly ClaimService _claim;
private readonly ConfigService _configService;
private readonly AllotService _allotService;
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;
_allotService = allotService;
_dictionaryService = dictionaryService;
......@@ -620,8 +626,8 @@ public ApiResponse GetAccountingList([FromBody] AccoungingRequest request)
[HttpPost]
public ApiResponse AccountingInsert([FromBody] cof_accounting request)
{
if (request.AllotId == 0 || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.ParameterError);
if (request.AllotId == 0 || string.IsNullOrEmpty(request.Code) || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.ParameterError, "参数不允许为空");
var drugprop = _configService.AccountingInsert(request);
return new ApiResponse(ResponseType.OK, drugprop);
......@@ -672,6 +678,19 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
}
/// <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>
/// <param name="allotId"></param>
......@@ -882,7 +901,7 @@ public ApiResponse GetCustomList([FromBody] CustomPagingRequest request)
if (allot == null)
return new ApiResponse(ResponseType.ParameterError, "AllotID错误");
return _configService.QueryCustom(request);
return _configService.QueryCustom(_claim.GetUserId(), request);
}
/// <summary>
......
......@@ -319,18 +319,19 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any())
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 })
.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>
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0)
Value = s.Sum(sum => sum.Amount ?? 0),
Remark = s.FirstOrDefault()?.Remark ?? "",
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
......@@ -396,8 +397,7 @@ public ApiResponse DeleteApr([FromBody] IdRequest request)
public ApiResponse AuditResult([FromBody] AprAmountAuditRequest request)
{
var userid = claim.GetUserId();
var result = employeeService.ConfirmAudit(userid, request);
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败");
return employeeService.ConfirmAudit(userid, request);
}
/// <summary>
......@@ -463,20 +463,51 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId)
[HttpPost]
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 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);
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
......@@ -576,16 +607,19 @@ public ApiResponse GetAprHideDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any())
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 })
.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>
Detail = t.GroupBy(group => group.PerforType).Select(s => new
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0)
Value = s.Sum(sum => sum.Amount ?? 0),
Remark = s.FirstOrDefault()?.Remark ?? "",
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
......@@ -650,8 +684,7 @@ public ApiResponse DeleteAprHide([FromBody] IdRequest request)
public ApiResponse AuditResultHide([FromBody] AprAmountAuditRequest request)
{
var userid = claim.GetUserId();
var result = employeeService.ConfirmAuditHide(userid, request);
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败");
return employeeService.ConfirmAuditHide(userid, request);
}
/// <summary>
......@@ -717,8 +750,40 @@ public ApiResponse<List<TitleValue>> GetPerforTypeDictHide([FromRoute] int allot
[HttpPost]
public ApiResponse AprHideOverview(int allotId)
{
var relust = employeeService.GetOtherPerStatsHide(allotId);
return new ApiResponse(ResponseType.OK, relust);
//var relust = employeeService.GetOtherPerStatsHide(allotId);
//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
......
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
public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request)
{
request.CreateUser = claimService.GetUserId();
var employeee = personService.CreatePerson(request);
return employeee.Id > 0 ? new ApiResponse(ResponseType.OK, "添加成功!", employeee)
: new ApiResponse(ResponseType.Fail, "添加失败!");
return personService.CreatePerson(request);
}
/// <summary>
......@@ -73,9 +71,7 @@ public ApiResponse CreatePerson([FromBody] PerEmployeeResponse request)
[HttpPost]
public ApiResponse UpdatePerson([FromBody] PerEmployeeResponse request)
{
var result = personService.UpdatePerson(request);
return result ? new ApiResponse(ResponseType.OK, "修改成功!")
: new ApiResponse(ResponseType.OK, "修改失败!");
return personService.UpdatePerson(request);
}
/// <summary>
......@@ -93,6 +89,20 @@ public ApiResponse DeletePerson(int employeeId)
}
/// <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>
/// <returns></returns>
......@@ -239,11 +249,7 @@ public ApiResponse GetBatchPersonStructrue(int hospitalId)
[Route("person/{allotId}/BathSavePerson/{hospitalId}")]
public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData request)
{
var result = personService.BathSavePerson(allotId, hospitalId, request);
if (result)
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, "出勤天数或预留比例格式错误");
return personService.BathSavePerson(allotId, hospitalId, request);
}
/// <summary>
......
......@@ -348,7 +348,6 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTime request)
public ApiResponse GetWholeHospitalGrantSummary([FromBody] HospitalGrantSummary request)
{
return new ApiResponse(ResponseType.OK, "ok", _computeService.GetPerformanceSummary(request, "view_allot_sign_emp"));
}
/// <summary>
......
......@@ -19,16 +19,19 @@ public class ReportGlobalController : Controller
private readonly IWebHostEnvironment env;
private readonly AllotService allotService;
private readonly ReportGlobalService reportGlobalService;
private readonly ClaimService claimService;
public ReportGlobalController(
IWebHostEnvironment env,
AllotService allotService,
ReportGlobalService reportGlobalService
ReportGlobalService reportGlobalService,
ClaimService claimService
)
{
this.env = env;
this.allotService = allotService;
this.reportGlobalService = reportGlobalService;
this.claimService = claimService;
}
/// <summary>
......@@ -128,16 +131,17 @@ public ApiResponse Import(int hospitalId, [FromForm] IFormCollection form)
/// 获取人员标签配置
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("ReportPersonTag")]
[HttpPost]
public ApiResponse ReportPersonTag(int hospitalId)
public ApiResponse ReportPersonTag(int hospitalId, int allotId)
{
if (hospitalId<=0)
if (hospitalId <= 0)
{
return new ApiResponse(ResponseType.Fail,"参数错误", "hospitalId无效");
return new ApiResponse(ResponseType.Fail, "参数错误", "hospitalId无效");
}
var relust = reportGlobalService.GetReportPersonTag(hospitalId);
var relust = reportGlobalService.GetReportPersonTag(hospitalId, allotId);
return new ApiResponse(ResponseType.OK, relust);
}
......@@ -145,18 +149,18 @@ public ApiResponse ReportPersonTag(int hospitalId)
/// 保存科室标签配置
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("saveReportPersonTag")]
[Route("saveReportPersonTag/{allotId}")]
[HttpPost]
public ApiResponse SaveReportPersonTag(int hospitalId,[FromBody] SaveCollectData request)
public ApiResponse SaveReportPersonTag(int hospitalId, int allotId, [FromBody] SaveCollectData request)
{
if (hospitalId <= 0)
{
return new ApiResponse(ResponseType.Fail, "参数错误", "hospitalId无效");
}
reportGlobalService.SaveReportPersonTag(hospitalId,request);
return new ApiResponse(ResponseType.OK);
return reportGlobalService.SaveReportPersonTag(hospitalId, allotId, claimService.GetUserId(), request);
}
/// <summary>
......
......@@ -612,7 +612,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
if (allot == null)
throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department);
var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
......@@ -634,7 +634,7 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
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)
result.AddRange(checkData);
......@@ -681,7 +681,7 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
if (allot == null)
throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department);
var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
......@@ -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()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
......@@ -745,14 +745,17 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
var second = secondAllotService.GetSecondAllot(request.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);
if (allot == null)
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 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()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
// 二次分配提交数据格式 校验
......@@ -766,6 +769,13 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
if (cleanDatas == null || cleanDatas.Count == 0)
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);
return result ? new ApiResponse(ResponseType.OK) : new ApiResponse(ResponseType.Fail, "保存失败");
}
......@@ -804,11 +814,11 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
if (!new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }.Contains(allot.States))
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 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()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
......@@ -823,9 +833,21 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
if (cleanDatas == null || cleanDatas.Count == 0)
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);
if (saveResult)
{
var res = _redistributionService.ValidationData(second);
if (!string.IsNullOrEmpty(res))
return new ApiResponse(ResponseType.Fail, $"提交数据中存在无效数据,已经被删除,确认正确后请重新提交;删除工号清单如下:{res}");
var userid = claimService.GetUserId();
var result = secondAllotService.AuditSubmit(second, userid);
if (result)
......@@ -833,9 +855,9 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
}
return new ApiResponse(ResponseType.Fail, "提交失败");
}
catch (PerformanceException ex)
catch (PerformanceException)
{
throw ex;
throw;
}
catch (Exception ex)
{
......@@ -843,6 +865,21 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
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>
......@@ -876,7 +913,7 @@ public ApiResponse RedistributionDetail([FromBody] SecondBaseDto request)
if (allot == null)
throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department);
var loads = _redistributionService.GetWorkLoads(allot, second);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 返回信息
......
......@@ -37,6 +37,7 @@ public class TemplateController : Controller
private readonly HospitalService hospitalService;
private readonly AllotService allotService;
private readonly LogManageService logService;
private readonly TaskService _taskService;
private readonly IServiceScopeFactory serviceScopeFactory;
private readonly ExtractService extractService;
......@@ -52,6 +53,7 @@ public class TemplateController : Controller
HospitalService hospitalService,
AllotService allotService,
LogManageService logService,
TaskService taskService,
IServiceScopeFactory serviceScopeFactory,
ExtractService extractService)
{
......@@ -66,6 +68,7 @@ public class TemplateController : Controller
this.hospitalService = hospitalService;
this.allotService = allotService;
this.logService = logService;
_taskService = taskService;
this.serviceScopeFactory = serviceScopeFactory;
this.extractService = extractService;
}
......@@ -209,8 +212,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
if (allot == null)
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))
......@@ -224,62 +226,13 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
//检验科室、费用类型是否需要补充
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 (allot.IsExtracting == 1 && allot.ExtractTime.HasValue && DateTime.Now.AddHours(-3) < allot.ExtractTime)
// return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
//if (isSingle)
//{
logger.LogInformation("同一项目中进行提取");
_taskService.Add(Background.JobType.提取数据, JsonHelper.Serialize(new { request.AllotId, request.HospitalId, request.UseScheme, isSingle, filePath }));
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 });
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-1 判断上传绩效是否存在,并执行成功
// 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 System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
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;
using System;
namespace Performance.Api
{
......@@ -21,6 +13,8 @@ public JobRegistry(IServiceProvider provider)
Schedule(() => provider.GetService<ExtractGenerateJob>()).ToRunEvery(1).Days().At(23, 00);
//Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(60).Seconds();
Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(1).Days().At(3, 00);
Schedule(() => provider.GetService<BackgroundJob>()).ToRunNow().AndEvery(10).Seconds();
Schedule(() => provider.GetService<AutoSyncConfigJob>()).ToRunEvery(1).Days().At(0, 00);
}
}
}
......@@ -48,6 +48,9 @@
<Content Update="wwwroot\Performance.Api.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\Performance.DtoModels.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\Performance.EntityModels.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
......
......@@ -4,13 +4,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>True</DeleteExistingFiles>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\publish\jx.suvalue.com2</PublishUrl>
<PublishUrl>D:\publish\jx</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net5.0</TargetFramework>
......
......@@ -102,6 +102,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddTransient<ExtractGenerateJob>();
services.AddTransient<ExtractDataJob>();
services.AddTransient<ClearLoggerJob>();
services.AddTransient<BackgroundJob>();
services.AddTransient<AutoSyncConfigJob>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Default": "Information",
"System": "Information",
"Microsoft": "Information"
"Microsoft": "Warning"
}
},
"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;",
"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"
"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;"
},
"Application": {
//登录过期时间
......
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
"Default": "Information",
"System": "Information"
}
},
"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=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"
"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;"
},
"Application": {
//登录过期时间
......
......@@ -6,22 +6,7 @@
},
//连接字符串
"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;",
"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
"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;"
},
"Application": {
//登录过期时间
......@@ -51,5 +36,16 @@
"ImportFile": "http://localhost:5001/api/",
// 抽取uri
"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 @@
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 -->
<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}" />
<!--<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}" />-->
<!-- write log to mongodb-->
<!--<target xsi:type="Mongo"
......@@ -49,9 +49,9 @@
<logger name="*" minlevel="Trace" writeTo="allfile" />
<!--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 -->
<logger name="*" minlevel="Trace" writeTo="ownFile-web" />
<!--<logger name="*" minlevel="Trace" writeTo="ownFile-web" />-->
<!--Add logs to mongodb-->
<!--<logger name="*" minlevel="Trace" writeTo="mongo"/>-->
......
UvHeSCNjMucE7mxfpB2wK1XQVSrGyXzxtRzclDPX+IoTYesKy64t4LEB4RpXEkF6lr8f9+GFSX0FPokmRGOzmP/Z+1kYdcu1FnA6DKI5izIe8BmL4GrGzyJYfxrPju8UzHiMexCHBxwzg7KrASjQBuzGS8UDvmOM5+ycZgar3h9zuG//kS9am2+a6BnWYk0iEOH7PGqo/QUOzN7hiSTF6y+Bl0ZmwdFy88sfBDccL9oZ4IbiM1I/zZjC1E4f6A97Tdr6h+BJ7e6kClrbk7TbOGMYKi5JY3CKCmVtCEUSvNriiHlazneLYYIDLFtjpor/9xfG+EDjrPANGtijoNi4YQ==
\ No newline at end of file
l4vo44Pp0mWIrTObcc2fo3aLq2gq2AFd553jQa5BciBcGR0R+L6ubgnGQBbtx7JxTs+kzGnurRVqKQst0ZoIFaXt9P2RXRnhdXAcqrkLr3wZTpO6yD2dZlAKcj6TwIKqoS6klzc/QECX1kOZNVxc7D476x03JP0Uszx/hVfQDlZBHPL+VO6dC1a2Y+izo3Ofys8W+KaIYE8SJdyDgd0a0GPaTNxwxT9tkVSXWG6/7vxc5UCytdhgJzhUf7q3XCnt3AddW6buWdUcPLIY5Hyr1P1GNCS0dbUBwYT1rwjRSMBeTxLFJHuJFl2vLeW0kVCn1LmQlp9qLkZ0O73m2RNuig==
\ No newline at end of file
......@@ -914,11 +914,6 @@
人员工号
</summary>
</member>
<member name="P:Performance.DtoModels.PerData.Annotation">
<summary>
单元格注释
</summary>
</member>
<member name="P:Performance.DtoModels.PerData.Remark">
<summary>
单元格备注
......
......@@ -1595,6 +1595,16 @@
排序
</summary>
</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">
<summary>
......@@ -1620,6 +1630,21 @@
核算单元
</summary>
</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">
<summary>
......@@ -1700,6 +1725,11 @@
状态 1 求和 0 不求和
</summary>
</member>
<member name="P:Performance.EntityModels.cof_alias.Sort">
<summary>
排序
</summary>
</member>
<member name="T:Performance.EntityModels.cof_check">
<summary>
上传excel文件校验配置
......@@ -3634,6 +3664,11 @@
</summary>
</member>
<member name="P:Performance.EntityModels.ex_script.Name">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ex_script.ExecScript">
<summary>
执行sql
......@@ -3654,6 +3689,21 @@
是否可用 1 可用 2 不可用
</summary>
</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">
<summary>
......@@ -5905,6 +5955,11 @@
自定义提取绩效数据文件生成路径
</summary>
</member>
<member name="P:Performance.EntityModels.per_allot.IsModifyConfig">
<summary>
是否修改过配置 1修改过 0未修改
</summary>
</member>
<member name="T:Performance.EntityModels.per_apr_amount">
<summary>
......@@ -8320,14 +8375,14 @@
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospitalconfig.Type">
<member name="P:Performance.EntityModels.sys_hospitalconfig.DataBaseType">
<summary>
1 标准库 2 绩效库
1、Sql Server 2、Orcale
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospitalconfig.DataBaseType">
<member name="P:Performance.EntityModels.sys_hospitalconfig.IsConnectioned">
<summary>
1、Sql Server 2、Orcale
</summary>
</member>
<member name="T:Performance.EntityModels.sys_menu">
......@@ -8635,6 +8690,11 @@
</summary>
</member>
<member name="T:Performance.EntityModels.sys_version">
<summary>
sys_version
</summary>
</member>
<member name="T:Performance.EntityModels.view_dic_category_factor">
<summary>
......
......@@ -2,10 +2,7 @@
using Performance.DtoModels.Request;
using Performance.EntityModels;
using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.DtoModels.AutoMapper
{
......@@ -255,8 +252,27 @@ public AutoMapperConfigs()
CreateMap<ex_result, ex_result_gather>()
.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>()
.ReverseMap();
CreateMap<cof_again,CofAgainRequest>().ReverseMap();
}
}
}
......@@ -132,6 +132,37 @@ public enum Role
特殊科室 = 9,
行政科室 = 10,
数据收集 = 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
/// 人员工号
/// </summary>
public string JobNumber { get; set; }
/// <summary>
/// 单元格注释
/// </summary>
public string Annotation { get; set; }
///// <summary>
///// 单元格注释
///// </summary>
//public string Annotation { get; set; }
/// <summary>
/// 单元格备注
/// </summary>
......
......@@ -54,6 +54,19 @@ public class ComputerAliasRequest
public string[] Heads { get; set; }
}
public class ComputerAliasUpdate
{
public int HospitalId { get; set; }
public string Route { get; set; }
public List<ComputerAliasHead> computerAliasHead { get; set; }
}
public class ComputerAliasHead
{
public string Head { get; set; }
public int HeadId { get; set; }
public int Sort { get; set; }
}
public class BeginEndTime
{
public string BeginTime { get; set; } // 2021-01
......
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
{
get
{
var value = ConvertHelper.To<decimal?>(cellValue);
var value = ConvertHelper.ToDecimalOrNull(cellValue);
if (value.HasValue && value.Value > 0)
return Math.Round(value.Value, 2);
return cellValue;
......
......@@ -15,6 +15,8 @@ public enum ResponseType
Disable = 7,
TooManyRequests = 8,
Warning = 9,
WarningTable = 10,
Expiration = 99,
}
}
......@@ -57,6 +57,7 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<as_tempassess> as_tempassess { get; set; }
/// <summary> 考核列头 </summary>
public virtual DbSet<as_tempcolumns> as_tempcolumns { get; set; }
public virtual DbSet<bg_task> bg_task { get; set; }
/// <summary> </summary>
public virtual DbSet<cof_accounting> cof_accounting { get; set; }
/// <summary> </summary>
......@@ -243,5 +244,6 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<sys_user_hospital> sys_user_hospital { get; set; }
/// <summary> 用户角色关联表 </summary>
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
/// 核算单元
/// </summary>
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
/// <summary>
/// 状态 1 可用 0 禁用
/// </summary>
public Nullable<int> States { get; set; }
public int States { get; set; }
/// <summary>
/// 状态 1 求和 0 不求和
/// </summary>
public Nullable<int> SumStatus { get; set; }
public int SumStatus { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
}
}
......@@ -76,9 +76,9 @@ public class ex_result
/// </summary>
public Nullable<DateTime> CreateTime { get; set; }
/// <summary>
/// 1 删除 0 未删除
/// </summary>
// public int IsDelete { get; set; }
// /// <summary>
// /// 1 删除 0 未删除
// /// </summary>
public int IsDelete { get; set; }
}
}
......@@ -46,9 +46,9 @@ public class ex_result_gather
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 1 未通过 2 通过
/// </summary>
// /// <summary>
// /// 1 未通过 2 通过
// /// </summary>
// public int States { get; set; }
}
}
......@@ -21,6 +21,11 @@ public class ex_script
public int Id { get; set; }
/// <summary>
///
/// </summary>
public string Name { get; set; }
/// <summary>
/// 执行sql
/// </summary>
public string ExecScript { get; set; }
......@@ -39,5 +44,20 @@ public class ex_script
/// 是否可用 1 可用 2 不可用
/// </summary>
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
/// 自定义提取绩效数据文件生成路径
/// </summary>
public string CustomExtractPath { get; set; }
/// <summary>
/// 是否修改过配置 1修改过 0未修改
/// </summary>
public int IsModifyConfig { get; set; }
}
}
......@@ -24,7 +24,7 @@ public class sys_hospitalconfig
/// <summary>
///
/// </summary>
public Nullable<int> HospitalId { get; set; }
public int HospitalId { get; set; }
/// <summary>
///
......@@ -52,13 +52,13 @@ public class sys_hospitalconfig
public string DbPassword { get; set; }
/// <summary>
/// 1 标准库 2 绩效库
/// 1、Sql Server 2、Orcale
/// </summary>
public Nullable<int> Type { get; set; }
public int DataBaseType { get; set; }
/// <summary>
/// 1、Sql Server 2、Orcale
///
/// </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
{
public int HospitalId { get; set; }
public int AllotID { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int UnitType { get; set; }
public int AccountingUnit { get; set; }
public int PerforFee { get; set; }
public int WorkloadFee { get; set; }
public int AssessBeforeOtherFee { get; set; }
public int PerforTotal { get; set; }
public int ScoringAverage { get; set; }
public int Extra { get; set; }
public int MedicineExtra { get; set; }
public int MaterialsExtra { get; set; }
public int AssessLaterOtherFee { get; set; }
public int AssessLaterPerforTotal { get; set; }
public int AdjustFactor { get; set; }
public int AdjustLaterOtherFee { get; set; }
public int AprPerforAmount { get; set; }
public int HideAprOtherPerforAmount { get; set; }
public int AssessLaterManagementFee { get; set; }
public int RealGiveFee { get; set; }
public string Year { get; set; }
public string Month { get; set; }
public string Code { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public decimal PerforFee { get; set; }
public decimal WorkloadFee { get; set; }
public decimal AssessBeforeOtherFee { get; set; }
public decimal PerforTotal { get; set; }
public decimal ScoringAverage { get; set; }
public decimal Extra { get; set; }
public decimal MedicineExtra { get; set; }
public decimal MaterialsExtra { get; set; }
public decimal AssessLaterOtherFee { get; set; }
public decimal AssessLaterPerforTotal { get; set; }
public decimal AdjustFactor { get; set; }
public decimal AdjustLaterOtherFee { get; set; }
public decimal AprPerforAmount { get; set; }
public decimal HideAprOtherPerforAmount { get; set; }
public decimal AssessLaterManagementFee { get; set; }
public decimal RealGiveFee { get; set; }
}
}
namespace Performance.DtoModels
{
public class view_allot_sign_emp
public class view_allot_sign_emp_finance
{
public int HospitalID { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int Source { 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 HospitalID { get; set; }
public string Year { get; set; }
public string Month { get; set; }
public string AllotId { get; set; }
public string JobNumber { get; set; }
public string EmployeeName { get; set; }
public string JobTitle { get; set; }
public string Emp_UnitType { get; set; }
public string Emp_AccountingUnit { get; set; }
public string Code { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public string BankCard { get; set; }
public string Batch { get; set; }
public string JobCategory { get; set; }
public string Duty { get; set; }
public string TitlePosition { get; set; }
public string PerforSumFee { get; set; }
public decimal PerforSumFee { get; set; }
public decimal PerforManagementFee { get; set; }
public decimal NightWorkPerfor { get; set; }
public decimal AdjustLaterOtherFee { get; set; }
......@@ -32,4 +26,15 @@ public class view_allot_sign_emp
public decimal ReservedRatioFee { 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(
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))
{
DateTime ret = defaultValue;
......@@ -46,23 +63,28 @@ public static DateTime TryDateTime(string inValue, DateTime defaultValue = defau
/// <returns></returns>
public static T To<T>(object value, T defaultValue = default(T))
{
try
{
var t = typeof(T);
//兼容可空类型转换
if (t.IsGenericType && t.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
{
if (value == null)
{
return default(T);
}
return defaultValue;
if (value is string && string.IsNullOrWhiteSpace(value.ToString()))
return defaultValue;
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;
}
......
......@@ -483,6 +483,8 @@ public static string FileToString(string filePath, Encoding encoding)
/// <param name="filePath">文件的绝对路径</param>
public static string GetFileName(string filePath)
{
if (string.IsNullOrEmpty(filePath))
return string.Empty;
//获取文件的名称
FileInfo fi = new FileInfo(filePath);
return fi.Name;
......
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -42,5 +43,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId)
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
/// <returns></returns>
public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(ComparisonPagingRequest request)
{
var queryData = @"
var queryData = $@"
SELECT
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
......@@ -73,7 +73,7 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari
) TAB
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
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 = @"
......@@ -86,7 +86,7 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari
";
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,
};
}
......@@ -96,13 +96,13 @@ public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(Compari
/// </summary>
public DtoModels.Comparison<view_check_emp> CheckAccountingUnitRealGiveFeeDiff(ComparisonPagingRequest request)
{
var queryData = @"
var queryData = $@"
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_specialunit WHERE AllotId = @allotId
) TAB
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 = @"
......@@ -114,7 +114,7 @@ public DtoModels.Comparison<view_check_emp> CheckAccountingUnitRealGiveFeeDiff(C
";
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,
};
}
......
......@@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.EntityModels.Other;
using System;
using System.Collections.Generic;
using System.Data;
......@@ -417,7 +418,8 @@ public List<dynamic> QueryComputeByDate(string viewName, BeginEndTime request)
if (!string.IsNullOrEmpty(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();
}
......@@ -431,13 +433,13 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
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_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_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" } },
};
......@@ -452,22 +454,11 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
if (!string.IsNullOrEmpty(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"];*/
{
switch (viewName)
{
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)}";
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"])}";
}
else
{
......@@ -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)
{
var result = new CustonPagingData();
......@@ -518,12 +539,12 @@ public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
return result;
}
public bool QueryIsAllotId(string tableName)
public bool QueryIsAllotId(string tableName, params string[] columns)
{
var database = context.Database.GetDbConnection().Database;
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');";
var result = DapperQuery<string>(sql, new { database = database, table_name = tableName });
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, columns });
var isExist = result?.Count() == 3;
......@@ -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 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 result = DapperQuery<dynamic>(sql, new { table_schema = database, table_name = tableName })?.ToList();
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<ColumnEntity>(sql, new { table_schema = database, table_name = tableName })?.ToList();
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
/// </summary>
public partial class PerforExtypeRepository : PerforRepository<ex_type>
{
private readonly PerformanceDbContext _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
{
var athead = header.Children.ElementAt(c);
//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)
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
{
RowNumber = r,
......@@ -117,13 +117,13 @@ private static PerAgainEmployee FixatRowRead(List<PerHeader> perHeader, int r, I
RowNumber = r,
Name = 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()),
Attendance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤").PointCell)?.ToString()),
YearFactor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "年资").PointCell)?.ToString()),
Award = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "重点奖励").PointCell)?.ToString()),
Allowance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "管理津贴").PointCell)?.ToString()),
AlonePerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "单独核算人员绩效").PointCell)?.ToString()),
NightShift = 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.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤").PointCell)?.ToString()),
YearFactor = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "年资").PointCell)?.ToString()),
Award = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "重点奖励").PointCell)?.ToString()),
Allowance = ConvertHelper.ToDecimalOrNull(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "管理津贴").PointCell)?.ToString()),
AlonePerfor = ConvertHelper.ToDecimalOrNull(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)
{
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();
int generate = allot.Generate;
if (new int[] { (int)AllotGenerate.OriginalDataEdited, (int)AllotGenerate.PersonnelOffice }.Contains(allot.Generate))
......@@ -344,7 +345,6 @@ public void Generate(per_allot allot)
// 导出数据
excel = importDataService.ReadDataAndSave(allot);
UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
//if (!checkDataService.Check(excel, allot))
//{
// UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
......
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 @@
// var value = deptData.FirstOrDefault(t => t.TypeName == headName)?.CellValue ?? "0";
// if (isIncom)
// {
// var cellvalue = value == "0" ? null : ConvertHelper.To<decimal?>(value);
// var cellvalue = value == "0" ? null : ConvertHelper.ToDecimalOrNull(value);
// OutToExcelCell<decimal>(newCell, cellvalue);
// newCell.CellStyle = style;
// }
// 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);
// if (header != null && header.Contains(headName))
// newCell.CellStyle = style;
......
......@@ -78,38 +78,35 @@ public List<ex_module> QueryModule(int hospitalId)
DefaultModules(hospitalId);
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;
}
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.1.1 门诊开单收入", SheetType = (int)SheetType.Income },
new ex_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income },
new ex_module{ ModuleName = "1.2.1 住院开单收入", SheetType = (int)SheetType.Income },
new ex_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income },
new ex_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend },
new ex_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload },
new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload },
new ex_module{ ModuleName = "1.0.1 额外收入", SheetType = (int)SheetType.OtherIncome, ReadOnly = 0 },
new ex_module{ ModuleName = "1.1.1 门诊开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.1.2 门诊执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.1 住院开单收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "1.2.2 住院执行收入", SheetType = (int)SheetType.Income, ReadOnly = 1 },
new ex_module{ ModuleName = "2.1 成本支出统计表", SheetType = (int)SheetType.Expend, ReadOnly = 0 },
new ex_module{ ModuleName = "3.1 医生组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
new ex_module{ ModuleName = "3.2 护理组工作量绩效测算表", SheetType = (int)SheetType.Workload, ReadOnly = 0 },
};
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())
{
var modules = inexistence.Select(t => new ex_module
inexistence.ForEach(t =>
{
HospitalId = hospitalId,
ModuleName = t.ModuleName,
SheetType = (int)t.SheetType,
ReadOnly = t.SheetType == (int)SheetType.Income ? 0 : 1,
TypeId = null,
t.HospitalId = hospitalId;
});
exmoduleRepository.AddRange(modules.ToArray());
exmoduleRepository.AddRange(inexistence.ToArray());
}
}
......
......@@ -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);
if (hisScrips == null || !hisScrips.Any()) return;
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, isSingle);
HisData(allot, configs.FirstOrDefault(t => t.Id == item.ConfigId), item, groupName, isSingle);
}
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取HIS数据完成", isSingle: isSingle);
}
catch (Exception)
{
......@@ -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
{
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”数据", isSingle: isSingle);
if (config == null || string.IsNullOrEmpty(script.ExecScript)) return;
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
CreateTime = DateTime.Now,
});
hisdataRepository.AddRange(insertData.ToArray());
logService.ReturnTheLog(allot.ID, groupName, 2, "提取数据", $"提取“{script.SourceType} - {script.Category}”完成", isSingle: isSingle);
}
catch (Exception ex)
{
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
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = createTime,
IsDelete = 0,
}).ToList();
exresultRepository.AddRange(result.ToArray());
}
......
......@@ -225,6 +225,12 @@ public static string NoBlank(this string @string)
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)
{
IWorkbook workbook = null;
......@@ -282,7 +288,9 @@ public static void EvaluateAll(this IWorkbook workbook)
{
try
{
workbook.GetCreationHelper().CreateFormulaEvaluator().EvaluateAll();
var creation = workbook.GetCreationHelper();
var formula = creation?.CreateFormulaEvaluator();
formula?.EvaluateAll();
}
catch
{
......
......@@ -54,18 +54,22 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
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))
{
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)
{
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 copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true);
var newSheet = copysheet.CopySheet(name, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
}
}
......@@ -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))
{
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)
{
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First();
var copysheet = workbook.GetSheet(item.Key);
if (copysheet == null) continue;
var newSheet = copysheet.CopySheet(module.ModuleName, true);
var newSheet = copysheet.CopySheet(name, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
var point = PerSheetDataFactory.GetDataRead(SheetType.Workload)?.Point;
......
......@@ -158,8 +158,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
string department = row.GetOrCreate(dataFirstCellNum - 1).GetDecodeEscapes();
if (string.IsNullOrEmpty(department)) continue;
if (rowIndex > dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
if (rowIndex >= dataFirstRowNum) dataFirstRowNum = rowIndex + 1;
var deptData = data.Where(t => t.Department.NoBlank() == department);
if (deptData == null || !deptData.Any(t => t.Value.HasValue && t.Value != 0)) continue;
......@@ -216,7 +215,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
filed = sheet.SheetName.Contains("医生") ? fieldDoctor : fieldNurse;
}
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -224,23 +223,24 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
foreach (string department in departments)
{
var deptData = data.Where(t => (t.Department ?? "") == department);
if (deptData == null || !deptData.Any()) continue;
var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes();
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")");
var cell = row.CreateCell(cellIndex);
if (filed.ContainsKey(column))
{
cell.SetCellOValue(filed[column]?.Invoke(deptData.First()));
cell.CellStyle = deptStyle;
var value = (deptData != null && deptData.Any()) ? filed[column]?.Invoke(deptData.First()) : "";
cell.SetCellOValue(value);
cell.CellStyle = cellStyle;
}
else if (sheetType == SheetType.Income || (headers != null && headers.Contains(column)))
{
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
if (value.HasValue && value != 0)
var value = (deptData != null && deptData.Any())
? deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value
: 0;
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
......@@ -253,7 +253,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
List<ExtractTransDto> data, List<IncomeRow> incomes, int dataFirstRowNum)
{
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -264,8 +264,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var row = sheet.GetOrCreate(dataFirstRowNum);
var deptData = data.Where(t => t.Department == item.Department);
if (deptData == null || !deptData.Any()) continue;
if (deptData != null && deptData.Any())
{
var deptContents = new Dictionary<int, string>
{
{ 1, item.Department },
......@@ -284,20 +284,16 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
{
var cell = row.GetOrCreate(dataFirstCellNum - content.Key);
cell.SetCellValue(content.Value);
cell.CellStyle = deptStyle;
cell.CellStyle = cellStyle;
}
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
//if (cell.CellType != CellType.Formula)
//{
// cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
......@@ -355,12 +351,7 @@ public static string HasValue(params string[] list)
private static readonly Dictionary<string, Func<ExtractTransDto, string>> fieldDoctor = new Dictionary<string, Func<ExtractTransDto, string>>
{
{ "科室名称", (dto) => dto.Department },
{ "核算单元", (dto) =>
{
var obj = new string []{ dto.OutDoctorAccounting, dto.InpatDoctorAccounting, dto.OutTechnicAccounting, dto.InpatTechnicAccounting }
.FirstOrDefault(t => !string.IsNullOrEmpty(t));
return obj;
}
{ "核算单元", (dto) => new string []{ dto.OutDoctorAccounting, dto.InpatDoctorAccounting, dto.OutTechnicAccounting, dto.InpatTechnicAccounting }.FirstOrDefault(t => !string.IsNullOrEmpty(t))
},
};
......@@ -464,7 +455,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
? collectWork
: new SheetType[] { SheetType.OtherIncome, SheetType.Expend }.Contains(sheetType) ? collectIncome : collectDept;
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -477,13 +468,13 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
var row = sheet.GetOrCreate(dataFirstRowNum);
for (int cellIndex = point.HeaderFirstCellNum.Value; cellIndex < columnHeader.LastCellNum; cellIndex++)
{
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes();
var column = columnHeader.GetCell(cellIndex).GetDecodeEscapes()?.Replace("(", "(").Replace(")", ")");
var cell = row.CreateCell(cellIndex);
if (filed.ContainsKey(column))
{
cell.SetCellOValue(filed[column]?.Invoke(deptData.First()));
cell.CellStyle = deptStyle;
cell.CellStyle = cellStyle;
}
else if (sheetType == SheetType.Income || (headers != null && headers.Contains(column)))
{
......@@ -500,7 +491,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
List<collect_data> data, List<IncomeRow> incomes, int dataFirstRowNum)
{
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
var deptStyle = style.GetCellStyle();
//var deptStyle = style.GetCellStyle();
headers = headers.Select(t => t.NoBlank()).ToList();
......@@ -525,7 +516,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
{
var cell = row.GetOrCreate(dataFirstCellNum - content.Key);
cell.SetCellValue(content.Value);
cell.CellStyle = deptStyle;
cell.CellStyle = cellStyle;
}
for (int cellIndex = dataFirstCellNum; cellIndex < columnHeader.LastCellNum; cellIndex++)
......
......@@ -100,20 +100,21 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle);
queryService.ClearConnectionPools();
queryService.ClearHistoryData(allot.ID, groupName, isSingle);
employeeService.SyncDataToResult(allotId);
var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
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);
var statesArray = new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive };
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("抽取文件创建失败");
......@@ -232,10 +233,10 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
var customer = factory.GetWriteData(sheetType, logger);
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);
var exdata = extractDto.Where(t => t.SheetName.NoBlank() == sheetName)?.ToList();
var exdata = extractDto.Where(t => t.SheetName.StartsWith(sheetName.GetNo()))?.ToList();
if (exdata != null)
{
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
/// <summary>
/// 标准数据格式, 匹配科室字典
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="results"></param>
/// <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>();
......@@ -307,42 +309,45 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
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 })
.Select(t =>
var data = new List<ExtractTransDto>();
foreach (var item in results)
{
var dept = !string.IsNullOrEmpty(t.inner.FirstOrDefault()?.Department) ? t.inner.FirstOrDefault()?.Department : t.outer.Department;
return new ExtractTransDto
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
{
SheetName = t.outer.Source,
SheetName = item.Source,
Department = dept,
Category = t.outer.Category,
DoctorName = t.outer.DoctorName,
PersonnelNumber = t.outer.PersonnelNumber,
Value = t.outer.Fee ?? 0,
OutDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutDoctorAccounting?.AccountingUnit,
OutNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutNurseAccounting?.AccountingUnit,
OutTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatDoctorAccounting?.AccountingUnit,
InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName,
Category = item.Category,
DoctorName = item.DoctorName,
PersonnelNumber = item.PersonnelNumber,
Value = item.Fee ?? 0,
OutDoctorAccounting = firstDic?.OutDoctorAccounting?.AccountingUnit,
OutNurseAccounting = firstDic?.OutNurseAccounting?.AccountingUnit,
OutTechnicAccounting = firstDic?.OutTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = firstDic?.InpatDoctorAccounting?.AccountingUnit,
InpatNurseAccounting = firstDic?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = firstDic?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = firstDic?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName,
};
});
data.Add(d);
}
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,
Category = t.Key.Category,
Value = t.Sum(group => group.Value) == 0 ? null : t.Sum(group => group.Value),
OutDoctorAccounting = t.FirstOrDefault()?.OutDoctorAccounting,
OutNurseAccounting = t.FirstOrDefault()?.OutNurseAccounting,
OutTechnicAccounting = t.FirstOrDefault()?.OutTechnicAccounting,
InpatDoctorAccounting = t.FirstOrDefault()?.InpatDoctorAccounting,
InpatNurseAccounting = t.FirstOrDefault()?.InpatNurseAccounting,
InpatTechnicAccounting = t.FirstOrDefault()?.InpatTechnicAccounting,
SpecialAccounting = t.FirstOrDefault()?.SpecialAccounting,
OutDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutDoctorAccounting))?.OutDoctorAccounting,
OutNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutNurseAccounting))?.OutNurseAccounting,
OutTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.OutTechnicAccounting))?.OutTechnicAccounting,
InpatDoctorAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatDoctorAccounting))?.InpatDoctorAccounting,
InpatNurseAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatNurseAccounting))?.InpatNurseAccounting,
InpatTechnicAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.InpatTechnicAccounting))?.InpatTechnicAccounting,
SpecialAccounting = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.SpecialAccounting))?.SpecialAccounting,
EName = t.FirstOrDefault(w => !string.IsNullOrEmpty(w.EName))?.EName
});
......
......@@ -62,6 +62,14 @@ PerforPerallotRepository perallotRepository
private static Dictionary<int, IDbConnection> pools = new Dictionary<int, IDbConnection>();
/// <summary>
/// 清理数据库连接池
/// </summary>
public void ClearConnectionPools()
{
pools.Clear();
}
/// <summary>
/// 获取抽取数据
/// </summary>
/// <param name="hospitalId"></param>
......@@ -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))
{
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
{
......@@ -224,6 +236,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
IsDelete = 0,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
......@@ -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))
{
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
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
......@@ -297,6 +315,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
IsDelete = 0,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
......@@ -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))
{
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
{
var querydata = QueryData<ExtractDto>(config, script.ExecScript, allot, isSingle);
......@@ -366,6 +390,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
ConfigId = config.Id,
AllotId = allot.ID,
CreateTime = CreateTime,
IsDelete = 0,
}).ToList();
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
......@@ -427,15 +452,16 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
try
{
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}条记录");
return result;
}
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;
}
}
/// <summary>
......@@ -455,6 +481,26 @@ public IEnumerable<T> QueryData<T>(sys_hospitalconfig config, string execsql, pe
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
}
}
......@@ -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)
{
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 (data is List<ExtractTransDto> extractDto && extractDto.Any())
......
......@@ -50,7 +50,7 @@ public List<HospitalResponse> GetUserHopital(int userid)
var hosList = _hospitalRepository.GetEntities(t => joinList.Select(j => j.HospitalID).Contains(t.ID));
var hosId = hosList?.Select(item => item.ID).ToList();
//获取存在数据记录的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
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
// switch (cell.CellType)
// {
// case CellType.Numeric:
// return ConvertHelper.To<decimal?>(cell.NumericCellValue);
// return ConvertHelper.ToDecimalOrNull(cell.NumericCellValue);
// case CellType.String:
// return ConvertHelper.To<decimal?>(cell.StringCellValue);
// return ConvertHelper.ToDecimalOrNull(cell.StringCellValue);
// case CellType.Formula:
// return ConvertHelper.To<decimal?>(cell.NumericCellValue);
// return ConvertHelper.ToDecimalOrNull(cell.NumericCellValue);
// }
// }
// catch (Exception ex)
......
......@@ -51,7 +51,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
var athead = vhead.ElementAt(c);
//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)
continue;
......@@ -63,7 +63,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value).GetValue(),
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
FactorValue = 1,
IsFactor = true,
};
......
......@@ -69,7 +69,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
var athead = vhead.ElementAt(c);
//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)
continue;
PerData data = new PerData
......@@ -80,9 +80,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
dataList.Add(data);
......@@ -111,9 +111,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = cellValue,
TypeName = athead?.CellValue,
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, //手动匹配
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,
};
dataList.Add(data);
......
......@@ -44,7 +44,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
@object = ConvertHelper.ToDecimalOrNull(@object);
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
......
......@@ -46,7 +46,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
var athead = vhead.ElementAt(c);
//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)
continue;
......@@ -58,7 +58,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
//Department = NopiSevice.GetCellStringValue(row.GetCell(unit.DeptCellNum.Value)),
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = row.GetCell(0)?.ToString(),
FactorValue = 0,
IsFactor = false,
......
......@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
@object = ConvertHelper.ToDecimalOrNull(@object);
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
......
......@@ -72,7 +72,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
if (!string.IsNullOrEmpty(athead?.CellValue) && athead.CellValue.Contains("备注"))
continue;
//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)
continue;
......@@ -84,9 +84,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
var lastcell = vhead.OrderByDescending(t => t.PointCell).First();
......
......@@ -68,7 +68,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
var athead = vhead.ElementAt(c);
//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)
continue;
PerData data = new PerData
......@@ -79,9 +79,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
......
......@@ -41,7 +41,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
@object = ConvertHelper.ToDecimalOrNull(@object);
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
......
......@@ -68,7 +68,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
var athead = vhead.ElementAt(c);
//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)
continue;
PerData data = new PerData
......@@ -79,9 +79,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
Department = row.GetCell(unit.DeptCellNum.Value).GetValue(),
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
......
......@@ -51,7 +51,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
var athead = vhead.ElementAt(c);
//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)
continue;
......@@ -63,7 +63,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value).GetValue(),
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
FactorValue = 1,
IsFactor = true,
};
......
......@@ -55,13 +55,13 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
if (NopiSevice.TryGetPoint(perHeader, "量化指标", out point))
specialUnit.QuantitativeIndicators = row.GetCell(point).GetValue();
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))
specialUnit.QuantitativeIndicatorsValue = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
specialUnit.QuantitativeIndicatorsValue = ConvertHelper.ToDecimalOrNull(row.GetCell(point).GetValue());
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))
specialUnit.RealGiveFee = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
specialUnit.RealGiveFee = ConvertHelper.ToDecimalOrNull(row.GetCell(point).GetValue());
ICell cell = null;
if (NopiSevice.TryGetPoint(perHeader, "科室", out int kspoint))
......@@ -84,10 +84,10 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
specialUnit.AccountingUnit = accountingUnit;
specialUnit.Department = accountingUnit;
//specialUnit.ScoringAverage = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue);
//specialUnit.OtherPerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue);
//specialUnit.Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue);
//specialUnit.Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.NumericCellValue);
//specialUnit.ScoringAverage = ConvertHelper.ToDecimalOrNull(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.ToDecimalOrNull(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)
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