Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-09-26 17:34:22 +08:00
commit 02db483119
5 changed files with 89 additions and 9 deletions

View File

@ -90,7 +90,7 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<GetJudgeReadingInfoOutDto> GetJudgeReadingInfo(GetJudgeReadingInfo inDto)
{
var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).Select(x => x.CriterionType).FirstNotNullAsync();
@ -397,6 +397,23 @@ namespace IRaCIS.Core.Application.Service
break;
}
switch (visitTask.TrialReadingCriterion.CriterionType)
{
case CriterionType.IVUS:
case CriterionType.OCT:
judgeInfo.VisitInfoList.ForEach(x =>
{
var maxNum = x.VisitTaskInfoList.Select(y => y.JudgeQuestionList.Where(z => z.Answer != "NE").Count()).MaxOrDefault();
x.VisitTaskInfoList.ForEach(z =>
{
z.JudgeQuestionList=z.JudgeQuestionList.Take(maxNum).ToList();
});
});
break;
}
return judgeInfo;
}
@ -957,6 +974,16 @@ namespace IRaCIS.Core.Application.Service
});
break;
case JudgeTypeEnum.DifferenceAbsoluteValue:
var answer1 = taskAnswer1.IsNullOrEmptyReturnNull();
var answer2 = taskAnswer2.IsNullOrEmptyReturnNull();
// 已经判断不相等了 所以只可能有一个为Null
if (answer1 == null || answer2 == null)
{
noteEqual = true;
}
var deffaultValue = taskAnswer1.IsNullOrEmptyReturn0() - taskAnswer2.IsNullOrEmptyReturn0();
if (deffaultValue < 0)
{
@ -983,6 +1010,17 @@ namespace IRaCIS.Core.Application.Service
break;
case JudgeTypeEnum.PercentageDifference:
var answer1P = taskAnswer1.IsNullOrEmptyReturnNull();
var answer2P = taskAnswer2.IsNullOrEmptyReturnNull();
// 已经判断不相等了 所以只可能有一个为Null
if (answer1P == null || answer2P == null)
{
noteEqual = true;
}
var value1 = taskAnswer1.IsNullOrEmptyReturn0();
var value2 = taskAnswer2.IsNullOrEmptyReturn0();
if (value1 == 0 || value2 == 0)

View File

@ -505,7 +505,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
else if (calculate.GetDecimalNullFun != null)
{
var value = await calculate.GetDecimalNullFun(inDto);
item.Answer = value == null ? string.Empty : value.Value.ToString();
item.Answer = value == null ? "NE" : value.Value.ToString();
}
else if (calculate.GetStringFun != null)
{
@ -943,7 +943,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque1PVA(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x=>x.TableQuestionList.Any(y=>y.QuestionMark==QuestionMark.PlaqueNumber&&y.Answer.IsNullOrEmptyReturn0()==1)).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x=>x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x=>x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}
/// <summary>
@ -954,7 +954,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque2PVA(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 2)).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}
/// <summary>
@ -965,7 +965,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque3PVA(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PAV).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 3)).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}

View File

@ -815,7 +815,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
else if (calculate.GetDecimalNullFun != null)
{
var value = await calculate.GetDecimalNullFun(inDto);
item.Answer = value == null ? string.Empty : value.Value.ToString();
item.Answer = value == null ? "NE" : value.Value.ToString();
}
else if (calculate.GetStringFun != null)
{
@ -1062,7 +1062,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque1MinFCT(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PatchDataStatistics).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 1)).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}
/// <summary>
@ -1073,7 +1073,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque2MinFCT(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PatchDataStatistics).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 2)).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}
/// <summary>
@ -1084,7 +1084,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque3MinFCT(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.PatchDataStatistics).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer.IsNullOrEmptyReturn0() == 3)).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}
/// <summary>

View File

@ -208,6 +208,27 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}
}
public static decimal? IsNullOrEmptyReturnNull(this string value)
{
try
{
if (value == null || value == string.Empty || value == "NA")
{
return null;
}
else
{
return decimal.Parse(value);
}
}
catch (Exception)
{
return null;
}
}
public static decimal IsNullOrEmptyReturn0(this string value)
{
try
@ -232,6 +253,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
/// <summary>
/// 获取DisplayName
/// </summary>

View File

@ -50,5 +50,25 @@ namespace IRaCIS.Core.Infrastructure.Extention
}
}
/// <summary>
/// 查询字符串 为null 返回指定字符
/// </summary>
/// <typeparam name="TSource"></typeparam>
/// <param name="source"></param>
/// <returns></returns>
public static string FirstIsNullReturnValue(this IEnumerable<string> source,string value)
{
var result = source.FirstOrDefault();
if (result == null || result == string.Empty)
{
return value;
}
else
{
return result;
}
}
}
}