public async Task <PagedResultDto <ClinicDoctorsView> > DoctorInformation(YaeherDoctorSearch docotr) { var doc = _docrepository.GetAll().Where(t => !t.IsDelete && t.CheckRes == "success" && t.AuthCheckRes == "success"); var user = _userrepository.GetAll().Where(t => !t.IsDelete && t.RoleName == "doctor"); var clinicdoc = _clinicdocrepository.GetAll().Where(t => !t.IsDelete); var clinicinfo = _repository.GetAll().Where(t => !t.IsDelete); var query = from cd in clinicdoc join ci in clinicinfo on cd.ClinicID equals ci.Id join a in doc on cd.DoctorID equals a.Id join b in user on a.UserID equals b.Id select new ClinicDoctorsView { UserImage = b.UserImage, UserID = b.Id, DoctorName = a.DoctorName, HospitalName = a.HospitalName, Title = a.Title, DoctorLevel = "4.1", Status = "1", Id = a.Id, CreatedOn = a.CreatedOn, }; if (!string.IsNullOrEmpty(docotr.KeyWord)) { query = query.Where(t => t.DoctorName.Contains(docotr.KeyWord)); } //获取总数 var tasksCount = query.Count(); //获取总数 var totalpage = tasksCount / docotr.MaxResultCount; var ClinicInfomationList = await query.PageBy(docotr.SkipTotal, docotr.MaxResultCount).OrderBy(a => a.DoctorLevel).ToListAsync(); return(new PagedResultDto <ClinicDoctorsView>(tasksCount, ClinicInfomationList.MapTo <List <ClinicDoctorsView> >())); }
public async Task <PagedResultDto <ClinicDoctorsView> > QualityDoctorInfor(YaeherDoctorSearch clinic, IList <DoctorRelation> rel) { var doc = _docrepository.GetAll().Where(t => !t.IsDelete && t.CheckRes == "success" && t.AuthCheckRes == "success"); var user = _userrepository.GetAll().Where(t => !t.IsDelete && t.RoleName == "doctor"); var clinicdoc = _clinicdocrepository.GetAll().Where(t => !t.IsDelete); var doctorline = _doctoronlinerepository.GetAll().Where(t => !t.IsDelete && t.OnlineState == "Online"); var clinicinfo = _repository.GetAll().Where(t => !t.IsDelete); var query = from cd in clinicdoc join ci in clinicinfo on cd.ClinicID equals ci.Id join a in doc on cd.DoctorID equals a.Id join c in doctorline on a.Id equals c.DoctorID join b in user on a.UserID equals b.Id select new ClinicDoctorsView { UserImage = b.UserImage, DoctorName = a.DoctorName, DoctorLevel = "4.1", UserID = b.Id, HospitalName = a.HospitalName, Title = a.Title, Status = "1", Id = a.Id, CreatedOn = a.CreatedOn, }; if (!string.IsNullOrEmpty(clinic.KeyWord)) { var labelrel = new int[rel.Count]; for (var i = 0; i < rel.Count(); i++) { labelrel[i] = rel[i].DoctorID; } query = query.Where(t => labelrel.Contains(t.Id)); } //获取总数 var tasksCount = query.Count(); //获取总数 var totalpage = tasksCount / clinic.MaxResultCount; var ClinicInfomationList = await query.PageBy(clinic.SkipTotal, clinic.MaxResultCount).OrderBy(a => a.DoctorLevel).ToListAsync(); return(new PagedResultDto <ClinicDoctorsView>(tasksCount, ClinicInfomationList.MapTo <List <ClinicDoctorsView> >())); }
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); }
public async Task <PagedResultDto <ClinicDoctorsView> > QualityDoctorInformation(YaeherDoctorSearch clinic, IList <DoctorRelation> rel, IList <DoctorNew> doctorNews) { var doc = _docrepository.GetAll().Where(t => !t.IsDelete && t.CheckRes == "success" && t.AuthCheckRes == "success"); var user = _userrepository.GetAll().Where(t => !t.IsDelete && t.RoleName == "doctor"); var clinicdoc = _clinicdocrepository.GetAll().Where(t => !t.IsDelete); var doctorline = _doctoronlinerepository.GetAll().Where(t => !t.IsDelete); var clinicinfo = _repository.GetAll().Where(t => !t.IsDelete); var query = from a in doc join c in doctorline on a.Id equals c.DoctorID join b in user on a.UserID equals b.Id where !a.IsDelete && !b.IsDelete && !c.IsDelete && a.CheckRes == "success" && a.AuthCheckRes == "success" select new ClinicDoctorsView { UserImage = b.UserImage, DoctorName = a.DoctorName, UserID = b.Id, HospitalName = a.HospitalName, Title = a.Title, Id = a.Id, CreatedOn = a.CreatedOn, }; if (rel.Count() > 0) { var labelrel = new int[rel.Count]; for (var i = 0; i < rel.Count(); i++) { labelrel[i] = rel[i].DoctorID; } query = query.Where(t => labelrel.Contains(t.Id)); } var newdoctorrel = new int[doctorNews.Count]; for (var i = 0; i < doctorNews.Count(); i++) { newdoctorrel[i] = doctorNews[i].DoctorId; } if (newdoctorrel.Count() > 0) { query = query.Where(t => newdoctorrel.Contains(t.Id)); } //获取总数 var tasksCount = query.Count(); //获取总数 var totalpage = tasksCount / clinic.MaxResultCount; var ClinicInfomationList = await query.PageBy(clinic.SkipTotal, clinic.MaxResultCount).OrderBy(a => a.DoctorLevel).ToListAsync(); return(new PagedResultDto <ClinicDoctorsView>(tasksCount, ClinicInfomationList.MapTo <List <ClinicDoctorsView> >())); }
public async Task <PagedResultDto <ClinicDoctorsView> > DoctorInformation(YaeherDoctorSearch clinic, IList <DoctorRelation> rel) { // 医生评分 //DateTime StartTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //DateTime EndTime = StartTime.AddDays(1); //var evaluationTotalList = _EvaluationTotalrepository.GetAll().Where(a=>a.IsDelete==false && a.CreatedOn >= StartTime && a.CreatedOn < EndTime); //var DoctorServiceList = _ServiceMoneyListrepository.GetAll().Where(a=>a.IsDelete==false); //var qualitycontrol = _QualityCommitteerepository.GetAll().Where(a=>a.IsDelete==false); var doc = _docrepository.GetAll().OrderByDescending(t => t.CreatedOn).Where(t => !t.IsDelete && t.CheckRes == "success" && t.AuthCheckRes == "success"); var user = _userrepository.GetAll().Where(t => !t.IsDelete && t.RoleName == "doctor"); var doctorline = _doctoronlinerepository.GetAll().Where(t => !t.IsDelete); var query = from a in doc join c in doctorline on a.Id equals c.DoctorID join b in user on a.UserID equals b.Id select new ClinicDoctorsView { UserImage = b.UserImage, DoctorName = a.DoctorName, DoctorLevel = "4.1", UserID = b.Id, HospitalName = a.HospitalName, Title = a.Title, Status = "1", OnlineState = c.OnlineState, DoctorOnlineRecordId = c.Id, Id = a.Id, CreatedOn = a.CreatedOn, }; if (!string.IsNullOrEmpty(clinic.KeyWord)) { if (rel.Count > 0) { var labelrel = new int[rel.Count]; for (var i = 0; i < rel.Count(); i++) { labelrel[i] = rel[i].DoctorID; } query = query.Distinct().Where(t => labelrel.Contains(t.Id)); } else { query = query.Distinct().Where(t => t.DoctorName.Contains(clinic.KeyWord)); } } if (!string.IsNullOrEmpty(clinic.OnlineState)) { query = query.Distinct().Where(t => t.OnlineState == clinic.OnlineState); } #region //List<ClinicDoctorsView> clinicDoctorsViews = new List<ClinicDoctorsView>(); //if (query.Count() > 0) //{ // foreach (var DoctorInfo in query) // { // if (evaluationTotalList.Count() > 0) // { // var evaluationTotal = evaluationTotalList.FirstOrDefault(t => t.DoctorID == DoctorInfo.Id); // if (evaluationTotal != null) // { // DoctorInfo.ReceiptNumBer = evaluationTotal == null ? 0 : evaluationTotal.CompleteTotal;//接单数 // DoctorInfo.AverageTime = evaluationTotal == null ? "0" : evaluationTotal.AverageAnswer.ToString();//平均时长 // DoctorInfo.EvaluateTotal = evaluationTotal.EvaluateTotal; // DoctorInfo.CompleteTotal = evaluationTotal.CompleteTotal; // DoctorInfo.EvaluationCount = evaluationTotal.OneStar + evaluationTotal.TwoStar + evaluationTotal.ThreeStar + evaluationTotal.FourStar + evaluationTotal.FiveStar; // if (DoctorInfo.EvaluationCount >= 15) // { // DoctorInfo.AverageEvaluate = evaluationTotal.AverageEvaluate;//星级 // } // } // } // else // { // DoctorInfo.ReceiptNumBer = 0;//接单数 // DoctorInfo.AverageTime = "0";//平均时长 // DoctorInfo.AverageEvaluate = 0; // } // DoctorInfo.serviceMoneyList = DoctorServiceList.ToList(); // // 接单状态 // bool ImageState = false; // 图文咨询关闭 // bool PhoneState = false; // 电话咨询关闭 // DoctorInfo.ServiceState = false; // 停止服务 // DoctorInfo.ReceiptState = false; // 不可接单 // DoctorInfo.ImageServiceFrequency = 0; // 默认0 // DoctorInfo.PhoneServiceFrequency = 0; // 默认0 // #region 统计当天订单 // var yaeherConsultations = _YaeherConsultationrepository.GetAll().Where(a => a.IsDelete == false && a.DoctorID == DoctorInfo.Id && a.CreatedOn>=StartTime && a.RefundNumber==null).ToList(); // // 当天图文接单总数 // var ImageNumberTotal = yaeherConsultations.Where(a => a.ConsultType == "ImageText").Count(); // // 当天电话接单总数 // var PhoneNumberTotal = yaeherConsultations.Where(a => a.ConsultType == "Phone").Count(); // #endregion // var ImageTextItem = DoctorServiceList.Where(a => a.DoctorID == DoctorInfo.Id && a.IsDelete == false && a.ServiceType == "ImageText").FirstOrDefault(); // if (ImageTextItem != null) // { // ImageState = ImageTextItem.ServiceState; // DoctorInfo.ImageServiceExpense = ImageTextItem.ServiceExpense; // if (ImageState) // 开启 // { // DoctorInfo.ImageServiceFrequency = ImageTextItem.ServiceFrequency; // } // } // var PhoneItem = DoctorServiceList.Where(a => a.DoctorID == DoctorInfo.Id && a.IsDelete == false && a.ServiceType == "Phone").FirstOrDefault(); // if (PhoneItem != null) // { // PhoneState = PhoneItem.ServiceState; // DoctorInfo.PhoneServiceExpense = PhoneItem.ServiceExpense; // if (PhoneState) // 开启 // { // DoctorInfo.PhoneServiceFrequency = PhoneItem.ServiceFrequency; // } // } // if (ImageState || PhoneState) // { // DoctorInfo.ServiceState = true; //可咨询 // } // if (DoctorInfo.PhoneServiceFrequency - PhoneNumberTotal > 0 || DoctorInfo.ImageServiceFrequency - ImageNumberTotal > 0) // { // DoctorInfo.ReceiptState = true; // 可接单,默认不满额 // } // clinicDoctorsViews.Add(DoctorInfo); // } //} //query = from a in query // join b in clinicDoctorsViews on a.Id equals b.Id // select b; #endregion query = query.OrderByDescending(a => a.ServiceState).ThenBy(a => a.ReceiptState); //获取总数 var tasksCount = query.Count(); //获取总数 var totalpage = tasksCount / clinic.MaxResultCount; var ClinicInfomationList = await query.PageBy(clinic.SkipTotal, clinic.MaxResultCount).ToListAsync(); return(new PagedResultDto <ClinicDoctorsView>(tasksCount, ClinicInfomationList.MapTo <List <ClinicDoctorsView> >())); }
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); }