Commit 68927268 by 纪旭 韦

手工录入汇总与详情

parent 53423ce3
...@@ -320,6 +320,8 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request) ...@@ -320,6 +320,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,
...@@ -797,18 +799,21 @@ public ApiResponse SaveGatherHands(int allotId, [FromBody] SaveGatherData reques ...@@ -797,18 +799,21 @@ 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}")]
[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)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效"); 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); return new ApiResponse(ResponseType.OK, result);
} }
/// <summary> /// <summary>
......
...@@ -1216,12 +1216,14 @@ ...@@ -1216,12 +1216,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)">
......
...@@ -41,18 +41,22 @@ public class GatherRequest ...@@ -41,18 +41,22 @@ public class GatherRequest
public class GatherTotalRequest public class GatherTotalRequest
{ {
public int ID { get; set; }
public string Department { get; set; } public string Department { get; set; }
public string Source { get; set; } public string Source { get; set; }
public decimal Fee { get; set; } public decimal Fee { get; set; }
} }
public class GatherInfoRequest public class GatherInfoRequest
{ {
public int ID { get; set; }
public string Department { get; set; } public string Department { get; set; }
public string DoctorName { get; set; } public string DoctorName { get; set; }
public string PersonnelNumber { get; set; } public string PersonnelNumber { get; set; }
public List<GatherInfoFee> Detail { get; set; }
}
public class GatherInfoFee
{
public string Category { get; set; } public string Category { get; set; }
public decimal Fee { get; set; }
public decimal? Value { get; set; }
} }
} }
...@@ -1238,62 +1238,123 @@ public void SaveGatherHands(int allotId, SaveGatherData request) ...@@ -1238,62 +1238,123 @@ public void SaveGatherHands(int allotId, SaveGatherData request)
exresultgatherRepository.AddRange(depts.ToArray()); 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; var datas = exresultgatherRepository.GetEntities(t => t.AllotId == allotId && t.Department.Contains(department) && t.Source .Contains(source) && (t.PersonnelNumber != "" || t.DoctorName != ""));
head.ForEach(t =>
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 != ""; List<GatherInfoRequest> gatherInfoRequests = new List<GatherInfoRequest>();
foreach (var item in result.ToList())
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)); GatherInfoRequest gatherInfoRequest = new GatherInfoRequest()
{
var data = exresultgatherRepository.GetGatherForPaging(request.PageNumber, request.PageSize, exp); Department = item.Department,
DoctorName = item.DoctorName,
List<GatherInfoRequest> Info = Mapper.Map<List<GatherInfoRequest>>(data); 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() GatherInfo gatherInfo = new GatherInfo()
{ {
Heads = head, Datas = gatherInfoRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
Datas = Info, CurrentPage = request.PageNumber,
CurrentPage = data.CurrentPage, TotalCount = gatherInfoRequests.Count(),
TotalCount = data.TotalCount, PageSize = request.PageSize,
PageSize = data.PageSize, TotalPages = (int)Math.Ceiling((double)gatherInfoRequests.Count() / request.PageSize)
TotalPages = data.TotalPages };
};
return gatherInfo; 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) public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
{ {
var head = ColumnHeadsConfig.GatherTotal; #region 旧的
head.ForEach(t => /*var head = ColumnHeadsConfig.GatherTotal;
{ head.ForEach(t =>
t.Name = t.Name.ToLower(); {
}); t.Name = t.Name.ToLower();
});
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<GatherTotalRequest> deptTotal = Mapper.Map<List<GatherTotalRequest>>(data);
return new GatherResponse()
{
Heads = head,
Datas = deptTotal,
CurrentPage = data.CurrentPage,
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 != ""; Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.DoctorName != "" || t.PersonnelNumber != "";
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 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)
});
var data = exresultgatherRepository.GetGatherForPaging(request.PageNumber, request.PageSize, exp); 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);
}
List<GatherTotalRequest> deptTotal = Mapper.Map<List<GatherTotalRequest>>(data); GatherResponse gatherResponse = new GatherResponse()
return new GatherResponse()
{ {
Heads = head, Datas = gatherTotalRequests.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize).ToList(),
Datas = deptTotal, CurrentPage = request.PageNumber,
CurrentPage = data.CurrentPage, TotalCount = gatherTotalRequests.Count(),
TotalCount = data.TotalCount, PageSize = request.PageSize,
PageSize = data.PageSize, TotalPages = (int)Math.Ceiling((double)gatherTotalRequests.Count() / request.PageSize)
TotalPages = data.TotalPages
}; };
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