public async Task <IActionResult> GetPatientInfoAsync(string userId) { var res = await new DoctorBiz().GetPatientInfoAsync(userId, UserID); var chaBiz = new CharacterBiz(); var dicBiz = new DictionaryBiz(); var chaModelList = chaBiz.GetCharacterModels(userId);//用户所有的列值 chaModelList = chaModelList ?? new List <CharacterModel>(); var dicModel = dicBiz.GetModelById(DictionaryType.UserPersonalInfo);//约定的GUID指定某类型的数据 if (dicModel == null) { return(Failed(ErrorCode.FormatError, "查询不到约定ID,请联系管理员!")); } var dicModelList = dicBiz.GetListByParentGuid(dicModel.DicGuid);//个人资料所有的值 res.CharacterInfos = (from dml in dicModelList join cml in chaModelList on dml.DicGuid equals cml.ConfGuid into temp from tt in temp.DefaultIfEmpty() select new GetPatientInfoResponseDto.CharacterInfo { ValueType = dml?.ValueType, CharacterName = dml?.ConfigName, CharacterValue = tt?.ConfValue }).ToList(); return(Success(res)); }
public IActionResult AddUserInfoList([FromBody] AddUserInfoRequestDto userInfoDtoList) { var charsList = new List <CharacterModel>(); var charsBiz = new CharacterBiz(); foreach (var kv in userInfoDtoList.UserInfoDtoList) { var isExist = charsBiz.IsExistConfig(kv.Guid, UserID); if (isExist) { var charMode = charsBiz.GetCharacterModelByConfigGuid(kv.Guid, UserID); charMode.ConfValue = kv.Value; var isUpdateSuccess = charsBiz.UpdateCharacterModel(charMode);//有记录的则更新 if (!isUpdateSuccess) { return(Failed(ErrorCode.DataBaseError, "数据更新失败!")); } } else { var newCharsGuid = Guid.NewGuid().ToString("N"); charsList.Add(new CharacterModel { CharacterGuid = newCharsGuid, UserGuid = UserID, ConfGuid = kv.Guid, ConfValue = kv.Value, CreatedBy = UserID, OrgGuid = "", LastUpdatedBy = UserID, Enable = true }); } } if (charsList.Count < 1) { return(Success()); } var isSuccess = charsBiz.InsertCharacterModelList(charsList);//新增所有新纪录 return(isSuccess ? Success() : Failed(ErrorCode.DataBaseError, "数据提交失败!")); }
public IActionResult GetUserInfoList(string userId = "") { if (string.IsNullOrWhiteSpace(userId)) { userId = UserID; } var chaBiz = new CharacterBiz(); var dicBiz = new DictionaryBiz(); //var modelx = dicBiz.GetModelById("0ed7181b01d211e9b2da00e04c01c721"); //modelx.ValueRange = "{\"1\":\"内向\",\"2\":\"外向\",\"3\":\"富有创造性\"}"; //var ssss = dicBiz.Update(modelx); var chaModelList = chaBiz.GetCharacterModels(userId);//用户所有的列值 chaModelList = chaModelList ?? new List <CharacterModel>(); var dicModel = dicBiz.GetModelById(DictionaryType.UserPersonalInfo);//约定的GUID指定某类型的数据 if (dicModel == null) { return(Failed(ErrorCode.FormatError, "查询不到约定ID,请联系管理员!")); } var dicModelList = dicBiz.GetListByParentGuid(dicModel.DicGuid);//个人资料所有的值 var chaDtoList = from dml in dicModelList join cml in chaModelList on dml.DicGuid equals cml.ConfGuid into temp from tt in temp.DefaultIfEmpty() select new GetUserHabbitInfoResponseDto { ConfGuid = dml?.DicGuid, CharacterGuid = dml?.DicGuid, ValueType = dml?.ValueType, ConfName = dml?.ConfigName, Sort = dml?.Sort, ValueRange = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(dml?.ValueRange)), ConfValue = tt?.ConfValue, }; return(Success(chaDtoList.OrderByDescending(a => a.Sort))); }