|
|
|
|
@ -11,6 +11,7 @@ using IRaCIS.Core.Domain.Models;
|
|
|
|
|
using IRaCIS.Core.Domain.Share;
|
|
|
|
|
using IRaCIS.Core.Infra.EFCore.Common;
|
|
|
|
|
using IRaCIS.Core.Infrastructure;
|
|
|
|
|
using IRaCIS.Core.Infrastructure.Extention;
|
|
|
|
|
using MassTransit;
|
|
|
|
|
using MassTransit.Initializers;
|
|
|
|
|
using MathNet.Numerics;
|
|
|
|
|
@ -159,7 +160,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
if (inQuery.IsImageSegmentLabel == true)
|
|
|
|
|
{
|
|
|
|
|
var querySV = _subjectVisitRepository.WhereIf(inQuery.SubjectVisitId != null, t => t.Id == inQuery.SubjectVisitId)
|
|
|
|
|
var querySV = _subjectVisitRepository.Where(t => t.CheckState == CheckStateEnum.CVPassed)
|
|
|
|
|
.WhereIf(inQuery.SubjectVisitId != null, t => t.Id == inQuery.SubjectVisitId)
|
|
|
|
|
.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId)
|
|
|
|
|
.Select(u => new SubjectVisitMarkUploadDto()
|
|
|
|
|
{
|
|
|
|
|
@ -230,7 +232,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null
|
|
|
|
|
var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed
|
|
|
|
|
&& t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect)
|
|
|
|
|
//满足 有序,或者随机只看到当前任务的dicom 非dicom检查
|
|
|
|
|
.WhereIf(criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId)
|
|
|
|
|
@ -934,14 +936,19 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
//靶段标注上传,查看访视级别,上传绑定访视级别
|
|
|
|
|
if (inQuery.IsImageSegmentLabel == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var noneDicomSVList = await _noneDicomStudyReposiotry.Where(t => t.SubjectId == inQuery.SubjectId && t.Modality == "IVUS")
|
|
|
|
|
.Select(t => t.SubjectVisitId).Distinct().ToListAsync();
|
|
|
|
|
//存在ivus 和oct 这两种的项目
|
|
|
|
|
if (_readingQuestionCriterionTrialRepository.Where(t => t.TrialId == info.TrialId &&
|
|
|
|
|
(t.CriterionType == CriterionType.IVUS || t.CriterionType == CriterionType.OCT)).Distinct().Count() == 2
|
|
|
|
|
&& !_noneDicomStudyReposiotry.Any(t => t.SubjectId == inQuery.SubjectId && t.Modality == "IVUS"))
|
|
|
|
|
&& noneDicomSVList.Count() !=
|
|
|
|
|
_dicomStudyRepository.Where(t => t.SubjectId == inQuery.SubjectId).Select(t => t.SubjectVisitId).Distinct().Count())
|
|
|
|
|
{
|
|
|
|
|
#region ivus 自动创建非dicom检查
|
|
|
|
|
|
|
|
|
|
var addList = await _dicomStudyRepository.Where(t => t.SubjectId == inQuery.SubjectId)
|
|
|
|
|
.Where(t => !noneDicomSVList.Contains(t.SubjectVisitId))
|
|
|
|
|
.Select(t => new NoneDicomStudyAddOrEdit()
|
|
|
|
|
{
|
|
|
|
|
TrialId = t.TrialId,
|
|
|
|
|
@ -989,7 +996,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list = _noneDicomStudyReposiotry.Where(t => t.SubjectId == subjectId)
|
|
|
|
|
var list = _noneDicomStudyReposiotry.Where(t => t.SubjectId == subjectId && t.SubjectVisit.CheckState == CheckStateEnum.CVPassed)
|
|
|
|
|
.WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectVisitId == inQuery.SubjectVisitId)
|
|
|
|
|
//.WhereIf(info.IsImageFilter, t => ("|" + info.CriterionModalitys + "|").Contains("|" + t.Modality + "|"))
|
|
|
|
|
.Select(u => new TaskNoneDicomStudyDTO()
|
|
|
|
|
@ -1047,7 +1054,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var query = from u in _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId
|
|
|
|
|
&& t.SourceSubjectVisitId != null && t.DoctorUserId == doctorUserId && t.TaskState == TaskState.Effect)
|
|
|
|
|
&& t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.DoctorUserId == doctorUserId && t.TaskState == TaskState.Effect)
|
|
|
|
|
//满足 有序,或者随机只看到当前任务的dicom 非dicom检查
|
|
|
|
|
.WhereIf(info.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId)
|
|
|
|
|
join ns in _noneDicomStudyReposiotry.Where(t => t.SubjectId == subjectId).WhereIf(info.IsImageFilter, t => ("|" + info.CriterionModalitys + "|").Contains("|" + t.Modality + "|"))
|
|
|
|
|
@ -1137,6 +1144,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
var dirDic = new Dictionary<string, string>();
|
|
|
|
|
#region DIR处理导出文件名,并将对应关系上传到OSS里面存储
|
|
|
|
|
|
|
|
|
|
var info = await _subjectVisitRepository.Where(t => t.Id == inQuery.SubjectVisitId).Select(t => new { t.Trial.TrialCode }).FirstOrDefaultAsync();
|
|
|
|
|
|
|
|
|
|
//有传输语法值的导出 才生成DIR
|
|
|
|
|
if (_subjectVisitRepository.Where(t => t.Id == inQuery.SubjectVisitId).SelectMany(t => t.StudyList.SelectMany(t => t.InstanceList)).All(c => c.TransferSytaxUID != string.Empty))
|
|
|
|
|
{
|
|
|
|
|
@ -1148,7 +1157,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
DicomStudyId = t.DicomStudy.Id,
|
|
|
|
|
|
|
|
|
|
PatientId = t.DicomStudy.PatientId,
|
|
|
|
|
PatientId = info.TrialCode + "-" + t.DicomStudy.PatientId,
|
|
|
|
|
PatientName = t.DicomStudy.PatientName,
|
|
|
|
|
PatientBirthDate = t.DicomStudy.PatientBirthDate,
|
|
|
|
|
PatientSex = t.DicomStudy.PatientSex,
|
|
|
|
|
@ -1329,7 +1338,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
if (inQuery.IsImageSegmentLabel == true)
|
|
|
|
|
{
|
|
|
|
|
var list = await _subjectVisitRepository
|
|
|
|
|
var list = await _subjectVisitRepository.Where(t => t.CheckState == CheckStateEnum.CVPassed)
|
|
|
|
|
.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId)
|
|
|
|
|
.ProjectTo<SubjectVisitMarkStudyDto>(_mapper.ConfigurationProvider).ToListAsync();
|
|
|
|
|
|
|
|
|
|
@ -1404,7 +1413,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId
|
|
|
|
|
&& t.SourceSubjectVisitId != null && t.DoctorUserId == doctorUserId)
|
|
|
|
|
&& t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.DoctorUserId == doctorUserId)
|
|
|
|
|
//满足 有序,或者随机只看到当前任务的dicom 非dicom检查
|
|
|
|
|
.WhereIf(inQuery.VisitTaskId == null, t => t.TaskState == TaskState.Effect)//从待阅列表进入,要筛选出有效的,任务可能重阅了,也要看到该任务的
|
|
|
|
|
.WhereIf(criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId)
|
|
|
|
|
@ -1508,7 +1517,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
public async Task<IResponseOutput> GetIRReadingDownloadStudyInfo(IRDownloadQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
var info = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId)
|
|
|
|
|
.Select(t => new { t.IsImageFilter, t.CriterionModalitys, t.TrialId, t.IsReadingTaskViewInOrder }).FirstNotNullAsync();
|
|
|
|
|
.Select(t => new { t.IsImageFilter, t.CriterionModalitys, t.TrialId, t.IsReadingTaskViewInOrder, t.Trial.TrialCode }).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
var isQueryDicom = inQuery.DicomStudyIdList.Count > 0;
|
|
|
|
|
var isQueryNoneDicom = inQuery.NoneDicomStudyIdList.Count > 0;
|
|
|
|
|
@ -1526,7 +1535,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
#region 在下载前先处理DIR文件
|
|
|
|
|
|
|
|
|
|
//有传输语法值的导出 才生成DIR
|
|
|
|
|
if (_subjectVisitRepository.Where(t => t.SubjectId == inQuery.SubjectId).SelectMany(t => t.StudyList.SelectMany(t => t.InstanceList)).All(c => c.TransferSytaxUID != string.Empty))
|
|
|
|
|
if (_subjectVisitRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.CheckState == CheckStateEnum.CVPassed).SelectMany(t => t.StudyList.SelectMany(t => t.InstanceList)).All(c => c.TransferSytaxUID != string.Empty))
|
|
|
|
|
{
|
|
|
|
|
var dirInfolist = _subjectRepository.Where(t => t.Id == inQuery.SubjectId).SelectMany(t => t.SubjectVisitList.Where(t => subjectVisitIdList.Contains(t.Id))).SelectMany(t => t.StudyList)
|
|
|
|
|
.Where(t => isQueryDicom ? inQuery.DicomStudyIdList.Contains(t.Id) : false)
|
|
|
|
|
@ -1539,7 +1548,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
DicomStudyId = t.DicomStudy.Id,
|
|
|
|
|
|
|
|
|
|
PatientId = t.DicomStudy.PatientId,
|
|
|
|
|
PatientId = info.TrialCode + "-" + t.DicomStudy.PatientId,
|
|
|
|
|
PatientName = t.DicomStudy.PatientName,
|
|
|
|
|
PatientBirthDate = t.DicomStudy.PatientBirthDate,
|
|
|
|
|
PatientSex = t.DicomStudy.PatientSex,
|
|
|
|
|
@ -1579,7 +1588,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
DicomStudyId = t.TaskStudy.Id,
|
|
|
|
|
|
|
|
|
|
PatientId = t.TaskStudy.PatientId,
|
|
|
|
|
PatientId = info.TrialCode + "-" + t.TaskStudy.PatientId,
|
|
|
|
|
PatientName = t.TaskStudy.PatientName,
|
|
|
|
|
PatientBirthDate = t.TaskStudy.PatientBirthDate,
|
|
|
|
|
PatientSex = t.TaskStudy.PatientSex,
|
|
|
|
|
@ -1642,7 +1651,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var query = from sv in _subjectRepository.Where(t => t.Id == inQuery.SubjectId).SelectMany(t => t.SubjectVisitList.Where(t => subjectVisitIdList.Contains(t.Id)))
|
|
|
|
|
var query = from sv in _subjectRepository.Where(t => t.Id == inQuery.SubjectId).SelectMany(t => t.SubjectVisitList.Where(t => subjectVisitIdList.Contains(t.Id) && t.CheckState == CheckStateEnum.CVPassed))
|
|
|
|
|
//一致性分析,导致查询出来两条数据
|
|
|
|
|
join visitTask in _visitTaskRepository.Where(t => taskIdList.Contains(t.Id)) on sv.Id equals visitTask.SourceSubjectVisitId into cc
|
|
|
|
|
from leftVisitTask in cc.DefaultIfEmpty()
|
|
|
|
|
@ -2248,7 +2257,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 在下载前先处理DIR文件
|
|
|
|
|
|
|
|
|
|
//有传输语法值的导出 才生成DIR
|
|
|
|
|
@ -2263,7 +2271,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
|
|
|
|
|
DicomStudyId = t.DicomStudy.Id,
|
|
|
|
|
|
|
|
|
|
PatientId = t.DicomStudy.PatientId,
|
|
|
|
|
PatientId = t.Trial.TrialCode + "-" + t.DicomStudy.PatientId,
|
|
|
|
|
PatientName = t.DicomStudy.PatientName,
|
|
|
|
|
PatientBirthDate = t.DicomStudy.PatientBirthDate,
|
|
|
|
|
PatientSex = t.DicomStudy.PatientSex,
|
|
|
|
|
@ -2406,16 +2414,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|
|
|
|
SubjectCode = t.Code,
|
|
|
|
|
IsUrgent = t.IsUrgent,
|
|
|
|
|
|
|
|
|
|
VisitCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).Count(),
|
|
|
|
|
VisitCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.CheckState == CheckStateEnum.CVPassed).Count(),
|
|
|
|
|
|
|
|
|
|
MarkIVUSVisitCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).Count(t => t.NoneDicomStudyList.Where(t => t.Modality == "IVUS").SelectMany(c => c.ImageLabelNoneDicomFileList).Any()),
|
|
|
|
|
MarkIVUSVisitCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.CheckState == CheckStateEnum.CVPassed).Count(t => t.NoneDicomStudyList.Where(t => t.Modality == "IVUS").SelectMany(c => c.ImageLabelNoneDicomFileList).Any()),
|
|
|
|
|
|
|
|
|
|
MarkOCTVisitCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).Count(t => t.NoneDicomStudyList.Where(t => t.Modality == "OCT").SelectMany(c => c.ImageLabelNoneDicomFileList).Any()),
|
|
|
|
|
MarkOCTVisitCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.CheckState == CheckStateEnum.CVPassed).Count(t => t.NoneDicomStudyList.Where(t => t.Modality == "OCT").SelectMany(c => c.ImageLabelNoneDicomFileList).Any()),
|
|
|
|
|
|
|
|
|
|
DicomStudyCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).SelectMany(t => t.StudyList).Count(),
|
|
|
|
|
DicomStudyCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.CheckState == CheckStateEnum.CVPassed).SelectMany(t => t.StudyList).Count(),
|
|
|
|
|
//MarkDicomStudyCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).SelectMany(t => t.TaskStudyList).Count(),
|
|
|
|
|
|
|
|
|
|
NoneDicomStudyCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).SelectMany(t => t.NoneDicomStudyList).Count(),
|
|
|
|
|
NoneDicomStudyCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.CheckState == CheckStateEnum.CVPassed).SelectMany(t => t.NoneDicomStudyList).Count(),
|
|
|
|
|
//MarkNoneDicomStudyCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).SelectMany(t => t.NoneDicomStudyList).Where(t => t.ImageLabelNoneDicomFileList.Any()).Count(),
|
|
|
|
|
}).ToPagedListAsync(inQuery);
|
|
|
|
|
|
|
|
|
|
|