diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 78789fad..be513d29 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -1,4 +1,5 @@ using AutoMapper; +using DocumentFormat.OpenXml.Drawing; using EasyCaching.Core; using ExcelDataReader; using IRaCIS.Application.Contracts; @@ -12,6 +13,7 @@ using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.MediatR.CommandAndQueries; using IRaCIS.Core.Application.MediatR.Handlers; using IRaCIS.Core.Application.Service; +using IRaCIS.Core.Application.Service.ImageAndDoc; using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; @@ -43,6 +45,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using Path = System.IO.Path; namespace IRaCIS.Core.API.Controllers { @@ -223,29 +226,60 @@ namespace IRaCIS.Core.API.Controllers _repository = repository; } - - /// Dicom 归档 - [HttpPost, Route("Study/ArchiveStudy")] - [DisableFormValueModelBinding] - [DisableRequestSizeLimit] + [HttpPost, Route("Study/PreArchiveStudy")] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task ArchiveStudyNew(/*[FromForm] ArchiveStudyCommand archiveStudyCommand,*/ Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId, - [FromServices] ILogger _logger, - [FromServices] IEasyCachingProvider _provider, + public async Task PreArchiveStudy(PreArchiveStudyCommand preArchiveStudyCommand, [FromServices] IStudyService _studyService, - [FromServices] IHubContext _uploadHub, - [FromServices] IDicomArchiveService _dicomArchiveService, - [FromServices] IRepository _repository - ) + [FromServices] IRepository _studyMonitorRepository) { - if (_provider.Get>(StaticData.Anonymize.Anonymize_AddFixedFiled).Value == null) { await _mediator.Send(new AnonymizeCacheRequest()); } - //_logger.LogError("请求到达接口"); + var savedInfo = _studyService.GetSaveToDicomInfo(preArchiveStudyCommand.SubjectVisitId); + + var studyMonitor = new StudyMonitor() + { + TrialId = savedInfo.TrialId, + SiteId = savedInfo.SiteId, + SubjectId = savedInfo.SubjectId, + SubjectVisitId = savedInfo.SubjectVisitId, + + IsSuccess = false, + UploadStartTime = DateTime.Now, + IsDicom = preArchiveStudyCommand.IsDicom, + IP = _userInfo.IP + }; + + + var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true); + + return ResponseOutput.Ok(addEntity.Id); + + } + + + /// Dicom 归档 + [HttpPost, Route("Study/ArchiveStudy")] + [DisableFormValueModelBinding] + [DisableRequestSizeLimit] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + public async Task ArchiveStudyNew(/*[FromForm] ArchiveStudyCommand archiveStudyCommand,*/ Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId,Guid studyMonitorId, + [FromServices] ILogger _logger, + [FromServices] IEasyCachingProvider _provider, + [FromServices] IStudyService _studyService, + [FromServices] IHubContext _uploadHub, + [FromServices] IDicomArchiveService _dicomArchiveService, + [FromServices] IRepository _studyMonitorRepository + ) + { + + + + + if (!HttpContext.Request.HasFormContentType || !MediaTypeHeaderValue.TryParse(HttpContext.Request.ContentType, out var mediaTypeHeader) || @@ -256,7 +290,6 @@ namespace IRaCIS.Core.API.Controllers var archiveStudyCommand = new ArchiveStudyCommand() { AbandonStudyId = abandonStudyId, StudyInstanceUid = studyInstanceUid, SubjectVisitId = subjectVisitId }; - string studycode = string.Empty; var startTime = DateTime.Now; @@ -270,6 +303,13 @@ namespace IRaCIS.Core.API.Controllers _provider.Set($"StudyUid_{trialId}_{archiveStudyCommand.StudyInstanceUid}", _userInfo.Id, TimeSpan.FromMinutes(30)); } + //到了接口,代表上传结束了 + + var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId); + + studyMonitor.UploadFinishedTime = DateTime.Now; + + var (archiveResult, archivedStudyIds) = (new DicomArchiveResult(), new List()); @@ -332,23 +372,12 @@ namespace IRaCIS.Core.API.Controllers throw new BusinessValidationFailedException("请求异常,请重试!"); } + studyMonitor.FileSize = (decimal)HttpContext.Request.ContentLength; + studyMonitor.FileCount = archiveResult.ReceivedFileCount; + studyMonitor.FailedFileCount = archiveResult.ErrorFiles.Count; + studyMonitor.IsDicomReUpload = archiveStudyCommand.AbandonStudyId != null; + studyMonitor.Note = JsonConvert.SerializeObject(archiveResult); - var studyMonitor = new StudyMonitor() - { - TrialId = savedInfo.TrialId, - SiteId = savedInfo.SiteId, - SubjectId = savedInfo.SubjectId, - SubjectVisitId = savedInfo.SubjectVisitId, - - - - UploadStartTime = startTime, - FileSize = (decimal)HttpContext.Request.ContentLength, - FileCount = archiveResult.ReceivedFileCount, - IsDicom = true, - IsDicomReUpload = archiveStudyCommand.AbandonStudyId != null, - IP = _userInfo.IP - }; try { @@ -365,21 +394,12 @@ namespace IRaCIS.Core.API.Controllers studyMonitor.IsSuccess = true; } - else - { - studyMonitor.IsSuccess = false; - studyMonitor.Note = JsonConvert.SerializeObject(archiveResult); - } - - - + } catch (Exception e) { - studyMonitor.IsSuccess = false; studyMonitor.Note = JsonConvert.SerializeObject(new { Message = e.Message, Result = archiveResult }); - _logger.LogError(e.Message + e.StackTrace); } @@ -389,9 +409,9 @@ namespace IRaCIS.Core.API.Controllers studyMonitor.StudyId = archiveResult.ArchivedDicomStudies.FirstOrDefault()?.Id ?? Guid.Empty; studyMonitor.StudyCode = archiveResult.ArchivedDicomStudies.FirstOrDefault()?.StudyCode; - studyMonitor.UploadFinishedTime = DateTime.Now; - await _repository.AddAsync(studyMonitor, true); + studyMonitor.ArchiveFinishedTime = DateTime.Now; + await _studyMonitorRepository.SaveChangesAsync(); } @@ -617,20 +637,25 @@ namespace IRaCIS.Core.API.Controllers /// /// /// + /// + /// /// //[DisableRequestSizeLimit] [RequestSizeLimit(1_073_741_824)] - [HttpPost("NoneDicomStudy/UploadNoneDicomFile/{trialId:guid}/{subjectVisitId:guid}/{noneDicomStudyId:guid}")] + [HttpPost("NoneDicomStudy/UploadNoneDicomFile/{trialId:guid}/{subjectVisitId:guid}/{noneDicomStudyId:guid}/{studyMonitorId:guid}")] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC)] - public async Task UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId, [FromServices] IRepository _noneDicomStudyRepository) + public async Task UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId, Guid studyMonitorId, + [FromServices] IRepository _noneDicomStudyRepository, [FromServices] IRepository _studyMonitorRepository) { - var startTime = DateTime.Now; await QCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId); var sv = (await _repository.Where(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException(); + var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId); + + studyMonitor.UploadFinishedTime = DateTime.Now; await FileUploadAsync(async (fileName) => { @@ -642,6 +667,7 @@ namespace IRaCIS.Core.API.Controllers return serverFilePath; }); + var uploadFinishedTime = DateTime.Now; //// 上传非Dicom 后 将状态改为待提交 分为普通上传 和QC后重传 普通上传时才改为待提交 @@ -651,22 +677,14 @@ namespace IRaCIS.Core.API.Controllers noneDicomStudy.FileCount = noneDicomStudy.FileCount + formCollection.Files.Count; - await _repository.AddAsync(new StudyMonitor() - { - FileCount = formCollection.Files.Count, - FileSize = formCollection.Files.Sum(t => t.Length), - IsDicom = false, - IsDicomReUpload = false, - StudyId = noneDicomStudyId, - StudyCode = noneDicomStudy.StudyCode, - UploadStartTime = startTime, - UploadFinishedTime = DateTime.Now, - IP = _userInfo.IP, - TrialId = sv.TrialId, - SiteId = sv.SiteId, - SubjectId = sv.SubjectId, - SubjectVisitId = subjectVisitId, - }); + studyMonitor.FileCount = formCollection.Files.Count; + studyMonitor.FileSize = formCollection.Files.Sum(t => t.Length); + studyMonitor.IsDicom = false; + studyMonitor.IsDicomReUpload = false; + studyMonitor.StudyId = noneDicomStudyId; + studyMonitor.StudyCode = noneDicomStudy.StudyCode; + studyMonitor.ArchiveFinishedTime = DateTime.Now; + studyMonitor.IP = _userInfo.IP; await _repository.SaveChangesAsync(); diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 2731afbf..439dccf4 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -230,7 +230,7 @@ 流式上传 Dicom上传 - + Dicom 归档 @@ -280,13 +280,15 @@ - + 上传非Dicom 文件 支持压缩包 多文件上传 + + diff --git a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs index 6df8e9b3..84a8f7dc 100644 --- a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs @@ -31,7 +31,7 @@ public static class ExcelExportHelper //一个值 对应不同的字典翻译 var needTranslatePropertyList = translateType.GetProperties().Where(t => t.IsDefined(typeof(DictionaryTranslateAttribute), true)) .SelectMany(c => - c.GetCustomAttributes(typeof(DictionaryTranslateAttribute), false).Select(f => (DictionaryTranslateAttribute?)f).Where(t => t.CriterionType == criterionType || t.CriterionType == null) + c.GetCustomAttributes(typeof(DictionaryTranslateAttribute), false).Select(f => (DictionaryTranslateAttribute?)f).Where(t => t?.CriterionType == criterionType || t?.CriterionType == null) .Select(k => new { c.Name, k.DicParentCode ,k.IsTranslateDenpendOtherProperty, k.DependPropertyName,k.DependPropertyValueStr}) ).ToList(); diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 6044df4f..ad48de76 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -458,6 +458,9 @@ 质疑列表 + + + @@ -465,6 +468,9 @@ 受试者信息导出表 + + + @@ -492,6 +498,9 @@ 阅片期信息表 + + + @@ -499,6 +508,9 @@ 一致性核查 检查信息表 + + + @@ -506,6 +518,10 @@ 一致性核查记录表 + + + + @@ -513,6 +529,9 @@ PM阅片跟踪 + + + @@ -520,6 +539,9 @@ PM 重阅追踪 + + + @@ -527,6 +549,9 @@ PM 医学审核(挑选任务生成后的列表) + + + @@ -534,12 +559,19 @@ 自身一致性分析(仅做了resist1.1) + + + 组件一致性分析(仅做了resist1.1) + + + + @@ -555,6 +587,9 @@ 整体肿瘤评估 (目前仅仅 RECIST1.1 多个标准一个接口 Excel 列是一样的 ) + + + @@ -573,6 +608,9 @@ 评估病灶明细表 (目前仅仅 RECIST1.1 RECIST1.1 PGW3 表都是不同的) + + + diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 9050c4ea..94470861 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -86,6 +86,9 @@ namespace IRaCIS.Core.Application.Service.Common /// 质疑列表 /// /// + /// + /// + /// /// [HttpPost] [AllowAnonymous] @@ -128,6 +131,9 @@ namespace IRaCIS.Core.Application.Service.Common /// 受试者信息导出表 /// /// + /// + /// + /// /// [HttpPost] public async Task GetSubjectList_Export(SubjectQueryParam param, @@ -379,7 +385,8 @@ namespace IRaCIS.Core.Application.Service.Common UploadFinishedTime = t.UploadFinishedTime, - TotalMillisecondsInterval = t.TotalMillisecondsInterval, + ArchiveFinishedTime=t.ArchiveFinishedTime, + UploadTime = t.CreateTime, @@ -409,6 +416,9 @@ namespace IRaCIS.Core.Application.Service.Common /// 阅片期信息表 /// /// + /// + /// + /// /// [HttpPost] public async Task GetReadingPeriodList_Export(ReadPeriodQuery param, @@ -435,6 +445,9 @@ namespace IRaCIS.Core.Application.Service.Common /// 一致性核查 检查信息表 /// /// + /// + /// + /// /// [HttpPost] @@ -519,6 +532,10 @@ namespace IRaCIS.Core.Application.Service.Common /// 一致性核查记录表 /// /// + /// + /// + /// + /// /// [HttpPost] public async Task GetConsistencyVerificationList_Export(CheckQuery checkQuery, @@ -555,6 +572,9 @@ namespace IRaCIS.Core.Application.Service.Common /// PM阅片跟踪 /// /// + /// + /// + /// /// [HttpPost] public async Task GetReadingTaskList_Export(VisitTaskQuery queryVisitTask, @@ -602,6 +622,9 @@ namespace IRaCIS.Core.Application.Service.Common /// PM 重阅追踪 /// /// + /// + /// + /// /// [HttpPost] public async Task GetReReadingTaskList_Export(VisitTaskQuery queryVisitTask, @@ -648,6 +671,9 @@ namespace IRaCIS.Core.Application.Service.Common /// PM 医学审核(挑选任务生成后的列表) /// /// + /// + /// + /// /// [HttpPost] public async Task GetMedicalReviewTaskList_Export(TaskMedicalReviewQuery inQuery, @@ -686,6 +712,9 @@ namespace IRaCIS.Core.Application.Service.Common /// 自身一致性分析(仅做了resist1.1) /// /// + /// + /// + /// /// [HttpPost] public async Task GetSelfAnalysisTaskList_Export(VisitTaskQuery queryVisitTask, @@ -763,6 +792,10 @@ namespace IRaCIS.Core.Application.Service.Common /// /// 组件一致性分析(仅做了resist1.1) /// + /// + /// + /// + /// /// /// [HttpPost] @@ -923,6 +956,9 @@ namespace IRaCIS.Core.Application.Service.Common /// 整体肿瘤评估 (目前仅仅 RECIST1.1 多个标准一个接口 Excel 列是一样的 ) /// /// + /// + /// + /// /// [HttpPost] public async Task GetOverallTumorEvaluationList_Export(VisitTaskQuery queryVisitTask, @@ -935,7 +971,7 @@ namespace IRaCIS.Core.Application.Service.Common //每次查询必须是单标准的 - var criterion = await _repository.Where(t => t.Id == queryVisitTask.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName }).FirstOrDefaultAsync(); + var criterion = await _repository.Where(t => t.Id == queryVisitTask.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName }).FirstNotNullAsync(); if (criterion.CriterionType != CriterionType.RECIST1Pointt1 && criterion.CriterionType != CriterionType.PCWG3) { @@ -1040,6 +1076,9 @@ namespace IRaCIS.Core.Application.Service.Common /// 评估病灶明细表 (目前仅仅 RECIST1.1 RECIST1.1 PGW3 表都是不同的) /// /// + /// + /// + /// /// [HttpPost] public async Task GetDetailedOfEvaluatedLesion_Export(VisitTaskQuery queryVisitTask, diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index abff1e36..73ae4175 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -181,7 +181,7 @@ namespace IRaCIS.Core.Application.Service var isNeedSend = true; //手动发送的时候,也有可能答案是是 此时是 这里不发送,发送已经生成的文件 - if (pdAnswer == "是" && isHandSend==null) + if (pdAnswer == "是" && isHandSend == null) { isNeedSend = true; @@ -196,9 +196,16 @@ namespace IRaCIS.Core.Application.Service //生成任务 foreach (var taskId in taskIdList) { - await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() { TrialId = trialId, VisitTaskId = taskId, MedicalManagerUserId = minUserIdList.FirstOrDefault(), AllocateTime = DateTime.Now - ,IsAutoGenerate=true,PDRelationTaskIdListStr=string.Join('|', taskIdList) - },true); + await _taskMedicalReviewRepository.AddAsync(new TaskMedicalReview() + { + TrialId = trialId, + VisitTaskId = taskId, + MedicalManagerUserId = minUserIdList.FirstOrDefault(), + AllocateTime = DateTime.Now + , + IsAutoGenerate = true, + PDRelationTaskIdListStr = string.Join('|', taskIdList.Distinct()) + }, true); } } @@ -470,7 +477,7 @@ namespace IRaCIS.Core.Application.Service if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion)) { - answer = "是"; + answer = "是"; } @@ -478,13 +485,13 @@ namespace IRaCIS.Core.Application.Service //入组确认一直交给第一个人,如果第一个人重阅 还未做完,第二个人先做完了,此时不发 - var existFirstEnrollTask= await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.IsAnalysisCreate == false - && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId).OrderBy(t=>t.SignTime).FirstOrDefaultAsync(); + var existFirstEnrollTask = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.IsAnalysisCreate == false + && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId).OrderBy(t => t.SignTime).FirstOrDefaultAsync(); //入组确认的医生已确定 - if( (existFirstEnrollTask != null) &&(taskInfo.DoctorUserId != existFirstEnrollTask.DoctorUserId) ) - { - isNeedSend = false; + if ((existFirstEnrollTask != null) && (taskInfo.DoctorUserId != existFirstEnrollTask.DoctorUserId)) + { + isNeedSend = false; } else { @@ -506,7 +513,7 @@ namespace IRaCIS.Core.Application.Service } - + } @@ -520,48 +527,9 @@ namespace IRaCIS.Core.Application.Service { - //单重 - if (taskInfo.ReadingType == ReadingMethod.Single) - { - //仲裁在访视上 或者在阅片期 - if (taskInfo.ArbitrationRule != ArbitrationRule.None) - { - - throw new BusinessValidationFailedException("单重有序阅片配置有误(不应该有仲裁对象配置),请核查!"); - } - - - //要求PD 确认的访视 是截止访视 还是非截止访视(根据该访视有没有配置阅片期来判断) - - if (taskInfo.ReadingCategory == ReadingCategory.Visit) - { - //存在阅片期 那么就是截止访视 - if (await _repository.Where(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.SubjectVisitId == taskInfo.SourceSubjectVisitId && t.ReadingSetType == ReadingSetType.ImageReading).AnyAsync()) - { - isNeedSend = false; - } - else//非截止访视 在访视读完后,发送 - { - answer = await TranslatePdStateAsync(visitTaskId, ReadingCategory.Visit, taskInfo.CriterionType); - } - } - //截止访视 在访视读完,并完成全局阅片后发送全局的结果 - else if (taskInfo.ReadingCategory == ReadingCategory.Global) - { - answer = await TranslatePdStateAsync(visitTaskId, ReadingCategory.Global, taskInfo.CriterionType); - } - else - { - throw new BusinessValidationFailedException("单重有序阅片 该类型的任务不应进入此处逻辑,请联系后台开发核查!"); - } - - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); - - - } //双重 - else if (taskInfo.ReadingType == ReadingMethod.Double) + if (taskInfo.ReadingType == ReadingMethod.Double) { @@ -590,7 +558,7 @@ namespace IRaCIS.Core.Application.Service var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value; answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType); - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Where(t=>t.ReadingCategory==ReadingCategory.Judge).Select(t => t.Id).ToList(), minUserIdList); + isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Select(t => t.Id).ToList(), minUserIdList); } else @@ -657,100 +625,128 @@ namespace IRaCIS.Core.Application.Service { throw new BusinessValidationFailedException("双重有序阅片 没有定义该仲裁规则处理逻辑,请联系业务和后台开发核查!"); - - ////只发第一个人 - //if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && - //t.Id != visitTaskId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId)) - //{ - // isNeedSend = false; - //} - //else - //{ - - // answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - //} } } + + //屏蔽单重阅片添加 else { - throw new BusinessValidationFailedException("有序阅片配置有误(应为单重或者双重阅片),请核查!"); + isNeedSend = false; + return string.Empty; } + #region 发邮件屏蔽单重的 + ////单重 + //else if (taskInfo.ReadingType == ReadingMethod.Single) + //{ + // //仲裁在访视上 或者在阅片期 + // if (taskInfo.ArbitrationRule != ArbitrationRule.None) + // { + + // throw new BusinessValidationFailedException("单重有序阅片配置有误(不应该有仲裁对象配置),请核查!"); + // } + + + // //要求PD 确认的访视 是截止访视 还是非截止访视(根据该访视有没有配置阅片期来判断) + + // if (taskInfo.ReadingCategory == ReadingCategory.Visit) + // { + // //存在阅片期 那么就是截止访视 + // if (await _repository.Where(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.SubjectVisitId == taskInfo.SourceSubjectVisitId && t.ReadingSetType == ReadingSetType.ImageReading).AnyAsync()) + // { + // isNeedSend = false; + // } + // else//非截止访视 在访视读完后,发送 + // { + // answer = await TranslatePdStateAsync(visitTaskId, ReadingCategory.Visit, taskInfo.CriterionType); + // } + // } + // //截止访视 在访视读完,并完成全局阅片后发送全局的结果 + // else if (taskInfo.ReadingCategory == ReadingCategory.Global) + // { + // answer = await TranslatePdStateAsync(visitTaskId, ReadingCategory.Global, taskInfo.CriterionType); + // } + // else + // { + // throw new BusinessValidationFailedException("单重有序阅片 该类型的任务不应进入此处逻辑,请联系后台开发核查!"); + // } + + // isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); + + + //} + //else + //{ + // throw new BusinessValidationFailedException("有序阅片配置有误(应为单重或者双重阅片),请核查!"); + //} + + #endregion + + + } - //无序 + //屏蔽无序阅片添加 else { - //单重 - - - if (taskInfo.ReadingType == ReadingMethod.Single && taskInfo.ArbitrationRule == ArbitrationRule.None) - { - answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); - } - //双重 截止访视只在阅片期的时候存在 要求PD确认的访视 肯定是非截止访视 - else if (taskInfo.ReadingType == ReadingMethod.Double && taskInfo.ArbitrationRule == ArbitrationRule.Visit) - { - //在两位阅片人读完访视后,如果有裁判者等裁判读完,如果无裁判则等第二个人的读完 - - var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect - && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync(); - - //这里要求 到这里已经如果有裁判 已经生成裁判了保存数据库 - if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) == 2) - { - - answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); - } - else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1) - { - var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value; - answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType); - - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Select(t => t.Id).ToList(), minUserIdList); - - - } - else - { - isNeedSend = false; - } - - } - else - { - throw new BusinessValidationFailedException("无序阅片配置有误(应为单重无仲裁对象,双重针对访视仲裁),请核查!"); - - - ////只发第一个人 - //if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && - //t.Id != visitTaskId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId)) - //{ - // isNeedSend = false; - //} - //else - //{ - - // answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); - //} - - } - + isNeedSend = false; + return string.Empty; } + #region 发送邮件屏蔽无序的 + // //无序 + //else + //{ + // //单重 + // if (taskInfo.ReadingType == ReadingMethod.Single && taskInfo.ArbitrationRule == ArbitrationRule.None) + // { + // answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); + + // isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); + // } + // //双重 截止访视只在阅片期的时候存在 要求PD确认的访视 肯定是非截止访视 + // else if (taskInfo.ReadingType == ReadingMethod.Double && taskInfo.ArbitrationRule == ArbitrationRule.Visit) + // { + // //在两位阅片人读完访视后,如果有裁判者等裁判读完,如果无裁判则等第二个人的读完 + + // var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect + // && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync(); + + // //这里要求 到这里已经如果有裁判 已经生成裁判了保存数据库 + // if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) == 2) + // { + + // answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType); + + // isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList); + // } + // else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1) + // { + // var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value; + // answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType); + + // isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Select(t => t.Id).ToList(), minUserIdList); + // } + // else + // { + // isNeedSend = false; + // } + // } + // else + // { + // throw new BusinessValidationFailedException("无序阅片配置有误(应为单重无仲裁对象,双重针对访视仲裁),请核查!"); + // } + //} + #endregion } else { @@ -824,7 +820,7 @@ namespace IRaCIS.Core.Application.Service sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig() { - FileName =$"{taskInfo.SubjectCode}_{emailConfig.FileName}" , + FileName = $"{taskInfo.SubjectCode}_{emailConfig.FileName}", FileStream = memoryStream }); @@ -887,12 +883,12 @@ namespace IRaCIS.Core.Application.Service //找到最早签名的 var firstSignTask = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id /*&& t.TaskState == TaskState.Effect*/ && t.IsAnalysisCreate == false - && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).OrderBy(t=>t.SignTime).FirstOrDefaultAsync(); + && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).OrderBy(t => t.SignTime).FirstOrDefaultAsync(); if (firstSignTask != null) { - var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id && t.TaskState == TaskState.Effect && t.DoctorUserId== firstSignTask.DoctorUserId && t.IsAnalysisCreate == false + var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id && t.TaskState == TaskState.Effect && t.DoctorUserId == firstSignTask.DoctorUserId && t.IsAnalysisCreate == false && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).OrderBy(t => t.SignTime).FirstOrDefaultAsync(); //如果存在做完的该任务 @@ -914,10 +910,10 @@ namespace IRaCIS.Core.Application.Service { return ResponseOutput.NotOk("当前未有阅片人读完基线任务!"); } - - + + } } @@ -946,7 +942,7 @@ namespace IRaCIS.Core.Application.Service { TrialReadingCriterionId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder, t.CriterionType, t.ArbitrationRule }).FirstNotNullAsync(); // 项目双重 - if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Double) + if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Double && trialReadingCriterionConfig.IsReadingTaskViewInOrder) { //仲裁在访视上面 if (trialReadingCriterionConfig.ArbitrationRule == ArbitrationRule.Visit) @@ -1037,58 +1033,62 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.NotOk("未定义该仲裁规则发送业务逻辑!"); } } - // 项目单重 判断最新的Pd 访视是否完成 是否有阅片期即可 - else if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Single) - { + + #region 发送邮件屏蔽单重阅片情况 + //// 项目单重 判断最新的Pd 访视是否完成 是否有阅片期即可 + //else if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Single) + //{ - var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == currentLatestPdVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false - && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync(); + // var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == currentLatestPdVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false + // && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync(); - if (task == null) - { - return ResponseOutput.NotOk("当前受试者最新PD访视任务未阅片完成"); - } - else - { - //存在阅片期 那么就是截止访视 + // if (task == null) + // { + // return ResponseOutput.NotOk("当前受试者最新PD访视任务未阅片完成"); + // } + // else + // { + // //存在阅片期 那么就是截止访视 - var existReadModule = await _repository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectVisitId == currentLatestPdVisitId && t.ReadingSetType == ReadingSetType.ImageReading) - .FirstOrDefaultAsync(); - if (existReadModule != null) - { + // var existReadModule = await _repository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectVisitId == currentLatestPdVisitId && t.ReadingSetType == ReadingSetType.ImageReading) + // .FirstOrDefaultAsync(); + // if (existReadModule != null) + // { - var global = await _visitTaskRepository.Where(t => t.SouceReadModuleId == currentLatestPdVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false - && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync(); + // var global = await _visitTaskRepository.Where(t => t.SouceReadModuleId == currentLatestPdVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false + // && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync(); - if (global != null) - { - var filePath = await BaseBusinessScenarioSendEmailAsync(global.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); + // if (global != null) + // { + // var filePath = await BaseBusinessScenarioSendEmailAsync(global.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - } - else - { - return ResponseOutput.NotOk("当前受试者阅片期任务未阅片完成"); - } + // return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); + // } + // else + // { + // return ResponseOutput.NotOk("当前受试者阅片期任务未阅片完成"); + // } - } - else//非截止访视 在访视读完后,发送 - { - var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); + // } + // else//非截止访视 在访视读完后,发送 + // { + // var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - } - } + // return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); + // } + // } - } + //} + #endregion + else { - return ResponseOutput.NotOk("当前项目配置,未定义单双重外发送业务逻辑!"); + return ResponseOutput.NotOk("当前项目配置,不满足双重有序阅片,不满足发送条件!"); } } @@ -1127,7 +1127,7 @@ namespace IRaCIS.Core.Application.Service /// 是否是全局产生(区分裁判任务) /// /// - private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType, bool? IsGlobalGenerate=null) + private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType, bool? IsGlobalGenerate = null) { var answer = string.Empty; diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 73b21e96..476951f0 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -54,10 +54,31 @@ namespace IRaCIS.Core.Application.Contracts public string UploadStartTimeStr => UploadStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); - public string UploadFinishedTimeStr => UploadFinishedTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); + public string UploadFinishedTimeStr => UploadFinishedTime?.ToString("yyyy-MM-dd HH:mm:ss.fff"); + + public string ArchiveFinishedTimeStr => ArchiveFinishedTime?.ToString("yyyy-MM-dd HH:mm:ss.fff"); - public double TotalMillisecondsInterval { get; set; } + public string UploadIntervalStr + { + get + { + var uploadTimeSpan = UploadFinishedTime - UploadStartTime; + + return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}"; + } + } + + public string ArchiveIntervalStr + { + get + { + var uploadTimeSpan = ArchiveFinishedTime - UploadFinishedTime; + + return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}"; + } + } + public string TimeInterval @@ -65,9 +86,11 @@ namespace IRaCIS.Core.Application.Contracts get { - var uploadTimeSpan = UploadFinishedTime - UploadStartTime; + var uploadTimeSpan = ArchiveFinishedTime - UploadStartTime; - return $" {uploadTimeSpan.Hours}:{uploadTimeSpan.Minutes}:{uploadTimeSpan.Seconds}.{uploadTimeSpan.Milliseconds}"; + return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}"; + + #region 废弃 //if (uploadTimeSpan.Seconds == 0 && uploadTimeSpan.Minutes==0 && uploadTimeSpan.Hours == 0) //{ // return $"{uploadTimeSpan.Milliseconds}毫秒"; @@ -84,13 +107,17 @@ namespace IRaCIS.Core.Application.Contracts //{ // return $" {uploadTimeSpan.Hours} 小时 {uploadTimeSpan.Minutes} 分钟 {uploadTimeSpan.Seconds} 秒 {uploadTimeSpan.Milliseconds}毫秒"; //} + #endregion + } } public DateTime UploadStartTime { get; set; } - public DateTime UploadFinishedTime { get; set; } + public DateTime? UploadFinishedTime { get; set; } + + public DateTime? ArchiveFinishedTime { get; set; } public decimal FileSize { get; set; } @@ -103,7 +130,7 @@ namespace IRaCIS.Core.Application.Contracts public int FileCount { get; set; } - public bool IsSuccess = true; + public bool IsSuccess { get; set; } public string Note = string.Empty; diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs index 559964f1..f852be36 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs @@ -50,6 +50,9 @@ namespace IRaCIS.Core.Application.Services return success; } + + + public async Task<(Guid StudyId, string StudyCode)> ArchiveDicomStreamAsync(Stream dicomStream, DicomTrialSiteSubjectInfo addtionalInfo, List seriesInstanceUidList, List instanceUidList) { diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index d1c7fdbf..647d5a2c 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -188,8 +188,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc FileSize = t.FileSize, UploadFinishedTime = t.UploadFinishedTime, UploadStartTime = t.UploadStartTime, + ArchiveFinishedTime=t.ArchiveFinishedTime, + + - TotalMillisecondsInterval = t.TotalMillisecondsInterval, IsDicomReUpload = t.IsDicomReUpload, StudyId = t.Id, diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 6a914a8f..cea16a57 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -473,10 +473,29 @@ namespace IRaCIS.Core.Application.Contracts public string IsDicomStr => IsDicom ? "DICOM" : "Non-DICOM"; public string UploadStartTimeStr => UploadStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); - public string UploadFinishedTimeStr => UploadFinishedTime.ToString("yyyy-MM-dd HH:mm:ss.fff"); + public string UploadFinishedTimeStr => UploadFinishedTime?.ToString("yyyy-MM-dd HH:mm:ss.fff"); + public string ArchiveFinishedTimeStr => ArchiveFinishedTime?.ToString("yyyy-MM-dd HH:mm:ss.fff"); - public double TotalMillisecondsInterval { get; set; } + public string UploadIntervalStr + { + get + { + var uploadTimeSpan = UploadFinishedTime - UploadStartTime; + + return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}"; + } + } + + public string ArchiveIntervalStr + { + get + { + var uploadTimeSpan = ArchiveFinishedTime - UploadFinishedTime; + + return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}"; + } + } public string TimeInterval @@ -484,16 +503,16 @@ namespace IRaCIS.Core.Application.Contracts get { - var uploadTimeSpan = UploadFinishedTime - UploadStartTime; + var uploadTimeSpan = ArchiveFinishedTime - UploadStartTime; - return $" {uploadTimeSpan.Hours}:{uploadTimeSpan.Minutes}:{uploadTimeSpan.Seconds}.{uploadTimeSpan.Milliseconds}"; + return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}"; } } public DateTime UploadStartTime { get; set; } - - public DateTime UploadFinishedTime { get; set; } + public DateTime? ArchiveFinishedTime { get; set; } + public DateTime? UploadFinishedTime { get; set; } public decimal FileSize { get; set; } @@ -509,7 +528,7 @@ namespace IRaCIS.Core.Application.Contracts public int FileCount { get; set; } [DictionaryTranslateAttribute("YesOrNo")] - public bool IsSuccess { get; set; } = true; + public bool IsSuccess { get; set; } public string Note = string.Empty; diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 3ee7141b..40b07755 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -1589,7 +1589,7 @@ namespace IRaCIS.Core.Application.Image.QA } - await _qcChallengeRepository.BatchUpdateNoTrackingAsync(t => t.IsClosed == false, u => new QCChallenge() { IsClosed = true, CloseResonEnum = QCChallengeCloseEnum.Unresolvable }); + await _qcChallengeRepository.UpdatePartialFromQueryAsync(t => t.IsClosed == false&& t.SubjectVisitId==dbSubjectVisit.Id, u => new QCChallenge() { IsClosed = true, ClosedTime=DateTime.Now, CloseResonEnum = QCChallengeCloseEnum.Unresolvable }); } diff --git a/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs b/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs index 7ba3e36d..084ed14f 100644 --- a/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs +++ b/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs @@ -219,10 +219,19 @@ namespace IRaCIS.Core.Application.Contracts public List SeriesList { get; set; } = new List(); } + public class PreArchiveStudyCommand + { + public Guid SubjectVisitId { get; set; } + + public bool IsDicom { get; set; } + + + } + public class ArchiveStudyCommand { - - + //[NotDefault] + //public Guid StudyMonitorId { get; set; } public Guid? AbandonStudyId { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs index 5e02d6a2..4ee122c2 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReview.cs @@ -200,7 +200,7 @@ namespace IRaCIS.Core.Domain.Models public bool IsAutoGenerate { get; set; } // | 分割 - public string PDRelationTaskIdListStr { get; set; } + public string PDRelationTaskIdListStr { get; set; }=string.Empty; [NotMapped] public List PDRelationTaskIdList=> PDRelationTaskIdListStr.Split('|',StringSplitOptions.RemoveEmptyEntries).Select(t=> Guid.Parse(t) ).ToList(); diff --git a/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs b/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs index 2996b8e7..9d6a6579 100644 --- a/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs +++ b/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs @@ -31,13 +31,18 @@ namespace IRaCIS.Core.Domain.Models - public int TotalMillisecondsInterval { get; set; } + //public int TotalMillisecondsInterval { get; set; } public DateTime UploadStartTime { get; set; } - public DateTime UploadFinishedTime { get; set; } + public DateTime? UploadFinishedTime { get; set; } + + + public DateTime? ArchiveFinishedTime { get; set; } + + public int FailedFileCount { get; set; } public decimal FileSize { get; set; } @@ -83,7 +88,7 @@ namespace IRaCIS.Core.Domain.Models public User Uploader { get; set; } - public bool IsSuccess = true; + public bool IsSuccess { get; set; } public string Note = string.Empty; diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 65049292..a1c877d0 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -10,7 +10,6 @@ using Microsoft.EntityFrameworkCore.ChangeTracking; using System.Reflection; using EntityFramework.Exceptions.SqlServer; using IRaCIS.Core.Domain.Share; -using IRaCIS.Core.Infra.EFCore.ValueGenerator; using MassTransit; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; diff --git a/IRaCIS.Core.Infra.EFCore/Context/ValueGenerator/UploadTotalMillisecondsIntervalGenerator.cs b/IRaCIS.Core.Infra.EFCore/Context/ValueGenerator/UploadTotalMillisecondsIntervalGenerator.cs index 18f4519d..a5096482 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/ValueGenerator/UploadTotalMillisecondsIntervalGenerator.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/ValueGenerator/UploadTotalMillisecondsIntervalGenerator.cs @@ -1,34 +1,34 @@ -using System; -using IRaCIS.Core.Domain.Models; -using Microsoft.EntityFrameworkCore.ChangeTracking; -using Microsoft.EntityFrameworkCore.ValueGeneration; +//using System; +//using IRaCIS.Core.Domain.Models; +//using Microsoft.EntityFrameworkCore.ChangeTracking; +//using Microsoft.EntityFrameworkCore.ValueGeneration; -namespace IRaCIS.Core.Infra.EFCore.ValueGenerator -{ - /// - /// 上传监控 时间间隔存储 需要按照这个字段进行排序 - /// - public class UploadTotalMillisecondsInterval : ValueGenerator - { +//namespace IRaCIS.Core.Infra.EFCore.ValueGenerator +//{ +// /// +// /// 上传监控 时间间隔存储 需要按照这个字段进行排序 +// /// +// public class UploadTotalMillisecondsInterval : ValueGenerator +// { - //code first must migration dbfirst must config in db and also need config in code - //modelBuilder.Entity().Property(e => e.TotalMillisecondsInterval).HasComputedColumnSql("datediff(MS,UploadStartTime,UploadFinishedTime)"); +// //code first must migration dbfirst must config in db and also need config in code +// //modelBuilder.Entity().Property(e => e.TotalMillisecondsInterval).HasComputedColumnSql("datediff(MS,UploadStartTime,UploadFinishedTime)"); - //modelBuilder.Entity().Property(e => e.TestInterval).ValueGeneratedOnAddOrUpdate().HasDefaultValueSql("datediff(MS,UploadStartTime,UploadFinishedTime)"); +// //modelBuilder.Entity().Property(e => e.TestInterval).ValueGeneratedOnAddOrUpdate().HasDefaultValueSql("datediff(MS,UploadStartTime,UploadFinishedTime)"); - public override int Next(EntityEntry entry) - { - if (entry.Entity is StudyMonitor entity) - { - return (entity.UploadFinishedTime - entity.UploadStartTime).Milliseconds; - } - else - { - throw new ArgumentException("ValueGenerator用在了不适合的实体"); +// public override int Next(EntityEntry entry) +// { +// if (entry.Entity is StudyMonitor entity) +// { +// return (entity.UploadFinishedTime - entity.UploadStartTime)?.Milliseconds; +// } +// else +// { +// throw new ArgumentException("ValueGenerator用在了不适合的实体"); - } - } - public override bool GeneratesTemporaryValues => false; - } +// } +// } +// public override bool GeneratesTemporaryValues => false; +// } -} \ No newline at end of file +//} \ No newline at end of file diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/StudyMonitorConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/StudyMonitorConfigration.cs index 142e4a78..b60f29ac 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/StudyMonitorConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/StudyMonitorConfigration.cs @@ -1,5 +1,5 @@ using IRaCIS.Core.Domain.Models; -using IRaCIS.Core.Infra.EFCore.ValueGenerator; +//using IRaCIS.Core.Infra.EFCore.ValueGenerator; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; @@ -18,7 +18,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration //.HasForeignKey(s => new { s.TrialId, s.SiteId }) //.HasPrincipalKey(c => new { c.TrialId, c.SiteId }); - builder.Property(e => e.TotalMillisecondsInterval).HasValueGenerator().ValueGeneratedOnAdd(); + //builder.Property(e => e.TotalMillisecondsInterval).HasValueGenerator().ValueGeneratedOnAdd(); builder