diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index 5859710db..66ef3bc6d 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -279,7 +279,7 @@ namespace IRaCIS.Api.Controllers var isExpire = _tokenService.IsTokenExpired(token); - if (!await _useRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd) || isExpire) + if ( Guid.TryParse(userId,out _) == false || isExpire || !await _useRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd) ) { decodeUrl = errorUrl + $"?lang={lang}&ErrorMessage={System.Web.HttpUtility.UrlEncode(I18n.T("UserRedirect_InitializationLinkExpire"))} "; } diff --git a/IRaCIS.Core.API/Properties/launchSettings.json b/IRaCIS.Core.API/Properties/launchSettings.json index 80db71188..d3e1c91fe 100644 --- a/IRaCIS.Core.API/Properties/launchSettings.json +++ b/IRaCIS.Core.API/Properties/launchSettings.json @@ -4,7 +4,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:3305", + "applicationUrl": "http://0.0.0.0:3305", "sslPort": 0 } }, @@ -23,7 +23,7 @@ "ASPNETCORE_ENVIRONMENT": "Test_IRC", "ASPNETCORE_OpenSwagger": "true" }, - "applicationUrl": "http://localhost:6100" + "applicationUrl": "http://0.0.0.0:6100" }, "IRaCIS.Test_IRC_PGSQL": { "commandName": "Project", @@ -31,7 +31,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Test_IRC_PGSQL" }, - "applicationUrl": "http://localhost:6100" + "applicationUrl": "http://0.0.0.0:6100" }, "IRaCIS.Event_IRC": { "commandName": "Project", @@ -39,7 +39,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Event_IRC" }, - "applicationUrl": "http://localhost:6100" + "applicationUrl": "http://0.0.0.0:6100" }, "Docker": { "commandName": "Docker", @@ -53,7 +53,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Uat_IRC" }, - "applicationUrl": "http://localhost:6100" + "applicationUrl": "http://0.0.0.0:6100" }, "IRaCIS.Prod_IRC": { "commandName": "Project", @@ -61,7 +61,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Prod_IRC" }, - "applicationUrl": "http://localhost:6100" + "applicationUrl": "http://0.0.0.0:6100" }, "IRaCIS.US_Uat_IRC": { "commandName": "Project", @@ -69,7 +69,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "US_Uat_IRC" }, - "applicationUrl": "http://localhost:6100" + "applicationUrl": "http://0.0.0.0:6100" }, "IRaCIS.US_Prod_IRC": { "commandName": "Project", @@ -77,7 +77,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "US_Prod_IRC" }, - "applicationUrl": "http://localhost:6100" + "applicationUrl": "http://0.0.0.0:6100" } } diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index e79f50804..8dde1dfb0 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -45,7 +45,7 @@ namespace IRaCIS.Core.API } else { - options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure()); + options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure()/*.CommandTimeout(60)*/); } diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index ae5c7a155..10eb03d31 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -471,7 +471,10 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName)) - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false) && t.IsDeleted == false) + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, + t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false + && t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false)) + && t.IsDeleted == false) .WhereIf(inQuery.CriterionType != null, o => o.TrialReadingCriterionList.Any(t => t.CriterionType == inQuery.CriterionType && t.IsSigned && t.IsConfirm)) .WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserRoleList.Any(t => t.UserRole.IdentityUser.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM))) .Select(t => new TrialToBeDoneDto() diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index d729a1ffa..d849a5c5a 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -53,6 +53,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc IDistributedLockProvider _distributedLockProvider, IRepository _trialImageDownloadRepository, IRepository _subjectRepository, + IRepository _instanceRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IDownloadAndUploadService { @@ -256,7 +257,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc OrginalStudyList = u.SourceSubjectVisit.StudyList .Where(t => u.TrialReadingCriterion.IsImageFilter ? ("|" + u.TrialReadingCriterion.CriterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|") : true) - .Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT" : true) + .Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT" : true) .Select(t => new StudyBasicInfo() { Id = t.Id, @@ -1141,7 +1142,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc 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)) + //if (_subjectVisitRepository.Where(t => t.Id == inQuery.SubjectVisitId).SelectMany(t => t.StudyList.SelectMany(t => t.InstanceList)).All(c => c.TransferSytaxUID != string.Empty)) + if (!_instanceRepository.Where(t => inQuery.SubjectVisitId == t.SubjectVisitId).Any(c => c.TransferSytaxUID == string.Empty)) { var list = _subjectVisitRepository.Where(t => t.Id == inQuery.SubjectVisitId).SelectMany(t => t.StudyList) .Where(t => isQueryDicom ? inQuery.DicomStudyIdList.Contains(t.Id) : false) @@ -1437,7 +1439,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc foreach (var item in list) { - var dicomList = item.DicomStudyList.Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT" : true).ToList(); + var dicomList = item.DicomStudyList.Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT" : true).ToList(); //dicomList.AddRange(preDicomStudyList.Where(t => t.SubjectVisitId == item.SourceSubjectVisitId).ToList()); @@ -1537,7 +1539,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc 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) .Where(t => info.IsImageFilter && inQuery.IsImageSegmentLabel == null ? ("|" + info.CriterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|") : true) - .Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" : true) + .Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" : true) .SelectMany(t => t.InstanceList.Where(t => t.IsReading && t.DicomSerie.IsReading)) .Select(t => new StudyDIRInfo() { @@ -1666,7 +1668,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TaskBlindName = leftVisitTask.TaskBlindName, StudyList = sv.StudyList.Where(t => isQueryDicom ? inQuery.DicomStudyIdList.Contains(t.Id) : false) .Where(t => info.IsImageFilter && inQuery.IsImageSegmentLabel == null ? ("|" + info.CriterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|") : true) - .Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" : true) + .Where(t => inQuery.IsImageSegmentLabel == false ? t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" : true) .Select(u => new DownloadDicomStudyDto() { PatientId = u.PatientId, @@ -2258,8 +2260,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { #region 在下载前先处理DIR文件 + //sql 超时 + //_subjectVisitRepository.Where(t => inCommand.SubjectVisitIdList.Contains(t.Id)) + // .SelectMany(t => t.StudyList.SelectMany(t => t.InstanceList.Where(t => isExportReading ? (t.IsReading && t.DicomSerie.IsReading) : true))) + // .All(c => c.TransferSytaxUID != string.Empty) //有传输语法值的导出 才生成DIR - if (_subjectVisitRepository.Where(t => inCommand.SubjectVisitIdList.Contains(t.Id)).SelectMany(t => t.StudyList.SelectMany(t => t.InstanceList.Where(t => isExportReading ? (t.IsReading && t.DicomSerie.IsReading) : true))).All(c => c.TransferSytaxUID != string.Empty)) + if (!_instanceRepository.Where(t => isExportReading ? (t.IsReading && t.DicomSerie.IsReading) : true) + .Where(t => inCommand.SubjectVisitIdList.Contains(t.SubjectVisitId)).Any(c => c.TransferSytaxUID == string.Empty)) { var dirInfolist = _subjectVisitRepository.Where(t => inCommand.SubjectVisitIdList.Contains(t.Id)).SelectMany(t => t.StudyList) .SelectMany(t => t.InstanceList.Where(t => isExportReading ? (t.IsReading && t.DicomSerie.IsReading) : true)) diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs index 42bf4fcd7..3bbbcfcdd 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs @@ -94,6 +94,10 @@ namespace IRaCIS.Application.Contracts public string UserCode { get; set; } public string EMail { get; set; } + public string HiddenEmail { get; set; } + + + public int Status { get; set; } public bool IsTestUser { get; set; } public bool IsZhiZhun { get; set; } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index b866781ec..fa46dfa78 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -296,7 +296,7 @@ namespace IRaCIS.Core.Application.Service var pwd = IRCEmailPasswordHelper.GenerateRandomPassword(10); - await _mailVerificationService.AdminResetPwdSendEmailAsync(identityUserId, pwd,inCommand.BaseUrl); + await _mailVerificationService.AdminResetPwdSendEmailAsync(identityUserId, pwd, inCommand.BaseUrl); await _identityUserRepository.UpdatePartialFromQueryAsync(t => t.Id == identityUserId, u => new IdentityUser() { @@ -936,11 +936,11 @@ namespace IRaCIS.Core.Application.Service [AllowAnonymous] [HttpGet] - public async Task LoginOut(Guid identityUserId, Guid userRoleId) + public async Task LoginOut(Guid identityUserId, Guid? userRoleId) { await _fusionCache.RemoveAsync(CacheKeys.UserToken(identityUserId)); - if (_identityUserRepository.Any(t => t.Id == identityUserId)) + if (_identityUserRepository.Any(t => t.Id == identityUserId) && userRoleId != null) { var userName = await _userRoleRepository.Where(t => t.Id == userRoleId).Select(t => t.IdentityUser.UserName).FirstOrDefaultAsync(); @@ -1207,7 +1207,7 @@ namespace IRaCIS.Core.Application.Service var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(email); - userLoginReturnModel.BasicInfo.EMail = hiddenEmail; + userLoginReturnModel.BasicInfo.HiddenEmail = hiddenEmail; //修改密码 || 90天修改密码再mfa 之前 if (userLoginReturnModel.BasicInfo.IsFirstAdd || userLoginReturnModel.BasicInfo.NeedChangePassWord) @@ -1223,6 +1223,10 @@ namespace IRaCIS.Core.Application.Service } } + else + { + userLoginReturnModel.BasicInfo.HiddenEmail = userLoginReturnModel.BasicInfo.EMail; + } await _fusionCache.SetAsync(CacheKeys.UserToken(identityUserId), userLoginReturnModel.JWTStr, TimeSpan.FromDays(7)); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 5f4d4ef47..114460c00 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -1151,7 +1151,7 @@ namespace IRaCIS.Core.Application .Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)).Count() > 0).CountAsync(); - var needSignSysDocCont = await _systemDocumentRepository.AsQueryable(true) + var needSignSysDocCont = await _systemDocumentRepository.Where(t => t.IsPublish) .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)) //外部人员 只签署 外部需要签署的 .WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter) @@ -1159,19 +1159,19 @@ namespace IRaCIS.Core.Application .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); //电子阅片声明是否已经签署 - var isfirstSysDocNeedSign = await _systemDocumentRepository.AsQueryable(true) + var isfirstSysDocNeedSign = await _systemDocumentRepository.Where(t => t.IsPublish) .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)) //外部人员 只签署 外部需要签署的 .WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter) .SelectMany(t => t.NeedConfirmedUserTypeList) .AnyAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId && t.SystemDocument.FileType.Code == "-1"); - var signedTrialCount = await _trialDocumentRepository.AsQueryable(true) + var signedTrialCount = await _trialDocumentRepository.Where(t => t.IsPublish) .Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId))) .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)).CountAsync(); - var signedSysDocCont = await _systemDocumentRepository.AsQueryable(true) + var signedSysDocCont = await _systemDocumentRepository.Where(t=>t.IsPublish) .Where(t => t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null)) .SelectMany(t => t.NeedConfirmedUserTypeList) .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId);