diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 461c2f746..df93ce8e4 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -11445,7 +11445,7 @@
-
+
IR影像阅片
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs
index 804a7d83e..c9835af4a 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs
@@ -409,14 +409,12 @@ namespace IRaCIS.Core.Application.Contracts
public class IRUploadStudyQuery : SortInput
{
- [NotDefault]
- public Guid SubjectId { get; set; }
+ public Guid? SubjectId { get; set; }
[NotDefault]
public Guid TrialReadingCriterionId { get; set; }
- [NotDefault]
- public string SubjectCode { get; set; }
+ public string? SubjectCode { get; set; }
public Guid? VisitTaskId { get; set; }
}
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
index 1fd4b224e..0fcf86880 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
@@ -23,7 +23,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
public interface IDownloadAndUploadService
{
Task PackageAndAnonymizImage(Guid trialId, Guid subjectVisitId, bool isDicom, bool isAnonymize = true);
+
+ Task SubejctRandomReadingTaskNameDeal(Guid subjectId, Guid trialReadingCriterionId);
}
+
[ApiExplorerSettings(GroupName = "Trial")]
public class DownloadAndUploadService(
IRepository _systemAnonymizationRepository,
@@ -77,7 +80,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint").Select(t => new { t.TaskBlindName, t.SourceSubjectVisitId, t.SouceReadModuleId }).ToListAsync();
-
//随机赋值编号 比如要处理5个任务,实例化一个包含1-5的数组,每次随机取出一个
List availableNumbers = Enumerable.Range(haveDealedTaskList.Count + haveFinishedTaskCount + 1, needDealTaskList.Count).ToList();
Random rng = new Random();
@@ -111,13 +113,44 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
[HttpPost]
public async Task>> GetSubjectImageUploadList(IRUploadStudyQuery inQuery)
{
- await SubejctRandomReadingTaskNameDeal(inQuery.SubjectId, inQuery.TrialReadingCriterionId);
//要根据标准阅片顺序,确定是否查询单个任务的,还是查询所有的
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId)
- .Select(t => new { t.IsReadingTaskViewInOrder }).FirstNotNullAsync();
+ .Select(t => new { t.IsReadingTaskViewInOrder }).FirstNotNullAsync();
- var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null
+ var subjectCode = string.Empty;
+ var subjectId = inQuery.SubjectId;
+
+ if (criterionInfo.IsReadingTaskViewInOrder == ReadingOrder.Random)
+ {
+ if (inQuery.VisitTaskId == null)
+ {
+ throw new Exception("无序阅片,前端参数传递错误");
+ }
+ //考虑到一致性分析,必须要这个编号进行过滤
+ var taskInfo = _visitTaskRepository.Where(t => t.Id == inQuery.VisitTaskId).Select(t => new {
+ SubjectCode= t.IsAnalysisCreate ? t.BlindSubjectCode : t.Subject.Code,
+ SubjectId= t.SubjectId,
+ }).FirstOrDefault();
+ subjectId = taskInfo.SubjectId;
+ subjectCode = taskInfo.SubjectCode;
+ }
+ else
+ {
+ if (inQuery.SubjectId == null || inQuery.SubjectCode == null)
+ {
+ throw new Exception("有序阅片,前端参数传递错误");
+ }
+
+ //考虑到一致性分析,必须要这个编号进行过滤
+ subjectCode = inQuery.SubjectCode;
+ }
+
+ await SubejctRandomReadingTaskNameDeal((Guid)subjectId, inQuery.TrialReadingCriterionId);
+
+
+
+ var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null
&& t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect)
//满足 有序,或者随机只看到当前任务的dicom 非dicom检查
.WhereIf(criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId)
@@ -177,8 +210,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}).ToList()
})
;
+ //var test = await query.ToListAsync();
- var list = await query.Where(t => t.SubjectCode == inQuery.SubjectCode).ToListAsync();
+ var list = await query.Where(t => t.SubjectCode == subjectCode).ToListAsync();
return ResponseOutput.Ok(list);
@@ -253,11 +287,14 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
public async Task> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand, [FromServices] IRepository _dicomStudyRepository)
{
+ var currentUploadSubjectVisitId = inCommand.VisitTaskId == null ? null : _visitTaskRepository.Where(t => t.Id == inCommand.VisitTaskId).Select(t => t.SourceSubjectVisitId).FirstOrDefault();
+
//重阅任务排除
var notAllowedUidList1 = _taskStudyRepository.Where(t => t.TrialId == inCommand.TrialId && t.VisitTask.TaskState == TaskState.Effect && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new
{
t.StudyInstanceUid,
t.SubjectId,
+ SubjectVisitId = t.VisitTask.SourceSubjectVisitId,
SubejectCode = t.VisitTask.IsAnalysisCreate ? t.VisitTask.BlindSubjectCode : t.Subject.Code,
VisitTaskId = (Guid?)t.VisitTaskId
}).ToList();
@@ -266,6 +303,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
{
t.StudyInstanceUid,
t.SubjectId,
+ SubjectVisitId = (Guid?)t.SubjectVisitId,
SubejectCode = t.Subject.Code,
VisitTaskId = (Guid?)null
}).ToList();
@@ -283,12 +321,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
//同一个subject 同一份影响
if (findStudy.SubejectCode == inCommand.SubjectCode && findStudy.SubjectId == inCommand.SubjectId)
{
+ //上传给后处理其他访视了
if (inCommand.VisitTaskId != null && findStudy.VisitTaskId != null && findStudy.VisitTaskId != inCommand.VisitTaskId)
{
result.Add(new TaskStudyArchiveConfirmResult() { StudyInstanceUid = studyUid, IsAllowReUpload = false, IsAllowUpload = false });
}
- //在原始crc 里面上传了
- else if (inCommand.VisitTaskId != null && findStudy.VisitTaskId == null)
+ //在原始crc 里面上传了,并且不是当前访视
+ else if (inCommand.VisitTaskId != null && findStudy.VisitTaskId == null && findStudy.SubjectVisitId != currentUploadSubjectVisitId)
{
result.Add(new TaskStudyArchiveConfirmResult() { StudyInstanceUid = studyUid, IsAllowReUpload = false, IsAllowUpload = false });
}
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
index fe67ccc8d..acf0fc037 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
@@ -2,6 +2,7 @@
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Interfaces;
+using IRaCIS.Core.Application.Service.ImageAndDoc;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.Service.ReadingCalculate.Interface;
using IRaCIS.Core.Application.ViewModel;
@@ -44,24 +45,21 @@ namespace IRaCIS.Core.Application.Service
IRepository _dicomInstanceRepository,
IRepository _organInfoRepository,
IRepository _trialDocumentRepository,
- IRepository _userRepository,
ILuganoCalculateService _luganoCalculateService,
IRepository _readingCustomTagRepository,
IRepository _readingTaskQuestionMarkRepository,
- IRepository _readingCriterionDictionaryRepository,
IRepository _readingTrialCriterionDictionaryRepository,
- IRepository _tumorAssessmentRepository,
IRepository _readingTableAnswerRowInfoRepository,
IRepository _readingTableQuestionSystemRepository,
IRepository _readingTableQuestionTrialRepository,
IRepository _readingTaskQuestionAnswerRepository,
IRepository _readingQuestionCriterionTrialRepository,
- IRepository _readingQuestionCriterionSystemRepository,
IRepository _readingQuestionSystem,
IRepository _noneDicomStudyFileSystem,
IGeneralCalculateService _generalCalculateService,
IRepository _readingQuestionTrialRepository,
IRepository _taskStudyRepository,
+ IDownloadAndUploadService _downloadAndUploadService,
ITrialEmailNoticeConfigService _trialEmailNoticeConfigService) : BaseService, IReadingImageTaskService
{
@@ -783,7 +781,7 @@ namespace IRaCIS.Core.Application.Service
var criterionIdInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync();
- var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId&& x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable).Select(x => x.GroupId).Distinct().ToListAsync();
+ var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable).Select(x => x.GroupId).Distinct().ToListAsync();
var questionIds = await _readingQuestionTrialRepository
.Where(x => x.IsShowInDicom)
@@ -792,10 +790,10 @@ namespace IRaCIS.Core.Application.Service
//排除表格问题 以及在表格问题分组的外层问题
var questions = await _readingQuestionTrialRepository
- .Where(x=> !questionIds.Contains(x.Id))
+ .Where(x => !questionIds.Contains(x.Id))
.WhereIf(questionClassify != null, x => x.QuestionClassify == questionClassify)
-
- .Where( x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable)
+
+ .Where(x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable)
.ProjectTo(_mapper.ConfigurationProvider, new
{
@@ -1085,7 +1083,7 @@ namespace IRaCIS.Core.Application.Service
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
var qusetionList = await _readingQuestionTrialRepository
- .Where(x=>x.IsShowInDicom)
+ .Where(x => x.IsShowInDicom)
.WhereIf(inDto.QuestionClassify != null, x => x.QuestionClassify == inDto.QuestionClassify)
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider, new
{
@@ -2606,10 +2604,10 @@ namespace IRaCIS.Core.Application.Service
public async Task VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
{
//验证后处理影像必须传
- if (_visitTaskRepository.Any(t => t.Id==inDto.VisitTaskId && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None))
+ if (_visitTaskRepository.Any(t => t.Id == inDto.VisitTaskId && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None))
{
if (!_taskStudyRepository.Any(t => t.VisitTaskId == inDto.VisitTaskId))
- {
+ {
return ResponseOutput.NotOk(_localizer["ReadingImage_BackImageNotExist"]);
}
}
@@ -2827,6 +2825,8 @@ namespace IRaCIS.Core.Application.Service
}
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
{
+ await _downloadAndUploadService.SubejctRandomReadingTaskNameDeal((Guid)inDto.SubjectId, (Guid)trialReadingCriterionId);
+
var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
{
TrialId = inDto.TrialId,
@@ -2848,17 +2848,22 @@ namespace IRaCIS.Core.Application.Service
// 排除跳过的
List remainingItems = taskList.Select(x => x.Id).Except(cacheSkipIds).ToList();
- taskList = taskList.Where(x => remainingItems.Contains(x.Id)).ToList();
+ //受试者随机固定排序
+ taskList = taskList.Where(x => remainingItems.Contains(x.Id)).OrderBy(t=>t.TaskBlindName).ToList();
+
if (taskList.Count() == 0)
{
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
}
- Random random = new Random();
- //返回的范围是 0- taskList.Count-1
- int randomIndex = random.Next(taskList.Count);
+ #region 随机废弃
+ //Random random = new Random();
+ ////返回的范围是 0- taskList.Count-1
+ //int randomIndex = random.Next(taskList.Count);
- var visitTaskId = taskList[randomIndex].Id;
+ //var visitTaskId = taskList[randomIndex].Id;
+ #endregion
+ var visitTaskId = taskList[0].Id;
task = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => new GetReadingTaskDto()
{
diff --git a/IRaCIS.Core.Domain/Common/SystemBasicData.cs b/IRaCIS.Core.Domain/Common/SystemBasicData.cs
index ae58959fb..9e9a22d63 100644
--- a/IRaCIS.Core.Domain/Common/SystemBasicData.cs
+++ b/IRaCIS.Core.Domain/Common/SystemBasicData.cs
@@ -14,6 +14,7 @@ public class SystemBasicData : BaseFullAuditEntity
#endregion
public string Name { get; set; } = string.Empty;
+ [StringLength(1000)]
public string Value { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
@@ -23,6 +24,7 @@ public class SystemBasicData : BaseFullAuditEntity
public string Code { get; set; } = string.Empty;
public Guid? ParentId { get; set; }
+ [StringLength(1000)]
public string ValueCN { get; set; } = string.Empty;
public bool IsEnable { get; set; }
diff --git a/IRaCIS.Core.Domain/QC/QCChallenge.cs b/IRaCIS.Core.Domain/QC/QCChallenge.cs
index ab538294b..ef7aee7e7 100644
--- a/IRaCIS.Core.Domain/QC/QCChallenge.cs
+++ b/IRaCIS.Core.Domain/QC/QCChallenge.cs
@@ -51,7 +51,7 @@ public class QCChallenge : BaseAddAuditEntity
public string ClosedUser { get; set; } = string.Empty;
public QCChallengeCloseEnum CloseResonEnum { get; set; }
- [StringLength(1000)]
+ [StringLength(1200)]
public string Content { get; set; } = string.Empty;
[StringLength(1000)]