public async Task <IActionResult> GetHealthInformationAsync(string userGuid) { if (string.IsNullOrEmpty(userGuid)) { return(Failed(ErrorCode.Empty, "请指定会员")); } var userBiz = new UserBiz(); var model = await userBiz.GetAsync(userGuid); if (model is null || !model.Enable) { return(Failed(ErrorCode.Empty, "指定会员不存在")); } var informationBiz = new HealthInformationBiz(); var informations = await informationBiz.GetHealthInformationList(userGuid); GetUserHealthInformationResponseDto result = new GetUserHealthInformationResponseDto { UserName = model.UserName, Birthday = model.Birthday, Gender = model.Gender, IdentityNumber = model.IdentityNumber, HealthInformationList = informations }; return(Success(result)); }
public async Task <IActionResult> GetHealthInformationAsync(string userId) { if (string.IsNullOrWhiteSpace(userId)) { userId = UserID; } GetUserHealthInformationResponseDto respon = new GetUserHealthInformationResponseDto(); //删除用户改变的所有基础信息数据 var resultModelList = await new HealthInformationBiz().DeleteUserHealthInformation(userId); var result = await new HealthInformationBiz().GetHealthInformationList(userId); var userBiz = new UserBiz(); var model = userBiz.GetUser(userId); if (model != null) { UserResponseDto userInfo = new UserResponseDto { UserName = model.UserName, Birthday = model.Birthday, Gender = model.Gender, IdentityNumber = model.IdentityNumber }; respon.UserInfo = userInfo; } if (result == null) { return(Success(respon)); } foreach (var item in result) { if (item.InformationType != HealthInformationEnum.Decimal.ToString() && item.InformationType != HealthInformationEnum.String.ToString()) { //查询选项数据 item.OptionList = (await new HealthInformationOptionBiz().GetHealthInformationOptionAsync(item.InformationGuid)).Select(s => new HealthInformationOptionResponse { OptionGuid = s.OptionGuid, OptionLabel = s.OptionLabel, IsDefault = s.IsDefault, Sort = s.Sort }).OrderBy(s => s.Sort).ToList(); item.OptionValue = (await new ConsumerHealthInfoBiz().GetConsumerHealthInfoAsync(item.InformationGuid, userId))?.OptionGuids; } } respon.HealthInformationList = result; return(Success(respon)); }