修改一版
parent
b15505f2ba
commit
d4a1f6f113
|
@ -18,6 +18,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
|
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
|
||||||
public List<QuestionInfo> QuestionInfo { get; set; } = new List<QuestionInfo>();
|
public List<QuestionInfo> QuestionInfo { get; set; } = new List<QuestionInfo>();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public List<GetTrialReadingQuestionOutDto> RelationQuestions { get; set; } = new List<GetTrialReadingQuestionOutDto>();
|
public List<GetTrialReadingQuestionOutDto> RelationQuestions { get; set; } = new List<GetTrialReadingQuestionOutDto>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GetTableAnswerRowInfoInDto
|
||||||
|
{
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public Guid? QuestionId { get; set; }
|
||||||
|
}
|
||||||
public class GetReadingQuestionAndAnswerInDto
|
public class GetReadingQuestionAndAnswerInDto
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -621,6 +626,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
|
|
||||||
public string MeasureData { get; set; }
|
public string MeasureData { get; set; }
|
||||||
|
|
||||||
|
public Guid? SeriesId { get; set; }
|
||||||
|
|
||||||
|
public Guid? InstanceId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<SubmitTableQuestionInfo> AnswerList { get; set; }
|
public List<SubmitTableQuestionInfo> AnswerList { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,25 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
|
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
|
||||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||||
private readonly IRepository<TumorAssessment> _tumorAssessmentRepository;
|
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
|
||||||
|
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||||
|
private readonly IRepository<TumorAssessment> _tumorAssessmentRepository;
|
||||||
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
|
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
|
||||||
|
|
||||||
public ReadingCalculateService(
|
public ReadingCalculateService(
|
||||||
IRepository<ReadingTableQuestionAnswer> readingTableQuestionAnswerRepository,
|
IRepository<ReadingTableQuestionAnswer> readingTableQuestionAnswerRepository,
|
||||||
IRepository<VisitTask> visitTaskRepository,
|
IRepository<VisitTask> visitTaskRepository,
|
||||||
IRepository<TumorAssessment> tumorAssessmentRepository,
|
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
|
||||||
|
IRepository<SubjectVisit> subjectVisitRepository,
|
||||||
|
IRepository<TumorAssessment> tumorAssessmentRepository,
|
||||||
IRepository<ReadingTaskQuestionAnswer> ReadingTaskQuestionAnswerRepository
|
IRepository<ReadingTaskQuestionAnswer> ReadingTaskQuestionAnswerRepository
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository;
|
this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository;
|
||||||
this._visitTaskRepository = visitTaskRepository;
|
this._visitTaskRepository = visitTaskRepository;
|
||||||
this._tumorAssessmentRepository = tumorAssessmentRepository;
|
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
|
||||||
|
this._subjectVisitRepository = subjectVisitRepository;
|
||||||
|
this._tumorAssessmentRepository = tumorAssessmentRepository;
|
||||||
this._readingTaskQuestionAnswerRepository = ReadingTaskQuestionAnswerRepository;
|
this._readingTaskQuestionAnswerRepository = ReadingTaskQuestionAnswerRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,9 +232,33 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string> GetIsAddFive(ReadingCalculateDto inDto)
|
public async Task<bool> GetIsAddFive(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
|
||||||
|
var LastVisitTaskId = await this.GetLastVisitTaskId(inDto);
|
||||||
|
|
||||||
|
var questionIds = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).Select(x => x.QuestionId).ToList();
|
||||||
|
var lastQuestionAsnwer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId && questionIds.Contains(x.QuestionId)).Include(x=>x.ReadingQuestionTrial).ToListAsync();
|
||||||
|
var rowIndexs = lastQuestionAsnwer.Where(x=>x.ReadingTableQuestionTrial.QuestionMark==QuestionMark.IsLymph&&x.Answer=="是").Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList();
|
||||||
|
|
||||||
|
var thisQuestionAsnwer = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
||||||
|
|
||||||
|
var isExists = false;
|
||||||
|
foreach (var item in rowIndexs)
|
||||||
|
{
|
||||||
|
var lastValue = decimal.Parse(lastQuestionAsnwer.Where(x => x.RowIndex == item && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault() ?? "0");
|
||||||
|
|
||||||
|
var thisRowData = thisQuestionAsnwer.Where(x => x.RowIndex == item).SelectMany(x => x.TableQuestionList).ToList();
|
||||||
|
var thisValue = decimal.Parse(thisRowData.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault() ?? "0");
|
||||||
|
|
||||||
|
if (thisValue - lastValue > 5)
|
||||||
|
{
|
||||||
|
isExists = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isExists;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -275,14 +305,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<decimal> GetBaseLineSOD(ReadingCalculateDto inDto)
|
private async Task<decimal> GetBaseLineSOD(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
if (await _visitTaskRepository.AnyAsync(x => x.Id == inDto.VisitTaskId && x.SourceSubjectVisit.IsBaseLine))
|
if (await _visitTaskRepository.AnyAsync(x => x.Id == inDto.VisitTaskId && x.SourceSubjectVisit.IsBaseLine&&!x.IsAnalysisCreate))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 先找到基线的任务
|
// 先找到基线的任务
|
||||||
var baseLineTaskId = await _visitTaskRepository.Where(x => x.SubjectId == inDto.SubjectId && x.ReadingCategory == ReadingCategory.Visit
|
var baseLineTaskId = await _visitTaskRepository.Where(x => x.SubjectId == inDto.SubjectId && x.ReadingCategory == ReadingCategory.Visit
|
||||||
&& x.SourceSubjectVisit.IsBaseLine && x.TaskState == TaskState.Effect)
|
&& x.SourceSubjectVisit.IsBaseLine && x.TaskState == TaskState.Effect&&!x.IsAnalysisCreate)
|
||||||
.Select(x => x.Id).FirstOrDefaultAsync();
|
.Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
@ -317,7 +347,24 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取上一个访视任务Id
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<Guid> GetLastVisitTaskId(ReadingCalculateDto inDto)
|
||||||
|
{
|
||||||
|
// 拿到这一个访视
|
||||||
|
var thisNum = await _subjectVisitRepository.Where(x => x.Id == inDto.SubjectVisitId).Select(x => x.VisitNum).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
// 先找到上一个访视
|
||||||
|
var lastVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == inDto.SubjectId && x.VisitNum < thisNum).OrderByDescending(x => x.VisitNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
// 找到访视任务Id
|
||||||
|
|
||||||
|
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit && x.TaskState == TaskState.Effect && !x.IsAnalysisCreate && x.SourceSubjectVisitId == lastVisitId).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return LastVisitTaskId;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,20 @@ namespace IRaCIS.Application.Services
|
||||||
// result.SinglePage = groupList;
|
// result.SinglePage = groupList;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取表格答案行信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <remarks>
|
||||||
|
/// (QuestionId) 可为空
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ReadingTableAnswerRowInfo>> GetTableAnswerRowInfo(GetTableAnswerRowInfoInDto inDto)
|
||||||
|
{
|
||||||
|
return await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId)
|
||||||
|
.WhereIf(inDto.QuestionId != null, x => x.QuestionId == inDto.QuestionId)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取表格问题及答案(2022-08-26)
|
/// 获取表格问题及答案(2022-08-26)
|
||||||
|
@ -279,6 +293,8 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
answers.Add("MeasureData", rowInfo==null?string.Empty:rowInfo.MeasureData);
|
answers.Add("MeasureData", rowInfo==null?string.Empty:rowInfo.MeasureData);
|
||||||
answers.Add("RowIndex", x.ToString());
|
answers.Add("RowIndex", x.ToString());
|
||||||
|
answers.Add("InstanceId", rowInfo == null ? string.Empty : rowInfo.InstanceId.ToString());
|
||||||
|
answers.Add("SeriesId", rowInfo == null ? string.Empty : rowInfo.SeriesId.ToString());
|
||||||
|
|
||||||
item.TableQuestions.Answers.Add(answers);
|
item.TableQuestions.Answers.Add(answers);
|
||||||
});
|
});
|
||||||
|
@ -1532,6 +1548,7 @@ namespace IRaCIS.Application.Services
|
||||||
QuestionId=inDto.QuestionId,
|
QuestionId=inDto.QuestionId,
|
||||||
TableQuestionId=x.TableQuestionId,
|
TableQuestionId=x.TableQuestionId,
|
||||||
RowIndex=inDto.RowIndex,
|
RowIndex=inDto.RowIndex,
|
||||||
|
|
||||||
VisitTaskId = inDto.VisitTaskId
|
VisitTaskId = inDto.VisitTaskId
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
@ -1542,6 +1559,8 @@ namespace IRaCIS.Application.Services
|
||||||
QuestionId = inDto.QuestionId,
|
QuestionId = inDto.QuestionId,
|
||||||
MeasureData = inDto.MeasureData,
|
MeasureData = inDto.MeasureData,
|
||||||
RowIndex = inDto.RowIndex,
|
RowIndex = inDto.RowIndex,
|
||||||
|
InstanceId=inDto.InstanceId,
|
||||||
|
SeriesId=inDto.SeriesId,
|
||||||
VisitTaskId = inDto.VisitTaskId,
|
VisitTaskId = inDto.VisitTaskId,
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,20 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RowIndex
|
/// InstanceId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public Guid? InstanceId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SeriesId
|
||||||
|
/// </summary>
|
||||||
|
public Guid? SeriesId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// RowIndex
|
||||||
|
/// </summary>
|
||||||
public int RowIndex { get; set; }
|
public int RowIndex { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -60,6 +60,10 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public ReadingQuestionTrial ReadingQuestionTrial { get; set; }
|
public ReadingQuestionTrial ReadingQuestionTrial { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("TableQuestionId")]
|
||||||
|
|
||||||
|
public ReadingTableQuestionTrial ReadingTableQuestionTrial { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue