public BaseResponse <AbNormaleMotionRec> QueryAB(int FeeNo, int year, int month) { //加载子项目 var response = new BaseResponse <AbNormaleMotionRec>(); //这边获取list的集合 AbNormaleMotionRec AbNormaleMotionRec = new AbNormaleMotionRec(); ABFilter ABFilter = new ABFilter(); List <DC_AbNormaleMotionRec> DC_AbNormaleMotionRec = new List <DC_AbNormaleMotionRec>(); List <DC_ABNORMALEMOTIONREC> regQuestion = unitOfWork.GetRepository <DC_ABNORMALEMOTIONREC>().dbSet.Where(m => m.YEAR == year && m.MONTH == month && m.FEENO == FeeNo).ToList(); Mapper.CreateMap <DC_ABNORMALEMOTIONREC, DC_AbNormaleMotionRec>(); Mapper.Map(regQuestion, DC_AbNormaleMotionRec); if (DC_AbNormaleMotionRec.Count > 0) { ABFilter.REGNAME = DC_AbNormaleMotionRec[0].REGNAME; ABFilter.SEX = DC_AbNormaleMotionRec[0].SEX; ABFilter.RESIDENTNO = DC_AbNormaleMotionRec[0].RESIDENTNO; } AbNormaleMotionRec.AbNormaleMotionlist = DC_AbNormaleMotionRec; AbNormaleMotionRec.ab = ABFilter; response.Data = AbNormaleMotionRec; return(response); }
public IHttpActionResult Post(AbNormaleMotionRec baseRequest) { //baseRequest.DayLifeRec.OrgId = SecurityHelper.CurrentPrincipal.OrgId; var response = service.SaveAB(baseRequest); return(Ok(response)); }
public BaseResponse SaveAB(AbNormaleMotionRec baseRequest) { BaseResponse tt = new BaseResponse(); if (baseRequest != null && baseRequest.AbNormaleMotionlist.Count > 0) { foreach (DC_AbNormaleMotionRec ckrt in baseRequest.AbNormaleMotionlist) { Mapper.CreateMap <DC_AbNormaleMotionRec, DC_ABNORMALEMOTIONREC>(); var Ckmodel = unitOfWork.GetRepository <DC_ABNORMALEMOTIONREC>().dbSet.Where(x => x.ID == ckrt.ID).FirstOrDefault(); //这边进行辅助 if (Ckmodel == null) { Ckmodel = Mapper.Map <DC_ABNORMALEMOTIONREC>(ckrt); Ckmodel.SEX = baseRequest.ab.SEX; Ckmodel.REGNAME = baseRequest.ab.REGNAME; Ckmodel.RESIDENTNO = baseRequest.ab.RESIDENTNO; Ckmodel.REGNO = baseRequest.ab.REGNO; Ckmodel.ORGID = SecurityHelper.CurrentPrincipal.OrgId; Ckmodel.DELFLAG = false; Ckmodel.NURSEAIDES = baseRequest.ab.NURSEAIDES; Ckmodel.RECORDDATE = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); Ckmodel.YEAR = baseRequest.ab.year; Ckmodel.MONTH = baseRequest.ab.month; Ckmodel.FEENO = baseRequest.ab.FEENO; unitOfWork.GetRepository <DC_ABNORMALEMOTIONREC>().Insert(Ckmodel); unitOfWork.Save(); } else { Mapper.Map(ckrt, Ckmodel); Ckmodel.NURSEAIDES = baseRequest.ab.NURSEAIDES; Ckmodel.RESIDENTNO = baseRequest.ab.RESIDENTNO; Ckmodel.SEX = baseRequest.ab.SEX; Ckmodel.REGNAME = baseRequest.ab.REGNAME; unitOfWork.GetRepository <DC_ABNORMALEMOTIONREC>().Update(Ckmodel); unitOfWork.Save(); } } } return(tt); }
public BaseResponse <AbNormaleMotionRec> GetAb(long feeNo, int year, int month) { //加载子项目 var response = new BaseResponse <AbNormaleMotionRec>(); //这边获取list的集合 AbNormaleMotionRec AbNormaleMotionRec = new AbNormaleMotionRec(); ABFilter ABFilter = new ABFilter(); List <DC_AbNormaleMotionRec> DC_AbNormaleMotionRec = new List <DC_AbNormaleMotionRec>(); List <DC_ABNORMALEMOTIONREC> regQuestion = unitOfWork.GetRepository <DC_ABNORMALEMOTIONREC>().dbSet.Where(m => m.YEAR == year && m.MONTH == month && m.FEENO == feeNo).ToList(); Mapper.CreateMap <DC_ABNORMALEMOTIONREC, DC_AbNormaleMotionRec>(); Mapper.Map(regQuestion, DC_AbNormaleMotionRec); NurseingLifeWeeks DayLifeCarereclist = new NurseingLifeWeeks(); if (DC_AbNormaleMotionRec.Count > 0) { StringBuilder sb = new StringBuilder(); string sql = string.Format("select LTC_ORG.ORGNAME as OrgName from DC_ABNORMALEMOTIONREC as nurse inner join LTC_ORG on nurse.ORGID=LTC_ORG.ORGID "); sb.Append(sql); //这边默认的是时间 using (TWSLTCContext context = new TWSLTCContext()) { DayLifeCarereclist = context.Database.SqlQuery <NurseingLifeWeeks>(sb.ToString()).ToList()[0]; } ABFilter.REGNAME = DC_AbNormaleMotionRec[0].REGNAME; ABFilter.SEX = DC_AbNormaleMotionRec[0].SEX; ABFilter.RESIDENTNO = DC_AbNormaleMotionRec[0].RESIDENTNO; ABFilter.Res = DC_AbNormaleMotionRec[0].RESIDENTNO; ABFilter.Day = year + "." + month; ABFilter.NURSEAIDES = DC_AbNormaleMotionRec[0].NURSEAIDES; ABFilter.Nur = DC_AbNormaleMotionRec[0].NURSEAIDES; ABFilter.OrgName = DayLifeCarereclist.OrgName; } AbNormaleMotionRec.AbNormaleMotionlist = DC_AbNormaleMotionRec; AbNormaleMotionRec.ab = ABFilter; response.Data = AbNormaleMotionRec; return(response); }