IRC_NewDev
he 2024-09-26 15:03:01 +08:00
parent ea48967492
commit 3d6d64175b
5 changed files with 70 additions and 9 deletions

View File

@ -90,7 +90,7 @@ namespace IRaCIS.Core.Application.Service
[HttpPost] [HttpPost]
public async Task<GetJudgeReadingInfoOutDto> GetJudgeReadingInfo(GetJudgeReadingInfo inDto) 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(); var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).Select(x => x.CriterionType).FirstNotNullAsync();
@ -397,6 +397,26 @@ namespace IRaCIS.Core.Application.Service
break; 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 != "NA").Count()).MaxOrDefault();
x.VisitTaskInfoList.ForEach(z =>
{
z.JudgeQuestionList=z.JudgeQuestionList.Take(maxNum).ToList();
});
});
break;
}
return judgeInfo; return judgeInfo;
} }

View File

@ -505,7 +505,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
else if (calculate.GetDecimalNullFun != null) else if (calculate.GetDecimalNullFun != null)
{ {
var value = await calculate.GetDecimalNullFun(inDto); var value = await calculate.GetDecimalNullFun(inDto);
item.Answer = value == null ? string.Empty : value.Value.ToString(); item.Answer = value == null ? "NA" : value.Value.ToString();
} }
else if (calculate.GetStringFun != null) else if (calculate.GetStringFun != null)
{ {
@ -943,7 +943,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque1PVA(ReadingCalculateDto inDto) 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) 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> /// <summary>
@ -954,7 +954,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque2PVA(ReadingCalculateDto inDto) 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) 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> /// <summary>
@ -965,7 +965,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque3PVA(ReadingCalculateDto inDto) 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) 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) else if (calculate.GetDecimalNullFun != null)
{ {
var value = await calculate.GetDecimalNullFun(inDto); var value = await calculate.GetDecimalNullFun(inDto);
item.Answer = value == null ? string.Empty : value.Value.ToString(); item.Answer = value == null ? "NA" : value.Value.ToString();
} }
else if (calculate.GetStringFun != null) else if (calculate.GetStringFun != null)
{ {
@ -1062,7 +1062,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque1MinFCT(ReadingCalculateDto inDto) 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) 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> /// <summary>
@ -1073,7 +1073,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque2MinFCT(ReadingCalculateDto inDto) 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) 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> /// <summary>
@ -1084,7 +1084,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetPlaque3MinFCT(ReadingCalculateDto inDto) 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) 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> /// <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 0;
}
}
public static decimal IsNullOrEmptyReturn0(this string value) public static decimal IsNullOrEmptyReturn0(this string value)
{ {
try try

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;
}
}
} }
} }