/// <summary> /// 根据日期段分页查询记录 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <IActionResult> GetPagedList(GetPagedListInput input) { var pagination = new Pagination { rows = input.rows, page = input.page, sidx = input.orderField ?? "F_ReportDate", sord = input.orderType }; var users = _usersService.GetUserNameDict("").Select(t => new { id = t.F_Id, name = t.F_RealName }).ToList(); var list = (await _infectionApp.GetList(pagination, input.startDate.ToDate(), input.endDate.ToDate())) .Select(t => new { id = t.F_Id, reportDate = t.F_ReportDate, item1 = t.F_Item1.ToFloat(2), item2 = t.F_Item2.ToFloat(2), item3 = t.F_Item3.ToFloat(2), item4 = t.F_Item4.ToFloat(2), item5 = t.F_Item5.ToFloat(2), item6 = t.F_Item6.ToFloat(2), item7 = t.F_Item7.ToFloat(2), recordPerson = t.F_RecordPerson == null ? "" : users.First(u => u.id.Equals(t.F_RecordPerson)).name, memo = t.F_Memo }); var source = list.OrderByDescending(t => t.reportDate).Select(t => new { t.id, t.recordPerson, t.reportDate, t.item1, t.item2, t.item3, t.item4, t.item5, t.item6, t.item7, isAbnormal = t.item1 > 4 || t.item2 > 10 || t.item3 > 10 || t.item4 > 100 || t.item5 > 0.25 || t.item6 > 100 || t.item7 > 0.25 }).ToList(); var data = new { rows = source, abnormalCount = source.Count(t => t.isAbnormal == true), pagination.total, pagination.page, pagination.records }; return(Ok(data)); }
public async Task <IActionResult> GetGridJson(Pagination pagination, string keyword) { var data = new { rows = await _infectionApp.GetList(pagination, keyword), total = pagination.total, page = pagination.page, records = pagination.records }; var users = _usersService.GetUserNameDict(null).Select(t => new { t.F_Id, t.F_RealName }); foreach (var item in data.rows) { var user = users.FirstOrDefault(t => t.F_Id == item.F_RecordPerson); if (user != null) { item.F_RecordPerson = user.F_RealName; } } return(Content(data.ToJson())); }