public async Task <PagedResultDto <ClinicDoctorsView> > DoctorInformation(ClinicInfomationIn clinic) { var doc = _docrepository.GetAll().Where(t => !t.IsDelete).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(clinic.Expression); var query = from a in doc join b in user on a.UserID equals b.Id join c in clinicdoc on a.Id equals c.DoctorID join d in doctorline on a.Id equals d.DoctorID join e in clinicinfo on c.ClinicID equals e.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, }; //获取总数 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> >())); }
/// <summary> /// 输出模型 /// </summary> /// <param name="ClinicInfomationDto"></param> /// <param name="ClinicInfomationInfo"></param> public ClinicInfoOut(PagedResultDto <ClinicInfomationView> ClinicInfomationDto, ClinicInfomationIn ClinicInfomationInfo) { Items = ClinicInfomationDto.Items; TotalCount = ClinicInfomationDto.TotalCount; TotalPage = ClinicInfomationDto.TotalCount / ClinicInfomationInfo.MaxResultCount; SkipCount = ClinicInfomationInfo.SkipCount; MaxResultCount = ClinicInfomationInfo.MaxResultCount; }
public async Task <IList <ClinicInfomation> > ClinicInfomationListByArrId(ClinicInfomationIn ClinicInfomationInfo, List <int> IDArr) { var query = _repository.GetAll().OrderByDescending(a => a.CreatedOn).Where(ClinicInfomationInfo.Expression); if (IDArr.Count > 0) { query = query.Where(t => IDArr.Contains(t.Id)); } return(await query.ToListAsync()); }
public async Task <PagedResultDto <ClinicInfomation> > ClinicInfomationPage(ClinicInfomationIn ClinicInfomationInfo) { //初步过滤 var query = _repository.GetAll().OrderBy(a => a.OrderSort).ThenByDescending(a => a.CreatedOn).Where(ClinicInfomationInfo.Expression); //获取总数 var tasksCount = query.Count(); //获取总数 var totalpage = tasksCount / ClinicInfomationInfo.MaxResultCount; var ClinicInfomationList = await query.PageBy(ClinicInfomationInfo.SkipTotal, ClinicInfomationInfo.MaxResultCount).ToListAsync(); return(new PagedResultDto <ClinicInfomation>(tasksCount, ClinicInfomationList.MapTo <List <ClinicInfomation> >())); }
public async Task <List <ClinicInfomation> > ClinicInfomationList(ClinicInfomationIn ClinicInfomationInfo, List <ClinicDoctorReltion> rel) { var query = _repository.GetAll().OrderByDescending(a => a.CreatedOn).Where(ClinicInfomationInfo.Expression); if (rel.Count() > 0) { var labelrel = new int[rel.Count]; for (var i = 0; i < rel.Count(); i++) { labelrel[i] = rel[i].ClinicID; } query = query.Where(t => !labelrel.Contains(t.Id)); } return(await query.ToListAsync()); }
public async Task <PagedResultDto <YaeherClinicDoctor> > YaeherClinicDoctorPage(ClinicInfomationIn input) { var relation = _relrepository.GetAll(); var label = _repository.GetAll(); var user = _userrepository.GetAll(); var query = from a in relation join b in label on a.DoctorID equals b.Id join c in user on b.UserID equals c.Id where !a.IsDelete && !b.IsDelete && b.CheckRes == "success" && b.AuthCheckRes == "success" where !a.IsDelete && !b.IsDelete select new YaeherClinicDoctor { CreatedOn = b.CreatedOn, CreatedBy = b.CreatedBy, ModifyBy = b.ModifyBy, ModifyOn = b.ModifyOn, UserImage = c.UserImage, DoctorName = b.DoctorName, ClinicID = a.ClinicID, }; //获取总数 var tasksCount = query.Count(); //获取总页码 var totalpage = tasksCount / input.MaxResultCount; var YaeherDoctorList = await query.PageBy(input.SkipTotal, input.MaxResultCount).ToListAsync(); return(new PagedResultDto <YaeherClinicDoctor>(tasksCount, YaeherDoctorList.MapTo <List <YaeherClinicDoctor> >())); }
public async Task <ObjectResultModule> CreateDoctorRules([FromBody] DoctorRules 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; //ApplyClinicID 前段按照1,2,3,4格式返回后端 string[] IDArray = null; int[] iNums = null; if (!string.IsNullOrEmpty(DoctorRulesInfo.ApplyClinicID)) { IDArray = DoctorRulesInfo.ApplyClinicID.TrimEnd(',').Split(','); } if (IDArray.Length < 1) { return(new ObjectResultModule("", 400, "医生制度必须选择科室!")); } //转换方法 iNums = Array.ConvertAll <string, int>(IDArray, s => int.Parse(s)); var clin = new ClinicInfomationIn(); clin.AndAlso(t => !t.IsDelete); var clinicinfo = await _clinicInfomationService.ClinicInfomationListByArrId(clin, iNums.ToList()); string clinicname = ""; foreach (var item in clinicinfo) { string ClinicType = item.ClinicType == 1 ? "(成人)" : "(儿童)"; clinicname += item.ClinicName + ClinicType + ","; } var CreateDoctorRules = new DoctorRules() { RulesType = DoctorRulesInfo.RulesType, RulesTitle = DoctorRulesInfo.RulesTitle, RulesContent = DoctorRulesInfo.RulesContent, ApplyClinicName = clinicname.TrimEnd(','), ImageFie = DoctorRulesInfo.ImageFie, ApplyClinicID = "," + DoctorRulesInfo.ApplyClinicID.TrimEnd(',') + ",", CreatedBy = userid, CreatedOn = DateTime.Now }; var result = await _doctorRulesService.CreateDoctorRules(CreateDoctorRules); if (result.Id > 0) { this.ObjectResultModule.Object = result; this.ObjectResultModule.StatusCode = 200; this.ObjectResultModule.Message = "success"; } else { this.ObjectResultModule.Object = ""; this.ObjectResultModule.StatusCode = 400; this.ObjectResultModule.Message = "error!"; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "CreateDoctorRules", OperContent = JsonHelper.ToJson(DoctorRulesInfo), OperType = "CreateDoctorRules", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(ObjectResultModule); }
public async Task <IList <ClinicInfomation> > ClinicInfomationList(ClinicInfomationIn ClinicInfomationInfo) { var query = _repository.GetAll().OrderByDescending(a => a.CreatedOn).Where(ClinicInfomationInfo.Expression); return(await query.ToListAsync()); }
public async Task <string> SendWecharMesaage(string KeyWord) { // 查询标签关联的组数据 RelationLabelGroupIn relationLabelGroupIn = new RelationLabelGroupIn(); relationLabelGroupIn.AndAlso(a => a.IsDelete == false); if (!string.IsNullOrEmpty(KeyWord)) { relationLabelGroupIn.AndAlso(a => a.LableName.Contains(KeyWord)); } else { // 当输入为空时 不查询 return(null); } var LabelGroupList = await _RelationLabelGrouprepository.GetAll().Where(relationLabelGroupIn.Expression).ToListAsync(); List <LabelGroup> labelGroups = new List <LabelGroup>(); if (LabelGroupList != null) { foreach (var Item in LabelGroupList) { string[] LableID = Item.LableID.Split(','); string[] LableName = Item.LableName.Split(','); if (LableID.Length > 0) { for (int a = 0; a < LableID.Length; a++) { LabelGroup labelGroup = new LabelGroup(); labelGroup.GroupName = Item.GroupName; labelGroup.LableID = int.Parse(LableID[a]); labelGroup.LableName = LableName[a]; labelGroups.Add(labelGroup); } } } } // 查询业务与标签之间的关系 RelationLabelListIn relationLabelListIn = new RelationLabelListIn(); relationLabelListIn.AndAlso(a => a.IsDelete == false); var relationLabelList = _RelationLabelListrepository.GetAll().Where(relationLabelListIn.Expression); List <RelationLabelList> relationLabelLists = new List <RelationLabelList>(); if (LabelGroupList != null) { var RelationLabelLists = from a in labelGroups join b in relationLabelList on a.LableID equals b.LableID select b; if (RelationLabelLists != null) { relationLabelLists = RelationLabelLists.Distinct().ToList(); } } StringBuilder sbClinic = new StringBuilder(); StringBuilder sbDoctor = new StringBuilder(); StringBuilder sbPaper = new StringBuilder(); StringBuilder sbQuestion = new StringBuilder(); if (relationLabelLists != null) { // 关键字查询科室信息 var ClinicList = relationLabelLists.Where(a => a.RelationCode == "Clinic").ToList(); if (ClinicList != null && ClinicList.Count > 0) { ClinicInfomationIn clinicInfomationIn = new ClinicInfomationIn(); clinicInfomationIn.AndAlso(a => a.IsDelete == false); // 增加查询状态 var YaeherCinlinList = _ClinicInfomationrepository.GetAll().Where(clinicInfomationIn.Expression); var RecomCinlinList = from a in ClinicList join b in YaeherCinlinList on a.BusinessID equals b.Id select b; if (RecomCinlinList != null) { var CinlinList = RecomCinlinList.Distinct().ToList().OrderBy(a => a.OrderSort).ThenByDescending(a => a.CreatedOn).Take(4); //int CinlinCount = 0; foreach (var Item in CinlinList) { var ClinicUrl = Commons.WecharWeb + "doctor-list-patient?id=" + Item.Id + "&clinicNmae=" + Item.ClinicName + "&rShow=no"; sbClinic.Append("<a href=\"" + ClinicUrl + "\">" + Item.ClinicName + "</a> "); sbClinic.Append("\n"); // 去掉科室换行 //CinlinCount += 1; //if (CinlinCount >= 2) //{ // sbClinic.Append("\n"); // sbClinic.Append("\n"); // CinlinCount = 0; //} } } } #region 关键字查询医生信息 暂时去掉 // 关键字查询医生信息 //var DoctorList = relationLabelLists.Where(a => a.RelationCode == "Doctor").ToList(); //if (DoctorList != null&&DoctorList.Count>0) //{ // YaeherDoctorIn yaeherDoctorIn = new YaeherDoctorIn(); // yaeherDoctorIn.AndAlso(a => a.IsDelete == false); // yaeherDoctorIn.AndAlso(a => a.AuthCheckRes =="success"); // // 增加查询状态 // var YaeherDoctotList = _YaeherDoctorrepository.GetAll().Where(yaeherDoctorIn.Expression); // //查询医生开启状态 // ServiceMoneyListIn serviceMoneyListIn = new ServiceMoneyListIn(); // serviceMoneyListIn.AndAlso(a => a.IsDelete == false); // serviceMoneyListIn.AndAlso(a => a.ServiceState == true); // var DocotorService= _ServiceMoneyListrepository.GetAll().Where(serviceMoneyListIn.Expression); // var RecomDoctotList = from a in DoctorList // join b in YaeherDoctotList on a.BusinessID equals b.Id // join c in DocotorService on b.Id equals c.DoctorID // select b; // if (RecomDoctotList != null) // { // var DoctotList = RecomDoctotList.Distinct().ToList().OrderByDescending(a=>a.CreatedOn).Take(12); // int DoctotCount = 0; // foreach (var Item in DoctotList) // { // var DoctotUrl= Commons.WecharWeb + "doctor-detail-patient?id="+Item.Id+"&rShow=no"; // sbDoctor.Append("<a href=\""+DoctotUrl+"\">"+Item.DoctorName+"</a> "); // DoctotCount += 1; // if (DoctotCount >=3) // { // sbDoctor.Append("\n"); // sbDoctor.Append("\n"); // DoctotCount = 0; // } // } // } //} //// 关键字查询文章信息 //var PaperList = relationLabelLists.Where(a => a.RelationCode == "Paper").ToList(); //if (PaperList != null&&PaperList.Count>0) //{ // ReleaseManageIn releaseManageIn = new ReleaseManageIn(); // releaseManageIn.AndAlso(a => a.IsDelete == false); // // 增加查询状态 // var ReleasList = _ReleaseManagerepository.GetAll().Where(releaseManageIn.Expression); // var RecomReleasList = from a in PaperList // join b in ReleasList on a.BusinessID equals b.Id // select b; // if (RecomReleasList != null) // { // var ReleasLists = RecomReleasList.Distinct().ToList().OrderByDescending(a=>a.CreatedOn).Take(5); // foreach (var Item in ReleasLists) // { // var ReleasUrl= Commons.WecharWeb + "article-detail?id="+Item.Id+"&rShow=no&look=no"; // sbPaper.Append("<a href=\""+ReleasUrl+"\">"+Item.PaperTiltle+"</a>\n"); // } // } //} //// 关键字查询问答信息 //var QuestionList = relationLabelLists.Where(a => a.RelationCode == "Question").ToList(); //if (QuestionList != null&&QuestionList.Count>0) //{ // QuestionReleaseIn questionReleaseIn = new QuestionReleaseIn(); // questionReleaseIn.AndAlso(a => a.IsDelete == false); // // 增加查询状态 // var QuestinList = _QuestionReleaserepository.GetAll().Where(questionReleaseIn.Expression); // var RecomQuestionList = from a in QuestionList // join b in QuestinList on a.BusinessID equals b.Id // select b; // if (RecomQuestionList != null) // { // var QuestionLists = RecomQuestionList.Distinct().ToList().OrderByDescending(a=>a.CreatedOn).Take(5); // foreach (var Item in QuestionLists) // { // var QuestionUrl= Commons.WecharWeb + "question-detail?id="+Item.Id+"&rShow=no"; // sbQuestion.Append("<a href=\""+QuestionUrl+"\">"+Item.Title+"</a>\n"); // } // } //} #endregion } StringBuilder sbWecharMessage = new StringBuilder(); if (sbClinic.ToString() != null && sbClinic.ToString() != "") { sbWecharMessage.Append("推荐科室: \n"); sbWecharMessage.Append(sbClinic.ToString() + "\n"); } #region 暂时去掉 //if (sbDoctor.ToString() != null&&sbDoctor.ToString()!="") //{ // sbWecharMessage.Append("推荐医生: \n"); // sbWecharMessage.Append(sbDoctor.ToString() +"\n"); //} //if (sbPaper.ToString() != null&&sbPaper.ToString()!="") //{ // sbWecharMessage.Append("推荐文章: \n"); // sbWecharMessage.Append(sbPaper.ToString() +"\n"); //} //if (sbQuestion.ToString() != null&&sbQuestion.ToString()!="") //{ // sbWecharMessage.Append("推荐问答: \n"); // sbWecharMessage.Append(sbQuestion.ToString() +"\n"); //} #endregion return(sbWecharMessage.ToString()); }
public async Task <List <ClinicInfo> > ClinicInfoList(ClinicInfomationIn ClinicInfomationInfo) { List <ClinicInfo> clinicInfoList = new List <ClinicInfo>(); // 科室数据Lsit var clinicList = await _ClinicInfomationrepository.GetAll().OrderBy(a => a.CreatedOn).Where(ClinicInfomationInfo.Expression).ToListAsync(); // 科室与医生关系 var clinicDoctorReltionList = _ClinicDoctorReltionrepository.GetAll().Where(a => a.IsDelete == false).ToList(); // 科室与标签关系 var clinicLableReltionList = _ClinicLableReltionrepository.GetAll().Where(a => a.IsDelete == false).ToList(); // 标签数据list var LableList = _LableManagerepository.GetAll().Where(a => a.IsDelete == false).ToList(); // 医生基本信息list var DoctorList = _YaeherDoctorrepository.GetAll().Where(a => a.IsDelete == false).ToList(); // 医生与标签关系 var DoctorRelationList = _DoctorRelationrepository.GetAll().Where(a => a.IsDelete == false).ToList(); if (clinicList.Count > 0) { foreach (var clinicInfo in clinicList) { ClinicInfo clinicInfos = new ClinicInfo(); clinicInfos.clinicInfomation = clinicInfo; // 科室与医生关系 clinicInfos.clinicDoctorReltion = clinicDoctorReltionList.Where(a => a.ClinicID == clinicInfo.Id).ToList(); // 科室与标签关系 clinicInfos.clinicLableReltion = clinicLableReltionList.Where(a => a.ClinicID == clinicInfo.Id).ToList(); clinicInfoList.Add(clinicInfos); } } if (clinicInfoList.Count > 0) { foreach (var clinicInfo in clinicInfoList) { if (clinicInfo.clinicDoctorReltion.Count() > 0) { List <YaeherDoctorList> yaeherDoctorList = new List <YaeherDoctorList>(); foreach (var DoctorInfo in clinicInfo.clinicDoctorReltion) { YaeherDoctorList yaeherDoctor = new YaeherDoctorList(); //医生基本信息 yaeherDoctor.yaeherDoctor = DoctorList.Where(a => a.Id == DoctorInfo.DoctorID).FirstOrDefault(); //医生与标签关系 yaeherDoctor.doctorRelation = _DoctorRelationrepository.GetAll().Where(a => a.DoctorID == DoctorInfo.DoctorID && a.IsDelete == false).ToList(); //医生上下线设置状态 yaeherDoctor.doctorOnlineRecord = _DoctorOnlineRecordrepository.GetAll().FirstOrDefault(a => a.DoctorID == DoctorInfo.DoctorID && a.IsDelete == false); //医生申请文件 yaeherDoctor.doctorFileApply = _DoctorFileApplyrepository.GetAll().Where(a => a.DoctorID == DoctorInfo.DoctorID && a.IsDelete == false).ToList(); //医生排班 yaeherDoctor.doctorScheduling = _DoctorSchedulingrepository.GetAll().Where(a => a.DoctorID == DoctorInfo.DoctorID && a.IsDelete == false).ToList(); //医生提供服务信息 yaeherDoctor.serviceMoneyList = _ServiceMoneyListrepository.GetAll().Where(a => a.DoctorID == DoctorInfo.DoctorID && a.IsDelete == false).ToList(); yaeherDoctorList.Add(yaeherDoctor); } if (DoctorList.Count() > 0) { clinicInfo.yaeherDoctorList = yaeherDoctorList; } } } } return(clinicInfoList); }
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); }