diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 40138eb90..b3d9cf10f 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3368,12 +3368,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common // 这里本来就批量展示问题的 现在又需要单个展示 var thisQuestinonAnswer = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTaskQuestionAnswer)).Select(x => x.Entity as ReadingTaskQuestionAnswer).FirstOrDefault(); + var question = await _dbContext.ReadingQuestionTrial.Where(x => x.Id == thisQuestinonAnswer.ReadingQuestionTrialId).FirstOrDefaultAsync(); + string questionName = string.Empty; string questionAnswer = string.Empty; if (thisQuestinonAnswer != null) { - questionName = await _dbContext.ReadingQuestionTrial.Where(x => x.Id == thisQuestinonAnswer.ReadingQuestionTrialId).Select(x => _userInfo.IsEn_Us ? x.QuestionEnName : x.QuestionName).FirstOrDefaultAsync(); - questionAnswer = thisQuestinonAnswer.Answer; + questionName = _userInfo.IsEn_Us ? question.QuestionEnName : question.QuestionName; + questionAnswer = Translationunit(question.Type, question.Unit, question.CustomUnit, unitDataList, thisQuestinonAnswer.Answer) ; } await InsertInspection(cloneEntity, type, x => new InspectionConvertDTO() @@ -3429,7 +3431,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as ReadingTableQuestionAnswer; - var tableQuestionName = await _dbContext.ReadingTableQuestionTrial.Where(x => x.Id == entity.TableQuestionId).Select(x => _userInfo.IsEn_Us ? x.QuestionEnName : x.QuestionName).FirstOrDefaultAsync(); + var tableQuestion = await _dbContext.ReadingTableQuestionTrial.Where(x => x.Id == entity.TableQuestionId).FirstOrDefaultAsync(); var questionName = await _dbContext.ReadingQuestionTrial.Where(x => x.Id == entity.QuestionId).Select(x => _userInfo.IsEn_Us ? x.QuestionEnName : x.QuestionName).FirstOrDefaultAsync(); var generalId = IdentifierHelper.CreateGuid(entity.VisitTaskId.ToString(), entity.QuestionId.ToString(), entity.RowId.ToString(), entity.TableQuestionId.ToString(), "ReadingTableQuestionAnswer"); var rowMark = await _dbContext.ReadingTableAnswerRowInfo.Where(x => x.Id == entity.RowId).Select(x => x.RowMark).FirstOrDefaultAsync(); @@ -3444,7 +3446,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common { markName = mark.OrderMarkName; } + List unitDataList = (await _dbContext.Dictionary.Where(x => x.Parent.Code == "ValueUnit").Where(x => x.Code != "0").ToListAsync()).Select(x => new UnitData() + { + Unit = (ValueUnit)int.Parse(x.Code), + UnitName = x.Value.ToString(), + }).ToList(); await InsertInspection(entity, type, x => new InspectionConvertDTO() { @@ -3455,11 +3462,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common }, new { + Answer= Translationunit(tableQuestion.Type, tableQuestion.Unit, tableQuestion.CustomUnit, unitDataList, entity.Answer), MarkName = markName, PicturePath = mark != null ? mark.PicturePath : string.Empty, QuestionName = questionName, RowMark = rowMark, - TableQuestionName = tableQuestionName, + TableQuestionName = _userInfo.IsEn_Us ? tableQuestion.QuestionEnName : tableQuestion.QuestionName, }, _userInfo.AuditIdentification); }