//点击编辑的历史的记录 public BaseResponse <NurseingLife> QueryShowNurseList(string id) { //加载子项目 var response = new BaseResponse <NurseingLife>(); //这边获取list的集合 NurseingLife CheckReclist = new NurseingLife(); DC_NurseingLifeCareREC DayLifeCarereclist = new DC_NurseingLifeCareREC(); DC_NURSEINGLIFECAREREC regQuestion = new DC_NURSEINGLIFECAREREC(); var ID = Convert.ToInt32(id); // 这边只有一条的信息 regQuestion = unitOfWork.GetRepository <DC_NURSEINGLIFECAREREC>().dbSet.Where(m => m.ID == ID).OrderByDescending(m => m.CREATEDATE).ToList()[0]; Mapper.CreateMap <DC_NURSEINGLIFECAREREC, DC_NurseingLifeCareREC>(); Mapper.Map(regQuestion, DayLifeCarereclist); List <DC_NurseingLifeCareEDTL> DayLifeCaredtlist = new List <DC_NurseingLifeCareEDTL>(); if (DayLifeCarereclist.ID > 0) { List <DC_NURSEINGLIFECAREDTL> DayLifeCaredtl = unitOfWork.GetRepository <DC_NURSEINGLIFECAREDTL>().dbSet.Where(m => m.ID == DayLifeCarereclist.ID).ToList(); Mapper.CreateMap <DC_NURSEINGLIFECAREDTL, DC_NurseingLifeCareEDTL>(); Mapper.Map(DayLifeCaredtl, DayLifeCaredtlist); } CheckReclist.NurseingLifeCareREC = DayLifeCarereclist; CheckReclist.NurseingLifeCareEDTL = DayLifeCaredtlist; response.Data = CheckReclist; return(response); }
public BaseResponse <NurseingLife> QueryNurseingLife(int FeeNo, int year, int num) { //加载子项目 var response = new BaseResponse <NurseingLife>(); //这边获取list的集合 NurseingLife CheckReclist = new NurseingLife(); DC_NurseingLifeCareREC DayLifeCarereclist = new DC_NurseingLifeCareREC(); DC_NURSEINGLIFECAREREC regQuestion = new DC_NURSEINGLIFECAREREC(); List <DC_NURSEINGLIFECAREREC> regQuestionlist = new List <DC_NURSEINGLIFECAREREC>(); //这边默认本周为0 StringBuilder sb = new StringBuilder(); string sql = string.Format("select * from DC_NURSEINGLIFECAREREC where DC_NURSEINGLIFECAREREC.FEENO='" + FeeNo + "' and DC_NURSEINGLIFECAREREC.WEEKNUMBER='" + num + "' and DATE_FORMAT( current_timestamp(),'%Y' )='" + year + "' and DC_NURSEINGLIFECAREREC.DELFLAG<>1"); sb.Append(sql); //这边默认的是时间 using (TWSLTCContext context = new TWSLTCContext()) { var daylife = context.Database.SqlQuery <DC_NURSEINGLIFECAREREC>(sb.ToString()).ToList().FirstOrDefault(); if (daylife != null) { DayLifeCarereclist.REGNO = daylife.REGNO; DayLifeCarereclist.REGNAME = daylife.REGNAME; DayLifeCarereclist.SEX = daylife.SEX; DayLifeCarereclist.ID = daylife.ID; DayLifeCarereclist.NURSEAIDES = daylife.NURSEAIDES; DayLifeCarereclist.SECURITYMEASURES = daylife.SECURITYMEASURES; DayLifeCarereclist.ARTICLESCARRIED = daylife.ARTICLESCARRIED; DayLifeCarereclist.MEDICATIONINSTRUCTIONS = daylife.MEDICATIONINSTRUCTIONS; DayLifeCarereclist.ACTIVITYSUMMARY = daylife.ACTIVITYSUMMARY; DayLifeCarereclist.QUESTIONBEHAVIOR = daylife.QUESTIONBEHAVIOR; DayLifeCarereclist.REMARKS = daylife.REMARKS; } } List <DC_NurseingLifeCareEDTL> DayLifeCaredtlist = new List <DC_NurseingLifeCareEDTL>(); if (DayLifeCarereclist.ID > 0) { List <DC_NURSEINGLIFECAREDTL> DayLifeCaredtl = unitOfWork.GetRepository <DC_NURSEINGLIFECAREDTL>().dbSet.Where(m => m.ID == DayLifeCarereclist.ID).ToList(); Mapper.CreateMap <DC_NURSEINGLIFECAREDTL, DC_NurseingLifeCareEDTL>(); Mapper.Map(DayLifeCaredtl, DayLifeCaredtlist); } CheckReclist.NurseingLifeCareREC = DayLifeCarereclist; CheckReclist.NurseingLifeCareEDTL = DayLifeCaredtlist; response.Data = CheckReclist; // response.PagesCount = regQuestionlist.Count; return(response); }