Commit 527ea30b by ruyun.zhang@suvalue.com

Merge branch 'release/V20220107绩效v22.1.7'

parents e1197a0e 573f6615
...@@ -74,6 +74,22 @@ public ApiResponse<List<res_specialunit>> GetSpecial([FromBody] ComputerRequest ...@@ -74,6 +74,22 @@ public ApiResponse<List<res_specialunit>> GetSpecial([FromBody] ComputerRequest
} }
/// <summary> /// <summary>
/// 医技组科室绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getmedicaldata")]
[HttpPost]
public ApiResponse<List<DeptResponse>> GetMedicalTechnician([FromBody] ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetMedicalPerformance(request.AllotId);
return new ApiResponse<List<DeptResponse>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// 医生组科室绩效列表 /// 医生组科室绩效列表
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
...@@ -386,8 +402,14 @@ public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest ...@@ -386,8 +402,14 @@ public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest
[HttpPost] [HttpPost]
public ApiResponse CustomColumnHeaders([FromBody] ComputerAliasRequest request) public ApiResponse CustomColumnHeaders([FromBody] ComputerAliasRequest request)
{ {
var result = _computeService.CustomColumnHeaders(request.HospitalId, request.Route); if (request.Heads != null)
for (int i = 0; i < request.Heads.Length; i++)
{
request.Heads[i] = request.Heads[i].ToLower();
}
var result = _computeService.CustomColumnHeaders(request.HospitalId, request.Route, request.Heads);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
/// <summary> /// <summary>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.DtoModels.Request;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services; using Performance.Services;
...@@ -318,6 +319,8 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request) ...@@ -318,6 +319,8 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any()) if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee); return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new
{ {
PersonnelNumber = t.Key.PersonnelNumber, PersonnelNumber = t.Key.PersonnelNumber,
...@@ -736,6 +739,22 @@ public ApiResponse GetDeptComparison([FromBody] ComparisonPagingRequest request) ...@@ -736,6 +739,22 @@ public ApiResponse GetDeptComparison([FromBody] ComparisonPagingRequest request)
return new ApiResponse(ResponseType.OK, relust); return new ApiResponse(ResponseType.OK, relust);
} }
/// <summary>
/// 实发绩效校验
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("getDeptComparisonTotal/{allotId}")]
[HttpPost]
public ApiResponse GetDeptComparisonTotal([FromRoute] int allotId)
{
var allot = allotService.GetAllot(allotId);
if (allot == null)
return new ApiResponse(ResponseType.ParameterError, "allotId无效");
var relust = employeeService.GetDeptComparisonTotal(allotId);
return new ApiResponse(ResponseType.OK, relust);
}
#region 手工录入 #region 手工录入
/// <summary> /// <summary>
...@@ -767,7 +786,6 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ ...@@ -767,7 +786,6 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ
{ {
if (allotId <= 0) if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var relust = employeeService.GetGatherHands(allotId, request); var relust = employeeService.GetGatherHands(allotId, request);
return new ApiResponse(ResponseType.OK, relust); return new ApiResponse(ResponseType.OK, relust);
} }
...@@ -780,14 +798,19 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ ...@@ -780,14 +798,19 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ
/// <returns></returns> /// <returns></returns>
[Route("savegatherhands/{allotId}")] [Route("savegatherhands/{allotId}")]
[HttpPost] [HttpPost]
public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData request) public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGatherData request)
{ {
if (allotId <= 0) if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
if (string.IsNullOrEmpty(request.Source) || string.IsNullOrEmpty(request.Category)) if (string.IsNullOrEmpty(request.Source) || string.IsNullOrEmpty(request.Category))
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.Fail);
if (request.Data == null || !request.Data.Any())
return new ApiResponse(ResponseType.Fail, "用户提交数据为空");
employeeService.CheckGatherData(allotId, request);
employeeService.SaveGatherHands(allotId, request); employeeService.SaveGatherHands(allotId, request);
employeeService.AddCategoryToConfig(allotId);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
...@@ -795,33 +818,40 @@ public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData reques ...@@ -795,33 +818,40 @@ public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData reques
/// 手工录入列表 - 明细 /// 手工录入列表 - 明细
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="request"></param> /// <param name="department">科室</param>
/// <param name="source">来源</param>
/// <param name="request">分页</param>
/// <returns></returns> /// <returns></returns>
[Route("getgather/{allotId}")] [Route("getgather/{allotId},{department},{source}")]
[HttpPost] [HttpPost]
public ApiResponse GetGather([FromRoute] int allotId, [FromBody] PersonParamsRequest request) public ApiResponse GetGather([FromRoute] int allotId, string department, string source, [FromBody] PersonParamsRequest request)
{ {
if (allotId <= 0) if (allotId <= 0 || string.IsNullOrEmpty(department) || string.IsNullOrEmpty(source))
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,department,source是否正确");
var result = employeeService.GetGather(allotId, request); var result = employeeService.GetGather(allotId, department, source, request);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
/// <summary> /// <summary>
/// 手工录入列表 - 汇总 /// 手工录入列表 - 汇总
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="request"></param> /// <param name="request">分页</param>
/// <returns></returns> /// <returns></returns>
[Route("getgathertotal/{allotId}")] [Route("getgathertotal/{allotId}")]
[HttpPost] [HttpPost]
public ApiResponse GetGatherTotal([FromRoute] int allotId, [FromBody] PersonParamsRequest request) public ApiResponse GetGatherTotal([FromRoute] int allotId, [FromBody] PersonParamsRequest request)
{ {
return new ApiResponse(ResponseType.OK); if (allotId <= 0)
} return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var result = employeeService.GetGatherTotal(allotId, request);
return new ApiResponse(ResponseType.OK, result);
}
#endregion #endregion
} }
} }
...@@ -61,13 +61,13 @@ public ApiResponse CustomExtract(int allotId) ...@@ -61,13 +61,13 @@ public ApiResponse CustomExtract(int allotId)
} }
else else
{ {
scopedQueue.Send(new Notification(allotId, "Notification", new TextContent("自定义数据提取数据失败", NotificationLevel.ERR))); scopedQueue.Send(new Notification(allotId, "ReceiveMessage", new TextContent("自定义数据提取数据失败", NotificationLevel.ERR)));
} }
await Task.Delay(TimeSpan.FromSeconds(5), token); await Task.Delay(TimeSpan.FromSeconds(5), token);
} }
}); });
_notificationQueue.Send(new Notification(allotId, "Notification", new TextContent("自定义数据提取任务开始执行"))); _notificationQueue.Send(new Notification(allotId, "ReceiveMessage", new TextContent("自定义数据提取任务开始执行")));
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
......
...@@ -275,9 +275,7 @@ public ApiResponse TableSpecial([FromBody] ConditionRequest request) ...@@ -275,9 +275,7 @@ public ApiResponse TableSpecial([FromBody] ConditionRequest request)
return new ApiResponse(ResponseType.OK, "", list); return new ApiResponse(ResponseType.OK, "", list);
} }
#region 发放表视图、下载 #region 发放表视图、下载 全院发放
/// <summary> /// <summary>
/// 全院绩效发放(视图) /// 全院绩效发放(视图)
...@@ -288,19 +286,14 @@ public ApiResponse TableSpecial([FromBody] ConditionRequest request) ...@@ -288,19 +286,14 @@ public ApiResponse TableSpecial([FromBody] ConditionRequest request)
[HttpPost] [HttpPost]
public ApiResponse GetAllComputeView([FromBody] BeginEndTime request) public ApiResponse GetAllComputeView([FromBody] BeginEndTime request)
{ {
DateTime bdate = DateTime.Now; if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out _) ||
DateTime edate = DateTime.Now; string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out _))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
throw new PerformanceException("请输入正确的时间"); throw new PerformanceException("请输入正确的时间");
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", request);
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", bdate, edate.AddMonths(1));
if (null == datas)
throw new PerformanceException("当前绩效记录不存在");
var list = new QueryComputeByDateGetPage var list = new QueryComputeByDateGetPage
{ {
Data = datas.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize).ToList(), Data = datas.Skip(request.PageSize * (request.CurrentPage - 1)).Take(request.PageSize).ToList(),
TotalData = _computeService.SumDatas(datas), TotalData = _computeService.SumDatas(datas),
TotalCount = datas.Count(), TotalCount = datas.Count(),
TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize), TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize),
...@@ -317,7 +310,55 @@ public ApiResponse GetAllComputeView([FromBody] BeginEndTime request) ...@@ -317,7 +310,55 @@ public ApiResponse GetAllComputeView([FromBody] BeginEndTime request)
/// <returns></returns> /// <returns></returns>
[Route("getAllComputeViewDown/download")] [Route("getAllComputeViewDown/download")]
[HttpPost] [HttpPost]
public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request) public IActionResult AllComputeViewDownload([FromBody] BeginEndTime request)
{
if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空");
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out DateTime bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out DateTime edate))
throw new PerformanceException("请输入正确的时间");
request.PageSize = 0;
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", request);
if (null == list)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_grant", "全院绩效发放", bdate, edate.AddMonths(1));
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 全院绩效发放汇总表(视图)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("wholehospital_grant_summary")]
[HttpPost]
public ApiResponse GetWholeHospitalGrantSummary([FromBody] HospitalGrantSummary request)
{
return new ApiResponse(ResponseType.OK, "ok", _computeService.GetPerformanceSummary(request, "view_allot_sign_emp"));
}
/// <summary>
/// 全院绩效发放汇总表(视图)下载
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("wholehospital_grant_summary/download")]
[HttpPost]
public IActionResult WholeHospitalGrantSummaryDownload([FromBody] HospitalGrantSummaryDown request)
{ {
if (request.HospitalId == 0) if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空"); throw new PerformanceException("医院ID不能为空");
...@@ -329,11 +370,18 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request) ...@@ -329,11 +370,18 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request)
throw new PerformanceException("请输入正确的时间"); throw new PerformanceException("请输入正确的时间");
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", bdate, edate.AddMonths(1)); var list = _computeService.GetAllComputeViewByDateAndTotal("view_allot_sign_emp", request);
if (null == list) if (null == list)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_grant", "全院绩效发放", bdate, edate.AddMonths(1)); List<string> headlist = new List<string>();
foreach (var item in request.GroupBy.Union(request.SumBy).ToList())
{
headlist.Add(item.ToLower());
}
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_grant_summary", "全院绩效发放", bdate, edate.AddMonths(1), headlist.ToArray());
var memoryStream = new MemoryStream(); var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open)) using (var stream = new FileStream(filepath, FileMode.Open))
...@@ -345,9 +393,11 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request) ...@@ -345,9 +393,11 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request)
FileInfo fileInfo = new FileInfo(filepath); FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"]; var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name)); return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
}
#endregion
#region 全院核算发放
/// <summary> /// <summary>
/// 全院核算绩效发放(视图) /// 全院核算绩效发放(视图)
/// </summary> /// </summary>
...@@ -357,19 +407,15 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request) ...@@ -357,19 +407,15 @@ public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request)
[HttpPost] [HttpPost]
public ApiResponse GethosdataView([FromBody] BeginEndTime request) public ApiResponse GethosdataView([FromBody] BeginEndTime request)
{ {
DateTime bdate = DateTime.Now; if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out _) ||
DateTime edate = DateTime.Now; string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out _))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
throw new PerformanceException("请输入正确的时间"); throw new PerformanceException("请输入正确的时间");
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", bdate, edate.AddMonths(1)); var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", request);
if (null == datas)
throw new PerformanceException("当前绩效记录不存在");
var list = new QueryComputeByDateGetPage var list = new QueryComputeByDateGetPage
{ {
Data = datas.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize).ToList(), Data = datas.Skip(request.PageSize * (request.CurrentPage - 1)).Take(request.PageSize).ToList(),
TotalData = _computeService.SumDatas(datas), TotalData = _computeService.SumDatas(datas),
TotalCount = datas.Count(), TotalCount = datas.Count(),
TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize), TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize),
...@@ -380,6 +426,8 @@ public ApiResponse GethosdataView([FromBody] BeginEndTime request) ...@@ -380,6 +426,8 @@ public ApiResponse GethosdataView([FromBody] BeginEndTime request)
} }
/// <summary> /// <summary>
/// 全院核算绩效发放(视图) 下载 /// 全院核算绩效发放(视图) 下载
/// </summary> /// </summary>
...@@ -387,18 +435,17 @@ public ApiResponse GethosdataView([FromBody] BeginEndTime request) ...@@ -387,18 +435,17 @@ public ApiResponse GethosdataView([FromBody] BeginEndTime request)
/// <returns></returns> /// <returns></returns>
[Route("gethosdataView/download")] [Route("gethosdataView/download")]
[HttpPost] [HttpPost]
public IActionResult GethosdataView([FromBody] BeginEndTimeDown request) public IActionResult GethosdataViewDown([FromBody] BeginEndTime request)
{ {
if (request.HospitalId == 0) if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空"); throw new PerformanceException("医院ID不能为空");
DateTime bdate = DateTime.Now; if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out DateTime bdate) ||
DateTime edate = DateTime.Now; string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out DateTime edate))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
throw new PerformanceException("请输入正确的时间"); throw new PerformanceException("请输入正确的时间");
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", bdate, edate.AddMonths(1)); request.PageSize = 0;
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", request);
if (null == list) if (null == list)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
...@@ -416,30 +463,86 @@ public IActionResult GethosdataView([FromBody] BeginEndTimeDown request) ...@@ -416,30 +463,86 @@ public IActionResult GethosdataView([FromBody] BeginEndTimeDown request)
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name)); return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
} }
/// <summary>
/// 全院核算绩效发放汇总表(视图)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("wholehospital_accounting_grant_summary")]
[HttpPost]
public ApiResponse GetWholeHospitalAccountingGrantSummary([FromBody] HospitalGrantSummary request)
{
return new ApiResponse(ResponseType.OK, "ok", _computeService.GetPerformanceSummary(request, "view_allot_sign_dept"));
}
/// <summary> /// <summary>
/// 获取财务全院绩效列表(视图) /// 全院核算绩效发放汇总表(视图)下载
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
[Route("allcomputeView/personnel")] [Route("wholehospital_accounting_grant_summary/download")]
[HttpPost] [HttpPost]
public ApiResponse AllComputeViewByPM([FromBody] BeginEndTime request) public IActionResult WholeHospitalAccountingGrantSummaryDownload([FromBody] HospitalGrantSummaryDown request)
{ {
if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空");
DateTime bdate = DateTime.Now; DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now; DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) || if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate)) string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
throw new PerformanceException("请输入正确的时间"); throw new PerformanceException("请输入正确的时间");
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", bdate, edate.AddMonths(1));
if (null == datas) var list = _computeService.GetAllComputeViewByDateAndTotal("view_allot_sign_dept", request);
if (null == list)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
List<string> headlist = new List<string>();
foreach (var item in request.GroupBy.Union(request.SumBy).ToList())
{
headlist.Add(item.ToLower());
}
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_accounting_grant_summary", "全院核算绩效发放", bdate, edate.AddMonths(1), headlist.ToArray());
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
#endregion
#region 全院财务发放
/// <summary>
/// 获取财务全院绩效列表(视图)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allcomputeView/personnel")]
[HttpPost]
public ApiResponse AllComputeViewByPM([FromBody] BeginEndTime request)
{
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out _) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out _))
throw new PerformanceException("请输入正确的时间");
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", request);
var list = new QueryComputeByDateGetPage var list = new QueryComputeByDateGetPage
{ {
Data = datas.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize).ToList(), Data = datas.Skip(request.PageSize * (request.CurrentPage - 1)).Take(request.PageSize).ToList(),
TotalData = _computeService.SumDatas(datas), TotalData = _computeService.SumDatas(datas),
TotalCount = datas.Count(), TotalCount = datas.Count(),
TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize), TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize),
...@@ -456,7 +559,56 @@ public ApiResponse AllComputeViewByPM([FromBody] BeginEndTime request) ...@@ -456,7 +559,56 @@ public ApiResponse AllComputeViewByPM([FromBody] BeginEndTime request)
/// <returns></returns> /// <returns></returns>
[Route("allcomputeView/personnel/download")] [Route("allcomputeView/personnel/download")]
[HttpPost] [HttpPost]
public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTimeDown request) public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTime request)
{
if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空");
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out DateTime bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out DateTime edate))
throw new PerformanceException("请输入正确的时间");
request.PageSize = 0;
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", request);
if (null == list)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_finance_grant", "财务全院绩效发放", bdate, edate.AddMonths(1));
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 财务全院绩效发放汇总表(视图)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("wholehospital_finance_grant_summary")]
[HttpPost]
public ApiResponse GetWholeHospitalFinanceGrantSummary([FromBody] HospitalGrantSummary request)
{
return new ApiResponse(ResponseType.OK, "ok", _computeService.GetPerformanceSummary(request, "view_allot_sign_emp_finance"));
}
/// <summary>
/// 财务全院绩效发放汇总表(视图)下载
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("wholehospital_finance_grant_summary/download")]
[HttpPost]
public IActionResult WholeHospitalFinanceGrantSummaryDownload([FromBody] HospitalGrantSummaryDown request)
{ {
if (request.HospitalId == 0) if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空"); throw new PerformanceException("医院ID不能为空");
...@@ -467,11 +619,19 @@ public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTimeDown requ ...@@ -467,11 +619,19 @@ public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTimeDown requ
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate)) string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
throw new PerformanceException("请输入正确的时间"); throw new PerformanceException("请输入正确的时间");
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", bdate, edate.AddMonths(1));
var list = _computeService.GetAllComputeViewByDateAndTotal("view_allot_sign_emp_finance", request);
if (null == list) if (null == list)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_finance_grant", "财务全院绩效发放", bdate, edate.AddMonths(1)); List<string> headlist = new List<string>();
foreach (var item in request.GroupBy.Union(request.SumBy).ToList())
{
headlist.Add(item.ToLower());
}
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_finance_grant_summary", "财务全院绩效发放", bdate, edate.AddMonths(1), headlist.ToArray());
var memoryStream = new MemoryStream(); var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open)) using (var stream = new FileStream(filepath, FileMode.Open))
...@@ -483,6 +643,7 @@ public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTimeDown requ ...@@ -483,6 +643,7 @@ public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTimeDown requ
FileInfo fileInfo = new FileInfo(filepath); FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"]; var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name)); return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
} }
#endregion #endregion
} }
......
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Performance.DtoModels;
using Performance.Infrastructure;
using System;
using System.IO;
using System.Threading.Tasks;
namespace Performance.Api
{
/// <summary>
/// 过期限制
/// </summary>
public class ExpirationLimitMiddleware
{
private readonly RequestDelegate _next;
public ExpirationLimitMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
if (context.Request.Path.StartsWithSegments("/api/function/limit"))
{
var response = new ApiResponse(ResponseType.OK, new
{
ExpirationTime = FunctionLimit.Limit.ExpirationTime.ToString("yyyy-MM-dd"),
Remark = FunctionLimit.Limit.Remark,
});
context.Response.ContentType = "application/json";
await context.Response.WriteAsync(JsonHelper.Serialize(response));
return;
}
else if (FunctionLimit.Limit.ExpirationTime > DateTime.Now)
{
await _next.Invoke(context);
return;
}
else
{
var response = new ApiResponse(ResponseType.Expiration, FunctionLimit.Limit.Remark);
context.Response.ContentType = "application/json";
await context.Response.WriteAsync(JsonHelper.Serialize(response));
}
}
}
}
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using XC.RSAUtil;
namespace Performance.Api
{
public class LimitInformation
{
public DateTime ExpirationTime { get; set; }
public string Remark { get; internal set; }
}
public class FunctionLimit
{
public static LimitInformation Limit { get; } = new LimitInformation();
public static void Init(NLog.Logger logger)
{
string message = "此网站的验证证书有问题,验证证书已过期或还未生效,请及时联系供应厂商进行维护升级。";
var filePath = Path.Combine(Environment.CurrentDirectory, "secret.key");
logger.Info(filePath);
if (!File.Exists(filePath))
{
Limit.ExpirationTime = DateTime.MinValue;
Limit.Remark = message;
return;
}
string content = ReadLimitContent(filePath, logger);
logger.Info(content);
if (string.IsNullOrEmpty(content))
{
Limit.ExpirationTime = DateTime.MinValue;
Limit.Remark = message;
return;
}
var timestamp = ConvertToExpiration(content);
if (timestamp == 0)
{
Limit.ExpirationTime = DateTime.MinValue;
Limit.Remark = message;
return;
}
Limit.ExpirationTime = (new DateTime(1970, 1, 1, 8, 0, 0, DateTimeKind.Unspecified)).AddSeconds(timestamp);
Limit.Remark = Limit.ExpirationTime > DateTime.Now ? "已授权开放使用!" : message;
}
private static long ConvertToExpiration(string content)
{
long result = 0;
try
{
var bigDataRsa = new RsaPkcs8Util(Encoding.UTF8, "", privateKey, 2048);
var timestamp = bigDataRsa.DecryptBigData(content, RSAEncryptionPadding.Pkcs1);
long.TryParse(timestamp, out result);
return result;
}
catch (Exception) { }
return result;
}
private static string ReadLimitContent(string filePath, NLog.Logger logger)
{
var content = "";
try
{
using (FileStream stream = new FileStream(filePath, FileMode.Open))
using (StreamReader reader = new StreamReader(stream))
{
content = reader.ReadToEnd();
}
}
catch (Exception ex) { logger.Error(ex); }
return content;
}
private static string privateKey = @"-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC/XTloNsKshhr/
GC34GSQqKxiojkSWBZ+Xe3SxryqrYjx8yyjdrTgBq8lXOO9xtu+jr3XcFwHhFsq5
iK8qwRZQhinASjOFroeszrn0dbuLMT3ad+pCfdkXKcOwmCifHWLqODn0JXmPnTx5
8F1JD954J1Es8ugyJ6S77T0iPezmHvPgxV0Cn4E7Lg2114LwBgy1Kgb5S/b3pz5P
MQKECPRqK69SRIzUU7Nvw1LrqjK9OF5ZWYdGBlCBpRvbd0RIrgJ3NzAUCrE5t3Y+
KI3UM02FhoGzWM0j8oC/P6GGkNL8bY5JMR2TGWfUiB1UUjT+Y2hCCl0tfZUBWPDu
NVeqB9dxAgMBAAECggEAGOU56LLnFKbFsFYm9NXgfJPqu1L23UWSA5UOE2ekd3Nq
RxnvERfN53m/0dcYX4TbHEJhZOahWfUrHoQHtdo02vj5SYjdtxCDmhmy23jNk0gu
sdNT6J6StY67ZKgG8NxT2ADEmVyeue5MxdhdannkCWGkD+LyDkRWDBTLFT9VKIK4
dV22NdL7uvIYH+dP8fUYm6sM65+fAcPwj5bVPhCI90TjJo93e2/aBtzaMjdrRcfY
r8AaRMuY8m/QDvVhIaurki1JxG+Qwz4gT5eWhI8qUwGsxti92/Mz+B3oT8X+AhP0
tEsRNxu+BrDeb6qM3JpYaR4UbJIFLljVWRFRa67L+QKBgQD1f1eoh6YbMXI9c3Ty
3u5YRawVRG47MtuMDu94PqUKjo57evQEaOvtwPYADR1G1qFDRJbSbTsVhXEH5YaA
SuYdNYBNYJzPkD6Du+gwFqiemolKbMb2bTGtdci4FEZIcHS8u+FaARtAJuUWqtTY
KMqyu95JTcLrHYBnlynWwy+QdwKBgQDHjQVZGIOH2WW6OG7wHHicc7SxjRiBTADk
aIJAM1JJlgTHZ4o9v47DBOPAT7MCcbI8Ln+/kbJgdNMFC3SyPpzNHtvRp48dNXxx
liGtLys8GBaBEDzI0jmXb5nZXLk5DfwZEOQ57T4TbYjuBlwjY/FQl+7HWUKgwEt8
AvPjefb5VwKBgQC+YisQv2HJ5Oa7UTZ4wvoD6sQxGgiCUEaCr3J2xd4n+bX1fLyQ
Tu3oS6R7FbCGpxwYlrCAL8WKQxoNDarpAyzBqiP93da+ARb6AldmM6xAk4e09/a0
VKoZ4yXt24tF0jA1zV5N9l2zunYexgyaNcg8JAWWw39N5msV6ty/eE8CsQKBgQCi
IfI2cbRsrDX7F98LOBbHBzvJBtriMt6GtmMdxpUVNM6tNXMcuIdF7LMfjaHkWnx2
aVFiVP6ZYFITxzsJl9XO00PHFF0zXkG+CD1UeP6n1Opz8r1wbV5drE9UTAIyWSp7
Mz470oadQmH/AyvZlVp8IPXhAqUf9x1dpQiDypTgAQKBgQDLeiwRRG6SxnZDddDK
RNKJaMz1q0GM3KPC4MuM8gPkWBRnrGZ67J3bTpgPYVVFxxyIspDG6miMATfZXnDF
OKst4raozj7kX5ghZRZCI2okvFEipVkBSwPdAB20mx5DENXOtpr2h+V/57AgD8Ua
UGTpnMMY2uONH/H/mMPny8D5LA==
-----END PRIVATE KEY-----";
}
}
using Microsoft.AspNetCore.Builder;
namespace Performance.Api
{
public static class RequestCultureMiddlewareExtensions
{
/// <summary>
/// 过期限制
/// </summary>
/// <param name="builder"></param>
/// <returns></returns>
public static IApplicationBuilder UseExpirationLimit(this IApplicationBuilder builder)
{
return builder.UseMiddleware<ExpirationLimitMiddleware>();
}
}
}
...@@ -24,6 +24,16 @@ ...@@ -24,6 +24,16 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="secret.key">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="XC.RSAUtil" Version="1.3.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Performance.DtoModels\Performance.DtoModels.csproj" /> <ProjectReference Include="..\Performance.DtoModels\Performance.DtoModels.csproj" />
<ProjectReference Include="..\Performance.Services\Performance.Services.csproj" /> <ProjectReference Include="..\Performance.Services\Performance.Services.csproj" />
</ItemGroup> </ItemGroup>
......
...@@ -12,6 +12,7 @@ public class Program ...@@ -12,6 +12,7 @@ public class Program
public static void Main(string[] args) public static void Main(string[] args)
{ {
var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
FunctionLimit.Init(logger);
try try
{ {
CreateWebHostBuilder(args).Build().Run(); CreateWebHostBuilder(args).Build().Run();
...@@ -45,5 +46,6 @@ public static void Main(string[] args) ...@@ -45,5 +46,6 @@ public static void Main(string[] args)
logging.SetMinimumLevel(LogLevel.Trace); logging.SetMinimumLevel(LogLevel.Trace);
}) })
.UseNLog(); .UseNLog();
} }
} }
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Performance.Api.Configurations; using Performance.Api.Configurations;
using Performance.DtoModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Services; using Performance.Services;
using System.Globalization; using System.Globalization;
...@@ -113,6 +115,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) ...@@ -113,6 +115,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
app.UseStatusCodePagesWithReExecute("/error/{0}"); app.UseStatusCodePagesWithReExecute("/error/{0}");
} }
app.UseExpirationLimit();
app.UseRouting(); app.UseRouting();
app.UseAuthentication(); app.UseAuthentication();
...@@ -146,4 +151,5 @@ private void JsonOptions(MvcNewtonsoftJsonOptions json) ...@@ -146,4 +151,5 @@ private void JsonOptions(MvcNewtonsoftJsonOptions json)
json.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; json.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
} }
} }
} }
UvHeSCNjMucE7mxfpB2wK1XQVSrGyXzxtRzclDPX+IoTYesKy64t4LEB4RpXEkF6lr8f9+GFSX0FPokmRGOzmP/Z+1kYdcu1FnA6DKI5izIe8BmL4GrGzyJYfxrPju8UzHiMexCHBxwzg7KrASjQBuzGS8UDvmOM5+ycZgar3h9zuG//kS9am2+a6BnWYk0iEOH7PGqo/QUOzN7hiSTF6y+Bl0ZmwdFy88sfBDccL9oZ4IbiM1I/zZjC1E4f6A97Tdr6h+BJ7e6kClrbk7TbOGMYKi5JY3CKCmVtCEUSvNriiHlazneLYYIDLFtjpor/9xfG+EDjrPANGtijoNi4YQ==
\ No newline at end of file
...@@ -440,6 +440,13 @@ ...@@ -440,6 +440,13 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ComputeController.GetMedicalTechnician(Performance.DtoModels.ComputerRequest)">
<summary>
医技组科室绩效列表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.GetDoctor(Performance.DtoModels.ComputerRequest)"> <member name="M:Performance.Api.Controllers.ComputeController.GetDoctor(Performance.DtoModels.ComputerRequest)">
<summary> <summary>
医生组科室绩效列表 医生组科室绩效列表
...@@ -1190,6 +1197,13 @@ ...@@ -1190,6 +1197,13 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetDeptComparisonTotal(System.Int32)">
<summary>
实发绩效校验
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherDrop(System.Int32)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetGatherDrop(System.Int32)">
<summary> <summary>
手工录入 - 下拉列表 手工录入 - 下拉列表
...@@ -1213,12 +1227,14 @@ ...@@ -1213,12 +1227,14 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,Performance.DtoModels.PersonParamsRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,System.String,System.String,Performance.DtoModels.PersonParamsRequest)">
<summary> <summary>
手工录入列表 - 明细 手工录入列表 - 明细
</summary> </summary>
<param name="allotId"></param> <param name="allotId"></param>
<param name="request"></param> <param name="department">科室</param>
<param name="source">来源</param>
<param name="request">分页</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(System.Int32,Performance.DtoModels.PersonParamsRequest)"> <member name="M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(System.Int32,Performance.DtoModels.PersonParamsRequest)">
...@@ -1226,7 +1242,7 @@ ...@@ -1226,7 +1242,7 @@
手工录入列表 - 汇总 手工录入列表 - 汇总
</summary> </summary>
<param name="allotId"></param> <param name="allotId"></param>
<param name="request"></param> <param name="request">分页</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ExConfigController.Extract(Performance.DtoModels.ModModuleRequest)"> <member name="M:Performance.Api.Controllers.ExConfigController.Extract(Performance.DtoModels.ModModuleRequest)">
...@@ -1656,13 +1672,27 @@ ...@@ -1656,13 +1672,27 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeViewDownload(Performance.DtoModels.BeginEndTimeDown)"> <member name="M:Performance.Api.Controllers.ReportController.AllComputeViewDownload(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
全院绩效发放(视图)下载 全院绩效发放(视图)下载
</summary> </summary>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.GetWholeHospitalGrantSummary(Performance.DtoModels.HospitalGrantSummary)">
<summary>
全院绩效发放汇总表(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.WholeHospitalGrantSummaryDownload(Performance.DtoModels.HospitalGrantSummaryDown)">
<summary>
全院绩效发放汇总表(视图)下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTime)"> <member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
全院核算绩效发放(视图) 全院核算绩效发放(视图)
...@@ -1670,13 +1700,27 @@ ...@@ -1670,13 +1700,27 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTimeDown)"> <member name="M:Performance.Api.Controllers.ReportController.GethosdataViewDown(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
全院核算绩效发放(视图) 下载 全院核算绩效发放(视图) 下载
</summary> </summary>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.GetWholeHospitalAccountingGrantSummary(Performance.DtoModels.HospitalGrantSummary)">
<summary>
全院核算绩效发放汇总表(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.WholeHospitalAccountingGrantSummaryDownload(Performance.DtoModels.HospitalGrantSummaryDown)">
<summary>
全院核算绩效发放汇总表(视图)下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeViewByPM(Performance.DtoModels.BeginEndTime)"> <member name="M:Performance.Api.Controllers.ReportController.AllComputeViewByPM(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
获取财务全院绩效列表(视图) 获取财务全院绩效列表(视图)
...@@ -1684,13 +1728,27 @@ ...@@ -1684,13 +1728,27 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeByPMViewDownLoad(Performance.DtoModels.BeginEndTimeDown)"> <member name="M:Performance.Api.Controllers.ReportController.AllComputeByPMViewDownLoad(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
获取财务全院绩效列表(视图)下载 获取财务全院绩效列表(视图)下载
</summary> </summary>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.GetWholeHospitalFinanceGrantSummary(Performance.DtoModels.HospitalGrantSummary)">
<summary>
财务全院绩效发放汇总表(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.WholeHospitalFinanceGrantSummaryDownload(Performance.DtoModels.HospitalGrantSummaryDown)">
<summary>
财务全院绩效发放汇总表(视图)下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportGlobalController.GetAllReportGlobal(System.Int32)"> <member name="M:Performance.Api.Controllers.ReportGlobalController.GetAllReportGlobal(System.Int32)">
<summary> <summary>
获取报表配置信息 获取报表配置信息
...@@ -2107,6 +2165,18 @@ ...@@ -2107,6 +2165,18 @@
<param name="query"></param> <param name="query"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Performance.Api.ExpirationLimitMiddleware">
<summary>
过期限制
</summary>
</member>
<member name="M:Performance.Api.RequestCultureMiddlewareExtensions.UseExpirationLimit(Microsoft.AspNetCore.Builder.IApplicationBuilder)">
<summary>
过期限制
</summary>
<param name="builder"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.ClaimService.GetUserId"> <member name="M:Performance.Api.ClaimService.GetUserId">
<summary> <summary>
获取当前请求登录ID 获取当前请求登录ID
......
...@@ -1695,6 +1695,11 @@ ...@@ -1695,6 +1695,11 @@
状态 1 可用 0 禁用 状态 1 可用 0 禁用
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.cof_alias.SumStatus">
<summary>
状态 1 求和 0 不求和
</summary>
</member>
<member name="T:Performance.EntityModels.cof_check"> <member name="T:Performance.EntityModels.cof_check">
<summary> <summary>
上传excel文件校验配置 上传excel文件校验配置
...@@ -3569,11 +3574,6 @@ ...@@ -3569,11 +3574,6 @@
创建时间 创建时间
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ex_result.IsDelete">
<summary>
1 删除 0 未删除
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Id"> <member name="P:Performance.EntityModels.ex_result_gather.Id">
<summary> <summary>
...@@ -3624,11 +3624,6 @@ ...@@ -3624,11 +3624,6 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ex_result_gather.States">
<summary>
1 未通过 2 通过
</summary>
</member>
<member name="T:Performance.EntityModels.ex_script"> <member name="T:Performance.EntityModels.ex_script">
<summary> <summary>
......
...@@ -69,8 +69,8 @@ static void Main(string[] args) ...@@ -69,8 +69,8 @@ static void Main(string[] args)
var task = emailService.SendAsync(message); var task = emailService.SendAsync(message);
task.Wait(); task.Wait();
Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>()); //Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
services.AddAutoMapper(); //services.AddAutoMapper();
//service注入 repoitory注入 //service注入 repoitory注入
services services
...@@ -79,10 +79,10 @@ static void Main(string[] args) ...@@ -79,10 +79,10 @@ static void Main(string[] args)
var connection = configuration.GetSection("AppConnection:PerformanceConnectionString").Value; var connection = configuration.GetSection("AppConnection:PerformanceConnectionString").Value;
services.AddDbContext<PerformanceDbContext>(options => //services.AddDbContext<PerformanceDbContext>(options =>
{ //{
options.UseMySQL(connection); // options.UseMySQL(connection);
}); //});
Console.ReadKey(); Console.ReadKey();
} }
......
...@@ -94,12 +94,19 @@ public class ColumnHeadsConfig ...@@ -94,12 +94,19 @@ public class ColumnHeadsConfig
{ {
public static List<Heads> GatherHeads { get; } = new List<Heads> public static List<Heads> GatherHeads { get; } = new List<Heads>
{ {
new Heads{Column="科室",Name=nameof(ex_result_gather.Department)}, new Heads{Column="来源",Name=nameof(GatherInfoRequest.Source)},
new Heads{Column="医生姓名",Name=nameof(ex_result_gather.DoctorName)}, new Heads{Column="科室",Name=nameof(GatherInfoRequest.Department)},
new Heads{Column="人员工号",Name=nameof(ex_result_gather.PersonnelNumber)}, new Heads{Column="医生姓名",Name=nameof(GatherInfoRequest.DoctorName)},
new Heads{Column="费用类型",Name=nameof(ex_result_gather.Category)}, new Heads{Column="人员工号",Name=nameof(GatherInfoRequest.PersonnelNumber)},
new Heads{Column="费用",Name=nameof(ex_result_gather.Fee)}, new Heads{Column="费用类型",Name=nameof(GatherInfoFee.Category)},
new Heads{Column="来源",Name=nameof(ex_result_gather.Source)} new Heads{Column="费用",Name=nameof(GatherInfoFee.Fee)},
};
public static List<Heads> GatherTotal { get; } = new List<Heads>
{
new Heads{Column="科室",Name=nameof(GatherTotalRequest.Department)},
new Heads{Column="来源",Name=nameof(GatherTotalRequest.Source)},
new Heads{Column="费用",Name=nameof(GatherTotalRequest.Fee)}
}; };
} }
......
using FluentValidation; using FluentValidation;
using Performance.EntityModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
...@@ -49,31 +50,46 @@ public ComputerRequestValidator() ...@@ -49,31 +50,46 @@ public ComputerRequestValidator()
public class ComputerAliasRequest public class ComputerAliasRequest
{ {
public int HospitalId { get; set; } public int HospitalId { get; set; }
public string Route { get; set; } public string Route { get; set; }
public string[] Heads { get; set; }
} }
public class BeginEndTime public class BeginEndTime
{ {
public string BeginTime { get; set; } // 2021-01 public string BeginTime { get; set; } // 2021-01
public string EndTime { get; set; } // 2021-08 public string EndTime { get; set; } // 2021-08
public int CurrentPage { get; set; } public int HospitalId { get; set; }
public int PageSize { get; set; } public List<TitleValue> Search { get; set; }
public string SortBy { get; set; }
public int CurrentPage { get; set; } = 0;
public int PageSize { get; set; } = 0;
} }
public class BeginEndTimeDown
public class HospitalGrantSummary : BeginEndTime
{ {
public string BeginTime { get; set; } // 2021-01 public List<string> GroupBy { get; set; }
public string EndTime { get; set; } // 2021-08 public List<string> SumBy { get; set; }
public int HospitalId { get; set; }
} }
public class HospitalGrantSummaryDown : HospitalGrantSummary
{
public string[] heads { get; set; }
}
public class QueryComputeByDateGetPage public class QueryComputeByDateGetPage : GetPage
{ {
public List<dynamic> Data { get; set; } public List<dynamic> Data { get; set; }
public Dictionary<string, decimal> TotalData { get; set; } public Dictionary<string, decimal> TotalData { get; set; }
}
public class GetPage
{
public int CurrentPage { get; set; } public int CurrentPage { get; set; }
public int TotalPages { get; set; } public int TotalPages { get; set; }
public int PageSize { get; set; } public int PageSize { get; set; }
public int TotalCount { get; set; } public int TotalCount { get; set; }
} }
} }
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
namespace Performance.DtoModels namespace Performance.DtoModels
{ {
public class ComparisonResponse public class ComparisonResponse<T>
{ {
public List<Heads> Heads { get; set; } public List<Heads> Heads { get; set; }
public Comparison Datas { get; set; } public T Datas { get; set; }
} }
public class Heads public class Heads
...@@ -16,9 +16,9 @@ public class Heads ...@@ -16,9 +16,9 @@ public class Heads
public string Name { get; set; } public string Name { get; set; }
} }
public class Comparison public class Comparison<T>
{ {
public List<view_check_emp> Datas { get; set; } public List<T> Datas { get; set; }
public int TotalCount { get; set; } public int TotalCount { get; set; }
} }
......
using Performance.EntityModels; using Performance.DtoModels.Request;
using Performance.EntityModels;
using Performance.Infrastructure.Models; using Performance.Infrastructure.Models;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -7,7 +8,16 @@ namespace Performance.DtoModels ...@@ -7,7 +8,16 @@ namespace Performance.DtoModels
public class GatherResponse public class GatherResponse
{ {
public List<Heads> Heads { get; set; } public List<Heads> Heads { get; set; }
public PageList<ex_result_gather> Datas { get; set; } public List<GatherTotalRequest> Datas { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public int PageSize { get; set; }
public int TotalCount { get; set; }
}
public class GatherInfo
{
public List<Heads> Heads { get; set; }
public List<GatherInfoRequest> Datas { get; set; }
public int CurrentPage { get; set; } public int CurrentPage { get; set; }
public int TotalPages { get; set; } public int TotalPages { get; set; }
public int PageSize { get; set; } public int PageSize { get; set; }
...@@ -28,4 +38,27 @@ public class GatherRequest ...@@ -28,4 +38,27 @@ public class GatherRequest
public string Source { get; set; } public string Source { get; set; }
public string Category { get; set; } public string Category { get; set; }
} }
public class GatherTotalRequest
{
public int ID { get; set; }
public string Department { get; set; }
public string Source { get; set; }
public decimal Fee { get; set; }
}
public class GatherInfoRequest
{
public string Source { get; set; }
public string Department { get; set; }
public string DoctorName { get; set; }
public string PersonnelNumber { get; set; }
public List<GatherInfoFee> Detail { get; set; }
}
public class GatherInfoFee
{
public string Category { get; set; }
public decimal? Fee { get; set; }
}
} }
...@@ -15,5 +15,6 @@ public enum ResponseType ...@@ -15,5 +15,6 @@ public enum ResponseType
Disable = 7, Disable = 7,
TooManyRequests = 8, TooManyRequests = 8,
Warning = 9, Warning = 9,
Expiration = 99,
} }
} }
...@@ -50,5 +50,9 @@ public class cof_alias ...@@ -50,5 +50,9 @@ public class cof_alias
/// 状态 1 可用 0 禁用 /// 状态 1 可用 0 禁用
/// </summary> /// </summary>
public Nullable<int> States { get; set; } public Nullable<int> States { get; set; }
/// <summary>
/// 状态 1 求和 0 不求和
/// </summary>
public Nullable<int> SumStatus { get; set; }
} }
} }
...@@ -79,6 +79,6 @@ public class ex_result ...@@ -79,6 +79,6 @@ public class ex_result
/// <summary> /// <summary>
/// 1 删除 0 未删除 /// 1 删除 0 未删除
/// </summary> /// </summary>
public int IsDelete { get; set; } // public int IsDelete { get; set; }
} }
} }
...@@ -49,6 +49,6 @@ public class ex_result_gather ...@@ -49,6 +49,6 @@ public class ex_result_gather
/// <summary> /// <summary>
/// 1 未通过 2 通过 /// 1 未通过 2 通过
/// </summary> /// </summary>
public int States { get; set; } // public int States { get; set; }
} }
} }
...@@ -6,7 +6,7 @@ public class view_allot_sign_dept ...@@ -6,7 +6,7 @@ public class view_allot_sign_dept
public int AllotID { get; set; } public int AllotID { get; set; }
public int Year { get; set; } public int Year { get; set; }
public int Month { get; set; } public int Month { get; set; }
public int UnitName { get; set; } public int UnitType { get; set; }
public int AccountingUnit { get; set; } public int AccountingUnit { get; set; }
public int PerforFee { get; set; } public int PerforFee { get; set; }
public int WorkloadFee { get; set; } public int WorkloadFee { get; set; }
......
...@@ -26,8 +26,16 @@ public class view_check_emp : view_check_dept ...@@ -26,8 +26,16 @@ public class view_check_emp : view_check_dept
public string JobNumber { get; set; } public string JobNumber { get; set; }
public string EmployeeName { get; set; } public string EmployeeName { get; set; }
} }
public class DeptComparisonTotal
{
public string UnitType { get; set; }
public int Count { get; set; }
public decimal? SumFee{ get; set; }
}
} }
using Performance.EntityModels;
using Performance.Infrastructure.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace Performance.Repository
{
public partial class PerforExresultgatherRepository : PerforRepository<ex_result_gather>
{
public PageList<ex_result_gather> GetGatherForPaging(int pageNumber, int pageSize, Expression<Func<ex_result_gather, bool>> exp)
{
IQueryable<ex_result_gather> queryableAuthors = context.Set<ex_result_gather>()
.Where(exp)
.OrderBy(w => w.Department)
.ThenBy(t => t.PersonnelNumber);
return PageList<ex_result_gather>.Create(queryableAuthors, pageNumber, pageSize);
}
}
}
...@@ -30,13 +30,6 @@ public new PageList<per_employee> GetEntitiesForPaging(int pageNumber, int pageS ...@@ -30,13 +30,6 @@ public new PageList<per_employee> GetEntitiesForPaging(int pageNumber, int pageS
} }
public PageList<ex_result_gather> GetGatherForPaging(int pageNumber, int pageSize, Expression<Func<ex_result_gather, bool>> exp)
{
IQueryable<ex_result_gather> queryableAuthors = context.Set<ex_result_gather>().Where(exp).OrderBy(w => w.Department).ThenBy(t => t.PersonnelNumber);
return PageList<ex_result_gather>.Create(queryableAuthors, pageNumber, pageSize);
}
//public Comparison GetComparison(ComparisonPagingRequest request) //public Comparison GetComparison(ComparisonPagingRequest request)
//{ //{
// var search = ""; // var search = "";
...@@ -67,7 +60,7 @@ public PageList<ex_result_gather> GetGatherForPaging(int pageNumber, int pageSiz ...@@ -67,7 +60,7 @@ public PageList<ex_result_gather> GetGatherForPaging(int pageNumber, int pageSiz
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <param name="searchQuery"></param> /// <param name="searchQuery"></param>
/// <returns></returns> /// <returns></returns>
public Comparison CheckEmployeeRealGiveFeeDiff(int allotId, string searchQuery) public DtoModels.Comparison<view_check_emp> CheckEmployeeRealGiveFeeDiff(ComparisonPagingRequest request)
{ {
var queryData = @" var queryData = @"
SELECT SELECT
...@@ -80,7 +73,7 @@ public Comparison CheckEmployeeRealGiveFeeDiff(int allotId, string searchQuery) ...@@ -80,7 +73,7 @@ public Comparison CheckEmployeeRealGiveFeeDiff(int allotId, string searchQuery)
) TAB ) TAB
WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm OR if(@searchQuery='','',JobNumber) LIKE @parm OR if(@searchQuery='','',EmployeeName) LIKE @parm WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm OR if(@searchQuery='','',JobNumber) LIKE @parm OR if(@searchQuery='','',EmployeeName) LIKE @parm
GROUP BY HospitalId,Year,Month,AllotID,UnitType,AccountingUnit,JobNumber GROUP BY HospitalId,Year,Month,AllotID,UnitType,AccountingUnit,JobNumber
ORDER BY HospitalId,Year,Month,ABS(SUM(RealGiveFeeExecl) - SUM(RealGiveFeeCompute)) DESC ORDER BY HospitalId,Year,Month,ABS(SUM(RealGiveFeeExecl) - SUM(RealGiveFeeCompute)) DESC LIMIT @pageSize OFFSET @pageIndex
"; ";
var queryCount = @" var queryCount = @"
...@@ -91,17 +84,17 @@ public Comparison CheckEmployeeRealGiveFeeDiff(int allotId, string searchQuery) ...@@ -91,17 +84,17 @@ public Comparison CheckEmployeeRealGiveFeeDiff(int allotId, string searchQuery)
) TAB ) TAB
WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm OR if(@searchQuery='','',JobNumber) LIKE @parm OR if(@searchQuery='','',EmployeeName) LIKE @parm WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm OR if(@searchQuery='','',JobNumber) LIKE @parm OR if(@searchQuery='','',EmployeeName) LIKE @parm
"; ";
return new Comparison() return new DtoModels.Comparison<view_check_emp>()
{ {
Datas = DapperQuery<view_check_emp>(queryData, new { allotId, searchQuery, parm = $"%{searchQuery}%" })?.ToList() ?? new List<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>(),
TotalCount = DapperQuery<int>(queryCount, new { allotId, searchQuery, parm = $"%{searchQuery}%" })?.FirstOrDefault() ?? 0, TotalCount = DapperQuery<int>(queryCount, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.FirstOrDefault() ?? 0,
}; };
} }
/// <summary> /// <summary>
/// 科室实发绩效比对 /// 科室实发绩效比对
/// </summary> /// </summary>
public Comparison CheckAccountingUnitRealGiveFeeDiff(int allotId, string searchQuery) public DtoModels.Comparison<view_check_emp> CheckAccountingUnitRealGiveFeeDiff(ComparisonPagingRequest request)
{ {
var queryData = @" var queryData = @"
SELECT *,IFNULL(RealGiveFeeExecl,0) - IFNULL(RealGiveFeeCompute,0) AS Diff FROM ( SELECT *,IFNULL(RealGiveFeeExecl,0) - IFNULL(RealGiveFeeCompute,0) AS Diff FROM (
...@@ -109,7 +102,7 @@ public Comparison CheckAccountingUnitRealGiveFeeDiff(int allotId, string searchQ ...@@ -109,7 +102,7 @@ public Comparison CheckAccountingUnitRealGiveFeeDiff(int allotId, string searchQ
SELECT * FROM view_check_dept_specialunit WHERE AllotId = @allotId SELECT * FROM view_check_dept_specialunit WHERE AllotId = @allotId
) TAB ) TAB
WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm
ORDER BY HospitalId,Year,Month,ABS(DIFF) DESC ORDER BY HospitalId,Year,Month,ABS(DIFF) DESC LIMIT @pageSize OFFSET @pageIndex
"; ";
var queryCount = @" var queryCount = @"
...@@ -119,10 +112,28 @@ public Comparison CheckAccountingUnitRealGiveFeeDiff(int allotId, string searchQ ...@@ -119,10 +112,28 @@ public Comparison CheckAccountingUnitRealGiveFeeDiff(int allotId, string searchQ
) TAB ) TAB
WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm WHERE if(@searchQuery='','',AccountingUnit) LIKE @parm
"; ";
return new Comparison() 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>(),
TotalCount = DapperQuery<int>(queryCount, new { allotId = request.AllotId, searchQuery = request.SearchQuery, parm = $"%{request.SearchQuery}%" })?.FirstOrDefault() ?? 0,
};
}
/// <summary>
/// 实发绩效校验
/// </summary>
public DtoModels.Comparison<DeptComparisonTotal> CheckView_check_deptUnitRealGiveFeeDiffTotal(int allotId)
{
var queryData = @"SELECT UnitType,Count(1) Count,Sum(RealGiveFeeCompute) SumFee FROM
(SELECT *,IFNULL(RealGiveFeeExecl,0) - IFNULL(RealGiveFeeCompute,0) AS Diff FROM (
SELECT * FROM view_check_dept_account UNION ALL
SELECT * FROM view_check_dept_specialunit
) TAB
ORDER BY HospitalId,Year,Month,ABS(DIFF) DESC )view_check_dept
where AllotID = @allotId and Diff <> 0 GROUP BY UnitType";
return new DtoModels.Comparison<DeptComparisonTotal>()
{ {
Datas = DapperQuery<view_check_emp>(queryData, new { allotId, searchQuery, parm = $"%{searchQuery}%" })?.ToList() ?? new List<view_check_emp>(), Datas = DapperQuery<DeptComparisonTotal>(queryData, new { allotId })?.ToList() ?? new List<DeptComparisonTotal>(),
TotalCount = DapperQuery<int>(queryCount, new { allotId, searchQuery, parm = $"%{searchQuery}%" })?.FirstOrDefault() ?? 0,
}; };
} }
......
using Microsoft.EntityFrameworkCore; using Dapper;
using Microsoft.EntityFrameworkCore;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
namespace Performance.Repository namespace Performance.Repository
{ {
public partial class PerforReportRepository : PerforRepository<PerReport> public partial class PerforReportRepository : PerforRepository<PerReport>
{ {
private readonly IDbConnection connection;
public PerforReportRepository(PerformanceDbContext context) : base(context) public PerforReportRepository(PerformanceDbContext context) : base(context)
{ {
connection = context?.Database.GetDbConnection() ?? throw new ArgumentNullException(nameof(context));
} }
/// <summary> /// <summary>
...@@ -397,13 +402,78 @@ public List<dynamic> QueryCompute(int allotId, string viewName) ...@@ -397,13 +402,78 @@ public List<dynamic> QueryCompute(int allotId, string viewName)
return DapperQuery<dynamic>(sql, new { allotId })?.ToList(); return DapperQuery<dynamic>(sql, new { allotId })?.ToList();
} }
public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, DateTime endTime)
public List<dynamic> QueryComputeByDate(string viewName, BeginEndTime request)
{ {
var sql = $@"SELECT * FROM {viewName} var sql = $@"SELECT * FROM {viewName}
where STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') >= @beginTime where STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') >= @beginTime
and STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') < @endTime"; and STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') < @endTime and hospitalid = {request.HospitalId}";
if (request.Search != null && request.Search.Any(w => !string.IsNullOrEmpty(w.Title) && !string.IsNullOrEmpty(w.Value)))
{
var where = request.Search.Where(w => !string.IsNullOrEmpty(w.Title) && !string.IsNullOrEmpty(w.Value)).Select(t => $"{t.Title} like '%{t.Value}%'");
sql += " and " + string.Join(" and ", where);
}
if (!string.IsNullOrEmpty(request.SortBy))
sql += $" order by {request.SortBy} ";
return DapperQuery<dynamic>(sql, new { beginTime = request.BeginTime, endTime = request.EndTime }).ToList();
}
public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSummary request)
{
if (!new string[] { "view_allot_sign_dept", "view_allot_sign_emp", "view_allot_sign_emp_finance" }.Contains(viewName)) return new List<dynamic>();
var sql = $@" SELECT * FROM {viewName} where STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') >= @beginTime
and STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') < @endTime and hospitalid = {request.HospitalId}";
Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>
{
{ "view_allot_sign_emp_group", new List<string>{ "hospitalid", "year", "month", "source", "allotid", "secondid", "states", "unittype", "accountingunit", "isshowmanage", "employeename", "jobnumber", "jobtitle", "emp_unittype", "emp_accountingunit", "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_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_sum", new List<string>{ "perforsumfee", "performanagementfee", "nightworkperfor", "adjustlaterotherfee", "otherperfor", "hideotherperfor", "shouldgivefee", "reservedratiofee", "realgivefee" } },
};
if (request.GroupBy == null || !request.GroupBy.Any(t => !string.IsNullOrEmpty(t))) request.GroupBy = dict[viewName + "_group"];
return DapperQuery<dynamic>(sql, new { beginTime = beginTime.ToString("yyyy-MM-dd"), endTime = endTime.ToString("yyyy-MM-dd") }).ToList(); if (request.SumBy == null || !request.SumBy.Any(t => !string.IsNullOrEmpty(t))) request.SumBy = dict[viewName + "_sum"];
if (request.Search != null && request.Search.Any(w => !string.IsNullOrEmpty(w.Title) && !string.IsNullOrEmpty(w.Value)))
{
var where = request.Search.Where(w => !string.IsNullOrEmpty(w.Title) && !string.IsNullOrEmpty(w.Value)).Select(t => $"{t.Title} like '%{t.Value}%'");
sql += " and " + string.Join(" and ", where);
}
if (!string.IsNullOrEmpty(request.SortBy))
sql += $" order by {request.SortBy} ";
sql = $"select {string.Join(",", request.GroupBy)}, {string.Join(",", request.SumBy.Select(t => $"sum({t}) {t}"))} from ({sql}) tab group by {string.Join(",", request.GroupBy)}";
return DapperQuery<dynamic>(sql, new { beginTime = request.BeginTime, endTime = request.EndTime }).ToList();
}
public (List<dynamic> list, int count) QueryComputePageData(string query, object param = null)
{
try
{
using (var multi = connection.QueryMultiple(query, param, commandTimeout: 1000))
{
var list = multi.Read<dynamic>().ToList();
var count = multi.Read<int>().FirstOrDefault();
return (list, count);
}
}
catch
{
return (new List<dynamic>(), 0);
}
} }
public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead) public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
......
...@@ -486,8 +486,15 @@ public void Generate(per_allot allot) ...@@ -486,8 +486,15 @@ public void Generate(per_allot allot)
/// <param name="allot"></param> /// <param name="allot"></param>
public void GenerateReport(per_allot allot) public void GenerateReport(per_allot allot)
{ {
try
{
reportService.ExecProc("call proc_report_performance(@hospitalid, @year, @month);", new { allot.HospitalId, allot.Year, allot.Month }); reportService.ExecProc("call proc_report_performance(@hospitalid, @year, @month);", new { allot.HospitalId, allot.Year, allot.Month });
} }
catch (Exception ex)
{
_logger.LogError($"{allot.Year}{allot.Month}月绩效报表生成失败。 allotid: {allot.ID}。" + ex.Message);
}
}
/// <summary> /// <summary>
/// 验证科室核算单元、工号 /// 验证科室核算单元、工号
......
...@@ -272,17 +272,24 @@ public List<res_specialunit> GetSpecial(int allotId) ...@@ -272,17 +272,24 @@ public List<res_specialunit> GetSpecial(int allotId)
} }
/// <summary> /// <summary>
/// 返回医技组科室绩效
/// </summary>
/// <param name="allotId">绩效ID</param>
/// <returns></returns>
public List<DeptResponse> GetMedicalPerformance(int allotId)
{
return GetGroupPerformance(allotId, new List<int> { (int)UnitType.医技组 });
}
/// <summary>
/// 返回医生组科室绩效 /// 返回医生组科室绩效
/// </summary> /// </summary>
/// <param name="allotId">绩效ID</param> /// <param name="allotId">绩效ID</param>
/// <returns></returns> /// <returns></returns>
public List<DeptResponse> GetDoctorPerformance(int allotId) public List<DeptResponse> GetDoctorPerformance(int allotId)
{ {
List<int> types = new List<int> { (int)UnitType.医生组, (int)UnitType.医技组 }; return GetGroupPerformance(allotId, new List<int> { (int)UnitType.医生组 });
var list = perforResaccountRepository.GetEntities(t => types.Contains(t.UnitType.Value) && t.AllotID == allotId)?.OrderBy(t => t.UnitType).ThenByDescending(t => t.AccountingUnit);
List<DeptResponse> doctor = _mapper.Map<List<DeptResponse>>(list);
doctor?.ForEach(t => t.UnitName = ((UnitType)t.UnitType).ToString());
return doctor;
} }
/// <summary> /// <summary>
...@@ -292,10 +299,7 @@ public List<DeptResponse> GetDoctorPerformance(int allotId) ...@@ -292,10 +299,7 @@ public List<DeptResponse> GetDoctorPerformance(int allotId)
/// <returns></returns> /// <returns></returns>
public List<DeptResponse> GetNursePerformance(int allotId) public List<DeptResponse> GetNursePerformance(int allotId)
{ {
var list = perforResaccountRepository.GetEntities(t => t.UnitType == (int)UnitType.护理组 && t.AllotID == allotId)?.OrderBy(t => t.UnitType).ThenByDescending(t => t.AccountingUnit); return GetGroupPerformance(allotId, new List<int> { (int)UnitType.护理组 });
List<DeptResponse> nurse = _mapper.Map<List<DeptResponse>>(list);
nurse?.ForEach(t => t.UnitName = ((UnitType)t.UnitType).ToString());
return nurse;
} }
/// <summary> /// <summary>
...@@ -305,13 +309,16 @@ public List<DeptResponse> GetNursePerformance(int allotId) ...@@ -305,13 +309,16 @@ public List<DeptResponse> GetNursePerformance(int allotId)
/// <returns></returns> /// <returns></returns>
public List<DeptResponse> GetOtherPerformance(int allotId) public List<DeptResponse> GetOtherPerformance(int allotId)
{ {
var unitType = new List<int> { (int)UnitType.其他医技组, (int)UnitType.其他医生组, (int)UnitType.其他护理组, (int)UnitType.专家组 }; return GetGroupPerformance(allotId, new List<int> { (int)UnitType.其他医技组, (int)UnitType.其他医生组, (int)UnitType.其他护理组, (int)UnitType.专家组 });
}
public List<DeptResponse> GetGroupPerformance(int allotId, List<int> group)
{
var unitType = group;
var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId)?.OrderBy(t => t.UnitType).ThenByDescending(t => t.AccountingUnit); var list = perforResaccountRepository.GetEntities(t => unitType.Contains(t.UnitType.Value) && t.AllotID == allotId)?.OrderBy(t => t.UnitType).ThenByDescending(t => t.AccountingUnit);
List<DeptResponse> other = _mapper.Map<List<DeptResponse>>(list); List<DeptResponse> Performance = _mapper.Map<List<DeptResponse>>(list);
other?.ForEach(t => t.UnitName = ((UnitType)t.UnitType).ToString()); Performance?.ForEach(t => t.UnitName = ((UnitType)t.UnitType).ToString());
return other; return Performance;
} }
/// <summary> /// <summary>
/// 返回行政科室绩效列表 /// 返回行政科室绩效列表
/// </summary> /// </summary>
...@@ -2000,7 +2007,7 @@ private decimal GetDecimal(decimal? value, decimal _ = 0) ...@@ -2000,7 +2007,7 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
public List<cof_alias> CustomColumnHeaders(int hospitalId, string route) public List<cof_alias> CustomColumnHeaders(int hospitalId, string route, params string[] heads)
{ {
var init = new List<cof_alias>(); var init = new List<cof_alias>();
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId) ?? new List<cof_alias>(); var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId) ?? new List<cof_alias>();
...@@ -2017,6 +2024,11 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route) ...@@ -2017,6 +2024,11 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route)
{ "/report/wholehospital_grant" , ComputeConfig.AllComputeViewByDate }, { "/report/wholehospital_grant" , ComputeConfig.AllComputeViewByDate },
{ "/report/wholehospital_accounting_grant" , ComputeConfig.AllComputeDepartmentViewByDate }, { "/report/wholehospital_accounting_grant" , ComputeConfig.AllComputeDepartmentViewByDate },
{ "/report/wholehospital_finance_grant" , ComputeConfig.AllComputePersonViewByDate }, { "/report/wholehospital_finance_grant" , ComputeConfig.AllComputePersonViewByDate },
{ "/report/wholehospital_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) },
{ "/report/wholehospital_accounting_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) },
{ "/report/wholehospital_finance_grant_summary" , ComputeConfig.PerformanceTotal(route,heads) },
}; };
init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>(); init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
} }
...@@ -2070,13 +2082,46 @@ public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewN ...@@ -2070,13 +2082,46 @@ public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewN
{ {
return reportRepository.QueryCompute(AllotId, viewName); return reportRepository.QueryCompute(AllotId, viewName);
} }
public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime, DateTime endTime)
public List<dynamic> GetAllComputeViewByDate(string viewName, BeginEndTime request)
{
request.EndTime = Convert.ToDateTime(request.EndTime).AddMonths(1).ToString();
return reportRepository.QueryComputeByDate(viewName, request);
}
public List<dynamic> GetAllComputeViewByDateAndTotal(string viewName, HospitalGrantSummary request)
{ {
return reportRepository.QueryComputeByDate(viewName, beginTime, endTime); request.EndTime = Convert.ToDateTime(request.EndTime).AddMonths(1).ToString();
return reportRepository.QueryComputeByDateAndTotal(viewName, request);
}
public QueryComputeByDateGetPage GetPerformanceSummary(HospitalGrantSummary request, string ViewName)
{
DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
throw new PerformanceException("请输入正确的时间");
var datas = reportRepository.QueryComputeByDateAndTotal(ViewName, request);
if (null == datas)
throw new PerformanceException("当前绩效记录不存在");
var list = new QueryComputeByDateGetPage
{
Data = datas.Skip(request.PageSize * (request.CurrentPage - 1)).Take(request.PageSize).ToList(),
TotalData = SumDatas(datas),
TotalCount = datas.Count(),
TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize),
CurrentPage = request.CurrentPage,
PageSize = request.PageSize
};
return list;
} }
/// <summary> /// <summary>
/// /// 合计数据
/// </summary> /// </summary>
/// <param name="datas"></param> /// <param name="datas"></param>
/// <returns></returns> /// <returns></returns>
...@@ -2116,30 +2161,49 @@ public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime ...@@ -2116,30 +2161,49 @@ public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime
public class ComputeConfig public class ComputeConfig
{ {
public static List<cof_alias> PerformanceTotal(string route, string[] heads)
{
if (heads == null || heads.Length == 0 || (heads.Length > 0 && heads[0] == ""))
{
if (route == "/report/wholehospital_grant_summary")
return AllComputeView.ToList();
if (route == "/report/wholehospital_accounting_grant_summary")
return AllComputeDepartmentView.ToList();
if (route == "/report/wholehospital_finance_grant_summary")
return AllComputePersonView.ToList();
}
if (route == "/report/wholehospital_grant_summary")
return AllComputeView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
if (route == "/report/wholehospital_accounting_grant_summary")
return AllComputeDepartmentView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
if (route == "/report/wholehospital_finance_grant_summary")
return AllComputePersonView.Where(t => heads.Contains(t.Name.ToLower())).ToList();
return null;
}
public static List<cof_alias> AllComputeView { get; } = new List<cof_alias> public static List<cof_alias> AllComputeView { get; } = new List<cof_alias>
{ {
new cof_alias{ Alias = "来源", Name = nameof(view_allot_sign_emp.Source), States = 1}, new cof_alias{ Alias = "来源", Name = nameof(view_allot_sign_emp.Source), States = 1, SumStatus = 0},
new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1}, new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0},
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1}, new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0},
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1}, new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0},
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1}, new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0},
new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1}, new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1, SumStatus = 0},
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1}, new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1, SumStatus = 0},
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1}, new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1, SumStatus = 0},
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1}, new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1, SumStatus = 0},
//new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1},
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1}, new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1, SumStatus = 0},
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1}, new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1}, new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1}, new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1}, new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1}, new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1}, new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1}, new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1}, new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1},
}; };
private static List<cof_alias> _allComputeViewByDate = new List<cof_alias>(); private static List<cof_alias> _allComputeViewByDate = new List<cof_alias>();
...@@ -2149,8 +2213,8 @@ public static List<cof_alias> AllComputeViewByDate ...@@ -2149,8 +2213,8 @@ public static List<cof_alias> AllComputeViewByDate
{ {
if (_allComputeViewByDate == null || _allComputeViewByDate.Count == 0) if (_allComputeViewByDate == null || _allComputeViewByDate.Count == 0)
{ {
_allComputeViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 }); _allComputeViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputeViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 }); _allComputeViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputeViewByDate.AddRange(AllComputeView); _allComputeViewByDate.AddRange(AllComputeView);
} }
return _allComputeViewByDate; return _allComputeViewByDate;
...@@ -2158,21 +2222,24 @@ public static List<cof_alias> AllComputeViewByDate ...@@ -2158,21 +2222,24 @@ public static List<cof_alias> AllComputeViewByDate
} }
public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias> public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias>
{ {
new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1}, new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_emp.UnitType), States = 1, SumStatus = 0},
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1}, new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1, SumStatus = 0},
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1}, new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1, SumStatus = 0},
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1}, new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1, SumStatus = 0},
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1}, new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1}, new cof_alias{ Alias = "调节后实发管理绩效", Name = nameof(view_allot_sign_emp.PerforManagementFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1}, new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1}, new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1}, new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1}, new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1}, new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1}, new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1, SumStatus = 1},
}; };
private static List<cof_alias> _allComputePersonViewByDate = new List<cof_alias>(); private static List<cof_alias> _allComputePersonViewByDate = new List<cof_alias>();
...@@ -2182,8 +2249,8 @@ public static List<cof_alias> AllComputePersonViewByDate ...@@ -2182,8 +2249,8 @@ public static List<cof_alias> AllComputePersonViewByDate
{ {
if (_allComputePersonViewByDate == null || _allComputePersonViewByDate.Count == 0) if (_allComputePersonViewByDate == null || _allComputePersonViewByDate.Count == 0)
{ {
_allComputePersonViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 }); _allComputePersonViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputePersonViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 }); _allComputePersonViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputePersonViewByDate.AddRange(AllComputePersonView); _allComputePersonViewByDate.AddRange(AllComputePersonView);
} }
return _allComputePersonViewByDate; return _allComputePersonViewByDate;
...@@ -2191,24 +2258,24 @@ public static List<cof_alias> AllComputePersonViewByDate ...@@ -2191,24 +2258,24 @@ public static List<cof_alias> AllComputePersonViewByDate
} }
public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias> public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias>
{ {
new cof_alias{ Alias = "核算群体", Name = nameof(view_allot_sign_dept.UnitName), States = 1}, new cof_alias{ Alias = "核算组别", Name = nameof(view_allot_sign_dept.UnitType), States = 1, SumStatus = 0},
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_dept.AccountingUnit), States = 1}, new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_dept.AccountingUnit), States = 1, SumStatus = 0},
new cof_alias{ Alias = "业绩绩效", Name = nameof(view_allot_sign_dept.PerforFee), States = 1}, new cof_alias{ Alias = "业绩绩效", Name = nameof(view_allot_sign_dept.PerforFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "工作量绩效", Name = nameof(view_allot_sign_dept.WorkloadFee), States = 1}, new cof_alias{ Alias = "工作量绩效", Name = nameof(view_allot_sign_dept.WorkloadFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核前其他绩效", Name = nameof(view_allot_sign_dept.AssessBeforeOtherFee), States = 1}, new cof_alias{ Alias = "考核前其他绩效", Name = nameof(view_allot_sign_dept.AssessBeforeOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核前绩效合计", Name = nameof(view_allot_sign_dept.PerforTotal), States = 1}, new cof_alias{ Alias = "考核前绩效合计", Name = nameof(view_allot_sign_dept.PerforTotal), States = 1, SumStatus = 1},
new cof_alias{ Alias = "科室考核得分", Name = nameof(view_allot_sign_dept.ScoringAverage), States = 1}, new cof_alias{ Alias = "科室考核得分", Name = nameof(view_allot_sign_dept.ScoringAverage), States = 1, SumStatus = 1},
new cof_alias{ Alias = "药占比奖罚", Name = nameof(view_allot_sign_dept.MedicineExtra), States = 1}, new cof_alias{ Alias = "药占比奖罚", Name = nameof(view_allot_sign_dept.MedicineExtra), States = 1, SumStatus = 1},
new cof_alias{ Alias = "材料占比奖罚", Name = nameof(view_allot_sign_dept.MaterialsExtra), States = 1}, new cof_alias{ Alias = "材料占比奖罚", Name = nameof(view_allot_sign_dept.MaterialsExtra), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院奖罚", Name = nameof(view_allot_sign_dept.Extra), States = 1}, new cof_alias{ Alias = "医院奖罚", Name = nameof(view_allot_sign_dept.Extra), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核后其他绩效", Name = nameof(view_allot_sign_dept.AssessLaterOtherFee), States = 1}, new cof_alias{ Alias = "考核后其他绩效", Name = nameof(view_allot_sign_dept.AssessLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "考核后绩效", Name = nameof(view_allot_sign_dept.AssessLaterPerforTotal), States = 1}, new cof_alias{ Alias = "考核后绩效", Name = nameof(view_allot_sign_dept.AssessLaterPerforTotal), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节系数", Name = nameof(view_allot_sign_dept.AdjustFactor), States = 1}, new cof_alias{ Alias = "调节系数", Name = nameof(view_allot_sign_dept.AdjustFactor), States = 1, SumStatus = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_dept.AdjustLaterOtherFee), States = 1}, new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_dept.AdjustLaterOtherFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "科主任实发管理绩效", Name = nameof(view_allot_sign_dept.AssessLaterManagementFee), States = 1}, new cof_alias{ Alias = "科主任实发管理绩效", Name = nameof(view_allot_sign_dept.AssessLaterManagementFee), States = 1, SumStatus = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_dept.AprPerforAmount), States = 1}, new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_dept.AprPerforAmount), States = 1, SumStatus = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1}, new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1, SumStatus = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1, SumStatus = 1},
}; };
private static List<cof_alias> _allComputeDepartmentViewByDate = new List<cof_alias>(); private static List<cof_alias> _allComputeDepartmentViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeDepartmentViewByDate public static List<cof_alias> AllComputeDepartmentViewByDate
...@@ -2217,8 +2284,8 @@ public static List<cof_alias> AllComputeDepartmentViewByDate ...@@ -2217,8 +2284,8 @@ public static List<cof_alias> AllComputeDepartmentViewByDate
{ {
if (_allComputeDepartmentViewByDate == null || _allComputeDepartmentViewByDate.Count == 0) if (_allComputeDepartmentViewByDate == null || _allComputeDepartmentViewByDate.Count == 0)
{ {
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 }); _allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1, SumStatus = 0 });
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 }); _allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1, SumStatus = 0 });
_allComputeDepartmentViewByDate.AddRange(AllComputeDepartmentView); _allComputeDepartmentViewByDate.AddRange(AllComputeDepartmentView);
} }
return _allComputeDepartmentViewByDate; return _allComputeDepartmentViewByDate;
......
...@@ -869,6 +869,7 @@ public bool BatchSaveAccounting(int allotId, SaveCollectData request) ...@@ -869,6 +869,7 @@ public bool BatchSaveAccounting(int allotId, SaveCollectData request)
var json = JsonHelper.Serialize(item); var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_accounting>(json); var data = JsonHelper.Deserialize<cof_accounting>(json);
data.AllotId = allotId; data.AllotId = allotId;
if (!unitType.Contains(data?.UnitType) && !string.IsNullOrEmpty(data?.UnitType)) return false; if (!unitType.Contains(data?.UnitType) && !string.IsNullOrEmpty(data?.UnitType)) return false;
if (getAccounts != null) if (getAccounts != null)
if (getAccounts.Any(t => t.AccountingUnit == data?.AccountingUnit && t.UnitType == data?.UnitType)) continue; if (getAccounts.Any(t => t.AccountingUnit == data?.AccountingUnit && t.UnitType == data?.UnitType)) continue;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
using Performance.Services.ExtractExcelService; using Performance.Services.ExtractExcelService;
using Performance.Services.Queues;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
...@@ -26,6 +27,7 @@ public class CustomExtractService : IAutoInjection ...@@ -26,6 +27,7 @@ public class CustomExtractService : IAutoInjection
private readonly PerforPerdeptdicRepository _perforPerdeptdicRepository; private readonly PerforPerdeptdicRepository _perforPerdeptdicRepository;
private readonly PerforHospitalconfigRepository _perforHospitalconfigRepository; private readonly PerforHospitalconfigRepository _perforHospitalconfigRepository;
private readonly PerforCustscriptRepository _perforcustscriptRepository; private readonly PerforCustscriptRepository _perforcustscriptRepository;
private readonly IHubNotificationQueue _notificationQueue;
public CustomExtractService( public CustomExtractService(
ILogger<CustomExtractService> logger, ILogger<CustomExtractService> logger,
...@@ -35,7 +37,8 @@ public class CustomExtractService : IAutoInjection ...@@ -35,7 +37,8 @@ public class CustomExtractService : IAutoInjection
PerforPerallotRepository perallotRepository, PerforPerallotRepository perallotRepository,
PerforPerdeptdicRepository perforPerdeptdicRepository, PerforPerdeptdicRepository perforPerdeptdicRepository,
PerforHospitalconfigRepository perforHospitalconfigRepository, PerforHospitalconfigRepository perforHospitalconfigRepository,
PerforCustscriptRepository perforcustscriptRepository) PerforCustscriptRepository perforcustscriptRepository,
IHubNotificationQueue notificationQueue)
{ {
_logger = logger; _logger = logger;
_options = options; _options = options;
...@@ -45,6 +48,7 @@ public class CustomExtractService : IAutoInjection ...@@ -45,6 +48,7 @@ public class CustomExtractService : IAutoInjection
_perforPerdeptdicRepository = perforPerdeptdicRepository; _perforPerdeptdicRepository = perforPerdeptdicRepository;
_perforHospitalconfigRepository = perforHospitalconfigRepository; _perforHospitalconfigRepository = perforHospitalconfigRepository;
_perforcustscriptRepository = perforcustscriptRepository; _perforcustscriptRepository = perforcustscriptRepository;
_notificationQueue = notificationQueue;
} }
public bool CheckConfigScript(int userId, int allotId) public bool CheckConfigScript(int userId, int allotId)
...@@ -138,6 +142,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -138,6 +142,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
var conf = configs.FirstOrDefault(w => w.Id == item.ConfigId); var conf = configs.FirstOrDefault(w => w.Id == item.ConfigId);
if (conf != null) if (conf != null)
{ {
_notificationQueue.Send(new Notification(allot.ID, "ReceiveMessage", new TextContent($"正在提取“{item.Name}”的数据")));
var execsql = item.Script; var execsql = item.Script;
var dynamics = QueryData(conf, execsql, parameters); var dynamics = QueryData(conf, execsql, parameters);
...@@ -152,8 +157,12 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -152,8 +157,12 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
var sheet = workbook.CreateSheet(item.Name); var sheet = workbook.CreateSheet(item.Name);
// 没数据跳过 // 没数据跳过
if (dynamics == null || dynamics.Count() == 0) if (dynamics == null || dynamics.Count() == 0)
{
_notificationQueue.Send(new Notification(allot.ID, "ReceiveMessage", new TextContent($"“{item.Name}”提取的数据为空")));
continue; continue;
}
_notificationQueue.Send(new Notification(allot.ID, "ReceiveMessage", new TextContent($"正在写入“{item.Name}”的数据")));
var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys; var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys;
for (int col = 0; col < headers.Count; col++) for (int col = 0; col < headers.Count; col++)
{ {
...@@ -221,6 +230,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -221,6 +230,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
} }
row++; row++;
} }
_notificationQueue.Send(new Notification(allot.ID, "ReceiveMessage", new TextContent($"“{item.Name}”的数据写入完成")));
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -228,6 +238,8 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -228,6 +238,8 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
} }
} }
} }
_notificationQueue.Send(new Notification(allot.ID, "ReceiveMessage", new TextContent($"数据已提取完成,正在写入文件,文件稍后将自动下载...")));
} }
/// <summary> /// <summary>
......
...@@ -191,18 +191,34 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -191,18 +191,34 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
/// <param name="allData"></param> /// <param name="allData"></param>
/// <param name="isAll"></param> /// <param name="isAll"></param>
/// <returns></returns> /// <returns></returns>
public string AllComputerViewReportByDate(int hospitalId, List<dynamic> dynamics, string route, string name, DateTime beginTime, DateTime endTime) public string AllComputerViewReportByDate(int hospitalId, List<dynamic> dynamics, string route, string name, DateTime beginTime, DateTime endTime,params string[] headlist)
{ {
var hospital = perforHospital.GetEntity(t => t.ID == hospitalId); var hospital = perforHospital.GetEntity(t => t.ID == hospitalId);
var title = (beginTime.AddMonths(1).Date == endTime.Date) var title = (beginTime.AddMonths(1).Date == endTime.Date)
? $"{beginTime.ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}" ? $"{beginTime.ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}"
: $"{beginTime.ToString("yyyy年MM月")}{endTime.ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}"; : $"{beginTime.ToString("yyyy年MM月")}{endTime.AddMonths(-1).ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}";
return AllComputerDown(hospital, dynamics, route, title, name); return AllComputerDown(hospital, dynamics, route, title, name, headlist);
} }
public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, string route, string title, string name) public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, string route, string title, string name, params string[] headlist)
{
var ser = JsonHelper.Serialize(dynamics);
var dict = JsonHelper.Deserialize<List<Dictionary<string, object>>>(ser);
var data = new List<Dictionary<string, object>>();
foreach (var obj in dict)
{
Dictionary<string, object> nobj = new Dictionary<string, object>();
foreach (var item in obj)
{ {
var headList = _computeService.CustomColumnHeaders(hospital.ID, route).Where(w => w.States == 1).ToList(); nobj[item.Key.ToLower()] = item.Value;
}
data.Add(nobj);
}
var headList = _computeService.CustomColumnHeaders(hospital.ID, route, headlist).Where(w => w.States == 1).ToList();
var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{hospital.ID}"); var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{hospital.ID}");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}"); string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}");
...@@ -225,11 +241,11 @@ public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, str ...@@ -225,11 +241,11 @@ public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, str
} }
for (int col = 0; col < headList.Count; col++) for (int col = 0; col < headList.Count; col++)
{ {
for (int row = 0; row < dynamics.Count(); row++) for (int row = 0; row < data.Count(); row++)
{ {
var data = dynamics.ElementAt(row); var temp = data.ElementAt(row);
var temp = (IDictionary<string, object>)data; var low = temp.Keys.ToString().ToLower();
var value = temp[headList[col].Name]; var value = temp[headList[col].Name.ToLower()];
worksheet.Cells[row + 3, col + 1].Value = value; worksheet.Cells[row + 3, col + 1].Value = value;
} }
...@@ -272,6 +288,7 @@ public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, str ...@@ -272,6 +288,7 @@ public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, str
return filepath; return filepath;
} }
public static List<(string, Func<ComputeResponse, object>, Func<List<ComputeResponse>, decimal>)> AllCompute { get; } = new List<(string, Func<ComputeResponse, object>, Func<List<ComputeResponse>, decimal>)> public static List<(string, Func<ComputeResponse, object>, Func<List<ComputeResponse>, decimal>)> AllCompute { get; } = new List<(string, Func<ComputeResponse, object>, Func<List<ComputeResponse>, decimal>)>
{ {
("来源",t=>t.Source,null), ("来源",t=>t.Source,null),
......
...@@ -6,8 +6,10 @@ ...@@ -6,8 +6,10 @@
using NPOI.SS.Util; using NPOI.SS.Util;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.DtoModels.Request;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Infrastructure.Models;
using Performance.Repository; using Performance.Repository;
using Performance.Services.AllotCompute; using Performance.Services.AllotCompute;
using System; using System;
...@@ -15,6 +17,7 @@ ...@@ -15,6 +17,7 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text.RegularExpressions;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -1123,33 +1126,41 @@ public List<TitleValue> GetPerforTypeDictHide(int allotId) ...@@ -1123,33 +1126,41 @@ public List<TitleValue> GetPerforTypeDictHide(int allotId)
} }
#endregion #endregion
public ComparisonResponse GetComparison(ComparisonPagingRequest request) public ComparisonResponse<DtoModels.Comparison<view_check_emp>> GetComparison(ComparisonPagingRequest request)
{ {
var result = new ComparisonResponse(); var result = new ComparisonResponse<DtoModels.Comparison<view_check_emp>>();
if (request.ViewName == "view_check_dept") if (request.ViewName == "view_check_dept")
{ {
result.Heads = ComparisonConfig.DeptHeads; result.Heads = ComparisonConfig.DeptHeads;
result.Datas = peremployeeRepository.CheckAccountingUnitRealGiveFeeDiff(request.AllotId, request.SearchQuery); result.Datas = peremployeeRepository.CheckAccountingUnitRealGiveFeeDiff(request);
} }
else if (request.ViewName == "view_check_emp") else if (request.ViewName == "view_check_emp")
{ {
result.Heads = ComparisonConfig.EmpHeads; result.Heads = ComparisonConfig.EmpHeads;
result.Datas = peremployeeRepository.CheckEmployeeRealGiveFeeDiff(request.AllotId, request.SearchQuery); result.Datas = peremployeeRepository.CheckEmployeeRealGiveFeeDiff(request);
} }
else else
{ {
result.Datas = new Comparison { Datas = new List<view_check_emp>(), TotalCount = 0 }; result.Datas = new DtoModels.Comparison<view_check_emp> { Datas = new List<view_check_emp>(), TotalCount = 0 };
} }
//result.Datas = peremployeeRepository.GetComparison(request); //result.Datas = peremployeeRepository.GetComparison(request);
return result; return result;
} }
public ComparisonResponse<DtoModels.Comparison<DeptComparisonTotal>> GetDeptComparisonTotal(int AllotId)
{
var result = new ComparisonResponse<DtoModels.Comparison<DeptComparisonTotal>>();
result.Heads = ComparisonConfig.DeptTotalHeads;
result.Datas = peremployeeRepository.CheckView_check_deptUnitRealGiveFeeDiffTotal(AllotId);
return result;
}
#region 手工数据录入 #region 手工数据录入
public List<GatherDropResponse> GetGatherDrop(int allotId) public List<GatherDropResponse> GetGatherDrop(int allotId)
{ {
again:
var perSheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value)); var perSheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value));
if (perSheets == null || !perSheets.Any()) if (perSheets == null || !perSheets.Any())
{ {
...@@ -1165,21 +1176,37 @@ public List<GatherDropResponse> GetGatherDrop(int allotId) ...@@ -1165,21 +1176,37 @@ public List<GatherDropResponse> GetGatherDrop(int allotId)
// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据 // 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
allotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID; allotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID;
if (allotId == allot.ID) return new List<GatherDropResponse>(); if (allotId == allot.ID) return new List<GatherDropResponse>();
goto again;
} }
//var sheets = perSheets.Select(t => new GatherDropResponse() { Label = t.SheetName, Value = t.SheetName }); //var sheets = perSheets.Select(t => new GatherDropResponse() { Label = t.SheetName, Value = t.SheetName });
var imHeaders = imheaderRepository.GetEntities(t => t.AllotID == allotId); var imHeaders = imheaderRepository.GetEntities(t => t.AllotID == allotId);
var exresultgather = exresultgatherRepository.GetEntities(t => t.AllotId == allotId);
foreach (var item in exresultgather.Select(t => new { t.Category, t.Source }).Distinct())
{
int id = perSheets.Where(t => t.SheetName.Contains(item.Source)).Select(t => new { t.ID }).ToList()[0].ID;
imHeaders.Add(
new im_header
{
SheetID = id,
CellValue = item.Category
}
);
}
var result = new List<GatherDropResponse>(); var result = new List<GatherDropResponse>();
var cellValue = new[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称" }; var cellValue = new[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称" };
foreach (var sheet in perSheets) foreach (var sheet in perSheets)
{ {
var drop = new GatherDropResponse(); var drop = new GatherDropResponse();
var header = imHeaders.Where(t => t.SheetID == sheet.ID && !cellValue.Contains(t.CellValue)).Select(t => t.CellValue).Distinct(); var header = imHeaders.Where(t => t.SheetID == sheet.ID && !cellValue.Contains(t.CellValue)).Select(t => t.CellValue).Distinct();
drop.Label = sheet.SheetName.Split(' ')[1]; drop.Label = Regex.Replace(sheet.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*sheet.SheetName.Split(' ')[1]*/;
drop.Value = sheet.SheetName.Split(' ')[1]; drop.Value = Regex.Replace(sheet.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*sheet.SheetName.Split(' ')[1]*/;
drop.Children = header.Select(t => new GatherDropResponse() { Label = t, Value = t }).ToList(); drop.Children = header.Select(t => new GatherDropResponse() { Label = t, Value = t }).ToList();
result.Add(drop); result.Add(drop);
} }
...@@ -1196,6 +1223,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request) ...@@ -1196,6 +1223,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
Visible = 1 Visible = 1
}).ToList()); }).ToList());
if (result.Columns != null && result.Columns.Any()) if (result.Columns != null && result.Columns.Any())
{ {
foreach (var column in result.Columns) foreach (var column in result.Columns)
...@@ -1209,8 +1237,12 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request) ...@@ -1209,8 +1237,12 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
column.Type = "text"; column.Type = "text";
} }
} }
List<ex_result_gather> data = new List<ex_result_gather>();
if (!string.IsNullOrEmpty(request.Source) && !string.IsNullOrEmpty(request.Category))
{
data = exresultgatherRepository.GetEntities(t => t.AllotId == AllotId && t.Source.Contains(request.Source) && t.Category.Contains(request.Category));
}
var data = exresultgatherRepository.GetEntities(t => t.AllotId == AllotId && t.Source.Contains(request.Source) && t.Category.Contains(request.Category));
if (data == null) if (data == null)
return result; return result;
...@@ -1254,30 +1286,120 @@ public void SaveGatherHands(int allotId, SaveGatherData request) ...@@ -1254,30 +1286,120 @@ public void SaveGatherHands(int allotId, SaveGatherData request)
exresultgatherRepository.AddRange(depts.ToArray()); exresultgatherRepository.AddRange(depts.ToArray());
} }
public GatherResponse GetGather(int allotId, PersonParamsRequest request) public GatherInfo GetGather(int allotId, string department, string source, PersonParamsRequest request)
{
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.Department.Contains(department) && t.Source.Contains(source);
if (request != null && !string.IsNullOrEmpty(request.SearchQuery))
exp = exp.And(t => t.AllotId == allotId && t.Department.Contains(department) && t.Source.Contains(source) && t.DoctorName.Contains(request.SearchQuery) || t.PersonnelNumber.Contains(request.SearchQuery));
var datas = exresultgatherRepository.GetEntities(exp);
var result = datas.GroupBy(a => new { a.Source, a.Department, a.DoctorName, a.PersonnelNumber }).Select(t => new
{
Source = t.Key.Source,
Department = t.Key.Department,
DoctorName = t.Key.DoctorName,
PersonnelNumber = t.Key.PersonnelNumber,
Detail = t.GroupBy(group => group.Category).Select(s => new TitleValue<decimal>
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Fee)
})
});
List<GatherInfoRequest> gatherInfoRequests = new List<GatherInfoRequest>();
foreach (var item in result.ToList())
{
GatherInfoRequest gatherInfoRequest = new GatherInfoRequest()
{
Source = Regex.Replace(item.Source.Replace(" ", "").Replace(".", ""), "[0-9]", ""),
Department = item.Department,
DoctorName = item.DoctorName,
PersonnelNumber = item.PersonnelNumber,
Detail = new List<GatherInfoFee>()
};
foreach (var item2 in item.Detail)
{ {
GatherInfoFee gatherInfoFee = new GatherInfoFee()
{
Category = item2.Title,
Fee = item2.Value
};
gatherInfoRequest.Detail.Add(gatherInfoFee);
}
gatherInfoRequests.Add(gatherInfoRequest);
}
var head = ColumnHeadsConfig.GatherHeads; var head = ColumnHeadsConfig.GatherHeads;
head.ForEach(t => head.ForEach(t =>
{ {
t.Name = t.Name.ToLower(); t.Name = t.Name.ToLower();
}); });
GatherInfo gatherInfo = new GatherInfo()
{
Heads = head,
Datas = gatherInfoRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
CurrentPage = request.PageNumber,
TotalCount = gatherInfoRequests.Count(),
PageSize = request.PageSize,
TotalPages = (int)Math.Ceiling((double)gatherInfoRequests.Count() / request.PageSize)
};
return gatherInfo;
}
public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
{
List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId; Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId;
if (request != null && !string.IsNullOrEmpty(request.SearchQuery)) if (request != null && !string.IsNullOrEmpty(request.SearchQuery))
exp = exp.And(t => t.Department.Contains(request.SearchQuery) || t.DoctorName.Contains(request.SearchQuery) || t.PersonnelNumber.Contains(request.SearchQuery) || t.Category.Contains(request.SearchQuery) || t.Source.Contains(request.SearchQuery)); {
exp = exp.And(t => t.Department.Contains(request.SearchQuery) || t.Source.Contains(request.SearchQuery));
}
var data = peremployeeRepository.GetGatherForPaging(request.PageNumber, request.PageSize, exp); var datas = exresultgatherRepository.GetEntities(exp);
if (datas != null && datas.Any())
{
var result = datas.GroupBy(a => new { a.AllotId, a.Department, a.Source }).Select(t => new
{
ID = t.Key.AllotId,
Department = t.Key.Department,
Source = t.Key.Source,
Fee = t.Sum(a => a.Fee)
});
return new GatherResponse() foreach (var item in result.ToList())
{
GatherTotalRequest gatherTotalRequest = new GatherTotalRequest()
{
ID = item.ID,
Department = item.Department,
Source = Regex.Replace(item.Source.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*item.Source.Split(' ')[1]*/,
Fee = item.Fee
};
gatherTotalRequests.Add(gatherTotalRequest);
}
}
var head = ColumnHeadsConfig.GatherTotal;
head.ForEach(t =>
{
t.Name = t.Name.ToLower();
});
GatherResponse gatherResponse = new GatherResponse()
{ {
Heads = head, Heads = head,
Datas = data, Datas = gatherTotalRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
CurrentPage = data.CurrentPage, CurrentPage = request.PageNumber,
TotalCount = data.TotalCount, TotalCount = gatherTotalRequests.Count(),
PageSize = data.PageSize, PageSize = request.PageSize,
TotalPages = data.TotalPages TotalPages = (int)Math.Ceiling((double)gatherTotalRequests.Count() / request.PageSize)
}; };
return gatherResponse;
} }
public static Dictionary<string, string> Gather { get; } = new Dictionary<string, string> public static Dictionary<string, string> Gather { get; } = new Dictionary<string, string>
...@@ -1323,60 +1445,43 @@ public GatherResponse GetGather(int allotId, PersonParamsRequest request) ...@@ -1323,60 +1445,43 @@ public GatherResponse GetGather(int allotId, PersonParamsRequest request)
return result; return result;
} }
#endregion #endregion
#region 录入校验 #region 录入校验
public bool CheckGatherData(int allotId) public void CheckGatherData(int allotId, SaveGatherData saveGather)
{
try
{ {
var allot = perallotRepository.GetEntity(w => w.ID == allotId); var allot = perallotRepository.GetEntity(w => w.ID == allotId);
if (allot == null) throw new PerformanceException("绩效记录不存在"); if (allot == null) throw new PerformanceException("绩效记录不存在");
var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId); var data = saveGather.Data;
if (data == null || !data.Any()) throw new PerformanceException("录入数据为空");
SetDataStatesAndRemark(data, 2, string.Empty);
var departments = perdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId); var departments = perdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId);
if (departments != null && departments.Any()) if (departments == null || !departments.Any()) throw new PerformanceException("未配置科室字典");
{
var notExistsDeptData = data.Where(w => !departments.Select(t => t.Department).Contains(w.Department)); var notExistsDeptData = data.Where(w => !departments.Select(t => t.Department).Contains(w[0]));
if (notExistsDeptData != null && notExistsDeptData.Any()) if (notExistsDeptData != null && notExistsDeptData.Any())
SetDataStatesAndRemark(notExistsDeptData, 1, "科室字典中不存在科室[{0}]", t => t.Department); throw new PerformanceException($"科室字典中不存在科室[{string.Join(",", notExistsDeptData.Select(t => t[0]).Distinct())}]");
}
var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotId); var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotId);
if (employees != null && employees.Any()) if (employees == null || !employees.Any()) throw new PerformanceException("未配置人员字典");
{
var notExistNameData = data.Where(w => !employees.Select(t => t.DoctorName).Contains(w.DoctorName) && !string.IsNullOrEmpty(w.DoctorName)); var notExistNameData = data.Where(w => !employees.Select(t => t.DoctorName).Contains(w[1]) && !string.IsNullOrEmpty(w[1]));
if (notExistNameData != null && notExistNameData.Any()) if (notExistNameData != null && notExistNameData.Any())
SetDataStatesAndRemark(notExistNameData, 1, "人员字典中不存在医生名称[{0}]", t => t.DoctorName); throw new PerformanceException($"人员字典中不存在医生姓名[{string.Join(",", notExistNameData.Select(t => t[1]).Distinct())}]");
var notExistNumberData = data.Where(w => !employees.Select(t => t.PersonnelNumber).Contains(w.PersonnelNumber) && !string.IsNullOrEmpty(w.PersonnelNumber)); var notExistNumberData = data.Where(w => !employees.Select(t => t.PersonnelNumber).Contains(w[2]) && !string.IsNullOrEmpty(w[2]));
if (notExistNumberData != null && notExistNumberData.Any()) if (notExistNumberData != null && notExistNumberData.Any())
SetDataStatesAndRemark(notExistNumberData, 1, "人员字典中不存在工号[{0}]", t => t.PersonnelNumber); throw new PerformanceException($"人员字典中不存在工号[{string.Join(",", notExistNumberData.Select(t => t[2]).Distinct())}]");
}
var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allotId); var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allotId);
if (sheets != null && sheets.Any()) if (sheets != null && sheets.Any())
{ {
var notExistsSourceData = data.Where(w => !sheets.Select(t => t.SheetName).Contains(w.Source)); if (!sheets.Select(t => t.SheetName).Any(t => t.Contains(saveGather.Source)))
if (notExistsSourceData != null && notExistsSourceData.Any()) throw new PerformanceException($"来源错误[{saveGather.Source}]");
SetDataStatesAndRemark(notExistsSourceData, 1, "来源中不存在名称[{0}]", t => t.Source);
}
exresultgatherRepository.UpdateRange(data.ToArray());
AddCategoryToConfig(data, allot.HospitalId);
return data.Any(w => w.States == 1);
}
catch (Exception ex)
{
logger.LogError(ex.Message);
throw new PerformanceException("校验失败");
} }
} }
...@@ -1391,18 +1496,19 @@ private static void SetDataStatesAndRemark(IEnumerable<ex_result_gather> data, i ...@@ -1391,18 +1496,19 @@ private static void SetDataStatesAndRemark(IEnumerable<ex_result_gather> data, i
if (func != null) if (func != null)
remark = string.Format(remark, func.Invoke(item)); remark = string.Format(remark, func.Invoke(item));
item.States = states; //item.States = states;
item.Remark = (!string.IsNullOrEmpty(item.Remark) && item.Remark.Length > 0) ? item.Remark + ", " + remark : remark; item.Remark = (!string.IsNullOrEmpty(item.Remark) && item.Remark.Length > 0) ? item.Remark + ", " + remark : remark;
} }
} }
private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId) public void AddCategoryToConfig(int allotId)
{ {
if (data == null || !data.Any(w => w.States == 2)) return; var allot = perallotRepository.GetEntity(w => w.ID == allotId);
data = data.Where(w => w.States == 2).ToList(); var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId);
if (data == null || !data.Any()) return;
var modules = exmoduleRepository.GetEntities(w => w.HospitalId == hospitalId && w.SheetType != (int)SheetType.Income); var modules = exmoduleRepository.GetEntities(w => w.HospitalId == allot.HospitalId && w.SheetType != (int)SheetType.Income);
if (modules == null || !modules.Any()) return; if (modules == null || !modules.Any()) return;
var items = exitemRepository.GetEntities(w => modules.Select(t => t.Id).Distinct().Contains(w.ModuleId ?? 0)); var items = exitemRepository.GetEntities(w => modules.Select(t => t.Id).Distinct().Contains(w.ModuleId ?? 0));
...@@ -1413,16 +1519,16 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId) ...@@ -1413,16 +1519,16 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
var insertList = new List<ex_item>(); var insertList = new List<ex_item>();
foreach (var module in modules) foreach (var module in modules)
{ {
var categories = data.Where(t => t.Source == module.ModuleName)?.Select(t => t.Category).Distinct(); var categories = data.Where(t => module.ModuleName.Contains(t.Source))?.Select(t => t.Category).Distinct();
if (categories == null || !categories.Any()) continue; if (categories == null || !categories.Any()) continue;
var moduleItems = items.Where(w => w.ModuleId == module.Id)?.Select(t => t.ItemName).Distinct(); var moduleItems = items.Where(w => w.ModuleId == module.Id)?.Select(t => t.ItemName).Distinct();
if (moduleItems == null || !moduleItems.Any()) continue; if (moduleItems != null && moduleItems.Any())
categories = categories.Except(moduleItems);
var exceptCategories = categories.Except(moduleItems); if (categories == null || !categories.Any()) continue;
if (exceptCategories == null || !exceptCategories.Any()) continue;
insertList.AddRange(exceptCategories.Select(t => new ex_item insertList.AddRange(categories.Select(t => new ex_item
{ {
ModuleId = module.Id, ModuleId = module.Id,
ItemName = t, ItemName = t,
...@@ -1438,15 +1544,18 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId) ...@@ -1438,15 +1544,18 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
var speacialCategories = data.Where(t => t.Source.Contains("特殊核算单元"))?.Select(t => new { t.Category, t.Department }).Distinct(); var speacialCategories = data.Where(t => t.Source.Contains("特殊核算单元"))?.Select(t => new { t.Category, t.Department }).Distinct();
if (speacialCategories == null || !speacialCategories.Any()) return; if (speacialCategories == null || !speacialCategories.Any()) return;
var specials = exspecialRepository.GetEntities(w => w.HospitalId == hospitalId); var specials = exspecialRepository.GetEntities(w => w.HospitalId == allot.HospitalId);
if (specials == null || !specials.Any()) return; if (specials == null || !specials.Any()) return;
var list = speacialCategories.Where(w => !specials.Select(t => t.Target + t.Department).Contains(w.Category + w.Department)); var list = (specials == null || !specials.Any())
? speacialCategories
: speacialCategories.Where(w => !specials.Select(t => t.Target + t.Department).Contains(w.Category + w.Department));
if (list == null || !list.Any()) return; if (list == null || !list.Any()) return;
exspecialRepository.AddRange(list.Select(t => new ex_special exspecialRepository.AddRange(list.Select(t => new ex_special
{ {
HospitalId = hospitalId, HospitalId = allot.HospitalId,
Department = t.Department, Department = t.Department,
Target = t.Category Target = t.Category
}).ToArray()); }).ToArray());
...@@ -1459,10 +1568,19 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId) ...@@ -1459,10 +1568,19 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
public void SyncDataToResult(int allotId) public void SyncDataToResult(int allotId)
{ {
var sheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value));
if (sheets == null || !sheets.Any()) return;
var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId); var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId);
if (data == null || !data.Any() || data.Any(w => w.States == 1)) return; if (data == null || !data.Any()) return;
var syncData = _mapper.Map<List<ex_result>>(data); var syncData = _mapper.Map<List<ex_result>>(data);
syncData.ForEach(x =>
{
x.Id = 0;
x.Source = sheets.FirstOrDefault(t => t.SheetName.Contains(x.Source))?.SheetName ?? x.Source;
});
exresultRepository.AddRange(syncData.ToArray()); exresultRepository.AddRange(syncData.ToArray());
} }
...@@ -1490,5 +1608,12 @@ public class ComparisonConfig ...@@ -1490,5 +1608,12 @@ public class ComparisonConfig
new Heads{Column="软件实发",Name=nameof(view_check_emp.RealGiveFeeCompute)}, new Heads{Column="软件实发",Name=nameof(view_check_emp.RealGiveFeeCompute)},
new Heads{Column="差额",Name=nameof(view_check_emp.Diff)}, new Heads{Column="差额",Name=nameof(view_check_emp.Diff)},
}; };
public static List<Heads> DeptTotalHeads { get; } = new List<Heads>
{
new Heads{Column="分类",Name=nameof(view_check_dept.UnitType)},
new Heads{Column="实发不一致",Name="Count"},
new Heads{Column="总额",Name="SumFee"},
};
} }
} }
...@@ -120,6 +120,7 @@ private void Employee(per_allot allot, List<sys_hospitalconfig> configs, IEnumer ...@@ -120,6 +120,7 @@ private void Employee(per_allot allot, List<sys_hospitalconfig> configs, IEnumer
if (limitData == null || !limitData.Any()) return; if (limitData == null || !limitData.Any()) return;
var columns = ((IDictionary<string, object>)limitData.ElementAt(0)).Select(t => t.Key.ToLower()).ToList(); var columns = ((IDictionary<string, object>)limitData.ElementAt(0)).Select(t => t.Key.ToLower()).ToList();
if (columns == null || !columns.Any()) return;
var data = queryService.QueryData<per_employee>(config, sql, allot, isSingle).ToList(); var data = queryService.QueryData<per_employee>(config, sql, allot, isSingle).ToList();
data.ForEach(t => data.ForEach(t =>
...@@ -191,6 +192,9 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List< ...@@ -191,6 +192,9 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
{ nameof(per_employee.BankCard), (t) => t.BankCard }, { nameof(per_employee.BankCard), (t) => t.BankCard },
}; };
columns = columns.Intersect(dict.Keys.Select(t => t.ToLower())).ToList();
if (columns == null || !columns.Any()) return;
if (columns.Contains(nameof(per_employee.PersonnelNumber).ToLower())) columns.Remove(nameof(per_employee.PersonnelNumber).ToLower()); if (columns.Contains(nameof(per_employee.PersonnelNumber).ToLower())) columns.Remove(nameof(per_employee.PersonnelNumber).ToLower());
if (!columns.Contains(nameof(per_employee.AccountingUnit).ToLower())) columns.Add(nameof(per_employee.AccountingUnit).ToLower()); if (!columns.Contains(nameof(per_employee.AccountingUnit).ToLower())) columns.Add(nameof(per_employee.AccountingUnit).ToLower());
......
...@@ -102,9 +102,9 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -102,9 +102,9 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
queryService.ClearHistoryData(allot.ID, groupName, isSingle); queryService.ClearHistoryData(allot.ID, groupName, isSingle);
//employeeService.SyncDataToResult(allotId); employeeService.SyncDataToResult(allotId);
var data = exresultRepository.GetEntities(t => t.AllotId == allotId && t.IsDelete == 0); var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict)); data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict));
var standData = StandDataFormat(hospitalId, data); var standData = StandDataFormat(hospitalId, data);
......
...@@ -49,7 +49,6 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp ...@@ -49,7 +49,6 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
if (exdict.ContainsKey(ExDataDict.IncomeFactor) && exdict[ExDataDict.IncomeFactor] is List<cof_drugtype_factor> factors && factors.Any(t => t.ExModuleId == module.Id)) if (exdict.ContainsKey(ExDataDict.IncomeFactor) && exdict[ExDataDict.IncomeFactor] is List<cof_drugtype_factor> factors && factors.Any(t => t.ExModuleId == module.Id))
{ {
factors = factors.Where(t => t.ExModuleId == module.Id).ToList(); factors = factors.Where(t => t.ExModuleId == module.Id).ToList();
// categories = categories.Union(factors.Select(t => t.Charge)).Distinct();
headers = categories.GroupJoin(factors, inner => new { category = inner.NoBlank() }, outer => new { category = outer.Charge.NoBlank() }, (inner, outer) => new { inner, outer }) headers = categories.GroupJoin(factors, inner => new { category = inner.NoBlank() }, outer => new { category = outer.Charge.NoBlank() }, (inner, outer) => new { inner, outer })
.Select(t => new ExcelHeader .Select(t => new ExcelHeader
{ {
......
...@@ -53,9 +53,9 @@ private void Consumer() ...@@ -53,9 +53,9 @@ private void Consumer()
} }
public enum NotificationLevel public enum NotificationLevel
{ {
[Description("通知")] INF, [Description("通知")] INF = 1,
[Description("警告")] WAR, [Description("警告")] WAR = 2,
[Description("错误")] ERR, [Description("错误")] ERR = 3,
} }
public class Notification public class Notification
{ {
...@@ -75,11 +75,11 @@ public abstract class PushContent ...@@ -75,11 +75,11 @@ public abstract class PushContent
protected PushContent(string subject, NotificationLevel level) protected PushContent(string subject, NotificationLevel level)
{ {
Subject = subject; Subject = subject;
LogLevel = level.ToString(); LogLevel = (int)level;
} }
public abstract string Type { get; } public abstract string Type { get; }
public string LogLevel { get; } public int LogLevel { get; }
public string Time { get => DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } public string Time { get => DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); }
public string Subject { get; set; } public string Subject { get; set; }
} }
...@@ -120,7 +120,7 @@ public UrlContent(string subject, string url, NotificationLevel level = Notifica ...@@ -120,7 +120,7 @@ public UrlContent(string subject, string url, NotificationLevel level = Notifica
} }
public class CustomDownloadContent : Notification.PushContent public class CustomDownloadContent : Notification.PushContent
{ {
public CustomDownloadContent(string subject,object @object ,NotificationLevel level = NotificationLevel.INF) public CustomDownloadContent(string subject, object @object, NotificationLevel level = NotificationLevel.INF)
: base(subject, level) : base(subject, level)
{ {
Arguments = @object; Arguments = @object;
......
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