Commit 7d4eccb7 by lcx

修改

parent 4170b4fa
...@@ -790,6 +790,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe ...@@ -790,6 +790,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
return new ApiResponse(ResponseType.Fail); return new ApiResponse(ResponseType.Fail);
employeeService.SaveGatherHands(allotId, request); employeeService.SaveGatherHands(allotId, request);
employeeService.CheckGatherData(allotId);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
...@@ -803,7 +804,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe ...@@ -803,7 +804,7 @@ public ApiResponse SaveGatherHands([FromRoute] int allotId, [FromBody] SaveGathe
/// <returns></returns> /// <returns></returns>
[Route("getgather/{allotId},{department},{source}")] [Route("getgather/{allotId},{department},{source}")]
[HttpPost] [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)) if (allotId <= 0 || string.IsNullOrEmpty(department) || string.IsNullOrEmpty(source))
return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,department,source是否正确"); return new ApiResponse(ResponseType.Fail, "参数错误", "请检查allotId,department,source是否正确");
......
...@@ -3619,6 +3619,16 @@ ...@@ -3619,6 +3619,16 @@
创建时间 创建时间
</summary> </summary>
</member> </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"> <member name="T:Performance.EntityModels.ex_script">
<summary> <summary>
......
...@@ -1178,7 +1178,7 @@ public List<GatherDropResponse> GetGatherDrop(int allotId) ...@@ -1178,7 +1178,7 @@ public List<GatherDropResponse> GetGatherDrop(int allotId)
var exresultgather = exresultgatherRepository.GetEntities(t => t.AllotId == 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; int id = perSheets.Where(t => t.SheetName.Contains(item.Source)).Select(t => new { t.ID }).ToList()[0].ID;
imHeaders.Add( imHeaders.Add(
...@@ -1277,7 +1277,7 @@ public void SaveGatherHands(int allotId, SaveGatherData request) ...@@ -1277,7 +1277,7 @@ public void SaveGatherHands(int allotId, SaveGatherData request)
exresultgatherRepository.AddRange(depts.ToArray()); 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); 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 ...@@ -1286,7 +1286,7 @@ public GatherInfo GetGather(int allotId,string department,string source, PersonP
var datas = exresultgatherRepository.GetEntities(exp); 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, Source = t.Key.Source,
Department = t.Key.Department, Department = t.Key.Department,
...@@ -1342,76 +1342,38 @@ public GatherInfo GetGather(int allotId,string department,string source, PersonP ...@@ -1342,76 +1342,38 @@ public GatherInfo GetGather(int allotId,string department,string source, PersonP
public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request) public GatherResponse GetGatherTotal(int allotId, PersonParamsRequest request)
{ {
#region 旧的 List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
/*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
Expression<Func<ex_result_gather, bool>> exp = t => t.AllotId == allotId; 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)); exp = exp.And(t => 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
{
}
} }
var datas = exresultgatherRepository.GetEntities(exp); 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())
{
var result = datas.GroupBy(a => new { a.AllotId, a.Department, a.Source }).Select(t => new
{ {
ID = t.Key.AllotId, ID = t.Key.AllotId,
Department = t.Key.Department, Department = t.Key.Department,
Source = t.Key.Source, Source = t.Key.Source,
Fee = t.Sum(a=> a.Fee) Fee = t.Sum(a => a.Fee)
}); });
List<GatherTotalRequest> gatherTotalRequests = new List<GatherTotalRequest>();
foreach (var item in result.ToList()) foreach (var item in result.ToList())
{ {
GatherTotalRequest gatherTotalRequest = new GatherTotalRequest() GatherTotalRequest gatherTotalRequest = new GatherTotalRequest()
{ {
ID = item.ID, ID = item.ID,
Department = item.Department, Department = item.Department,
Source = Regex.Replace(item.Source.Replace(" ","").Replace(".",""),"[0-9]","")/*item.Source.Split(' ')[1]*/, Source = Regex.Replace(item.Source.Replace(" ", "").Replace(".", ""), "[0-9]", "")/*item.Source.Split(' ')[1]*/,
Fee = item.Fee Fee = item.Fee
}; };
gatherTotalRequests.Add(gatherTotalRequest); gatherTotalRequests.Add(gatherTotalRequest);
} }
}
var head = ColumnHeadsConfig.GatherTotal; var head = ColumnHeadsConfig.GatherTotal;
head.ForEach(t => head.ForEach(t =>
...@@ -1612,10 +1574,19 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId) ...@@ -1612,10 +1574,19 @@ private void AddCategoryToConfig(List<ex_result_gather> data, int hospitalId)
public void SyncDataToResult(int allotId) 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); var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId);
if (data == null || !data.Any() || data.Any(w => w.States == 1)) return; 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()); 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