private Expression <Func <Student_Info, bool> > StudentSearchLineWhere(StudentSearchHealthInfo studentSearchHealthInfo) { var predicate = WhereExtension.True <Student_Info>();//初始化where表达式 predicate = predicate.And(p => p.SchoolCode.Contains(studentSearchHealthInfo.SchoolCode)); predicate = predicate.And(p => p.GradeCode.Contains(studentSearchHealthInfo.GradeCode)); predicate = predicate.And(p => p.ClassCode.Contains(studentSearchHealthInfo.ClassCode)); predicate = predicate.And(p => p.IdNumber.Contains(Dtol.Helper.MD5.Md5Hash(studentSearchHealthInfo.Idnumber))); predicate = predicate.And(p => p.Name.Contains(studentSearchHealthInfo.Name)); return(predicate); }
public List <StudentHealthInfoSearchMiddle> StudentSearchHealthRegisterInfo(StudentSearchHealthInfo studentSearchHealthInfo) { var searchResult = healthRegisterRepository.searchHealthByStudentInfo(studentSearchHealthInfo); var searchresult = _IMapper.Map <List <StudentRegisterHeath_Info>, List <StudentHealthInfoSearchMiddle> >(searchResult); foreach (var item in searchresult) { var modelStudent = studentInfoRepository.GetStudentByStudentRegisterHeath_InfoId(item.id); item.SchoolName = modelStudent.SchoolName; } return(searchresult); }
public List <StudentRegisterHeath_Info> searchHealthByStudentInfo(StudentSearchHealthInfo studentSearchHealthInfo) { List <StudentRegisterHeath_Info> studentRegisterHeath_Infos = new List <StudentRegisterHeath_Info>(); var preciate = StudentSearchLineWhere(studentSearchHealthInfo); //需要从学生信息差 var result = Db.Student_Info.Include(a => a.StudentRegisterHeath_Info).Where(preciate).ToList(); for (int i = 0; i < result.Count; i++) { if (result[i].StudentRegisterHeath_Info != null) { studentRegisterHeath_Infos.Add(result[i].StudentRegisterHeath_Info); } } return(studentRegisterHeath_Infos); }
// GET: HealthInfo/Details/5 public ActionResult <StudentHealthInfoSearchResModel> StudentSearchHealthRegister(StudentSearchHealthInfo studentSearchHealthInfo) { StudentHealthInfoSearchResModel studentHealthInfoSearchResModel = new StudentHealthInfoSearchResModel(); var data = healthRegisterService.StudentSearchHealthRegisterInfo(studentSearchHealthInfo); studentHealthInfoSearchResModel.healthInfoSearchMiddles = data; studentHealthInfoSearchResModel.TotalNum = data.Count(); studentHealthInfoSearchResModel.IsSuccess = true; studentHealthInfoSearchResModel.baseViewModel.Message = "查询成功"; studentHealthInfoSearchResModel.baseViewModel.ResponseCode = 200; return(Ok(studentHealthInfoSearchResModel)); }