Commit 68927268 by 纪旭 韦

手工录入汇总与详情

parent 53423ce3
......@@ -320,6 +320,8 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request)
if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
......@@ -797,18 +799,21 @@ public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData reques
/// 手工录入列表 - 明细
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <param name="department">科室</param>
/// <param name="source">来源</param>
/// <param name="request">分页</param>
/// <returns></returns>
[Route("getgather/{allotId}")]
[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)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var result = employeeService.GetGather(allotId, request);
var result = employeeService.GetGather(allotId, department, source, request);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
......
......@@ -1216,12 +1216,14 @@
<param name="request"></param>
<returns></returns>
</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>
<param name="allotId"></param>
<param name="request"></param>
<param name="department">科室</param>
<param name="source">来源</param>
<param name="request">分页</param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetGatherTotal(System.Int32,Performance.DtoModels.PersonParamsRequest)">
......
......@@ -41,18 +41,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 class GatherInfoRequest
{
public int ID { 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; }
public decimal? Value { get; set; }
}
}
......@@ -1238,40 +1238,64 @@ public void SaveGatherHands(int allotId, SaveGatherData request)
exresultgatherRepository.AddRange(depts.ToArray());
}
public GatherInfo GetGather(int allotId, PersonParamsRequest request)
public GatherInfo GetGather(int allotId,string department,string source, PersonParamsRequest request)
{
var head = ColumnHeadsConfig.GatherHeads;
head.ForEach(t =>
var datas = exresultgatherRepository.GetEntities(t => t.AllotId == allotId && t.Department.Contains(department) && t.Source .Contains(source) && (t.PersonnelNumber != "" || t.DoctorName != ""));
var result = datas.GroupBy(a => new { a.Department, a.DoctorName, a.PersonnelNumber }).Select(t => new
{
t.Name = t.Name.ToLower();
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)
})
});
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.DoctorName != "" || t.PersonnelNumber != "";
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 = exresultgatherRepository.GetGatherForPaging(request.PageNumber, request.PageSize, exp);
List<GatherInfoRequest> Info = Mapper.Map<List<GatherInfoRequest>>(data);
List<GatherInfoRequest> gatherInfoRequests = new List<GatherInfoRequest>();
foreach (var item in result.ToList())
{
GatherInfoRequest gatherInfoRequest = new GatherInfoRequest()
{
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,
Value = item2.Value
};
gatherInfoRequest.Detail.Add(gatherInfoFee);
}
gatherInfoRequests.Add(gatherInfoRequest);
}
GatherInfo gatherInfo = new GatherInfo()
{
Heads = head,
Datas = Info,
CurrentPage = data.CurrentPage,
TotalCount = data.TotalCount,
PageSize = data.PageSize,
TotalPages = data.TotalPages
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 List<ex_result_gather> GetGatherCategory(int allotId,string department, string source)
{
return exresultgatherRepository.GetEntities(a => a.AllotId == allotId && a.Department == department && a.Source == source).ToList();
}
public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
{
var head = ColumnHeadsConfig.GatherTotal;
#region 旧的
/*var head = ColumnHeadsConfig.GatherTotal;
head.ForEach(t =>
{
t.Name = t.Name.ToLower();
......@@ -1293,7 +1317,44 @@ public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
TotalCount = data.TotalCount,
PageSize = data.PageSize,
TotalPages = data.TotalPages
};*/
#endregion
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.DoctorName != "" || t.PersonnelNumber != "";
if (request != null && !string.IsNullOrEmpty(request.SearchQuery))
exp = exp.And(t => t.Department.Contains(request.SearchQuery) || t.Source.Contains(request.SearchQuery));
var datas = exresultgatherRepository.GetEntities(exp);
var result = datas.GroupBy(a => new { a.Department,a.Source}).Select(t => new
{
Department = t.Key.Department,
Source = t.Key.Source,
Fee = t.Sum(a=> a.Fee)
});
List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
foreach (var item in result.ToList())
{
GatherTotalRequest gatherTotalRequest = new GatherTotalRequest()
{
Department = item.Department,
Source = item.Source,
Fee = item.Fee
};
gatherTotalRequests.Add(gatherTotalRequest);
}
GatherResponse gatherResponse = new GatherResponse()
{
Datas = gatherTotalRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
CurrentPage = request.PageNumber,
TotalCount = gatherTotalRequests.Count(),
PageSize = request.PageSize,
TotalPages = (int)Math.Ceiling((double)gatherTotalRequests.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