Test.EIImageViewer
he 2022-09-19 16:13:49 +08:00
parent cc0933da8a
commit 25d07ecf8b
3 changed files with 72 additions and 9 deletions

View File

@ -92,6 +92,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
{ {
public Guid SubjectId { get; set; } public Guid SubjectId { get; set; }
public bool IsBaseLine { get; set; }
public Guid VisitTaskId { get; set; } public Guid VisitTaskId { get; set; }
public Guid CriterionId { get; set; } public Guid CriterionId { get; set; }

View File

@ -136,6 +136,14 @@ namespace IRaCIS.Core.Application.Service
}; };
var typeNAList = new List<QuestionType>
{
QuestionType.SODChange,
QuestionType.SODPercent,
QuestionType.LowestIncrease,
QuestionType.LowPercent,
};
foreach (var calculate in calculateList) foreach (var calculate in calculateList)
{ {
var item=inDto.QuestionInfo.FirstOrDefault(x => x.QuestionType == calculate.QuestionType); var item=inDto.QuestionInfo.FirstOrDefault(x => x.QuestionType == calculate.QuestionType);
@ -156,8 +164,17 @@ namespace IRaCIS.Core.Application.Service
{ {
var value = await calculate.GetDecimalNullFun(inDto); var value = await calculate.GetDecimalNullFun(inDto);
if (value == null) if (value == null)
{
if (typeNAList.Contains(item.QuestionType ?? QuestionType.SOD))
{
item.Answer = "NA";
}
else
{ {
item.Answer = string.Empty; item.Answer = string.Empty;
}
} }
else else
@ -276,6 +293,7 @@ namespace IRaCIS.Core.Application.Service
public async Task<ReadingCalculateDto> GetReadingCalculateDto(Guid visitTaskId) public async Task<ReadingCalculateDto> GetReadingCalculateDto(Guid visitTaskId)
{ {
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync(); var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == (visitTask.SourceSubjectVisitId ?? default(Guid))).FirstOrDefaultAsync();
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == visitTask.TrialId && x.IsConfirm).Select(x => x.Id).FirstOrDefaultAsync(); var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == visitTask.TrialId && x.IsConfirm).Select(x => x.Id).FirstOrDefaultAsync();
List<QuestionInfo> questionInfos = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).Select(x => new QuestionInfo() List<QuestionInfo> questionInfos = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).Select(x => new QuestionInfo()
{ {
@ -323,6 +341,7 @@ namespace IRaCIS.Core.Application.Service
QuestionInfo = questionInfos, QuestionInfo = questionInfos,
CriterionId = criterionId, CriterionId = criterionId,
TrialId = visitTask.TrialId, TrialId = visitTask.TrialId,
IsBaseLine = subjectVisit!.IsBaseLine,
DoctorUserId = visitTask.DoctorUserId, DoctorUserId = visitTask.DoctorUserId,
}; };
@ -525,6 +544,11 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns> /// <returns></returns>
public async Task<string> GetLowVisit(ReadingCalculateDto inDto) public async Task<string> GetLowVisit(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine)
{
return "NA";
}
var decimalAnswerList = await GetVisitTaskAnswerList(inDto); var decimalAnswerList = await GetVisitTaskAnswerList(inDto);
return decimalAnswerList.OrderBy(x => x.SOD).Select(x => x.VisitName).FirstOrDefault() ?? string.Empty; return decimalAnswerList.OrderBy(x => x.SOD).Select(x => x.VisitName).FirstOrDefault() ?? string.Empty;
} }
@ -560,6 +584,10 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns> /// <returns></returns>
public async Task<string> GetIsAddFive(ReadingCalculateDto inDto) public async Task<string> GetIsAddFive(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine)
{
return "NA";
}
var LastVisitTaskId = await this.GetLastVisitTaskId(inDto); var LastVisitTaskId = await this.GetLastVisitTaskId(inDto);
@ -596,6 +624,11 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns> /// <returns></returns>
public async Task<string> GetNETarget(ReadingCalculateDto inDto) public async Task<string> GetNETarget(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine)
{
return "NA";
}
var result = inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer == "NE"); var result = inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer == "NE");
return result ? "有" : "无"; return result ? "有" : "无";
@ -611,6 +644,12 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns> /// <returns></returns>
public async Task<string> GetTumor(ReadingCalculateDto inDto) public async Task<string> GetTumor(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine)
{
return "NA";
}
var targetLesion = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.TargetLesion).Select(x => x.Answer).FirstOrDefault(); var targetLesion = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.TargetLesion).Select(x => x.Answer).FirstOrDefault();
var noTargetLesion = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NoTargetLesion).Select(x => x.Answer).FirstOrDefault(); var noTargetLesion = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NoTargetLesion).Select(x => x.Answer).FirstOrDefault();
var newLesions = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesions).Select(x => x.Answer).FirstOrDefault(); var newLesions = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesions).Select(x => x.Answer).FirstOrDefault();
@ -802,7 +841,10 @@ namespace IRaCIS.Core.Application.Service
public async Task<string> GetTargetLesionEvaluate(ReadingCalculateDto inDto) public async Task<string> GetTargetLesionEvaluate(ReadingCalculateDto inDto)
{ {
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList(); var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
if (inDto.IsBaseLine)
{
return "NA";
}
if (tableQuestion.Count() == 0) if (tableQuestion.Count() == 0)
{ {
return string.Empty; return string.Empty;
@ -942,6 +984,11 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns> /// <returns></returns>
public async Task<string> GetNoTargetLesionEvaluate(ReadingCalculateDto inDto) public async Task<string> GetNoTargetLesionEvaluate(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine)
{
return "NA";
}
var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NonTargetLesions).SelectMany(x => x.TableRowInfoList).ToList(); var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NonTargetLesions).SelectMany(x => x.TableRowInfoList).ToList();
var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList(); var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList();
@ -995,6 +1042,11 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns> /// <returns></returns>
public async Task<string> GetNewLesionEvaluate(ReadingCalculateDto inDto) public async Task<string> GetNewLesionEvaluate(ReadingCalculateDto inDto)
{ {
if (inDto.IsBaseLine)
{
return "NA";
}
var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).ToList(); var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).ToList();
var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList(); var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList();

View File

@ -53,7 +53,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
public static decimal IsNullOrEmptyReturn0(this string value) public static decimal IsNullOrEmptyReturn0(this string value)
{ {
if (value == null || value == string.Empty) try
{
if (value == null || value == string.Empty || value == "NA")
{ {
return 0; return 0;
@ -63,6 +65,13 @@ namespace IRaCIS.Core.Infra.EFCore.Common
return decimal.Parse(value); return decimal.Parse(value);
} }
} }
catch (Exception)
{
return 0;
}
}