public async Task <ObjectResultModule> CollectConsultationList([FromBody] CollectConsultationIn CollectConsultationList)
        {
            if (!Commons.CheckSecret(CollectConsultationList.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;

            CollectConsultationList.AndAlso(t => !t.IsDelete && t.CreatedBy == userid);
            var values = await _collectConsultationService.CollectConsultationList(CollectConsultationList);

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

            #endregion

            return(this.ObjectResultModule);
        }
        public async Task <ObjectResultModule> CollectConsultationPage([FromBody] CollectConsultationIn CollectConsultationPage)
        {
            if (!Commons.CheckSecret(CollectConsultationPage.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 User = _userManagerService.UserManager(userid);
            var usermanager = JsonHelper.FromJson <UserMemory>(_IabpSession.GetUserData());

            if (CollectConsultationPage.Platform == "PC")
            {
                if ((!usermanager.IsAdmin && usermanager.IsDoctor))
                {
                    CollectConsultationPage.AndAlso(t => t.DoctorID == usermanager.DoctorID);
                }
            }
            else if (CollectConsultationPage.Platform == "Mobile")
            {
                if (usermanager.MobileRoleName == "doctor")
                {
                    var doctor = await _yaeherDoctorService.YaeherDoctorByUserID(userid);

                    CollectConsultationPage.AndAlso(t => t.DoctorID == doctor.Id);
                }
            }
            CollectConsultationPage.AndAlso(t => !t.IsDelete);
            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(CollectConsultationPage.StartTime))
            {
                StartTime = DateTime.Parse(CollectConsultationPage.StartTime);
                if (string.IsNullOrEmpty(CollectConsultationPage.EndTime))
                {
                    CollectConsultationPage.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(CollectConsultationPage.EndTime))
            {
                EndTime = DateTime.Parse(CollectConsultationPage.EndTime);
            }
            if (!string.IsNullOrEmpty(CollectConsultationPage.StartTime))
            {
                CollectConsultationPage.AndAlso(t => t.CreatedOn >= StartTime);
                CollectConsultationPage.AndAlso(t => t.CreatedOn < EndTime.AddDays(+1));
            }
            var values = await _collectConsultationService.CollectConsultationPage(CollectConsultationPage);

            if (values.Items.Count() == 0)
            {
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Object     = new List <ConsultationIn>();
            }
            else
            {
                var param = new SystemParameterIn()
                {
                    Type = "ConfigPar"
                };
                param.AndAlso(t => !t.IsDelete && t.SystemCode == "ConsultState");
                var paramlist = await _systemParameterService.ParameterList(param);

                this.ObjectResultModule.Object     = new ConsultationOut(values, CollectConsultationPage, paramlist);
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "CollectConsultationPage",
                OperContent = JsonHelper.ToJson(CollectConsultationPage),
                OperType    = "CollectConsultationPage",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }
        public async Task <List <CollectConsultation> > CollectConsultationListAsync(CollectConsultationIn collectConsultation)
        {
            var CollectConsultation = _repository.GetAll();

            return(await CollectConsultation.ToListAsync());
        }
        public async Task <PagedResultDto <YaeherConsultation> > CollectConsultationPage(CollectConsultationIn collectConsultation)
        {
            //初步过滤
            var query = _repository.GetAll().OrderByDescending(a => a.CreatedOn).Where(collectConsultation.Expression);

            var consquery = _consrepository.GetAll().Where(t => !t.IsDelete);

            var querylist = from a in query
                            join b in consquery on a.ConsultID equals b.Id
                            where !a.IsDelete && !b.IsDelete
                            select new YaeherConsultation
            {
                ConsultNumber       = b.ConsultNumber,
                ConsultantID        = b.ConsultantID,
                ConsultantName      = b.ConsultantName,
                ConsultantJSON      = b.ConsultantJSON,
                DoctorName          = b.DoctorName,
                DoctorID            = b.DoctorID,
                DoctorJSON          = b.DoctorJSON,
                PatientID           = b.PatientID,
                PatientName         = b.PatientName,
                PatientJSON         = b.PatientJSON,
                ConsultType         = b.ConsultType,
                IIInessType         = b.IIInessType,
                IIInessJSON         = b.IIInessJSON,
                PhoneNumber         = b.PhoneNumber,
                PatientCity         = b.PatientCity,
                IIInessDescription  = b.IIInessDescription,
                InquiryTimes        = b.InquiryTimes,
                ConsultState        = b.ConsultState,
                OvertimeRemindTimes = b.OvertimeRemindTimes,
                Overtime            = b.Overtime,
                RefundBy            = b.RefundBy,
                RefundTime          = b.RefundTime,
                RefundType          = b.RefundType,
                RefundNumber        = b.RefundNumber,
                RefundState         = b.RefundState,
                RefundReason        = b.RefundReason,
                RefundRemarks       = b.RefundRemarks,
                RecommendDoctorID   = b.RecommendDoctorID,
                RecommendDoctorName = b.RecommendDoctorName,
                HasReply            = b.HasReply,
                Age = b.Age,
                ServiceMoneyListId = b.ServiceMoneyListId,
                HasInquiryTimes    = b.HasInquiryTimes,
                IsReturnVisit      = b.IsReturnVisit,
                IsEvaluate         = b.IsEvaluate,
                ReturnVisit        = b.ReturnVisit,
                ReturnVisitTime    = b.ReturnVisitTime,
                CreatedOn          = b.CreatedOn,
                Id = b.Id,
            };

            if (!string.IsNullOrEmpty(collectConsultation.KeyWord))
            {
                querylist = querylist.Where(t => (t.ConsultNumber.Contains(collectConsultation.KeyWord) ||
                                                  t.DoctorName.Contains(collectConsultation.KeyWord) ||
                                                  t.PatientName.Contains(collectConsultation.KeyWord) ||
                                                  t.ConsultType.Contains(collectConsultation.KeyWord) ||
                                                  t.ConsultantName.Contains(collectConsultation.KeyWord)));
            }
            //获取总数
            var tasksCount = querylist.Count();
            //获取总数
            var totalpage = tasksCount / collectConsultation.MaxResultCount;
            var YaeherConsultationList = await querylist.OrderByDescending(t => t.CreatedOn).PageBy(collectConsultation.SkipTotal, collectConsultation.MaxResultCount).ToListAsync();

            return(new PagedResultDto <YaeherConsultation>(tasksCount, YaeherConsultationList.MapTo <List <YaeherConsultation> >()));
        }
        public async Task <IList <CollectConsultation> > CollectConsultationList(CollectConsultationIn collectConsultation)
        {
            var CollectConsultation = await _repository.GetAllListAsync(t => !t.IsDelete);

            return(CollectConsultation.ToList());
        }