|
|
|
@ -150,14 +150,14 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
List<ReadingTaskQuestionAnswer> questionAnswers = questions.Select(x => new ReadingTaskQuestionAnswer()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Answer=x.DefaultValue,
|
|
|
|
|
Id= NewId.NextGuid(),
|
|
|
|
|
ReadingQuestionCriterionTrialId= visitTaskInfo.TrialReadingCriterionId,
|
|
|
|
|
ReadingQuestionTrialId= x.Id,
|
|
|
|
|
SubjectId= visitTaskInfo.SubjectId,
|
|
|
|
|
TrialId= visitTaskInfo.TrialId,
|
|
|
|
|
VisitTaskId=visitTaskId,
|
|
|
|
|
|
|
|
|
|
Answer = x.DefaultValue,
|
|
|
|
|
Id = NewId.NextGuid(),
|
|
|
|
|
ReadingQuestionCriterionTrialId = visitTaskInfo.TrialReadingCriterionId,
|
|
|
|
|
ReadingQuestionTrialId = x.Id,
|
|
|
|
|
SubjectId = visitTaskInfo.SubjectId,
|
|
|
|
|
TrialId = visitTaskInfo.TrialId,
|
|
|
|
|
VisitTaskId = visitTaskId,
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
await _readingTaskQuestionAnswerRepository.AddRangeAsync(questionAnswers);
|
|
|
|
@ -209,7 +209,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
|
|
|
|
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
|
|
|
|
|
x.TaskState == TaskState.Effect &&
|
|
|
|
|
x.VisitTaskNum<= taskInfo.VisitTaskNum&&
|
|
|
|
|
x.VisitTaskNum <= taskInfo.VisitTaskNum &&
|
|
|
|
|
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
|
|
|
|
|
x.ReadingCategory == ReadingCategory.Visit) || x.Id == inDto.VisitTaskId)
|
|
|
|
|
.Select(x => new GetRelatedVisitTaskOutDto()
|
|
|
|
@ -247,7 +247,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
var readingPastResultList = await _visitTaskRepository.Where(x =>
|
|
|
|
|
x.TrialId == taskInfo.TrialId &&
|
|
|
|
|
x.SubjectId == taskInfo.SubjectId &&
|
|
|
|
|
x.VisitTaskNum<= taskInfo.VisitTaskNum&&
|
|
|
|
|
x.VisitTaskNum <= taskInfo.VisitTaskNum &&
|
|
|
|
|
x.ArmEnum == taskInfo.ArmEnum &&
|
|
|
|
|
x.Id != inDto.VisitTaskId &&
|
|
|
|
|
x.DoctorUserId == taskInfo.DoctorUserId &&
|
|
|
|
@ -372,18 +372,18 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
/// <param name="visitTaskId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonDynamicMethod]
|
|
|
|
|
public async Task<List<DicomReadingQuestionAnswer>> GetReadingQuestion(Guid trialReadingCriterionId,Guid? visitTaskId)
|
|
|
|
|
public async Task<List<DicomReadingQuestionAnswer>> GetReadingQuestion(Guid trialReadingCriterionId, Guid? visitTaskId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var criterionIdInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//排除表格问题
|
|
|
|
|
var questions = await _readingQuestionTrialRepository
|
|
|
|
|
.WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x=>x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
|
.WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x=>x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
|
|
|
|
|
|
.WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
|
.WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
|
|
|
|
|
|
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -393,7 +393,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
{
|
|
|
|
|
answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).ToListAsync(); ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//排除表格问题 同时排除组问题
|
|
|
|
|
var groups = questions.Where(x => x.Type != ReadingQestionType.Group).Select(x => x.GroupName).ToList();
|
|
|
|
@ -411,7 +411,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item, List<DicomReadingQuestionAnswer> questions, List<ReadingTaskQuestionAnswer> answers)
|
|
|
|
|
{
|
|
|
|
|
item.Answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.Childrens = questions.Where(x => x.ParentId == item.Id || ((item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName))).ToList();
|
|
|
|
|
if (item.Childrens != null && item.Childrens.Count > 0)
|
|
|
|
|
{
|
|
|
|
@ -483,7 +483,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
result.IsBaseLineTask = taskinfo.SourceSubjectVisitId == baseLineVisitId;
|
|
|
|
|
|
|
|
|
|
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tableAnswers = await _readingTableQuestionAnswerRepository
|
|
|
|
|
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
|
|
|
|
@ -514,7 +514,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<(GetReadingTableQuestionOutDto,bool)> GetCustomTableQuestionAnswer(GetCustomTableQuestionAnswerInDto inDto)
|
|
|
|
|
public async Task<(GetReadingTableQuestionOutDto, bool)> GetCustomTableQuestionAnswer(GetCustomTableQuestionAnswerInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
|
|
|
@ -538,7 +538,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
/// <param name="tableAnsweRowInfos"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonDynamicMethod]
|
|
|
|
|
public async Task<GetReadingTableQuestionOutDto> GetReadingTableQuestion(Guid trialReadingCriterionId, Guid? taskId, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos,bool isGetallQuestion=false)
|
|
|
|
|
public async Task<GetReadingTableQuestionOutDto> GetReadingTableQuestion(Guid trialReadingCriterionId, Guid? taskId, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, bool isGetallQuestion = false)
|
|
|
|
|
{
|
|
|
|
|
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
@ -561,7 +561,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
var usedGurops = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupName).ToList();
|
|
|
|
|
qusetionList = qusetionList.Where(x => usedGurops.Contains(x.GroupName)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (taskId != null)
|
|
|
|
|
{
|
|
|
|
@ -687,7 +687,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
answers.Add(z.TableQuestionId.ToString(), z.Answer);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
answers.Add("BlindName", rowInfo.BlindName);
|
|
|
|
|
answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString());
|
|
|
|
@ -717,7 +717,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 访视任务 - Dicom 阅片 表格问题 病灶的拆分与合并
|
|
|
|
|
|
|
|
|
@ -878,7 +878,6 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
return ResponseOutput.Ok(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.SplitRowId == deleteRowInfo.Id && x.MergeRowId == deleteRowInfo.Id))
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败");
|
|
|
|
@ -890,9 +889,9 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).Include(x=>x.ReadingQuestionTrial).OrderBy(x => x.RowIndex).ToListAsync();
|
|
|
|
|
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).Include(x => x.ReadingQuestionTrial).OrderBy(x => x.RowIndex).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in rowInfoList.Where(x => x.RowIndex % 1 == 0))
|
|
|
|
|
{
|
|
|
|
|
string measureDataStr = string.Empty;
|
|
|
|
@ -902,17 +901,17 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
measureData.data.remark = item.ReadingQuestionTrial.OrderMark + ((decimal)index).GetLesionMark();
|
|
|
|
|
measureDataStr = JsonConvert.SerializeObject(measureData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
|
|
|
|
{
|
|
|
|
|
RowIndex = index
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
|
|
|
|
{
|
|
|
|
|
RowIndex = index,
|
|
|
|
|
MeasureData = measureDataStr,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
var spiltList = rowInfoList.Where(x => x.RowIndex % 1 != 0 && x.RowIndex > item.RowIndex && x.RowIndex < Math.Floor(item.RowIndex + 1)).OrderBy(x => x.RowIndex).ToList();
|
|
|
|
|
decimal spiltindex = 0.01M;
|
|
|
|
|
foreach (var spiltitem in spiltList)
|
|
|
|
@ -922,7 +921,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
{
|
|
|
|
|
dynamic spiltmeasureData = JObject.Parse(spiltitem.MeasureData);
|
|
|
|
|
spiltmeasureData.data.remark = item.ReadingQuestionTrial.OrderMark + ((decimal)index + spiltindex).GetLesionMark();
|
|
|
|
|
spiltmeasureDataStr = JsonConvert.SerializeObject(spiltmeasureData);
|
|
|
|
|
spiltmeasureDataStr = JsonConvert.SerializeObject(spiltmeasureData);
|
|
|
|
|
}
|
|
|
|
|
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
|
|
|
|
{
|
|
|
|
@ -931,7 +930,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
|
|
|
|
{
|
|
|
|
|
RowIndex = index + spiltindex,
|
|
|
|
|
MeasureData= spiltmeasureDataStr,
|
|
|
|
|
MeasureData = spiltmeasureDataStr,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
spiltindex += 0.01M;
|
|
|
|
@ -976,7 +975,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
if (inDto.RowIndex % 1 == 0)
|
|
|
|
|
{
|
|
|
|
|
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.Id == inDto.QuestionId).FirstNotNullAsync();
|
|
|
|
|
if (questionInfo.MaxQuestionCount != null&& questionInfo.MaxQuestionCount!=0)
|
|
|
|
|
if (questionInfo.MaxQuestionCount != null && questionInfo.MaxQuestionCount != 0)
|
|
|
|
|
{
|
|
|
|
|
if (questionInfo.MaxQuestionCount <
|
|
|
|
|
(
|
|
|
|
@ -1000,7 +999,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
if (rowCount > item.MaxRowCount.Value - 1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<CriterionType, string> errorMsgDic = new Dictionary<CriterionType, string>()
|
|
|
|
|
{
|
|
|
|
|
{CriterionType.RECIST1Pointt1, $"按照RECIST1.1的相关规则,同一器官的靶病灶数量不超过{item.MaxRowCount.Value}个,请确认!"},
|
|
|
|
@ -1013,7 +1012,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
msg=$"问题{item.QuestionName}最大相同问题数为{item.MaxRowCount.Value},当前已存在{rowCount}条!";
|
|
|
|
|
msg = $"问题{item.QuestionName}最大相同问题数为{item.MaxRowCount.Value},当前已存在{rowCount}条!";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new BusinessValidationFailedException(msg);
|
|
|
|
@ -1036,7 +1035,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.RowId == (inDto.RowId ?? default(Guid)));
|
|
|
|
|
await _readingTableAnswerRowInfoRepository.BatchDeleteNoTrackingAsync(x => x.Id == (inDto.RowId ?? default(Guid)));
|
|
|
|
|
|
|
|
|
|
rowInfo.Id =inDto.RowId==null? NewId.NextGuid(): inDto.RowId.Value;
|
|
|
|
|
rowInfo.Id = inDto.RowId == null ? NewId.NextGuid() : inDto.RowId.Value;
|
|
|
|
|
rowInfo.TrialId = inDto.TrialId;
|
|
|
|
|
rowInfo.QuestionId = inDto.QuestionId;
|
|
|
|
|
rowInfo.MeasureData = inDto.MeasureData;
|
|
|
|
@ -1093,62 +1092,61 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<IResponseOutput> SubmitDicomVisitTask(SubmitDicomVisitTaskInDto inDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await VerifyTaskIsSign(inDto.VisitTaskId);
|
|
|
|
|
|
|
|
|
|
// 修改编号
|
|
|
|
|
//// 修改编号
|
|
|
|
|
//var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
|
|
|
|
//// 获取标准表格外层问题
|
|
|
|
|
//var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.LesionType != null && x.ReadingTableQuestionTrialList.Any(x => x.QuestionMark == QuestionMark.AutoId))
|
|
|
|
|
// .SelectMany(x => x.ReadingTableQuestionTrialList).Where(x => x.QuestionMark == QuestionMark.AutoId).Select(x => new
|
|
|
|
|
// {
|
|
|
|
|
// x.ReadingQuestionId,
|
|
|
|
|
// TableQuestionId = x.Id,
|
|
|
|
|
|
|
|
|
|
// 获取标准表格外层问题
|
|
|
|
|
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.LesionType != null && x.ReadingTableQuestionTrialList.Any(x => x.QuestionMark == QuestionMark.AutoId))
|
|
|
|
|
.SelectMany(x => x.ReadingTableQuestionTrialList).Where(x => x.QuestionMark == QuestionMark.AutoId).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.ReadingQuestionId,
|
|
|
|
|
TableQuestionId = x.Id,
|
|
|
|
|
// }).ToListAsync();
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
//var questionIds = questionList.Select(x => x.ReadingQuestionId).ToList();
|
|
|
|
|
|
|
|
|
|
var questionIds = questionList.Select(x => x.ReadingQuestionId).ToList();
|
|
|
|
|
//var questionMarkList = await _readingQuestionTrialRepository.Where(x => questionIds.Contains(x.Id)).Select(x => new
|
|
|
|
|
//{
|
|
|
|
|
// QuestionId = x.Id,
|
|
|
|
|
// x.OrderMark,
|
|
|
|
|
|
|
|
|
|
var questionMarkList = await _readingQuestionTrialRepository.Where(x => questionIds.Contains(x.Id)).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
QuestionId = x.Id,
|
|
|
|
|
x.OrderMark,
|
|
|
|
|
//}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
//var rowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && questionIds.Contains(x.QuestionId)).ToListAsync();
|
|
|
|
|
//List<ReadingTableQuestionAnswer> questionAnswerList = new List<ReadingTableQuestionAnswer>();
|
|
|
|
|
//foreach (var item in questionList)
|
|
|
|
|
//{
|
|
|
|
|
// await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.QuestionId == item.ReadingQuestionId
|
|
|
|
|
// && x.TableQuestionId == item.TableQuestionId && x.VisitTaskId == inDto.VisitTaskId);
|
|
|
|
|
|
|
|
|
|
var rowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && questionIds.Contains(x.QuestionId)).ToListAsync();
|
|
|
|
|
List<ReadingTableQuestionAnswer> questionAnswerList = new List<ReadingTableQuestionAnswer>();
|
|
|
|
|
foreach (var item in questionList)
|
|
|
|
|
{
|
|
|
|
|
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.QuestionId == item.ReadingQuestionId
|
|
|
|
|
&& x.TableQuestionId == item.TableQuestionId && x.VisitTaskId == inDto.VisitTaskId);
|
|
|
|
|
// var orderMark = questionMarkList.Where(x => x.QuestionId == item.ReadingQuestionId).Select(x => x.OrderMark).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
var orderMark = questionMarkList.Where(x => x.QuestionId == item.ReadingQuestionId).Select(x => x.OrderMark).FirstOrDefault();
|
|
|
|
|
// foreach (var row in rowInfo.Where(x => x.QuestionId == item.ReadingQuestionId))
|
|
|
|
|
// {
|
|
|
|
|
// questionAnswerList.Add(new ReadingTableQuestionAnswer()
|
|
|
|
|
// {
|
|
|
|
|
// Answer = orderMark + row.RowIndex.GetLesionMark(),
|
|
|
|
|
// Id = NewId.NextGuid(),
|
|
|
|
|
// QuestionId = item.ReadingQuestionId,
|
|
|
|
|
// RowId = row.Id,
|
|
|
|
|
// RowIndex = row.RowIndex,
|
|
|
|
|
// TableQuestionId = item.TableQuestionId,
|
|
|
|
|
// TrialId = taskInfo.TrialId,
|
|
|
|
|
// VisitTaskId = taskInfo.Id,
|
|
|
|
|
|
|
|
|
|
foreach (var row in rowInfo.Where(x => x.QuestionId == item.ReadingQuestionId))
|
|
|
|
|
{
|
|
|
|
|
questionAnswerList.Add(new ReadingTableQuestionAnswer()
|
|
|
|
|
{
|
|
|
|
|
Answer = orderMark + row.RowIndex.GetLesionMark(),
|
|
|
|
|
Id = NewId.NextGuid(),
|
|
|
|
|
QuestionId = item.ReadingQuestionId,
|
|
|
|
|
RowId = row.Id,
|
|
|
|
|
RowIndex = row.RowIndex,
|
|
|
|
|
TableQuestionId = item.TableQuestionId,
|
|
|
|
|
TrialId = taskInfo.TrialId,
|
|
|
|
|
VisitTaskId = taskInfo.Id,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
await _readingTableQuestionAnswerRepository.AddRangeAsync(questionAnswerList);
|
|
|
|
|
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//await _readingTableQuestionAnswerRepository.AddRangeAsync(questionAnswerList);
|
|
|
|
|
//await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1178,7 +1176,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId
|
|
|
|
|
&& (x.IsJudgeQuestion || (x.IsRequired == IsRequired.Required&&x.ShowQuestion==ShowQuestion.Show))
|
|
|
|
|
&& (x.IsJudgeQuestion || (x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show))
|
|
|
|
|
).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var answerQuestionIds = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Select(x => x.ReadingQuestionTrialId).ToListAsync();
|
|
|
|
@ -1187,7 +1185,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
if (readingQuestionList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException($" 必填问题{ string.Join(',', readingQuestionList.Select(x => x.QuestionName))}的答案为空或未保存");
|
|
|
|
|
throw new BusinessValidationFailedException($" 必填问题{string.Join(',', readingQuestionList.Select(x => x.QuestionName))}的答案为空或未保存");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _readingCalculateService.VerifyVisitTaskQuestions(inDto);
|
|
|
|
@ -1221,9 +1219,9 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
{
|
|
|
|
|
throw new BusinessValidationFailedException($"临床数据未阅读!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1272,9 +1270,10 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
}
|
|
|
|
|
else if (inDto.SubjectId != null)
|
|
|
|
|
{
|
|
|
|
|
var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto() {
|
|
|
|
|
TrialId= inDto.TrialId,
|
|
|
|
|
TrialReadingCriterionId=inDto.TrialReadingCriterionId,
|
|
|
|
|
var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto()
|
|
|
|
|
{
|
|
|
|
|
TrialId = inDto.TrialId,
|
|
|
|
|
TrialReadingCriterionId = inDto.TrialReadingCriterionId,
|
|
|
|
|
})).Item2;
|
|
|
|
|
|
|
|
|
|
var index = 0;
|
|
|
|
@ -1387,7 +1386,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
task.DigitPlaces = criterionInfo.DigitPlaces;
|
|
|
|
|
task.CriterionType = criterionInfo.CriterionType;
|
|
|
|
|
|
|
|
|
|
var blindSubjectCode = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).Select(x=>x.BlindSubjectCode).FirstNotNullAsync();
|
|
|
|
|
var blindSubjectCode = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).Select(x => x.BlindSubjectCode).FirstNotNullAsync();
|
|
|
|
|
task.SubjectCode = blindSubjectCode.IsNullOrEmpty() ? task.SubjectCode : blindSubjectCode;
|
|
|
|
|
return task;
|
|
|
|
|
}
|
|
|
|
@ -1524,7 +1523,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
OriginalVisitId = visitTaskId,
|
|
|
|
|
ReadingCategory = GenerateTaskCategory.Global,
|
|
|
|
|
TrialId = taskInfo.TrialId,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReadingGenerataTaskList = needReadList
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|