Ejemplo n.º 1
0
        public async Task <ObjectResultModule> DoctorLables([FromBody] LableManageIn LableManageInfo)
        {
            if (!Commons.CheckSecret(LableManageInfo.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;

            if (!string.IsNullOrEmpty(LableManageInfo.LableName))
            {
                LableManageInfo.AndAlso(t => t.LableName == LableManageInfo.LableName);
            }
            if (LableManageInfo.Id > 0)
            {
                LableManageInfo.AndAlso(t => t.Id == LableManageInfo.Id);
            }
            LableManageInfo.AndAlso(t => !t.IsDelete);
            // 医生现有标签
            DoctorRelationIn doctorRelationIn = new DoctorRelationIn();

            doctorRelationIn.AndAlso(a => a.DoctorID == LableManageInfo.DoctorID);
            doctorRelationIn.AndAlso(a => a.IsDelete == false);
            var DoctorLableList = await _doctorRelationService.DoctorRelationList(doctorRelationIn);

            // 查询所有标签
            LableManageIn lableManageIn = new LableManageIn();

            lableManageIn.AndAlso(a => a.IsDelete == false);
            var LableList = await _lableManageService.LableManageList(lableManageIn);

            // 查询医生所在的科室
            ClinicDoctorReltionIn clinicDoctorReltionIn = new ClinicDoctorReltionIn();

            clinicDoctorReltionIn.AndAlso(a => a.IsDelete == false);
            clinicDoctorReltionIn.AndAlso(a => a.DoctorID == LableManageInfo.DoctorID);
            var clinicDoctor = await _clinicDoctorReltionService.ClinicDoctorReltionList(clinicDoctorReltionIn);

            List <LableManage> lableManageList = new List <LableManage>();

            if (clinicDoctor != null)
            {
                // 查询所有科室的标签数据
                ClinicLableReltionIn clinicLableReltionIn = new ClinicLableReltionIn();
                clinicLableReltionIn.AndAlso(a => a.IsDelete == false);
                var clininLable = await _clinicLableReltionService.ClinicDoctorReltionList(clinicLableReltionIn);

                if (clininLable != null)
                {
                    var lableManages = from a in clinicDoctor
                                       join b in clininLable on a.ClinicID equals b.ClinicID
                                       join c in LableList on b.LableID equals c.Id
                                       select c;
                    if (lableManages != null)
                    {
                        lableManageList = lableManages.ToList();
                    }
                }
            }
            if (lableManageList == null)
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Message    = "NotFound";
            }
            else
            {
                if (LableManageInfo.Platform == "PC")
                {
                    this.ObjectResultModule.Object     = lableManageList;
                    this.ObjectResultModule.StatusCode = 200;
                    this.ObjectResultModule.Message    = "success";
                }
                else
                {
                    var LableLists = from a in lableManageList
                                     where !(from b in DoctorLableList select b.LableID).Contains(a.Id)
                                     select a;
                    this.ObjectResultModule.Object     = LableLists.ToList();
                    this.ObjectResultModule.StatusCode = 200;
                    this.ObjectResultModule.Message    = "success";
                }
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "LableByName",
                OperContent = JsonHelper.ToJson(LableManageInfo),
                OperType    = "LableByName",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(ObjectResultModule);
        }
Ejemplo n.º 2
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);
        }
        public async Task <List <DoctorClinicApplyOutDetail> > ClinicDoctorReltionApplyList(ClinicDoctorReltionIn ClinicDoctorReltionInfo)
        {
            var query1      = _repository.GetAll().OrderByDescending(a => a.CreatedOn).Where(ClinicDoctorReltionInfo.Expression);
            var clinicquery = _clinicrepository.GetAll().OrderByDescending(a => a.CreatedOn).Where(t => t.IsDelete == false);

            var query = from item in query1
                        join b in clinicquery on item.ClinicID equals b.Id
                        select new DoctorClinicApplyOutDetail
            {
                DoctorName   = item.DoctorName,
                DoctorID     = item.DoctorID,
                ApplyType    = "",
                ClinicID     = item.ClinicID,
                ClinicName   = item.ClinicName,
                ApplyRemark  = "",
                CheckRemark  = "",
                Id           = item.Id,
                CreatedOn    = item.CreatedOn,
                ClinicType   = b.ClinicType,
                CheckResCode = "",
                CheckRes     = "",
            };

            return(await query.ToListAsync());
        }
        public async Task <PagedResultDto <ClinicDoctorReltion> > ClinicDoctorReltionPage(ClinicDoctorReltionIn ClinicDoctorReltionInfo)
        {
            //初步过滤
            var query = _repository.GetAll().OrderByDescending(a => a.CreatedOn).Where(ClinicDoctorReltionInfo.Expression);
            //获取总数
            var tasksCount = query.Count();
            //获取总数
            var totalpage = tasksCount / ClinicDoctorReltionInfo.MaxResultCount;
            var ClinicDoctorReltionList = await query.PageBy(ClinicDoctorReltionInfo.SkipTotal, ClinicDoctorReltionInfo.MaxResultCount).ToListAsync();

            return(new PagedResultDto <ClinicDoctorReltion>(tasksCount, ClinicDoctorReltionList.MapTo <List <ClinicDoctorReltion> >()));
        }
        public async Task <IList <ClinicDoctorReltion> > ClinicDoctorReltionList(ClinicDoctorReltionIn ClinicDoctorReltionInfo)
        {
            var query = _repository.GetAll().Where(ClinicDoctorReltionInfo.Expression).OrderByDescending(a => a.CreatedOn);

            return(await query.ToListAsync());
        }