Commit 3fe6637c by lcx

Merge branch 'feature/v22.1.7' into feature/实发绩效检验,医技组绩效,绩效汇总表合并

# Conflicts:
#	performance/Performance.Api/wwwroot/Performance.EntityModels.xml
parents 1cd79ae3 980923c5
...@@ -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,
...@@ -783,7 +786,6 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ ...@@ -783,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);
} }
...@@ -796,14 +798,19 @@ public ApiResponse GetGatherHands([FromRoute] int allotId, [FromBody] GatherRequ ...@@ -796,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);
} }
...@@ -811,33 +818,40 @@ public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData reques ...@@ -811,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);
......
...@@ -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 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; }
}
} }
...@@ -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; }
} }
} }
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 = "";
......
...@@ -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)
...@@ -136,6 +140,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -136,6 +140,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);
...@@ -150,8 +155,12 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -150,8 +155,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++)
{ {
...@@ -219,6 +228,7 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -219,6 +228,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)
{ {
......
...@@ -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,6 +49,20 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp ...@@ -49,6 +49,20 @@ 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();
var columnHeader = sheet.GetOrCreate(point.HeaderFirstRowNum.Value);
var excelcolumns = new List<string>();
if (columnHeader != null)
{
excelcolumns = columnHeader.GetCellValues();
if (excelcolumns != null && excelcolumns.Any())
{
excelcolumns.RemoveAll(w => w.Contains("核算单元"));
excelcolumns.Remove("科室名称");
categories = categories.Union(excelcolumns).Distinct();
}
}
// categories = categories.Union(factors.Select(t => t.Charge)).Distinct(); // 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
......
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