Commit 7d4eccb7 by lcx

修改

parent 4170b4fa
......@@ -790,6 +790,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
return new ApiResponse(ResponseType.Fail);
employeeService.SaveGatherHands(allotId, request);
employeeService.CheckGatherData(allotId);
return new ApiResponse(ResponseType.OK);
}
......@@ -803,7 +804,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
/// <returns></returns>
[Route("getgather/{allotId},{department},{source}")]
[HttpPost]
public ApiResponse GetGather([FromRoute] int allotId,string department,string source,[FromBody] PersonParamsRequest request)
public ApiResponse GetGather([FromRoute] int allotId, string department, string source, [FromBody] PersonParamsRequest request)
{
if (allotId <= 0 || string.IsNullOrEmpty(department) || string.IsNullOrEmpty(source))
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,department,source是否正确");
......
......@@ -3619,6 +3619,16 @@
创建时间
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.States">
<summary>
1 未通过 2 通过
</summary>
</member>
<member name="T:Performance.EntityModels.ex_script">
<summary>
......
......@@ -1170,7 +1170,7 @@ public List<GatherDropResponse> GetGatherDrop(int allotId)
}
//var sheets = perSheets.Select(t => new GatherDropResponse() { Label = t.SheetName, Value = t.SheetName });
var imHeaders = imheaderRepository.GetEntities(t => t.AllotID == allotId);
......@@ -1178,7 +1178,7 @@ public List<GatherDropResponse> GetGatherDrop(int allotId)
var exresultgather = exresultgatherRepository.GetEntities(t => t.AllotId == allotId);
foreach (var item in exresultgather.Select(t => new { t.Category,t.Source}).Distinct())
foreach (var item in exresultgather.Select(t => new { t.Category, t.Source }).Distinct())
{
int id = perSheets.Where(t => t.SheetName.Contains(item.Source)).Select(t => new { t.ID }).ToList()[0].ID;
imHeaders.Add(
......@@ -1195,7 +1195,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 => t.SheetID == sheet.ID && !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();
......@@ -1213,7 +1213,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
HeadName = t.Value,
Visible = 1
}).ToList());
if (result.Columns != null && result.Columns.Any())
{
......@@ -1233,7 +1233,7 @@ public HandsonTable GetGatherHands(int AllotId, GatherRequest request)
{
data = exresultgatherRepository.GetEntities(t => t.AllotId == AllotId && t.Source.Contains(request.Source) && t.Category.Contains(request.Category));
}
if (data == null)
return result;
......@@ -1277,7 +1277,7 @@ 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, PersonParamsRequest request)
{
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId && t.Department.Contains(department) && t.Source.Contains(source);
......@@ -1286,7 +1286,7 @@ public GatherInfo GetGather(int allotId,string department,string source, PersonP
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.GroupBy(a => new { a.Source, a.Department, a.DoctorName, a.PersonnelNumber }).Select(t => new
{
Source = t.Key.Source,
Department = t.Key.Department,
......@@ -1336,81 +1336,43 @@ public GatherInfo GetGather(int allotId,string department,string source, PersonP
TotalCount = gatherInfoRequests.Count(),
PageSize = request.PageSize,
TotalPages = (int)Math.Ceiling((double)gatherInfoRequests.Count() / request.PageSize)
};
};
return gatherInfo;
}
public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
{
#region 旧的
/*var head = ColumnHeadsConfig.GatherTotal;
head.ForEach(t =>
{
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
List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId;
//var datas = exresultgatherRepository.GetEntities(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.AllotId == allotId&& t.Department.Contains(request.SearchQuery) || t.Source.Contains(request.SearchQuery));
//datas = exresultgatherRepository.GetEntities(t => t.AllotId == allotId && (t.DoctorName != "" || t.PersonnelNumber != "") && t.Department.Contains(request.SearchQuery) || t.Source.Contains(request.SearchQuery));
try
{
Convert.ToDecimal(request.SearchQuery);
exp = t => t.AllotId == allotId;
//datas = exresultgatherRepository.GetEntities(t => t.AllotId == allotId && (t.DoctorName != "" || t.PersonnelNumber != ""));
}
catch
{
}
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.AllotId,a.Department,a.Source}).Select(t => new
if (datas != null && datas.Any())
{
ID = t.Key.AllotId,
Department = t.Key.Department,
Source = t.Key.Source,
Fee = t.Sum(a=> a.Fee)
});
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)
});
List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
foreach (var item in result.ToList())
{
GatherTotalRequest gatherTotalRequest = new GatherTotalRequest()
foreach (var item in result.ToList())
{
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);
GatherTotalRequest gatherTotalRequest = new GatherTotalRequest()
{
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);
}
}
var head = ColumnHeadsConfig.GatherTotal;
......@@ -1612,10 +1574,19 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
public void SyncDataToResult(int allotId)
{
var sheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value));
if (sheets == null || sheets.Any()) return;
var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId);
if (data == null || !data.Any() || data.Any(w => w.States == 1)) return;
var syncData = _mapper.Map<List<ex_result>>(data);
var syncData = _mapper.Map<List<ex_result>>(data);
syncData.ForEach(x =>
{
x.Id = 0;
x.Source = sheets.FirstOrDefault(t => t.SheetName.Contains(x.Source))?.SheetName ?? x.Source;
});
exresultRepository.AddRange(syncData.ToArray());
}
......
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