+107
-114
@@ -1,22 +1,15 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using MassTransit;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using AutoMapper;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 全局阅片
|
||||
/// </summary>
|
||||
@@ -34,8 +27,8 @@ namespace IRaCIS.Application.Services
|
||||
await VerifyTaskIsSign(inDto.GlobalTaskId);
|
||||
await this.SubmitTaskChangeState(inDto.GlobalTaskId);
|
||||
|
||||
var globalAnswerList = await _readingGlobalTaskInfoRepository.Where(x =>
|
||||
x.QuestionId!=null &&x.Answer!=string.Empty&& x.Answer != null &&
|
||||
var globalAnswerList = await _readingGlobalTaskInfoRepository.Where(x =>
|
||||
x.QuestionId != null && x.Answer != string.Empty && x.Answer != null &&
|
||||
x.GlobalTaskId == inDto.GlobalTaskId).ToListAsync();
|
||||
|
||||
foreach (var item in globalAnswerList)
|
||||
@@ -80,16 +73,16 @@ namespace IRaCIS.Application.Services
|
||||
&& x.Answer != answer.Answer && answer.Answer != string.Empty && answer.Answer != null
|
||||
, x => new ReadingTaskQuestionAnswer()
|
||||
{
|
||||
Answer= answer.Answer,
|
||||
GlobalChangeAnswer = answer.Answer,
|
||||
IsGlobalChange = true,
|
||||
Answer = answer.Answer,
|
||||
GlobalChangeAnswer = answer.Answer,
|
||||
IsGlobalChange = true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
var answers= inDto.VisitTaskAnswerList.SelectMany(x => x.AnswerList.Select(y => new ReadingGlobalTaskInfo()
|
||||
var answers = inDto.VisitTaskAnswerList.SelectMany(x => x.AnswerList.Select(y => new ReadingGlobalTaskInfo()
|
||||
{
|
||||
Answer = y.Answer,
|
||||
QuestionId = y.QuestionId,
|
||||
@@ -144,7 +137,7 @@ namespace IRaCIS.Application.Services
|
||||
GlobalAnswerType = x.GlobalAnswerType,
|
||||
TaskId = x.VisitTaskId,
|
||||
TrialId = inDto.TrialId,
|
||||
CreateTime= createtime,
|
||||
CreateTime = createtime,
|
||||
}).ToList());
|
||||
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.GlobalTaskId, u => new VisitTask() { ReadingTaskState = ReadingTaskState.Reading });
|
||||
@@ -163,7 +156,7 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<GetGlobalReadingInfoOutDto> GetGlobalReadingInfo(GetGlobalReadingInfoInDto inDto)
|
||||
{
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.Subject).FirstNotNullAsync();
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).FirstNotNullAsync();
|
||||
if (taskInfo.ReadingCategory != ReadingCategory.Global)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingGlobal_NotGlobal"]);
|
||||
@@ -174,15 +167,15 @@ namespace IRaCIS.Application.Services
|
||||
ReadingTaskState = taskInfo.ReadingTaskState,
|
||||
|
||||
};
|
||||
|
||||
|
||||
var otherGlobalTask = await _visitTaskRepository.Where(x => x.SouceReadModuleId == taskInfo.SouceReadModuleId && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
||||
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis && x.TaskState == TaskState.Effect && x.DoctorUserId != taskInfo.DoctorUserId
|
||||
).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var otherGlobalTask = await _visitTaskRepository.Where(x => x.SouceReadModuleId == taskInfo.SouceReadModuleId && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
||||
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis && x.TaskState == TaskState.Effect && x.DoctorUserId != taskInfo.DoctorUserId
|
||||
).FirstOrDefaultAsync();
|
||||
if (otherGlobalTask != null)
|
||||
{
|
||||
result.OtherGlobalTaskId = otherGlobalTask.Id;
|
||||
}
|
||||
}
|
||||
|
||||
result.TaskBlindName = taskInfo.TaskBlindName;
|
||||
if (taskInfo.IsAnalysisCreate)
|
||||
@@ -195,18 +188,18 @@ namespace IRaCIS.Application.Services
|
||||
result.SubjectCode = taskInfo.Subject.Code;
|
||||
}
|
||||
|
||||
var judgeInfo = await _visitTaskRepository.Where(x =>
|
||||
x.SubjectId == taskInfo.SubjectId
|
||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
&& x.TaskState == TaskState.Effect
|
||||
&& x.ArmEnum == taskInfo.ArmEnum
|
||||
&& x.ReadingCategory == ReadingCategory.Judge
|
||||
&& x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
||||
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis
|
||||
&& x.DoctorUserId == taskInfo.DoctorUserId
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned
|
||||
&& x.VisitTaskNum == taskInfo.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge]
|
||||
&& x.ReReadingApplyState != ReReadingApplyState.Agree).FirstOrDefaultAsync();
|
||||
var judgeInfo = await _visitTaskRepository.Where(x =>
|
||||
x.SubjectId == taskInfo.SubjectId
|
||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
&& x.TaskState == TaskState.Effect
|
||||
&& x.ArmEnum == taskInfo.ArmEnum
|
||||
&& x.ReadingCategory == ReadingCategory.Judge
|
||||
&& x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
||||
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis
|
||||
&& x.DoctorUserId == taskInfo.DoctorUserId
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned
|
||||
&& x.VisitTaskNum == taskInfo.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge]
|
||||
&& x.ReReadingApplyState != ReReadingApplyState.Agree).FirstOrDefaultAsync();
|
||||
if (judgeInfo != null)
|
||||
{
|
||||
result.JudgeTaskId = judgeInfo.Id;
|
||||
@@ -217,7 +210,7 @@ namespace IRaCIS.Application.Services
|
||||
// 一致性分析按照doctorId 其他按照分组
|
||||
|
||||
|
||||
var queruTask = _visitTaskRepository.Where(x =>
|
||||
var queruTask = _visitTaskRepository.Where(x =>
|
||||
x.TrialId == taskInfo.TrialId &&
|
||||
x.SubjectId == taskInfo.SubjectId &&
|
||||
x.ReadingCategory == ReadingCategory.Visit &&
|
||||
@@ -248,37 +241,37 @@ namespace IRaCIS.Application.Services
|
||||
VisitNum = x.SourceSubjectVisit.VisitNum,
|
||||
IsBaseLine = x.SourceSubjectVisit.IsBaseLine,
|
||||
VisitId = x.SourceSubjectVisitId!.Value,
|
||||
LesionCountList=x.LesionList.GroupBy(y=>y.ReadingQuestionTrial.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
LesionType = x.Key!.Value,
|
||||
Count = x.ToList().Count()
|
||||
}).ToList(),
|
||||
//CrterionDictionaryGroup= x.CrterionDictionaryGroup,
|
||||
BeforeQuestionList = x.ReadingTaskQuestionAnswerList.Where(y => y.ReadingQuestionTrial.GlobalReadingShowType!=GlobalReadingShowType.NotShow).OrderBy(y => y.ReadingQuestionTrial.ShowOrder)
|
||||
LesionCountList = x.LesionList.GroupBy(y => y.ReadingQuestionTrial.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
LesionType = x.Key!.Value,
|
||||
Count = x.ToList().Count()
|
||||
}).ToList(),
|
||||
//CrterionDictionaryGroup= x.CrterionDictionaryGroup,
|
||||
BeforeQuestionList = x.ReadingTaskQuestionAnswerList.Where(y => y.ReadingQuestionTrial.GlobalReadingShowType != GlobalReadingShowType.NotShow).OrderBy(y => y.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(y => new GlobalQuestionInfo()
|
||||
{
|
||||
|
||||
JudgeDifferenceValue= y.ReadingQuestionTrial.JudgeDifferenceValue,
|
||||
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
JudgeDifferenceValue = y.ReadingQuestionTrial.JudgeDifferenceValue,
|
||||
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
QuestionName = y.ReadingQuestionTrial.QuestionName.LanguageName(y.ReadingQuestionTrial.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionEnName=y.ReadingQuestionTrial.QuestionEnName,
|
||||
QuestionEnName = y.ReadingQuestionTrial.QuestionEnName,
|
||||
AnswerGroup = y.ReadingQuestionTrial.AnswerGroup,
|
||||
QuestionType = y.ReadingQuestionTrial.QuestionType,
|
||||
LimitEdit= y.ReadingQuestionTrial.LimitEdit,
|
||||
MaxAnswerLength=y.ReadingQuestionTrial.MaxAnswerLength,
|
||||
FileType=y.ReadingQuestionTrial.FileType,
|
||||
LimitEdit = y.ReadingQuestionTrial.LimitEdit,
|
||||
MaxAnswerLength = y.ReadingQuestionTrial.MaxAnswerLength,
|
||||
FileType = y.ReadingQuestionTrial.FileType,
|
||||
QuestionGenre = y.ReadingQuestionTrial.QuestionGenre,
|
||||
DictionaryCode = y.ReadingQuestionTrial.DictionaryCode,
|
||||
GlobalReadingShowType=y.ReadingQuestionTrial.GlobalReadingShowType,
|
||||
GlobalReadingShowType = y.ReadingQuestionTrial.GlobalReadingShowType,
|
||||
AnswerCombination = y.ReadingQuestionTrial.AnswerCombination,
|
||||
JudgeType = y.ReadingQuestionTrial.JudgeType,
|
||||
ShowOrder= y.ReadingQuestionTrial.ShowOrder,
|
||||
Type = y.ReadingQuestionTrial.Type,
|
||||
ShowOrder = y.ReadingQuestionTrial.ShowOrder,
|
||||
Type = y.ReadingQuestionTrial.Type,
|
||||
TypeValue = y.ReadingQuestionTrial.TypeValue,
|
||||
ValueType = y.ReadingQuestionTrial.ValueType,
|
||||
IsJudgeQuestion =y.ReadingQuestionTrial.IsJudgeQuestion,
|
||||
Answer =y.Answer,
|
||||
IsJudgeQuestion = y.ReadingQuestionTrial.IsJudgeQuestion,
|
||||
Answer = y.Answer,
|
||||
}).ToList()
|
||||
}).ToListAsync();
|
||||
var globalQuestionList = await _readingQuestionTrialRepository.Where(x => x.GlobalReadingShowType != GlobalReadingShowType.NotShow && x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId).IgnoreAutoIncludes().ToListAsync();
|
||||
@@ -299,40 +292,40 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
x.BeforeQuestionList.Add(new GlobalQuestionInfo()
|
||||
{
|
||||
QuestionId = y.Id,
|
||||
JudgeDifferenceValue=y.JudgeDifferenceValue,
|
||||
QuestionName = y.QuestionName.LanguageName(y.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionEnName = y.QuestionEnName,
|
||||
AnswerGroup = y.AnswerGroup,
|
||||
QuestionType = y.QuestionType,
|
||||
LimitEdit = y.LimitEdit,
|
||||
MaxAnswerLength = y.MaxAnswerLength,
|
||||
FileType = y.FileType,
|
||||
QuestionGenre = y.QuestionGenre,
|
||||
ShowOrder=y.ShowOrder,
|
||||
DictionaryCode = y.DictionaryCode,
|
||||
GlobalReadingShowType = y.GlobalReadingShowType,
|
||||
AnswerCombination = y.AnswerCombination,
|
||||
JudgeType = y.JudgeType,
|
||||
Type = y.Type,
|
||||
TypeValue = y.TypeValue,
|
||||
ValueType = y.ValueType,
|
||||
IsJudgeQuestion = y.IsJudgeQuestion,
|
||||
Answer = string.Empty,
|
||||
QuestionId = y.Id,
|
||||
JudgeDifferenceValue = y.JudgeDifferenceValue,
|
||||
QuestionName = y.QuestionName.LanguageName(y.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionEnName = y.QuestionEnName,
|
||||
AnswerGroup = y.AnswerGroup,
|
||||
QuestionType = y.QuestionType,
|
||||
LimitEdit = y.LimitEdit,
|
||||
MaxAnswerLength = y.MaxAnswerLength,
|
||||
FileType = y.FileType,
|
||||
QuestionGenre = y.QuestionGenre,
|
||||
ShowOrder = y.ShowOrder,
|
||||
DictionaryCode = y.DictionaryCode,
|
||||
GlobalReadingShowType = y.GlobalReadingShowType,
|
||||
AnswerCombination = y.AnswerCombination,
|
||||
JudgeType = y.JudgeType,
|
||||
Type = y.Type,
|
||||
TypeValue = y.TypeValue,
|
||||
ValueType = y.ValueType,
|
||||
IsJudgeQuestion = y.IsJudgeQuestion,
|
||||
Answer = string.Empty,
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
x.BeforeQuestionList = x.BeforeQuestionList.OrderBy(y => y.ShowOrder).ToList();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
var globalReadingQuestion = await _readingGlobalTaskInfoRepository.Where(x => x.GlobalTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
var globalReadingQuestion = await _readingGlobalTaskInfoRepository.Where(x => x.GlobalTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).Select(x => x.CriterionType).FirstOrDefaultAsync();
|
||||
|
||||
// Before的Answer取自于 上一次全局阅片的结果, 如果没有上一次全局阅片的结果 取访视的答案
|
||||
@@ -341,7 +334,7 @@ namespace IRaCIS.Application.Services
|
||||
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
|
||||
x.SubjectId == taskInfo.SubjectId && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate && x.TaskState == TaskState.Effect && x.VisitTaskNum < taskInfo.VisitTaskNum)
|
||||
.Where(x => x.DoctorUserId == taskInfo.DoctorUserId)
|
||||
.OrderByDescending(x=>x.VisitTaskNum)
|
||||
.OrderByDescending(x => x.VisitTaskNum)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
List<ReadingGlobalTaskInfo>? globalAnswers = new List<ReadingGlobalTaskInfo>();
|
||||
@@ -358,13 +351,13 @@ namespace IRaCIS.Application.Services
|
||||
x.BeforeQuestionList.ForEach(y =>
|
||||
{
|
||||
|
||||
var globalAnswer = globalAnswers.Where(z => z.QuestionId == y.QuestionId&&z.TaskId==x.VisitTaskId).Select(z => z.Answer).FirstOrDefault();
|
||||
var globalAnswer = globalAnswers.Where(z => z.QuestionId == y.QuestionId && z.TaskId == x.VisitTaskId).Select(z => z.Answer).FirstOrDefault();
|
||||
if (!globalAnswer.IsNullOrEmpty())
|
||||
{
|
||||
y.Answer = globalAnswer??string.Empty;
|
||||
y.Answer = globalAnswer ?? string.Empty;
|
||||
y.IsGlobalAnswer = true;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -372,7 +365,7 @@ namespace IRaCIS.Application.Services
|
||||
result.TaskList.ForEach(x =>
|
||||
{
|
||||
x.AfterQuestionList = x.BeforeQuestionList
|
||||
.GroupJoin(
|
||||
.GroupJoin(
|
||||
globalReadingQuestion
|
||||
, l => new { a = l.QuestionId, b = x.VisitTaskId }
|
||||
, r => new { a = r.QuestionId, b = r.TaskId }
|
||||
@@ -384,15 +377,15 @@ namespace IRaCIS.Application.Services
|
||||
(lr.global.Select(x => x.Answer).FirstOrDefault().IsNullOrEmpty() && inDto.UsingOriginalData ?
|
||||
lr.question.Answer : lr.global.Select(x => x.Answer).FirstOrDefault()
|
||||
),
|
||||
JudgeDifferenceValue= lr.question.JudgeDifferenceValue,
|
||||
VisitAnswer = lr.question.Answer,
|
||||
IsHaveChange = lr.global.Any(x=>x.QuestionId!=null&&!x.Answer.IsNullOrEmpty()) ? true : false,
|
||||
JudgeDifferenceValue = lr.question.JudgeDifferenceValue,
|
||||
VisitAnswer = lr.question.Answer,
|
||||
IsHaveChange = lr.global.Any(x => x.QuestionId != null && !x.Answer.IsNullOrEmpty()) ? true : false,
|
||||
QuestionId = lr.question.QuestionId,
|
||||
QuestionName = lr.question.QuestionName.LanguageName(lr.question.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionType = lr.question.QuestionType,
|
||||
LimitEdit=lr.question.LimitEdit,
|
||||
MaxAnswerLength=lr.question.MaxAnswerLength,
|
||||
FileType=lr.question.FileType,
|
||||
LimitEdit = lr.question.LimitEdit,
|
||||
MaxAnswerLength = lr.question.MaxAnswerLength,
|
||||
FileType = lr.question.FileType,
|
||||
QuestionGenre = lr.question.QuestionGenre,
|
||||
DictionaryCode = lr.question.DictionaryCode,
|
||||
GlobalReadingShowType = lr.question.GlobalReadingShowType,
|
||||
@@ -400,10 +393,10 @@ namespace IRaCIS.Application.Services
|
||||
GlobalAnswerType = GlobalAnswerType.Question,
|
||||
AnswerGroup = lr.question.AnswerGroup,
|
||||
AnswerCombination = lr.question.AnswerCombination,
|
||||
IsJudgeQuestion=lr.question.IsJudgeQuestion,
|
||||
IsJudgeQuestion = lr.question.IsJudgeQuestion,
|
||||
JudgeType = lr.question.JudgeType,
|
||||
TypeValue = lr.question.TypeValue,
|
||||
ValueType= lr.question.ValueType,
|
||||
ValueType = lr.question.ValueType,
|
||||
|
||||
}).ToList();
|
||||
|
||||
@@ -415,7 +408,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
var agreeOrNotAnswer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.GlobalAnswerType == GlobalAnswerType.AgreeOrNot).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||
|
||||
if (agreeOrNotAnswer.IsNullOrEmpty()&& lastGlobalTask!=null&& lastGlobalTask.RelatedVisitTaskIdList.Contains(x.VisitTaskId))
|
||||
if (agreeOrNotAnswer.IsNullOrEmpty() && lastGlobalTask != null && lastGlobalTask.RelatedVisitTaskIdList.Contains(x.VisitTaskId))
|
||||
{
|
||||
agreeOrNotAnswer = "1";
|
||||
}
|
||||
@@ -430,7 +423,7 @@ namespace IRaCIS.Application.Services
|
||||
GlobalAnswerType=GlobalAnswerType.AgreeOrNot,
|
||||
GlobalReadingShowType= GlobalReadingShowType.AllShow,
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
questionTypes.Add(new GetGlobalQuestionType() { GlobalAnswerType = GlobalAnswerType.UpdateType, QuestionName = "评估更新类型" });
|
||||
@@ -443,8 +436,8 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
questionTypes.Add(new GetGlobalQuestionType() { GlobalAnswerType = GlobalAnswerType.Reason, QuestionName = "全局阅片备注" });
|
||||
foreach (var item in questionTypes)
|
||||
{
|
||||
@@ -454,7 +447,7 @@ namespace IRaCIS.Application.Services
|
||||
QuestionName = item.QuestionName,
|
||||
Type = "input",
|
||||
GlobalAnswerType = item.GlobalAnswerType,
|
||||
GlobalReadingShowType= GlobalReadingShowType.AllShow,
|
||||
GlobalReadingShowType = GlobalReadingShowType.AllShow,
|
||||
|
||||
});
|
||||
}
|
||||
@@ -469,8 +462,8 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
// 找到上一个全局阅片
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
result.TaskList.ForEach(x =>
|
||||
{
|
||||
foreach (var item in x.AfterQuestionList.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation))
|
||||
@@ -502,7 +495,7 @@ namespace IRaCIS.Application.Services
|
||||
x.BeforeQuestionList = x.BeforeQuestionList.Where(x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation).ToList();
|
||||
|
||||
|
||||
x.AfterQuestionList = x.AfterQuestionList.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation|| x.GlobalAnswerType != GlobalAnswerType.Question).ToList();
|
||||
x.AfterQuestionList = x.AfterQuestionList.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation || x.GlobalAnswerType != GlobalAnswerType.Question).ToList();
|
||||
|
||||
});
|
||||
}
|
||||
@@ -514,16 +507,16 @@ namespace IRaCIS.Application.Services
|
||||
List<CriterionDictionaryInfo> assessTypeList = await _readingTrialCriterionDictionaryRepository.Where(x => x.CriterionId == taskInfo.TrialReadingCriterionId
|
||||
&& x.ParentCode == ReadingCommon.CriterionDictionary.GlobalAssess
|
||||
)
|
||||
//.WhereIf(isBaseLine,x=>x.IsBaseLineUse)
|
||||
//.WhereIf(!isBaseLine,x=>x.IsFollowVisitUse)
|
||||
//.WhereIf(isBaseLine,x=>x.IsBaseLineUse)
|
||||
//.WhereIf(!isBaseLine,x=>x.IsFollowVisitUse)
|
||||
.Select(x => new CriterionDictionaryInfo()
|
||||
{
|
||||
Id = x.Id,
|
||||
|
||||
|
||||
DictionaryId = x.DictionaryId,
|
||||
ChildGroup = x.Dictionary.ChildGroup,
|
||||
IsBaseLineUse=x.IsBaseLineUse,
|
||||
IsFollowVisitUse=x.IsFollowVisitUse,
|
||||
IsBaseLineUse = x.IsBaseLineUse,
|
||||
IsFollowVisitUse = x.IsFollowVisitUse,
|
||||
Code = x.Dictionary.Code,
|
||||
Description = x.Dictionary.Description,
|
||||
ShowOrder = x.Dictionary.ShowOrder,
|
||||
|
||||
+58
-69
@@ -1,33 +1,22 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using MassTransit;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using AutoMapper;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.Service.ReadingCalculate.Interface;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using IRaCIS.Core.Application.Service.ReadingCalculate.Interface;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Linq;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using ZiggyCreatures.Caching.Fusion;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// IR影像阅片
|
||||
@@ -74,7 +63,7 @@ namespace IRaCIS.Application.Services
|
||||
ITrialEmailNoticeConfigService _trialEmailNoticeConfigService) : BaseService, IReadingImageTaskService
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
#region 计算
|
||||
|
||||
@@ -504,10 +493,10 @@ namespace IRaCIS.Application.Services
|
||||
x.TaskState == TaskState.Effect &&
|
||||
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
|
||||
x.ReadingCategory == ReadingCategory.Visit) || x.Id == inDto.VisitTaskId)
|
||||
.WhereIf(taskInfo.TrialReadingCriterion.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom,x=> (x.VisitTaskNum <= taskInfo.VisitTaskNum && x.ReadingTaskState == ReadingTaskState.HaveSigned)|| x.Id == inDto.VisitTaskId);
|
||||
.WhereIf(taskInfo.TrialReadingCriterion.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom, x => (x.VisitTaskNum <= taskInfo.VisitTaskNum && x.ReadingTaskState == ReadingTaskState.HaveSigned) || x.Id == inDto.VisitTaskId);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||
{
|
||||
@@ -546,7 +535,7 @@ namespace IRaCIS.Application.Services
|
||||
var self = result.Where(x => x.VisitTaskId == inDto.VisitTaskId).FirstOrDefault();
|
||||
Random random = new Random();
|
||||
var otherList = result.Where(x => x.VisitTaskId != inDto.VisitTaskId).OrderBy(x => random.Next()).ToList();
|
||||
var newList = new List<GetRelatedVisitTaskOutDto>() { };
|
||||
var newList = new List<GetRelatedVisitTaskOutDto>() { };
|
||||
newList.AddRange(otherList);
|
||||
newList.Add(self);
|
||||
result = newList;
|
||||
@@ -795,7 +784,7 @@ namespace IRaCIS.Application.Services
|
||||
//排除表格问题
|
||||
var questions = await _readingQuestionTrialRepository
|
||||
.WhereIf(questionClassify != null, x => x.QuestionClassify == questionClassify)
|
||||
.WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table&& x.Type != ReadingQestionType.BasicTable)
|
||||
.WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable)
|
||||
.WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable)
|
||||
|
||||
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider, new
|
||||
@@ -1161,7 +1150,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
}
|
||||
|
||||
var usedGuropIds = qusetionList.Where(x => x.Type == ReadingQestionType.Table|| x.Type== ReadingQestionType.BasicTable).Select(x => x.GroupId).ToList();
|
||||
var usedGuropIds = qusetionList.Where(x => x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable).Select(x => x.GroupId).ToList();
|
||||
qusetionList = qusetionList.Where(x => usedGuropIds.Contains(x.Id) || usedGuropIds.Contains(x.GroupId)).ToList();
|
||||
}
|
||||
break;
|
||||
@@ -1173,7 +1162,7 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2704,10 +2693,10 @@ namespace IRaCIS.Application.Services
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<bool> SetSkipReadingCache(SetSkipReadingCacheInDto inDto )
|
||||
public async Task<bool> SetSkipReadingCache(SetSkipReadingCacheInDto inDto)
|
||||
{
|
||||
var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.Id));
|
||||
if (clearSkipReadingCache == null|| clearSkipReadingCache==string.Empty)
|
||||
if (clearSkipReadingCache == null || clearSkipReadingCache == string.Empty)
|
||||
{
|
||||
List<Guid> cacheIds = new List<Guid>();
|
||||
cacheIds.Add(inDto.VisitTaskId);
|
||||
@@ -2715,7 +2704,7 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Guid>? cacheIds=JsonConvert.DeserializeObject<List<Guid>>(clearSkipReadingCache);
|
||||
List<Guid>? cacheIds = JsonConvert.DeserializeObject<List<Guid>>(clearSkipReadingCache);
|
||||
cacheIds.Add(inDto.VisitTaskId);
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.Id), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
|
||||
}
|
||||
@@ -2750,7 +2739,7 @@ namespace IRaCIS.Application.Services
|
||||
#region 跳过阅片
|
||||
var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.Id));
|
||||
|
||||
|
||||
|
||||
List<Guid> cacheSkipIds = new List<Guid>();
|
||||
if (clearSkipReadingCache != null && clearSkipReadingCache != string.Empty)
|
||||
{
|
||||
@@ -2800,7 +2789,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var currentSubject = subjectTaskList.Where(x => x.Index >= subjectIndex && !x.ExistReadingApply)
|
||||
// 排除跳过的
|
||||
.Where(x=> x.UnReadCanReadTaskList.Select(y => y.Id).Intersect(cacheSkipIds).Count()==0)
|
||||
.Where(x => x.UnReadCanReadTaskList.Select(y => y.Id).Intersect(cacheSkipIds).Count() == 0)
|
||||
.OrderBy(x => x.Index).FirstOrDefault();
|
||||
|
||||
|
||||
@@ -2811,17 +2800,17 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
task = currentSubject.UnReadCanReadTaskList
|
||||
.Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
SubjectCode = currentSubject.SubjectCode,
|
||||
SubjectId = currentSubject.SubjectId,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
VisitNum = x.VisitNum,
|
||||
ArmEnum = x.ArmEnum,
|
||||
VisistId = x.VisistId ?? default(Guid),
|
||||
VisitTaskId = x.Id,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).FirstOrDefault();
|
||||
{
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
SubjectCode = currentSubject.SubjectCode,
|
||||
SubjectId = currentSubject.SubjectId,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
VisitNum = x.VisitNum,
|
||||
ArmEnum = x.ArmEnum,
|
||||
VisistId = x.VisistId ?? default(Guid),
|
||||
VisitTaskId = x.Id,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).FirstOrDefault();
|
||||
|
||||
|
||||
|
||||
@@ -2833,7 +2822,7 @@ namespace IRaCIS.Application.Services
|
||||
TrialId = inDto.TrialId,
|
||||
SubjectId = inDto.SubjectId,
|
||||
TrialReadingCriterionId = trialReadingCriterionId!.Value,
|
||||
SubjectCode=inDto.SubjectCode,
|
||||
SubjectCode = inDto.SubjectCode,
|
||||
PageIndex = 1,
|
||||
PageSize = 99999,
|
||||
|
||||
@@ -2858,23 +2847,23 @@ namespace IRaCIS.Application.Services
|
||||
Random random = new Random();
|
||||
//返回的范围是 0- taskList.Count-1
|
||||
int randomIndex = random.Next(taskList.Count);
|
||||
|
||||
|
||||
var visitTaskId = taskList[randomIndex].Id;
|
||||
|
||||
task = await _visitTaskRepository.Where(x=>x.Id== visitTaskId).Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
ArmEnum = x.ArmEnum,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.VisitTaskNum,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectCode = x.Subject.Code,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).FirstOrDefaultAsync();
|
||||
task = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
ArmEnum = x.ArmEnum,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.VisitTaskNum,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectCode = x.Subject.Code,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id
|
||||
@@ -2917,7 +2906,7 @@ namespace IRaCIS.Application.Services
|
||||
task.SubjectCode = await _subjectRepository.Where(x => x.Id == task.SubjectId).Select(x => x.Code).FirstNotNullAsync();
|
||||
}
|
||||
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == task.VisitTaskId&&x.TaskState==TaskState.Effect&&x.ReadingTaskState!=ReadingTaskState.HaveSigned , x => new VisitTask()
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == task.VisitTaskId && x.TaskState == TaskState.Effect && x.ReadingTaskState != ReadingTaskState.HaveSigned, x => new VisitTask()
|
||||
{
|
||||
FirstReadingTime = DateTime.Now,
|
||||
});
|
||||
@@ -3039,7 +3028,7 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<bool> VerifyReadingRestTime()
|
||||
{
|
||||
var userTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt;
|
||||
var userTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt;
|
||||
if (userTypeEnum != UserTypeEnum.IndependentReviewer)
|
||||
{
|
||||
return true;
|
||||
@@ -3282,7 +3271,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
if (taskInfo.ReadingCategory == ReadingCategory.Visit)
|
||||
{
|
||||
switch(isReadingTaskViewInOrder)
|
||||
switch (isReadingTaskViewInOrder)
|
||||
{
|
||||
case ReadingOrder.SubjectRandom:
|
||||
|
||||
@@ -3295,7 +3284,7 @@ namespace IRaCIS.Application.Services
|
||||
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
|
||||
x.ArmEnum == taskInfo.ArmEnum &&
|
||||
x.IsSelfAnalysis == taskInfo.IsSelfAnalysis &&
|
||||
x.BlindSubjectCode==taskInfo.BlindSubjectCode &&
|
||||
x.BlindSubjectCode == taskInfo.BlindSubjectCode &&
|
||||
x.DoctorUserId == taskInfo.DoctorUserId &&
|
||||
x.TaskState == TaskState.Effect && x.Id != taskInfo.Id).Select(x => x.Id).ToListAsync();
|
||||
|
||||
@@ -3304,7 +3293,7 @@ namespace IRaCIS.Application.Services
|
||||
relatedVisitTaskIdList.Add(taskInfo.Id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+97
-99
@@ -1,21 +1,17 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using MassTransit;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using AutoMapper;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 裁判
|
||||
/// </summary>
|
||||
@@ -43,14 +39,14 @@ namespace IRaCIS.Application.Services
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
PageName = x.ReadingCriterionPage.PageName,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionGenre=x.QuestionGenre,
|
||||
DictionaryCode=x.DictionaryCode,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
JudgeType = x.JudgeType,
|
||||
Type=x.Type,
|
||||
Unit= x.Unit,
|
||||
Type = x.Type,
|
||||
Unit = x.Unit,
|
||||
ReadingQuestionTrialId = x.Id,
|
||||
JudgeDifferenceValue= x.JudgeDifferenceValue,
|
||||
JudgeDifferenceType=x.JudgeDifferenceType,
|
||||
JudgeDifferenceValue = x.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.JudgeDifferenceType,
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
@@ -74,9 +70,9 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
AnswerGroup = JsonConvert.SerializeObject(inDto.AnswerGroup),
|
||||
AnswerCombination = JsonConvert.SerializeObject(inDto.AnswerCombination),
|
||||
JudgeDifferenceValue= inDto.JudgeDifferenceValue,
|
||||
JudgeDifferenceType=inDto.JudgeDifferenceType,
|
||||
JudgeType = inDto.JudgeType,
|
||||
JudgeDifferenceValue = inDto.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = inDto.JudgeDifferenceType,
|
||||
JudgeType = inDto.JudgeType,
|
||||
});
|
||||
|
||||
var result = await _readingQuestionTrialRepository.SaveChangesAsync();
|
||||
@@ -134,21 +130,11 @@ namespace IRaCIS.Application.Services
|
||||
if (await VerifyIsGlobalVisitTask(taskList[0].Id))
|
||||
{
|
||||
|
||||
var globalVisitTaskIds = await _visitTaskRepository.Where(x=>x.Id== taskList[0].Id).Select(x=>x.RelatedVisitTaskIdList).FirstNotNullAsync();
|
||||
var globalVisitTaskIds = await _visitTaskRepository.Where(x => x.Id == taskList[0].Id).Select(x => x.RelatedVisitTaskIdList).FirstNotNullAsync();
|
||||
|
||||
// 找到所有的的任务
|
||||
var globalVisitTasks = await _visitTaskRepository.Where(x => globalVisitTaskIds.Contains(x.Id)||x.Id== taskList[0].Id).Select(x => new {
|
||||
x.Id,
|
||||
x.ArmEnum,
|
||||
x.VisitTaskNum,
|
||||
x.SourceSubjectVisitId,
|
||||
x.TaskBlindName,
|
||||
} ).ToListAsync();
|
||||
|
||||
var globalVisitTwoTaskIds = await _visitTaskRepository.Where(x => x.Id == taskList[1].Id).Select(x => x.RelatedVisitTaskIdList).FirstNotNullAsync();
|
||||
|
||||
// 找到所有的的任务
|
||||
var globalVisitTwoTasks = await _visitTaskRepository.Where(x => globalVisitTwoTaskIds.Contains(x.Id) || x.Id == taskList[1].Id).Select(x => new {
|
||||
var globalVisitTasks = await _visitTaskRepository.Where(x => globalVisitTaskIds.Contains(x.Id) || x.Id == taskList[0].Id).Select(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.ArmEnum,
|
||||
x.VisitTaskNum,
|
||||
@@ -156,7 +142,19 @@ namespace IRaCIS.Application.Services
|
||||
x.TaskBlindName,
|
||||
}).ToListAsync();
|
||||
|
||||
var taskNum = globalVisitTasks.Select(x => x.VisitTaskNum).Distinct().OrderBy(x=>x).ToList();
|
||||
var globalVisitTwoTaskIds = await _visitTaskRepository.Where(x => x.Id == taskList[1].Id).Select(x => x.RelatedVisitTaskIdList).FirstNotNullAsync();
|
||||
|
||||
// 找到所有的的任务
|
||||
var globalVisitTwoTasks = await _visitTaskRepository.Where(x => globalVisitTwoTaskIds.Contains(x.Id) || x.Id == taskList[1].Id).Select(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.ArmEnum,
|
||||
x.VisitTaskNum,
|
||||
x.SourceSubjectVisitId,
|
||||
x.TaskBlindName,
|
||||
}).ToListAsync();
|
||||
|
||||
var taskNum = globalVisitTasks.Select(x => x.VisitTaskNum).Distinct().OrderBy(x => x).ToList();
|
||||
|
||||
|
||||
var judgeQuestionAnswer = await _readingTaskQuestionAnswerRepository.Where(x => globalVisitTaskIds.Contains(x.VisitTaskId) && x.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(x => x.ReadingQuestionTrial.ShowOrder)
|
||||
@@ -267,7 +265,7 @@ namespace IRaCIS.Application.Services
|
||||
judgeInfo.VisitInfoList.Add(judgeReadingInfoDto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case ReadingCategory.Global:
|
||||
@@ -300,14 +298,14 @@ namespace IRaCIS.Application.Services
|
||||
ArmEnum = item.ArmEnum,
|
||||
VisitTaskId = item.VisitTaskId,
|
||||
GlobalVisitTaskId = taskList[0].Id,
|
||||
JudgeQuestionList = item.AfterQuestionList.Where(x => x.GlobalAnswerType== GlobalAnswerType.Question).Select(x => new JudgeQuestion()
|
||||
JudgeQuestionList = item.AfterQuestionList.Where(x => x.GlobalAnswerType == GlobalAnswerType.Question).Select(x => new JudgeQuestion()
|
||||
{
|
||||
|
||||
Answer = x.Answer,
|
||||
QuestionId = x.QuestionId!.Value,
|
||||
QuestionName = x.QuestionName,
|
||||
QuestionGenre=x.QuestionGenre,
|
||||
DictionaryCode=x.DictionaryCode,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
@@ -322,11 +320,11 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
judgeReadingQuestion.JudgeQuestionList.Add(new JudgeQuestion()
|
||||
{
|
||||
Answer = item.AfterQuestionList.Where(x => x.GlobalAnswerType == GlobalAnswerType.Reason).Select(x => x.Answer).FirstOrDefault()??string.Empty,
|
||||
Answer = item.AfterQuestionList.Where(x => x.GlobalAnswerType == GlobalAnswerType.Reason).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||
QuestionType = JudgeReadingQuestionType.VisitRemark,
|
||||
QuestionName = "",
|
||||
});
|
||||
@@ -337,14 +335,14 @@ namespace IRaCIS.Application.Services
|
||||
var rTwoJudge = new JudgeReadingQuestion()
|
||||
{
|
||||
ArmEnum = twoItem.ArmEnum,
|
||||
|
||||
|
||||
VisitTaskId = twoItem.VisitTaskId,
|
||||
GlobalVisitTaskId = taskList[1].Id,
|
||||
JudgeQuestionList = twoItem.AfterQuestionList.Where(x => x.GlobalAnswerType == GlobalAnswerType.Question).Select(x => new JudgeQuestion()
|
||||
{
|
||||
|
||||
Answer = x.Answer,
|
||||
QuestionId = x.QuestionId==null?default(Guid): x.QuestionId.Value,
|
||||
QuestionId = x.QuestionId == null ? default(Guid) : x.QuestionId.Value,
|
||||
QuestionName = x.QuestionName,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
@@ -365,11 +363,11 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rTwoJudge.JudgeQuestionList.Add(new JudgeQuestion()
|
||||
{
|
||||
Answer = twoItem.AfterQuestionList.Where(x => x.GlobalAnswerType == GlobalAnswerType.Reason).Select(x => x.Answer).FirstOrDefault()??string.Empty,
|
||||
Answer = twoItem.AfterQuestionList.Where(x => x.GlobalAnswerType == GlobalAnswerType.Reason).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||
QuestionType = JudgeReadingQuestionType.VisitRemark,
|
||||
QuestionName = "",
|
||||
});
|
||||
@@ -405,7 +403,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
JudgeResultTaskId = inDto.JudgeResultTaskId,
|
||||
JudgeResultRemark = inDto.JudgeResultRemark,
|
||||
JudgeResultImagePath = string.Join(',',inDto.JudgeResultImagePathList),
|
||||
JudgeResultImagePath = string.Join(',', inDto.JudgeResultImagePathList),
|
||||
|
||||
});
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
@@ -432,19 +430,19 @@ namespace IRaCIS.Application.Services
|
||||
SignTime = DateTime.Now,
|
||||
JudgeResultImagePath = string.Join(',', inDto.JudgeResultImagePathList),
|
||||
});
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
// 需要判断是否添加肿瘤学任务
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
// 需要判断是否添加肿瘤学任务
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
|
||||
if (taskInfo.ReadingCategory == ReadingCategory.Visit)
|
||||
{
|
||||
var oncologModule = await _readModuleRepository
|
||||
.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId &&x.TrialReadingCriterionId==taskInfo.TrialReadingCriterionId&& x.ModuleType == ModuleTypeEnum.Oncology).FirstOrDefaultAsync();
|
||||
if (!taskInfo.TrialReadingCriterion.IsGlobalReading&&oncologModule != null)
|
||||
var oncologModule = await _readModuleRepository
|
||||
.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId && x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && x.ModuleType == ModuleTypeEnum.Oncology).FirstOrDefaultAsync();
|
||||
if (!taskInfo.TrialReadingCriterion.IsGlobalReading && oncologModule != null)
|
||||
{
|
||||
await AddOncologyTask(oncologModule.Id);
|
||||
}
|
||||
await AddOncologyTask(oncologModule.Id);
|
||||
}
|
||||
}
|
||||
|
||||
else if (taskInfo.ReadingCategory == ReadingCategory.Global)
|
||||
@@ -457,15 +455,15 @@ namespace IRaCIS.Application.Services
|
||||
var visitId = await _readModuleRepository.Where(x => x.Id == taskInfo.SouceReadModuleId).Select(x => x.SubjectVisitId).FirstOrDefaultAsync();
|
||||
|
||||
var oncologModule = await _readModuleRepository.Where(x => x.SubjectVisitId == visitId && x.ModuleType == ModuleTypeEnum.Oncology
|
||||
&&x.TrialReadingCriterionId== taskInfo.TrialReadingCriterionId
|
||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
).FirstOrDefaultAsync();
|
||||
|
||||
if (oncologModule != null)
|
||||
{
|
||||
await AddOncologyTask(oncologModule.Id);
|
||||
}
|
||||
if (oncologModule != null)
|
||||
{
|
||||
await AddOncologyTask(oncologModule.Id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -534,12 +532,12 @@ namespace IRaCIS.Application.Services
|
||||
else
|
||||
{
|
||||
isGroupAnalysis = true;
|
||||
visitTaskids = await _visitTaskRepository.Where(x => x.TaskState == TaskState.Effect && x.SourceSubjectVisitId == visitTask.SourceSubjectVisitId
|
||||
visitTaskids = await _visitTaskRepository.Where(x => x.TaskState == TaskState.Effect && x.SourceSubjectVisitId == visitTask.SourceSubjectVisitId
|
||||
&& x.TrialReadingCriterionId == visitTask.TrialReadingCriterionId
|
||||
&& x.SouceReadModuleId == visitTask.SouceReadModuleId && x.ReadingCategory != ReadingCategory.Judge && x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.Id).ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
@@ -559,13 +557,13 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in visitTaskids.Where(x=>x!=visitTask.Id))
|
||||
foreach (var item in visitTaskids.Where(x => x != visitTask.Id))
|
||||
{
|
||||
var armEnum = await _visitTaskRepository.Where(x => x.Id == item).Select(x=>x.ArmEnum).FirstNotNullAsync();
|
||||
var armEnum = await _visitTaskRepository.Where(x => x.Id == item).Select(x => x.ArmEnum).FirstNotNullAsync();
|
||||
await VerifyJudgeResult(visitTask, new List<Guid>() { visitTask.Id, item }, armEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -573,7 +571,7 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
|
||||
private async Task VerifyJudgeResult(VisitTask visitTask,List<Guid> visitTaskids,Arm? groupArm = null)
|
||||
private async Task VerifyJudgeResult(VisitTask visitTask, List<Guid> visitTaskids, Arm? groupArm = null)
|
||||
{
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).Select(x => new
|
||||
{
|
||||
@@ -605,8 +603,8 @@ namespace IRaCIS.Application.Services
|
||||
&& x.TaskState == TaskState.Effect
|
||||
&& x.TrialReadingCriterionId == visitTask.TrialReadingCriterionId
|
||||
&& x.IsAnalysisCreate == false
|
||||
&& x.SubjectId == visitTask.SubjectId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit && x.VisitTaskNum <= visitTask.VisitTaskNum).Select(x => x.Id).ToListAsync();
|
||||
&& x.SubjectId == visitTask.SubjectId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit && x.VisitTaskNum <= visitTask.VisitTaskNum).Select(x => x.Id).ToListAsync();
|
||||
|
||||
|
||||
var globalVisitQuestionQuery = from questionAnswer in _readingTaskQuestionAnswerRepository.Where(x => GlobalVisitTaskIds.Contains(x.VisitTaskId))
|
||||
@@ -619,8 +617,8 @@ namespace IRaCIS.Application.Services
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
JudgeDifferenceValue=question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType=question.JudgeDifferenceType,
|
||||
JudgeDifferenceValue = question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
VisitTaskId = questionAnswer.VisitTaskId,
|
||||
};
|
||||
var globalVisitAnswerlist = await globalVisitQuestionQuery.ToListAsync();
|
||||
@@ -629,15 +627,15 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
foreach (var item in taskNums)
|
||||
{
|
||||
List<GroupTaskAnswerDto> groupTasks = globalVisitAnswerlist.Where(x => x.VisitTaskNum == item).GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> groupTasks = globalVisitAnswerlist.Where(x => x.VisitTaskNum == item).GroupBy(x => new { x.JudgeDifferenceValue, x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
JudgeDifferenceValue = x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(groupTasks);
|
||||
}
|
||||
@@ -654,22 +652,22 @@ namespace IRaCIS.Application.Services
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
JudgeDifferenceValue=question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
VisitTaskId = questionAnswet.VisitTaskId,
|
||||
JudgeDifferenceValue = question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
VisitTaskId = questionAnswet.VisitTaskId,
|
||||
};
|
||||
var questionAnswerlist = await query.ToListAsync();
|
||||
|
||||
// 将答案进行分组
|
||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.JudgeDifferenceValue, x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
JudgeDifferenceValue = x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = ComputeJudgeResult(groupTasks);
|
||||
}
|
||||
@@ -710,16 +708,16 @@ namespace IRaCIS.Application.Services
|
||||
twoItem.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList()
|
||||
).ToList();
|
||||
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination,x.JudgeDifferenceValue,x.JudgeDifferenceType }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination, x.JudgeDifferenceValue, x.JudgeDifferenceType }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId!.Value,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
JudgeDifferenceValue= x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
}).ToList();
|
||||
JudgeDifferenceValue = x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
}
|
||||
|
||||
@@ -762,9 +760,9 @@ namespace IRaCIS.Application.Services
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
JudgeDifferenceValue=question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
};
|
||||
JudgeDifferenceValue = question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
};
|
||||
|
||||
var visitTaskQuestions = await query.ToListAsync();
|
||||
|
||||
@@ -772,15 +770,15 @@ namespace IRaCIS.Application.Services
|
||||
lastTask.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
|
||||
).ToList();
|
||||
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.JudgeDifferenceValue, x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId!.Value,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
JudgeDifferenceValue = x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
}
|
||||
@@ -822,7 +820,7 @@ namespace IRaCIS.Application.Services
|
||||
IsGroupDiffArm2 = true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
@@ -853,7 +851,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (visitTask.IsAnalysisCreate)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (groupArm == null)
|
||||
{
|
||||
@@ -902,8 +900,8 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
else if (noteEqual)
|
||||
{
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
var taskAnswer1 = item.TaskAnswerList[0];
|
||||
|
||||
+7
-10
@@ -1,15 +1,12 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using MassTransit;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
|
||||
+153
-156
@@ -1,21 +1,17 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using MassTransit;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using AutoMapper;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 肿瘤学
|
||||
/// </summary>
|
||||
@@ -32,7 +28,7 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<GetOncologyReadingInfoOutDto> GetOncologyReadingInfo(GetOncologyReadingInfoInDto inDto)
|
||||
{
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
|
||||
if (taskInfo.ReadingCategory != ReadingCategory.Oncology)
|
||||
{
|
||||
@@ -58,16 +54,16 @@ namespace IRaCIS.Application.Services
|
||||
Guid? judgeResultTaskId = null;
|
||||
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned && relatedVisitTaskIdList.Count() > 0)
|
||||
{
|
||||
judgeResultTaskId = await _visitTaskRepository.Where(x => x.Id == relatedVisitTaskIdList[0]).Select(x => x.JudgeResultTaskId).FirstOrDefaultAsync();
|
||||
judgeResultTaskId = await _visitTaskRepository.Where(x => x.Id == relatedVisitTaskIdList[0]).Select(x => x.JudgeResultTaskId).FirstOrDefaultAsync();
|
||||
|
||||
// 说明是裁判 取裁判结果
|
||||
if (judgeResultTaskId != null)
|
||||
{
|
||||
globalOrVisitTaskInfo = await _visitTaskRepository.Where(x =>x.Id== judgeResultTaskId).FirstNotNullAsync();
|
||||
globalOrVisitTaskInfo = await _visitTaskRepository.Where(x => x.Id == judgeResultTaskId).FirstNotNullAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
globalOrVisitTaskInfo = await _visitTaskRepository.Where(x => x.Id == relatedVisitTaskIdList[0]).FirstNotNullAsync();
|
||||
globalOrVisitTaskInfo = await _visitTaskRepository.Where(x => x.Id == relatedVisitTaskIdList[0]).FirstNotNullAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,26 +76,26 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
// 访视
|
||||
(decimal)(taskInfo.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Oncology])
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
globalOrVisitTaskInfo = await _visitTaskRepository
|
||||
|
||||
globalOrVisitTaskInfo = await _visitTaskRepository
|
||||
.Where(x => x.SubjectId == taskInfo.SubjectId &&
|
||||
x.TaskState == TaskState.Effect &&
|
||||
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
|
||||
taskNums.Contains(x.VisitTaskNum) &&
|
||||
taskNums.Contains(x.VisitTaskNum) &&
|
||||
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
|
||||
x.IsSelfAnalysis == taskInfo.IsSelfAnalysis &&
|
||||
x.VisitTaskNum < taskInfo.VisitTaskNum
|
||||
)
|
||||
.WhereIf(taskInfo.TrialReadingCriterion.IsGlobalReading, x=>x.ReadingCategory == ReadingCategory.Global)
|
||||
.WhereIf(!taskInfo.TrialReadingCriterion.IsGlobalReading, x => x.ReadingCategory == ReadingCategory.Visit)
|
||||
.OrderByDescending(x=>x.VisitTaskNum).ThenBy(x => x.ArmEnum)
|
||||
.WhereIf(taskInfo.TrialReadingCriterion.IsGlobalReading, x => x.ReadingCategory == ReadingCategory.Global)
|
||||
.WhereIf(!taskInfo.TrialReadingCriterion.IsGlobalReading, x => x.ReadingCategory == ReadingCategory.Visit)
|
||||
.OrderByDescending(x => x.VisitTaskNum).ThenBy(x => x.ArmEnum)
|
||||
.FirstNotNullAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 最后取哪组的数据
|
||||
@@ -125,23 +121,23 @@ namespace IRaCIS.Application.Services
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingOncology_Abnormal"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//visitTask = await _visitTaskRepository.Where(x => x.Id == judgeResultTaskId).FirstNotNullAsync();
|
||||
visitTaskIdList= await _visitTaskRepository.Where(x => x.Id == judgeResultTaskId).Select(x=>x.RelatedVisitTaskIdList).FirstNotNullAsync();
|
||||
visitTaskIdList = await _visitTaskRepository.Where(x => x.Id == judgeResultTaskId).Select(x => x.RelatedVisitTaskIdList).FirstNotNullAsync();
|
||||
globalOrVisitTaskInfo = await _visitTaskRepository.Where(x => x.Id == judgeResultTaskId).FirstNotNullAsync();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
result.RelatedTaskId = globalOrVisitTaskInfo!.JudgeVisitTaskId ?? globalOrVisitTaskInfo.Id;
|
||||
result.RelatedTaskId = globalOrVisitTaskInfo!.JudgeVisitTaskId ?? globalOrVisitTaskInfo.Id;
|
||||
result.ReadingCategory = globalOrVisitTaskInfo.ReadingCategory;
|
||||
|
||||
result.GlobalOrVisitTaskId = globalOrVisitTaskInfo.Id;
|
||||
result.GlobalOrVisitTaskId = globalOrVisitTaskInfo.Id;
|
||||
result.SubjectId = globalOrVisitTaskInfo.SubjectId;
|
||||
|
||||
|
||||
List<GlobalVisitInfo> globalVisits=new List<GlobalVisitInfo>();
|
||||
List<GlobalVisitInfo> globalVisits = new List<GlobalVisitInfo>();
|
||||
|
||||
if (result.ReadingCategory == ReadingCategory.Global)
|
||||
{
|
||||
@@ -155,61 +151,61 @@ namespace IRaCIS.Application.Services
|
||||
else
|
||||
{
|
||||
// 按照全局那边的查询法
|
||||
globalVisits =await _visitTaskRepository.Where(x =>
|
||||
x.TrialId == globalOrVisitTaskInfo.TrialId &&
|
||||
x.SubjectId == globalOrVisitTaskInfo.SubjectId &&
|
||||
x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == globalOrVisitTaskInfo.TrialReadingCriterionId &&
|
||||
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
||||
x.IsAnalysisCreate == globalOrVisitTaskInfo.IsAnalysisCreate &&
|
||||
x.ArmEnum == globalOrVisitTaskInfo.ArmEnum &&
|
||||
x.IsSelfAnalysis == globalOrVisitTaskInfo.IsSelfAnalysis &&
|
||||
x.DoctorUserId == globalOrVisitTaskInfo.DoctorUserId &&
|
||||
x.TaskState == TaskState.Effect &&
|
||||
x.VisitTaskNum <= globalOrVisitTaskInfo.VisitTaskNum)
|
||||
.OrderBy(x => x.VisitTaskNum).Select(x => new GlobalVisitInfo()
|
||||
{
|
||||
VisitName = x.TaskName,
|
||||
BlindName = x.TaskBlindName,
|
||||
VisitTaskId = x.Id,
|
||||
IsConvertedTask = x.IsConvertedTask,
|
||||
IsFirstChangeTask = x.IsConvertedTask && x.BeforeConvertedTaskId != null,
|
||||
ArmEnum = globalOrVisitTaskInfo.ArmEnum,
|
||||
VisitNum = x.SourceSubjectVisit.VisitNum,
|
||||
IsBaseLine = x.SourceSubjectVisit.IsBaseLine,
|
||||
VisitId = x.SourceSubjectVisitId!.Value,
|
||||
LesionCountList = x.LesionList.GroupBy(y => y.ReadingQuestionTrial.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
LesionType = x.Key!.Value,
|
||||
Count = x.ToList().Count()
|
||||
}).ToList(),
|
||||
//CrterionDictionaryGroup= x.CrterionDictionaryGroup,
|
||||
AfterQuestionList = x.ReadingTaskQuestionAnswerList.Where(y => y.ReadingQuestionTrial.GlobalReadingShowType != GlobalReadingShowType.NotShow).OrderBy(y => y.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(y => new GlobalQuestionInfo()
|
||||
{
|
||||
globalVisits = await _visitTaskRepository.Where(x =>
|
||||
x.TrialId == globalOrVisitTaskInfo.TrialId &&
|
||||
x.SubjectId == globalOrVisitTaskInfo.SubjectId &&
|
||||
x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == globalOrVisitTaskInfo.TrialReadingCriterionId &&
|
||||
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
||||
x.IsAnalysisCreate == globalOrVisitTaskInfo.IsAnalysisCreate &&
|
||||
x.ArmEnum == globalOrVisitTaskInfo.ArmEnum &&
|
||||
x.IsSelfAnalysis == globalOrVisitTaskInfo.IsSelfAnalysis &&
|
||||
x.DoctorUserId == globalOrVisitTaskInfo.DoctorUserId &&
|
||||
x.TaskState == TaskState.Effect &&
|
||||
x.VisitTaskNum <= globalOrVisitTaskInfo.VisitTaskNum)
|
||||
.OrderBy(x => x.VisitTaskNum).Select(x => new GlobalVisitInfo()
|
||||
{
|
||||
VisitName = x.TaskName,
|
||||
BlindName = x.TaskBlindName,
|
||||
VisitTaskId = x.Id,
|
||||
IsConvertedTask = x.IsConvertedTask,
|
||||
IsFirstChangeTask = x.IsConvertedTask && x.BeforeConvertedTaskId != null,
|
||||
ArmEnum = globalOrVisitTaskInfo.ArmEnum,
|
||||
VisitNum = x.SourceSubjectVisit.VisitNum,
|
||||
IsBaseLine = x.SourceSubjectVisit.IsBaseLine,
|
||||
VisitId = x.SourceSubjectVisitId!.Value,
|
||||
LesionCountList = x.LesionList.GroupBy(y => y.ReadingQuestionTrial.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
LesionType = x.Key!.Value,
|
||||
Count = x.ToList().Count()
|
||||
}).ToList(),
|
||||
//CrterionDictionaryGroup= x.CrterionDictionaryGroup,
|
||||
AfterQuestionList = x.ReadingTaskQuestionAnswerList.Where(y => y.ReadingQuestionTrial.GlobalReadingShowType != GlobalReadingShowType.NotShow).OrderBy(y => y.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(y => new GlobalQuestionInfo()
|
||||
{
|
||||
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
QuestionName = y.ReadingQuestionTrial.QuestionName.LanguageName(y.ReadingQuestionTrial.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionEnName = y.ReadingQuestionTrial.QuestionEnName,
|
||||
AnswerGroup = y.ReadingQuestionTrial.AnswerGroup,
|
||||
QuestionType = y.ReadingQuestionTrial.QuestionType,
|
||||
LimitEdit = y.ReadingQuestionTrial.LimitEdit,
|
||||
MaxAnswerLength = y.ReadingQuestionTrial.MaxAnswerLength,
|
||||
FileType = y.ReadingQuestionTrial.FileType,
|
||||
QuestionGenre = y.ReadingQuestionTrial.QuestionGenre,
|
||||
DictionaryCode = y.ReadingQuestionTrial.DictionaryCode,
|
||||
GlobalReadingShowType = y.ReadingQuestionTrial.GlobalReadingShowType,
|
||||
AnswerCombination = y.ReadingQuestionTrial.AnswerCombination,
|
||||
JudgeType = y.ReadingQuestionTrial.JudgeType,
|
||||
ShowOrder = y.ReadingQuestionTrial.ShowOrder,
|
||||
Type = y.ReadingQuestionTrial.Type,
|
||||
TypeValue = y.ReadingQuestionTrial.TypeValue,
|
||||
ValueType = y.ReadingQuestionTrial.ValueType,
|
||||
IsJudgeQuestion = y.ReadingQuestionTrial.IsJudgeQuestion,
|
||||
Answer = y.Answer,
|
||||
}).ToList()
|
||||
}).ToListAsync();
|
||||
}
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
QuestionName = y.ReadingQuestionTrial.QuestionName.LanguageName(y.ReadingQuestionTrial.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionEnName = y.ReadingQuestionTrial.QuestionEnName,
|
||||
AnswerGroup = y.ReadingQuestionTrial.AnswerGroup,
|
||||
QuestionType = y.ReadingQuestionTrial.QuestionType,
|
||||
LimitEdit = y.ReadingQuestionTrial.LimitEdit,
|
||||
MaxAnswerLength = y.ReadingQuestionTrial.MaxAnswerLength,
|
||||
FileType = y.ReadingQuestionTrial.FileType,
|
||||
QuestionGenre = y.ReadingQuestionTrial.QuestionGenre,
|
||||
DictionaryCode = y.ReadingQuestionTrial.DictionaryCode,
|
||||
GlobalReadingShowType = y.ReadingQuestionTrial.GlobalReadingShowType,
|
||||
AnswerCombination = y.ReadingQuestionTrial.AnswerCombination,
|
||||
JudgeType = y.ReadingQuestionTrial.JudgeType,
|
||||
ShowOrder = y.ReadingQuestionTrial.ShowOrder,
|
||||
Type = y.ReadingQuestionTrial.Type,
|
||||
TypeValue = y.ReadingQuestionTrial.TypeValue,
|
||||
ValueType = y.ReadingQuestionTrial.ValueType,
|
||||
IsJudgeQuestion = y.ReadingQuestionTrial.IsJudgeQuestion,
|
||||
Answer = y.Answer,
|
||||
}).ToList()
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
// 找到对应的访视
|
||||
List<OncologyVisitTaskInfo> oncologyVisits = await _visitTaskRepository.Where(x => visitTaskIdList.Contains(x.Id))
|
||||
@@ -217,9 +213,9 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
VisitName = x.SourceSubjectVisit.VisitName,
|
||||
IsBaseLine = x.SourceSubjectVisit.IsBaseLine,
|
||||
VisitNum=x.SourceSubjectVisit.VisitNum,
|
||||
VisitNum = x.SourceSubjectVisit.VisitNum,
|
||||
|
||||
VisitTaskId = x.Id,
|
||||
VisitTaskId = x.Id,
|
||||
// QuestionList = x.ReadingTaskQuestionAnswerList.Where(y => y.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(y => y.ReadingQuestionTrial.ShowOrder)
|
||||
//.Select(y => new OncologyQuestion()
|
||||
//{
|
||||
@@ -229,7 +225,7 @@ namespace IRaCIS.Application.Services
|
||||
//}).ToList()
|
||||
}).ToListAsync();
|
||||
|
||||
var oncologyReadingQuestions = await _readingOncologyTaskInfoRepository.Where(x => x.OncologyTaskId == inDto.VisitTaskId).Include(x=>x.VisitTask).ToListAsync();
|
||||
var oncologyReadingQuestions = await _readingOncologyTaskInfoRepository.Where(x => x.OncologyTaskId == inDto.VisitTaskId).Include(x => x.VisitTask).ToListAsync();
|
||||
// 上一次肿瘤学阅片
|
||||
|
||||
var lastOncologyTask = await _visitTaskRepository.Where(x =>
|
||||
@@ -241,56 +237,56 @@ namespace IRaCIS.Application.Services
|
||||
&& x.VisitTaskNum < taskInfo.VisitTaskNum
|
||||
).OrderByDescending(x => x.VisitTaskNum).FirstOrDefaultAsync();
|
||||
|
||||
List<ReadingOncologyTaskInfo> lastOncologyAnswerList= new List<ReadingOncologyTaskInfo>();
|
||||
List<ReadingOncologyTaskInfo> lastOncologyAnswerList = new List<ReadingOncologyTaskInfo>();
|
||||
|
||||
if (lastOncologyTask != null&& taskInfo.TaskState==TaskState.Effect&&taskInfo.ReadingTaskState!=ReadingTaskState.HaveSigned)
|
||||
if (lastOncologyTask != null && taskInfo.TaskState == TaskState.Effect && taskInfo.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||
{
|
||||
lastOncologyAnswerList= await _readingOncologyTaskInfoRepository.Where(x => x.OncologyTaskId == lastOncologyTask.Id).Include(x => x.VisitTask).ToListAsync();
|
||||
lastOncologyAnswerList = await _readingOncologyTaskInfoRepository.Where(x => x.OncologyTaskId == lastOncologyTask.Id).Include(x => x.VisitTask).ToListAsync();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
oncologyVisits.ForEach(x =>
|
||||
oncologyVisits.ForEach(x =>
|
||||
{
|
||||
var oncologyData = oncologyReadingQuestions.Where(y => y.VisitTaskId == x.VisitTaskId).FirstOrDefault();
|
||||
/// 根据任务编号匹配 不区分 r1 r2
|
||||
var lastOncologyData = lastOncologyAnswerList.Where(y => y.VisitTask.VisitTaskNum == x.VisitNum).FirstOrDefault();
|
||||
|
||||
var evaluationResult = string.Empty;
|
||||
var evaluationReason = string.Empty;
|
||||
if (oncologyData != null && !oncologyData.EvaluationResult.IsNullOrEmpty())
|
||||
var evaluationReason = string.Empty;
|
||||
if (oncologyData != null && !oncologyData.EvaluationResult.IsNullOrEmpty())
|
||||
{
|
||||
evaluationResult = oncologyData.EvaluationResult;
|
||||
}
|
||||
else if (lastOncologyData != null && !lastOncologyData.EvaluationResult.IsNullOrEmpty())
|
||||
{
|
||||
evaluationResult = lastOncologyData.EvaluationResult;
|
||||
}
|
||||
evaluationResult = lastOncologyData.EvaluationResult;
|
||||
}
|
||||
|
||||
|
||||
if (oncologyData != null && !oncologyData.EvaluationReason.IsNullOrEmpty())
|
||||
{
|
||||
evaluationReason = oncologyData.EvaluationReason;
|
||||
}
|
||||
else if (lastOncologyData != null && !lastOncologyData.EvaluationReason.IsNullOrEmpty())
|
||||
{
|
||||
evaluationReason = lastOncologyData.EvaluationReason;
|
||||
}
|
||||
if (oncologyData != null && !oncologyData.EvaluationReason.IsNullOrEmpty())
|
||||
{
|
||||
evaluationReason = oncologyData.EvaluationReason;
|
||||
}
|
||||
else if (lastOncologyData != null && !lastOncologyData.EvaluationReason.IsNullOrEmpty())
|
||||
{
|
||||
evaluationReason = lastOncologyData.EvaluationReason;
|
||||
}
|
||||
|
||||
|
||||
x.EvaluationResult = evaluationResult;
|
||||
x.EvaluationReason = evaluationReason;
|
||||
x.EvaluationResult = evaluationResult;
|
||||
x.EvaluationReason = evaluationReason;
|
||||
|
||||
x.QuestionList = globalVisits.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Where(x => x.GlobalAnswerType == GlobalAnswerType.Question)
|
||||
x.QuestionList = globalVisits.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Where(x => x.GlobalAnswerType == GlobalAnswerType.Question)
|
||||
.Select(y => new OncologyQuestion
|
||||
{
|
||||
QuestionId = y.QuestionId ?? default(Guid),
|
||||
QuestionName = y.QuestionName,
|
||||
QuestionGenre=y.QuestionGenre,
|
||||
DictionaryCode=y.DictionaryCode,
|
||||
QuestionGenre = y.QuestionGenre,
|
||||
DictionaryCode = y.DictionaryCode,
|
||||
Answer = y.Answer
|
||||
}).ToList();
|
||||
x.IsHaveChange = result.ReadingCategory == ReadingCategory.Visit?false: globalVisits.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Any(y => y.IsHaveChange);
|
||||
x.IsHaveChange = result.ReadingCategory == ReadingCategory.Visit ? false : globalVisits.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Any(y => y.IsHaveChange);
|
||||
x.VisitRemark = result.ReadingCategory == ReadingCategory.Visit ? string.Empty : globalVisits.Where(y => x.VisitTaskId == y.VisitTaskId).SelectMany(y => y.AfterQuestionList).Where(y => y.GlobalAnswerType == GlobalAnswerType.Reason).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||
|
||||
});
|
||||
@@ -343,7 +339,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
await _readingOncologyTaskInfoRepository.AddRangeAsync(readingOncologies);
|
||||
|
||||
var relatedVisitTaskIdList=new List<Guid>();
|
||||
var relatedVisitTaskIdList = new List<Guid>();
|
||||
relatedVisitTaskIdList.Add(inDto.RelatedTaskId);
|
||||
|
||||
var relatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList);
|
||||
@@ -352,7 +348,7 @@ namespace IRaCIS.Application.Services
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.OncologyTaskId, u => new VisitTask()
|
||||
{
|
||||
RelatedVisitTaskIds = relatedVisitTaskIds
|
||||
}) ;
|
||||
});
|
||||
|
||||
var result = await _readingOncologyTaskInfoRepository.SaveChangesAsync();
|
||||
|
||||
@@ -377,7 +373,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var readModuleInfo = await _readModuleRepository.Where(x => x.Id == oncologModuleId && x.ModuleType == ModuleTypeEnum.Oncology).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 如果当前是肿瘤学
|
||||
@@ -386,21 +382,21 @@ namespace IRaCIS.Application.Services
|
||||
// 先找到对应的全局阅片模块Id
|
||||
var isGlobalReading = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == readModuleInfo.TrialReadingCriterionId).Select(x => x.IsGlobalReading).FirstOrDefaultAsync();
|
||||
|
||||
var globalOrVisitTaskId = default(Guid);
|
||||
var globalOrVisitTaskId = default(Guid);
|
||||
var globalreadModule = await _readModuleRepository.Where(x => x.SubjectVisitId == readModuleInfo.SubjectVisitId &&
|
||||
x.TrialReadingCriterionId== readModuleInfo.TrialReadingCriterionId&&
|
||||
x.ModuleType == ModuleTypeEnum.Global).Include(x=>x.SubjectVisit).FirstOrDefaultAsync();
|
||||
// 获取系统配置
|
||||
var readingType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == readModuleInfo.TrialReadingCriterionId).Select(x => x.ReadingType).FirstOrDefaultAsync();
|
||||
if (globalreadModule != null&& isGlobalReading)
|
||||
x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId &&
|
||||
x.ModuleType == ModuleTypeEnum.Global).Include(x => x.SubjectVisit).FirstOrDefaultAsync();
|
||||
// 获取系统配置
|
||||
var readingType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == readModuleInfo.TrialReadingCriterionId).Select(x => x.ReadingType).FirstOrDefaultAsync();
|
||||
if (globalreadModule != null && isGlobalReading)
|
||||
{
|
||||
// 找到一个全局阅片任务是否有裁判任务
|
||||
|
||||
globalOrVisitTaskId = await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModule.Id && x.TaskState == TaskState.Effect
|
||||
&& x.ReadingCategory == ReadingCategory.Global
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
&& x.ReadingCategory == ReadingCategory.Global
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
var judgeVisitTaskId = await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModule.Id && x.TaskState == TaskState.Effect
|
||||
var judgeVisitTaskId = await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModule.Id && x.TaskState == TaskState.Effect
|
||||
&& x.ReadingCategory == ReadingCategory.Global
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.JudgeVisitTaskId).FirstOrDefaultAsync();
|
||||
|
||||
@@ -414,7 +410,7 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 判断阅片是否完成
|
||||
if (judgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModule.Id && x.TaskState == TaskState.Effect && x.ReadingCategory == ReadingCategory.Global
|
||||
@@ -430,42 +426,43 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
var visitTask = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == readModuleInfo.SubjectVisitId && x.TaskState == TaskState.Effect
|
||||
&& x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId
|
||||
&& x.ReadingCategory==ReadingCategory.Visit
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned).FirstNotNullAsync();
|
||||
&& x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned).FirstNotNullAsync();
|
||||
|
||||
globalOrVisitTaskId = visitTask.Id;
|
||||
|
||||
var judgeVisitTaskId = visitTask.JudgeVisitTaskId;
|
||||
|
||||
// 要判断是否为老裁判任务的Id
|
||||
if (judgeVisitTaskId != null)
|
||||
{
|
||||
// 如果不存在有效的裁判
|
||||
if (!(await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId && x.TaskState == TaskState.Effect)))
|
||||
{
|
||||
judgeVisitTaskId = null;
|
||||
}
|
||||
}
|
||||
// 要判断是否为老裁判任务的Id
|
||||
if (judgeVisitTaskId != null)
|
||||
{
|
||||
// 如果不存在有效的裁判
|
||||
if (!(await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId && x.TaskState == TaskState.Effect)))
|
||||
{
|
||||
judgeVisitTaskId = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断阅片是否完成
|
||||
if (judgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == readModuleInfo.SubjectVisitId && x.TaskState == TaskState.Effect
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate && x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId
|
||||
).CountAsync() == (int)readingType))
|
||||
{
|
||||
// 判断阅片是否完成
|
||||
if (judgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == readModuleInfo.SubjectVisitId && x.TaskState == TaskState.Effect
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate && x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId
|
||||
).CountAsync() == (int)readingType))
|
||||
{
|
||||
|
||||
finishReading = true;
|
||||
}
|
||||
else if (judgeVisitTaskId != null && (await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId.Value && x.JudgeResultTaskId != null && x.ReadingTaskState == ReadingTaskState.HaveSigned)))
|
||||
{
|
||||
finishReading = true;
|
||||
}
|
||||
finishReading = true;
|
||||
}
|
||||
else if (judgeVisitTaskId != null && (await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId.Value && x.JudgeResultTaskId != null && x.ReadingTaskState == ReadingTaskState.HaveSigned)))
|
||||
{
|
||||
finishReading = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (finishReading)
|
||||
{
|
||||
@@ -475,7 +472,7 @@ namespace IRaCIS.Application.Services
|
||||
SubjectId = readModuleInfo.SubjectId,
|
||||
ReadingId = readModuleInfo.Id,
|
||||
TrialId = readModuleInfo.TrialId,
|
||||
TrialReadingCriterionId= readModuleInfo.TrialReadingCriterionId,
|
||||
TrialReadingCriterionId = readModuleInfo.TrialReadingCriterionId,
|
||||
|
||||
});
|
||||
|
||||
@@ -495,7 +492,7 @@ namespace IRaCIS.Application.Services
|
||||
ReadingCategory = ReadingCategory.Oncology,
|
||||
});
|
||||
|
||||
var originalVisit = await _visitTaskRepository.Where(x =>x.Id==globalOrVisitTaskId
|
||||
var originalVisit = await _visitTaskRepository.Where(x => x.Id == globalOrVisitTaskId
|
||||
).OrderByDescending(x => x.VisitTaskNum).ThenBy(x => x.ArmEnum).FirstNotNullAsync();
|
||||
|
||||
var originalVisitId = default(Guid);
|
||||
@@ -509,12 +506,12 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
originalVisitId = originalVisit.Id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
|
||||
{
|
||||
OriginalVisitId= originalVisitId,
|
||||
OriginalVisitId = originalVisitId,
|
||||
ReadingCategory = GenerateTaskCategory.Oncology,
|
||||
TrialId = readModuleInfo.TrialId,
|
||||
ReadingGenerataTaskList = needReadList
|
||||
|
||||
+11
-10
@@ -1,11 +1,11 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
@@ -63,7 +63,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var organIds = tableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
var organList = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
var result=await GetReadingTableQuestion(new GetReadingTableQuestionOrAnswerInDto()
|
||||
var result = await GetReadingTableQuestion(new GetReadingTableQuestionOrAnswerInDto()
|
||||
{
|
||||
|
||||
TrialReadingCriterionId = inDto.ReadingQuestionCriterionTrialId,
|
||||
@@ -114,7 +114,7 @@ namespace IRaCIS.Application.Services
|
||||
LesionType = data.LesionType,
|
||||
QuestionGenre = data.QuestionGenre,
|
||||
DictionaryCode = data.DictionaryCode,
|
||||
GroupId=data.GroupId,
|
||||
GroupId = data.GroupId,
|
||||
ShowOrder = data.ShowOrder,
|
||||
RelevanceId = data.RelevanceId,
|
||||
IsShowInDicom = data.IsShowInDicom,
|
||||
@@ -232,15 +232,16 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var questionIds = qusetionList.Select(x => x.Id).ToList();
|
||||
var tableQuestionList = await _readingTableQuestionSystemRepository.Where(x => questionIds.Contains(x.ReadingQuestionId))
|
||||
.ProjectTo<TableQuestionDataInfo>(_mapper.ConfigurationProvider,new {
|
||||
isEn_Us=_userInfo.IsEn_Us,
|
||||
.ProjectTo<TableQuestionDataInfo>(_mapper.ConfigurationProvider, new
|
||||
{
|
||||
isEn_Us = _userInfo.IsEn_Us,
|
||||
}).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
var groupList = new List<GetSystemReadingQuestionOutDto>();
|
||||
|
||||
//qusetionList = qusetionList.Where(x => x.ParentId == null).ToList();
|
||||
|
||||
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group ).ToList();
|
||||
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
||||
groupList.ForEach(x =>
|
||||
{
|
||||
this.FindSystemChildQuestion(x, qusetionList, tableQuestionList);
|
||||
@@ -270,7 +271,7 @@ namespace IRaCIS.Application.Services
|
||||
Childrens = new List<GetSystemReadingQuestionOutDto>(),
|
||||
ShowOrder = x.ShowOrder,
|
||||
GroupName = string.Empty,
|
||||
|
||||
|
||||
Id = x.Id,
|
||||
Type = x.Type,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
|
||||
Reference in New Issue
Block a user