Commit 158813c4 by 钟博

新增改动粘贴查询,下拉,保存

parent 22e65d8d
......@@ -737,6 +737,80 @@ public ApiResponse GetDeptComparison([FromBody] ComparisonPagingRequest request)
return new ApiResponse(ResponseType.OK, relust);
}
#region 手工录入
/// <summary>
/// 手工录入
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("getgatherdrop/{allotId}")]
[HttpPost]
public ApiResponse GetGatherDrop([FromRoute] int allotId)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var relust = employeeService.GetGatherDrop(allotId);
return new ApiResponse(ResponseType.OK, relust);
}
/// <summary>
/// 手工录入
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("getgatherhands/{allotId}")]
[HttpPost]
public ApiResponse GetGatherHands([FromRoute]int allotId,[FromBody]GatherRequest request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var relust = employeeService.GetGatherHands(allotId,request);
return new ApiResponse(ResponseType.OK, relust);
}
/// <summary>
/// 保存手工录入
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("savegatherhands/{allotId}")]
[HttpPost]
public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
if (string.IsNullOrEmpty(request.Source) || string.IsNullOrEmpty(request.Category))
return new ApiResponse(ResponseType.OK);
employeeService.SaveGatherHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 手工录入列表
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("getgather/{allotId}")]
[HttpPost]
public ApiResponse GetGather([FromRoute] int allotId, [FromBody] PersonParamsRequest request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var result = employeeService.GetGather(allotId,request);
return new ApiResponse(ResponseType.OK, result);
}
#endregion
}
}
......@@ -1193,6 +1193,37 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherDrop(System.Int32)">
<summary>
手工录入
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherHands(System.Int32,Performance.DtoModels.GatherRequest)">
<summary>
手工录入
</summary>
<param name="allotId"></param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.SaveGatherHands(System.Int32,Performance.DtoModels.SaveGatherData)">
<summary>
保存手工录入
</summary>
<param name="allotId"></param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,Performance.DtoModels.PersonParamsRequest)">
<summary>
手工录入列表
</summary>
<param name="allotId"></param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ExConfigController.Extract(Performance.DtoModels.ModModuleRequest)">
<summary>
绩效数据抽取模板
......
......@@ -157,6 +157,9 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.ex_type">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.ex_result_gather">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.his_data">
<summary> </summary>
</member>
......@@ -2622,6 +2625,51 @@
1 删除 0 未删除
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Id">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.AllotId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.DoctorName">
<summary>
医生姓名
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.PersonnelNumber">
<summary>
人员工号
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Category">
<summary>
费用类型
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Fee">
<summary>
费用
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Source">
<summary>
来源
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.CreateTime">
<summary>
创建时间
</summary>
</member>
<member name="T:Performance.EntityModels.ex_script">
<summary>
......
......@@ -89,4 +89,18 @@ public class PerSheetHeader
//("调节系数", (t) => Math.Round(t.Adjust.Value * 100, 2), 1, 1, false, true, true, "Adjust"),
};
}
public class ColumnHeadsConfig
{
public static List<Heads> GatherHeads { get; } = new List<Heads>
{
new Heads{Column="科室",Name=nameof(ex_result_gather.Department)},
new Heads{Column="医生姓名",Name=nameof(ex_result_gather.DoctorName)},
new Heads{Column="人员工号",Name=nameof(ex_result_gather.PersonnelNumber)},
new Heads{Column="费用类型",Name=nameof(ex_result_gather.Category)},
new Heads{Column="费用",Name=nameof(ex_result_gather.Fee)},
new Heads{Column="来源",Name=nameof(ex_result_gather.Source)}
};
}
}
using Performance.EntityModels;
using System;
using Performance.Infrastructure.Models;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
......
using Performance.EntityModels;
using Performance.Infrastructure.Models;
using System.Collections.Generic;
namespace Performance.DtoModels
{
public class GatherResponse
{
public List<Heads> Heads { get; set; }
public PageList<ex_result_gather> 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 GatherDropResponse
{
public string Label { get; set; }
public string Value { get; set; }
public List<GatherDropResponse> Children { get; set; }
}
public class GatherRequest
{
public string Source { get; set; }
public string Category { get; set; }
}
}
......@@ -29,4 +29,12 @@ public class SaveCustomData
public string[] ColHeaders { get; set; }
public new string[][] Data { get; set; }
}
public class SaveGatherData
{
public string Source { get; set; }
public string Category { get; set; }
public string[] ColHeaders { get; set; }
public new string[][] Data { get; set; }
}
}
......@@ -116,6 +116,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> </summary>
public virtual DbSet<ex_type> ex_type { get; set; }
/// <summary> </summary>
public virtual DbSet<ex_result_gather> ex_result_gather { get; set; }
/// <summary> </summary>
public virtual DbSet<his_data> his_data { get; set; }
/// <summary> </summary>
public virtual DbSet<his_import_account> his_import_account { get; set; }
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.EntityModels
{
public class ex_result_gather
{
/// <summary>
///
/// </summary>
public int Id { get; set; }
/// <summary>
///
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 医生姓名
/// </summary>
public string DoctorName { get; set; }
/// <summary>
/// 人员工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 费用类型
/// </summary>
public string Category { get; set; }
/// <summary>
/// 费用
/// </summary>
public decimal Fee { get; set; }
/// <summary>
/// 来源
/// </summary>
public string Source { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}
......@@ -29,6 +29,13 @@ 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)
//{
// var search = "";
......
using Performance.EntityModels;
namespace Performance.Repository
{
public partial class PerforExresultgatherRepository : PerforRepository<ex_result_gather>
{
public PerforExresultgatherRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -34,6 +34,8 @@ public class EmployeeService : IAutoInjection
private PerforUserRepository userRepository;
private readonly PerforRoleRepository _roleRepository;
private readonly PerforPerapramounthideRepository _hideRepository;
private readonly PerforExresultgatherRepository exresultgatherRepository;
private readonly PerforImheaderRepository imheaderRepository;
private ILogger<EmployeeService> logger;
public EmployeeService(
......@@ -51,6 +53,8 @@ public class EmployeeService : IAutoInjection
PerforUserRepository userRepository,
PerforRoleRepository roleRepository,
PerforPerapramounthideRepository hideRepository,
PerforExresultgatherRepository exresultgatherRepository,
PerforImheaderRepository imheaderRepository,
ILogger<EmployeeService> logger)
{
this.perforImemployeeRepository = perforImemployeeRepository;
......@@ -67,6 +71,8 @@ public class EmployeeService : IAutoInjection
this.userRepository = userRepository;
_roleRepository = roleRepository;
_hideRepository = hideRepository;
this.exresultgatherRepository = exresultgatherRepository;
this.imheaderRepository = imheaderRepository;
this.logger = logger;
}
......@@ -1121,6 +1127,186 @@ public ComparisonResponse GetComparison(ComparisonPagingRequest request)
return result;
}
#region 手工数据录入
public List<GatherDropResponse> GetGatherDrop(int allotId)
{
again:
var perSheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value));
if (perSheets == null || !perSheets.Any())
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var list = perallotRepository.GetEntities(t => t.HospitalId == allot.HospitalId);
if (list == null || !list.Any(t => t.ID == allot.ID)) return new List<GatherDropResponse>();
list = list.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
var index = list.IndexOf(list.First(t => t.ID == allot.ID));
// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
allotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID;
if (allotId == allot.ID) return new List<GatherDropResponse>();
goto again;
}
//var sheets = perSheets.Select(t => new GatherDropResponse() { Label = t.SheetName, Value = t.SheetName });
var imHeaders = imheaderRepository.GetEntities(t => t.AllotID == allotId);
var result = new List<GatherDropResponse>();
var cellValue = new[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称" };
foreach (var sheet in perSheets)
{
var drop = new GatherDropResponse();
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.Value = sheet.SheetName.Split(' ')[1];
drop.Children = header.Select(t => new GatherDropResponse() { Label = t, Value = t }).ToList();
result.Add(drop);
}
return result;
}
public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, Gather.Select(t => t.Value).ToArray(), Gather.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1
}).ToList());
if (result.Columns != null && result.Columns.Any())
{
foreach (var column in result.Columns)
{
if (column.Data == "数值")
{
column.Type = "numeric";
column.NumericFormat = new NumericFormat { Pattern = "0,00.00" };
}
else
column.Type = "text";
}
}
var data = exresultgatherRepository.GetEntities(t => t.AllotId == AllotId && t.Source.Contains(request.Source) && t.Category.Contains(request.Category));
if (data == null)
return result;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 1;
foreach (var item in data)
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in Gather join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
result.SetRowData(rowDatas, rowDatas != null);
return result;
}
public void SaveGatherHands(int allotId, SaveGatherData request)
{
var dicData = CreateDataRow(0, allotId, request, Gather);
List<ex_result_gather> depts = new List<ex_result_gather>();
DateTime timeNow = DateTime.Now;
foreach (var item in dicData)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<ex_result_gather>(json);
if (!string.IsNullOrEmpty(data.Department) && !string.IsNullOrEmpty(data.Fee.ToString()))
{
data.Source = request.Source;
data.Category = request.Category;
data.AllotId = allotId;
data.CreateTime = timeNow;
depts.Add(data);
}
}
exresultgatherRepository.Execute($@"delete from ex_result_gather where allotid = @allotid and source like '%{request.Source}%' and category = '{request.Category}' ",new { allotId });
exresultgatherRepository.AddRange(depts.ToArray());
}
public GatherResponse GetGather(int allotId, PersonParamsRequest request)
{
var head = ColumnHeadsConfig.GatherHeads;
head.ForEach(t =>
{
t.Name = t.Name.ToLower();
});
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId;
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));
var data = peremployeeRepository.GetGatherForPaging(request.PageNumber, request.PageSize, exp);
return new GatherResponse()
{
Heads = head,
Datas = data,
CurrentPage = data.CurrentPage,
TotalCount = data.TotalCount,
PageSize = data.PageSize,
TotalPages = data.TotalPages
};
}
public static Dictionary<string, string> Gather { get; } = new Dictionary<string, string>
{
{nameof(ex_result_gather.Department), "科室"},
{nameof(ex_result_gather.DoctorName), "医生姓名"},
{nameof(ex_result_gather.PersonnelNumber), "人员工号"},
//{nameof(ex_result_gather.Category), "费用类型"},
{nameof(ex_result_gather.Fee), "数值"},
//{nameof(ex_result_gather.Source), "来源"}
};
private List<Dictionary<string, string>> CreateDataRow(int hospitalId, int allotId, SaveGatherData request, Dictionary<string, string> config)
{
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++)
{
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
baseData.Add(nameof(cof_hrp_department.AllotId), hospitalId.ToString());
allData.Add(baseData);
}
return allData;
}
private Dictionary<string, string> CreateBaseData(SaveGatherData request, Dictionary<string, string> config, int rownumber)
{
Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header)
&& request.Data[rownumber].Length > c)
{
result.Add(first.Key, request.Data[rownumber][c]);
}
}
return result;
}
#endregion
}
public class ComparisonConfig
......
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