public void updatencievaluatedtl(ResBasicInfo baserequest) { if (baserequest != null && baserequest.nursingEval != null && baserequest.nursingEval.Count > 0) { foreach (var nurEval in baserequest.nursingEval) { foreach (var quesitem in nurEval.QuesItem) { NCIEvaluatedtl evaldtl = new NCIEvaluatedtl(); Mapper.CreateMap <LTC_NCIEVALUATEDTL, NCIEvaluatedtl>(); var nciEval = unitOfWork.GetRepository <LTC_NCIEVALUATEDTL>().dbSet.Where(m => m.ITEMCODE == quesitem.Itemcode && m.SUBITEMID == quesitem.Id && m.NCIEVALUATEID == baserequest.NCIEvaluateid).FirstOrDefault(); Mapper.Map(nciEval, evaldtl); evaldtl.Score = quesitem.ncievaluatedtl.Score; base.Save <LTC_NCIEVALUATEDTL, NCIEvaluatedtl>(evaldtl, (q) => q.ID == evaldtl.ID); } } } }
public void Insertncievaluatedtl(ResBasicInfo baserequest, int nciEvaluateId) { if (baserequest != null && baserequest.nursingEval != null && baserequest.nursingEval.Count > 0) { foreach (var nurEval in baserequest.nursingEval) { foreach (var quesitem in nurEval.QuesItem) { NCIEvaluatedtl evaldtl = new NCIEvaluatedtl(); evaldtl.NCIEvaluateid = nciEvaluateId; evaldtl.Itemcode = quesitem.Itemcode; evaldtl.Subitemid = quesitem.Id; evaldtl.Score = quesitem.ncievaluatedtl.Score; Mapper.CreateMap <NCIEvaluatedtl, LTC_NCIEVALUATEDTL>(); var model = Mapper.Map <LTC_NCIEVALUATEDTL>(evaldtl); unitOfWork.GetRepository <LTC_NCIEVALUATEDTL>().Insert(model); } } } }
public BaseResponse <ResBasicInfo> GetNursingCareEvalQues(string itemType, int feeNo, int evaluateid) { var response = new BaseResponse <ResBasicInfo>(); response.Data = new ResBasicInfo(); if (evaluateid == -1) { #region 住民基本详情 var q = from a in unitOfWork.GetRepository <LTC_IPDREG>().dbSet.Where(m => m.FEENO == feeNo) join e in unitOfWork.GetRepository <LTC_REGFILE>().dbSet on a.REGNO equals e.REGNO into res from re in res.DefaultIfEmpty() select new ResBasicInfo { Feeno = a.FEENO, Name = re.NAME, Ssno = re.SSNO, Residentno = re.RESIDENGNO, Bedno = a.BEDNO, }; var list = q.ToList(); if (list != null && list.Count > 0) { response.Data = q.FirstOrDefault(); } #endregion } else { #region 住民基本详情 var q = from a in unitOfWork.GetRepository <LTC_NCIEVALUATE>().dbSet.Where(m => m.NCIEVALUATEID == evaluateid) select new ResBasicInfo { NCIEvaluateid = a.NCIEVALUATEID, Feeno = a.FEENO, Name = a.NAME, Ssno = a.SSNO, Starttime = a.STARTTIME, Residentno = a.RESIDENTNO, Bedno = a.BEDNO, }; var list = q.ToList(); if (list != null && list.Count > 0) { response.Data = q.FirstOrDefault(); } #endregion } #region 长期护理保险评价表详情 response.Data.nursingEval = new List <NursingCareEval>(); List <NursingCareEval> nursingCareEval = new List <NursingCareEval>(); List <LTC_WORKITEM> workItem = unitOfWork.GetRepository <LTC_WORKITEM>().dbSet.Where(m => m.ITEMTYPE == itemType).OrderBy(m => m.ORDER).ToList(); Mapper.CreateMap <LTC_WORKITEM, NursingCareEval>(); Mapper.Map(workItem, nursingCareEval); response.Data.nursingEval = nursingCareEval; foreach (var subitem in response.Data.nursingEval) { List <WorkSubitem> subItem = new List <WorkSubitem>(); List <LTC_WORKSUBITEM> sub = unitOfWork.GetRepository <LTC_WORKSUBITEM>().dbSet.Where(m => m.ITEMCODE == subitem.Itemcode).OrderBy(m => m.ORDER).ToList(); Mapper.CreateMap <LTC_WORKSUBITEM, WorkSubitem>(); Mapper.Map(sub, subItem); subitem.QuesItem = subItem; if (subitem.QuesItem != null && subItem.Count > 0) { subitem.MaxTotalnum = sub.Sum(m => m.MAXINUM.Value); } foreach (var score in subItem) { score.scoreOfValue = new List <ScoreOfValue>(); for (int i = 0; i <= score.Maxinum; i++) { ScoreOfValue sval = new ScoreOfValue(); sval.Score = i + "分"; sval.value = i; score.scoreOfValue.Add(sval); } NCIEvaluatedtl evaldtl = new NCIEvaluatedtl(); if (evaluateid != -1) { Mapper.CreateMap <LTC_NCIEVALUATEDTL, NCIEvaluatedtl>(); var nciEval = unitOfWork.GetRepository <LTC_NCIEVALUATEDTL>().dbSet.Where(m => m.ITEMCODE == subitem.Itemcode && m.SUBITEMID == score.Id && m.NCIEVALUATEID == evaluateid).FirstOrDefault(); Mapper.Map(nciEval, evaldtl); } score.ncievaluatedtl = evaldtl; } } #endregion return(response); }