单位翻译

Test_HIR_Net8
he 2025-09-09 17:07:05 +08:00
parent c62fb1df92
commit 05be768188
1 changed files with 35 additions and 5 deletions

View File

@ -72,6 +72,35 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}
}
/// <summary>
/// 翻译单位
/// </summary>
/// <param name="answerType">答案类型</param>
/// <param name="unit">单位</param>
/// <param name="customUnit">自定义单位</param>
/// <param name="unitDataList">单位字典</param>
/// <param name="answer">答案</param>
/// <returns></returns>
public string Translationunit(string answerType, ValueUnit? unit, string customUnit, List<UnitData> unitDataList, string? answer)
{
if (answer == null || answer == string.Empty)
{
return string.Empty;
}
if (answerType == "upload")
{
return "❄❅❆❇❈❉❊" + answer;
}
if (unit == ValueUnit.Custom)
{
return answer + string.Empty + customUnit;
}
return answer + string.Empty + unitDataList.Where(y => y.Unit == unit).Select(x => x.UnitName).FirstIsNullReturnEmpty();
}
// 修改为删除
private List<Type> UpdateIsDelete
{
@ -250,7 +279,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
ClinicalDataSetNames = string.Join(",", clinicalDataSetNameList.Union(memoryClinicalDataSetNameList).Distinct().OrderBy(t => t)),
}); ;
});
}
#region 已修改
@ -2808,6 +2837,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
QuestionId = t.Id,
t.DictionaryCode,
t.Unit,
t.CustomUnit,
t.ShowOrder,
AnswerType = t.Type,
}).OrderBy(t => t.ShowOrder).ToListAsync();
@ -2855,7 +2885,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
new
{
//如果问题类型是附件 特殊处理 方便前端解析
Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer,
Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer),
u.QuestionName,
u.QuestionEnName,
u.DictionaryCode,
@ -2886,8 +2917,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
(t, u) =>
new
{
Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer + unitDataList.Where(y => y.Unit == u.Unit).Select(x => x.UnitName).FirstIsNullReturnEmpty()
,
Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer),
u.DictionaryCode,
u.QuestionName,
u.QuestionEnName,
@ -2990,7 +3020,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
new
{
//如果问题类型是附件 特殊处理 方便前端解析
Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer + unitDataList.Where(y => y.Unit == u.Unit).Select(x => x.UnitName).FirstIsNullReturnEmpty(),
Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer),
//t.Answer /*u.Unit==ValueUnit.Custom? t.Answer+u.CustomUnit:(u.Unit != ValueUnit.None|| u.Unit != null)*/,
u.QuestionName,
u.QuestionEnName,