示例#1
0
        public async Task <PagedResultDto <DoctorRules> > DoctorRulesPage(DoctorRulesIn DoctorRulesInfo)
        {
            //初步过滤
            var query = _repository.GetAll().Where(DoctorRulesInfo.Expression);
            //var queryclinicrel = _clireltorrepository.GetAll();
            //var querydoctor = _doctorrepository.GetAll();
            //var queryuser = _userrepository.GetAll();

            //var querylist = from a in query
            //join b in queryclinicrel on a.ApplyClinicID equals b.ClinicID
            //join c in querydoctor on b.DoctorID equals c.Id
            //join d in queryuser on c.UserID equals d.Id
            //where !a.IsDelete && !b.IsDelete && !c.IsDelete && !d.IsDelete && d.Id == DoctorRulesInfo.userid
            //select new DoctorRulesView
            //{
            //    CreatedOnUtc = a.CreatedOn.ToString("yyyy-MM-ddTHH:mm:ss"),
            //    Id=a.Id,
            //    RulesType = a.RulesType,
            //    RulesTitle = a.RulesTitle,
            //    RulesContent = a.RulesContent,
            //    ApplyClinicName = a.ApplyClinicName,
            //    ImageFie = a.ImageFie,
            //};

            //获取总数
            var tasksCount = query.Count();
            //获取总数
            var totalpage       = tasksCount / DoctorRulesInfo.MaxResultCount;
            var DoctorRulesList = await query.OrderByDescending(t => t.CreatedOn).PageBy(DoctorRulesInfo.SkipTotal, DoctorRulesInfo.MaxResultCount).ToListAsync();

            return(new PagedResultDto <DoctorRules>(tasksCount, DoctorRulesList.MapTo <List <DoctorRules> >()));
        }
示例#2
0
        public async Task <List <DoctorRules> > DoctorRulesList(DoctorRulesIn DoctorRulesInfo)
        {
            var DoctorRuless = _repository.GetAll().Where(DoctorRulesInfo.Expression);

            if (!string.IsNullOrEmpty(DoctorRulesInfo.IdCheck))
            {
                DoctorRuless = DoctorRuless.Where(t => t.ApplyClinicID.Contains(DoctorRulesInfo.IdCheck));
            }
            return(await DoctorRuless.ToListAsync());
        }
示例#3
0
        public async Task <ObjectResultModule> DoctorRulesById([FromBody] DoctorRulesIn DoctorRulesInfo)
        {
            if (!Commons.CheckSecret(DoctorRulesInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var values = await _doctorRulesService.DoctorRulesByID(DoctorRulesInfo.Id);

            var outvalue = new DoctorRulesDetailView(values);

            if (outvalue == null)
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Message    = "NotFound";
            }
            else
            {
                this.ObjectResultModule.Object     = outvalue;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "DoctorRulesById",
                OperContent = JsonHelper.ToJson(DoctorRulesInfo),
                OperType    = "DoctorRulesById",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
示例#4
0
        public async Task <ObjectResultModule> DoctorRulesList([FromBody] DoctorRulesIn DoctorRulesInfo)
        {
            if (!Commons.CheckSecret(DoctorRulesInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var      userid    = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(DoctorRulesInfo.StartTime))
            {
                StartTime = DateTime.Parse(DoctorRulesInfo.StartTime);
                if (string.IsNullOrEmpty(DoctorRulesInfo.EndTime))
                {
                    DoctorRulesInfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(DoctorRulesInfo.EndTime))
            {
                EndTime = DateTime.Parse(DoctorRulesInfo.EndTime);
            }
            if (!string.IsNullOrEmpty(DoctorRulesInfo.StartTime))
            {
                DoctorRulesInfo.AndAlso(t => t.CreatedOn >= StartTime && t.CreatedOn < EndTime.AddDays(+1));
            }
            if (!string.IsNullOrEmpty(DoctorRulesInfo.KeyWord))
            {
                DoctorRulesInfo.AndAlso(t => t.RulesTitle.Contains(DoctorRulesInfo.KeyWord) ||
                                        t.RulesContent.Contains(DoctorRulesInfo.KeyWord));
            }
            DoctorRulesInfo.AndAlso(t => t.IsDelete == false);
            var values = await _doctorRulesService.DoctorRulesList(DoctorRulesInfo);

            if (values.Count == 0)
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
            }
            else
            {
                this.ObjectResultModule.Object     = values;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "DoctorRulesList",
                OperContent = JsonHelper.ToJson(DoctorRulesInfo),
                OperType    = "DoctorRulesList",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
示例#5
0
        public async Task <ObjectResultModule> DoctorRulesPage([FromBody] DoctorRulesIn DoctorRulesInfo)
        {
            if (!Commons.CheckSecret(DoctorRulesInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid      = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var usermanager = JsonHelper.FromJson <UserMemory>(_IabpSession.GetUserData());
            //var usermanager = _userManagerService.UserManager(userid);

            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(DoctorRulesInfo.StartTime))
            {
                StartTime = DateTime.Parse(DoctorRulesInfo.StartTime);
                if (string.IsNullOrEmpty(DoctorRulesInfo.EndTime))
                {
                    DoctorRulesInfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(DoctorRulesInfo.EndTime))
            {
                EndTime = DateTime.Parse(DoctorRulesInfo.EndTime);
            }
            if (!string.IsNullOrEmpty(DoctorRulesInfo.StartTime))
            {
                DoctorRulesInfo.AndAlso(t => t.CreatedOn >= StartTime && t.CreatedOn < EndTime.AddDays(+1));
            }
            if (!string.IsNullOrEmpty(DoctorRulesInfo.KeyWord))
            {
                DoctorRulesInfo.AndAlso(t => t.RulesTitle.Contains(DoctorRulesInfo.KeyWord) ||
                                        t.RulesContent.Contains(DoctorRulesInfo.KeyWord));
            }
            DoctorRulesInfo.AndAlso(t => t.IsDelete == false);
            if (!string.IsNullOrEmpty(DoctorRulesInfo.RulesType))
            {
                DoctorRulesInfo.AndAlso(t => t.RulesType == DoctorRulesInfo.RulesType);
            }
            if ((usermanager.MobileRoleName == "doctor" || usermanager.IsDoctor) && !usermanager.IsAdmin)
            {
                if (DoctorRulesInfo.Platform == "Mobile")
                {
                    var doctor = await _yaeherDoctorService.YaeherDoctorByUserID(userid);

                    usermanager.DoctorID = doctor.Id;
                }
                var rel = new ClinicDoctorReltionIn();
                rel.AndAlso(t => !t.IsDelete && t.DoctorID == usermanager.DoctorID);
                var clinicrel = await _clinicDoctorReltionService.ClinicDoctorReltionList(rel);

                List <DoctorRules> Result = new List <DoctorRules>();
                foreach (var item in clinicrel)
                {
                    DoctorRulesInfo.IdCheck = "," + item.ClinicID + ",";
                    var value = await _doctorRulesService.DoctorRulesList(DoctorRulesInfo);

                    Result = Result.Union(value).ToList <DoctorRules>();
                }
                //获取总数
                var tasksCount = Result.Count();
                //获取总数
                var totalpage       = tasksCount / DoctorRulesInfo.MaxResultCount;
                var DoctorRulesList = Result.OrderByDescending(t => t.CreatedOn).Skip(DoctorRulesInfo.SkipTotal).Take(DoctorRulesInfo.MaxResultCount).ToList();
                var values          = new PagedResultDto <DoctorRules>(tasksCount, DoctorRulesList.MapTo <List <DoctorRules> >());

                this.ObjectResultModule.Object = new DoctorRulesOut(values, DoctorRulesInfo);
            }
            else
            {
                var values = await _doctorRulesService.DoctorRulesPage(DoctorRulesInfo);

                this.ObjectResultModule.Object = new DoctorRulesOut(values, DoctorRulesInfo);
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "DoctorRulesPage",
                OperContent = JsonHelper.ToJson(DoctorRulesInfo),
                OperType    = "DoctorRulesPage",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            this.ObjectResultModule.StatusCode = 200;
            this.ObjectResultModule.Message    = "success";

            return(this.ObjectResultModule);
        }