From 2441a6ae3b34b836c17d750a3bce2f6e84d5f7d2 Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Wed, 4 Jan 2023 18:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=20=20=E4=B8=8D=E5=85=81=E8=AE=B8=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/InspectionController.cs | 1 + .../Service/Document/TrialDocumentService.cs | 4 +- .../Service/QC/QCOperationService.cs | 71 ++++++++++--------- .../ReadingPeriod/ReadModuleService.cs | 3 + .../ReadingPeriod/ReadingPeriodSetService.cs | 5 ++ .../TrialSiteEquipmentSurveyService.cs | 4 +- .../SiteSurvey/TrialSiteSurveyService.cs | 6 +- .../Service/Visit/SubjectService.cs | 23 +++--- .../Service/Visit/SubjectVisitService.cs | 30 ++++---- .../Service/WorkLoad/DoctorWorkloadService.cs | 4 +- 10 files changed, 87 insertions(+), 64 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 9d8bf8c6b..e9453cc74 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -406,6 +406,7 @@ namespace IRaCIS.Core.API.Controllers /// /// [HttpPost, Route("Inspection/TrialDocument/userConfirm")] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [UnitOfWork] public async Task UserConfirm(DataInspectionDto opt) { diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 1f4327746..eccb10de3 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -384,7 +384,7 @@ namespace IRaCIS.Core.Application.Services return ResponseOutput.Ok(result); } - + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM)] public async Task AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument) { @@ -454,6 +454,7 @@ namespace IRaCIS.Core.Application.Services /// [HttpDelete("{trialId:guid}/{trialDocumentId:guid}")] [Authorize(Policy = IRaCISPolicy.PM)] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task DeleteTrialDocument(Guid trialDocumentId, Guid trialId) { if (await _trialDocumentRepository.AsQueryable(true).Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any())) @@ -600,6 +601,7 @@ namespace IRaCIS.Core.Application.Services /// /// [HttpPut("{documentId:guid}/{isSystemDoc:bool}")] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task UserAbandonDoc(Guid documentId, bool isSystemDoc) { if (isSystemDoc) diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 7d1404aba..e4a1b1000 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -58,7 +58,7 @@ namespace IRaCIS.Core.Application.Image.QA #region QC质疑 以及回复 关闭 [HttpGet("{trialId:guid}/{subjectVisitId:guid}/{currentQCType:int}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task VerifyQCCanAddChallenge(Guid subjectVisitId, [FromRoute] CurrentQC currentQCType) { @@ -81,7 +81,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost("{trialId:guid}/{trialQCProcess:int}/{currentQCType:int}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task AddOrUpdateQCChallenge(QCChallengeCommand qaQuestionCommand, Guid trialId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType) { @@ -139,7 +139,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [UnitOfWork] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task CloseQCChallenge(CloseQCChallengeInDto input) @@ -192,7 +192,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpDelete("{trialId:guid}/{subjectVisitId:guid}/{qcChallengeId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task DeleteQCChallenge(Guid qcChallengeId) { @@ -219,7 +219,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost("{trialId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC_IQC)] public async Task AddQCChallengeReply(QADialogCommand qaDialogCommand) { @@ -254,7 +254,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost("{trialId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM_APM_CRC)] public async Task AddCheckChallengeReply(CheckChallengeDialogCommand checkDialogCommand) { @@ -293,7 +293,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut("{trialId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM_APM)] public async Task CloseCheckChallenge(CloseCheckChallengeDto input) { @@ -327,7 +327,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut("{trialId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM_APM)] [UnitOfWork] public async Task SetCheckPass(SetCheckPassDt data) @@ -372,7 +372,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut("{trialId:guid}/{subjectVisitId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC)] public async Task CRCRequstCheckBack(Guid subjectVisitId) { @@ -411,8 +411,11 @@ namespace IRaCIS.Core.Application.Image.QA } + + [HttpPut("{trialId:guid}/{subjectVisitId:guid}")] [Authorize(Policy = IRaCISPolicy.PM_APM)] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task RejectCheckBack(Guid subjectVisitId) { //if (_userInfo.UserTypeEnumInt != (int)UserTypeEnum.ProjectManager && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.APM) @@ -443,7 +446,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut("{trialId:guid}/{subjectVisitId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM_APM)] [UnitOfWork] public async Task CheckBack(Guid subjectVisitId) @@ -520,7 +523,7 @@ namespace IRaCIS.Core.Application.Image.QA /// 添加或者更新 QC核对问题列表 两个人不能同时操作,就算意外进去了,提交数据,也不会覆盖前一个人数据, 后台已经做好判断 /// [HttpPost("{trialId:guid}/{subjectVisitId:guid}/{trialQCProcess:int}/{currentQCType:int}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task AddOrUpdateQCQuestionAnswerList(QCQuestionAnswerCommand[] qcQuestionAnswerCommands, Guid trialId, Guid subjectVisitId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType) { @@ -592,7 +595,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut("{trialId:guid}/{subjectVisitId:guid}/{studyId:guid}/{seriesId:guid}/{state:int}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task SetSeriesState(Guid subjectVisitId, Guid studyId, Guid seriesId, int state) { @@ -659,7 +662,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost("{trialId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC_IQC)] public async Task UpdateModality(UpdateModalityCommand updateModalityCommand) { @@ -670,7 +673,7 @@ namespace IRaCIS.Core.Application.Image.QA } else { - if(await _subjectVisitRepository.AnyAsync(t=>t.Id==updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted)) + if (await _subjectVisitRepository.AnyAsync(t => t.Id == updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted)) { throw new BusinessValidationFailedException("提交之后,不允许修改!"); } @@ -736,7 +739,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// SeriesCount [HttpPost, Route("{trialId:guid}/{subjectVisitId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [UnitOfWork] [Authorize(Policy = IRaCISPolicy.CRC_IQC)] public async Task DeleteStudyList(Guid[] ids, Guid subjectVisitId, Guid trialId) @@ -785,7 +788,7 @@ namespace IRaCIS.Core.Application.Image.QA //删除 物理文件 var instancePathList = await _repository.Where(t => t.StudyId == id) - .Select(t => t.Path ).ToListAsync(); + .Select(t => t.Path).ToListAsync(); instancePathList.ForEach(path => { @@ -851,6 +854,7 @@ namespace IRaCIS.Core.Application.Image.QA /// 替换当前领取人 [HttpPut("{trialId:guid}/{subjectVisitId:guid}")] [Authorize(Policy = IRaCISPolicy.IQC)] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task ReplaceQCTaskActionUser(Guid trialId, Guid subjectVisitId) { var dbSubjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId)).IfNullThrowException(); @@ -882,7 +886,7 @@ namespace IRaCIS.Core.Application.Image.QA /// true 获取 false是取消领取 /// [HttpPut("{trialId:guid}/{subjectVisitId:guid}/{obtaionOrCancel:bool}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task ObtainOrCancelQCTask(Guid trialId, Guid subjectVisitId, bool obtaionOrCancel) { @@ -1076,11 +1080,11 @@ namespace IRaCIS.Core.Application.Image.QA } - - + + } - if(dbSubjectVisitList.Any(t=>t.IsBaseLine && !t.IsHaveClinicalData)) + if (dbSubjectVisitList.Any(t => t.IsBaseLine && !t.IsHaveClinicalData)) { return ResponseOutput.NotOk($"基线没有临床数据,确认提交?", 0, ApiResponseCodeEnum.NeedTips); } @@ -1095,7 +1099,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC)] public async Task CRCRequestToQC(CRCRequestToQCCommand cRCRequestToQCCommand) { @@ -1104,7 +1108,7 @@ namespace IRaCIS.Core.Application.Image.QA .FirstOrDefaultAsync(t => t.TrialId == cRCRequestToQCCommand.TrialId)).IfNullThrowException(); //找到符合配置的标准 确认的并且签名的、双重,有序,阅片期仲裁 - var trialReadingCriterionIdList = _repository.Where(t => t.TrialId == cRCRequestToQCCommand.TrialId && t.IsConfirm && t.ReadingInfoSignTime != null + var trialReadingCriterionIdList = _repository.Where(t => t.TrialId == cRCRequestToQCCommand.TrialId && t.IsConfirm && t.ReadingInfoSignTime != null //&& t.ReadingType == ReadingMethod.Double && t.ArbitrationRule == ArbitrationRule.Reading && t.IsReadingTaskViewInOrder && t.IsReadingPeriod).Select(t => t.Id).ToList(); @@ -1151,7 +1155,7 @@ namespace IRaCIS.Core.Application.Image.QA await _readingClinicalDataRepository.BatchUpdateNoTrackingAsync(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == dbSubjectVisit.Id, x => new ReadingClinicalData() { IsSign = true, - ReadingClinicalDataState=ReadingClinicalDataStatus.HaveSigned + ReadingClinicalDataState = ReadingClinicalDataStatus.HaveSigned }); //var signSuccess = await _repository.UpdateFromQueryAsync(t => t.Id == cRCRequestToQCCommand.SignId, u => new TrialSign() { IsCompleted = true }); @@ -1264,7 +1268,7 @@ namespace IRaCIS.Core.Application.Image.QA ReadingSetType = ReadingSetType.ImageReading, SubjectVisitId = dbSubjectVisit.Id, ModuleName = $"G-{dbSubjectVisit.VisitName}", - ModuleType = ModuleTypeEnum.Global , + ModuleType = ModuleTypeEnum.Global, IsUrgent = dbSubjectVisit.IsUrgent, TrialId = dbSubjectVisit.TrialId, SubjectId = dbSubjectVisit.SubjectId @@ -1298,7 +1302,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost("{trialId:guid}/{subjectVisitId:guid}/{auditState:int}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] [UnitOfWork] public async Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState) @@ -1310,7 +1314,7 @@ namespace IRaCIS.Core.Application.Image.QA } - if(auditState== AuditStateEnum.QCPassed) + if (auditState == AuditStateEnum.QCPassed) { //判断质疑是否都关闭了 if (await _repository.AnyAsync(t => t.SubjectVisitId == subjectVisitId && t.IsClosed == false)) @@ -1319,7 +1323,7 @@ namespace IRaCIS.Core.Application.Image.QA } } - + var trialConfig = await _trialRepository .Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification }) @@ -1392,7 +1396,7 @@ namespace IRaCIS.Core.Application.Image.QA return ResponseOutput.NotOk("项目配置影像质控为单审,当前访视影像质控任务不能从当前审核状态变更到 审核通过。"); } - + } else if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit) @@ -1526,7 +1530,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut("{trialId:guid}/{subjectVisitId:guid}/{setOrCancel:bool}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task SetVisitUrgent(Guid trialId, Guid subjectVisitId, bool setOrCancel) { @@ -1563,7 +1567,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPut("{trialId:guid}/{subjectVisitId:guid}/{qcChallengeId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.IQC)] public async Task SetNeedReupload(Guid trialId, Guid qcChallengeId) { @@ -1660,7 +1664,7 @@ namespace IRaCIS.Core.Application.Image.QA /// [HttpPost] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC)] public async Task SetReuploadFinished(CRCReuploadFinishedCommand cRCReuploadFinishedCommand) { @@ -1735,7 +1739,7 @@ namespace IRaCIS.Core.Application.Image.QA [HttpPut("{trialId:guid}/{subjectVisitId:guid}/{qcChallengeId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC)] public async Task CRCRequestReUpload(Guid qcChallengeId) { @@ -1780,7 +1784,7 @@ namespace IRaCIS.Core.Application.Image.QA /// [HttpPut("{trialId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task UpdateSubjectAndSVInfo(UploadSubjectAndVisitCommand command) { var dbSubjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == command.SubjectVisitId)).IfNullThrowException(); @@ -1818,6 +1822,7 @@ namespace IRaCIS.Core.Application.Image.QA [HttpPost("{trialId:guid}")] [Authorize(Policy = IRaCISPolicy.PM_APM)] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task ForwardSVDicomImage(Guid[] subjectVisitIdList) { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs index 7d2b4af1a..6ee40a256 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs @@ -7,6 +7,7 @@ using System.Linq.Dynamic.Core; using IRaCIS.Core.Application.Service; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Infrastructure; +using IRaCIS.Core.Application.Filter; namespace IRaCIS.Application.Services { @@ -251,6 +252,7 @@ namespace IRaCIS.Application.Services /// /// [HttpPost] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task AddReadModule(ReadModuleAddDto dto) { @@ -404,6 +406,7 @@ namespace IRaCIS.Application.Services /// /// [HttpDelete("{readModuleId:guid}")] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task DeleteReadModule(Guid readModuleId) { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs index 8127eeeef..7a84f7bf5 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs @@ -5,6 +5,7 @@ using MassTransit; using IRaCIS.Core.Application.Service; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Infrastructure; +using IRaCIS.Core.Application.Filter; namespace IRaCIS.Application.Services { @@ -65,6 +66,7 @@ namespace IRaCIS.Application.Services /// /// [HttpPost] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task AddOrUpdateReadingPeriodSet(ReadingPeriodSetAddOrEdit addOrEditReadingPeriodSet) { if (await _readingPeriodSetRepository.AnyAsync(x => x.Id != addOrEditReadingPeriodSet.Id && x.IsTakeEffect != ReadingPeriodStatus.Revocation @@ -126,6 +128,7 @@ namespace IRaCIS.Application.Services /// /// [HttpDelete("{readingPeriodSetId:guid}")] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task DeleteReadingPeriodSet(Guid readingPeriodSetId) { await _readingPeriodSetRepository.UpdatePartialFromQueryAsync(t => t.Id == readingPeriodSetId, x => new ReadingPeriodSet() @@ -149,6 +152,7 @@ namespace IRaCIS.Application.Services /// /// [HttpPut] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task SetReadingPeriodSetEffect(SetReadingPeriodSetEffect indto) { var readingPeriodSet = await _readingPeriodSetRepository.Where(x => x.Id == indto.Id).FirstNotNullAsync(); @@ -369,6 +373,7 @@ namespace IRaCIS.Application.Services /// /// /// + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task GenerateReadingTask(ReadingToGenerateInDto inDto) { List plans = new List(); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs index ead710cf2..9cb946421 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs @@ -34,7 +34,7 @@ namespace IRaCIS.Core.Application.Contracts return await trialSiteEquipmentSurveyQueryable.ToListAsync(); } - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] [HttpPost("{trialId:guid}")] public async Task AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey) { @@ -54,7 +54,7 @@ namespace IRaCIS.Core.Application.Contracts } - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] [HttpDelete("{trialSiteEquipmentSurveyId:guid}/{trialId:guid}")] public async Task DeleteTrialSiteEquipmentSurvey(Guid trialSiteEquipmentSurveyId) { diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 781891b8b..a0fd6f3e7 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -87,6 +87,7 @@ namespace IRaCIS.Core.Application.Contracts /// [HttpPost] [AllowAnonymous] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService) { @@ -643,7 +644,6 @@ namespace IRaCIS.Core.Application.Contracts /// /// /// - // [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] [HttpPost] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [UnitOfWork] @@ -763,8 +763,10 @@ namespace IRaCIS.Core.Application.Contracts await _trialSiteUserSurveyRepository.SaveChangesAsync(); } - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + + + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task SendSiteSurveyUserJoinEmail(TrialSiteUserSurveyJoinCommand joinCommand) { var trialSiteSurvey = await _trialSiteSurveyRepository.FirstAsync(t => t.Id == joinCommand.TrialSiteSurveyId); diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index 4a79816d1..ad5c5892e 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -14,10 +14,10 @@ namespace IRaCIS.Application.Services private readonly IRepository _subjectRepository; private readonly IRepository _subjectVisitRepository; - public SubjectService(IRepository subjectRepository,IRepository subjectVisitRepository) + public SubjectService(IRepository subjectRepository, IRepository subjectVisitRepository) { _subjectRepository = subjectRepository; - _subjectVisitRepository = subjectVisitRepository; + _subjectVisitRepository = subjectVisitRepository; } /// @@ -27,7 +27,7 @@ namespace IRaCIS.Application.Services /// [TrialAudit(AuditType.SubjectAudit, AuditOptType.AddOrUpdateSubject)] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM_APM_CRC_QC)] public async Task> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand) { @@ -44,23 +44,23 @@ namespace IRaCIS.Application.Services }; - + Subject? mapedSubject = null; if (subjectCommand.Id == null) //insert { - - mapedSubject= await _subjectRepository.InsertFromDTOAsync(subjectCommand, false, verifyExp1); + + mapedSubject = await _subjectRepository.InsertFromDTOAsync(subjectCommand, false, verifyExp1); } else //update { - mapedSubject = await _subjectRepository.UpdateFromDTOAsync(subjectCommand, false,false, verifyExp1/*, verifyExp2*/); - + mapedSubject = await _subjectRepository.UpdateFromDTOAsync(subjectCommand, false, false, verifyExp1/*, verifyExp2*/); + } @@ -74,15 +74,16 @@ namespace IRaCIS.Application.Services [HttpPut] [UnitOfWork] [Authorize(Policy = IRaCISPolicy.PM_APM_CRC_QC)] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task UpdateSubjectStatus(SubjectStatusChangeCommand subjectStatusChangeCommand) { - await _subjectRepository.UpdateFromDTOAsync(subjectStatusChangeCommand, true); + await _subjectRepository.UpdateFromDTOAsync(subjectStatusChangeCommand, true); return ResponseOutput.Ok(); } [HttpDelete("{trialId:guid}/{id:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [UnitOfWork] [Authorize(Policy = IRaCISPolicy.PM_APM_CRC)] public async Task DeleteSubject(Guid id) @@ -102,7 +103,7 @@ namespace IRaCIS.Application.Services IsDeleted = true, }); - var isSuccess = await _subjectRepository.SaveChangesAsync(); + var isSuccess = await _subjectRepository.SaveChangesAsync(); return ResponseOutput.Result(isSuccess); } diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 0ab81656f..d465c4388 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -54,7 +54,7 @@ namespace IRaCIS.Core.Application.Services } [HttpPost] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [UnitOfWork] [Authorize(Policy = IRaCISPolicy.CRC)] public async Task> AddOrUpdateSV(SubjectVisitCommand svCommand) @@ -159,7 +159,7 @@ namespace IRaCIS.Core.Application.Services [HttpPut("{trialId:guid}/{subjectVisitId:guid}/{isUrgent:bool}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM_IQC)] public async Task SetSubjectVisitUrgent(Guid subjectVisitId, bool isUrgent) { @@ -171,7 +171,7 @@ namespace IRaCIS.Core.Application.Services [HttpDelete, Route("{trialId:guid}/{id:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.CRC)] public async Task DeleteSV(Guid id) { @@ -284,7 +284,7 @@ namespace IRaCIS.Core.Application.Services { var result = new List(); - var thisRowinfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).OrderBy(x=>x.ReadingQuestionTrial.ShowOrder).ThenBy(x=>x.RowIndex).Select(x=>new + var thisRowinfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).OrderBy(x => x.ReadingQuestionTrial.ShowOrder).ThenBy(x => x.RowIndex).Select(x => new { x.ReadingQuestionTrial.ShowOrder, x.RowIndex, @@ -299,7 +299,7 @@ namespace IRaCIS.Core.Application.Services if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned) { - var thisStudyIds = thisRowinfo.OrderBy(x=>x.ShowOrder).ThenBy(x=>x.RowIndex).Select(x => x.StudyId).Distinct().ToList(); + var thisStudyIds = thisRowinfo.OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.StudyId).Distinct().ToList(); var thisSeriesIdIds = thisRowinfo.Where(x => x.SeriesId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.SeriesId).Distinct().ToList(); if (thisRowinfo.Count > 0) { @@ -324,16 +324,18 @@ namespace IRaCIS.Core.Application.Services if (item != null) { item.SeriesInstanceUid = string.Empty; - + item.InstanceList = thisRowinfo.Where(y => y.InstanceId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(y => y.InstanceId.Value).Distinct().ToList(); var tempInstanceList = await _repository.Where(t => item.InstanceList.Contains(t.Id)).OrderBy(t => t.InstanceNumber) - .Select(t => new TempInstance { - - Id=t.Id, - Path=t.Path, - NumberOfFrames=t.NumberOfFrames, - InstanceNumber = t.InstanceNumber }).ToListAsync(); + .Select(t => new TempInstance + { + + Id = t.Id, + Path = t.Path, + NumberOfFrames = t.NumberOfFrames, + InstanceNumber = t.InstanceNumber + }).ToListAsync(); tempInstanceList.ForEach(x => @@ -422,7 +424,7 @@ namespace IRaCIS.Core.Application.Services .SelectMany(u => { - if (u.NumberOfFrames >1) + if (u.NumberOfFrames > 1) { var pathList = new List(); @@ -517,7 +519,7 @@ namespace IRaCIS.Core.Application.Services /// /// [HttpPut("{trialId:guid}/{subjectVisitId:guid}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [Obsolete] public async Task SetSVExecuted(Guid subjectVisitId) { diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs index 10a7eeec3..cd3d1ed25 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs @@ -55,7 +55,7 @@ namespace IRaCIS.Application.Services /// [HttpPost("{trialId}")] - [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] + [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })] [Authorize(Policy = IRaCISPolicy.PM_APM)] public async Task UploadReviewerAckSOW(Guid trialId, ReviewerAckDTO attachmentViewModel) @@ -104,6 +104,7 @@ namespace IRaCIS.Application.Services /// /// [Authorize(Policy = IRaCISPolicy.PM_APM)] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task SetEnrollReadingCategory(SetEnrollReadingCategoryInDto inDto) { @@ -156,6 +157,7 @@ namespace IRaCIS.Application.Services /// /// [Authorize(Policy = IRaCISPolicy.PM_APM)] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task UpdateTrialReviewerState(SetEnrollEnableCommand inCommand) { await _taskAllocationRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == inCommand.TrialId && t.EnrollId == inCommand.EnrollId, u => new TaskAllocationRule() { IsEnable = inCommand.IsEnable },true);