diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index f00c10d6d..47c6eaa12 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -5526,6 +5526,21 @@ 是否是第一次转化的任务 + + + 融合的PTSeriesId + + + + + 融合的CTSeriesId + + + + + StudyId + + 当新答案为空的时候 是否是有原数据 diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs index 8ce0fb61a..3832948ec 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs @@ -230,7 +230,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid) .WhereIf(inQuery.IsGetBeRead,x=>!x.IsInvalid&&x.AuditState!= MedicalReviewAuditState.HaveSigned) .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .OrderBy(x => x.AuditState).ThenBy(x=>x.VisitTask.SubjectId).ThenBy(x=>x.VisitTask.ArmEnum).ThenBy(x=>x.VisitTask.VisitTaskNum) + .OrderBy(x => x.AuditState!= MedicalReviewAuditState.WaitAudit&& x.AuditState != MedicalReviewAuditState.Auditing).ThenBy(x=>x.VisitTask.SubjectId).ThenBy(x=>x.VisitTask.ArmEnum).ThenBy(x=>x.VisitTask.VisitTaskNum) .ProjectTo(_mapper.ConfigurationProvider); diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index f73cd2887..99da29c06 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -34,7 +34,9 @@ namespace IRaCIS.Core.Application.Contracts public class GetNextQCInfoInDto { public Guid TrialId { get; set; } - } + + public Guid? VisitId { get; set; } + } public class QCVisitSearchDTO : PageInput { @@ -50,7 +52,9 @@ namespace IRaCIS.Core.Application.Contracts public bool? IsUrgent { get; set; } public Guid TrialId { get; set; } public Guid? SiteId { get; set; } - public Guid? SubjectId { get; set; } + + public Guid? VisitId { get; set; } + public Guid? SubjectId { get; set; } public string SubjectInfo { get; set; } = String.Empty; diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index 60d2bfdc1..b85b2b380 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -248,26 +248,26 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost] - public async Task GetNextQCInfo(GetNextQCInfoInDto inDto) - { - var result= await GetQCVisitList(new QCVisitSearchDTO() - { + public async Task GetNextQCInfo(GetNextQCInfoInDto inDto) + { + var result = await GetQCVisitList(new QCVisitSearchDTO() + { + TrialId = inDto.TrialId, + CurrentActionUserId = _userInfo.Id, + VisitId = inDto.VisitId, + PageIndex = 1, + PageSize = 1, + }); - TrialId = inDto.TrialId, - CurrentActionUserId=_userInfo.Id, - PageIndex=1, - PageSize=1, - }); + return result.Item1.CurrentPageData.Count > 0 ? result.Item1.CurrentPageData[0] : null; + } - return result.Item1.CurrentPageData.Count > 0 ? result.Item1.CurrentPageData[0] : null; - } - - /// - /// QC 访视列表 - /// - /// - /// - [HttpPost] + /// + /// QC 访视列表 + /// + /// + /// + [HttpPost] public async Task<(PageOutput, TrialSubjectAndSVConfig)> GetQCVisitList(QCVisitSearchDTO visitSearchDTO) { @@ -431,7 +431,8 @@ namespace IRaCIS.Core.Application.Image.QA var svExpression = QCCommon.GetSubjectVisitFilter(visitSearchDTO.VisitPlanArray); var query = _subjectVisitRepository.Where(x => x.TrialId == visitSearchDTO.TrialId) - .WhereIf(visitSearchDTO.CurrentActionUserId != null, t => t.CurrentActionUserId == visitSearchDTO.CurrentActionUserId) + .WhereIf(visitSearchDTO.VisitId != null, t => t.Id == visitSearchDTO.VisitId) + .WhereIf(visitSearchDTO.CurrentActionUserId != null, t => t.CurrentActionUserId == visitSearchDTO.CurrentActionUserId) .WhereIf(visitSearchDTO.ChallengeState != null, t => t.ChallengeState == visitSearchDTO.ChallengeState) .WhereIf(visitSearchDTO.SiteId != null, t => t.SiteId == visitSearchDTO.SiteId) .WhereIf(visitSearchDTO.SubjectId != null, t => t.Subject.Id == visitSearchDTO.SubjectId) diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index f50e8e922..44442d108 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -928,9 +928,15 @@ namespace IRaCIS.Core.Application.Image.QA return new GetNextIQCQualityOutDto() { }; break; case TrialQCProcess.SingleAudit: - visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId!= _userInfo.Id&&(x.CurrentActionUserId == _userInfo.Id || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))).Include(x => x.Subject).ToListAsync(); + visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted + && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId!= _userInfo.Id&&(x.CurrentActionUserId == _userInfo.Id || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) + .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y=>!y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id) + .Include(x => x.Subject).ToListAsync(); - subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId).OrderBy(x=>x.VisitNum).FirstOrDefault(); + subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId) + + + .OrderBy(x=>x.VisitNum).FirstOrDefault(); if(subjectVisit!=null) { return new GetNextIQCQualityOutDto() { @@ -957,7 +963,9 @@ namespace IRaCIS.Core.Application.Image.QA visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId && ((x.CurrentActionUserId == _userInfo.Id)||(!x.IsTake&& x.AuditState != AuditStateEnum.QCPassed&& (x.PreliminaryAuditUserId != _userInfo.Id))) - ).Include(x => x.Subject).ToListAsync(); + ) + .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId !=_userInfo.Id) + .Include(x => x.Subject).ToListAsync(); if (subjectVisit != null) { return new GetNextIQCQualityOutDto() diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index e55631197..a8b548954 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1442,7 +1442,22 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// 是否是第一次转化的任务 /// public bool IsFirstChangeTask { get; set; } = false; - } + + /// + /// 融合的PTSeriesId + /// + public Guid? PTSeriesId { get; set; } + + /// + /// 融合的CTSeriesId + /// + public Guid? CTSeriesId { get; set; } + + /// + /// StudyId + /// + public Guid? OtherStudyId { get; set; } + } public class GetVisitReadingQuestionOutDto { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 2427928c1..4aba2d23d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -202,13 +202,13 @@ namespace IRaCIS.Application.Services .OrderBy(x => x.VisitTask.VisitTaskNum).Select(x => new GetPreviousOtherPicturePathOutDto() { VisitTaskId = x.VisitTaskId, - PicturePath = x.PicturePath, + PicturePath = x.OtherPicturePath, TaskBlindName = x.VisitTask.TaskBlindName }).ToListAsync(); } - - return result.Where(x=>x.PicturePath!=string.Empty).ToList(); + + return result.Where(x => x.PicturePath != string.Empty && x.PicturePath != null).ToList(); } /// @@ -612,7 +612,22 @@ namespace IRaCIS.Application.Services result = result.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToList(); } - foreach (var item in result) + + var visitaskIds = result.Select(x => x.VisitTaskId).ToList(); + + var otherStudys = await _readingTableAnswerRowInfoRepository.Where(x => visitaskIds.Contains(x.VisitTaskId)) + .Where(x=>x.CTSeriesId!=null&&x.PTSeriesId!=null) + .Select(x => new + { + x.OtherStudyId, + x.CTSeriesId, + x.PTSeriesId, + x.VisitTaskId, + x.UpdateTime + }).ToListAsync(); + + + foreach (var item in result) { var clinicalDataList = await _readingClinicalDataService.GetClinicalDataList(new GetReadingOrTaskClinicalDataListInDto() { @@ -623,7 +638,15 @@ namespace IRaCIS.Application.Services }); item.IsExistsClinicalData = clinicalDataList.Count > 0; - } + var otherStudy = otherStudys.Where(x => x.VisitTaskId == item.VisitTaskId).OrderByDescending(x => x.UpdateTime).FirstOrDefault(); + if (otherStudy != null) + { + item.PTSeriesId = otherStudy.PTSeriesId; + item.CTSeriesId = otherStudy.CTSeriesId; + item.OtherStudyId = otherStudy.OtherStudyId; + } + + } @@ -1646,7 +1669,8 @@ namespace IRaCIS.Application.Services var query = _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == rowinfo.VisitTaskId && x.QuestionId == rowinfo.QuestionId && x.Id != rowinfo.Id) .Where(x => x.SplitOrMergeType != SplitOrMergeType.Split && x.SplitOrMergeType != SplitOrMergeType.SplitMain - &&x.SplitOrMergeType!=SplitOrMergeType.Merge && x.SplitOrMergeType != SplitOrMergeType.MergeMain && x.SplitOrMergeType != SplitOrMergeType.MergeMained && x.SplitOrMergeType != SplitOrMergeType.Merged); + &&x.SplitOrMergeType!=SplitOrMergeType.Merge && x.SplitOrMergeType != SplitOrMergeType.MergeMain + && x.SplitOrMergeType != SplitOrMergeType.Merged); switch (taskInfo.TrialReadingCriterion.CriterionType) { @@ -1798,8 +1822,30 @@ namespace IRaCIS.Application.Services }).ToListAsync(); var markquestionId = inDto.QuestionMarkInfoList.Select(y => y.QuestionId).ToList(); - await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId&& markquestionId.Contains(x.QuestionId)); - var datetime = DateTime.Now; + + var needDeleteMarkQuestonIds = inDto.Answers.Where(x => x.Answer == string.Empty).Select(x => x.Id).ToList(); + + + await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x => + (x.QuestionType == QuestionType.SplenicTopPosition || x.QuestionType == QuestionType.SplenicBottomPosition) && + x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark() + { + PicturePath = string.Empty, + MeasureData = string.Empty, + }) ; + + await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x => + (x.QuestionType == QuestionType.LiverSUVmax || x.QuestionType == QuestionType.MediastinumSUVmax) && + x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark() + { + OtherPicturePath = string.Empty, + OtherMeasureData=string.Empty, + }); + + + await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && markquestionId.Contains(x.QuestionId)); + + var datetime = DateTime.Now; var markList = _mapper.Map, List>(inDto.QuestionMarkInfoList); markList.ForEach(x => { @@ -1851,21 +1897,21 @@ namespace IRaCIS.Application.Services var index = await _readingCalculateService.GetDeleteLesionStatrIndex(inDto); - await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.RowId == inDto.RowId, x => new ReadingTableQuestionAnswer() + await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.RowId == inDto.RowId, x => new ReadingTableQuestionAnswer() { IsDeleted = true }); if (!(await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.SplitRowId == deleteRowInfo.SplitRowId && x.Id != deleteRowInfo.Id))) { - await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => x.Id == deleteRowInfo.SplitRowId, x => new ReadingTableAnswerRowInfo() + await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.Id == deleteRowInfo.SplitRowId, x => new ReadingTableAnswerRowInfo() { SplitOrMergeType = null, }); } - await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.RowId, x => new ReadingTableAnswerRowInfo() + await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.RowId, x => new ReadingTableAnswerRowInfo() { IsDeleted = true diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 4777364ae..7a178bd51 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -1039,7 +1039,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate x.RowIndex >= (int)Math.Floor(inDto.RowNumber) && x.RowIndex < ((int)Math.Floor(inDto.RowNumber) + 1) && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis && x.QuestionId== targetQuestion.Id - ).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0(); + ).Select(x => x.Answer).ToListAsync()).Select(x => x.IsNullOrEmptyReturn0()).Sum(); // 短径 var shortAxis = (await _readingTableQuestionAnswerRepository.Where(x => @@ -1047,7 +1047,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate x.RowIndex >= (int)Math.Floor(inDto.RowNumber) && x.RowIndex < ((int)Math.Floor(inDto.RowNumber) + 1) && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis && x.QuestionId == targetQuestion.Id - ).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0(); + ).Select(x => x.Answer).ToListAsync()).Select(x => x.IsNullOrEmptyReturn0()).Sum(); // 找到ppd问题 var ppdQuestion = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == targetQuestion.Id && x.QuestionMark == QuestionMark.PPD).FirstOrDefaultAsync(); @@ -1107,7 +1107,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate // 符合疾病进展 if (accord) { - await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => + await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == (int)Math.Floor(inDto.RowNumber) && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && @@ -1119,7 +1119,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } else if (state == TargetState.DiseaseProgression.GetEnumInt()) { - await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => + await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == (int)Math.Floor(inDto.RowNumber) && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && @@ -1374,15 +1374,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var addList = _mapper.Map>(tableRowAnswers).OrderBy(x => x.RowIndex).ToList(); - await _readingTaskQuestionMarkRepository.AddRangeAsync(questionMarkList); - await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); - await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); - addList.ForEach(x => + foreach (var item in addList) { - x.MergeRow = null; - x.SplitRow = null; + await _readingTableAnswerRowInfoRepository.AddAsync(item); + await _readingTableQuestionAnswerRepository.SaveChangesAsync(); + } + await _readingTaskQuestionMarkRepository.AddRangeAsync(questionMarkList); + //await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); + await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); + //addList.ForEach(x => + //{ + // x.MergeRow = null; + // x.SplitRow = null; - }); + //}); await _readingTableQuestionAnswerRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Domain.Share/QC/AuditStateEnum.cs b/IRaCIS.Core.Domain.Share/QC/AuditStateEnum.cs index 3e32a2761..35f4dc763 100644 --- a/IRaCIS.Core.Domain.Share/QC/AuditStateEnum.cs +++ b/IRaCIS.Core.Domain.Share/QC/AuditStateEnum.cs @@ -14,6 +14,9 @@ namespace IRaCIS.Core.Domain.Share //1st QC进行了操作 InPrimaryQC = 4, + /// + /// 单审通过 + /// PrimaryQCPassed = 5, //2nd QC进行操作 diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 42f5cdb4a..b4bf54ad2 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -2278,6 +2278,15 @@ public enum SUVChangeVSBaseline /// PSScoreRemarks = 59, + /// + /// 脾尖位置 + /// + SplenicTopPosition = 60, + + /// + /// 脾底位置 + /// + SplenicBottomPosition = 61, } diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs index 556b96ccf..54ba087db 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs @@ -61,10 +61,10 @@ namespace IRaCIS.Core.Domain.Models - /// - /// 审核通过时间 - /// - public DateTime? AuditSignTime { get; set; } + /// + /// 审核通过时间 + /// + public DateTime? AuditSignTime { get; set; } /// /// 阅片人是否认同 diff --git a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs index e5e6edaca..1073f3b12 100644 --- a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs +++ b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs @@ -84,7 +84,9 @@ namespace IRaCIS.Core.Domain.Models public Guid? ForwardUserId { get; set; } public DateTime? ForwardTime { get; set; } - // 质控领取人 + /// + /// 当前质控领取人 + /// public Guid? CurrentActionUserId { get; set; } public DateTime? CurrentActionUserExpireTime { get; set; }