diff --git a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs index 66cabccb0..4fb56ce88 100644 --- a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs +++ b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs @@ -15,6 +15,7 @@ using IRaCIS.Core.Application.Service.Inspection.DTO; using Nito.AsyncEx; using IRaCIS.Application.Interfaces; using IRaCIS.Core.Domain.Common; +using IRaCIS.Core.Infrastructure; namespace IRaCIS.Core.Application.Contracts { @@ -30,8 +31,7 @@ namespace IRaCIS.Core.Application.Contracts private readonly IInspectionService _inspectionService; private readonly IRepository _studyMonitorRepository; private readonly IRepository _noneDicomStudyFileRepository; - - + private readonly IRepository _subjectVisitRepository; private readonly AsyncLock _mutex = new AsyncLock(); @@ -40,7 +40,7 @@ namespace IRaCIS.Core.Application.Contracts IDictionaryService dictionaryService, IInspectionService inspectionService, IRepository studyMonitorRepository, - IRepository noneDicomStudyFileRepository) + IRepository noneDicomStudyFileRepository,IRepository subjectVisitRepository) { _noneDicomStudyRepository = noneDicomStudyRepository; @@ -49,6 +49,7 @@ namespace IRaCIS.Core.Application.Contracts this._inspectionService = inspectionService; this._studyMonitorRepository = studyMonitorRepository; _noneDicomStudyFileRepository = noneDicomStudyFileRepository; + this._subjectVisitRepository = subjectVisitRepository; } @@ -62,6 +63,24 @@ namespace IRaCIS.Core.Application.Contracts return await noneDicomStudyQueryable.ToListAsync(); } + public void VerifyIsCanQC(SubjectVisit? subjectVisit, Guid? sujectVisitId = null) + { + if (sujectVisitId != null) + { + subjectVisit = _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == sujectVisitId).Result.IfNullThrowException(); + } + + if (subjectVisit.PreliminaryAuditUserId != null) + { + throw new BusinessValidationFailedException("当前访视已审核通过,不允许操作"); + } + + if (subjectVisit.CurrentActionUserId != _userInfo.Id) + { + throw new BusinessValidationFailedException("您不是该质控任务当前领取人,没有操作权限!"); + } + } + [UnitOfWork] [TypeFilter(typeof(TrialResourceFilter))] public async Task> AddOrUpdateNoneDicomStudy(NoneDicomStudyAddOrEdit addOrEditNoneDicomStudy) @@ -83,6 +102,12 @@ namespace IRaCIS.Core.Application.Contracts } else { + + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC) + { + VerifyIsCanQC(null, addOrEditNoneDicomStudy.SubjectVisitId); + } + optEntity = await _noneDicomStudyRepository.UpdateFromDTOAsync(addOrEditNoneDicomStudy); } diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index 14e1b90f6..a16a9eb0c 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Application.Contracts.DTO; using System.Linq.Expressions; +using IRaCIS.Core.Infrastructure; namespace IRaCIS.Core.Application.Image.QA { @@ -609,20 +610,12 @@ namespace IRaCIS.Core.Application.Image.QA { var sv = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId)).IfNullThrowException(); - if (currentQCType == CurrentQC.First) + + if (_userInfo.Id != sv.CurrentActionUserId) { - if (_userInfo.Id != sv.CurrentActionUserId) - { - throw new Exception("当前用户不是初审用户,不允许操作!"); - } - } - else - { - if (_userInfo.Id != sv.CurrentActionUserId) - { - throw new Exception("当前用户不是复审用户,不允许操作!"); - } + throw new BusinessValidationFailedException("您不是该质控任务当前领取人,没有操作权限!"); } + var temp = await GetVisitQCStudyAndSeriesList(subjectVisitId); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 2a36872c2..be9329053 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -151,6 +151,11 @@ namespace IRaCIS.Core.Application.Image.QA public async Task CloseQCChallenge(Guid qcChallengeId, Guid subjectVisitId, [FromRoute] QCChallengeCloseEnum closeEnum, [FromRoute] string closeReason) { + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC) + { + VerifyIsCanQC(null, subjectVisitId); + } + var dbQCChallenge = (await _qcChallengeRepository.FirstOrDefaultAsync(t => t.Id == qcChallengeId)).IfNullThrowException(); @@ -159,6 +164,8 @@ namespace IRaCIS.Core.Application.Image.QA throw new BusinessValidationFailedException("CRC申请重传的/QC同意重传的质疑,在CRC设置重传完成前不允许关闭质疑"); } + + #region 之前 @@ -489,9 +496,6 @@ namespace IRaCIS.Core.Application.Image.QA /// 一致性核查 excel上传 支持三种格式 /// /// - /// - /// - /// /// [HttpPost("{trialId:guid}")] [TypeFilter(typeof(TrialResourceFilter))] @@ -1091,7 +1095,7 @@ namespace IRaCIS.Core.Application.Image.QA if (subjectVisit.CurrentActionUserId != _userInfo.Id) { - throw new BusinessValidationFailedException("当前领取人已不是自己,不允许操作"); + throw new BusinessValidationFailedException("您不是该质控任务当前领取人,没有操作权限!"); } } @@ -1415,7 +1419,6 @@ namespace IRaCIS.Core.Application.Image.QA [TypeFilter(typeof(TrialResourceFilter))] public async Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState) { - var aa = _userInfo.RequestUrl; if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.Id)) { @@ -1428,6 +1431,7 @@ namespace IRaCIS.Core.Application.Image.QA return ResponseOutput.NotOk("有质疑未关闭,不允许该操作"); } + var trialConfig = await _trialRepository .Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification }) @@ -1436,7 +1440,7 @@ namespace IRaCIS.Core.Application.Image.QA var dbSubjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId)).IfNullThrowException(); - + VerifyIsCanQC(dbSubjectVisit); //有人QC Passed if (auditState == AuditStateEnum.QCPassed)