public async Task <ObjectResultModule> CollectConsultationList([FromBody] CollectConsultationIn CollectConsultationList) { if (!Commons.CheckSecret(CollectConsultationList.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; CollectConsultationList.AndAlso(t => !t.IsDelete && t.CreatedBy == userid); var values = await _collectConsultationService.CollectConsultationList(CollectConsultationList); if (values.Count() == 0) { this.ObjectResultModule.StatusCode = 204; this.ObjectResultModule.Message = "NoContent"; this.ObjectResultModule.Object = ""; } else { this.ObjectResultModule.Object = values; this.ObjectResultModule.Message = "sucess"; this.ObjectResultModule.StatusCode = 200; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "CollectConsultationList", OperContent = JsonHelper.ToJson(CollectConsultationList), OperType = "CollectConsultationList", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(this.ObjectResultModule); }
public async Task <ObjectResultModule> CollectConsultationPage([FromBody] CollectConsultationIn CollectConsultationPage) { if (!Commons.CheckSecret(CollectConsultationPage.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 User = _userManagerService.UserManager(userid); var usermanager = JsonHelper.FromJson <UserMemory>(_IabpSession.GetUserData()); if (CollectConsultationPage.Platform == "PC") { if ((!usermanager.IsAdmin && usermanager.IsDoctor)) { CollectConsultationPage.AndAlso(t => t.DoctorID == usermanager.DoctorID); } } else if (CollectConsultationPage.Platform == "Mobile") { if (usermanager.MobileRoleName == "doctor") { var doctor = await _yaeherDoctorService.YaeherDoctorByUserID(userid); CollectConsultationPage.AndAlso(t => t.DoctorID == doctor.Id); } } CollectConsultationPage.AndAlso(t => !t.IsDelete); DateTime StartTime = new DateTime(); DateTime EndTime = new DateTime(); if (!string.IsNullOrEmpty(CollectConsultationPage.StartTime)) { StartTime = DateTime.Parse(CollectConsultationPage.StartTime); if (string.IsNullOrEmpty(CollectConsultationPage.EndTime)) { CollectConsultationPage.EndTime = DateTime.Now.ToString("yyyy-MM-dd"); } } if (!string.IsNullOrEmpty(CollectConsultationPage.EndTime)) { EndTime = DateTime.Parse(CollectConsultationPage.EndTime); } if (!string.IsNullOrEmpty(CollectConsultationPage.StartTime)) { CollectConsultationPage.AndAlso(t => t.CreatedOn >= StartTime); CollectConsultationPage.AndAlso(t => t.CreatedOn < EndTime.AddDays(+1)); } var values = await _collectConsultationService.CollectConsultationPage(CollectConsultationPage); if (values.Items.Count() == 0) { this.ObjectResultModule.StatusCode = 200; this.ObjectResultModule.Object = new List <ConsultationIn>(); } else { var param = new SystemParameterIn() { Type = "ConfigPar" }; param.AndAlso(t => !t.IsDelete && t.SystemCode == "ConsultState"); var paramlist = await _systemParameterService.ParameterList(param); this.ObjectResultModule.Object = new ConsultationOut(values, CollectConsultationPage, paramlist); this.ObjectResultModule.StatusCode = 200; this.ObjectResultModule.Message = "success"; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "CollectConsultationPage", OperContent = JsonHelper.ToJson(CollectConsultationPage), OperType = "CollectConsultationPage", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(this.ObjectResultModule); }