diff --git a/IRaCIS.Core.API/appsettings.json b/IRaCIS.Core.API/appsettings.json index 59dd671c2..8fa44ed41 100644 --- a/IRaCIS.Core.API/appsettings.json +++ b/IRaCIS.Core.API/appsettings.json @@ -90,7 +90,6 @@ "DicomStudyCodePrefix": "ST", "SystemSiteCodePrefix": "S", "DefaultPassword": "123456", - "DefaultInternalOrganizationName": "ExtImaging", "ImageShareExpireDays": 10 }, diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 5bf595a63..dbed0f7c8 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -145,6 +145,23 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand) { + + var @uploadLock = _distributedLockProvider.CreateLock($"UploadDicom"); + + using (await @uploadLock.AcquireAsync()) + { + if (_provider.Exists($"{incommand.TrialId}_{incommand.Study.StudyInstanceUid}")) + { + //---当前已有人正在上传和归档该检查! + return ResponseOutput.NotOk(StaticData.International("UploadDownLoad_ArchiveInProgress")); + } + else + { + //在事务未完成前 防止前端重复提交 + _provider.Set($"{incommand.TrialId}_{incommand.Study.StudyInstanceUid}", _userInfo.Id, TimeSpan.FromMinutes(3)); + } + } + var modalitys = string.Empty; try @@ -191,7 +208,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc study.SubjectVisitId = incommand.SubjectVisitId; //如果因为意外情况,连续点击两次,导致第一次插入了,第二次进来也会插入,在此判断一下 - var findStudy = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == study.Id); + var findStudy = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == study.Id); if (findStudy != null) { @@ -339,6 +356,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc finally { _provider.Remove($"StudyUid_{incommand.TrialId}_{incommand.Study.StudyInstanceUid}"); + _provider.Remove($"{incommand.TrialId}_{incommand.Study.StudyInstanceUid}"); } @@ -372,7 +390,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc VisitNum = t.SubjectVisit.VisitNum, IsDicom = true, - IsFromPACS=t.IsFromPACS, + IsFromPACS = t.IsFromPACS, SubjectCode = t.Subject.Code, @@ -422,7 +440,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc VisitNum = t.SubjectVisit.VisitNum, IsDicom = false, - IsFromPACS=false, + IsFromPACS = false, SubjectCode = t.Subject.Code, @@ -543,7 +561,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc path = (await _dicomInstanceRepository.Where(s => s.StudyId == studyId).Select(t => t.Path).FirstOrDefaultAsync()).IfNullThrowException(); - + using (var sw = ImageHelper.RenderPreviewJpeg(path)) { diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 7aab3e7b6..a719dbab3 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -560,7 +560,9 @@ namespace IRaCIS.Application.Services if (saveItem.IsZhiZhun) { - saveItem.OrganizationName = AppSettings.DefaultInternalOrganizationName; + var organizationName = _userInfo.IsEn_Us ? _systemEmailConfig.OrganizationName : _systemEmailConfig.OrganizationNameCN; + + saveItem.OrganizationName = organizationName; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialDicomAEService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialDicomAEService.cs index 7c24b56c9..b0e1be07c 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialDicomAEService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialDicomAEService.cs @@ -76,6 +76,14 @@ namespace IRaCIS.Core.Application.Service VerifyMsg = _localizer["TrialDicomAE_RepeatIPAndPort"] }; + var verifyExp2 = new EntityVerifyExp() + { + VerifyExp = u => u.CalledAE == addOrEditDicomAE.CalledAE , + + //"AE名称不能与其他项目相同" + VerifyMsg = _localizer["TrialDicomAE_RepeatCalledAE"] + }; + //var verifyExp2 = new EntityVerifyExp() //{ // VerifyExp = u => u.TrialId == addOrEditDicomAE.TrialId, @@ -90,7 +98,7 @@ namespace IRaCIS.Core.Application.Service if (addOrEditDicomAE.IsPACSConnect) { // 在此处拷贝automapper 映射 - var entity = await _dicomAERepository.InsertOrUpdateAsync(addOrEditDicomAE, true, verifyExp1); + var entity = await _dicomAERepository.InsertOrUpdateAsync(addOrEditDicomAE, true, verifyExp1, verifyExp2); return ResponseOutput.Ok(entity.Id.ToString()); } diff --git a/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs b/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs index 178dc34b8..05d8d3fcc 100644 --- a/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs +++ b/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs @@ -954,6 +954,8 @@ namespace IRaCIS.Application.Contracts public class SCPImageUploadQuery : PageInput { + [NotDefault] + public Guid TrialId { get; set; } public string TrialSiteKeyInfo { get; set; } public string? CallingAE { get; set; } diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index da2f95207..1d98ce922 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -75,7 +75,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task>> GetSCPImageUploadList(SCPImageUploadQuery inQuery) { - var query = _repository.Where() + var query = _repository.Where(t=>t.TrialId==inQuery.TrialId) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CalledAE), t => t.CalledAE.Contains(inQuery.CalledAE)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAEIP), t => t.CallingAEIP.Contains(inQuery.CallingAEIP)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAE), t => t.CallingAE.Contains(inQuery.CallingAE)) diff --git a/IRaCIS.Core.Domain/_Config/_AppSettings.cs b/IRaCIS.Core.Domain/_Config/_AppSettings.cs index a4833050b..b4c890257 100644 --- a/IRaCIS.Core.Domain/_Config/_AppSettings.cs +++ b/IRaCIS.Core.Domain/_Config/_AppSettings.cs @@ -90,7 +90,6 @@ namespace IRaCIS.Core.Domain.Share public static string NoneDicomStudyCodePrefix { get; set; } - public static string DefaultInternalOrganizationName { get; set; } public static int ImageShareExpireDays { get; set; } = 7; @@ -123,7 +122,6 @@ namespace IRaCIS.Core.Domain.Share DefaultPassword = configuration.GetSection("IRaCISBasicConfig").GetValue("DefaultPassword"); SystemSiteCodePrefix = configuration.GetSection("IRaCISBasicConfig").GetValue("SystemSiteCodePrefix"); - DefaultInternalOrganizationName = configuration.GetSection("IRaCISBasicConfig").GetValue("DefaultInternalOrganizationName"); ImageShareExpireDays = configuration.GetSection("IRaCISBasicConfig").GetValue("ImageShareExpireDays");