Commit 4b4cb98c by 1391696987

手工录入数据补录列表、查看详情

parent 680b61d5
......@@ -858,12 +858,12 @@ public ApiResponse GetDeptComparisonTotal([FromRoute] int allotId)
/// <returns></returns>
[Route("getgatherdrop/{allotId}")]
[HttpPost]
public ApiResponse GetGatherDrop([FromRoute] int allotId)
public ApiResponse GetGatherDrop([FromRoute] int allotId,int userId)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var relust = employeeService.GetGatherDrop(allotId);
var relust = employeeService.GetGatherDrop(allotId,userId);
return new ApiResponse(ResponseType.OK, relust);
}
......@@ -914,16 +914,17 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
/// <param name="allotId"></param>
/// <param name="department">科室</param>
/// <param name="source">来源</param>
/// <param name="category">费用类型</param>
/// <param name="request">分页</param>
/// <returns></returns>
[Route("getgather/{allotId},{department},{source}")]
[Route("getgather/{allotId},{source},{category},{createTime}")]
[HttpPost]
public ApiResponse GetGather([FromRoute] int allotId, string department, string source, [FromBody] PersonParamsRequest request)
public ApiResponse GetGather([FromRoute] int allotId,string department, string source, string category, [FromBody] PersonParamsRequest request)
{
if (allotId <= 0 || string.IsNullOrEmpty(department) || string.IsNullOrEmpty(source))
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,department,source是否正确");
if (allotId <= 0 || string.IsNullOrEmpty(source) || string.IsNullOrEmpty(category) || string.IsNullOrEmpty(department) )
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,source,category,department是否正确");
var result = employeeService.GetGather(allotId, department, source, request);
var result = employeeService.GetGather(allotId, department, source, category, request);
return new ApiResponse(ResponseType.OK, result);
......@@ -933,16 +934,17 @@ public ApiResponse GetGather([FromRoute] int allotId, string department, string
/// 手工录入列表 - 汇总
/// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <param name="request">分页</param>
/// <returns></returns>
[Route("getgathertotal/{allotId}")]
[HttpPost]
public ApiResponse GetGatherTotal([FromRoute] int allotId, [FromBody] PersonParamsRequest request)
public ApiResponse GetGatherTotal([FromRoute] int allotId,int userId, [FromBody] PersonParamsRequest request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var result = employeeService.GetGatherTotal(allotId, request);
var result = employeeService.GetGatherTotal(allotId,userId, request);
return new ApiResponse(ResponseType.OK, result);
}
......
......@@ -1356,7 +1356,7 @@
<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,System.Int32)">
<summary>
手工录入 - 下拉列表
</summary>
......@@ -1379,21 +1379,23 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,System.String,System.String,Performance.DtoModels.PersonParamsRequest)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetGather(System.Int32,System.String,System.String,System.String,Performance.DtoModels.PersonParamsRequest)">
<summary>
手工录入列表 - 明细
</summary>
<param name="allotId"></param>
<param name="department">科室</param>
<param name="source">来源</param>
<param name="category">费用类型</param>
<param name="request">分页</param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(System.Int32,Performance.DtoModels.PersonParamsRequest)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(System.Int32,System.Int32,Performance.DtoModels.PersonParamsRequest)">
<summary>
手工录入列表 - 汇总
</summary>
<param name="allotId"></param>
<param name="userId"></param>
<param name="request">分页</param>
<returns></returns>
</member>
......
......@@ -3629,9 +3629,19 @@
创建时间
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.AuditTime">
<summary>
审核时间
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.States">
<summary>
审核状态 0未审核 1 未通过 2 通过 3审核中
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Remark">
<summary>
备注
失败理由
</summary>
</member>
<member name="T:Performance.EntityModels.ex_script">
......
......@@ -78,6 +78,7 @@ public AutoMapperConfigs()
CreateMap<PerDataEmployee, im_employee>();
CreateMap<im_employee, PerDataEmployee>();
CreateMap<res_baiscnorm, ComputerAvgRequest>().ReverseMap();
CreateMap<ex_result_gather, GatherTotalRequest>();
//CreateMap<PerDataAccountBaisc, PerDataAccount>()
// .ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
......
......@@ -104,9 +104,13 @@ public class ColumnHeadsConfig
public static List<Heads> GatherTotal { get; } = new List<Heads>
{
new Heads{Column="科室",Name=nameof(GatherTotalRequest.Department)},
new Heads{Column="核算组别",Name=nameof(GatherTotalRequest.Department)},
new Heads{Column="来源",Name=nameof(GatherTotalRequest.Source)},
new Heads{Column="费用",Name=nameof(GatherTotalRequest.Fee)}
new Heads{Column="核算项目",Name=nameof(GatherTotalRequest.Category)},
new Heads{Column="提交日期",Name=nameof(GatherTotalRequest.CreateTime)},
new Heads{Column="审核日期",Name=nameof(GatherTotalRequest.AuditTime)},
new Heads{Column="审核状态",Name=nameof(GatherTotalRequest.States)},
new Heads{Column="失败理由",Name=nameof(GatherTotalRequest.Remark)},
};
}
......
using Performance.DtoModels.Request;
using Performance.EntityModels;
using Performance.Infrastructure.Models;
using System;
using System.Collections.Generic;
namespace Performance.DtoModels
......@@ -8,7 +9,7 @@ namespace Performance.DtoModels
public class GatherResponse
{
public List<Heads> Heads { get; set; }
public List<GatherTotalRequest> Datas { get; set; }
public List<Dictionary<string, object>> Datas { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public int PageSize { get; set; }
......@@ -41,18 +42,22 @@ public class GatherRequest
public class GatherTotalRequest
{
public int ID { get; set; }
public string Department { get; set; }
public string Source { get; set; }
public decimal Fee { get; set; }
public string Category { get; set; }
public string CreateTime { get; set; }
public string AuditTime { get; set; }
public string States { get; set; }
public string Remark { get; set; }
}
public class GatherInfoRequest
{
public string Source { get; set; }
public string CreateTime { get; set; }
public string Department { get; set; }
public string DoctorName { get; set; }
public string PersonnelNumber { get; set; }
public List<GatherInfoFee> Detail { get; set; }
public GatherInfoFee Detail { get; set; }
}
public class GatherInfoFee
......
......@@ -43,12 +43,16 @@ public class ex_result_gather
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 备注
/// 审核时间
/// </summary>
public DateTime? AuditTime { get; set; }
/// <summary>
/// 审核状态 0未审核 1 未通过 2 通过 3审核中
/// </summary>
public int States { get; set; }
/// <summary>
/// 失败理由
/// </summary>
public string Remark { get; set; }
// /// <summary>
// /// 1 未通过 2 通过
// /// </summary>
// public int States { get; set; }
}
}
using AutoMapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
......@@ -45,6 +46,7 @@ public class EmployeeService : IAutoInjection
private readonly PerforExitemRepository exitemRepository;
private readonly PerforExspecialRepository exspecialRepository;
private readonly PerforExresultRepository exresultRepository;
private readonly PerforCollectpermissionRepository perforcollectpermissionRepository;
private ILogger<EmployeeService> logger;
public EmployeeService(
......@@ -70,6 +72,7 @@ public class EmployeeService : IAutoInjection
PerforExitemRepository exitemRepository,
PerforExspecialRepository exspecialRepository,
PerforExresultRepository exresultRepository,
PerforCollectpermissionRepository perforcollectpermissionRepository,
ILogger<EmployeeService> logger)
{
_mapper = mapper;
......@@ -94,6 +97,7 @@ public class EmployeeService : IAutoInjection
this.exitemRepository = exitemRepository;
this.exspecialRepository = exspecialRepository;
this.exresultRepository = exresultRepository;
this.perforcollectpermissionRepository = perforcollectpermissionRepository;
this.logger = logger;
}
......@@ -1247,9 +1251,11 @@ public ComparisonResponse<DtoModels.Comparison<DeptComparisonTotal>> GetDeptComp
#region 手工数据录入
public List<GatherDropResponse> GetGatherDrop(int allotId)
public List<GatherDropResponse> GetGatherDrop(int allotId,int userId)
{
var perSheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value));
var collectPermission = perforcollectpermissionRepository.GetEntities(t=>t.UserId == userId).Select(t=> t.SheetName).Distinct();
var perSheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value) && collectPermission.Contains(t.SheetName));
if (perSheets == null || !perSheets.Any())
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
......@@ -1292,7 +1298,7 @@ public List<GatherDropResponse> GetGatherDrop(int allotId)
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();
var header = imHeaders.Where(t =>!cellValue.Contains(t.CellValue)).Select(t => t.CellValue).Distinct();
drop.Label = Regex.Replace(sheet.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*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();
......@@ -1374,51 +1380,29 @@ public void SaveGatherHands(int allotId, SaveGatherData request)
exresultgatherRepository.AddRange(depts.ToArray());
}
public GatherInfo GetGather(int allotId, string department, string source, PersonParamsRequest request)
public GatherInfo GetGather(int allotId,string department, string source,string category, PersonParamsRequest request)
{
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.Department.Contains(department) && t.Source.Contains(source);
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.Department == department && t.Source.Contains(source) && t.Category.Contains(category);
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));
exp = exp.And(t => 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
var result = datas.Select(t => new GatherInfoRequest
{
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>
Source = Regex.Replace(t.Source.Replace(" ", "").Replace(".", ""), "[0-9]", ""),
CreateTime = t.CreateTime.ToString("d"),
Department = t.Department,
PersonnelNumber = t.PersonnelNumber,
DoctorName = t.DoctorName,
Detail = new GatherInfoFee
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Fee)
})
Category = category,
Fee = t.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;
head.ForEach(t =>
{
......@@ -1428,48 +1412,58 @@ public GatherInfo GetGather(int allotId, string department, string source, Perso
GatherInfo gatherInfo = new GatherInfo()
{
Heads = head,
Datas = gatherInfoRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
Datas = result.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
CurrentPage = request.PageNumber,
TotalCount = gatherInfoRequests.Count(),
TotalCount = result.Count(),
PageSize = request.PageSize,
TotalPages = (int)Math.Ceiling((double)gatherInfoRequests.Count() / request.PageSize)
TotalPages = (int)Math.Ceiling((double)result.Count() / request.PageSize)
};
return gatherInfo;
}
public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
public GatherResponse GetGatherTotal(int allotId, int userId, PersonParamsRequest request)
{
List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
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.Source.Contains(request.SearchQuery));
exp = exp.And(t => t.Category.Contains(request.SearchQuery));
}
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)
var userSource = perforcollectpermissionRepository.GetEntities(t => t.UserId == userId)
.Select(s => Regex.Replace(s.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", ""))
.Distinct().ToList();
exp = exp.And(t => userSource.Contains(t.Source));
var datas = exresultgatherRepository.GetEntities(exp)
.GroupBy(t => new { t.Department, t.Source, t.Category })
.Select(s => new {
Department = s.Key.Department,
Source = s.Key.Source,
Category = s.Key.Category,
CreateTime = s.Max(t => t.CreateTime).ToString("d"),
AuditTime = s.Max(t => t.AuditTime)?.ToString("d"),
States = s.Any(w => w.States == 1) ? "未通过"
: s.Any(w => w.States == 3) ? "审核中"
: s.Count() == s.Where(w => w.States == 2).Count() ? "已通过"
: s.Count() == s.Where(w => w.States == 0).Count() ? "未审核" : "未知",
Remark = s.FirstOrDefault()?.Remark,
});
foreach (var item in result.ToList())
var ser = JsonConvert.SerializeObject(datas);
var rows = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(ser);
var data = new List<Dictionary<string, object>>();
foreach (var obj in rows)
{
GatherTotalRequest gatherTotalRequest = new GatherTotalRequest()
Dictionary<string, object> nobj = new Dictionary<string, object>();
foreach (var item in obj)
{
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);
nobj[item.Key.ToLower()] = item.Value;
}
data.Add(nobj);
}
var head = ColumnHeadsConfig.GatherTotal;
......@@ -1480,11 +1474,11 @@ public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
GatherResponse gatherResponse = new GatherResponse()
{
Heads = head,
Datas = gatherTotalRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
Datas = data.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
CurrentPage = request.PageNumber,
TotalCount = gatherTotalRequests.Count(),
TotalCount = data.Count(),
PageSize = request.PageSize,
TotalPages = (int)Math.Ceiling((double)gatherTotalRequests.Count() / request.PageSize)
TotalPages = (int)Math.Ceiling((double)data.Count() / request.PageSize)
};
return gatherResponse;
......
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