コード例 #1
0
        public async Task <ObjectResultModule> YaeherPatientDoctorPage([FromBody] YaeherDoctorSearch PagePatientDoctor)
        {
            if (!Commons.CheckSecret(PagePatientDoctor.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 secret = await CreateSecret();

            var doc = new YaeherPatientDoctorIn();

            doc.AndAlso(t => !t.IsDelete && t.CreatedBy == userid);
            var doctor = await _PatientDoctorService.YaeherPatientDoctorList(doc);

            var docarray = "";

            for (var i = 0; i < doctor.Count; i++)
            {
                docarray += "" + doctor[i].DoctorID + ",";
            }
            docarray = docarray.TrimEnd(',');
            var nulllist = new List <ClinicDoctorsView>();

            if (string.IsNullOrEmpty(docarray))
            {
                { return(new ObjectResultModule(nulllist, 200, "sucess")); }
            }
            var Content = "{\"IDArray\":\"" + docarray.ToString() + "\",\"KeyWord\":\"" + PagePatientDoctor.KeyWord + "\",\"secret\":\"" + secret + "\"}";
            var clinic  = await this.PostResponseAsync(Commons.DoctorIp + "api/YaeherPatientDoctorByIDArray/", Content);

            var ClinicInfo = JsonHelper.FromJson <APIResult <List <ClinicDoctorsView> > >(clinic);

            if (ClinicInfo == null || ClinicInfo.result.Count < 1)
            {
                { return(new ObjectResultModule(nulllist, 200, "sucess")); }
            }
            //查询标签
            //Content = "{\"IDArray\":\"" + docarray.ToString() + "\"}";
            //var labellist = await this.PostResponseAsync(Commons.DoctorIp + "api/DoctorLableManageList/", Content);
            //var label = JsonHelper.FromJson<APIResult<List<LabelDoctorManage>>>(labellist);
            //if (label == null || label.result.Count < 1) { { return new ObjectResultModule(nulllist, 200, "sucess"); } }

            // 查询科室信息
            //if (ClinicInfo != null && ClinicInfo.result.Count > 0)
            //{
            //    for (var i = 0; i < ClinicInfo.result.Count; i++)
            //    {
            //        ClinicInfo.result[i].Doctorslable = label.result.Where(t => t.DoctorID == ClinicInfo.result[i].Id).ToList();
            //        ClinicInfo.result[i].KeyWord += JsonHelper.ToJson(label.result.Where(t => t.DoctorID == ClinicInfo.result[i].Id).ToList());
            //    }
            //}
            var tasksCount = ClinicInfo.result.Count;
            //var query = from a in ClinicInfo.result
            //            select new ClinicDoctorsView
            //            {
            //                UserImage = a.UserImage,
            //                DoctorName = a.DoctorName,
            //                DoctorLevel = a.DoctorLevel,
            //                UserID = a.UserID,
            //                HospitalName = a.HospitalName,
            //                Title = a.Title,
            //                Status = a.Status,
            //                Id = a.Id,
            //                CreatedOn = a.CreatedOn,
            //                CreatedBy = a.CreatedBy,
            //                ModifyOn = a.ModifyOn,
            //                ModifyBy = a.ModifyBy,
            //                DeleteBy = a.DeleteBy,
            //                DeleteTime = a.DeleteTime,
            //                IsDelete = a.IsDelete,
            //                Doctorslable = a.Doctorslable,
            //                //KeyWord = a.KeyWord,
            //            };
            //if (!string.IsNullOrEmpty(PagePatientDoctor.KeyWord))
            //{
            //    query = query.Where(t => t.KeyWord.Contains(PagePatientDoctor.KeyWord));
            //}
            //  ClinicInfo.result = ClinicInfo.result;
            //获取总数
            var ClinicViewLists = new PagedResultDto <ClinicDoctorsView>(tasksCount, ClinicInfo.result);

            this.ObjectResultModule.Object     = new ClinicDoctorInfoOut(ClinicViewLists, PagePatientDoctor);
            this.ObjectResultModule.Message    = "sucess";
            this.ObjectResultModule.StatusCode = 200;
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "YaeherPatientDoctorPage",
                OperContent = JsonHelper.ToJson(PagePatientDoctor),
                OperType    = "YaeherPatientDoctorPage",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }