Exemplo 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);
        }
        public async Task <ObjectResultModule> QualityYaeherDoctorSearch([FromBody] YaeherDoctorSearch YaeherDoctorSearch)
        {
            if (!Commons.CheckSecret(YaeherDoctorSearch.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 param1 = new SystemParameterIn()
            {
                SystemType = "newdoctor"
            };
            var paramlist1 = await _systemParameterService.ParameterList(param1);

            var consul = new DoctorNewIn();

            consul.RecordCount = int.Parse(paramlist1[0].ItemValue);
            var NewDoctor = await _consultationService.DoctorNewList(consul);

            if (NewDoctor.Count < 1)
            {
                this.ObjectResultModule.Object = new List <ClinicDoctorsView>();
                return(this.ObjectResultModule);
            }
            DoctorRelationIn doctorRelationIn = new DoctorRelationIn();

            doctorRelationIn.AndAlso(a => a.IsDelete == false);
            if (!string.IsNullOrEmpty(YaeherDoctorSearch.KeyWord))
            {
                doctorRelationIn.AndAlso(a => a.LableName.Contains(YaeherDoctorSearch.KeyWord) || a.DoctorName.Contains(YaeherDoctorSearch.KeyWord));
            }
            var lableList = await _DoctorRelationService.DoctorRelationList(doctorRelationIn);

            var docrel = new DoctorRelationIn();

            docrel.AndAlso(t => (!t.IsDelete));
            if (!string.IsNullOrEmpty(YaeherDoctorSearch.KeyWord))
            {
                docrel.AndAlso(t => (t.DoctorName.Contains(YaeherDoctorSearch.KeyWord) || t.LableName.Contains(YaeherDoctorSearch.KeyWord)));
            }
            var labelrel = await _DoctorRelationService.DoctorClinicRelationList(docrel);

            if (labelrel.Count < 1)
            {
                this.ObjectResultModule.Object = new List <ClinicDoctorsView>();
                return(this.ObjectResultModule);
            }
            var seach = new ClinicInfomationIn()
            {
                MaxResultCount = YaeherDoctorSearch.MaxResultCount, SkipTotal = YaeherDoctorSearch.SkipTotal
            };
            var ClinicInfo = await _clinicInfomationService.QualityDoctorInformation(YaeherDoctorSearch, labelrel, NewDoctor);

            // 查询科室信息
            if (ClinicInfo != null && ClinicInfo.TotalCount > 0)
            {
                foreach (var item in ClinicInfo.Items)
                {
                    item.Doctorslable = lableList.Where(t => t.DoctorID == item.Id).ToList();
                }
            }
            if (ClinicInfo.TotalCount < 0)
            {
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                var ClinicDoctorsViewLists = ClinicInfo;
                this.ObjectResultModule.Object     = new ClinicDoctorInfoOut(ClinicDoctorsViewLists, YaeherDoctorSearch);
                this.ObjectResultModule.Message    = "sucess";
                this.ObjectResultModule.StatusCode = 200;
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "QualityYaeherDoctorSearch",
                OperContent = JsonHelper.ToJson(YaeherDoctorSearch),
                OperType    = "QualityYaeherDoctorSearch",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(this.ObjectResultModule);
        }