From 552a77ecd431ca1e0d34a775151dd9d412dc5410 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 15 Aug 2025 09:50:39 +0800 Subject: [PATCH] =?UTF-8?q?HIR=20=E7=94=A8=E6=88=B7=20=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AC=AC=E4=BA=8C=E6=AC=A1=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ExtraController.cs | 282 +- .../Controllers/InspectionController.cs | 17 +- .../Controllers/UploadDownLoadController.cs | 112 +- IRaCIS.Core.API/IRaCIS.Core.API.xml | 9 - IRaCIS.Core.API/SignalRHub/UploadHub.cs | 2 +- .../Serilog/SerilogConfig.cs | 3 +- IRaCIS.Core.Application/Auth/IRaCISClaims.cs | 46 - IRaCIS.Core.Application/Auth/JwtSetting.cs | 65 +- IRaCIS.Core.Application/Auth/TokenService.cs | 30 +- IRaCIS.Core.Application/Auth/UserTokenInfo.cs | 27 + .../LimitUserRequestAuthorization.cs | 10 +- ...tUserRequestAuthorizationEndpointFilter.cs | 10 +- .../BusinessFilter/_Config/_AppSettings.cs | 9 +- IRaCIS.Core.Application/Helper/CacheHelper.cs | 11 +- .../Helper/IPCityHelper.cs | 42 + .../IRaCIS.Core.Application.csproj | 1 + .../IRaCIS.Core.Application.xml | 565 +- .../Consumer/ConsistencyCheckConsumer.cs | 2 +- .../Allocation/TaskMedicalReviewService.cs | 2 +- .../Service/Allocation/VisitTaskService.cs | 36 +- .../Service/Common/CommonDocumentService.cs | 2 +- .../Service/Common/ExcelExportService.cs | 209 +- .../Service/Common/MailService.cs | 253 +- .../Service/Doctor/DoctorService.cs | 2 +- .../Service/Doctor/_MapConfig.cs | 11 +- .../Document/DTO/SystemDocumentViewModel.cs | 202 - .../Interface/ISystemDocumentService.cs | 33 - .../Interface/ITrialDocumentService.cs | 26 - .../Service/Document/SystemDocumentService.cs | 191 - .../Service/Document/TrialDocumentService.cs | 855 - .../Document/TrialEmailNoticeConfigService.cs | 1591 -- .../Service/Document/_MapConfig.cs | 49 +- .../Financial/TrialPaymentPriceService.cs | 2 +- .../ImageAndDoc/DownloadAndUploadService.cs | 16 +- .../Service/ImageAndDoc/ImageShareService.cs | 13 +- .../Service/ImageAndDoc/StudyService.cs | 24 +- .../Service/Inspection/DTO/InspectionModel.cs | 8 - .../Inspection/FrontAuditConfigService.cs | 4 +- .../Management/DTO/UserLogViewModel.cs | 16 + .../Service/Management/DTO/UserModel.cs | 155 +- .../Management/Interface/IUserService.cs | 7 - .../Service/Management/SystemNoticeService.cs | 10 +- .../Service/Management/UserFeedBackService.cs | 2 +- .../Service/Management/UserService.cs | 892 +- .../Service/Management/_MapConfig.cs | 28 +- .../Service/QC/QCCommon.cs | 2 +- .../Service/QC/QCListService.cs | 16 +- .../Service/QC/QCOperationService.cs | 54 +- .../Interface/IReadingImageTaskService.cs | 1 - .../ReadingMedicalReviewService.cs | 16 +- .../ReadingImageTaskService.cs | 108 +- .../Reading/ShortcutKey/ShortcutKeyService.cs | 12 +- .../ShortcutKey/UserWLTemplateService.cs | 14 +- .../DTO/TrialSiteEquipmentSurveyViewModel.cs | 64 - .../DTO/TrialSiteSurveyViewModel.cs | 397 - .../DTO/TrialSiteUserSurveyViewModel.cs | 171 - .../ITrialSiteEquipmentSurveyService.cs | 16 - .../Interface/ITrialSiteSurveyService.cs | 25 - .../Interface/ITrialSiteUserSurveyService.cs | 15 - .../TrialSiteEquipmentSurveyService.cs | 66 - .../SiteSurvey/TrialSiteSurveyService.cs | 1056 - .../SiteSurvey/TrialSiteUserSurveyService.cs | 152 - .../Service/SiteSurvey/_MapConfig.cs | 100 - .../Service/Stat/StatisticsService.cs | 6 +- .../UltrasonicDicomService.cs | 2 +- .../TrialSiteUser/DTO/UserTrialViewModel.cs | 23 - .../Interface/ITrialExternalUserService.cs | 2 +- .../Interface/ITrialSiteService.cs | 1 - .../TrialSiteUser/PersonalWorkstation.cs | 462 +- .../TrialSiteUser/TrialConfigService.cs | 6 +- .../TrialSiteUser/TrialExternalUserService.cs | 193 - .../Service/TrialSiteUser/TrialService.cs | 25 +- .../Service/TrialSiteUser/TrialSiteService.cs | 23 +- .../Service/TrialSiteUser/_MapConfig.cs | 16 +- .../Service/Visit/PatientService.cs | 16 +- .../Service/Visit/SubjectService.cs | 2 +- .../Service/WorkLoad/EnrollService.cs | 175 - IRaCIS.Core.Application/TestService.cs | 45 +- .../BeforeSaveTrigger/UserLogTrigger.cs | 2 +- .../Reading/ImageFilterState.cs | 11 +- .../Document/SystemDocConfirmedUser.cs | 26 - .../SystemDocNeedConfirmedUserType.cs | 20 - IRaCIS.Core.Domain/Document/SystemDocument.cs | 36 - .../Document/TrialDocConfirmedUser.cs | 22 - .../Document/TrialDocNeedConfirmedUserType.cs | 20 - IRaCIS.Core.Domain/Document/TrialDocument.cs | 32 - .../Management/HospitalGroup.cs | 9 +- IRaCIS.Core.Domain/Management/User.cs | 62 +- IRaCIS.Core.Domain/Management/UserLog.cs | 1 - IRaCIS.Core.Domain/Management/UserType.cs | 2 - IRaCIS.Core.Domain/Trial/Trial.cs | 3 +- IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs | 1 - .../AuthUser/IUserInfo.cs | 17 +- IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs | 56 +- .../Common/AuditingData.cs | 198 +- .../Context/IRaCISDBContext.cs | 11 - .../EntityConfigration/SubjectConfigration.cs | 47 +- .../Interceptor/AuditEntityInterceptor.cs | 8 +- ...0250815014752_secondUserModify.Designer.cs | 18753 ++++++++++++++++ .../20250815014752_secondUserModify.cs | 364 + .../IRaCISDBContextModelSnapshot.cs | 1144 +- .../Repository/IRepository.cs | 2 +- .../Repository/Repository.cs | 2 +- 103 files changed, 20797 insertions(+), 9216 deletions(-) delete mode 100644 IRaCIS.Core.Application/Auth/IRaCISClaims.cs create mode 100644 IRaCIS.Core.Application/Auth/UserTokenInfo.cs create mode 100644 IRaCIS.Core.Application/Helper/IPCityHelper.cs delete mode 100644 IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs delete mode 100644 IRaCIS.Core.Application/Service/Document/Interface/ISystemDocumentService.cs delete mode 100644 IRaCIS.Core.Application/Service/Document/Interface/ITrialDocumentService.cs delete mode 100644 IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs delete mode 100644 IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs delete mode 100644 IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteEquipmentSurveyViewModel.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteEquipmentSurveyService.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs delete mode 100644 IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs delete mode 100644 IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs delete mode 100644 IRaCIS.Core.Domain/Document/SystemDocNeedConfirmedUserType.cs delete mode 100644 IRaCIS.Core.Domain/Document/SystemDocument.cs delete mode 100644 IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs delete mode 100644 IRaCIS.Core.Domain/Document/TrialDocNeedConfirmedUserType.cs delete mode 100644 IRaCIS.Core.Domain/Document/TrialDocument.cs create mode 100644 IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.Designer.cs create mode 100644 IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.cs diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index 3cfb05980..d72ea429d 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -102,275 +102,6 @@ namespace IRaCIS.Api.Controllers } - - [HttpGet, Route("user/loginSelectUserType")] - public async Task> LoginSelectUserType(Guid userId, Guid userTypeId, - [FromServices] IUserService _userService, - [FromServices] IFusionCache _fusionCache, - [FromServices] ITokenService _tokenService, - [FromServices] IReadingImageTaskService readingImageTaskService, - [FromServices] IOptionsMonitor _verifyConfig, - [FromServices] IOptionsMonitor _emailConfig, - - [FromServices] IMailVerificationService _mailVerificationService) - { - var emailConfig = _emailConfig.CurrentValue; - var companyInfo = new SystemEmailSendConfigView() { CompanyName = emailConfig.CompanyName, CompanyNameCN = emailConfig.CompanyNameCN, CompanyShortName = emailConfig.CompanyShortName, CompanyShortNameCN = emailConfig.CompanyShortNameCN }; - - var returnModel = await _userService.LoginSelectUserType(userId, userTypeId); - - if (returnModel.IsSuccess) - { - if (_verifyConfig.CurrentValue.OpenLoginMFA) - { - //MFA 发送邮件 - - returnModel.Data.IsMFA = true; - - var email = returnModel.Data.BasicInfo.EMail; - - var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(email); - - returnModel.Data.BasicInfo.EMail = hiddenEmail; - - //修改密码 - if (returnModel.Data.BasicInfo.IsFirstAdd || returnModel.Data.BasicInfo.LoginState == 1) - { - returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo)); - } - else - { - //正常登录才发送邮件 - await _userService.SendMFAEmail(userId); - - } - - } - else - { - returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo)); - - // 创建一个 CookieOptions 对象,用于设置 Cookie 的属性 - var option = new CookieOptions - { - Expires = DateTime.Now.AddMonths(1), // 设置过期时间为 30 分钟之后 - HttpOnly = false, // 确保 cookie 只能通过 HTTP 访问 - SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None, // 设置 SameSite 属性 - Secure = false // 确保 cookie 只能通过 HTTPS 访问 - }; - - HttpContext.Response.Cookies.Append("access_token", returnModel.Data.JWTStr, option); - - - - // 验证阅片休息时间 - await readingImageTaskService.ResetReadingRestTime(returnModel.Data.BasicInfo.Id); - - await _fusionCache.SetAsync(CacheKeys.UserToken(userId), returnModel.Data.JWTStr, TimeSpan.FromDays(7)); - - await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(userId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes)); - } - } - - returnModel.Data.CompanyInfo = companyInfo; - - return returnModel; - } - - - - - - /// 系统用户登录接口[New] - [HttpPost, Route("user/login")] - [AllowAnonymous] - public async Task Login(UserLoginDTO loginUser, - [FromServices] IFusionCache _fusionCache, - [FromServices] IUserService _userService, - [FromServices] ITokenService _tokenService, - [FromServices] IReadingImageTaskService readingImageTaskService, - [FromServices] IOptionsMonitor _verifyConfig, - [FromServices] IOptionsMonitor _emailConfig, - - [FromServices] IMailVerificationService _mailVerificationService) - { - var emailConfig = _emailConfig.CurrentValue; - var companyInfo = new SystemEmailSendConfigView() { CompanyName = emailConfig.CompanyName, CompanyNameCN = emailConfig.CompanyNameCN, CompanyShortName = emailConfig.CompanyShortName, CompanyShortNameCN = emailConfig.CompanyShortNameCN }; - - //MFA 邮箱验证 前端传递用户Id 和MFACode - if (loginUser.UserId != null && _verifyConfig.CurrentValue.OpenLoginMFA) - { - Guid userId = (Guid)loginUser.UserId; - - //验证MFA 编码是否有问题 ,前端要拆开,自己调用验证的逻辑 - //await _userService.VerifyMFACodeAsync(userId, loginUser.MFACode); - - //var loginUser = await _userRoleRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); - - var basicInfo = await _userService.GetUserBasicInfo(userId, loginUser.Password); - - var loginReturn = new LoginReturnDTO() { BasicInfo = basicInfo }; - - loginReturn.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(loginReturn.BasicInfo)); - - - // 创建一个 CookieOptions 对象,用于设置 Cookie 的属性 - var option = new CookieOptions - { - Expires = DateTime.Now.AddMonths(1), // 设置过期时间为 30 分钟之后 - HttpOnly = false, // 确保 cookie 只能通过 HTTP 访问 - SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None, // 设置 SameSite 属性 - Secure = false // 确保 cookie 只能通过 HTTPS 访问 - }; - - HttpContext.Response.Cookies.Append("access_token", loginReturn.JWTStr, option); - - // 验证阅片休息时间 - await readingImageTaskService.ResetReadingRestTime(userId); - - await _fusionCache.SetAsync(CacheKeys.UserToken(userId), loginReturn.JWTStr, TimeSpan.FromDays(7)); - - await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(userId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes)); - - loginReturn.CompanyInfo = companyInfo; - return ResponseOutput.Ok(loginReturn); - - } - else - { - var returnModel = await _userService.Login(loginUser.UserName, loginUser.Password); - - if (returnModel.IsSuccess) - { - #region GRPC 调用鉴权中心,因为服务器IIS问题 http/2 故而没法使用 - - ////重试策略 - //var defaultMethodConfig = new MethodConfig - //{ - // Names = { MethodName.Default }, - // RetryPolicy = new RetryPolicy - // { - // MaxAttempts = 3, - // InitialBackoff = TimeSpan.FromSeconds(1), - // MaxBackoff = TimeSpan.FromSeconds(5), - // BackoffMultiplier = 1.5, - // RetryableStatusCodes = { Grpc.Core.StatusCode.Unavailable } - // } - //}; - - //#region unable to trust the certificate then the gRPC client can be configured to ignore the invalid certificate - - //var httpHandler = new HttpClientHandler(); - //// Return `true` to allow certificates that are untrusted/invalid - //httpHandler.ServerCertificateCustomValidationCallback = - // HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; - - - //////这一句是让grpc支持本地 http 如果本地访问部署在服务器上,那么是访问不成功的 - //AppContext.SetSwitch( - // "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); - - //#endregion - - - - //var grpcAdress = configuration.GetValue("GrpcAddress"); - ////var grpcAdress = "http://localhost:7200"; - - //var channel = GrpcChannel.ForAddress(grpcAdress, new GrpcChannelOptions - //{ - // HttpHandler = httpHandler, - // ServiceConfig = new ServiceConfig { MethodConfigs = { defaultMethodConfig } } - - //}); - ////var channel = GrpcChannel.ForAddress(grpcAdress); - //var grpcClient = new TokenGrpcService.TokenGrpcServiceClient(channel); - - //var userInfo = returnModel.Data.BasicInfo; - - //var tokenResponse = grpcClient.GetUserToken(new GetTokenReuqest() - //{ - // Id = userInfo.Id.ToString(), - // ReviewerCode = userInfo.ReviewerCode, - // IsAdmin = userInfo.IsAdmin, - // RealName = userInfo.RealName, - // UserTypeEnumInt = (int)userInfo.UserTypeEnum, - // UserTypeShortName = userInfo.UserTypeShortName, - // UserName = userInfo.UserName - //}); - - //returnModel.Data.JWTStr = tokenResponse.Token; - - #endregion - - var userId = returnModel.Data.BasicInfo.Id; - - if (_verifyConfig.CurrentValue.OpenLoginMFA) - { - - - - - //MFA 发送邮件 - - returnModel.Data.IsMFA = true; - - var email = returnModel.Data.BasicInfo.EMail; - - var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(email); - - returnModel.Data.BasicInfo.EMail = hiddenEmail; - - //修改密码 - if (returnModel.Data.BasicInfo.IsFirstAdd || returnModel.Data.BasicInfo.LoginState == 1) - { - returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo)); - } - else - { - //正常登录才发送邮件 - await _userService.SendMFAEmail(userId); - - } - - } - else - { - returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo)); - - // 创建一个 CookieOptions 对象,用于设置 Cookie 的属性 - var option = new CookieOptions - { - Expires = DateTime.Now.AddMonths(1), // 设置过期时间为 30 分钟之后 - HttpOnly = false, // 确保 cookie 只能通过 HTTP 访问 - SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None, // 设置 SameSite 属性 - Secure = false // 确保 cookie 只能通过 HTTPS 访问 - }; - - HttpContext.Response.Cookies.Append("access_token", returnModel.Data.JWTStr, option); - - - - // 验证阅片休息时间 - await readingImageTaskService.ResetReadingRestTime(returnModel.Data.BasicInfo.Id); - - await _fusionCache.SetAsync(CacheKeys.UserToken(userId), returnModel.Data.JWTStr, TimeSpan.FromDays(7)); - - await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(userId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes)); - } - - } - - returnModel.Data.CompanyInfo = companyInfo; - return returnModel; - - } - - - - - } - [AllowAnonymous] [HttpGet, Route("user/getPublicKey")] public IResponseOutput GetPublicKey([FromServices] IOptionsMonitor _IRCEncreptOption) @@ -385,18 +116,13 @@ namespace IRaCIS.Api.Controllers [AllowAnonymous] public IResponseOutput ShareImage([FromServices] ITokenService _tokenService) { - var token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo() + var token = _tokenService.GetToken(new UserTokenInfo() { - Id = Guid.Empty, - IsReviewer = false, - IsAdmin = false, - RealName = "Share001", + IdentityUserId = Guid.NewGuid(), UserName = "Share001", - Sex = 0, - //UserType = "ShareType", UserTypeEnum = UserTypeEnum.ShareImage, - Code = "ShareCode001", - })); + + }); return ResponseOutput.Ok("/showdicom?studyId=f7b67793-8155-0223-2f15-118f2642efb8&type=Share&token=" + token); } diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 55ea2fdf5..1332f6deb 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -22,7 +22,6 @@ namespace IRaCIS.Core.API.Controllers [ApiController, ApiExplorerSettings(GroupName = "Reviewer")] [UnitOfWork] public class InspectionController( - ITrialDocumentService _trialDocumentService, IReadingImageTaskService _iReadingImageTaskService, ITrialConfigService _trialConfigService, IClinicalAnswerService _clinicalAnswerService, @@ -497,21 +496,7 @@ namespace IRaCIS.Core.API.Controllers } - /// - /// 用户 签名某个文档 - /// - /// - [HttpPost, Route("Inspection/TrialDocument/userConfirm")] - [TrialGlobalLimit( "BeforeOngoingCantOpt", "SignSystemDocNoTrialId", "AfterStopCannNotOpt" )] - [UnitOfWork] - public async Task UserConfirm(DataInspectionDto opt) - { - var singid = await _inspectionService.RecordSing(opt.SignInfo); - opt.Data.SignText = opt.SignInfo.SignText; - var result = await _trialDocumentService.UserConfirm(opt.Data); - await _inspectionService.CompletedSign(singid, result); - return result; - } + /// diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 11313c7be..e4bd1cdc1 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -370,7 +370,7 @@ namespace IRaCIS.Core.API.Controllers //await _uploadHub.Clients.All.ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount); - await _uploadHub.Clients.User(_userInfo.Id.ToString()).ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount); + await _uploadHub.Clients.User(_userInfo.UserRoleId.ToString()).ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount); archiveResult.ReceivedFileCount = receivedCount; @@ -797,116 +797,6 @@ namespace IRaCIS.Core.API.Controllers _userInfo = userInfo; } - [HttpPost, Route("TrialSiteSurvey/UploadTrialSiteSurveyUser")] - [DisableFormValueModelBinding] - [UnitOfWork] - public async Task UploadTrialSiteSurveyUser(Guid trialId, string baseUrl, string routeUrl, - [FromServices] IRepository _trialSiteRepository, - [FromServices] IRepository _usertypeRepository, - [FromServices] ITrialSiteSurveyService _trialSiteSurveyService, - [FromServices] IOSSService oSSService, - [FromServices] IRepository _inspectionFileRepository) - { - var templateFileStream = new MemoryStream(); - - - await FileUploadToOSSAsync(async (realFileName, fileStream) => - { - await fileStream.CopyToAsync(templateFileStream); - templateFileStream.Seek(0, SeekOrigin.Begin); - - if (!realFileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) - { - // 请用提供格式的模板excel上传需要处理的数据 - throw new BusinessValidationFailedException(_localizer["UploadDownLoad_TemplateUploadData"]); - } - - var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, "InspectionUpload/SiteSurvey", realFileName); - - await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = realFileName, RelativePath = ossRelativePath, TrialId = trialId }); - - - - return ossRelativePath; - - }); - - //去掉空白行 - var excelList = MiniExcel.Query(templateFileStream, excelType: ExcelType.XLSX).ToList() - .Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName) && string.IsNullOrWhiteSpace(t.Email) - && string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName))).ToList(); - - if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) - { - //请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传 - throw new BusinessValidationFailedException(_localizer["UploadDownLoad_EnsureCompleteData"]); - } - - var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim().ToUpper()).Distinct().ToList(); - - if (_trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode.ToUpper())).Count() != siteCodeList.Count) - { - //在项目中未找到该Excel中部分或全部中心 - throw new BusinessValidationFailedException(_localizer["UploadDownLoad_InvalidCenters"]); - } - - if (excelList.GroupBy(t => new { t.TrialSiteCode, t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) - { - // 同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据 - - throw new BusinessValidationFailedException(_localizer["UploadDownLoad_CheckDuplicateAccounts"]); - } - - if (excelList.Any(t => !t.Email.Contains("@"))) - { - //有邮箱不符合邮箱格式,请核查Excel数据 - throw new BusinessValidationFailedException(_localizer["UploadDownLoad_InvalidEmail"]); - } - var generateUserTypeList = new List() { "CRC", "CRA" }; - - //if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) - //{ - // //用户类型仅能为 CRC,SR,CRA 请核查Excel数据 - // throw new BusinessValidationFailedException(_localizer["UploadDownLoad_InvalidUserType"]); - //} - if (excelList.Count == 0) - { - throw new BusinessValidationFailedException(_localizer["UploadDownLoad_NoValiddata"]); - } - //处理好 用户类型 和用户类型枚举 - var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); - var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, TrialSiteId = t.Id }).ToList(); - - foreach (var item in excelList) - { - switch (item.UserTypeStr.ToUpper()) - { - case "CRC": - - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId; - item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator; - break; - - case "CRA": - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId; - item.UserTypeEnum = UserTypeEnum.CRA; - break; - - - - } - - item.TrialSiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).TrialSiteId; - } - - var list = excelList.Where(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.CRA).ToList(); - - await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, baseUrl, routeUrl, list); - - return ResponseOutput.Ok(); - - - } /// 通用文件下载 diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 222dde557..7ef85e91f 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -34,9 +34,6 @@ - - 系统用户登录接口[New] - 回调到前端,前端调用后端的接口 @@ -278,12 +275,6 @@ - - - 用户 签名某个文档 - - - 重阅同意 diff --git a/IRaCIS.Core.API/SignalRHub/UploadHub.cs b/IRaCIS.Core.API/SignalRHub/UploadHub.cs index 662c298d9..5bcd9b7ac 100644 --- a/IRaCIS.Core.API/SignalRHub/UploadHub.cs +++ b/IRaCIS.Core.API/SignalRHub/UploadHub.cs @@ -17,7 +17,7 @@ namespace IRaCIS.Core.API { public virtual string GetUserId(HubConnectionContext connection) { - return connection.User?.FindFirst(JwtIRaCISClaimType.Id)?.Value!; + return connection.User?.FindFirst(JwtIRaCISClaimType.IdentityUserId)?.Value!; } } diff --git a/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs b/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs index 6492c25ae..3b2c2f154 100644 --- a/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs +++ b/IRaCIS.Core.API/_PipelineExtensions/Serilog/SerilogConfig.cs @@ -21,6 +21,7 @@ namespace IRaCIS.Core.API => { + opts.MessageTemplate = "{FullName} {UserType} {UserIp} {Host} {RequestMethod} {RequestPath} {RequestBody} responded {StatusCode} in {Elapsed:0.0000} ms"; opts.EnrichDiagnosticContext = (diagnosticContext, httpContext) => @@ -38,7 +39,7 @@ namespace IRaCIS.Core.API diagnosticContext.Set("QueryString", request.QueryString.Value); } - diagnosticContext.Set("FullName", httpContext?.User?.FindFirst(JwtIRaCISClaimType.RealName)?.Value); + diagnosticContext.Set("FullName", httpContext?.User?.FindFirst(JwtIRaCISClaimType.FullName)?.Value); diagnosticContext.Set("UserType", httpContext?.User?.FindFirst(JwtIRaCISClaimType.UserTypeShortName)?.Value); diff --git a/IRaCIS.Core.Application/Auth/IRaCISClaims.cs b/IRaCIS.Core.Application/Auth/IRaCISClaims.cs deleted file mode 100644 index 3eefc9fd2..000000000 --- a/IRaCIS.Core.Application/Auth/IRaCISClaims.cs +++ /dev/null @@ -1,46 +0,0 @@ -using IRaCIS.Application.Contracts; -using IRaCIS.Core.Domain.Share; - -namespace IRaCIS.Core.Application.Auth -{ - public class IRaCISClaims - { - public Guid Id { get; set; } - public string FullName { get; set; } = String.Empty; - public string Code { get; set; } = String.Empty; - public string RealName { get; set; } = String.Empty; - - public string UserTypeShortName { get; set; } = String.Empty; - - public UserTypeEnum UserTypeEnum { get; set; } - - public string PermissionStr { get; set; } = String.Empty; - - public Guid UserTypeId { get; set; } - - public int IsAdmin { get; } - - public bool IsTestUser { get; set; } - - public bool IsZhiZhun { get; set; } - - public string Phone { get; set; } = String.Empty; - - public static IRaCISClaims Create(UserBasicInfo user) - { - return new IRaCISClaims - { - Id = user.Id, - FullName = user.UserName, - RealName = user.RealName, - UserTypeEnum = user.UserTypeEnum, - UserTypeId = user.UserTypeId, - IsTestUser = user.IsTestUser, - Code = user.Code, - PermissionStr = user.PermissionStr, - IsZhiZhun = user.IsZhiZhun, - UserTypeShortName = user.UserTypeShortName - }; - } - } -} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Auth/JwtSetting.cs b/IRaCIS.Core.Application/Auth/JwtSetting.cs index cc54eb4d0..87baf1884 100644 --- a/IRaCIS.Core.Application/Auth/JwtSetting.cs +++ b/IRaCIS.Core.Application/Auth/JwtSetting.cs @@ -1,42 +1,39 @@ using Microsoft.IdentityModel.Tokens; using System.Text; -namespace IRaCIS.Core.Application.Auth +public class JwtSetting { - public class JwtSetting + /// + /// 颁发者 + /// + public string Issuer { get; set; } = String.Empty; + + /// + /// 接收者 + /// + public string Audience { get; set; } = String.Empty; + + /// + /// 令牌密码 + /// + public string SecurityKey { get; set; } = String.Empty; + + /// + /// 过期时间 + /// + public int TokenExpireMinute { get; set; } + + //public Dictionary Claims { get; set; } + + /// + /// 签名 + /// + public SigningCredentials Credentials { - /// - /// 颁发者 - /// - public string Issuer { get; set; } = String.Empty; - - /// - /// 接收者 - /// - public string Audience { get; set; } = String.Empty; - - /// - /// 令牌密码 - /// - public string SecurityKey { get; set; } = String.Empty; - - /// - /// 过期时间 - /// - public int TokenExpireDays { get; set; } - - //public Dictionary Claims { get; set; } - - /// - /// 签名 - /// - public SigningCredentials Credentials + get { - get - { - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(SecurityKey)); - return new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - } + var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(SecurityKey)); + return new SigningCredentials(key, SecurityAlgorithms.HmacSha256); } } -} +} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Auth/TokenService.cs b/IRaCIS.Core.Application/Auth/TokenService.cs index d9e5f0214..6b4f908a4 100644 --- a/IRaCIS.Core.Application/Auth/TokenService.cs +++ b/IRaCIS.Core.Application/Auth/TokenService.cs @@ -8,7 +8,9 @@ namespace IRaCIS.Core.Application.Auth public interface ITokenService { - string GetToken(IRaCISClaims user); + string GetToken(UserTokenInfo user); + + bool IsTokenExpired(string token); } @@ -21,16 +23,16 @@ namespace IRaCIS.Core.Application.Auth _jwtSetting = option.Value; } - public string GetToken(IRaCISClaims user) + public string GetToken(UserTokenInfo user) { //创建用户身份标识,可按需要添加更多信息 var claims = new Claim[] { new Claim(Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), - new Claim(JwtIRaCISClaimType.Id, user.Id.ToString()), - new Claim(JwtIRaCISClaimType.Name, user.FullName), - new Claim(JwtIRaCISClaimType.RealName, user.RealName), - new Claim(JwtIRaCISClaimType.Code,user.Code), + new Claim(JwtIRaCISClaimType.IdentityUserId, user.IdentityUserId.ToString()), + new Claim(JwtIRaCISClaimType.UserRoleId, user.UserRoleId.ToString()), + new Claim(JwtIRaCISClaimType.UserName, user.UserName), + new Claim(JwtIRaCISClaimType.FullName, user.FullName), new Claim(JwtIRaCISClaimType.UserTypeId,user.UserTypeId.ToString()), new Claim(JwtIRaCISClaimType.UserTypeEnum,user.UserTypeEnum.ToString()), new Claim(JwtIRaCISClaimType.UserTypeEnumInt,((int)user.UserTypeEnum).ToString()), @@ -47,13 +49,27 @@ namespace IRaCIS.Core.Application.Auth signingCredentials: _jwtSetting.Credentials, claims: claims, notBefore: DateTime.Now, - expires: DateTime.Now.AddDays(_jwtSetting.TokenExpireDays) + expires: DateTime.Now.AddMinutes(_jwtSetting.TokenExpireMinute) ); string jwtToken = new JwtSecurityTokenHandler().WriteToken(token); return jwtToken; } + + public bool IsTokenExpired(string token) + { + var handler = new JwtSecurityTokenHandler(); + try + { + var jwtToken = handler.ReadJwtToken(token); + return jwtToken.ValidTo < DateTime.UtcNow; + } + catch + { + return true; // 无效 Token 也视为已过期 + } + } } diff --git a/IRaCIS.Core.Application/Auth/UserTokenInfo.cs b/IRaCIS.Core.Application/Auth/UserTokenInfo.cs new file mode 100644 index 000000000..ab104ae58 --- /dev/null +++ b/IRaCIS.Core.Application/Auth/UserTokenInfo.cs @@ -0,0 +1,27 @@ +using IRaCIS.Application.Contracts; +using IRaCIS.Core.Domain.Share; + +namespace IRaCIS.Core.Application.Auth +{ + public class UserTokenInfo + { + public Guid IdentityUserId { get; set; } + + public Guid UserRoleId { get; set; } + + public Guid UserTypeId { get; set; } + + public UserTypeEnum UserTypeEnum { get; set; } + + public string UserName { get; set; } = string.Empty; + public string FullName { get; set; } = string.Empty; + + public string PermissionStr { get; set; } = string.Empty; + + public bool IsTestUser { get; set; } + + public bool IsZhiZhun { get; set; } + + public string UserTypeShortName { get; set; } = string.Empty; + } +} \ No newline at end of file diff --git a/IRaCIS.Core.Application/BusinessFilter/LegacyController/LimitUserRequestAuthorization.cs b/IRaCIS.Core.Application/BusinessFilter/LegacyController/LimitUserRequestAuthorization.cs index 69bafe0f9..62e89fe54 100644 --- a/IRaCIS.Core.Application/BusinessFilter/LegacyController/LimitUserRequestAuthorization.cs +++ b/IRaCIS.Core.Application/BusinessFilter/LegacyController/LimitUserRequestAuthorization.cs @@ -48,7 +48,7 @@ public class LimitUserRequestAuthorization( //2、在这里取缓存 进行比较 看是否有其他人进行了登陆,如果其他人登陆了,就把之前用户挤掉 - var cacheUserToken = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserToken(_userInfo.Id)); + var cacheUserToken = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserToken(_userInfo.UserRoleId)); @@ -58,17 +58,17 @@ public class LimitUserRequestAuthorization( cacheUserToken = _userInfo.UserToken; //设置当前用户最新Token - await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.Id), _userInfo.UserToken, TimeSpan.FromDays(7)); + await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.UserRoleId), _userInfo.UserToken, TimeSpan.FromDays(7)); //重启应用程序,所有人续期,不一下子踢出所有人 - await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); + await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); } //是同一个人 else if (cacheUserToken == _userInfo.UserToken) { - var cacheTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id)); + var cacheTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserAutoLoginOut(_userInfo.UserRoleId)); //过期了 需要自动退出 if (string.IsNullOrEmpty(cacheTime)) @@ -80,7 +80,7 @@ public class LimitUserRequestAuthorization( } else { - await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); + await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); } } else diff --git a/IRaCIS.Core.Application/BusinessFilter/MinimalAPI/LimitUserRequestAuthorizationEndpointFilter.cs b/IRaCIS.Core.Application/BusinessFilter/MinimalAPI/LimitUserRequestAuthorizationEndpointFilter.cs index 0d7a9f5a3..2644dbce9 100644 --- a/IRaCIS.Core.Application/BusinessFilter/MinimalAPI/LimitUserRequestAuthorizationEndpointFilter.cs +++ b/IRaCIS.Core.Application/BusinessFilter/MinimalAPI/LimitUserRequestAuthorizationEndpointFilter.cs @@ -41,19 +41,19 @@ public class LimitUserRequestAuthorizationEndpointFilter( } // 获取缓存中的用户 token - var cacheUserToken = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserToken(_userInfo.Id)); + var cacheUserToken = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserToken(_userInfo.UserRoleId)); // 缓存中没有取到 token if (string.IsNullOrWhiteSpace(cacheUserToken)) { // 设置当前用户最新 token - await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.Id), _userInfo.UserToken, TimeSpan.FromDays(7)); - await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); + await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.UserRoleId), _userInfo.UserToken, TimeSpan.FromDays(7)); + await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); } // 如果是同一个用户 else if (cacheUserToken == _userInfo.UserToken) { - var cacheTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id)); + var cacheTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.UserAutoLoginOut(_userInfo.UserRoleId)); // 如果过期,自动登出 if (string.IsNullOrEmpty(cacheTime)) @@ -63,7 +63,7 @@ public class LimitUserRequestAuthorizationEndpointFilter( } else { - await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); + await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes)); } } else diff --git a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs index ea04c7697..465bf5d6e 100644 --- a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs +++ b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs @@ -58,6 +58,8 @@ public class SystemEmailSendConfig public string SiteUrl { get; set; } = string.Empty; + public string SystemShortName { get; set; } = string.Empty; + public string OrganizationName { get; set; } = string.Empty; public string OrganizationNameCN { get; set; } = string.Empty; @@ -73,11 +75,14 @@ public class SystemEmailSendConfig public bool IsOpenErrorNoticeEmail { get; set; } + public string EmailRegexStr { get; set; } + public List ErrorNoticeEmailList { get; set; } = new List(); } public class SystemEmailSendConfigView { + public string SystemShortName { get; set; } = string.Empty; public string CompanyName { get; set; } = string.Empty; public string CompanyNameCN { get; set; } = string.Empty; @@ -85,6 +90,8 @@ public class SystemEmailSendConfigView public string CompanyShortName { get; set; } = string.Empty; public string CompanyShortNameCN { get; set; } = string.Empty; + + public string EmailRegexStr { get; set; } } public class SystemPacsConfig @@ -147,7 +154,7 @@ public static class AppSettings case nameof(Doctor): return IRaCISBasicConfig.DoctorCodePrefix + codeInt.ToString("D4"); - case nameof(UserRole): + case nameof(IdentityUser): return IRaCISBasicConfig.UserCodePrefix + codeInt.ToString("D4"); case nameof(QCChallenge): diff --git a/IRaCIS.Core.Application/Helper/CacheHelper.cs b/IRaCIS.Core.Application/Helper/CacheHelper.cs index 2ad1c3b03..3a47da22e 100644 --- a/IRaCIS.Core.Application/Helper/CacheHelper.cs +++ b/IRaCIS.Core.Application/Helper/CacheHelper.cs @@ -1,5 +1,4 @@ using IRaCIS.Application.Contracts; -using IRaCIS.Core.Application.ViewModel; namespace IRaCIS.Core.Application.Helper; @@ -30,6 +29,11 @@ public static class CacheKeys //超时没请求接口自动退出 public static string UserAutoLoginOut(Guid userId) => $"UserAutoLoginOut:{userId}"; + + public static string UserDisable(Guid userId) => $"UserDisable:{userId}"; + + public static string UserRoleDisable(Guid userRoleId) => $"UserRoleDisable:{userRoleId}"; + /// /// 用户登录错误 限制登录 /// @@ -60,6 +64,7 @@ public static class CacheKeys public static string StartRestTime(Guid userId) => $"{userId}StartRestTime"; + public static string CmoveStudyId(string studyIdStr) => $"CmoveStudyId:{studyIdStr}"; public static string Hospital => $"Hospital"; @@ -83,9 +88,9 @@ public static class CacheHelper return list; } - public static async Task GetHospitalCode(IRepository _hirHospitalRepository) + public static async Task GetHospitalCode(IRepository _hirHospitalRepository) { - return await _hirHospitalRepository.Where(t => t.IsDefault == true).FirstOrDefaultAsync(); + return await _hirHospitalRepository.Where(t => t.IsDefault == true).FirstNotNullAsync(); } } diff --git a/IRaCIS.Core.Application/Helper/IPCityHelper.cs b/IRaCIS.Core.Application/Helper/IPCityHelper.cs new file mode 100644 index 000000000..46a91a642 --- /dev/null +++ b/IRaCIS.Core.Application/Helper/IPCityHelper.cs @@ -0,0 +1,42 @@ +using IRaCIS.Core.Domain.Models; +using MaxMind.GeoIP2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Application.Helper +{ + public static class IPCityHelper + { + + public static string GetCityResponse(string ip) + { + var path = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "GeoLite2-City.mmdb"); + + try + { + using (var reader = new DatabaseReader(path)) + { + + var city = reader.City(ip); + + //Console.WriteLine(city.Country.IsoCode); // 'US' 'CN' + //Console.WriteLine(city.Country.Name); // 'United States' 'China' + ////Console.WriteLine(city.Country.Names["zh-CN"]); // '美国' + //Console.WriteLine(city.MostSpecificSubdivision.Name); // 'Minnesota' 'Hubei' + //Console.WriteLine(city.City.Name); // 'Minneapolis' 'WUHan' + + return $"{city.Country.Name} | {city.MostSpecificSubdivision.Name} | {city.City.Name}"; + + } + } + catch (Exception ex) + { + + return $"UN | UN | {ip}"; + } + } + } +} diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index 65fc7c747..f4524f5c8 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -32,6 +32,7 @@ + diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 3172c5bb8..907b24688 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -4,31 +4,6 @@ IRaCIS.Core.Application - - - 颁发者 - - - - - 接收者 - - - - - 令牌密码 - - - - - 过期时间 - - - - - 签名 - - 统一返回前端数据包装,之前在控制器包装,现在修改为动态Api 在ResultFilter这里包装,减少重复冗余代码 @@ -724,19 +699,6 @@ - - - Site用户汇总表导出 - - - - - - - - - - 项目列表导出---new @@ -747,17 +709,6 @@ - - - getDocumentConfirmList 培训记录导出--new - - - - - - - - 影像上传列表 只导出已上传状态的访视记录 @@ -1321,95 +1272,6 @@ - - - TrialEmailNoticeConfigService - - - - - TrialEmailNoticeConfigService - - - - - 获取项目邮箱 - - - - - - - 设置项目邮箱 - - - - - - - 测试邮件 带附件 填充word - - - 为空 代表 正常任务自动发送,为true 代表医学审核手动发送 为false 代表医学审核自动发送 - - - - - - - - 手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示 - - - - - - - 手动发送邮件 - - - - - - - - - - 任务Id - 任务类型 - 标准类型 - 是否是全局产生(区分裁判任务) - - - - - - 选择人员下拉 - - - - - - - 黑名单用户Id 列表 - - - - - - - 获取系统 邮件配置 勾选列表 - - - - - - - 批量勾选 传递列表每行数据,后台进行处理转换,建立关联关系 - - - - 获取某个月下的某些医生最终确认的工作量,用于计算月度费用 @@ -1837,11 +1699,6 @@ 泛型 - - - 用户 签名某个文档 Dto - - 父标识 @@ -2207,7 +2064,7 @@ 重置密码为 默认密码 - + @@ -2221,7 +2078,7 @@ (未登陆) 设置新密码 - + @@ -2236,7 +2093,7 @@ 根据用户Id获取用户详细信息[New] - + xiuga @@ -2253,38 +2110,6 @@ - - - 删除用户 - - - - - - - 禁用或者启用账户 - - - - - - - - 发送MFA 验证邮件 - - - - - - - - 验证MFA 邮件 - - - - - - 同济生成账号 @@ -2294,14 +2119,6 @@ - - - 用户登陆 - - - - - 验证验证码,没问题就返回用户所有的账户 @@ -2317,6 +2134,22 @@ + + + 账号验证,获取账号角色信息 获取临时token + + + + + + + 验证密码成功后,选定角色,然后获取当前角色的Token + + + + + + 获取数据库的表信息 以及字段信息 @@ -12790,7 +12623,7 @@ - + IR影像阅片 @@ -12858,13 +12691,6 @@ - - - 获取手册 - - - - 获取任务附加问题 @@ -13648,13 +13474,6 @@ 项目外部人员 录入流程相关 - - - 添加和更新接口 已验证邮箱和账户类型不允许添加重复项 - - - - Setting页面 获取项目参与人员列表 @@ -13868,11 +13687,6 @@ 入组流程-CRO确定医生名单 [ Approve] - - - 入组流程-后台确认医生入组[Confirm] - - optType 0表示入组,列表没这条数据了, 1表示出组,需要填写出组时间 废弃 @@ -13893,7 +13707,7 @@ - + 项目退出历史数据维护 @@ -13901,13 +13715,13 @@ - + 用户多账号,初次维护数据 - + 项目用户 维护数据 @@ -15730,15 +15544,6 @@ ISystemBasicDataService - - SystemDocumentView 列表视图模型 - - - SystemDocumentQuery 列表查询参数模型 - - - SystemDocumentAddOrEdit 列表查询参数模型 - TrialDocumentUserConfirmView 列表视图模型 @@ -15751,11 +15556,6 @@ TrialDocumentAddOrEdit 列表查询参数模型 - - - ISystemDocumentService - - NoneDicomStudyService @@ -16170,157 +15970,6 @@ - - TrialSiteEquipmentSurveyView 列表视图模型 - - - TrialSiteEquipmentSurveyQuery 列表查询参数模型 - - - TrialSiteEquipmentSurveyAddOrEdit 列表查询参数模型 - - - TrialSiteSurveyView 列表视图模型 - - - TrialSiteSurveyQuery 列表查询参数模型 - - - - - - - - TrialSiteSurveyAddOrEdit 列表查询参数模型 - - - TrialSiteUserSurveyView 列表视图模型 - - - TrialSiteUserSurveyQuery 列表查询参数模型 - - - TrialSiteUserSurveyAddOrEdit 列表查询参数模型 - - - - TrialSiteEquipmentSurveyService - - - - - TrialSiteEquipmentSurveyService - - - - - TrialSiteSurveyService - - - - - TrialSiteSurveyService - - - - - 发送验证码 - - - - - - - 通过UserId获取Doctorid - - - - - - - 验证邮箱验证码 获取医生信息Id - - - - - - - site 调研 发送验证码 - - - - - - - 验证后 如果数据库该项目不存在该邮箱 那么就插入记录 存在 - - - - - - - - - 直接查询相关所有数据 - - - - - - 实际这里只会是更新 添加在login的时候做了 - - - - - - - 删除调研表 - - - - - - - 获取 项目 site的调研记录 New - - - - - - 项目Site调研用户列表 所有site的调研用户 最新的调研表的记录的用户 new - - - - - - 初始登陆界面 项目基本信息+下拉框数据 - - - - - - - 驳回 New - - - - - - 提交 后台自动识别是谁提交 - - - - - - - TrialSiteUserSurveyService - - - - - TrialSiteUserSurveyService - - 受试者编号具体规则 @@ -16832,125 +16481,6 @@ - - - SystemDocumentService - - - - - SystemDocumentService - - - - - 管理端列表 - - - - - - - 获取需要签署的系统文档列表 - - - - - - TrialDocumentService - - - - - TrialDocumentService - - - - - Setting 界面的 项目所有文档列表 - - - - - - - 获取下一个未签名的文件 - - - - - - - 具体用户看到的 系统文件列表 + 项目类型文档 - - - - - - - 获取确认列表情况 项目文档+系统文档+具体的人 - - - - - - - 项目下面的参与用户下拉 - - - - - - - 项目+系统的文档类型 下拉 - - - - - - - 已签名的文档 不允许删除 - - - - - - - - 浏览文档说明时调用,记录第一次看的时间 - - - - - - - - 用户 签名某个文档 可能是系统的,也可能是项目的 - - - - - - 用户 废除某个文档 - - - - - - - - 从项目下参与者的维度 先看人员列表(展示统计数字) 点击数字 再看人员具体签署的 系统文档+项目文档(共用上面与人相关的具体文档列表) - - - - - - - 从 文档的维度 先看到文档列表(系统文档+项目文档 以及需要确认的人数 和已经确认人数) 点击数字查看某文档下面人确认情况 - - - - Financial---项目收入价格验证 @@ -17015,13 +16545,6 @@ 删除CRC人员 - - - 获取项目下的 site 下拉框数据 CRC只看到他负责的 - - - - 删除 项目 下某一site @@ -17402,11 +16925,6 @@ - - - 映射配置 - - 中心调研 每个项目 需要处理的审批统计 @@ -17414,13 +16932,6 @@ - - - 待签署的项目文件 需要签署文件数量 系统级别的在第一行 - - - - 一致性核查待处理 -- PM APM 待办 @@ -18294,11 +17805,6 @@ GCP机构 - - - LastLoginIP - - 上一次修改密码的时间 @@ -18899,5 +18405,30 @@ + + + 颁发者 + + + + + 接收者 + + + + + 令牌密码 + + + + + 过期时间 + + + + + 签名 + + diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs index 0efce758d..afad75e47 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs @@ -191,7 +191,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer // dialogMsg.AppendLine(@$"
说明:为高效解决/处理以上全部质疑问题,麻烦您准确核实实际影像检查情况。请注意影像日期与实际检查的日期可能会不一致,部分检查(如PET -CT)可能同时存在多种模态影像。准确核实后,请回复该访视正确的影像检查情况。"); dbSV.CheckState = CheckStateEnum.CVPassed; - dbSV.CheckUserId = _userInfo.Id; + dbSV.CheckUserId = _userInfo.UserRoleId; dbSV.CheckPassedTime = DateTime.Now; dbSV.CheckChallengeState = CheckChanllengeTypeEnum.Closed; diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs index 93e49b1f7..3aa99409f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs @@ -196,7 +196,7 @@ namespace IRaCIS.Core.Application.Service public async Task>> GetMIMMedicalReviewTaskList(TaskMedicalReviewQuery inQuery) { - var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.Id && t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) + var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.UserRoleId && t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) .WhereIf(inQuery.IsGetNextMedicalReviewTask, x => ( diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 1df367231..9eb6aac03 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -141,14 +141,14 @@ public class VisitTaskService(IRepository _visitTaskRepository, visitTask.PIAuditImagePath = string.Join('|', incommand.PIAuditImagePathList); visitTask.PIAuditState = incommand.PIAuditState; - visitTask.LatestReplyUserId = _userInfo.Id; + visitTask.LatestReplyUserId = _userInfo.UserRoleId; visitTask.LatestReplyTime = DateTime.Now; visitTask.IsEnrollment = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsEnrollment; visitTask.IsPDConfirm = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsPDConfirm; if (isFirstAudit) { - visitTask.FirstAuditUserId = _userInfo.Id; + visitTask.FirstAuditUserId = _userInfo.UserRoleId; visitTask.FirstAuditTime = DateTime.Now; } @@ -175,7 +175,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, var visitTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == incommand.VisitTaskId); visitTask.IsEnrollment = incommand.IsEnrollment != null ? incommand.IsEnrollment : visitTask.IsEnrollment; visitTask.IsPDConfirm = incommand.IsPDConfirm != null ? incommand.IsPDConfirm : visitTask.IsPDConfirm; - visitTask.LatestReplyUserId = _userInfo.Id; + visitTask.LatestReplyUserId = _userInfo.UserRoleId; visitTask.LatestReplyTime = DateTime.Now; await _visitTaskRepository.SaveChangesAsync(); @@ -213,7 +213,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, foreach (var item in list) { - item.IsCurrentUser = item.CreateUserId == _userInfo.Id; + item.IsCurrentUser = item.CreateUserId == _userInfo.UserRoleId; } return list; } @@ -1030,7 +1030,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, var visitTaskQueryable = _visitTaskReReadingRepository .Where(t => t.RequestReReadingType == RequestReReadingType.DocotorApply) - .Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.Id) + .Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.UserRoleId) .Where(t => t.OriginalReReadingTask.TrialId == inQuery.TrialId) .WhereIf(inQuery.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == inQuery.RequestReReadingResultEnum) .WhereIf(inQuery.RootReReadingTaskId != null, t => t.RootReReadingTaskId == inQuery.RootReReadingTaskId || t.OriginalReReadingTaskId == inQuery.RootReReadingTaskId) @@ -1183,7 +1183,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, //随机阅片 else { - var taskQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId) + var taskQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId) .Where(x => !x.Subject.IsDeleted).Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign); iRUnReadOut = new IRUnReadOutDto() @@ -1391,19 +1391,19 @@ public class VisitTaskService(IRepository _visitTaskRepository, if (subjectId != null) { //找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务 - var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync(); if (needDealTaskList.Count > 0) { //已完成的访视任务数量(包含重阅的) - var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit); //已经处理过的任务名称的数量 - var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint"); @@ -1423,7 +1423,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, } } - var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect) + var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect) .WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId) .WhereIf(!string.IsNullOrEmpty(subjectCode), t => (t.Subject.Code.Contains(subjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(subjectCode!) && t.IsAnalysisCreate)); @@ -1528,10 +1528,10 @@ public class VisitTaskService(IRepository _visitTaskRepository, { if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.AIR) { - var baseLineTaskList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id + var baseLineTaskList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SourceSubjectVisit.IsBaseLine == true).ToListAsync(); - var judegeList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id + var judegeList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Judge && t.ReadingTaskState == ReadingTaskState.HaveSigned).ToListAsync(); foreach (var item in judegeList) @@ -1559,7 +1559,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, - var requestRecordList = await _visitTaskReReadingRepository.Where(t => baseLineTaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.Id && t.RequestReReadingReason == "AIR自动重阅基线").ToListAsync(); + var requestRecordList = await _visitTaskReReadingRepository.Where(t => baseLineTaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.UserRoleId && t.RequestReReadingReason == "AIR自动重阅基线").ToListAsync(); if (requestRecordList.Count != baseLineTaskIdList.Count) { @@ -1586,7 +1586,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, await ApplyReReading(new ApplyReReadingCommand() { IsCopyFollowForms = false, IsCopyOrigenalForms = true, TaskIdList = taskIdList, TrialId = command.TrialId, RequestReReadingReason = "阅片人自动重阅阅片任务", RequestReReadingType = RequestReReadingType.DocotorApply }); - var requestRecord = await _visitTaskReReadingRepository.Where(t => visitTaskId == t.OriginalReReadingTaskId && t.RequestReReadingUserId == _userInfo.Id && t.RequestReReadingReason == "阅片人自动重阅阅片任务").FirstAsync(); + var requestRecord = await _visitTaskReReadingRepository.Where(t => visitTaskId == t.OriginalReReadingTaskId && t.RequestReReadingUserId == _userInfo.UserRoleId && t.RequestReReadingReason == "阅片人自动重阅阅片任务").FirstAsync(); await ConfirmReReading(new ConfirmReReadingCommand() { @@ -1817,7 +1817,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, RootReReadingTaskId = rootReReadingTaskId == Guid.Empty ? task.Id : rootReReadingTaskId, OriginalReReadingTaskId = task.Id, RequestReReadingTime = DateTime.Now, - RequestReReadingUserId = _userInfo.Id, + RequestReReadingUserId = _userInfo.UserRoleId, IsCopyOrigenalForms = applyReReadingCommand.IsCopyOrigenalForms, IsCopyFollowForms = applyReReadingCommand.IsCopyFollowForms, RequestReReadingReason = applyReReadingCommand.RequestReReadingReason, @@ -1921,7 +1921,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, if ((origenalTask.TaskState != TaskState.Effect && origenalTask.TaskState != TaskState.Freeze)) { - await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new VisitTaskReReading() { RequestReReadingConfirmUserId = _userInfo.Id, RequestReReadingResultEnum = RequestReReadingResult.Invalid }); + await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new VisitTaskReReading() { RequestReReadingConfirmUserId = _userInfo.UserRoleId, RequestReReadingResultEnum = RequestReReadingResult.Invalid }); //---当前申请重阅任务的状态,已被其他任务重阅已影响,不允许对该状态下的任务进行重阅同意与否操作 return ResponseOutput.Ok(string.Empty, msg: _localizer["VisitTask_ReapplyStatusConflict"]); @@ -1932,7 +1932,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, //更新申请信息 var visitTaskReReadingAppply = await _visitTaskReReadingRepository.FirstOrDefaultAsync(t => t.Id == item.Id); - visitTaskReReadingAppply.RequestReReadingConfirmUserId = _userInfo.Id; + visitTaskReReadingAppply.RequestReReadingConfirmUserId = _userInfo.UserRoleId; visitTaskReReadingAppply.RequestReReadingResultEnum = agreeReReadingCommand.RequestReReadingResultEnum; visitTaskReReadingAppply.RequestReReadingRejectReason = agreeReReadingCommand.RequestReReadingRejectReason; @@ -3181,7 +3181,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, var list = await _visitTaskRepository.Where(filterExpression) //IR 申请的时候,仅仅看到影响自己的 - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer, t => t.DoctorUserId == _userInfo.Id) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer, t => t.DoctorUserId == _userInfo.UserRoleId) .OrderBy(t => t.VisitTaskNum).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); #region 影响后的操作 diff --git a/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs index 084f205ad..5ea3f87dc 100644 --- a/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Common/CommonDocumentService.cs @@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(queryCommonDocument.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryCommonDocument.BusinessScenarioEnum) .WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Code), t => t.Code.Contains(queryCommonDocument.Code)) .WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name) || t.NameCN.Contains(queryCommonDocument.Name)) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId }); return await commonDocumentQueryable.ToPagedListAsync(queryCommonDocument); } diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index fa79b6fe8..0011eefb0 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -25,16 +25,12 @@ namespace IRaCIS.Core.Application.Service.Common public class ExcelExportService(IRepository _trialUserRepository, IRepository _visitTaskRepository, IRepository _readingQuestionCriterionTrialRepository, - IRepository _systemDocNeedConfirmedUserTypeRepository, IRepository _dicomStudyRepository, IRepository _qcChallengeRepository, IRepository _readModuleRepository, IRepository _noneDicomStudyRepository, IRepository _studyMonitorRepository, IRepository _commonDocumentRepository, - IRepository _systemDocConfirmedUserRepository, - IRepository _trialDocNeedConfirmedUserTypeRepository, - IRepository _trialDocConfirmedUserRepository, IRepository _subjectRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IWebHostEnvironment _hostEnvironment) : BaseService { @@ -119,7 +115,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), t => t.TrialSite.TrialSiteCode.Contains(param.TrialSiteCode)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, - t => t.UserId == _userInfo.Id) + t => t.UserId == _userInfo.UserRoleId) .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => (t.User.FullName).Contains(param.UserKeyInfo) || t.User.UserName.Contains(param.UserKeyInfo) || t.User.EMail.Contains(param.UserKeyInfo)) @@ -135,58 +131,7 @@ namespace IRaCIS.Core.Application.Service.Common } - /// - /// Site用户汇总表导出 - /// - /// - /// - /// - /// - /// - /// - /// - /// - [HttpPost] - [AllowAnonymous] - public async Task TrialSiteUserSummaryListExport(TrialSiteUserSurveyExportQueryDto queryParam, - [FromServices] IRepository _commonDocumentRepository, - [FromServices] IRepository _trialSiteSurveyRepository, - [FromServices] IRepository _trialSiteUserSurveyRepository, - [FromServices] IRepository _trialRepository, - [FromServices] IDictionaryService _dictionaryService - ) - { - var data = (await _trialRepository.Where(t => t.Id == queryParam.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - - var groupSelectIdQuery = - _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId) - .WhereIf(queryParam.TrialSiteId != null, t => t.TrialSiteId == queryParam.TrialSiteId) - .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo)) - .GroupBy(t => t.TrialSiteId) - .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); - - - var query = _trialSiteUserSurveyRepository - .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) - .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) - .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) - .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) - .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) - .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) - .ProjectTo(_mapper.ConfigurationProvider); - - var list = await query.ToListAsync(); - data.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); - - var exportInfo = data; - - exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - - - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserSummary_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrialSiteUserSummaryDto)); - - } /// @@ -220,7 +165,7 @@ 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.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.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.TrialUserList.Any(t => t.UserRole.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM))) .Select(t => new TrialToBeDoneDto() @@ -247,49 +192,49 @@ namespace IRaCIS.Core.Application.Service.Common SPM_ReviewerSelectApprovalCount = isSPMOrCPM ? t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() : 0, - MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.VisitTask.IsUrgent && u.AuditState != MedicalReviewAuditState.HaveSigned).Count() : 0, - MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing).Count() : 0, - MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count() : 0, - CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id) && t.IsUrgent).Count() : 0, + CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId) && t.IsUrgent).Count() : 0, - CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() : 0, - CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).SelectMany(c => c.QCChallengeList) + CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)).SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count() : 0, //待审核 审核中 加急的数量 - IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, + IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, //审核未完成 - IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, + IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, //质疑待处理 IQC_QuestionToBeDealedCount = isIQC ? t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, //待领取 IQC_ToBeClaimedCount = isIQC ? t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0, + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count() : 0, IR_ReadingCriterionList = isIR ? t.TrialReadingCriterionList.Where(t => t.IsConfirm && t.IsSigned).OrderBy(t => t.CriterionName).Select(t => t.CriterionName).ToList() : null, IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.EMail).Select(t => t.UserRole.EMail).ToList() : null, - IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, + IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, IR_UnReadCount = isIR ? t.VisitTaskList - .Where(c => c.DoctorUserId == _userInfo.Id && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) + .Where(c => c.DoctorUserId == _userInfo.UserRoleId && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -324,118 +269,6 @@ namespace IRaCIS.Core.Application.Service.Common #region 导表查询 - /// - /// getDocumentConfirmList 培训记录导出--new - /// - /// - /// - /// - /// - /// - /// - [HttpPost] - [AllowAnonymous] - public async Task PMTrainingRecordList_Export(DocumentTrialUnionQuery inQuery, - [FromServices] IRepository _commonDocumentRepository, - [FromServices] IDictionaryService _dictionaryService, - [FromServices] IRepository _subjectVisitRepository, - [FromServices] IRepository _trialRepository - ) - { - var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync()); - - var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) - join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId) - .WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId) - on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId - - join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on - new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc - from confirm in cc.DefaultIfEmpty() - select new TrainingRecordExportDTO() - { - IsSystemDoc = false, - - Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id, - CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime, - IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted, - //SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes, - Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name, - //Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path, - FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId, - FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN, - //UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime, - //IsConfirmed= confirm.ConfirmTime!=null, - - - - //ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, - UserTypeId = trialUser.UserRole.UserTypeId, - UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, - - //FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path - }; - - - - var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime) - - join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId) - on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId - join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc - from confirm in cc.DefaultIfEmpty() - select new TrainingRecordExportDTO() - { - IsSystemDoc = true, - - Id = needConfirmEdUserType.SystemDocument.Id, - CreateTime = needConfirmEdUserType.SystemDocument.CreateTime, - IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted, - //SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes, - Name = needConfirmEdUserType.SystemDocument.Name, - //Path = needConfirmEdUserType.SystemDocument.Path, - FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN, - FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId, - //UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime, - //IsConfirmed = confirm.ConfirmTime != null, - - //ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, - UserTypeId = trialUser.UserRole.UserTypeId, - UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, - - //FullFilePath = needConfirmEdUserType.SystemDocument.Path - }; - - var unionQuery = trialDocQuery.Union(systemDocQuery) - .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - .WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null) - .WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null) - .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) - .WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId); - - var list = await unionQuery.ToListAsync(); - - - var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - - exportInfo.List = list; - exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); - - - - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialTrainingRecordList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrainingRecordExportDTO)); - - } @@ -476,7 +309,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.SubmitState != null, t => t.SubmitState == inQuery.SubmitState) .WhereIf(inQuery.ChallengeState != null, t => t.ChallengeState == inQuery.ChallengeState) .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); var list = query.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.BlindName).ToList(); @@ -584,7 +417,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == true, t => t.IsClosed ? t.ClosedTime > t.DeadlineTime : DateTime.Now > t.DeadlineTime) .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == false, t => t.IsClosed ? t.ClosedTime < t.DeadlineTime : DateTime.Now < t.DeadlineTime) .WhereIf(inQuery.IsUrgent != null, t => t.SubjectVisit.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); @@ -625,7 +458,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) // CRC 只负责他管理site的受试者 - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider) .WhereIf(inQuery.IsMissingImages == true, t => t.MissingSubmmitCount > 0) .WhereIf(inQuery.IsMissingImages == false, t => t.MissingSubmmitCount == 0) @@ -807,7 +640,7 @@ namespace IRaCIS.Core.Application.Service.Common var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(inQuery.VisitPlanArray); var StudyMonitorQuery = _studyMonitorRepository.Where(t => t.TrialId == inQuery.TrialId, ignoreQueryFilters: true) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -922,7 +755,7 @@ namespace IRaCIS.Core.Application.Service.Common var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray); var dicomStudyQuery = _dicomStudyRepository.Where(t => t.TrialId == studyQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo)) .Where(x => x.SubjectVisit.AuditState == AuditStateEnum.QCPassed) @@ -950,7 +783,7 @@ namespace IRaCIS.Core.Application.Service.Common var nodeDicomStudyQuery = _noneDicomStudyRepository.Where(t => t.TrialId == studyQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression2) .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo)) .Where(x => x.SubjectVisit.AuditState == AuditStateEnum.QCPassed) @@ -1019,7 +852,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) //.WhereIf(!string.IsNullOrEmpty(checkQuery.VisitPlanInfo), checkQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(checkQuery.VisitPlanInfo)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))//CRC 过滤负责的site .ProjectTo(_mapper.ConfigurationProvider); var list = query.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ToList(); diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 5d6bba601..09ba95a37 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -29,11 +29,6 @@ namespace IRaCIS.Core.Application.Service Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456"); - Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl); - - Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl); - - Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl); Task UserFeedBackMail(Guid feedBackId); } @@ -45,6 +40,7 @@ namespace IRaCIS.Core.Application.Service IRepository _userRoleRepository, IRepository _userFeedBackRepository, ITokenService _tokenService, + IRepository _identityUserRepository, IRepository _subjectVisitRepository, IRepository _trialRepository, IRepository _userTypeRepository, @@ -338,7 +334,7 @@ namespace IRaCIS.Core.Application.Service public async Task AddUserSendEmailAsync(Guid userId, string baseUrl, string routeUrl) { - var sysUserInfo = (await _userRoleRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); + var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).Include(t => t.UserRoleList).ThenInclude(c => c.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); var messageToSend = new MimeMessage(); @@ -350,11 +346,11 @@ namespace IRaCIS.Core.Application.Service //---[来自展影IRC] 关于创建账户的提醒 - var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map(sysUserInfo))); + var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id }); - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token }); + await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new IdentityUser() { EmailToken = token }); - routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; + routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login")); @@ -370,8 +366,8 @@ namespace IRaCIS.Core.Application.Service var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), sysUserInfo.FullName, - sysUserInfo.UserName, - sysUserInfo.UserTypeRole.UserTypeShortName, + sysUserInfo.EMail, + //string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)), redirectUrl ); @@ -422,242 +418,7 @@ namespace IRaCIS.Core.Application.Service } - //Site调研 用户加入项目 - public async Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl) - { - var sysUserInfo = (await _userRoleRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); - var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId); - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); - //收件地址 - messageToSend.To.Add(new MailboxAddress(sysUserInfo.FullName, sysUserInfo.EMail)); - //主题 - // $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信"; - - - var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map(sysUserInfo))); - - if (sysUserInfo.IsFirstAdd) - { - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token }); - } - - var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; - - var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login")); - - var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}"; - - - var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; - - Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => - { - var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo); - - var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), - - sysUserInfo.FullName, - trialInfo.ExperimentName, - trialInfo.ResearchProgramNo, - trialInfo.TrialCode, - sysUserInfo.UserName, - sysUserInfo.UserTypeRole.UserTypeShortName, - sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl - ); - - return (topicStr, htmlBodyStr); - }; - - - await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc); - - - await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig); - - - } - - //外部用户 加入项目 - public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl) - { - var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId)).IfNullThrowException(); - - var sysUserInfo = (await _userRoleRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); - - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, sysUserInfo.EMail)); - //主题 - // $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信"; - - - - var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map(sysUserInfo))); - if (sysUserInfo.IsFirstAdd) - { - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token }); - } - - var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login")); - - var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; - - var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}"; - - - var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; - - Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => - { - var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo); - - var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), - - sysUserInfo.FullName, - trialInfo.ExperimentName, - trialInfo.ResearchProgramNo, - trialInfo.TrialCode, - sysUserInfo.UserName, - sysUserInfo.UserTypeRole.UserTypeShortName, - sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl - ); - - return (topicStr, htmlBodyStr); - }; - - - await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc); - - - await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null); - - } - - - //医生生成账号加入 或者已存在账号加入到项目中 - public async Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl) - { - var doctor = await _doctorTypeRepository.FindAsync(doctorId); - UserRole sysUserInfo = new UserRole(); - - var userType = await _userTypeRepository.FirstAsync(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer); - - var @lock = _distributedLockProvider.CreateLock($"UserCode"); - - using (await @lock.AcquireAsync()) - { - var isDoctorHaveAccount = await _userRoleRepository.AnyAsync(t => t.DoctorId == doctorId); - - - if (!isDoctorHaveAccount) - { - - var saveItem = new UserRole() { FirstName = doctor.FirstName, LastName = doctor.LastName, EMail = doctor.EMail }; - - var trialType = await _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefaultAsync(); - - if (trialType == TrialType.NoneOfficial) - { - saveItem.IsTestUser = true; - } - - - saveItem.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(UserRole)); - - saveItem.UserName = saveItem.UserCode; - - saveItem.UserTypeEnum = UserTypeEnum.IndependentReviewer; - - saveItem.DoctorId = doctorId; - saveItem.UserTypeId = userType.Id; - - var savedUser = await _userRoleRepository.AddAsync(saveItem); - - //下面获取Token 需要这部分信息 - sysUserInfo = savedUser.Clone(); - - sysUserInfo.UserTypeRole = userType; - - await _userRoleRepository.SaveChangesAsync(); - - } - else - { - sysUserInfo = (await _userRoleRepository.Where(t => t.DoctorId == doctorId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); - } - } - - - var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId); - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); - //收件地址 - messageToSend.To.Add(new MailboxAddress(doctor.FullName, doctor.EMail)); - - - - var basicInfo = IRaCISClaims.Create(_mapper.Map(sysUserInfo)); - - ////第一次添加的时候 注意赋值 - //basicInfo.PermissionStr = userType.PermissionStr; - //basicInfo.UserTypeShortName = userType.UserTypeShortName; - - var token = _tokenService.GetToken(basicInfo); - - if (sysUserInfo.IsFirstAdd) - { - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token }); - } - - var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + userType.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token; - - var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login")); - - var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}"; - - //主题 - // $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信"; - - - var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; - - Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => - { - var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo); - - var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), - - sysUserInfo.FullName, - trialInfo.ExperimentName, - trialInfo.ResearchProgramNo, - trialInfo.TrialCode, - sysUserInfo.UserName, - userType.UserTypeShortName, - sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl - ); - - return (topicStr, htmlBodyStr); - }; - - - await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.DoctorUserFirstJoinTrial : EmailBusinessScenario.DoctorUserExistJoinTrial, messageToSend, emailConfigFunc); - - - await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null); - - return sysUserInfo.Id; - } //用户反馈邮件 diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index e77010be6..f298f6933 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -629,7 +629,7 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task UpdateAuditResume(ResumeConfirmCommand auditResumeParam) { - var userId = _userInfo.Id; + var userId = _userInfo.UserRoleId; //判断 合作协议、正式简历 是否有。如果没有,显示提示信息,并且不能保存 var attachmentList = await _attachmentRepository.Where(u => u.DoctorId == auditResumeParam.Id) .Select(u => u.Type).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs index d98a9f7f4..c74d45e59 100644 --- a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs @@ -93,11 +93,6 @@ namespace IRaCIS.Core.Application.Service CreateMap() ; - CreateMap() - .ForMember(d => d.UserTypeShortName, u => u.MapFrom(t => t.UserTypeRole.UserTypeShortName)) - .ForMember(d => d.Code, u => u.MapFrom(t => t.UserCode)) - .ForMember(d => d.PermissionStr, u => u.MapFrom(t => t.UserTypeRole.PermissionStr)) - .ForMember(d => d.RealName, u => u.MapFrom(user => string.IsNullOrEmpty(user.FirstName) ? user.LastName : user.LastName + " / " + user.FirstName)); CreateMap() .ForMember(x=>x.VisitReadingCount, u => u.MapFrom(t => (t.ExperienceDataType==ExperienceDataType.TrialAuto||t.ExperienceDataType==ExperienceDataType.SystemAuto)? @@ -110,11 +105,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.EvaluationCriteriaList, u => u.MapFrom(t => t.ExperienceCriteriaList.Select(t => t.EvaluationCriteria.Value))) .ForMember(d => d.EvaluationCriteriaIdList, u => u.MapFrom(t => t.ExperienceCriteriaList.Select(t => t.EvaluationCriteriaId))); - CreateMap() - .ForMember(d => d.Code, u => u.MapFrom(t => t.ReviewerCode)) - .ForMember(d => d.RealName, u => u.MapFrom(t => t.ChineseName)) - .ForMember(d => d.IsReviewer, u => u.MapFrom(t => true)) - .ForMember(d => d.UserName, u => u.MapFrom(doctor => doctor.LastName + " / " + doctor.FirstName)); + #region 医生基本信息 CreateMap() diff --git a/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs b/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs deleted file mode 100644 index dca4b6d69..000000000 --- a/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs +++ /dev/null @@ -1,202 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2022-01-05 09:17:10 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using System.ComponentModel.DataAnnotations; - -namespace IRaCIS.Core.Application.Contracts -{ - /// SystemDocumentView 列表视图模型 - public class SystemDocumentView : SystemDocumentAddOrEdit - { - public string FullFilePath { get; set; } = string.Empty; - public DateTime CreateTime { get; set; } - public DateTime UpdateTime { get; set; } - - public string FileType { get; set; } = string.Empty; - - public List NeedConfirmedUserTypeList { get; set; } = new List(); - } - - public class UnionDocumentView : SystemDocumentAddOrEdit - { - public string FullFilePath { get; set; } = string.Empty; - public DateTime CreateTime { get; set; } - public DateTime UpdateTime { get; set; } - - public bool IsSystemDoc { get; set; } - - public string FileType { get; set; } = string.Empty; - - } - - public class TrialSignDocView : UnionDocumentWithConfirmInfoView - { - public string TrialCode { get; set; } - public string ResearchProgramNo { get; set; } - - public string ExperimentName { get; set; } - - } - - - public class UnionDocumentWithConfirmInfoView : UnionDocumentView - { - - - public DateTime? ConfirmTime { get; set; } - - public Guid? ConfirmUserId { get; set; } - - public bool IsConfirmed => ConfirmTime != null; - - public string UserName { get; set; } = string.Empty; - - public string RealName { get; set; } = string.Empty; - - - public Guid UserTypeId { get; set; } - public string UserTypeShortName { get; set; } = string.Empty; - } - - - public class TrialUserDto - { - public Guid UserId { get; set; } - public string UserName { get; set; } = string.Empty; - - public string RealName { get; set; } = string.Empty; - } - - public class DocumentUnionWithUserStatView : UnionDocumentView - { - public int? DocumentUserCount { get; set; } - public int? DocumentConfirmedUserCount { get; set; } - } - - public class TrialUserUnionDocumentView - { - public Guid UserId { get; set; } - - public string UserTypeShortName { get; set; } = string.Empty; - public string UserName { get; set; } = string.Empty; - public string RealName { get; set; } = string.Empty; - - - public int? SystemDocumentCount { get; set; } - public int? TrialDocumentCount { get; set; } - public int? TrialDocumentConfirmedCount { get; set; } - public int? SystemDocumentConfirmedCount { get; set; } - - //public List DocumentList { get; set; } - } - - - - - - - ///SystemDocumentQuery 列表查询参数模型 - public class SystemDocumentQuery : PageInput - { - - public bool? IsDeleted { get; set; } - public Guid? SystemDocumentId { get; set; } - - public Guid? FileTypeId { get; set; } - - public string Name { get; set; } = string.Empty; - - public bool IsSigned { get; set; } - - - } - - public class GetNextUnSignDocumentInDto - { - public Guid? TrialId { get; set; } - - public bool Asc { get; set; } = true; - public string SortField { get; set; } = ""; - } - - public class TrialDocQuery : PageInput - { - public Guid? TrialId { get; set; } - - public Guid? FileTypeId { get; set; } - - public string TrialCode { get; set; } = string.Empty; - - - public string Name { get; set; } = string.Empty; - - public bool IsSigned { get; set; } - - } - - public class TrialUserDocUnionQuery : PageInput - { - [NotDefault] - public Guid TrialId { get; set; } - - public Guid? FileTypeId { get; set; } - - - public string Name { get; set; } = string.Empty; - - public bool? IsSign { get; set; } - - } - - public class UserConfirmCommand - { - - [NotDefault] - public Guid DocumentId { get; set; } - - - public bool isSystemDoc { get; set; } - - public string SignText { get; set; } = string.Empty; - } - - public class DocumentTrialUnionQuery : TrialUserDocUnionQuery - { - - public Guid? UserTypeId { get; set; } - public Guid? UserId { get; set; } - - public bool? IsConfirmed { get; set; } - - public bool? IsDeleted { get; set; } - } - - /// SystemDocumentAddOrEdit 列表查询参数模型 - public class SystemDocumentAddOrEdit - { - public Guid? Id { get; set; } - public Guid FileTypeId { get; set; } - public string Name { get; set; } = string.Empty; - public string Path { get; set; } = string.Empty; - - public bool IsDeleted { get; set; } - - public int SignViewMinimumMinutes { get; set; } - - public DocUserSignType DocUserSignType { get; set; } - - } - - public class AddOrEditSystemDocument : SystemDocumentAddOrEdit - { - - public List NeedConfirmedUserTypeIdList { get; set; } = new List(); - } -} - - - - - diff --git a/IRaCIS.Core.Application/Service/Document/Interface/ISystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/Interface/ISystemDocumentService.cs deleted file mode 100644 index 4b4c530e4..000000000 --- a/IRaCIS.Core.Application/Service/Document/Interface/ISystemDocumentService.cs +++ /dev/null @@ -1,33 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2022-01-05 09:17:00 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -namespace IRaCIS.Core.Application.Contracts -{ - /// - /// ISystemDocumentService - /// - public interface ISystemDocumentService - { - - //PageOutput GetSystemDocumentList(SystemDocumentQuery querySystemDocument); - - - //IResponseOutput AddOrUpdateSystemDocument(AddOrEditSystemDocument addOrEditSystemDocument); - - //IResponseOutput DeleteSystemDocument(Guid systemDocumentId); - - Task> GetSystemDocumentListAsync(SystemDocumentQuery querySystemDocument); - - Task AddOrUpdateSystemDocumentAsync(AddOrEditSystemDocument addOrEditSystemDocument); - - Task DeleteSystemDocumentAsync(Guid systemDocumentId); - - Task> getWaitSignSysDocList(SystemDocumentQuery querySystemDocument); - - - - - } -} diff --git a/IRaCIS.Core.Application/Service/Document/Interface/ITrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/Interface/ITrialDocumentService.cs deleted file mode 100644 index 839017e20..000000000 --- a/IRaCIS.Core.Application/Service/Document/Interface/ITrialDocumentService.cs +++ /dev/null @@ -1,26 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2022-01-05 09:17:03 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -namespace IRaCIS.Core.Application.Contracts -{ - public interface ITrialDocumentService - { - Task UserAbandonDoc(Guid documentId, bool isSystemDoc); - Task AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument); - Task DeleteTrialDocument(Guid trialDocumentId, Guid trialId); - //Task>> GetDocumentConfirmList(DocumentTrialUnionQuery querySystemDocument); - Task> GetTrialDocumentList(TrialDocumentQuery queryTrialDocument); - - Task>> GetUserDocumentList(TrialUserDocUnionQuery querySystemDocument); - Task SetFirstViewDocumentTime(Guid documentId, bool isSystemDoc); - Task UserConfirm(UserConfirmCommand userConfirmCommand); - Task> GetTrialUserSelect(Guid trialId); - - - Task> GetTrialSystemDocumentList(DocumentTrialUnionQuery querySystemDocument); - List GetTrialUserDocumentList(Guid trialId); - } -} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs deleted file mode 100644 index acd1c6e72..000000000 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ /dev/null @@ -1,191 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2022-01-05 09:17:03 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Application.Contracts; -using Microsoft.AspNetCore.Mvc; -using UserRole = IRaCIS.Core.Domain.Models.UserRole; - -namespace IRaCIS.Core.Application.Services -{ - /// - /// SystemDocumentService - /// - [ApiExplorerSettings(GroupName = "Trial")] - public class SystemDocumentService(IRepository _systemDocumentRepository, - IRepository _userRoleRepository, - IRepository _systemDocConfirmedUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemDocumentService - { - - - - - - /// - /// 管理端列表 - /// - /// - /// - [HttpPost] - public async Task> GetSystemDocumentListAsync(SystemDocumentQuery inQuery) - { - var systemDocumentQueryable = _systemDocumentRepository.AsQueryable(true) - .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us, userId = _userInfo.Id }); - - return await systemDocumentQueryable.ToPagedListAsync(inQuery); - } - - public async Task AddOrUpdateSystemDocumentAsync(AddOrEditSystemDocument addOrEditSystemDocument) - { - if (addOrEditSystemDocument.Id == null) - { - var entity = _mapper.Map(addOrEditSystemDocument); - - - if (await _systemDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditSystemDocument.FileTypeId && t.Name == addOrEditSystemDocument.Name, true)) - { - //---系统中已存在同类型的同名文件。 - return ResponseOutput.NotOk(_localizer["SystemD_DuplicateFile"]); - } - - await _systemDocumentRepository.AddAsync(entity, true); - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - else - { - var document = (await _systemDocumentRepository.Where(t => t.Id == addOrEditSystemDocument.Id, true, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync()).IfNullThrowException(); - - - if (await _systemDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditSystemDocument.FileTypeId && t.Name == addOrEditSystemDocument.Name && t.Id != addOrEditSystemDocument.Id, true)) - { - //---系统中已存在同类型的同名文件。 - return ResponseOutput.NotOk(_localizer["SystemD_DuplicateFile"]); - } - - - _mapper.Map(addOrEditSystemDocument, document); - - #region 之前区分路径文件夹 现在不区分废弃 - - //if (document.FileTypeId != addOrEditSystemDocument.FileTypeId) - //{ - // var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName; - // var beforeFilePath = Path.Combine(rootPath, document.Path); - - // document.Path = document.Path.Replace(document.FileTypeId.ToString(), addOrEditSystemDocument.FileTypeId.ToString()); - - // var nowPath = Path.Combine(rootPath, document.Path); - - // if (File.Exists(beforeFilePath)) - // { - // File.Move(beforeFilePath, nowPath, true); - // File.Delete(beforeFilePath); - // } - - //} - - #endregion - - - var success = await _systemDocumentRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(document.Id.ToString()); - } - - - - } - - [HttpDelete("{systemDocumentId:guid}")] - public async Task AbandonSystemDocumentAsync(Guid systemDocumentId) - { - - await _systemDocumentRepository.UpdatePartialFromQueryAsync(systemDocumentId, u => new SystemDocument() { IsDeleted = true }); - - await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == systemDocumentId, x => new SystemDocConfirmedUser() - { - IsDeleted = true - }); - - await _systemDocConfirmedUserRepository.SaveChangesAsync(); - return ResponseOutput.Result(true); - } - - - - [HttpDelete("{systemDocumentId:guid}")] - public async Task DeleteSystemDocumentAsync(Guid systemDocumentId) - { - - if (await _systemDocumentRepository.Where(t => t.Id == systemDocumentId).AnyAsync(u => u.SystemDocConfirmedUserList.Any())) - { - //---已有用户阅读该文档,并签名,不允许删除。 - return ResponseOutput.NotOk(_localizer["SystemD_CannotDeleteSignedFile"]); - } - - var success = await _systemDocumentRepository.DeleteFromQueryAsync(t => t.Id == systemDocumentId, true, true); - - return ResponseOutput.Result(true); - } - - - /// - /// 获取需要签署的系统文档列表 - /// - /// - [HttpPost] - public async Task> getWaitSignSysDocList(SystemDocumentQuery inQuery) - { - - var isInternal = _userInfo.IsZhiZhun; - - var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - //外部人员 只签署 文档类型枚举值有值的 - .WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = _userInfo.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc - from confirm in cc.DefaultIfEmpty() - - join user in _userRoleRepository.Where() on _userInfo.Id equals user.Id - - select new UnionDocumentWithConfirmInfoView() - { - IsSystemDoc = true, - - Id = sysDoc.Id, - CreateTime = sysDoc.CreateTime, - IsDeleted = sysDoc.IsDeleted, - SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes, - Name = sysDoc.Name, - Path = sysDoc.Path, - FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN, - UpdateTime = sysDoc.UpdateTime, - - FullFilePath = sysDoc.Path, - - ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = user.LastName + " / " + user.FirstName, - UserName = user.UserName, - UserTypeId = user.UserTypeId, - UserTypeShortName = user.UserTypeRole.UserTypeShortName - }; - - return await query.WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null) - .WhereIf(inQuery.IsSigned == false, t => t.ConfirmTime == null) - .ToPagedListAsync(inQuery); - - - - } - - } -} diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs deleted file mode 100644 index cf302ec83..000000000 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ /dev/null @@ -1,855 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2022-01-05 09:17:03 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Application.Contracts; -using IRaCIS.Core.Application.Filter; -using IRaCIS.Core.Domain.Share; -using Microsoft.AspNetCore.Mvc; - -namespace IRaCIS.Core.Application.Services -{ - /// - /// TrialDocumentService - /// - [ApiExplorerSettings(GroupName = "Trial")] - public class TrialDocumentService(IRepository _trialDocumentRepository, - IRepository _trialDocUserTypeConfirmedUserRepository, - IRepository _trialRepository, - ISystemDocumentService _systemDocumentService, - IRepository _systemDocConfirmedUserRepository, - IRepository _systemDocNeedConfirmedUserTypeRepository, - IRepository _trialDocNeedConfirmedUserTypeRepository, - IRepository _systemDocumentRepository, - IRepository _trialUserRepository, - IRepository _trialDocConfirmedUserRepository, - IRepository _readingQuestionCriterionTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialDocumentService - { - - - - - /// - /// Setting 界面的 项目所有文档列表 - /// - /// - /// - [HttpPost] - public async Task> GetTrialDocumentList(TrialDocumentQuery inQuery) - { - - var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - .WhereIf(inQuery.UserTypeId != null, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId)) - .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, isEn_Us = _userInfo.IsEn_Us }); - - return await trialDocumentQueryable.ToPagedListAsync(inQuery); - } - - [HttpPost] - public async Task> GetTrialSignDocumentList(TrialDocQuery inQuery) - { - var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true) - .WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId) - .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - - join trialUser in _trialUserRepository.Where(t => t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId - join confirm in _trialDocConfirmedUserRepository.Where() on - new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc - - from confirm in cc.DefaultIfEmpty() - select new TrialSignDocView() - { - TrialCode = trialDoc.Trial.TrialCode, - ResearchProgramNo = trialDoc.Trial.ResearchProgramNo, - ExperimentName = trialDoc.Trial.ExperimentName, - Id = trialDoc.Id, - IsSystemDoc = false, - CreateTime = trialDoc.CreateTime, - FullFilePath = trialDoc.Path, - IsDeleted = trialDoc.IsDeleted, - Name = trialDoc.Name, - Path = trialDoc.Path, - FileTypeId = trialDoc.FileTypeId, - FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN, - UpdateTime = trialDoc.UpdateTime, - SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes, - - //IsConfirmed = confirm.ConfirmTime != null, - ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, - UserTypeId = trialUser.UserRole.UserTypeId, - UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName - - }; - - trialDocQueryable = trialDocQueryable.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - .WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null) - .WhereIf(inQuery.IsSigned == false, t => t.ConfirmTime == null); - - - return await trialDocQueryable.ToPagedListAsync(inQuery); - - } - - /// - /// 获取下一个未签名的文件 - /// - /// - /// - [HttpPost] - public async Task GetNextUnSignDocument(GetNextUnSignDocumentInDto inDto) - { - var result = new PageOutput() { }; - - if (inDto.TrialId != null) - { - result = (await this.GetUserDocumentList(new TrialUserDocUnionQuery() - { - Asc = inDto.Asc, - IsSign = false, - SortField = inDto.SortField, - TrialId = inDto.TrialId.Value, - PageIndex = 1, - PageSize = 1, - })).Data; - } - else - { - result = await _systemDocumentService.getWaitSignSysDocList(new SystemDocumentQuery() - { - PageIndex = 1, - IsSigned = false, - PageSize = 1, - Asc = false, - SortField = "UpdateTime", - }); - - } - - - if (result.CurrentPageData.Count > 0) - { - return result.CurrentPageData.First(); - } - else - { - return null; - } - - } - - /// - /// 具体用户看到的 系统文件列表 + 项目类型文档 - /// - /// - /// - [HttpPost] - public async Task>> GetUserDocumentList(TrialUserDocUnionQuery inQuery) - { - #region https://github.com/dotnet/efcore/issues/16243 操作不行 - ////系统文档查询 - //var systemDocumentQueryable = _systemDocumentRepository - // .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - // .WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - //.ProjectTo(_mapper.ConfigurationProvider, new { userId = _userInfo.Id, token = _userInfo.UserToken }); - - ////项目文档查询 - //var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId) - // .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - // .WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - // .ProjectTo(_mapper.ConfigurationProvider, new { userId = _userInfo.Id, token = _userInfo.UserToken }); - - //var unionQuery = systemDocumentQueryable.Union(trialDocQueryable); - // .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - // .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Type), t => t.Type.Contains(querySystemDocument.Type)); - #endregion - - #region 仅仅文档信息 - - ////系统文档查询 - //var systemDocumentQueryable = _systemDocumentRepository - // .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - // .WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - // .Select(t => new UnionDocumentView() - // { - // Id = t.Id, - // IsSystemDoc = true, - // CreateTime = t.CreateTime, - // FullFilePath = t.Path + "?access_token=" + _userInfo.UserToken, - // IsAbandon = t.IsAbandon, - // Name = t.Name, - // Path = t.Path, - // Type = t.Type, - // UpdateTime = t.UpdateTime, - // SignViewMinimumMinutes = t.SignViewMinimumMinutes, - - // }); - - ////项目文档查询 - //var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId) - // .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - // .WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - // .Select(t => new UnionDocumentView() - // { - // Id = t.Id, - // IsSystemDoc = false, - // CreateTime = t.CreateTime, - // FullFilePath = t.Path + "?access_token=" + _userInfo.UserToken, - // IsAbandon = t.IsAbandon, - // Name = t.Name, - // Path = t.Path, - // Type = t.Type, - // UpdateTime = t.UpdateTime, - // SignViewMinimumMinutes = t.SignViewMinimumMinutes, - - // }); - - #endregion - - var trialId = inQuery.TrialId; - - var trialInfo = await (_trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync()); - - //系统文档查询 - var systemDocumentQueryable = from needConfirmedUserType in _systemDocNeedConfirmedUserTypeRepository.Where(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId, ignoreQueryFilters: true) - .WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime) - .WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - - join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) - on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId - join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc - from confirm in cc.DefaultIfEmpty() - select new UnionDocumentWithConfirmInfoView() - { - IsSystemDoc = true, - - Id = needConfirmedUserType.SystemDocument.Id, - CreateTime = needConfirmedUserType.SystemDocument.CreateTime, - IsDeleted = needConfirmedUserType.SystemDocument.IsDeleted, - SignViewMinimumMinutes = needConfirmedUserType.SystemDocument.SignViewMinimumMinutes, - Name = needConfirmedUserType.SystemDocument.Name, - Path = needConfirmedUserType.SystemDocument.Path, - FileTypeId = needConfirmedUserType.SystemDocument.FileTypeId, - FileType = _userInfo.IsEn_Us ? needConfirmedUserType.SystemDocument.FileType.Value : needConfirmedUserType.SystemDocument.FileType.ValueCN, - UpdateTime = needConfirmedUserType.SystemDocument.UpdateTime, - - FullFilePath = needConfirmedUserType.SystemDocument.Path, - - //IsConfirmed = confirm.ConfirmTime != null, - ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, - UserTypeId = trialUser.UserRole.UserTypeId, - UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName - }; - - //项目文档查询 - var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - - join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId - join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on - new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc - from confirm in cc.DefaultIfEmpty() - select new UnionDocumentWithConfirmInfoView() - { - Id = trialDoc.Id, - IsSystemDoc = false, - CreateTime = trialDoc.CreateTime, - FullFilePath = trialDoc.Path, - IsDeleted = trialDoc.IsDeleted, - Name = trialDoc.Name, - Path = trialDoc.Path, - FileTypeId = trialDoc.FileTypeId, - FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN, - UpdateTime = trialDoc.UpdateTime, - SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes, - - //IsConfirmed = confirm.ConfirmTime != null, - ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, - UserTypeId = trialUser.UserRole.UserTypeId, - UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName - - }; - - #region 报错 奇怪的bug - var unionQuery = systemDocumentQueryable.Union(trialDocQueryable) - .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - .WhereIf(inQuery.IsSign == true, t => t.ConfirmTime != null) - .WhereIf(inQuery.IsSign == false, t => t.ConfirmTime == null); - - - - var result = await unionQuery.ToPagedListAsync(inQuery); - #endregion - - #region 临时方案 - - //var list1 = systemDocumentQueryable - // .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - // .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId) - // .WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null) - // .WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null).ToList(); - - //var list2 = trialDocQueryable - // .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - //.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId) - //.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null) - //.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null).ToList(); - - //var list3 = list1.Union(list2).ToList(); - - //var result=list3.ToPagedList(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc); - - #endregion - - - - - var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .CountAsync(); - - - var needSignSystemDocCount = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .CountAsync(); - - var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); - - - - var isManualGenerateTask = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAutoCreate == false).Any(); - var isAdditionalAssessment = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAdditionalAssessment == true - && t.TrialCriterionAdditionalAssessmentTypeList.Any(c =>/*c.AdditionalAssessmentType==Domain.Share.Reading.AdditionalAssessmentType.BrainMetastasis &&*/ c.IsSelected == true)).Any(); - - return ResponseOutput.Ok>(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, IsAdditionalAssessment = isAdditionalAssessment && isManualGenerateTask, TrialStatusStr = trialInfo.TrialStatusStr, TrialConfig = trialTaskConfig }); - } - - - - - /// - /// 获取确认列表情况 项目文档+系统文档+具体的人 - /// - /// - /// - [HttpPost] - public async Task>> GetDocumentConfirmList(DocumentTrialUnionQuery inQuery) - { - - - #region linq join 方式 - //var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocumentNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) - // join trialUser in _trialUserRepository.Where(t => t.TrialId == querySystemDocument.TrialId) - // .WhereIf(querySystemDocument.UserId != null, t => t.UserId == querySystemDocument.UserId) - // on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId - - // join confirm in _trialDocuserConfrimedRepository.AsQueryable() on trialUser.UserId equals confirm.ConfirmUserId into cc - // from confirm in cc.DefaultIfEmpty() - // select new UnionDocumentConfirmListView() - // { - // Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id, - // CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime, - // IsAbandon = trialDocumentNeedConfirmedUserType.TrialDocument.IsAbandon, - // SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes, - // Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name, - // Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path, - // Type = trialDocumentNeedConfirmedUserType.TrialDocument.Type, - // UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime, - - // UserConfirmInfo = /*confirm == null ? null : */new UnionDocumentUserConfirmView() - // { - - // ConfirmUserId = confirm.ConfirmUserId, - // ConfirmTime = confirm.ConfirmTime, - // RealName = trialUser.User.LastName + " / " + trialUser.User.LastName, - // UserName = trialUser.User.UserName, - // }, - - // FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path + "?access_token=" + _userInfo.UserToken - // }; - - #endregion - - var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync()); - - var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) - join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId) - .WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId) - on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId - - join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on - new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc - from confirm in cc.DefaultIfEmpty() - select new UnionDocumentWithConfirmInfoView() - { - IsSystemDoc = false, - - Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id, - CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime, - IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted, - SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes, - Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name, - Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path, - FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId, - FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN, - UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime, - //IsConfirmed= confirm.ConfirmTime!=null, - - - - ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, - UserTypeId = trialUser.UserRole.UserTypeId, - UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, - - FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path - }; - - - - var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime) - - join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId) - on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId - join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc - from confirm in cc.DefaultIfEmpty() - select new UnionDocumentWithConfirmInfoView() - { - IsSystemDoc = true, - - Id = needConfirmEdUserType.SystemDocument.Id, - CreateTime = needConfirmEdUserType.SystemDocument.CreateTime, - IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted, - SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes, - Name = needConfirmEdUserType.SystemDocument.Name, - Path = needConfirmEdUserType.SystemDocument.Path, - FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN, - FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId, - UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime, - //IsConfirmed = confirm.ConfirmTime != null, - - ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, - UserTypeId = trialUser.UserRole.UserTypeId, - UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, - - FullFilePath = needConfirmEdUserType.SystemDocument.Path - }; - - var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null)) - .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) - .WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null) - .WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null) - .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) - .WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId); - - var result = await unionQuery.ToPagedListAsync(inQuery); - - var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .CountAsync(); - - - var needSignSystemDocCount = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .CountAsync(); - - - return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr }); - } - - - /// - /// 项目下面的参与用户下拉 - /// - /// - /// - [HttpGet("{trialId:guid}")] - public async Task> GetTrialUserSelect(Guid trialId) - { - return await _trialUserRepository.Where(t => t.TrialId == trialId) - .Select(t => new TrialUserDto() { UserId = t.UserId, RealName = t.UserRole.FullName, UserName = t.UserRole.UserName }) - .ToListAsync(); - } - - - /// - /// 项目+系统的文档类型 下拉 - /// - /// - /// - [HttpGet("{trialId:guid}")] - public async Task GetTrialDocAndSystemDocType(Guid trialId) - { - var result = await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => new { FileType = _userInfo.IsEn_Us ? t.FileType.Value : t.FileType.ValueCN, t.FileTypeId }) - .Union(_systemDocumentRepository.Select(t => new { FileType = _userInfo.IsEn_Us ? t.FileType.Value : t.FileType.ValueCN, t.FileTypeId })) - .ToListAsync(); - - return ResponseOutput.Ok(result); - } - - [TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )] - //[Authorize(Policy = IRaCISPolicy.PM)] - public async Task AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument) - { - if (addOrEditTrialDocument.Id == null) - { - var entity = _mapper.Map(addOrEditTrialDocument); - - - if (await _trialDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditTrialDocument.FileTypeId && t.Name == addOrEditTrialDocument.Name && t.TrialId == addOrEditTrialDocument.TrialId, true)) - { - //---该项目中已经存在同类型的同名文件。 - return ResponseOutput.NotOk(_localizer["TrialD_DuplicateFileInProject"]); - } - - //entity.Id = NewId.NextGuid(); - await _trialDocumentRepository.AddAsync(entity, true); - return ResponseOutput.Ok(entity.Id.ToString()); - } - else - { - if (await _trialDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditTrialDocument.FileTypeId && t.Name == addOrEditTrialDocument.Name && t.Id != addOrEditTrialDocument.Id && t.TrialId == addOrEditTrialDocument.TrialId, true)) - { - //---该项目中已经存在同类型的同名文件。 - return ResponseOutput.NotOk(_localizer["TrialD_DuplicateFileInProject"]); - } - - var document = (await _trialDocumentRepository.Where(t => t.Id == addOrEditTrialDocument.Id, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync()).IfNullThrowException(); - - - - _mapper.Map(addOrEditTrialDocument, document); - - #region 不区分路径了 - - //if (document.FileTypeId != addOrEditTrialDocument.FileTypeId) - //{ - - - // var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName; - // var beforeFilePath = Path.Combine(rootPath, document.Path); - - // document.Path = document.Path.Replace(document.FileTypeId.ToString(), addOrEditTrialDocument.FileTypeId.ToString()); - - // var nowPath = Path.Combine(rootPath, document.Path); - - // if (File.Exists(beforeFilePath)) - // { - // File.Move(beforeFilePath, nowPath, true); - // File.Delete(beforeFilePath); - // } - - //} - - #endregion - - - var success = await _trialDocumentRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(document.Id.ToString()); - } - } - - - /// - /// 已签名的文档 不允许删除 - /// - /// - /// - /// - [HttpDelete("{trialId:guid}/{trialDocumentId:guid}")] - //[Authorize(Policy = IRaCISPolicy.PM)] - [TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )] - public async Task DeleteTrialDocument(Guid trialDocumentId, Guid trialId) - { - if (await _trialDocumentRepository.AsQueryable(true).Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any())) - { - //---已有用户阅读该文档,并签名,不允许删除。 - return ResponseOutput.NotOk(_localizer["TrialD_DocumentHasAlready"]); - } - - var success = await _trialDocumentRepository.BatchDeleteNoTrackingAsync(t => t.Id == trialDocumentId); - - return ResponseOutput.Result(success); - } - - - /// - /// 浏览文档说明时调用,记录第一次看的时间 - /// - /// - /// - /// - [HttpPut("{trialId:guid}/{documentId:guid}/{isSystemDoc:bool}")] - [UnitOfWork] - public async Task SetFirstViewDocumentTime(Guid documentId, bool isSystemDoc) - { - - var success = false; - if (isSystemDoc) - { - if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) - { - await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); - - } - - } - else - { - - if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) - { - - await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); - - } - - - } - - success = await _systemDocConfirmedUserRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(success); - } - - [HttpPut("{documentId:guid}")] - public async Task SetSystemDocFirstViewTime(Guid documentId) - { - if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) - { - await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); - - } - - var success = await _systemDocConfirmedUserRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(success); - } - - [HttpPut("{trialId:guid}/{documentId:guid}")] - public async Task SetTrialDocFirstViewTime(Guid documentId) - { - if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id)) - { - - await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now }); - - } - var success = await _trialDocConfirmedUserRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(success); - } - - /// - /// 用户 签名某个文档 可能是系统的,也可能是项目的 - /// - /// - [TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )] - public async Task UserConfirm(UserConfirmCommand userConfirmCommand) - { - - if (userConfirmCommand.isSystemDoc) - { - - var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id, true); - - if (sysDocConfirm.ConfirmTime != null) - { - //---该文件已经签名 - return ResponseOutput.NotOk(_localizer["TrialD_FileAlreadySigned"]); - } - - if (sysDocConfirm.IsDeleted) - { - //---文件已废除,签署失败! - return ResponseOutput.NotOk(_localizer["TrialD_ObsoleteFile"]); - } - - - sysDocConfirm.ConfirmTime = DateTime.Now; - sysDocConfirm.SignText = userConfirmCommand.SignText; - - - - await _systemDocConfirmedUserRepository.SaveChangesAsync(); - - - } - else - { - - var trialDocConfirm = await _trialDocUserTypeConfirmedUserRepository.FirstOrDefaultAsync(t => t.TrialDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id, true); - - if (trialDocConfirm.ConfirmTime != null) - { - //---该文件已经签名 - return ResponseOutput.NotOk(_localizer["TrialD_FileAlreadySigned"]); - } - - if (trialDocConfirm.IsDeleted) - { - //---文件已废除,签署失败! - return ResponseOutput.NotOk(_localizer["TrialD_ObsoleteFile"]); - } - - trialDocConfirm.ConfirmTime = DateTime.Now; - trialDocConfirm.SignText = userConfirmCommand.SignText; - - await _trialDocUserTypeConfirmedUserRepository.SaveChangesAsync(); - - } - - - return ResponseOutput.Ok(); - } - - - /// - /// 用户 废除某个文档 - /// - /// - /// - /// - [HttpPut("{documentId:guid}/{isSystemDoc:bool}")] - [TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt", "SignSystemDocNoTrialId" )] - public async Task UserAbandonDoc(Guid documentId, bool isSystemDoc) - { - if (isSystemDoc) - { - await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true }); - await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == documentId, x => new SystemDocConfirmedUser() - { - IsDeleted = true - }); - } - else - { - await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true }); - await _trialDocUserTypeConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.TrialDocumentId == documentId, x => new TrialDocConfirmedUser() - { - IsDeleted = true - }); - } - await _systemDocumentRepository.SaveChangesAsync(); - return ResponseOutput.Ok(); - } - - - #region 废弃 - - - /// - /// 从项目下参与者的维度 先看人员列表(展示统计数字) 点击数字 再看人员具体签署的 系统文档+项目文档(共用上面与人相关的具体文档列表) - /// - /// - /// - [HttpGet("{trialId:guid}")] - [Obsolete] - public List GetTrialUserDocumentList(Guid trialId) - { - var query = _trialUserRepository.Where(t => t.TrialId == trialId) - .Select(t => new TrialUserUnionDocumentView() - { - UserId = t.UserId, - UserName = t.UserRole.UserName, - RealName = t.UserRole.FullName, - UserTypeShortName = t.UserRole.UserTypeRole.UserTypeShortName, - TrialDocumentCount = t.Trial.TrialDocumentList.Count(u => u.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == t.UserRole.UserTypeId)), - TrialDocumentConfirmedCount = t.Trial.TrialDocumentList.SelectMany(u => u.TrialDocConfirmedUserList).Count(k => k.ConfirmUserId == t.UserId), - SystemDocumentConfirmedCount = t.UserRole.SystemDocConfirmedList.Count(), - //这样写不行 - //SystemDocumentCount = _systemDocumentRepository.Where(s => s.NeedConfirmedUserTypeList.Any(kk => kk.NeedConfirmUserTypeId == t.User.UserTypeId)) - // .WhereIf(!_userInfo.IsAdmin, s => s.IsAbandon == false || (s.IsAbandon == true && s.SystemDocConfirmedUserList.Any(uu => uu.ConfirmUserId == t.UserId))).Count() - SystemDocumentCount = t.UserRole.UserTypeRole.SystemDocNeedConfirmedUserTypeList.Where(cc => cc.NeedConfirmUserTypeId == t.UserRole.UserTypeId).Select(y => y.SystemDocument).Count() - }); - - return query.ToList(); - } - - - /// - /// 从 文档的维度 先看到文档列表(系统文档+项目文档 以及需要确认的人数 和已经确认人数) 点击数字查看某文档下面人确认情况 - /// - /// - /// - [HttpPost] - [Obsolete] - public async Task> GetTrialSystemDocumentList(DocumentTrialUnionQuery inQuery) - { - var systemDocumentQueryable = _systemDocumentRepository - .WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false) - .Select(t => new DocumentUnionWithUserStatView() - { - Id = t.Id, - IsSystemDoc = true, - CreateTime = t.CreateTime, - FullFilePath = t.Path, - IsDeleted = t.IsDeleted, - Name = t.Name, - Path = t.Path, - FileType = t.FileType.Value, - UpdateTime = t.UpdateTime, - SignViewMinimumMinutes = t.SignViewMinimumMinutes, - DocumentConfirmedUserCount = t.SystemDocConfirmedUserList.Count(), - - //DocumentUserCount= _trialUserRepository.Where(tu=>tu.TrialId== querySystemDocument.TrialId).Count(u=>t.NeedConfirmedUserTypeList.Any(cc=>cc.NeedConfirmUserTypeId== u.User.UserTypeId )) - DocumentUserCount = t.NeedConfirmedUserTypeList.SelectMany(u => u.UserTypeRole.UserList.SelectMany(b => b.UserTrials.Where(r => r.TrialId == inQuery.TrialId))).Count() - }); - - var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == inQuery.TrialId).Select(t => new DocumentUnionWithUserStatView() - { - Id = t.Id, - IsSystemDoc = false, - CreateTime = t.CreateTime, - FullFilePath = t.Path, - IsDeleted = t.IsDeleted, - Name = t.Name, - Path = t.Path, - FileType = t.FileType.Value, - UpdateTime = t.UpdateTime, - SignViewMinimumMinutes = t.SignViewMinimumMinutes, - - DocumentConfirmedUserCount = t.TrialDocConfirmedUserList.Count(), - DocumentUserCount = t.Trial.TrialUserList.Count(cc => t.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == cc.UserRole.UserTypeId)) - - }); - - var unionQuery = systemDocumentQueryable.Union(trialDocQueryable) - .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) - .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId); - - return await unionQuery.ToPagedListAsync(inQuery); - } - #endregion - - - - } -} diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs deleted file mode 100644 index 9d9a4fa68..000000000 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ /dev/null @@ -1,1591 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2022-10-20 11:52:17 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Application.Contracts; -using IRaCIS.Core.Application.Filter; -using IRaCIS.Core.Application.Helper; -using IRaCIS.Core.Application.Interfaces; -using IRaCIS.Core.Application.ViewModel; -using IRaCIS.Core.Domain.Share; -using IRaCIS.Core.Domain.Share.Common; -using IRaCIS.Core.Infra.EFCore.Common; -using IRaCIS.Core.Infrastructure; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using Spire.Doc; -using System.Linq.Dynamic.Core; -using System.Runtime.InteropServices; - -namespace IRaCIS.Core.Application.Service -{ - /// - /// TrialEmailNoticeConfigService - /// - [ApiExplorerSettings(GroupName = "Trial")] - public class TrialEmailNoticeConfigService(IRepository _trialEmailNoticeConfigRepository, - IRepository _trialEmailBlackUserRepository, - IRepository _emailNoticeConfigRepository, - IRepository _trialRepository, - IRepository _taskMedicalReviewRepository, - IRepository _readingGlobalTaskInfoRepository, - IRepository _visitTaskRepository, - IRepository _trialUserRepository, - IRepository _trialEmailNoticeUserRepository, - IRepository _subjectRepository, - IRepository _readModuleRepository, - IRepository _readingTableQuestionAnswerRepository, - IRepository _subjectVisitRepository, - IRepository _readingTaskQuestionAnswerRepository, - IRepository _readingQuestionCriterionTrialRepository, - IOptionsMonitor _systemEmailSendConfig, - IEmailSendService _emailSendService, - IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IWebHostEnvironment _hostEnvironment) : BaseService, ITrialEmailNoticeConfigService - { - - - - /// - /// 获取项目邮箱 - /// - /// - /// - [HttpPost] - public async Task GetTrialEmail(GetTrialEmailSetInDto inDto) - { - return await _trialRepository.Where(x => x.Id == inDto.TrialId, ignoreQueryFilters: true).Select(x => new GetTrialEmailSetOutDto() - { - TrialId = inDto.TrialId, - EmailAuthorizationCode = x.EmailAuthorizationCode, - EmailSMTPServerAddress = x.EmailSMTPServerAddress, - EmailFromEmail = x.EmailFromEmail, - EmailFromName = x.EmailFromName, - IsConfigureEmail = x.IsConfigureEmail, - EmailSMTPServerPort = x.EmailSMTPServerPort - - }).FirstAsync(); - } - - /// - /// 设置项目邮箱 - /// - /// - /// - public async Task SetTrialEmail(SetTrialEmailInDto inDto) - { - - await TestEmailConfigAsync(new TrialEmailNoticeConfigAddOrEdit() - { - - AuthorizationCode = inDto.EmailAuthorizationCode, - FromEmail = inDto.EmailFromEmail, - FromName = inDto.EmailFromName, - SMTPServerAddress = inDto.EmailSMTPServerAddress, - SMTPServerPort = inDto.EmailSMTPServerPort, - TrialId = inDto.TrialId, - }); - - await _trialRepository.UpdatePartialFromQueryAsync(inDto.TrialId, x => new Trial() - { - - EmailFromEmail = inDto.EmailFromEmail, - EmailFromName = inDto.EmailFromName, - EmailAuthorizationCode = inDto.EmailAuthorizationCode, - EmailSMTPServerAddress = inDto.EmailSMTPServerAddress, - EmailSMTPServerPort = inDto.EmailSMTPServerPort, - IsConfigureEmail = true, - }); - - - - await _trialEmailNoticeConfigRepository.BatchUpdateNoTrackingAsync(x => x.TrialId == inDto.TrialId, x => new TrialEmailNoticeConfig() - { - AuthorizationCode = inDto.EmailAuthorizationCode, - FromEmail = inDto.EmailFromEmail, - FromName = inDto.EmailFromName, - SMTPServerAddress = inDto.EmailSMTPServerAddress, - SMTPServerPort = inDto.EmailSMTPServerPort, - }); - - await _trialRepository.SaveChangesAsync(); - return ResponseOutput.Ok(); - } - - - - private async Task DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isHandSend, string pdAnswer, List taskIdList, List minUserIdList) - { - - var isNeedSend = true; - - //手动发送的时候,也有可能答案是是 此时是 这里不发送,发送已经生成的文件 - if (pdAnswer == "是" && isHandSend == null) - { - isNeedSend = true; - - } - else - { - //正常阅片为否的 - if (isHandSend == null) - { - isNeedSend = false; - - //生成任务 - 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.Distinct()) - }, true); - - } - } - else if (isHandSend == true) - { - //手动发送 - isNeedSend = false; - } - else - { - // 医学审核确认未否了 才发 - isNeedSend = true; - } - } - - return isNeedSend; - - } - - /// - /// 测试邮件 带附件 填充word - /// - /// - /// 为空 代表 正常任务自动发送,为true 代表医学审核手动发送 为false 代表医学审核自动发送 - /// - /// - /// - /// - public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isHandSend, EmailStoreSendMode emailStoreMode, string sendFileRelativePath) - { - var isEn_us = _userInfo.IsEn_Us; - EmailBusinessScenario businessScenarioEnum = EmailBusinessScenario.None; - - #region 任务关联的项目配置 标准信息及配置,subject 信息 - var taskInfo = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => new - { - - t.Trial.ResearchProgramNo, - t.Subject.TrialSite.TrialSiteCode, - SubjectCode = t.Subject.Code, - t.Trial.Sponsor, - t.Trial.IsEnrollementQualificationConfirm, - t.Trial.IsPDProgressView, - - - VisitEarliestScanDate = t.SourceSubjectVisit.EarliestScanDate, - VisitName = (string?)t.SourceSubjectVisit.VisitName, - IsFinalVisit = (bool?)t.SourceSubjectVisit.IsFinalVisit, - PDState = (PDStateEnum?)t.SourceSubjectVisit.PDState, - IsEnrollmentConfirm = (bool?)t.SourceSubjectVisit.IsEnrollmentConfirm, - IsBaseline = (bool?)t.SourceSubjectVisit.IsBaseLine, - - - ModuleEarliestScanDate = t.ReadModule.SubjectVisit.EarliestScanDate, - ModuleVisitName = (string?)t.ReadModule.SubjectVisit.VisitName, - MoudulePDState = (PDStateEnum?)t.ReadModule.SubjectVisit.PDState, - - t.SourceSubjectVisitId, - t.SouceReadModuleId, - t.SubjectId, - t.Subject.TrialSiteId, - - t.DoctorUserId, - t.ReadingTaskState, - t.ReadingCategory, - t.SignTime, - //仲裁规则 - t.TrialReadingCriterion.ArbitrationRule, - //单双中 - t.TrialReadingCriterion.ReadingType, - - t.TrialReadingCriterion.CriterionType, - //有序与否 - t.TrialReadingCriterion.IsReadingTaskViewInOrder, - - t.TrialId, - - - - t.IsAnalysisCreate, - t.TrialReadingCriterionId, - }).FirstNotNullAsync(); - - - if (taskInfo.IsAnalysisCreate) - { - return string.Empty; - } - - #endregion - - - #region 任务 -邮件场景区分 - - if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned) - { - //入组确认场景 - if (taskInfo.IsEnrollmentConfirm == true && taskInfo.IsEnrollementQualificationConfirm == true && taskInfo.IsBaseline == true) - { - businessScenarioEnum = EmailBusinessScenario.EnrollConfirmed; - - - } - //PD确认场景 - else if (taskInfo.IsPDProgressView && - (taskInfo.PDState == PDStateEnum.PDProgress && taskInfo.SourceSubjectVisitId != null) || - (taskInfo.SouceReadModuleId != null && taskInfo.MoudulePDState == PDStateEnum.PDProgress)) - { - businessScenarioEnum = EmailBusinessScenario.PDConfirmed; - } - else - { - return string.Empty; - } - - } - else - { - //---进行邮件发送前,该任务必须已签名完成并已经触发完成相应的任务生成 - throw new BusinessValidationFailedException(_localizer["TrialEmailN_TaskNotSigned"]); - } - - - - #endregion - - - #region 邮件内容装配 - - Func topicAndHtmlFunc = trialEmailConfig => - { - var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, taskInfo.ResearchProgramNo, taskInfo.SubjectCode); - - var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN, - StaticData.EmailSend.EmailNamePlaceholder, taskInfo.ResearchProgramNo, taskInfo.SubjectCode); - - - return (topicStr, htmlBodyStr, isEn_us, null); - }; - - - var (trialEmailConfig, sendEmailConfig) = await _emailSendService.BuildEmailConfig(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId, taskInfo.TrialReadingCriterionId); - - #endregion - - - //自动发送 - if (sendEmailConfig != null && trialEmailConfig != null) - { - #region 不同标准 不同项目配置 发送邮件的时机 处理具体逻辑 - - var answer = "否"; - var isNeedSend = true; - var minUserIdList = _trialUserRepository.Where(t => t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList(); - - - - //入组确认 根据每个标准配置的是否自动发送,发送邮件与否 - if (businessScenarioEnum == EmailBusinessScenario.EnrollConfirmed) - { - if (await _readingTableQuestionAnswerRepository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() && - x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion)) - { - answer = "是"; - } - - - //如果其他阅片人已经做了,说明发送了入组确认报告,第二个人做完就不发送了 - - //入组确认一直交给第一个人,如果第一个人重阅 还未做完,第二个人先做完了,此时不发 - - 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; - } - else - { - isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); - - - if (answer == "是") - { - //把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否) - var urgent = _subjectVisitRepository.Where(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault(); - - if (urgent?.IsUrgent == false || urgent?.IsSubjectUrgent == false) - { - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && - t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false }); - } - } - - - } - } - else if (businessScenarioEnum == EmailBusinessScenario.PDConfirmed) - { - - - //有序 - - if (taskInfo.IsReadingTaskViewInOrder == ReadingOrder.InOrder) - { - - - - //双重 - if (taskInfo.ReadingType == ReadingMethod.Double) - { - - - //仲裁在访视上 就没有全局阅片 没有阅片期 - if (taskInfo.ArbitrationRule == ArbitrationRule.Visit) - { - //找到 访视,裁判 所有有效任务(不可能有全局的) 访视和裁判任务的SourceSubjectVisitId 一样 - 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 if (taskInfo.ArbitrationRule == ArbitrationRule.Reading) - { - //是访视任务 不可能是裁判任务(访视上不会生成裁判),也不会是全局任务(全局任务 SourceSubjectVisitId=null ) - if (taskInfo.SourceSubjectVisitId != null) - { - - //访视类型的任务 根本就不需要发送邮件 - - isNeedSend = false; - - } - //是全局任务 或者全局的裁判任务 (如果是全局任务,那么此时裁判任务已经生成) - else if (taskInfo.SouceReadModuleId != null) - { - var taskList = await _visitTaskRepository.Where(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.SouceReadModuleId == taskInfo.SouceReadModuleId - && (t.ReadingCategory == ReadingCategory.Global || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync(); - - //两个全局没有裁判 - if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Global) == 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 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Global).Count() == 2) - { - - var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId!.Value; - answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Global, 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 - { - //---发送PD 进展邮件中发现任务数据有问题! - throw new BusinessValidationFailedException(_localizer["TrialEmailN_PDProgressEmailTask"]); - } - - - - } - else - { - - //---双重有序阅片 没有定义该仲裁规则处理逻辑,请联系业务和后台开发核查! - throw new BusinessValidationFailedException(_localizer["TrialEmailN_DoubleBlindedError"]); - } - - - } - - //屏蔽单重阅片添加 - else - { - isNeedSend = false; - return string.Empty; - } - - #region 发邮件屏蔽单重的 - ////单重 - //else if (taskInfo.ReadingType == ReadingMethod.Single) - //{ - // //仲裁在访视上 或者在阅片期 - // if (taskInfo.ArbitrationRule != ArbitrationRule.None) - // { - - //---单重有序阅片配置有误(不应该有仲裁对象配置),请核查! - // throw new BusinessValidationFailedException(_localizer["TrialEmailN_SingleBlindedSet"]); - // } - - - // //要求PD 确认的访视 是截止访视 还是非截止访视(根据该访视有没有配置阅片期来判断) - - // if (taskInfo.ReadingCategory == ReadingCategory.Visit) - // { - // //存在阅片期 那么就是截止访视 - // if (await _readModuleRepository.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(_localizer["TrialEmailN_SingleBlindedSequenced"]); - // } - - // isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList); - - - //} - //else - //{ - //---有序阅片配置有误(应为单重或者双重阅片),请核查! - // throw new BusinessValidationFailedException(_localizer["TrialEmailN_BlindedSequencedReading"]); - //} - - #endregion - - - - - } - //屏蔽无序阅片添加 - else - { - 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(_localizer["TrialEmailN_UnblindedSequencedReading"]); - // } - - //} - - #endregion - } - else - { - isNeedSend = false; - } - - #endregion - - - #region MiniWord 组织字典 发送 - - - if (emailStoreMode == EmailStoreSendMode.NotStoreLocalOnlySentEmail) - { - - var phyPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, sendFileRelativePath); - - var attachPrefix = $"{taskInfo.SubjectCode}"; - - //先预先生成了邮件,发送预先生成的邮件 - sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig() - { - FileName = $"{attachPrefix}_{Path.GetFileNameWithoutExtension(_userInfo.IsEn_Us ? trialEmailConfig.AttachName : trialEmailConfig!.AttachNameCN)}.pdf", - - FileStream = File.OpenRead(phyPath), - }); - - - await SendEmailHelper.SendEmailAsync(sendEmailConfig); - - return string.Empty; - } - - var value = new Dictionary() - { - ["SponsorName"] = taskInfo.Sponsor, - ["ResearchProgramNo"] = taskInfo.ResearchProgramNo, - ["TrialSiteCode"] = taskInfo.TrialSiteCode, - ["SubjectCode"] = taskInfo.SubjectCode, - ["VisitName"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitName : taskInfo.ModuleVisitName, - ["EarliestScanDate"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitEarliestScanDate?.ToString("yyyy-MM-dd") : taskInfo.ModuleEarliestScanDate?.ToString("yyyy-MM-dd"), - ["SignTime"] = taskInfo.SignTime?.ToString("yyyy-MM-dd"), - ["Result"] = answer - - }; - - var path = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, _userInfo.IsEn_Us ? trialEmailConfig.AttachPath : trialEmailConfig.AttachCNPath); - - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.TrialSiteId, taskInfo.SubjectId, true); - - if (emailStoreMode == EmailStoreSendMode.StoreLocalSend || emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail) - { - - MemoryStream wordMemoryStream = new MemoryStream(); - - - MiniSoftware.MiniWord.SaveAsByTemplate(wordMemoryStream, path, value); - - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - Document document = new Document(); - - document.LoadFromStream(wordMemoryStream, FileFormat.Docx); - - document.SaveToFile(serverFilePath, FileFormat.PDF); - } - else - { - var wordStoreServerPath = Path.Combine(Path.GetDirectoryName(serverFilePath), Path.GetFileNameWithoutExtension(serverFilePath) + ".docx"); - - using (FileStream fileStream = new FileStream(wordStoreServerPath, FileMode.Create, FileAccess.Write)) - { - wordMemoryStream.WriteTo(fileStream); - } - FileConvertHelper.ConvertWordToPdf(wordStoreServerPath, Path.GetDirectoryName(serverFilePath)); - - File.Delete(wordStoreServerPath); - } - - - - } - //手动生成发送的邮件内容,但是并不发送 - if (emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail) - { - isNeedSend = false; - - return relativePath; - } - - - //正常的即时生成邮件 并发送邮件 - if (isNeedSend) - { - - - MemoryStream wordMemoryStream = new MemoryStream(); - MemoryStream pdfMemoryStream = new MemoryStream(); - - - MiniSoftware.MiniWord.SaveAsByTemplate(wordMemoryStream, path, value); - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - Document document = new Document(); - document.LoadFromStream(wordMemoryStream, FileFormat.Docx); - document.SaveToStream(pdfMemoryStream, FileFormat.PDF); - - } - else - { - var wordStoreServerPath = Path.Combine(Path.GetDirectoryName(serverFilePath), Path.GetFileNameWithoutExtension(serverFilePath) + ".docx"); - - using (FileStream fileStream = new FileStream(wordStoreServerPath, FileMode.Create, FileAccess.Write)) - { - wordMemoryStream.WriteTo(fileStream); - } - FileConvertHelper.ConvertWordToPdf(wordStoreServerPath, Path.GetDirectoryName(serverFilePath)); - - File.Delete(wordStoreServerPath); - - using (FileStream fileStream = new FileStream(serverFilePath, FileMode.Open, FileAccess.Read)) - { - fileStream.CopyTo(pdfMemoryStream); - } - - } - - pdfMemoryStream.Seek(0, SeekOrigin.Begin); - sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig() - { - FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(_userInfo.IsEn_Us ? trialEmailConfig.AttachName : trialEmailConfig.AttachNameCN)}.pdf", - - FileStream = pdfMemoryStream - }); - - - await SendEmailHelper.SendEmailAsync(sendEmailConfig); - - } - - - - return string.Empty; - - - - - - #endregion - } - else - { - return string.Empty; - } - - - - - - } - - - - /// - /// 手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示 - /// - /// - - /// - [HttpPost] - public async Task ManualGenerateEmailFile(GenerateEmailCommand generateEmailCommand) - { - var subjectId = generateEmailCommand.SubjectId; - var businessScenarioEnum = generateEmailCommand.BusinessScenarioEnum; - var trialReadingCriterionId = generateEmailCommand.TrialReadingCriterionId; - - - var trialConfig = await _subjectRepository.Where(t => t.Id == subjectId).Select(t => new { t.Trial.IsEnrollementQualificationConfirm, t.Trial.IsPDProgressView }).FirstNotNullAsync(); - - //找到入组确认 或者Pd 进展 已生成任务的 访视 - var subjectVisitList = await _subjectVisitRepository.Where(t => t.SubjectId == subjectId & t.CheckState == CheckStateEnum.CVPassed && (t.IsEnrollmentConfirm == true || t.PDState == PDStateEnum.PDProgress)).ToListAsync(); - - if (businessScenarioEnum == EmailBusinessScenario.EnrollConfirmed) - { - - if (trialConfig.IsEnrollementQualificationConfirm == false) - { - //---项目未配置入组确认! - return ResponseOutput.NotOk(_localizer["TrialEmailN_InCons"]); - - } - var exisitBaseline = subjectVisitList.FirstOrDefault(t => t.IsEnrollmentConfirm); - if (exisitBaseline == null) - { - //---不存在配置了入组确认的并且生成任务的基线访视 - return ResponseOutput.NotOk(_localizer["TrialEmailN_NoBaseLine"]); - } - else - { - //入组确认不用管项目的 有序 无序 单重 双重 阅片 - - //找到最早签名的 - 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(); - - - if (firstSignTask != null) - { - 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(); - - //如果存在做完的该任务 - - if (task == null) - { - //---做入组确认的阅片人基线任务没有阅片完! - return ResponseOutput.NotOk(_localizer["TrialEmailN_IncompBase"]); - } - else - { - var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - - if (string.IsNullOrEmpty(filePath)) - { - //---邮件手动生成失败,请联系开发核实该场景失败原因 - return ResponseOutput.NotOk(_localizer["TrialEmailN_EmailFail"]); - } - else - { - return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - - } - - - } - } - else - { - //---当前未有阅片人读完基线任务! - return ResponseOutput.NotOk(_localizer["TrialEmailN_NoReader"]); - } - - - - - - } - } - - else if (businessScenarioEnum == EmailBusinessScenario.PDConfirmed) - { - - if (trialConfig.IsPDProgressView == false) - { - //---项目未配置PD进展! - return ResponseOutput.NotOk(_localizer["TrialEmailN_NoPDConfig"]); - } - - //是否是截止访视 截止访视在全局发 否则就在当前访视发 - - var pdSubjectVisitIdList = subjectVisitList.Where(t => t.PDState == PDStateEnum.PDProgress).OrderBy(t => t.VisitNum).Select(t => (Guid?)t.Id).ToList(); - - if (pdSubjectVisitIdList.Count == 0) - { - //---不存在配置了PD进展的并且生成任务的访视 - return ResponseOutput.NotOk(_localizer["TrialEmailN_NoPDTasks"]); - } - - - var currentLatestPdVisitId = pdSubjectVisitIdList.Last(); - //标准配置 - var trialReadingCriterionConfig = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == trialReadingCriterionId).Select(t => new - { TrialReadingCriterionId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder, t.CriterionType, t.ArbitrationRule }).FirstNotNullAsync(); - - // 项目双重 - if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Double && trialReadingCriterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder) - { - //仲裁在访视上面 - if (trialReadingCriterionConfig.ArbitrationRule == ArbitrationRule.Visit) - { - //在两位阅片人读完访视后,如果有裁判者等裁判读完,如果无裁判则等第二个人的读完 - - var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == currentLatestPdVisitId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false - && t.TaskState == TaskState.Effect && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync(); - - var totalTaskCount = taskList.Count; - var finishedCount = taskList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).Count(); - - - //发送随访的 - if (totalTaskCount == 2 && totalTaskCount == finishedCount) - { - var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Visit); - - var filePath = await BaseBusinessScenarioSendEmailAsync(task!.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - - return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - } - //发送全局 - else if (totalTaskCount == 3 && totalTaskCount == finishedCount) - { - var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Judge); - - var filePath = await BaseBusinessScenarioSendEmailAsync(task!.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - - return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - } - else - { - //---当前受试者最新PD访视阅片任务完成状态不符合发送条件 - return ResponseOutput.NotOk(_localizer["TrialEmailN_PDNotFinished"]); - } - - } - //仲裁在阅片期上 - else if (trialReadingCriterionConfig.ArbitrationRule == ArbitrationRule.Reading) - { - var existReadModule = await _readModuleRepository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectVisitId == currentLatestPdVisitId && t.ReadingSetType == ReadingSetType.ImageReading) - .FirstOrDefaultAsync(); - - if (existReadModule == null) - { - //---项目配置了阅片期仲裁,但是当前受试者最新PD访视没有影像学阅片期 - return ResponseOutput.NotOk(_localizer["TrialEmailN_PDNoImaging"]); - } - else - { - var taskList = await _visitTaskRepository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.SouceReadModuleId == existReadModule.Id - && (t.ReadingCategory == ReadingCategory.Global || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync(); - - var totalTaskCount = taskList.Count; - var finishedCount = taskList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).Count(); - - - - //发送全局的 - if (totalTaskCount == 2 && totalTaskCount == finishedCount) - { - var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Global); - - var filePath = await BaseBusinessScenarioSendEmailAsync(task!.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - - return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - } - //发送全局裁判的 - else if (totalTaskCount == 3 && totalTaskCount == finishedCount) - { - var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Judge); - - var filePath = await BaseBusinessScenarioSendEmailAsync(task!.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - - return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - } - - - else - { - //---当前受试者最新PD访视阅片期任务完成状态不符合发送条件 - return ResponseOutput.NotOk(_localizer["TrialEmailN_PDPhaseNotFinished"]); - } - } - - - } - else - { - //---未定义该仲裁规则发送业务逻辑! - return ResponseOutput.NotOk(_localizer["TrialEmailN_NoRuleDefined"]); - } - } - - #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(); - - - // if (task == null) - // { - // return ResponseOutput.NotOk("当前受试者最新PD访视任务未阅片完成"); - // } - // else - // { - // //存在阅片期 那么就是截止访视 - - // var existReadModule = await _readModuleRepository.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(); - - - // 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("当前受试者阅片期任务未阅片完成"); - // } - - // } - // else//非截止访视 在访视读完后,发送 - // { - // var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty); - - // return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id }); - // } - // } - - - //} - #endregion - - else - { - //---当前项目配置,不满足双重有序阅片,不满足发送条件! - return ResponseOutput.NotOk(_localizer["TrialEmailN_NoDoubleOrder"]); - } - - } - - else - { - //---当前项目配置,未定义发送业务逻辑! - return ResponseOutput.NotOk(_localizer["TrialEmailN_NoSendLogicDefined"]); - } - - - - - } - - /// - /// 手动发送邮件 - /// - /// - /// - /// - [HttpPut] - public async Task ManualSendEmail(Guid visitTaskId, string sendFileRelativePath) - { - var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.NotStoreLocalOnlySentEmail, sendFileRelativePath); - - return ResponseOutput.Ok(); - - } - - /// - /// - /// - /// 任务Id - /// 任务类型 - /// 标准类型 - /// 是否是全局产生(区分裁判任务) - /// - /// - private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType, bool? IsGlobalGenerate = null) - { - - var answer = string.Empty; - - ReadingTaskQuestionAnswer visitQuestionAnswer = null; - - ReadingTaskQuestionAnswer globalQuestionAnswer = null; - - - - switch (criterionType) - { - - - case CriterionType.RECIST1Point1: - - if (readingCategory == ReadingCategory.Visit) - { - - visitQuestionAnswer = await _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync(); - - - answer = visitQuestionAnswer.Answer; - } - else if (readingCategory == ReadingCategory.Global) - { - var questionAnsewer = await _readingGlobalTaskInfoRepository.Where(t => t.GlobalTaskId == visitTaskId && t.TrialReadingQuestion.QuestionType == QuestionType.Tumor).OrderByDescending(c => c.VisitTask.VisitTaskNum).FirstNotNullAsync(); - - - answer = questionAnsewer.Answer; - if (string.IsNullOrEmpty(questionAnsewer.Answer)) - { - answer = await _readingTaskQuestionAnswerRepository.Where(t => questionAnsewer.TaskId == t.VisitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor) - .Select(t => t.Answer).FirstOrDefaultAsync(); - } - - } - //else if (readingCategory == ReadingCategory.Judge) - //{ - // var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync(); - - // var questionAnsewer = await _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == judgeResultTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync(); - - - // answer = questionAnsewer.Answer; - //} - else - { - //---不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑 - throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidTaskTypeForEmailSending"]); - } - - if (answer == OverallAssessment.PD.GetEnumInt()) - { - answer = "是"; - } - else - { - answer = "否"; - } - - break; - - case CriterionType.PCWG3: - if (readingCategory == ReadingCategory.Visit) - { - - visitQuestionAnswer = await _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync(); - - - answer = visitQuestionAnswer.Answer; - } - else if (readingCategory == ReadingCategory.Global) - { - var questionAnsewer = await _readingGlobalTaskInfoRepository.Where(t => t.TaskId == visitTaskId && t.TrialReadingQuestion.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync(); - - answer = questionAnsewer.Answer; - } - //else if (readingCategory == ReadingCategory.Judge) - //{ - // //var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync(); - - // var questionAnsewer = await _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync(); - - // answer = questionAnsewer.Answer; - //} - else - { - //---不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑 - throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidTaskTypeForEmailSending"]); - } - - if (answer == VisitTumorEvaluation.PD.GetEnumInt()) - { - answer = "是"; - } - if (answer == VisitTumorEvaluation.ND.GetEnumInt()) - { - answer = "ND"; - } - if (answer == VisitTumorEvaluation.NE.GetEnumInt()) - { - answer = "NE"; - } - else - { - answer = "否"; - } - break; - case CriterionType.SelfDefine: - case CriterionType.mRECISTMesothelioma: - case CriterionType.RECIL: - case CriterionType.RECIST1Point0: - case CriterionType.WHO: - case CriterionType.PERCIST: - case CriterionType.Forrest: - case CriterionType.Lugano2014: - case CriterionType.IRECIST1Point1: - case CriterionType.RANO_BM: - case CriterionType.RANO: - case CriterionType.IWCLL2018: - case CriterionType.mRECISTHCC: - case CriterionType.Cheson2007: - case CriterionType.IMWG2016: - default: - - //---该标准任务还未定义PD获取逻辑,联系业务和后台开发协商后补充 - throw new BusinessValidationFailedException(_localizer["TrialEmailN_PDLogicNotDefined"]); - } - - - - return answer; - - - - - } - - - /// - /// 选择人员下拉 - /// - /// - /// - public async Task> GetTrialUserTypeSelectList(Guid trialId) - { - - var query = _trialUserRepository.Where(t => t.TrialId == trialId, false, true).IgnoreQueryFilters().Select(t => t.UserRole.UserTypeRole).Distinct() - - .ProjectTo(_mapper.ConfigurationProvider); - - return await query.ToListAsync(); - - } - - /// - /// 黑名单用户Id 列表 - /// - /// - /// - public async Task> GetTrialUserIdSelectList(Guid trialEmailNoticeConfigId) - { - - var trialEmailNoticeConfig = await _trialEmailNoticeConfigRepository.Where(t => t.Id == trialEmailNoticeConfigId).Include(t => t.TrialEmailNoticeUserList).FirstNotNullAsync(); - - var trialId = trialEmailNoticeConfig.TrialId; - - var userTypeList = trialEmailNoticeConfig.TrialEmailNoticeUserList.Select(t => t.UserType).ToList(); - - - var query = _trialUserRepository.Where(t => t.TrialId == trialId && userTypeList.Contains(t.UserRole.UserTypeEnum), false, true).IgnoreQueryFilters() - .Select(t => new TrialSelectUser() - { - UserId = t.UserId, - UserName = t.UserRole.UserName, - RealName = t.UserRole.FullName, - UserTypeEnum = t.UserRole.UserTypeEnum - }).Distinct(); - - return await query.ToListAsync(); - } - - /// - /// 获取系统 邮件配置 勾选列表 - /// - /// - /// - [HttpPost] - public async Task> GetSysEmailNoticeConfigList(EmailNoticeConfigQuery inQuery) - { - var trialConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First(); - - var emailNoticeConfigQueryable = _emailNoticeConfigRepository - .WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) - .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) - .WhereIf(inQuery.IsReturnRequired != null, t => t.IsReturnRequired == inQuery.IsReturnRequired) - .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) - .WhereIf(inQuery.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == inQuery.IsDistinguishCriteria) - .WhereIf(inQuery.BusinessModuleEnum != null, t => t.BusinessModuleEnum == inQuery.BusinessModuleEnum) - .WhereIf(inQuery.EmailUrgentEnum != null, t => t.EmailUrgentEnum == inQuery.EmailUrgentEnum) - .WhereIf(inQuery.ToUserType != null, t => t.EmailNoticeUserTypeList.Any(t => t.UserType == inQuery.ToUserType && t.EmailUserType == EmailUserType.To)) - .WhereIf(inQuery.CopyUserType != null, t => t.EmailNoticeUserTypeList.Any(t => t.UserType == inQuery.CopyUserType && t.EmailUserType == EmailUserType.Copy)) - .WhereIf(trialConfig.IsEnrollementQualificationConfirm == false, t => t.BusinessModuleEnum != BusinessModule.EligibilityVerification) - .WhereIf(trialConfig.IsPDProgressView == false, t => t.BusinessModuleEnum != BusinessModule.PDVerification) - .WhereIf(trialConfig.IsPDProgressView == false && trialConfig.IsEnrollementQualificationConfirm == false, t => t.BusinessModuleEnum != BusinessModule.PDVerification - && t.BusinessModuleEnum != BusinessModule.EligibilityVerification) - .ProjectTo(_mapper.ConfigurationProvider, new { trialId = inQuery.TrialId }); - - return await emailNoticeConfigQueryable.ToPagedListAsync(inQuery); - } - - public async Task BatchAddEnrollOrPdEmailConfig(Guid trialId) - { - var trialConfig = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First(); - - var emailNoticeConfigQueryable = _emailNoticeConfigRepository - - .WhereIf(trialConfig.IsEnrollementQualificationConfirm == true && trialConfig.IsPDProgressView == false, t => t.BusinessModuleEnum == BusinessModule.EligibilityVerification || t.BusinessModuleEnum == BusinessModule.Eligibility_PDVerification) - .WhereIf(trialConfig.IsEnrollementQualificationConfirm == false && trialConfig.IsPDProgressView == true, t => t.BusinessModuleEnum == BusinessModule.PDVerification || t.BusinessModuleEnum == BusinessModule.Eligibility_PDVerification) - .WhereIf(trialConfig.IsPDProgressView == true && trialConfig.IsEnrollementQualificationConfirm == true, t => t.BusinessModuleEnum == BusinessModule.PDVerification - || t.BusinessModuleEnum == BusinessModule.EligibilityVerification || t.BusinessModuleEnum == BusinessModule.Eligibility_PDVerification) - .ProjectTo(_mapper.ConfigurationProvider, new { trialId = trialId }); - - - var list = await emailNoticeConfigQueryable.ToListAsync(); - - var addList = _mapper.Map>(list.Where(t => t.IsHaveSelected == false).ToList()); - - foreach (var item in addList) - { - item.TrialId = trialId; - } - - return await BatchAddSysEmailConfig(addList); - - } - /// - /// 批量勾选 传递列表每行数据,后台进行处理转换,建立关联关系 - /// - /// - /// - public async Task BatchAddSysEmailConfig(List batchAddList) - { - if (!batchAddList.Any()) - { - return ResponseOutput.Ok(); - } - - var first = batchAddList.First(); - var trialId = first.TrialId; - - var emailConfig = await _trialRepository.Where(t => t.Id == trialId).Select(x => new - { - TrialId = x.Id, - EmailAuthorizationCode = x.EmailAuthorizationCode, - EmailSMTPServerAddress = x.EmailSMTPServerAddress, - EmailFromEmail = x.EmailFromEmail, - EmailFromName = x.EmailFromName, - IsConfigureEmail = x.IsConfigureEmail, - EmailSMTPServerPort = x.EmailSMTPServerPort - - }).FirstNotNullAsync(); - - var list = await _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Select(t => new { t.CriterionType, TrialReadingCriterionId = t.Id }).ToListAsync(); - - - var addList = _mapper.Map>(batchAddList); - - - foreach (var item in addList) - { - item.SysEmailNoticeConfigId = item.Id; - item.Id = Guid.Empty; - - item.AuthorizationCode = emailConfig.EmailAuthorizationCode; - item.FromEmail = emailConfig.EmailFromEmail; - item.SMTPServerAddress = emailConfig.EmailSMTPServerAddress; - item.FromName = emailConfig.EmailFromName; - item.SMTPServerPort = emailConfig.EmailSMTPServerPort; - item.IsAutoSend = true; - item.IsEnable = true; - - item.TrialReadingCriterionId = list.FirstOrDefault(t => t.CriterionType == item.CriterionTypeEnum)?.TrialReadingCriterionId; - - item.TrialEmailNoticeUserList.AddRange(batchAddList.Where(t => t.Id == item.SysEmailNoticeConfigId) - .SelectMany(t => t.ToUserTypeList).Select(t => new TrialEmailNoticeUser() { EmailUserType = EmailUserType.To, UserType = t })); - - item.TrialEmailNoticeUserList.AddRange(batchAddList.Where(t => t.Id == item.SysEmailNoticeConfigId) - .SelectMany(t => t.CopyUserTypeList).Select(t => new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserType = t })); - - - await _trialEmailNoticeConfigRepository.AddAsync(item); - - } - - await _trialEmailNoticeConfigRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(); - - - } - - - - [HttpPost] - public async Task>> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery) - { - //await SyncSystemEmainCofigDocListAsync(inQuery.TrialId); - - var trialConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First(); - - var trialEmailNoticeConfigQueryable = _trialEmailNoticeConfigRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(inQuery.IsDistinguishCriteria == false, t => t.TrialReadingCriterionId == null) - .WhereIf(inQuery.IsDistinguishCriteria == true, t => t.CriterionTypeEnum != null) - .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) - .WhereIf(inQuery.EmailUrgentEnum != null, t => t.EmailUrgentEnum == inQuery.EmailUrgentEnum) - .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) - .WhereIf(inQuery.ToUserType != null, t => t.TrialEmailNoticeUserList.Any(t => t.UserType == inQuery.ToUserType && t.EmailUserType == EmailUserType.To)) - .WhereIf(inQuery.CopyUserType != null, t => t.TrialEmailNoticeUserList.Any(t => t.UserType == inQuery.CopyUserType && t.EmailUserType == EmailUserType.Copy)) - - .WhereIf(inQuery.BusinessModuleEnum != null, t => t.BusinessModuleEnum == inQuery.BusinessModuleEnum) - - .ProjectTo(_mapper.ConfigurationProvider); - - var sortField = string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialEmailNoticeConfigView.Code) : inQuery.SortField; - var orderQuery = inQuery.Asc ? trialEmailNoticeConfigQueryable.OrderBy(sortField) : trialEmailNoticeConfigQueryable.OrderBy(sortField + " desc"); - var list = await orderQuery.ToListAsync(); - - return ResponseOutput.Ok(list, trialConfig); - } - - - [TrialGlobalLimit("AfterStopCannNotOpt")] - public async Task AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig) - { - await TestEmailConfigAsync(addOrEditTrialEmailNoticeConfig); - - - if (addOrEditTrialEmailNoticeConfig.Id == null) - { - - var entity = _mapper.Map(addOrEditTrialEmailNoticeConfig); - - - foreach (var item in addOrEditTrialEmailNoticeConfig.ToUserTypeList) - { - entity.TrialEmailNoticeUserList.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.To, UserType = item }); - - } - - foreach (var item in addOrEditTrialEmailNoticeConfig.CopyUserTypeList) - { - entity.TrialEmailNoticeUserList.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserType = item }); - - } - - foreach (var userid in addOrEditTrialEmailNoticeConfig.BlackUserIdList) - { - entity.TrialEmailBlackUserList.Add(new TrialEmailBlackUser() { UserId = userid }); - } - - await _trialEmailNoticeConfigRepository.AddAsync(entity, true); - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - else - { - var id = (Guid)addOrEditTrialEmailNoticeConfig.Id; - - await _trialEmailNoticeUserRepository.BatchDeleteNoTrackingAsync(t => t.TrialEmailNoticeConfigId == addOrEditTrialEmailNoticeConfig.Id); - await _trialEmailBlackUserRepository.BatchDeleteNoTrackingAsync(t => t.TrialEmailNoticeConfigId == addOrEditTrialEmailNoticeConfig.Id); - - - List trialEmailNoticeUsers = new List(); - - - foreach (var item in addOrEditTrialEmailNoticeConfig.ToUserTypeList) - { - trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.To, UserType = item, TrialEmailNoticeConfigId = id }); - - } - - foreach (var item in addOrEditTrialEmailNoticeConfig.CopyUserTypeList) - { - trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserType = item, TrialEmailNoticeConfigId = id }); - - } - await _trialEmailNoticeUserRepository.AddRangeAsync(trialEmailNoticeUsers); - - foreach (var userid in addOrEditTrialEmailNoticeConfig.BlackUserIdList) - { - await _trialEmailBlackUserRepository.AddAsync(new TrialEmailBlackUser() { UserId = userid, TrialEmailNoticeConfigId = id }); - - } - - await _trialEmailNoticeConfigRepository.UpdateFromDTOAsync(addOrEditTrialEmailNoticeConfig); - - - await _trialEmailNoticeConfigRepository.SaveChangesAsync(); - - var jobId = $"{addOrEditTrialEmailNoticeConfig.TrialId}_{id}"; - - if (addOrEditTrialEmailNoticeConfig.IsAutoSend) - { - HangfireJobHelper.AddOrUpdateTrialCronJob(jobId, addOrEditTrialEmailNoticeConfig.TrialId, addOrEditTrialEmailNoticeConfig.BusinessScenarioEnum, addOrEditTrialEmailNoticeConfig.EmailCron); - - } - else - { - HangfireJobHelper.RemoveCronJob(jobId); - } - - return ResponseOutput.Ok(); - } - - - } - - - - private async Task TestEmailConfigAsync(TrialEmailNoticeConfigAddOrEdit config) - { - - - if (!config.FromEmail.Contains("@") || string.IsNullOrEmpty(config.FromEmail)) - { - //---项目发件邮箱配置有误,请核实 - throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidEmailConfig"]); - } - - try - { - await SendEmailHelper.TestEmailConfigAsync(new SystemEmailSendConfig() - { - AuthorizationCode = config.AuthorizationCode, - FromEmail = config.FromEmail, - FromName = config.FromName, - Host = config.SMTPServerAddress, - Port = config.SMTPServerPort - }); - - } - catch (Exception ex) - { - - //---发件人配置错误,请核对服务器地址或者授权码是否填写有误 - throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidSenderEmailConfig"]); - } - - - - - #region 人员还未加入,可以先配置邮件 历史废弃 - - //var toUserList = await _trialUserRepository.Where(t => t.TrialId == config.TrialId) - // .WhereIf(config.ToUserTypeList != null, t => config.ToUserTypeList.Contains(t.User.UserTypeEnum)) - // .Select(t => new { t.User.EMail, t.User.FullName }).ToListAsync(); - - - //if (toUserList.Count() == 0 || toUserList.Where(t => t.EMail.Contains("@")).Count() == 0) - //{ - // //---项目没有有效的收件人,无法发送邮件 - // throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidRecipient"]); - //} - - //var sendEmailConfig = new SMTPEmailConfig(); - - //sendEmailConfig.FromEmailAddress = new MimeKit.MailboxAddress(config.FromName, config.FromEmail); - //sendEmailConfig.AuthorizationCode = config.AuthorizationCode; - //sendEmailConfig.UserName = config.FromEmail; - - //sendEmailConfig.Host = config.SMTPServerAddress; - //sendEmailConfig.Port = config.SMTPServerPort; - - - //sendEmailConfig.ToMailAddressList.Add(new MimeKit.MailboxAddress(config.FromName, config.FromEmail)); - - - //var pathToFile = _hostEnvironment.WebRootPath - // + Path.DirectorySeparatorChar.ToString() - // + "EmailTemplate" - // + Path.DirectorySeparatorChar.ToString() - // //+ "EmailConfigTest.html"; - - // + (_userInfo.IsEn_Us ? "EmailConfigTest_US.html" : "EmailConfigTest.html"); - - - ////---项目邮件测试 - //sendEmailConfig.TopicDescription = _localizer["TrialEmailN_EmailTestMessage"]; - - //using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile)) - //{ - // var templateInfo = SourceReader.ReadToEnd(); - - - // sendEmailConfig.HtmlBodyStr = string.Format(templateInfo, - // //--- 收到此邮件,代表邮件配置正确 - // _localizer["TrialEmailN_ConfigurationCorrect"] - // ); - //} - - //try - //{ - // await SendEmailHelper.SendEmailAsync(sendEmailConfig); - - //} - //catch (Exception ex) - //{ - - // //---发件人配置错误,请核对服务器地址或者授权码是否填写有误 - // throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidSenderEmailConfig"] + ex.Message); - //} - - #endregion - - - } - - [TrialGlobalLimit("AfterStopCannNotOpt")] - [HttpDelete("{trialEmailNoticeConfigId:guid}")] - public async Task DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId) - { - var trialId = await _trialEmailNoticeConfigRepository.Where(t => t.Id == trialEmailNoticeConfigId).Select(t => t.TrialId).FirstOrDefaultAsync(); - var jobId = $"{trialId}_{trialEmailNoticeConfigId}"; - - HangfireJobHelper.RemoveCronJob(jobId); - - var success = await _trialEmailNoticeConfigRepository.DeleteFromQueryAsync(t => t.Id == trialEmailNoticeConfigId, true); - - return ResponseOutput.Ok(); - } - - - } -} diff --git a/IRaCIS.Core.Application/Service/Document/_MapConfig.cs b/IRaCIS.Core.Application/Service/Document/_MapConfig.cs index efdd3ef8a..a12854586 100644 --- a/IRaCIS.Core.Application/Service/Document/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Document/_MapConfig.cs @@ -14,40 +14,7 @@ namespace IRaCIS.Core.Application.Service var userId = Guid.Empty; var isEn_Us = false; - CreateMap() - .ForMember(d => d.FileType, u => u.MapFrom(s => isEn_Us ? s.FileType.Value : s.FileType.ValueCN)) - .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); - - CreateMap() - .ForMember(d => d.FileType, u => u.MapFrom(s => isEn_Us ? s.FileType.Value : s.FileType.ValueCN)) - .ForMember(d => d.IsSomeUserSigned, u => u.MapFrom(s => s.TrialDocConfirmedUserList.Any(t => t.ConfirmTime != null))) - .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); - - - CreateMap() - .ForMember(d => d.IsSystemDoc, u => u.MapFrom(s => true)) - .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); - - CreateMap() - .ForMember(d => d.IsSystemDoc, u => u.MapFrom(s => false)) - .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path)); - - CreateMap().ForMember(d => d.UserTypeShortName, t => t.MapFrom(c => c.UserTypeRole.UserTypeShortName)); - CreateMap().ForMember(d => d.UserTypeShortName, t => t.MapFrom(c => c.UserTypeRole.UserTypeShortName)); - - - //CreateMap() - // .ForMember(t => t.UserConfirmInfo, c => c.MapFrom(t => t.TrialDocConfirmedUserList.Where(u => u.ConfirmUserId == userId).FirstOrDefault())) - // .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); ; - - CreateMap() - .ForMember(d => d.UserName, c => c.MapFrom(t => t.User.UserName)) - .ForMember(d => d.RealName, c => c.MapFrom(t => t.User.FullName)); - - //CreateMap() - // .ForMember(d => d.UserName, c => c.MapFrom(t => t.User.UserName)) - // .ForMember(d => d.RealName, c => c.MapFrom(t => t.User.LastName + " / " + t.User.FirstName)); - + CreateMap(); @@ -56,20 +23,6 @@ namespace IRaCIS.Core.Application.Service CreateMap (); - CreateMap() - .ForMember(d => d.NeedConfirmedUserTypeList, c => c.MapFrom(t => t.NeedConfirmedUserTypeIdList)); - - CreateMap().EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId) - .ForMember(d => d.NeedConfirmUserTypeId, c => c.MapFrom(t => t)) - .ForMember(d => d.TrialDocumentId, c => c.Ignore()); - - - - CreateMap().ForMember(d => d.NeedConfirmedUserTypeList, c => c.MapFrom(t => t.NeedConfirmedUserTypeIdList)); - CreateMap().EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId) - .ForMember(d => d.NeedConfirmUserTypeId, c => c.MapFrom(t => t)) - .ForMember(d => d.SystemDocumentId, c => c.Ignore()); - CreateMap() diff --git a/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs b/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs index ea24386e5..4b10985ac 100644 --- a/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs +++ b/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs @@ -66,7 +66,7 @@ namespace IRaCIS.Core.Application.Service SowPath = "", SowName = "", UpdateTime = DateTime.Now, - UpdateUserId = _userInfo.Id + UpdateUserId = _userInfo.UserRoleId }); return ResponseOutput.Result(success); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 8aa30eb28..5a6bc7e5a 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -65,19 +65,19 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc (t.TrialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.Random && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None)))) { //找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务 - var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync(); if (needDealTaskList.Count > 0) { //已完成的访视任务数量(包含重阅的) - var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit); //已经处理过的任务名称的数量 - var haveDealedTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id + var haveDealedTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint").Select(t => new { t.TaskBlindName, t.SourceSubjectVisitId, t.SouceReadModuleId }).ToListAsync(); @@ -153,7 +153,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null - && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) + && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect) //满足 有序,或者随机只看到当前任务的dicom 非dicom检查 .WhereIf(criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId) .Select(u => new SubjectImageUploadDTO() @@ -402,7 +402,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc else { //在事务未完成前 防止前端重复提交 - await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidDBLock(incommand.TrialId, incommand.VisitTaskId, incommand.Study.StudyInstanceUid), _userInfo.Id, TimeSpan.FromMinutes(1)); + await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidDBLock(incommand.TrialId, incommand.VisitTaskId, incommand.Study.StudyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromMinutes(1)); } } @@ -653,7 +653,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { var subjectCode = inQuery.SubjectCode; var subjectId = inQuery.SubjectId; - var doctorUserId = _userInfo.Id; + var doctorUserId = _userInfo.UserRoleId; if (inQuery.VisitTaskId != null) { @@ -839,7 +839,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task> GetSubjectImageDownloadSelectList(IRReadingDownloadQuery inQuery) { - var doctorUserId = _userInfo.Id; + var doctorUserId = _userInfo.UserRoleId; var isAnalysisCreate = false; //要根据标准阅片顺序,确定是否查询单个任务的,还是查询所有的 @@ -1538,7 +1538,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task> GetIRUploadTaskList_Old(CRCUploadTaskQuery inQuery) { var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId - && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) + && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect) .ProjectTo(_mapper.ConfigurationProvider); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs index 29fd733a7..4c97b57b3 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/ImageShareService.cs @@ -102,18 +102,13 @@ namespace IRaCIS.Core.Application.Services var resource = new ResourceInfo() { StudyId = imageShare.StudyId, - Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo() + Token = _tokenService.GetToken(new UserTokenInfo() { - Id = Guid.Empty, - IsReviewer = false, - IsAdmin = false, - RealName = "Share001", + IdentityUserId = Guid.NewGuid(), + FullName = "Share001", UserName = "Share001", - Sex = 0, - //UserType = "ShareType", UserTypeEnum = UserTypeEnum.ShareImage, - Code = "ShareCode001", - })) + }) }; diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index c5d724dad..368d67b23 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -99,20 +99,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc if (visitTaskId != null) { var cacheValue = _fusionCache.GetOrDefault(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid)); - if (cacheValue != Guid.Empty && cacheValue != _userInfo.Id) + if (cacheValue != Guid.Empty && cacheValue != _userInfo.UserRoleId) { //---当前已有人正在上传和归档该检查! return ResponseOutput.NotOk(I18n.T("UploadDownLoad_ArchiveInProgress")); } else { - await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(15)); + await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(15)); } } else { - await _fusionCache.SetAsync(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(15)); + await _fusionCache.SetAsync(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(15)); } @@ -139,7 +139,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc else { //在事务未完成前 防止前端重复提交 - await _fusionCache.SetAsync(CacheKeys.TrialStudyUidDBLock(incommand.TrialId, incommand.Study.StudyInstanceUid), _userInfo.Id, TimeSpan.FromMinutes(3)); + await _fusionCache.SetAsync(CacheKeys.TrialStudyUidDBLock(incommand.TrialId, incommand.Study.StudyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromMinutes(3)); } } @@ -357,7 +357,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(inQuery.VisitPlanArray); var dicomStudyQuery = _dicomStudyRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -406,7 +406,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var nodeDicomStudyQuery = _noneDicomStudyRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression2) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -468,7 +468,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(inQuery.VisitPlanArray); var StudyMonitorQuery = _studyMonitorRepository.Where(t => t.TrialId == inQuery.TrialId, ignoreQueryFilters: true) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) @@ -615,7 +615,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task>> VerifyTaskStudyAllowUploadAsync(VerifyTaskUploadOrReupload verifyInfo) { - var queryStudy = _visitTaskRepository.Where(t => t.SubjectId == verifyInfo.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id).Select(u => new + var queryStudy = _visitTaskRepository.Where(t => t.SubjectId == verifyInfo.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.UserRoleId).Select(u => new { VisitTaskId = u.Id, SourceSubjectVisitId = u.SourceSubjectVisitId, @@ -654,7 +654,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var result = new VerifyStudyUploadResult(); - if (_fusionCache.GetOrDefault($"StudyUid_{trialId}_{studyInstanceUid}") != _userInfo.Id) + if (_fusionCache.GetOrDefault($"StudyUid_{trialId}_{studyInstanceUid}") != _userInfo.UserRoleId) { result.AllowUpload = false; @@ -704,7 +704,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { if (result.AllowReUpload || result.AllowUpload) { - await _fusionCache.SetAsync($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.Id, TimeSpan.FromSeconds(30)); + await _fusionCache.SetAsync($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.UserRoleId, TimeSpan.FromSeconds(30)); } else @@ -800,7 +800,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var result = new VerifyStudyUploadResult(); - if (cacheUserId.GetValueOrDefault() != _userInfo.Id && cacheUserId.HasValue) + if (cacheUserId.GetValueOrDefault() != _userInfo.UserRoleId && cacheUserId.HasValue) { result.AllowUpload = false; @@ -869,7 +869,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { if (result.AllowReUpload || result.AllowUpload) { - _fusionCache.Set(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(30)); + _fusionCache.Set(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(30)); } else { diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index c1ca69042..51924f190 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -338,14 +338,6 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO - /// - /// 用户 签名某个文档 Dto - /// - public class TrialDocumentConfirmDTO : InspectionBase, IInspectionDTO, ISignDTO - { - public UserConfirmCommand OptCommand { get; set; } - - } public class GetDataInspectionOutDto : DataInspection { diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index c78fc0453..c36602cb3 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -1074,14 +1074,14 @@ namespace IRaCIS.Core.Application.Service //IsConfig = lst.Select(x => x.IsConfig).FirstOrDefault(), IsShowParent = lst.Select(x => x.IsShowParent).FirstOrDefault(), ParentId = item.AddItemGuid, - CreateUserId = _userInfo.Id, + CreateUserId = _userInfo.UserRoleId, IsEnable = lst.Select(x => x.IsEnable).FirstOrDefault(), DictionaryKey = lst.Select(x => x.DictionaryKey).FirstOrDefault(), EnumType = lst.Select(x => x.EnumType).FirstOrDefault(), UpdateTime = DateTime.Now, ValueCN = lst.Select(x => x.ValueCN).FirstOrDefault(), Value = lst.Max(x => x.Value), - UpdateUserId = _userInfo.Id, + UpdateUserId = _userInfo.UserRoleId, ChildrenTypeId = additem?.ChildrenTypeId, ModuleTypeId = additem?.ModuleTypeId, ObjectTypeId = additem?.ObjectTypeId, diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs index f8147dbdf..9357f9f8c 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs @@ -3,6 +3,7 @@ // 生成时间 2023-07-04 16:10:46 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- +using IRaCIS.Application.Contracts; using IRaCIS.Core.Domain.Share; using Newtonsoft.Json; namespace IRaCIS.Core.Application.ViewModel @@ -106,7 +107,22 @@ namespace IRaCIS.Core.Application.ViewModel } + public class IRCLoginDto + { + public string UserName { get; set; } + public string Password { get; set; } + } + public class IRCLoginReturnDTO + { + public UserBasicInfo BasicInfo { get; set; } = new UserBasicInfo(); + public string JWTStr { get; set; } = string.Empty; + + public bool IsMFA { get; set; } = false; + + public SystemEmailSendConfigView CompanyInfo { get; set; } + + } } diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs index c8255a067..55b45039c 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs @@ -64,6 +64,7 @@ namespace IRaCIS.Application.Contracts public class UserAccountInfo { public Guid Id { get; set; } + public Guid IdentityUserId { get; set; } public string UserName { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; @@ -76,46 +77,42 @@ namespace IRaCIS.Application.Contracts public string UserTypeShortName { get; set; } - public int Status { get; set; } + public bool IsUserRoleDisabled { get; set; } } public class UserBasicInfo { - public Guid Id { get; set; } + public Guid IdentityUserId { get; set; } + + public Guid UserRoleId { get; set; } + + public bool IsMutiAccount => AccountList?.Count > 1; + public List AccountList { get; set; } + + public string UserName { get; set; } = string.Empty; - public string RealName { get; set; } = string.Empty; + public string FullName { get; set; } = string.Empty; public int? Sex { get; set; } // 1-男 2-女 + public string UserCode { get; set; } + public string EMail { get; set; } + + public int Status { get; set; } + public bool IsTestUser { get; set; } + public bool IsZhiZhun { get; set; } + public bool IsFirstAdd { get; set; } + + public bool NeedChangePassWord { get; set; } = false; - /// - /// LastLoginIP - /// + public bool PasswordChanged { get; set; } + + public int LoginState { get; set; } = 0; public string LastLoginIP { get; set; } = string.Empty; - - public UserTypeEnum UserTypeEnum { get; set; } - + public DateTime? LastLoginTime { get; set; } /// /// 上一次修改密码的时间 /// public DateTime? LastChangePassWordTime { get; set; } - public bool IsTestUser { get; set; } - public bool IsAdmin { get; set; } = false; - public string UserTypeShortName { get; set; } = string.Empty; - public bool PasswordChanged { get; set; } - public int Status { get; set; } - public Guid UserTypeId { get; set; } - - public string Code { get; set; } = String.Empty; - - public string PermissionStr { get; set; } = String.Empty; - - public string EMail { get; set; } = string.Empty; - public bool IsFirstAdd { get; set; } - - public bool IsZhiZhun { get; set; } - public bool IsReviewer { get; set; } = false; - - public int LoginState { get; set; } = 0; } @@ -163,23 +160,25 @@ namespace IRaCIS.Application.Contracts + public class UserDetailDTO : UserInfo { - public bool CanEditUserType { get; set; } + //public bool CanEditUserType { get; set; } + + public string FullName { get; set; } + + public Guid Id { get; set; } - public bool IsMutiAccount => AccountList?.Count > 1; public List AccountList { get; set; } } public class UserInfo { public string CheckCode { get; set; } = string.Empty; - public Guid Id { get; set; } - public string UserName { get; set; } = string.Empty; - public string Password { get; set; } = string.Empty; - public string RealName { get; set; } = string.Empty; + public string UserName { get; set; } = string.Empty; + public string FirstName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty; @@ -189,36 +188,22 @@ namespace IRaCIS.Application.Contracts public string Phone { get; set; } = string.Empty; public string EMail { get; set; } = string.Empty; - public Guid UserTypeId { get; set; } = Guid.Empty; public string UserCode { get; set; } = string.Empty; public bool IsZhiZhun { get; set; } - public string UserType { get; set; } = string.Empty; - - public string UserTypeShortName { get; set; } = string.Empty; - - - public UserTypeEnum UserTypeEnum { get; set; } - - - - //public Guid OrganizationTypeId { get; set; } = Guid.Empty; - //public string OrganizationType { get; set; } = String.Empty; - //public Guid OrganizationId { get; set; } public string OrganizationName { get; set; } = string.Empty; - - public string DepartmentName { get; set; } = String.Empty; public string PositionName { get; set; } = String.Empty; public bool IsTestUser { get; set; } - public DateTime? LastLoginTime { get; set; } + } + /// /// 添加用户是的返回模型 /// @@ -228,14 +213,40 @@ namespace IRaCIS.Application.Contracts public string UserCode { get; set; } = string.Empty; } + public class UserAddUserType + { + + public UserTypeEnum UserTypeEnum { get; set; } + + public Guid UserTypeId { get; set; } + + public bool IsUserRoleDisabled { get; set; } + + + } + public class UpdateUserRolesDto + { + public Guid Id { get; set; } + + public List UserRoleList { get; set; } + } + + public class UserBasicInfoCommand : UserInfo + { + public Guid Id { get; set; } + } + public class UserCommand : UserInfo { + public Guid? Id { get; set; } + + public List UserRoleList { get; set; } + public string BaseUrl { get; set; } = string.Empty; public string RouteUrl { get; set; } = string.Empty; - //public string FirstName { get; set; } - //public string LastName { get; set; } + } public class EditPasswordCommand @@ -283,6 +294,10 @@ namespace IRaCIS.Application.Contracts public DateTime? BeginLastLoginTime { get; set; } public DateTime? EndLastLoginTime { get; set; } + + public DateTime? BeginLastChangePassWordTime { get; set; } + + public DateTime? EndLastChangePassWordTime { get; set; } } public class UserRoleInfoDTO @@ -293,16 +308,42 @@ namespace IRaCIS.Application.Contracts public class UserListDTO : UserInfo { - [JsonIgnore] - public Guid testGuid { get; set; } - public bool CanEditUserType { get; set; } + public bool IsFirstAdd { get; set; } + + public DateTime? LastLoginTime { get; set; } public DateTime CreateTime { get; set; } - public List RoleNameArray { get; set; } = new List(); - public IEnumerable RoleNameList { get; set; } = new List(); - } + public Guid Id { get; set; } + public string FullName { get; set; } + + public DateTime? LastChangePassWordTime { get; set; } + + public List UserRoleList { get; set; } + + #region 用户来源 + + + public Guid? TrialId { get; set; } + + public string TrialCode { get; set; } + + public string ResearchProgramNo { get; set; } + + #endregion + + public int JoinedTrialCount { get; set; } + } + public class IdentityUserTypeDTO : UserAddUserType + { + public Guid Id { get; set; } + public string UserTypeShortName { get; set; } + + public DateTime CreateTime { get; set; } + + public DateTime UpdateTime { get; set; } + } public class UserIdRoleName : RoleDTO { diff --git a/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs b/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs index 7cf9372cc..cf42b0179 100644 --- a/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs +++ b/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs @@ -6,21 +6,14 @@ namespace IRaCIS.Core.Application.Service public interface IUserService { Task> AddUser(UserCommand userAddModel); - Task DeleteUser(Guid userId); Task GetUser(Guid id); Task> GetUserList(UserListQueryDTO param); - Task> LoginSelectUserType(Guid userId, Guid userTypeId); - Task> Login(string userName, string password); - Task VerifyMFACodeAsync(Guid userId, string Code); - - Task SendMFAEmail(Guid userId, int mfaType = 0); Task GetUserBasicInfo(Guid userId, string pwd); Task ModifyPassword(EditPasswordCommand editPwModel); Task ResetPassword(Guid userId); Task UpdateUser(UserCommand model); - Task UpdateUserState(Guid userId, UserStateEnum state); //Task SendVerificationCode(string emailOrPhone, VerifyType verificationType, bool isReviewer = false); //Task SetNewPassword(ResetPasswordCommand resetPwdModel); diff --git a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs index cfde80063..0c37fec09 100644 --- a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs +++ b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs @@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.Service if (entity.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished) { - entity.PublishedUserId = _userInfo.Id; + entity.PublishedUserId = _userInfo.UserRoleId; entity.PublishedTime = DateTime.Now; } await _systemNoticeRepository.SaveChangesAsync(); @@ -61,7 +61,7 @@ namespace IRaCIS.Core.Application.Service if (addOrEditSystemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && systemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.NotPublish) { - systemNotice.PublishedUserId = _userInfo.Id; + systemNotice.PublishedUserId = _userInfo.UserRoleId; systemNotice.PublishedTime = DateTime.Now; } else if (addOrEditSystemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.NotPublish && systemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished) @@ -125,7 +125,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.NoticeTypeEnum != null, t => t.NoticeTypeEnum == inQuery.NoticeTypeEnum) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.NoticeContent), t => t.NoticeContent.Contains(inQuery.NoticeContent)) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId }); return await systemNoticeQueryable.ToPagedListAsync(inQuery); } @@ -137,9 +137,9 @@ namespace IRaCIS.Core.Application.Service var appDateTimeNow = DateTime.Now; var query = _systemNoticeRepository - .Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.Id)) + .Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.UserRoleId)) .Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > appDateTimeNow) - .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId }); return await query.ToListAsync(); } diff --git a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs index 8a6d5e02d..3083adfc1 100644 --- a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs @@ -32,7 +32,7 @@ namespace IRaCIS.Core.Application.Service var isCRCOrIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer; var userFeedBackQueryable = _userFeedBackRepository - .WhereIf(isCRCOrIR, t => t.CreateUserId == _userInfo.Id) + .WhereIf(isCRCOrIR, t => t.CreateUserId == _userInfo.UserRoleId) .WhereIf(inQuery.State != null, t => t.State == inQuery.State) .WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId) .WhereIf(inQuery.QuestionType != null, t => t.QuestionType == inQuery.QuestionType) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index e4600fb7c..091725623 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -6,16 +6,20 @@ using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Helper.OtherTool; using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; +using MassTransit; using Medallion.Threading; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using NPOI.SS.Formula.Functions; using Panda.DynamicWebApi.Attributes; using System.Text.RegularExpressions; using ZiggyCreatures.Caching.Fusion; +using IdentityUser = IRaCIS.Core.Domain.Models.IdentityUser; using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO; namespace IRaCIS.Core.Application.Service @@ -33,24 +37,25 @@ namespace IRaCIS.Core.Application.Service IOptionsMonitor systemEmailConfig, IRepository _hirHospitalRepository, ITokenService _tokenService, + IRepository _identityUserRepository, ISearcher _searcher, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IUserService { private SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue; - private async Task VerifyUserNameAsync(Guid? userId, string userName) + private async Task VerifyUserNameAsync(Guid? identityUserId, string userName) { - if (await _userRoleRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => t.UserName == userName)) + if (await _identityUserRepository.WhereIf(identityUserId != null, t => t.Id != identityUserId).AnyAsync(t => t.UserName == userName)) { //---用户名已经存在。 throw new BusinessValidationFailedException(_localizer["User_UsernameExist"]); } } - private async Task VerifyUserPhoneAsync(Guid? userId, Guid userTypeId, string phone) + private async Task VerifyUserPhoneAsync(Guid? identityUserId, string phone) { - if (await _userRoleRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => (t.Phone == phone && t.UserTypeId == userTypeId))) + if (await _identityUserRepository.WhereIf(identityUserId != null, t => t.Id != identityUserId).AnyAsync(t => (t.Phone == phone))) { //---该用户类型中已存在具有相同的电话的用户。 throw new BusinessValidationFailedException(_localizer["User_PhoneDup"]); @@ -58,19 +63,17 @@ namespace IRaCIS.Core.Application.Service } - private async Task VerifyUserEmailAsync(Guid? userId, Guid userTypeId, string email) + private async Task VerifyUserEmailAsync(Guid? identityUserId, string email) { - if (await _userRoleRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => (t.EMail == email && t.UserTypeId == userTypeId))) + if (await _identityUserRepository.WhereIf(identityUserId != null, t => t.Id != identityUserId).AnyAsync(t => t.EMail == email)) { //---该用户类型中已存在具有相同邮箱的用户。 throw new BusinessValidationFailedException(_localizer["User_EmailDup"]); } } - private async Task VerifyUserPwdAsync(Guid userId, string newPwd, string? oldPwd = null) + private async Task VerifyUserPwdAsync(Guid identityUserId, string newPwd, string? oldPwd = null) { - //var dbUser = (await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == userId)).IfNullThrowException(); - if (_verifyConfig.CurrentValue.OpenUserComplexPassword) { if (oldPwd != null && oldPwd == newPwd) @@ -80,7 +83,7 @@ namespace IRaCIS.Core.Application.Service } - var dbUser = (await _userRoleRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException(); + var dbUser = (await _identityUserRepository.Where(t => t.Id == identityUserId).FirstOrDefaultAsync()).IfNullThrowException(); if (oldPwd != null && dbUser.Password != oldPwd) { @@ -94,7 +97,7 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException(_localizer["User_NewOldPwdSame"]); } - var passWordList = await _userPassWordLogRepository.Where(x => x.UserId == userId).OrderByDescending(x => x.CreateTime).Take(2).ToListAsync(); + var passWordList = await _userPassWordLogRepository.Where(x => x.IdentityUserId == identityUserId).OrderByDescending(x => x.CreateTime).Take(3).ToListAsync(); if (passWordList.Any(x => x.PassWord == newPwd)) { @@ -103,23 +106,9 @@ namespace IRaCIS.Core.Application.Service } - if (oldPwd == null) - { - oldPwd = await _userRoleRepository.Where(x => x.Id == userId).Select(x => x.Password).FirstOrDefaultAsync(); - } - if (oldPwd.IsNotNullOrEmpty()) - { - await _userPassWordLogRepository.AddAsync(new UserPassWordLog() - { - CreateTime = DateTime.Now, - PassWord = oldPwd!, - UserId = userId, - }); - } - - await _userRoleRepository.BatchUpdateNoTrackingAsync(x => x.Id == userId, x => new UserRole() + await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == identityUserId, x => new IdentityUser() { LastChangePassWordTime = DateTime.Now, }); @@ -138,7 +127,7 @@ namespace IRaCIS.Core.Application.Service { //检查手机或者邮箱是否有效 - if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")) + if (!Regex.IsMatch(email, _systemEmailConfig.EmailRegexStr)) { //---Please input a legal email return ResponseOutput.NotOk(_localizer["User_LegalEmail"]); @@ -148,7 +137,7 @@ namespace IRaCIS.Core.Application.Service //验证码 6位 int verificationCode = new Random().Next(100000, 1000000); - await _mailVerificationService.SendMailEditEmail(_userInfo.Id, _userInfo.RealName, email, verificationCode); + await _mailVerificationService.SendMailEditEmail(_userInfo.IdentityUserId, _userInfo.FullName, email, verificationCode); return ResponseOutput.Ok(); @@ -162,7 +151,7 @@ namespace IRaCIS.Core.Application.Service var verificationRecord = await _verificationCodeRepository - .FirstOrDefaultAsync(t => t.UserId == _userInfo.Id && t.Code == verificationCode && t.CodeType == 0); + .FirstOrDefaultAsync(t => t.UserId == _userInfo.IdentityUserId && t.Code == verificationCode && t.CodeType == 0); //检查数据库是否存在该验证码 if (verificationRecord == null) @@ -190,18 +179,22 @@ namespace IRaCIS.Core.Application.Service { - await VerifyUserEmailAsync(_userInfo.Id, _userInfo.UserTypeId, newEmail); + await VerifyUserEmailAsync(_userInfo.IdentityUserId, newEmail); + + // 修改用户邮箱的时候 需要修改医生表的邮箱 + var oldEmail = await _identityUserRepository.Where(t => t.Id == _userInfo.IdentityUserId).Select(t => t.EMail).FirstOrDefaultAsync(); - await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.Id, u => new UserRole() + await _identityUserRepository.UpdatePartialFromQueryAsync(_userInfo.IdentityUserId, u => new IdentityUser() { EMail = newEmail }); //删除验证码历史记录 - await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.UserId == _userInfo.Id && t.CodeType == 0); + await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.UserId == _userInfo.UserRoleId && t.CodeType == 0); + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); return ResponseOutput.Ok(); @@ -214,14 +207,15 @@ namespace IRaCIS.Core.Application.Service public async Task SetNewPhone(string newPhone) { - await VerifyUserPhoneAsync(_userInfo.Id, _userInfo.UserTypeId, newPhone); + await VerifyUserPhoneAsync(_userInfo.IdentityUserId, newPhone); - await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.Id, u => new UserRole() + await _identityUserRepository.UpdatePartialFromQueryAsync(_userInfo.IdentityUserId, u => new IdentityUser() { Phone = newPhone }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true); + return ResponseOutput.Ok(); } @@ -230,29 +224,30 @@ namespace IRaCIS.Core.Application.Service [HttpPut("{newUserName}")] public async Task SetNewUserName(string newUserName) { - await VerifyUserNameAsync(_userInfo.Id, newUserName); + await VerifyUserNameAsync(_userInfo.IdentityUserId, newUserName); - await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.Id, u => new UserRole() + await _identityUserRepository.UpdatePartialFromQueryAsync(_userInfo.IdentityUserId, u => new IdentityUser() { UserName = newUserName }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true); + return ResponseOutput.Ok(); } [HttpGet] - public async Task InitSetUserNameAndPwd(Guid userId, string newUserName, string newPWd) + public async Task InitSetUserNameAndPwd( string newUserName, string newPWd) { - await VerifyUserPwdAsync(userId, newPWd); + await VerifyUserPwdAsync(_userInfo.IdentityUserId, newPWd); - await VerifyUserNameAsync(userId, newUserName); + await VerifyUserNameAsync(_userInfo.IdentityUserId, newUserName); - await _userRoleRepository.UpdatePartialFromQueryAsync(userId, u => new UserRole() + await _identityUserRepository.UpdatePartialFromQueryAsync(_userInfo.IdentityUserId, u => new IdentityUser() { UserName = newUserName, @@ -264,7 +259,17 @@ namespace IRaCIS.Core.Application.Service }, true); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.UpdateUser }, true); + + await _userPassWordLogRepository.AddAsync(new UserPassWordLog() + { + + CreateTime = DateTime.Now, + PassWord = newPWd, + IdentityUserId = _userInfo.IdentityUserId, + }); + + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true); return ResponseOutput.Ok(); } @@ -273,11 +278,11 @@ namespace IRaCIS.Core.Application.Service /// /// 重置密码为 默认密码 /// - /// + /// /// - [HttpGet("{userId:guid}")] + [HttpGet("{identityUserId:guid}")] [UnitOfWork] - public async Task ResetPassword(Guid userId) + public async Task ResetPassword(Guid identityUserId) { var hospitalInfo = await _fusionCache.GetOrSetAsync(CacheKeys.Hospital, async _ => await CacheHelper.GetHospitalCode(_hirHospitalRepository), TimeSpan.FromDays(7)); @@ -288,20 +293,20 @@ namespace IRaCIS.Core.Application.Service if (hospitalInfo.IsCanConnectInternet) { - await _mailVerificationService.AdminResetPwdSendEmailAsync(userId, pwd); + await _mailVerificationService.AdminResetPwdSendEmailAsync(identityUserId, pwd); } - await _userRoleRepository.UpdatePartialFromQueryAsync(userId, u => new UserRole() + await _identityUserRepository.UpdatePartialFromQueryAsync(t => t.Id == identityUserId, u => new IdentityUser() { Password = MD5Helper.Md5(pwd), IsFirstAdd = true }); - var userName = _userRoleRepository.Where(t => t.Id == userId).Select(t => t.UserName).FirstOrDefault(); + var userName = _identityUserRepository.Where(t => t.Id == identityUserId).Select(t => t.UserName).FirstOrDefault(); await _fusionCache.RemoveAsync(CacheKeys.UserLoginError(userName)); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.ResetPassword }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.ResetPassword }, true); return ResponseOutput.Ok(); } @@ -319,7 +324,7 @@ namespace IRaCIS.Core.Application.Service { //检查手机或者邮箱是否有效 - if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")) + if (!Regex.IsMatch(email, _systemEmailConfig.EmailRegexStr)) { //---请输入一个正确的邮箱。 @@ -328,14 +333,22 @@ namespace IRaCIS.Core.Application.Service } ////查找改邮箱或者手机的用户 - var exist = await _userRoleRepository.AnyAsync(t => t.EMail == email); + var existUser = await _identityUserRepository.Where(t => t.EMail == email && t.Status == UserStateEnum.Enable).FirstOrDefaultAsync(); - if (!exist) + if (existUser == null) { //---邮箱错误。 return ResponseOutput.NotOk(_localizer["User_EmailError"]); } + else + { + if (existUser.IsFirstAdd && existUser.UserName.IsNullOrEmpty()) + { + return ResponseOutput.NotOk(_localizer["User_Notinitialized"]); + } + } + //验证码 6位 @@ -352,24 +365,34 @@ namespace IRaCIS.Core.Application.Service /// /// (未登陆) 设置新密码 /// - /// + /// /// /// [AllowAnonymous] - [HttpGet("{userId:guid}/{newPwd}")] - public async Task AnonymousSetPassword(Guid userId, string newPwd) + [HttpGet("{identityUserId:guid}/{newPwd}")] + public async Task AnonymousSetPassword(Guid identityUserId, string newPwd) { - await VerifyUserPwdAsync(userId, newPwd); + await VerifyUserPwdAsync(identityUserId, newPwd); - await _userRoleRepository.UpdatePartialFromQueryAsync(t => t.Id == userId, u => new UserRole() + await _identityUserRepository.UpdatePartialFromQueryAsync(t => t.Id == identityUserId, u => new IdentityUser() { Password = newPwd, + LastChangePassWordTime = DateTime.Now, IsFirstAdd = false }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, LoginPassword = newPwd, OptType = UserOptType.UnloginModifyPasswoed }, true); + await _userPassWordLogRepository.AddAsync(new UserPassWordLog() + { + + CreateTime = DateTime.Now, + PassWord = newPwd, + IdentityUserId = identityUserId, + }); + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.UnloginModifyPasswoed }, true); + return ResponseOutput.Ok(); @@ -387,21 +410,23 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task> GetUserList(UserListQueryDTO inQuery) { - var userQueryable = _userRoleRepository.Where(x => x.UserTypeEnum != UserTypeEnum.SuperAdmin) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.UserName.Contains(inQuery.UserName)) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.RealName), t => t.FullName.Contains(inQuery.RealName)) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Phone), t => t.Phone.Contains(inQuery.Phone)) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.OrganizationName.Contains(inQuery.OrganizationName)) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.EMail), t => t.EMail.Contains(inQuery.EMail)) - .WhereIf(inQuery.BeginCreateTime != null, t => t.CreateTime >= inQuery.BeginCreateTime) - .WhereIf(inQuery.EndCreateTime != null, t => t.CreateTime <= inQuery.EndCreateTime) - .WhereIf(inQuery.BeginLastLoginTime != null, t => t.LastLoginTime >= inQuery.BeginLastLoginTime) - .WhereIf(inQuery.EndLastLoginTime != null, t => t.LastLoginTime <= inQuery.EndLastLoginTime) - .WhereIf(inQuery.UserType != null, t => t.UserTypeId == inQuery.UserType) - .WhereIf(inQuery.UserState != null, t => t.Status == inQuery.UserState) - .WhereIf(inQuery.IsTestUser != null, t => t.IsTestUser == inQuery.IsTestUser) - .WhereIf(inQuery.IsZhiZhun != null, t => t.IsZhiZhun == inQuery.IsZhiZhun) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.OA, t => t.UserTypeEnum != UserTypeEnum.Admin) + var userQueryable = _identityUserRepository.Where(x => x.UserRoleList.Any(x => x.UserTypeEnum != UserTypeEnum.SuperAdmin)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.UserName.Contains(inQuery.UserName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.RealName), t => t.FullName.Contains(inQuery.RealName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Phone), t => t.Phone.Contains(inQuery.Phone)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.OrganizationName.Contains(inQuery.OrganizationName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.EMail), t => t.EMail.Contains(inQuery.EMail)) + .WhereIf(inQuery.BeginCreateTime != null, t => t.CreateTime >= inQuery.BeginCreateTime) + .WhereIf(inQuery.EndCreateTime != null, t => t.CreateTime <= inQuery.EndCreateTime) + .WhereIf(inQuery.BeginLastLoginTime != null, t => t.LastLoginTime >= inQuery.BeginLastLoginTime) + .WhereIf(inQuery.EndLastLoginTime != null, t => t.LastLoginTime <= inQuery.EndLastLoginTime) + .WhereIf(inQuery.BeginLastChangePassWordTime != null, t => t.LastChangePassWordTime >= inQuery.BeginLastChangePassWordTime) + .WhereIf(inQuery.EndLastChangePassWordTime != null, t => t.LastChangePassWordTime <= inQuery.EndLastChangePassWordTime) + .WhereIf(inQuery.UserType != null, t => t.UserRoleList.Any(t => t.UserTypeId == inQuery.UserType && t.IsUserRoleDisabled == false)) + .WhereIf(inQuery.UserState != null, t => t.Status == inQuery.UserState) + .WhereIf(inQuery.IsTestUser != null, t => t.IsTestUser == inQuery.IsTestUser) + .WhereIf(inQuery.IsZhiZhun != null, t => t.IsZhiZhun == inQuery.IsZhiZhun) + //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.OA, t => t.UserTypeEnum != UserTypeEnum.Admin) .ProjectTo(_mapper.ConfigurationProvider); return await userQueryable.ToPagedListAsync(inQuery); @@ -411,18 +436,21 @@ namespace IRaCIS.Core.Application.Service /// /// 根据用户Id获取用户详细信息[New] /// - /// + /// /// xiuga - [HttpGet("{id:guid}")] - public async Task GetUser(Guid id) + [HttpGet("{identityUserId:guid}")] + public async Task GetUser(Guid identityUserId) { - var userQuery = _userRoleRepository.Where(t => t.Id == id).ProjectTo(_mapper.ConfigurationProvider); - var result = await (userQuery.FirstOrDefaultAsync()).IfNullThrowException(); + identityUserId = identityUserId != Guid.Empty ? identityUserId : _userInfo.IdentityUserId; - result.AccountList = _userRoleRepository.Where(t => t.EMail == result.EMail && t.UserTypeEnum != UserTypeEnum.SuperAdmin) - .ProjectTo(_mapper.ConfigurationProvider).OrderBy(t => t.UserTypeShortName).ToList(); + var user = await _identityUserRepository.Where(t => t.Id == identityUserId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); - return result; + if (user != null) + { + user.AccountList = await _userRoleRepository.Where(t => t.IdentityUserId == identityUserId).ProjectTo(_mapper.ConfigurationProvider).OrderBy(t => t.UserTypeShortName).ToListAsync(); + + } + return user; } /// @@ -441,20 +469,19 @@ namespace IRaCIS.Core.Application.Service } - await VerifyUserEmailAsync(null, userAddModel.UserTypeId, userAddModel.EMail); - - //await VerifyUserPhoneAsync(null, userAddModel.UserTypeId, userAddModel.Phone); + await VerifyUserEmailAsync(null, userAddModel.EMail); - var saveItem = _mapper.Map(userAddModel); + + var saveItem = _mapper.Map(userAddModel); var @lock = _distributedLockProvider.CreateLock($"UserAccount"); using (await @lock.AcquireAsync()) { - saveItem.Code = await _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().MaxAsync() + 1; + saveItem.Code = await _identityUserRepository.Select(t => t.Code).DefaultIfEmpty().MaxAsync() + 1; - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(UserRole)); + saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(IdentityUser)); //if (saveItem.IsZhiZhun) //{ @@ -467,9 +494,26 @@ namespace IRaCIS.Core.Application.Service saveItem.Password = MD5Helper.Md5("123456"); - await _userRoleRepository.AddAsync(saveItem); - var success = await _userRoleRepository.SaveChangesAsync(); + + var addRoleList = new List(); + + foreach (var role in userAddModel.UserRoleList) + { + var addRole = _mapper.Map(userAddModel); + + addRole.UserTypeEnum = role.UserTypeEnum; + addRole.UserTypeId = role.UserTypeId; + addRole.IsUserRoleDisabled = role.IsUserRoleDisabled; + + addRoleList.Add(addRole); + } + + saveItem.UserRoleList = addRoleList; + + await _identityUserRepository.AddAsync(saveItem); + + var success = await _identityUserRepository.SaveChangesAsync(); } if (hospitalInfo.IsCanConnectInternet) @@ -494,21 +538,24 @@ namespace IRaCIS.Core.Application.Service await VerifyUserNameAsync(model.Id, model.UserName); - await VerifyUserEmailAsync(model.Id, model.UserTypeId, model.EMail); + await VerifyUserEmailAsync(model.Id, model.EMail); //await VerifyUserPhoneAsync(model.Id, model.UserTypeId, model.Phone); - var user = await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == model.Id); + var user = await _identityUserRepository.Where(t => t.Id == model.Id, true).Include(t => t.UserRoleList).FirstOrDefaultAsync(); if (user == null) return Null404NotFound(user); + if (user.Status != model.Status) { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = model.Status == UserStateEnum.Enable ? UserOptType.AccountEnable : UserOptType.AccountLocked }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = model.Id, OptType = model.Status == UserStateEnum.Enable ? UserOptType.AccountEnable : UserOptType.AccountLocked }, true); + + + await _fusionCache.SetAsync(CacheKeys.UserDisable(user.Id), model.Status == UserStateEnum.Disable, TimeSpan.FromHours(1)); } - _mapper.Map(model, user); //if (user.IsZhiZhun) @@ -516,128 +563,108 @@ namespace IRaCIS.Core.Application.Service // user.OrganizationName = _userInfo.IsEn_Us ? _systemEmailConfig.OrganizationName : _systemEmailConfig.OrganizationNameCN; //} - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = UserOptType.UpdateUser }); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = model.Id, OptType = UserOptType.UpdateUser }); + //处理角色的添加、禁用 + + foreach (var role in model.UserRoleList) + { + var find = user.UserRoleList.FirstOrDefault(t => t.UserTypeEnum == role.UserTypeEnum && t.UserTypeId == role.UserTypeId); + + if (find != null) + { + find.IsUserRoleDisabled = role.IsUserRoleDisabled; + + await _fusionCache.SetAsync(CacheKeys.UserRoleDisable(find.Id), find.IsUserRoleDisabled, TimeSpan.FromHours(1)); + } + else + { + var addRole = _mapper.Map(model); + + addRole.Id = NewId.NextSequentialGuid(); + addRole.IdentityUserId = user.Id; + addRole.UserTypeEnum = role.UserTypeEnum; + addRole.UserTypeId = role.UserTypeId; + + user.UserRoleList.Add(addRole); + } + } var success = await _userRoleRepository.SaveChangesAsync(); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = model.Id, OptType = UserOptType.UpdateUser }, true); + + return ResponseOutput.Ok(success); } - /// - /// 删除用户 - /// - /// - /// - [HttpDelete("{userId:guid}")] - public async Task DeleteUser(Guid userId) + [HttpPut] + public async Task UpdateUserBasicInfo(UserBasicInfoCommand command) { - if (await _userTrialRepository.AnyAsync(t => t.Id == userId)) + + var user = await _identityUserRepository.Where(t => t.Id == command.Id, true).FirstOrDefaultAsync(); + + if (user == null) return Null404NotFound(user); + _mapper.Map(command, user); + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = command.Id, OptType = UserOptType.UpdateUser }, true); + + await _identityUserRepository.SaveChangesAsync(); + return ResponseOutput.Ok(); + } + + [HttpPut] + public async Task UpdateUserRoleInfo(UpdateUserRolesDto command) + { + var user = await _identityUserRepository.Where(t => t.Id == command.Id, true).Include(t => t.UserRoleList).FirstOrDefaultAsync(); + + if (user == null) return Null404NotFound(user); + + foreach (var role in command.UserRoleList) { - //---该用户已经参加项目,不能够删除。 - return ResponseOutput.NotOk(_localizer["User_InProject"]); + var find = user.UserRoleList.FirstOrDefault(t => t.UserTypeEnum == role.UserTypeEnum && t.UserTypeId == role.UserTypeId); + + if (find != null) + { + find.IsUserRoleDisabled = role.IsUserRoleDisabled; + + + await _fusionCache.SetAsync(CacheKeys.UserRoleDisable(find.Id), find.IsUserRoleDisabled, TimeSpan.FromHours(1)); + } + else + { + var addRole = _mapper.Map(user); + + addRole.Id = NewId.NextSequentialGuid(); + addRole.IdentityUserId = user.Id; + addRole.UserTypeEnum = role.UserTypeEnum; + addRole.UserTypeId = role.UserTypeId; + addRole.IsUserRoleDisabled = role.IsUserRoleDisabled; + + user.UserRoleList.Add(addRole); + } } - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.DeleteUser }, true); - var success = await _userRoleRepository.BatchDeleteNoTrackingAsync(t => t.Id == userId); + var success = await _userRoleRepository.SaveChangesAsync(); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = command.Id, OptType = UserOptType.UpdateUserRole }, true); - return ResponseOutput.Result(success); + return ResponseOutput.Ok(); } - /// - /// 禁用或者启用账户 - /// - /// - /// - /// - - [HttpPost("{userId:guid}/{state:int}")] - public async Task UpdateUserState(Guid userId, UserStateEnum state) - { - - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = state == UserStateEnum.Enable ? UserOptType.AccountEnable : UserOptType.AccountLocked }, true); - - var success = await _userRoleRepository.BatchUpdateNoTrackingAsync(u => u.Id == userId, t => new UserRole - { - Status = state - }); - return ResponseOutput.Result(success); - } public async Task GetUserBasicInfo(Guid userId, string pwd) { - var info = await _userRoleRepository.Where(u => u.Id == userId && u.Password == pwd).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + var info = await _identityUserRepository.Where(u => u.Id == userId && u.Password == pwd).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); return info; } - /// - /// 发送MFA 验证邮件 - /// - /// - /// - /// - [AllowAnonymous] - public async Task SendMFAEmail(Guid userId, int mfaType) - { - var userInfo = await _userRoleRepository.Where(u => u.Id == userId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync(); - - int verificationCode = new Random().Next(100000, 1000000); - - await _mailVerificationService.SenMFAVerifyEmail(userId, userInfo.FullName, userInfo.EMail, verificationCode, (UserMFAType)mfaType); - - var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(userInfo.EMail); - return ResponseOutput.Ok(hiddenEmail); - } - - /// - /// 验证MFA 邮件 - /// - /// - /// - /// - /// - [AllowAnonymous] - public async Task VerifyMFACodeAsync(Guid userId, string Code) - { - var verificationRecord = await _verificationCodeRepository.Where(t => t.UserId == userId && t.Code == Code && t.CodeType == VerifyType.Email).OrderByDescending(x => x.ExpirationTime).FirstOrDefaultAsync(); - VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto(); - - //检查数据库是否存在该验证码 - if (verificationRecord == null) - { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALoginFail }, true); - //---验证码错误。 - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_WrongVerificationCode"]); - } - else - { - //检查验证码是否失效 - if (verificationRecord.ExpirationTime < DateTime.Now) - { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALoginFail }, true); - //---验证码已经过期。 - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); - } - else //验证码正确 并且 没有超时 - { - - - //删除验证码历史记录 - await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.Id == verificationRecord.Id); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALogin }, true); - - } - } - - return ResponseOutput.Ok(); - } /// /// 同济生成账号 @@ -716,52 +743,88 @@ namespace IRaCIS.Core.Application.Service using (await @lock.AcquireAsync()) { - //匹配的角色 都匹配一遍账号,没有便生成 - foreach (var roleName in matchedRoles) + + var findIdentityUser = await _identityUserRepository.Where(t => t.ThirdUserCode == thirdUId).Include(t => t.UserRoleList).FirstOrDefaultAsync(); + + if (findIdentityUser == null) { - var userType = sysUserTypeList.Where(t => t.UserTypeShortName == roleName).First(); + var newCode = await _identityUserRepository.Select(t => t.Code).DefaultIfEmpty().MaxAsync() + 1; - var userTypeId = userType.Id; - - if (!_userRoleRepository.Any(t => t.ThirdUserCode == thirdUId && t.UserTypeId == userTypeId)) + var newIdentityUser = new IdentityUser() { - var newCode = await _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().MaxAsync() + 1; + FirstName = $"{tjUserInfo.Data.UserName}", + LastName = "tj", - var newUser = new UserRole() - { - FirstName = $"{tjUserInfo.Data.UserName}", - LastName = "tj", + IsFirstAdd = false, + IsZhiZhun = true, + OrganizationName = hospital.HospitalName, + Code = newCode, + Password = MD5Helper.Md5("123456"), + CheckCode = "123456", + UserCode = AppSettings.GetCodeStr(newCode, nameof(IdentityUser)), - IsFirstAdd = false, - IsZhiZhun = true, - OrganizationName = hospital.HospitalName, - Code = newCode, - Password = MD5Helper.Md5("123456"), - CheckCode = "123456", - UserCode = AppSettings.GetCodeStr(newCode, nameof(UserRole)), - UserTypeId = userTypeId, - UserTypeEnum = userType.UserTypeEnum, + EMail = email, + UserName = $"{tjUserInfo.Data.UserName}", + ThirdUserCode = thirdUId, + }; - EMail = email, - UserName = $"{tjUserInfo.Data.UserName}-{roleName}", - ThirdUserCode = thirdUId, - }; - await _userRoleRepository.AddAsync(newUser); + var addRoleList = new List(); + + foreach (var roleName in matchedRoles) + { + var userType = sysUserTypeList.Where(t => t.UserTypeShortName == roleName).First(); + + var addRole = _mapper.Map(newIdentityUser); + + addRole.UserTypeEnum = userType.UserTypeEnum; + addRole.UserTypeId = userType.Id; + addRole.IsUserRoleDisabled = false; + + addRoleList.Add(addRole); } - + newIdentityUser.UserRoleList = addRoleList; } + else + { + //匹配的角色 都匹配一遍账号,没有便生成 + foreach (var roleName in matchedRoles) + { + var userType = sysUserTypeList.Where(t => t.UserTypeShortName == roleName).First(); + + var userTypeId = userType.Id; + + + if (!findIdentityUser.UserRoleList.Any(t => t.UserTypeId == userTypeId)) + { + var addRole = _mapper.Map(findIdentityUser); + addRole.UserTypeEnum = userType.UserTypeEnum; + addRole.UserTypeId = userType.Id; + addRole.IsUserRoleDisabled = false; + addRole.Id = NewId.NextSequentialGuid(); + addRole.IdentityUserId = findIdentityUser.Id; + + await _userRoleRepository.AddAsync(addRole); + + } + + } + } + + await _userRoleRepository.SaveChangesAsync(); } + + //返回该账号的在系统的中的所有角色,如果单个角色,就直接登录,如果是多个角色,那么前端进行选择后进行登录 var accountList = _userRoleRepository.Where(t => t.EMail == email && t.UserTypeEnum != UserTypeEnum.SuperAdmin) .ProjectTo(_mapper.ConfigurationProvider).OrderBy(t => t.UserTypeShortName).ToList(); - var hirToken = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo() { Id = Guid.NewGuid(), UserName = tjUserInfo.Data.UserName })); + var hirToken = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = Guid.NewGuid(), UserName = tjUserInfo.Data.UserName }); return ResponseOutput.Ok(accountList, hirToken); @@ -782,128 +845,6 @@ namespace IRaCIS.Core.Application.Service - [NonDynamicMethod] - public async Task> LoginSelectUserType(Guid userId, Guid userTypeId) - { - var userNamePwd = await _userRoleRepository.Where(t => t.Id == userId && t.UserTypeId == userTypeId).Select(t => new { t.UserName, t.Password }).FirstNotNullAsync(); - - return await Login(userNamePwd.UserName, userNamePwd.Password); - } - - - /// - /// 用户登陆 - /// - /// - /// - /// - [NonDynamicMethod] - public async Task> Login(string userName, string password) - { - - int maxFailures = _verifyConfig.CurrentValue.LoginMaxFailCount; - int lockoutMinutes = _verifyConfig.CurrentValue.LoginFailLockMinutes; - - // 生成缓存键 - string cacheKey = CacheKeys.UserLoginError(userName); - - // 从缓存中获取登录失败次数 - int? failCount = await _fusionCache.GetOrDefaultAsync(cacheKey); - - if (failCount == null) - { - failCount = 0; - } - - //每次登录 都重置缓存时间 - await _fusionCache.SetAsync(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes)); - - - if (failCount >= maxFailures) - { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, OptUserId = Guid.Empty, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountLocked }, true); - - //$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。" - throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]); - } - - var userLoginReturnModel = new LoginReturnDTO(); - - - var loginUser = await _userRoleRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); - - if (loginUser == null) - { - - //错误次数累加 - failCount++; - await _fusionCache.SetAsync(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes)); - - var errorPwdUserId = await _userRoleRepository.Where(u => u.UserName == userName).Select(t => t.Id).FirstOrDefaultAsync(); - - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = errorPwdUserId, OptUserId = errorPwdUserId, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountOrPasswordError }, true); - - return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new LoginReturnDTO()); - - } - - if (loginUser.Status == 0) - { - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = loginUser.Id, OptUserId = loginUser.Id, LoginFaildName = userName, OptType = UserOptType.LoginLockedAccount }, true); - - //---该用户已经被禁用。 - return ResponseOutput.NotOk(_localizer["User_Disabled"], new LoginReturnDTO()); - } - - //登录成功 清除缓存 - await _fusionCache.SetAsync(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes)); - var ipinfo = _searcher.Search(_userInfo.IP); - - var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3)); - - if (loginUser.LastLoginIP != string.Empty) - { - // 与上一次IP不一致 - if (loginUser.LastLoginIP != iPRegion) - { - loginUser.LoginState = 2; - } - } - - //超过90天没修改密码 - if (_verifyConfig.CurrentValue.IsNeedChangePassWord && loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-_verifyConfig.CurrentValue.ChangePassWordDays) > loginUser.LastChangePassWordTime.Value) - { - loginUser.LoginState = 1; - } - - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = loginUser.Id, OptUserId = loginUser.Id, OptType = UserOptType.Login }, true); - - userLoginReturnModel.BasicInfo = loginUser; - - if (loginUser.LastChangePassWordTime == null) - { - await _userRoleRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new UserRole() - { - LastChangePassWordTime = DateTime.Now - - }); - - } - - await _userRoleRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new UserRole() - { - LastLoginIP = iPRegion, - LastLoginTime = DateTime.Now - - }); - - userLoginReturnModel.AccountList = _userRoleRepository.Where(t => t.EMail == userLoginReturnModel.BasicInfo.EMail && t.UserTypeEnum != UserTypeEnum.SuperAdmin) - .ProjectTo(_mapper.ConfigurationProvider).ToList(); - - return ResponseOutput.Ok(userLoginReturnModel); - - } - [HttpPost] public async Task> GetUserLogList(UserLogQuery inQuery) { @@ -950,8 +891,8 @@ namespace IRaCIS.Core.Application.Service [HttpGet] public async Task LoginOut(Guid userId) { - await _fusionCache.RemoveAsync(CacheKeys.UserToken(_userInfo.Id)); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = _userInfo.Id, OptType = UserOptType.LoginOut }, true); + await _fusionCache.RemoveAsync(CacheKeys.UserToken(_userInfo.UserRoleId)); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.LoginOut }, true); return ResponseOutput.Ok(); } @@ -1024,17 +965,18 @@ namespace IRaCIS.Core.Application.Service [HttpPut("{newCheckCode}")] public async Task SetNewCheckCode(string newCheckCode) { - var user = await _userRoleRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == _userInfo.Id); + var user = await _userRoleRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == _userInfo.UserRoleId); await _userRoleRepository.UpdatePartialFromQueryAsync(t => t.EMail == user.EMail, u => new UserRole() { CheckCode = newCheckCode }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.ModifyCheckCode }, true); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.ModifyCheckCode }, true); return ResponseOutput.Ok(); } + /// /// 修改密码,当前支持旧密码修改密码 /// @@ -1044,36 +986,288 @@ namespace IRaCIS.Core.Application.Service public async Task ModifyPassword(EditPasswordCommand editPwModel) { - await VerifyUserPwdAsync(_userInfo.Id, editPwModel.NewPassWord, editPwModel.OldPassWord); + await VerifyUserPwdAsync(_userInfo.IdentityUserId, editPwModel.NewPassWord, editPwModel.OldPassWord); if (!string.IsNullOrEmpty(editPwModel.NewUserName)) { - await VerifyUserNameAsync(_userInfo.Id, editPwModel.NewUserName); + await VerifyUserNameAsync(_userInfo.IdentityUserId, editPwModel.NewUserName); - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == _userInfo.Id, u => new UserRole() + await _identityUserRepository.UpdatePartialFromQueryAsync(t => t.Id == _userInfo.IdentityUserId, u => new IdentityUser() { UserName = editPwModel.NewUserName, }); } - await _userRoleRepository.UpdatePartialFromQueryAsync(t => t.Id == _userInfo.Id, u => new UserRole() + var success = await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == _userInfo.IdentityUserId, u => new IdentityUser() { Password = editPwModel.NewPassWord, CheckCode = editPwModel.CheckCode, + LastChangePassWordTime = DateTime.Now, IsFirstAdd = false }); - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.LoginModifyPassword }, true); + await _userPassWordLogRepository.AddAsync(new UserPassWordLog() + { - return ResponseOutput.Ok(); + CreateTime = DateTime.Now, + PassWord = editPwModel.NewPassWord, + IdentityUserId = _userInfo.IdentityUserId, + }); + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.LoginModifyPassword }, true); + + return ResponseOutput.Result(success); } + #endregion + + #region 多账号修改 + + /// + /// 账号验证,获取账号角色信息 获取临时token + /// + /// + /// + [AllowAnonymous] + [HttpPost] + public async Task> GetUserLoginRoleList(IRCLoginDto loginDto, + [FromServices] ITokenService _tokenService, + [FromServices] IOptionsMonitor _emailConfig + ) + { + + var userName = loginDto.UserName; + var password = loginDto.Password; + + var emailConfig = _emailConfig.CurrentValue; + var companyInfo = new SystemEmailSendConfigView() { CompanyName = emailConfig.CompanyName, CompanyNameCN = emailConfig.CompanyNameCN, CompanyShortName = emailConfig.CompanyShortName, CompanyShortNameCN = emailConfig.CompanyShortNameCN, SystemShortName = emailConfig.SystemShortName, EmailRegexStr = emailConfig.EmailRegexStr }; + + + int maxFailures = _verifyConfig.CurrentValue.LoginMaxFailCount; + int lockoutMinutes = _verifyConfig.CurrentValue.LoginFailLockMinutes; + + // 生成缓存键 + string cacheKey = CacheKeys.UserLoginError(userName); + + // 从缓存中获取登录失败次数 + int? failCount = await _fusionCache.GetOrDefaultAsync(cacheKey); + + if (failCount == null) + { + failCount = 0; + } + + //每次登录 都重置缓存时间 + await _fusionCache.SetAsync(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes)); + + + var userLog = new UserLog(); + + if (failCount >= maxFailures) + { + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginPassword = password, OptType = UserOptType.TempLockLogin }, true); + + //$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。" + throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]); + } + + var userLoginReturnModel = new IRCLoginReturnDTO(); + + + var loginUser = await _identityUserRepository.Where(u => (u.UserName.Equals(userName) || u.EMail.Equals(userName)) && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + + var existUserLoginInfo = await _identityUserRepository.Where(u => u.UserName == userName || u.EMail == userName).Select(t => new { t.LastLoginIP, t.LastChangePassWordTime, t.Id }).FirstOrDefaultAsync(); + + var isExistAccount = existUserLoginInfo != null; + + var isLoginUncommonly = false; + + #region //登录用户是系统用户的时候,就要要记录异地登录 + + //账号在系统存在 + if (isExistAccount || loginUser != null) + { + //var ipinfo = _searcher.Search(_userInfo.IP); + + //var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3)); + + //string SplitAndConcatenate(string input) + //{ + // string[] parts = input.Split('|'); + // return parts.Length >= 3 ? parts[0] + parts[1] : string.Join("", parts); + //} + + var iPRegion = IPCityHelper.GetCityResponse(_userInfo.IP); + + //设置本次登录的IP + await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser() + { + LastLoginIP = iPRegion, + LastLoginTime = DateTime.Now + + }); + + //超过90天没修改密码 + + if (loginUser != null && _verifyConfig.CurrentValue.IsNeedChangePassWord && loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-_verifyConfig.CurrentValue.ChangePassWordDays) > loginUser.LastChangePassWordTime.Value) + { + loginUser.NeedChangePassWord = true; + } + + List userOptTypes = new List() { + UserOptType.Login, + UserOptType.AccountOrPasswordError, + UserOptType.LoginLockedAccount + }; + + var actionUserName = loginUser != null ? loginUser.UserName : userName; + + var lastLoginIPRegion = await _userLogRepository.Where(t => t.ActionUserName == actionUserName && userOptTypes.Contains(t.OptType)) + .OrderByDescending(t => t.CreateTime).Select(t => t.IPRegion).FirstOrDefaultAsync(); + + if (lastLoginIPRegion != string.Empty) + { + // 与上一次区域不一致 + //if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion)) + if (lastLoginIPRegion != iPRegion) + { + + isLoginUncommonly = true; + + + if (loginUser != null) + { + //异地登录 + loginUser.LoginState = 2; + + + } + } + } + + } + + #endregion + + + if (loginUser == null) + { + + //错误次数累加 + failCount++; + + await _fusionCache.SetAsync(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes)); + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginPassword = password, OptType = UserOptType.AccountOrPasswordError, IsLoginUncommonly = isLoginUncommonly }, true); + + return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new IRCLoginReturnDTO()); + + } + + //登录成功的,才会算异地登录 + if (loginUser.Status == 0) + { + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true); + + //---该用户已经被禁用。 + return ResponseOutput.NotOk(_localizer["User_Disabled"], new IRCLoginReturnDTO()); + } + + //登录成功 清除缓存 + await _fusionCache.SetAsync(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes)); + + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.Login, IsLoginUncommonly = isLoginUncommonly }, true); + + userLoginReturnModel.BasicInfo = loginUser; + + if (loginUser.LastChangePassWordTime == null) + { + await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.IdentityUserId, x => new IdentityUser() + { + LastChangePassWordTime = DateTime.Now + + }); + + } + + + + //返回临时token + userLoginReturnModel.JWTStr = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = loginUser.IdentityUserId, UserName = userName }); + + + var identityUserId = loginUser.IdentityUserId; + + + + await _fusionCache.SetAsync(CacheKeys.UserToken(identityUserId), userLoginReturnModel.JWTStr, TimeSpan.FromDays(7)); + + await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(identityUserId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes)); + + + userLoginReturnModel.BasicInfo.AccountList = await _userRoleRepository.Where(t => t.IdentityUserId == identityUserId).ProjectTo(_mapper.ConfigurationProvider).OrderBy(t => t.UserTypeShortName).ToListAsync(); + userLoginReturnModel.CompanyInfo = companyInfo; + + + + return ResponseOutput.Ok(userLoginReturnModel); + + } + + /// + /// 验证密码成功后,选定角色,然后获取当前角色的Token + /// + /// + /// + /// + /// + [HttpGet] + public async Task LoginSelectUserRole(Guid userRoleId, [FromServices] ITokenService _tokenService, [FromServices] IReadingImageTaskService readingImageTaskService) + { + var identityUserId = _userInfo.IdentityUserId; + + var userTokenInfo = await _userRoleRepository.Where(t => t.IdentityUserId == identityUserId && t.Id == userRoleId).Select(t => new UserTokenInfo() + { + UserRoleId = t.Id, + IdentityUserId = t.IdentityUserId, + UserTypeEnum = t.UserTypeEnum, + UserTypeId = t.UserTypeId, + IsTestUser = t.IdentityUser.IsTestUser, + IsZhiZhun = t.IdentityUser.IsZhiZhun, + FullName = t.IdentityUser.FullName, + PermissionStr = t.UserTypeRole.PermissionStr, + UserName = t.IdentityUser.UserName, + UserTypeShortName = t.UserTypeRole.UserTypeShortName, + }).FirstOrDefaultAsync(); + + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = userTokenInfo.IdentityUserId, ActionUserName = $"{userTokenInfo.UserName}", ActionUserType = userTokenInfo.UserTypeShortName, OptType = UserOptType.LoginSelectRole }, true); + + if (userTokenInfo != null) + { + var jwt = _tokenService.GetToken(userTokenInfo); + + // 验证阅片休息时间 + await readingImageTaskService.ResetReadingRestTime(userTokenInfo.UserRoleId); + + await _fusionCache.SetAsync(CacheKeys.UserToken(userTokenInfo.IdentityUserId), jwt, TimeSpan.FromDays(7)); + + return jwt; + } + else + { + throw new BusinessValidationFailedException("传递参数查询数据库不存在!"); + } + } + + + #endregion } } diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index cdfd3779b..ae3e5798e 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -73,18 +73,13 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.UserType, u => u.MapFrom(t => t.UserTypeName)); - CreateMap() - .ForMember(d => d.RealName, u => u.MapFrom(s => s.FullName)) - .ForMember(d => d.UserTypeId, u => u.MapFrom(s => s.UserTypeRole.Id)) - .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeName)) - .ForMember(d => d.UserTypeShortName, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) - .ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any())); + CreateMap(); - CreateMap() - .ForMember(d => d.RealName, u => u.MapFrom(s => s.FullName)) - .ForMember(d => d.UserTypeId, u => u.MapFrom(s => s.UserTypeRole.Id)) - .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) - .ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any())); + + CreateMap() + .ForMember(d => d.TrialCode, u => u.MapFrom(s => s.Trial.TrialCode)) + .ForMember(d => d.JoinedTrialCount, u => u.MapFrom(s => s.UserTrialList.Count())) + .ForMember(d => d.ResearchProgramNo, u => u.MapFrom(s => s.Trial.ResearchProgramNo)); var token = string.Empty; var userId = Guid.Empty; @@ -136,7 +131,18 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.UserTypeShortName, c => c.MapFrom(t => t.UserTypeRole.UserTypeShortName)); + CreateMap(); + + + CreateMap(); + + CreateMap(); + + + + + } } diff --git a/IRaCIS.Core.Application/Service/QC/QCCommon.cs b/IRaCIS.Core.Application/Service/QC/QCCommon.cs index da3590c1e..012befc5e 100644 --- a/IRaCIS.Core.Application/Service/QC/QCCommon.cs +++ b/IRaCIS.Core.Application/Service/QC/QCCommon.cs @@ -49,7 +49,7 @@ namespace IRaCIS.Core.Application.Service { subjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId)).IfNullThrowException(); } - if (subjectVisit!.CurrentActionUserId != _userInfo.Id) + if (subjectVisit!.CurrentActionUserId != _userInfo.UserRoleId) { //---您不是该质控任务当前领取人,没有操作权限! throw new BusinessValidationFailedException(_localizer["QCCommon_NoPermission"]); diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index 481ee7aeb..e117819d5 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(inQuery.SubmitState != null, t => t.SubmitState == inQuery.SubmitState) .WhereIf(inQuery.ChallengeState != null, t => t.ChallengeState == inQuery.ChallengeState) .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); @@ -148,7 +148,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == true, t => t.IsClosed ? t.ClosedTime > t.DeadlineTime : DateTime.Now > t.DeadlineTime) .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == false, t => t.IsClosed ? t.ClosedTime < t.DeadlineTime : DateTime.Now < t.DeadlineTime) .WhereIf(inQuery.IsUrgent != null, t => t.SubjectVisit.IsUrgent == inQuery.IsUrgent) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await query.ToPagedListAsync(inQuery, new string[] { nameof(QCCRCChallengeViewModel.IsUrgent) + " desc", nameof(QCCRCChallengeViewModel.CreateTime) }); @@ -207,7 +207,7 @@ namespace IRaCIS.Core.Application.Image.QA var result = await GetQCVisitList(new QCVisitSearchDTO() { TrialId = inDto.TrialId, - CurrentActionUserId = _userInfo.Id, + CurrentActionUserId = _userInfo.UserRoleId, VisitId = inDto.VisitId, PageIndex = 1, PageSize = 1, @@ -289,7 +289,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) //.WhereIf(!string.IsNullOrEmpty(checkQuery.VisitPlanInfo), checkQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(checkQuery.VisitPlanInfo)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))//CRC 过滤负责的site .ProjectTo(_mapper.ConfigurationProvider); var pageList = await query.ToPagedListAsync(inQuery); @@ -311,7 +311,7 @@ namespace IRaCIS.Core.Application.Image.QA var sv = (await _subjectVisitRepository.Where(t => t.Id == subjectVisitId) .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - sv.DialogList.ForEach(t => t.IsCurrentUser = _userInfo.Id == t.CreateUserId); + sv.DialogList.ForEach(t => t.IsCurrentUser = _userInfo.UserRoleId == t.CreateUserId); return sv; } @@ -369,7 +369,7 @@ namespace IRaCIS.Core.Application.Image.QA IsHaveStudyClinicalData = await _clinicalDataTrialSetRepository.AnyAsync(x => x.IsConfirm && x.TrialId == sv.TrialId && x.ClinicalDataLevel == ClinicalLevel.Study), StudyList = temp.StudyList, - ExistsManual = (await _IReadingImageTaskService.GetManualList(new GetManualListInDto() { TrialId = sv.TrialId })).Count() > 0, + ExistsManual =false, SeriesList = temp.SeriesList, RelationInfo = await GetVisitQCSubjectInfo(subjectVisitId), NoneDicomStudyList = await _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(), @@ -542,7 +542,7 @@ namespace IRaCIS.Core.Application.Image.QA { var list = await _qcChallengeRepository.Where(t => t.Id == qaChallengeId) - .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.Id }).ToListAsync(); + .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.UserRoleId }).ToListAsync(); //利用automapper 运行时映射 //list.ForEach(t => t.IsCurrentUser = _userInfo.Id == t.CreateUserId); @@ -564,7 +564,7 @@ namespace IRaCIS.Core.Application.Image.QA { var qaChallengeQuery = _qcChallengeRepository.Where(t => t.SubjectVisitId == subjectVisitId && t.QCProcessEnum == trialQCProcess) - .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.Id }); + .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.UserRoleId }); var list = await qaChallengeQuery.ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 680b9fbc3..0a4ac5fe0 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Image.QA dbQCChallenge.LatestMsgTime = DateTime.Now; - dbQCChallenge.LatestReplyUserId = _userInfo.Id; + dbQCChallenge.LatestReplyUserId = _userInfo.UserRoleId; var success = await _qCChallengeDialogrepository.SaveChangesAsync(); @@ -345,7 +345,7 @@ namespace IRaCIS.Core.Application.Image.QA ResponseOutput.NotOk(_localizer["QCOperation_PassAfterClose"]); } - sv.CheckUserId = _userInfo.Id; + sv.CheckUserId = _userInfo.UserRoleId; sv.CheckState = CheckStateEnum.CVPassed; sv.ReadingStatus = ReadingStatusEnum.TaskAllocate; @@ -835,7 +835,7 @@ namespace IRaCIS.Core.Application.Image.QA subjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == sujectVisitId)).IfNullThrowException(); } - if (subjectVisit!.CurrentActionUserId != _userInfo.Id) + if (subjectVisit!.CurrentActionUserId != _userInfo.UserRoleId) { //---您不是该质控任务当前领取人,没有操作权限! throw new BusinessValidationFailedException(_localizer["QCOperation_NoRecipient"]); @@ -863,7 +863,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.IsTake = true; - dbSubjectVisit.CurrentActionUserId = _userInfo.Id; + dbSubjectVisit.CurrentActionUserId = _userInfo.UserRoleId; dbSubjectVisit.CurrentActionUserExpireTime = DateTime.Now.AddHours(1); @@ -919,8 +919,8 @@ namespace IRaCIS.Core.Application.Image.QA break; case TrialQCProcess.SingleAudit: visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted - && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.Id && (x.CurrentActionUserId == _userInfo.Id || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) - .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id) + && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.UserRoleId && (x.CurrentActionUserId == _userInfo.UserRoleId || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) + .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId) .Include(x => x.Subject).ToListAsync(); subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId) @@ -953,9 +953,9 @@ namespace IRaCIS.Core.Application.Image.QA case TrialQCProcess.DoubleAudit: visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId && - ((x.CurrentActionUserId == _userInfo.Id) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.Id))) + ((x.CurrentActionUserId == _userInfo.UserRoleId) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.UserRoleId))) ) - .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id) + .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId) .Include(x => x.Subject).ToListAsync(); if (subjectVisit != null) { @@ -1046,7 +1046,7 @@ namespace IRaCIS.Core.Application.Image.QA } else if (trialConfig.QCProcessEnum == TrialQCProcess.SingleAudit) { - if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.Id) + if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.UserRoleId) { //---初审已通过,不能继续领取 return ResponseOutput.NotOk(_localizer["QCOperation_InitialAuditPassed"]); @@ -1068,7 +1068,7 @@ namespace IRaCIS.Core.Application.Image.QA } else if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit) { - if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.Id) + if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.UserRoleId) { //---复审不能和初审是同一个人 return ResponseOutput.NotOk(_localizer["QCOperation_NoSameReviewer"]); @@ -1099,7 +1099,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.IsTake = true; - dbSubjectVisit.CurrentActionUserId = _userInfo.Id; + dbSubjectVisit.CurrentActionUserId = _userInfo.UserRoleId; dbSubjectVisit.CurrentActionUserExpireTime = DateTime.Now.AddHours(1); @@ -1109,7 +1109,7 @@ namespace IRaCIS.Core.Application.Image.QA } else { - if (dbSubjectVisit!.CurrentActionUserId != _userInfo.Id) + if (dbSubjectVisit!.CurrentActionUserId != _userInfo.UserRoleId) { //---您不是该质控任务当前领取人,没有操作权限! return ResponseOutput.NotOk(_localizer["QCOperation_NoRecipient"], ApiResponseCodeEnum.NeedTips); @@ -1414,7 +1414,7 @@ namespace IRaCIS.Core.Application.Image.QA { dbSubjectVisit.SubmitState = SubmitStateEnum.Submitted; dbSubjectVisit.SubmitTime = DateTime.Now; - dbSubjectVisit.SubmitUserId = _userInfo.Id; + dbSubjectVisit.SubmitUserId = _userInfo.UserRoleId; //维护统一状态 dbSubjectVisit.ReadingStatus = ReadingStatusEnum.ImageQuality; @@ -1513,7 +1513,7 @@ namespace IRaCIS.Core.Application.Image.QA public async Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState) { - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.Id)) + if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.UserRoleId)) { //---您已经被移出项目,没有操作权限。 return ResponseOutput.NotOk(_localizer["QCOperation_RemoveItem"]); @@ -1574,7 +1574,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.AuditState = AuditStateEnum.QCPassed; dbSubjectVisit.CheckState = trialConfig.IsImageConsistencyVerification ? CheckStateEnum.ToCheck : CheckStateEnum.CVPassed; dbSubjectVisit.ForwardState = trialConfig.IsImageConsistencyVerification ? ForwardStateEnum.None : ForwardStateEnum.ToForward; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; dbSubjectVisit.PreliminaryAuditTime = DateTime.Now; @@ -1618,7 +1618,7 @@ namespace IRaCIS.Core.Application.Image.QA } dbSubjectVisit.AuditState = AuditStateEnum.PrimaryQCPassed; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; dbSubjectVisit.PreliminaryAuditTime = DateTime.Now; @@ -1638,7 +1638,7 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.ForwardState = trialConfig.IsImageConsistencyVerification ? ForwardStateEnum.None : ForwardStateEnum.ToForward; - dbSubjectVisit.ReviewAuditUserId = _userInfo.Id; + dbSubjectVisit.ReviewAuditUserId = _userInfo.UserRoleId; dbSubjectVisit.ReviewAuditTime = DateTime.Now; @@ -1682,7 +1682,7 @@ namespace IRaCIS.Core.Application.Image.QA if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC) { dbSubjectVisit.AuditState = AuditStateEnum.QCFailed; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; } else @@ -1697,12 +1697,12 @@ namespace IRaCIS.Core.Application.Image.QA if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC) { dbSubjectVisit.AuditState = AuditStateEnum.QCFailed; - dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id; + dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId; } else if (dbSubjectVisit.AuditState == AuditStateEnum.InSecondaryQC) { dbSubjectVisit.AuditState = AuditStateEnum.QCFailed; - dbSubjectVisit.ReviewAuditUserId = _userInfo.Id; + dbSubjectVisit.ReviewAuditUserId = _userInfo.UserRoleId; } else { @@ -1717,7 +1717,7 @@ namespace IRaCIS.Core.Application.Image.QA } - dbSubjectVisit.Auditor = _userInfo.Id; + dbSubjectVisit.Auditor = _userInfo.UserRoleId; dbSubjectVisit.IsTake = false; dbSubjectVisit.CurrentActionUserId = null; dbSubjectVisit.CurrentActionUserExpireTime = null; @@ -1818,7 +1818,7 @@ namespace IRaCIS.Core.Application.Image.QA qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.QCAgreeUpload; qcChallenge.LatestMsgTime = DateTime.Now; - qcChallenge.LatestReplyUserId = _userInfo.Id; + qcChallenge.LatestReplyUserId = _userInfo.UserRoleId; await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == qcChallenge.SubjectVisitId, c => new SubjectVisit() { IsQCConfirmedReupload = true }); @@ -1845,7 +1845,7 @@ namespace IRaCIS.Core.Application.Image.QA sv.AuditState = AuditStateEnum.InPrimaryQC; sv.CurrentActionUserExpireTime = DateTime.Now.AddHours(1); - sv.CurrentActionUserId = _userInfo.Id; + sv.CurrentActionUserId = _userInfo.UserRoleId; //BackgroundJob.Schedule(t => t.CancelQCObtaion(qcChallenge.SubjectVisitId, DateTime.Now), TimeSpan.FromHours(1)); sv.IsTake = true; @@ -1936,13 +1936,13 @@ namespace IRaCIS.Core.Application.Image.QA qcChallenge.ReUploadedTime = DateTime.Now; - qcChallenge.ReUploadUserId = _userInfo.Id; + qcChallenge.ReUploadUserId = _userInfo.UserRoleId; - qcChallenge.ReUploader = _userInfo.RealName; + qcChallenge.ReUploader = _userInfo.FullName; qcChallenge.LatestMsgTime = DateTime.Now; - qcChallenge.LatestReplyUserId = _userInfo.Id; + qcChallenge.LatestReplyUserId = _userInfo.UserRoleId; var dbSubjectVisit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == qcChallenge.SubjectVisitId).IfNullThrowException(); @@ -2013,7 +2013,7 @@ namespace IRaCIS.Core.Application.Image.QA } qcChallenge.LatestMsgTime = DateTime.Now; - qcChallenge.LatestReplyUserId = _userInfo.Id; + qcChallenge.LatestReplyUserId = _userInfo.UserRoleId; qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.CRCRequestReupload; qcChallenge.DialogList.Add(new QCChallengeDialog() diff --git a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs index 11b73f720..b7bb3a914 100644 --- a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs @@ -35,7 +35,6 @@ namespace IRaCIS.Core.Application.Contracts Task AddOncologyTask(Guid oncologModuleId); - Task> GetManualList(GetManualListInDto inDto); Task ResetReadingRestTime(Guid? userId); diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs index 501726155..2ca4eb1bb 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs @@ -429,7 +429,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = (inDto.IsSendDialog && !medicalReview.IsSendMessage && inDto.IsHaveQuestion) ? _userInfo.Id : null, + LatestReplyUserId = (inDto.IsSendDialog && !medicalReview.IsSendMessage && inDto.IsHaveQuestion) ? _userInfo.UserRoleId : null, IsHaveQuestion = inDto.IsHaveQuestion, Questioning = inDto.Questioning, IsSendMessage = inDto.IsSendDialog && inDto.IsHaveQuestion, @@ -472,7 +472,7 @@ namespace IRaCIS.Core.Application.Service { await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, IsClosedDialog = inDto.IsClosedDialog, MedicalDialogCloseEnum = inDto.MedicalDialogCloseEnum, DialogCloseReason = inDto.DialogCloseReason, @@ -511,7 +511,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, }); var visitTaskId = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).Select(x => x.VisitTaskId).FirstOrDefaultAsync(); @@ -567,7 +567,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(x => !x.IsClosedDialog && x.Id == inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, IsClosedDialog = true, MedicalDialogCloseEnum = MedicalDialogClose.IRApplyReReading, @@ -581,7 +581,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum, }); ReadingMedicalReviewDialog dialog = new ReadingMedicalReviewDialog() @@ -618,7 +618,7 @@ namespace IRaCIS.Core.Application.Service .OrderBy(x => x.CreateTime).ToListAsync(); result.ForEach(x => { - x.IsCurrentUser = x.CreateUserId == _userInfo.Id; + x.IsCurrentUser = x.CreateUserId == _userInfo.UserRoleId; }); return (result, new { @@ -711,7 +711,7 @@ namespace IRaCIS.Core.Application.Service await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview() { - LatestReplyUserId = _userInfo.Id, + LatestReplyUserId = _userInfo.UserRoleId, DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum, DisagreeReason = inDto.DisagreeReason, IsApplyHeavyReading = inDto.IsApplyHeavyReading, @@ -785,7 +785,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetIRMedicalFeedbackList(GetIRMedicalFeedbackListInDto inDto) { var taskMedicalReviewquery = _taskMedicalReviewRepository.Where(x => x.TrialId == inDto.TrialId).Include(x => x.VisitTask) - .Where(x => x.VisitTask.DoctorUserId == _userInfo.Id) + .Where(x => x.VisitTask.DoctorUserId == _userInfo.UserRoleId) .Where(x => x.IsHaveQuestion) .WhereIf(!inDto.TaskBlindName.IsNullOrEmpty(), x => x.VisitTask.TaskBlindName == inDto.TaskBlindName) .WhereIf(inDto.SubjectId != null, x => x.VisitTask.SubjectId == inDto.SubjectId!) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index c8b7342fa..b4177a46b 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -46,7 +46,6 @@ namespace IRaCIS.Core.Application.Service IRepository _readModuleRepository, IRepository _dicomInstanceRepository, IRepository _organInfoRepository, - IRepository _trialDocumentRepository, ILuganoCalculateService _luganoCalculateService, IRepository _readingCustomTagRepository, IRepository _readingTaskQuestionMarkRepository, @@ -214,39 +213,8 @@ namespace IRaCIS.Core.Application.Service return result; } - /// - /// 获取手册 - /// - /// - /// - [HttpPost] - public async Task> GetManualList(GetManualListInDto inDto) - { - UserTypeEnum userType = (UserTypeEnum)_userInfo.UserTypeEnumInt; - List canViewUserType = new List() - { - UserTypeEnum.IndependentReviewer, - UserTypeEnum.IQC, - - }; - - return await _trialDocumentRepository.Where(x => x.TrialId == inDto.TrialId - && x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.Id && y.ConfirmTime != null) - && x.NeedConfirmedUserTypeList.Any(y => y.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .WhereIf(userType == UserTypeEnum.IndependentReviewer, t => t.FileType.Code == "2" || t.FileType.Code == "6") - .WhereIf(userType == UserTypeEnum.IQC, t => t.FileType.Code == "4" || t.FileType.Code == "5") - .WhereIf(!canViewUserType.Contains(userType), t => false) - .IgnoreQueryFilters() - .Select(x => new GetManualListOutDto() - { - Id = x.Id, - Name = x.Name, - Path = x.Path - }).ToListAsync(); - } - /// /// 获取任务附加问题 /// @@ -383,7 +351,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task ChangeCalculationAnswer(ChangeCalculationAnswerInDto inDto) { var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); @@ -459,7 +427,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task ReadClinicalData(ReadClinicalDataInDto inDto) { await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask @@ -836,7 +804,7 @@ namespace IRaCIS.Core.Application.Service var criterionIdInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync(); - var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId &&( x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable)).Select(x => x.GroupId).Distinct().ToListAsync(); + var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable)).Select(x => x.GroupId).Distinct().ToListAsync(); var questionIds = await _readingQuestionTrialRepository .Where(x => x.IsShowInDicom) @@ -1364,7 +1332,7 @@ namespace IRaCIS.Core.Application.Service item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x => x.ShowOrder).ToList(); item.TableQuestions.Questions.ForEach(x => { - x.RelationQuestions= _mapper.Map>(tableQuestionLists.Where(z => (z.DependParentId ?? default(Guid)) == x.Id)); + x.RelationQuestions = _mapper.Map>(tableQuestionLists.Where(z => (z.DependParentId ?? default(Guid)) == x.Id)); x.RelationQuestions.ForEach(y => { y.Childrens = new List(); @@ -1374,7 +1342,7 @@ namespace IRaCIS.Core.Application.Service y.LesionType = item.LesionType; y.RelationQuestions = new List(); }); - + }); var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList(); @@ -1528,7 +1496,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task SplitLesion(SplitLesionInDto inDto) { await VerifyTaskIsSign(inDto.VisitTaskId); @@ -1766,7 +1734,7 @@ namespace IRaCIS.Core.Application.Service /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task SaveImageQuality(ChangeDicomReadingQuestionAnswerInDto inDto) { inDto.UpdateMark = true; @@ -1825,7 +1793,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task ChangeDicomReadingQuestionAnswer(ChangeDicomReadingQuestionAnswerInDto inDto) { await VerifyTaskIsSign(inDto.VisitTaskId); @@ -1942,7 +1910,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto) { await VerifyTaskIsSign(inDto.VisitTaskId); @@ -2129,7 +2097,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task SubmitTableQuestion(SubmitTableQuestionInDto inDto) { SubmitTableQuestionOutDto result = new SubmitTableQuestionOutDto(); @@ -2316,7 +2284,7 @@ namespace IRaCIS.Core.Application.Service && x.QuestionId == inDto.QuestionId ).CountAsync()) + 1)) { - throw new BusinessValidationFailedException(_localizer["ReadingImage_MaxQuestion", _userInfo.IsEn_Us? questionInfo.QuestionEnName:questionInfo.QuestionName, questionInfo.MaxQuestionCount]); + throw new BusinessValidationFailedException(_localizer["ReadingImage_MaxQuestion", _userInfo.IsEn_Us ? questionInfo.QuestionEnName : questionInfo.QuestionName, questionInfo.MaxQuestionCount]); } } @@ -2528,7 +2496,7 @@ namespace IRaCIS.Core.Application.Service /// /// /// - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task SubmitDicomVisitTask(SubmitDicomVisitTaskInDto inDto) { @@ -2613,7 +2581,7 @@ namespace IRaCIS.Core.Application.Service var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).FirstNotNullAsync(); - var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId&&x.Type != "group") + var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.Type != "group") .WhereIf(taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyBaseLine))) .WhereIf(!taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyVisit))) .WhereIf(taskInfo.TrialReadingCriterion.CriterionType == CriterionType.PCWG3, x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation) @@ -2729,7 +2697,7 @@ namespace IRaCIS.Core.Application.Service public async Task ClearSkipReadingCache() { - await _fusionCache.RemoveAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id)); + await _fusionCache.RemoveAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId)); return true; } @@ -2742,18 +2710,18 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task SetSkipReadingCache(SetSkipReadingCacheInDto inDto) { - var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id)); + var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId)); if (clearSkipReadingCache == null || clearSkipReadingCache == string.Empty) { List cacheIds = new List(); cacheIds.Add(inDto.VisitTaskId); - await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); + await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); } else { List? cacheIds = JsonConvert.DeserializeObject>(clearSkipReadingCache); cacheIds.Add(inDto.VisitTaskId); - await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); + await _fusionCache.SetAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24)); } return true; } @@ -2784,7 +2752,7 @@ namespace IRaCIS.Core.Application.Service #region 跳过阅片 - var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id)); + var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId)); List cacheSkipIds = new List(); @@ -2892,7 +2860,7 @@ namespace IRaCIS.Core.Application.Service List remainingItems = taskList.Select(x => x.Id).Except(cacheSkipIds).ToList(); //受试者随机固定排序 - taskList = taskList.Where(x => remainingItems.Contains(x.Id)).OrderBy(t=>t.TaskBlindName).ToList(); + taskList = taskList.Where(x => remainingItems.Contains(x.Id)).OrderBy(t => t.TaskBlindName).ToList(); // 当前受试者没有就找其他受试者 if (taskList.Count() == 0) @@ -2949,10 +2917,10 @@ namespace IRaCIS.Core.Application.Service } else { - var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id + var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.UserRoleId && x.TrialReadingCriterionId == trialReadingCriterionId && x.TaskState == TaskState.Effect) - .Where(x=> !cacheSkipIds.Contains(x.Id)); + .Where(x => !cacheSkipIds.Contains(x.Id)); var count = await query.CountAsync(); if (count == 0) { @@ -3066,7 +3034,7 @@ namespace IRaCIS.Core.Application.Service task.IsConvertedTask = visitTaskInfo.IsConvertedTask; var blindSubjectCode = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).Select(x => x.BlindSubjectCode).FirstNotNullAsync(); task.SubjectCode = blindSubjectCode.IsNullOrEmpty() ? task.SubjectCode : blindSubjectCode; - task.ExistsManual = (await GetManualList(new GetManualListInDto() { TrialId = visitTaskInfo.TrialId })).Count > 0; + task.ExistsManual = false; task.ReadingTaskState = visitTaskInfo.ReadingTaskState; // 添加默认答案 if (inDto.VisitTaskId == null && visitTaskInfo.ReadingTaskState != ReadingTaskState.HaveSigned) @@ -3124,17 +3092,17 @@ namespace IRaCIS.Core.Application.Service { return true; } - var startReadingTimeKey = _userInfo.Id.ToString() + "StartReadingTime"; - var startRestTimeKey = _userInfo.Id.ToString() + "StartRestTime"; + var startReadingTimeKey = _userInfo.UserRoleId.ToString() + "StartReadingTime"; + var startRestTimeKey = _userInfo.UserRoleId.ToString() + "StartRestTime"; int readingMinute = _verifyConfig.CurrentValue.ContinuousReadingTimeMin; // 为60整数 int restMinute = _verifyConfig.CurrentValue.ReadingRestTimeMin; // - var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id)); - var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.Id)); + var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId)); + var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); if (startReadingTime == null && startRestTime == null) { - await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); } else if (startRestTime != null) { @@ -3147,8 +3115,8 @@ namespace IRaCIS.Core.Application.Service else { // 休息时间>10分钟 删除休息时间的缓存 记录开始阅片时间 - await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.Id)); - await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); + await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); } } @@ -3160,8 +3128,8 @@ namespace IRaCIS.Core.Application.Service int timespanMin = (DateTime.Now - cacheDate).Minutes; if (timespanMin > readingMinute) { - await _fusionCache.RemoveAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id)); - await _fusionCache.SetAsync(CacheKeys.StartRestTime(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.RemoveAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId)); + await _fusionCache.SetAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", readingMinute / 60m, restMinute]); } @@ -3181,26 +3149,26 @@ namespace IRaCIS.Core.Application.Service { if (userID == null) { - userID = _userInfo.Id; + userID = _userInfo.UserRoleId; } //int readingMinute = 120; // 为60整数 int restMinute = 10; // - var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id)); - var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.Id)); + var startReadingTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId)); + var startRestTime = await _fusionCache.GetOrDefaultAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); if (startRestTime != null) { var cacheStartRestTime = DateTime.Parse(startRestTime!.ToString()); int timespanMin = (DateTime.Now - cacheStartRestTime).Minutes; if (timespanMin > restMinute) { - await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.Id)); + await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId)); } } else if (startReadingTime != null) { - await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + await _fusionCache.SetAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); } return true; } @@ -3215,7 +3183,7 @@ namespace IRaCIS.Core.Application.Service await VerifyTaskIsSign(visitTaskId); await _visitTaskRepository.UpdatePartialFromQueryAsync(visitTaskId, x => new VisitTask() { - DoctorUserId = _userInfo.Id, + DoctorUserId = _userInfo.UserRoleId, ReadingTaskState = ReadingTaskState.HaveSigned, SignTime = DateTime.Now, }); @@ -3430,7 +3398,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task AddReadingTask(Guid visitTaskId, Guid? trialId = null) { // ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********//// diff --git a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs index 4bd2e0754..502f937ed 100644 --- a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs @@ -27,7 +27,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetDoctorShortcutKey(DefaultShortcutKeyQuery inQuery) { var shortcutKeyList = await _shortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType) - .Where(x => x.UserId == _userInfo.Id) + .Where(x => x.UserId == _userInfo.UserRoleId) .ToListAsync(); var defaultshortcutKeyList = this.GetDefaultShortcutKey(); @@ -302,17 +302,17 @@ namespace IRaCIS.Core.Application.Service var shortcutKeys = GetDefaultShortcutKey(); shortcutKeys.ForEach(x => { - x.UserId = _userInfo.Id; + x.UserId = _userInfo.UserRoleId; }); - await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.Id); + await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.UserRoleId); await _shortcutKeyRepository.AddRangeAsync(shortcutKeys.Select(x => new ShortcutKey() { ImageToolType = inDto.ImageToolType, Keyboardkey = x.Keyboardkey, ShortcutKeyEnum = x.ShortcutKeyEnum, - UserId = _userInfo.Id, + UserId = _userInfo.UserRoleId, AltKey = x.AltKey, CtrlKey = x.CtrlKey, MetaKey = x.MetaKey, @@ -332,14 +332,14 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task SetShortcutKey(SetDefaultShortcutKey inDto) { - await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.Id); + await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.UserRoleId); await _shortcutKeyRepository.AddRangeAsync(inDto.ShortcutKeyList.Select(x => new ShortcutKey() { ImageToolType = inDto.ImageToolType, Keyboardkey = x.Keyboardkey, ShortcutKeyEnum = x.ShortcutKeyEnum, - UserId = _userInfo.Id, + UserId = _userInfo.UserRoleId, AltKey = x.AltKey, CtrlKey = x.CtrlKey, MetaKey = x.MetaKey, diff --git a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs index 684f0c84f..6a43b2333 100644 --- a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/UserWLTemplateService.cs @@ -28,7 +28,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetUserWLTemplateList(UserWLTemplateQuery inQuery) { var userWLTemplateQueryable = _userWLTemplateRepository - .Where(x => x.UserId == _userInfo.Id) + .Where(x => x.UserId == _userInfo.UserRoleId) .ProjectTo(_mapper.ConfigurationProvider); return await userWLTemplateQueryable.ToListAsync(); } @@ -40,10 +40,10 @@ namespace IRaCIS.Core.Application.Service /// public async Task AddOrUpdateUserWLTemplate(UserWLTemplateAddOrEdit addOrEditUserWLTemplate) { - addOrEditUserWLTemplate.UserId = _userInfo.Id; + addOrEditUserWLTemplate.UserId = _userInfo.UserRoleId; if (addOrEditUserWLTemplate.Id == null) { - var count = await _userWLTemplateRepository.Where(x => x.UserId == _userInfo.Id).CountAsync(); + var count = await _userWLTemplateRepository.Where(x => x.UserId == _userInfo.UserRoleId).CountAsync(); if (count >= 10) { throw new BusinessValidationFailedException(_localizer["UserWLTS_MaxTemplate"]); @@ -51,12 +51,12 @@ namespace IRaCIS.Core.Application.Service } - if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.Id && x.TemplateName == addOrEditUserWLTemplate.TemplateName && x.Id != addOrEditUserWLTemplate.Id)) + if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.UserRoleId && x.TemplateName == addOrEditUserWLTemplate.TemplateName && x.Id != addOrEditUserWLTemplate.Id)) { throw new BusinessValidationFailedException(_localizer["UserWLTS_NameRepeated"]); } - if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.Id && x.WW == addOrEditUserWLTemplate.WW && x.WL == addOrEditUserWLTemplate.WL && x.Id != addOrEditUserWLTemplate.Id)) + if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.UserRoleId && x.WW == addOrEditUserWLTemplate.WW && x.WL == addOrEditUserWLTemplate.WL && x.Id != addOrEditUserWLTemplate.Id)) { throw new BusinessValidationFailedException(_localizer["UserWLTS_ContentRepeated"]); } @@ -85,7 +85,7 @@ namespace IRaCIS.Core.Application.Service public async Task GetAutoCutNextTask() { - return await _userRoleRepository.Where(x => x.Id == _userInfo.Id).Select(x => new + return await _userRoleRepository.Where(x => x.Id == _userInfo.UserRoleId).Select(x => new { AutoCutNextTask = x.AutoCutNextTask }).FirstNotNullAsync(); @@ -100,7 +100,7 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task SetAutoCutNextTask(SetAutoCutNextTaskInDto inDto) { - await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.Id, x => new UserRole() + await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.UserRoleId, x => new UserRole() { AutoCutNextTask = inDto.AutoCutNextTask diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteEquipmentSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteEquipmentSurveyViewModel.cs deleted file mode 100644 index e503d80af..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteEquipmentSurveyViewModel.cs +++ /dev/null @@ -1,64 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:21:04 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -namespace IRaCIS.Core.Application.Contracts -{ - /// TrialSiteEquipmentSurveyView 列表视图模型 - public class TrialSiteEquipmentSurveyView - { - public Guid Id { get; set; } - public Guid TrialSiteSurveyId { get; set; } - public string EquipmentType { get; set; } = string.Empty; - public Guid? EquipmentTypeId { get; set; } - - public string Parameters { get; set; } = string.Empty; - public string ManufacturerName { get; set; } = string.Empty; - public string ScannerType { get; set; } = string.Empty; - public string Note { get; set; } = string.Empty; - public DateTime CreateTime { get; set; } - public Guid CreateUserId { get; set; } - public DateTime UpdateTime { get; set; } - public Guid UpdateUserId { get; set; } - } - - ///TrialSiteEquipmentSurveyQuery 列表查询参数模型 - public class TrialSiteEquipmentSurveyQuery - { - - public Guid TrialSiteSurveyId { get; set; } - - public string ScannerType { get; set; } = string.Empty; - - ///// Parameters - //public string Parameters { get; set; } - - ///// ManufacturerName - //public string ManufacturerName { get; set; } - - ///// ScannerType - //public string ScannerType { get; set; } - - ///// Note - //public string Note { get; set; } - - } - - /// TrialSiteEquipmentSurveyAddOrEdit 列表查询参数模型 - public class TrialSiteEquipmentSurveyAddOrEdit - { - public Guid? Id { get; set; } - public Guid TrialSiteSurveyId { get; set; } - - public Guid? EquipmentTypeId { get; set; } - public string Parameters { get; set; } = string.Empty; - public string ManufacturerName { get; set; } = string.Empty; - public string ScannerType { get; set; } = string.Empty; - public string Note { get; set; } = string.Empty; - } - - -} - - diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs deleted file mode 100644 index 12929ea52..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ /dev/null @@ -1,397 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:21:04 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Application.Contracts; -using IRaCIS.Core.Domain.Share; -using System.ComponentModel.DataAnnotations; -namespace IRaCIS.Core.Application.Contracts -{ - - public class TrialSurveyInitInfo - { - public Guid TrialId { get; set; } - public string Sponsor { get; set; } = string.Empty; - - //研究方案号 - public string ResearchProgramNo { get; set; } = string.Empty; - - //实验名称 - public string ExperimentName { get; set; } = string.Empty; - - public string TrialCode { get; set; } = string.Empty; - - public Guid IndicationTypeId { get; set; } - - public string IndicationType { get; set; } = string.Empty; - - public string TrialSiteSurveyUserRoles { get; set; } = string.Empty; - - public string TrialSiteSurveyEquipmentType { get; set; } = string.Empty; - - public string Modalitys { get; set; } - - public List TrialSiteSelectList { get; set; } = new List(); - - } - - public class TrialSiteForSelect - { - public Guid TrialSiteId => Id; - public Guid Id { get; set; } - public Guid TrialId { get; set; } - - public Guid? SiteId { get; set; } - - public string TrialSiteCode { get; set; } = string.Empty; - - public string TrialSiteAliasName { get; set; } = string.Empty; - - - public bool IsHaveSiteSurveyRecord { get; set; } - } - - - public class TrialSiteSimpleSelect - { - - public string TrialSiteCode { get; set; } = string.Empty; - - } - - public class LoginReturnDTO - { - public TrialSurveyInitInfo TrialInfo { get; set; } = new TrialSurveyInitInfo(); - - public TrialSiteSurveyView TrialSiteSurvey { get; set; } = new TrialSiteSurveyView(); - - public List TrialSiteEquipmentSurveyList { get; set; } = new List(); - - public List TrialSiteUserSurveyList { get; set; } = new List(); - - - public TrialExtraConfig SiteSurveyFiledConfig { get; set; } - } - - public class TrialSiteUserSurveyAllDTO : TrialSiteUserSurveyView - { - public TrialSiteSurveyView TrialSiteSurvey { get; set; } - } - - - public class TrialSiteUserSurveyExportQueryDto - { - [NotDefault] - public Guid TrialId { get; set; } - public Guid? TrialSiteId { get; set; } - - public Guid? UserTypeId { get; set; } - - - public bool? IsGenerateAccount { get; set; } - - public TrialSiteUserStateEnum? State { get; set; } - - public string FormWriterKeyInfo { get; set; } = string.Empty; - - - public string UserName { get; set; } = string.Empty; - - public string OrganizationName { get; set; } = string.Empty; - - } - - - public class TrialSiteUserSurveyAllQuery : PageInput - { - [NotDefault] - public Guid TrialId { get; set; } - public Guid? TrialSiteId { get; set; } - - public Guid? UserTypeId { get; set; } - - - public bool? IsGenerateAccount { get; set; } - public int? TrialRoleCode { get; set; } - - public TrialSiteUserStateEnum? State { get; set; } - - public string FormWriterKeyInfo { get; set; } = string.Empty; - - - public string UserName { get; set; } = string.Empty; - - public string OrganizationName { get; set; } = string.Empty; - - - } - - - /// TrialSiteSurveyView 列表视图模型 - public class TrialSiteSurveyView - { - - public string TrialSiteCode { get; set; } = String.Empty; - public string TrialSiteAliasName { get; set; } = String.Empty; - - public string SiteName { get; set; } = string.Empty; - public bool IsDeleted { get; set; } - public Guid Id { get; set; } - public Guid TrialId { get; set; } - public Guid TrialSiteId { get; set; } - public DateTime CreateTime { get; set; } - public Guid CreateUserId { get; set; } - public DateTime UpdateTime { get; set; } - public Guid UpdateUserId { get; set; } - public string UserName { get; set; } = string.Empty; - public string Phone { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - public int AverageEngravingCycle { get; set; } - public bool IsConfirmImagingTechnologist { get; set; } - public string NotConfirmReson { get; set; } = string.Empty; - public int EfficacyEvaluatorType { get; set; } - public bool IsFollowStudyParameters { get; set; } - public string NotFollowReson { get; set; } = string.Empty; - - public TrialSiteSurveyEnum State { get; set; } - - public string LatestBackReason { get; set; } = string.Empty; - - public UserInfoBasic ReviewerUser { get; set; } - public UserInfoBasic PreliminaryUser { get; set; } - - public Guid? PreliminaryUserId { get; set; } - - public Guid? ReviewerUserId { get; set; } - - - public DateTime? PreliminaryTime { get; set; } - - public DateTime? ReviewerTime { get; set; } - - - - - } - - public class TrialSiteSurveySelectView - { - public Guid Id { get; set; } - public TrialSiteSurveyEnum State { get; set; } - public DateTime CreateTime { get; set; } - public bool IsDeleted { get; set; } - - public string Phone { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - - public string UserName { get; set; } = string.Empty; - - } - - public class TrialSiteSurveySelectquery - { - public Guid TrialId { get; set; } - - public Guid TrialSiteId { get; set; } - - public Guid TrialSiteSurveyId { get; set; } - } - - ///TrialSiteSurveyQuery 列表查询参数模型 - public class TrialSiteSurveyQuery - { - public Guid TrialId { get; set; } - - public Guid TrialSiteId { get; set; } - - ///// UserName - //public string UserName { get; set; } - - ///// Phone - //public string Phone { get; set; } - - ///// Email - //public string Email { get; set; } - - ///// NotConfirmReson - //public string NotConfirmReson { get; set; } - - ///// NotFollowReson - //public string NotFollowReson { get; set; } - - } - - public class VerifyEmialGetDoctorInfoInDto - { - public string VerificationCode { get; set; } - - public string EmailOrPhone { get; set; } - } - - /// - /// - /// - public class UseUserIDGetDoctorIDOutDto - { - public Guid? DoctorID { get; set; } - } - - - public class UseUserIDGetDoctorIDInDto - { - public Guid UserID { get; set; } - } - - public class VerifyEmialGetDoctorInfoOutDto - { - public Guid? DoctorId { get; set; } - - public ReviewerInformationConfirmStatus? ReviewStatus { get; set; } - - public string Token { get; set; } - } - - public class SendEmialVerifyCodeInDto - { - public string Email { get; set; } = string.Empty; - } - - public class SiteSurveySendVerifyCode - { - //public VerifyType verificationType { get; set; } - public string Email { get; set; } = string.Empty; - - [NotDefault] - public Guid TrialId { get; set; } - - } - - public class LoginDto - { - public Guid TrialId { get; set; } - - public Guid TrialSiteId { get; set; } - - - public bool IsUpdate { get; set; } - - - public string ReplaceUserEmailOrPhone { get; set; } = string.Empty; - - public VerifyType verificationType { get; set; } - public string EmailOrPhone { get; set; } = string.Empty; - - public string verificationCode { get; set; } = string.Empty; - } - - - /// TrialSiteSurveyAddOrEdit 列表查询参数模型 - public class TrialSiteSurveyAddOrEdit - { - public Guid? Id { get; set; } - public Guid TrialId { get; set; } - public Guid TrialSiteId { get; set; } - public string UserName { get; set; } = string.Empty; - public string Phone { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - public int AverageEngravingCycle { get; set; } - public bool IsConfirmImagingTechnologist { get; set; } - public string NotConfirmReson { get; set; } = string.Empty; - public int EfficacyEvaluatorType { get; set; } - public bool IsFollowStudyParameters { get; set; } - public string NotFollowReson { get; set; } = string.Empty; - - - } - - - public class TrialSiteSubmitBackCommand - { - [NotDefault] - public Guid TrialId { get; set; } - [NotDefault] - public Guid TrialSiteSurveyId { get; set; } - - public string LatestBackReason { get; set; } = string.Empty; - - public string RouteUrl { get; set; } - } - - public class InviteEmailCommand - { - [NotDefault] - public Guid TrialId { get; set; } - - - public string RouteUrl { get; set; } = string.Empty; - - public List UserList { get; set; } = new List(); - } - - - public class TrialSiteUserSurveyJoinCommand - { - [NotDefault] - public Guid TrialId { get; set; } - - public Guid TrialSiteSurveyId { get; set; } - - public string BaseUrl { get; set; } = string.Empty; - - public string RouteUrl { get; set; } = string.Empty; - - public List UserList { get; set; } = new List(); - } - - - public class TrialSiteSurvyeSubmitDTO - { - [NotDefault] - public Guid TrialId { get; set; } - [NotDefault] - public Guid TrialSiteSurveyId { get; set; } - - - public string BaseUrl { get; set; } = string.Empty; - public string RouteUrl { get; set; } = string.Empty; - } - - public class TrialSiteSurveyQueryDTO : PageInput - { - [NotDefault] - public Guid TrialId { get; set; } - - public Guid? TrialSiteId { get; set; } - - public string UserKeyInfo { get; set; } = string.Empty; - - - - public TrialSiteSurveyEnum? State { get; set; } - - public bool? IsDeleted { get; set; } - - public DateTime? UpdateTimeBegin { get; set; } - - public DateTime? UpdateTimeEnd { get; set; } - - public string? PreliminaryUserName { get; set; } - - public string? ReviewerUserName { get; set; } - - } - - public class CopyTrialSiteSurveyDTO - { - public Guid TrialSiteSurveyId { get; set; } - public string UserName { get; set; } = string.Empty; - public string Phone { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - } - - -} - - diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs deleted file mode 100644 index 923e6f585..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ /dev/null @@ -1,171 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:21:04 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using IRaCIS.Core.Application.Helper; -using IRaCIS.Core.Domain.Share; -using MiniExcelLibs.Attributes; -using Newtonsoft.Json; -using System.ComponentModel.DataAnnotations; - -namespace IRaCIS.Core.Application.Contracts -{ - /// TrialSiteUserSurveyView 列表视图模型 - public class TrialSiteUserSurveyView : TrialSiteUserSurveyAddOrEdit - { - public bool IsGenerateSuccess { get; set; } - public DateTime CreateTime { get; set; } - public Guid CreateUserId { get; set; } - public DateTime UpdateTime { get; set; } - public Guid UpdateUserId { get; set; } - - public string UserType { get; set; } = string.Empty; - - [JsonIgnore] - public TrialSiteUserStateEnum InviteState { get; set; } - - public DateTime? ExpireTime { get; set; } - - [DictionaryTranslateAttribute("YesOrNo")] - public bool? IsJoin { get; set; } - - public DateTime? ConfirmTime { get; set; } - - public string RejectReason { get; set; } = string.Empty; - - [DictionaryTranslateAttribute("researchUserState")] - public TrialSiteUserStateEnum State - { - get - { - if (InviteState == TrialSiteUserStateEnum.HasSend && ExpireTime != null && ExpireTime < DateTime.Now) - { - return TrialSiteUserStateEnum.OverTime; - } - else - { - return InviteState; - } - } - } - - - - public UserTypeEnum? UserTypeEnum { get; set; } - - public Guid? SystemUserId { get; set; } - - - - - public bool? IsHistoryUserOriginDeleted { get; set; } - - - } - - - public class UserInfoBasic - { - public Guid Id { get; set; } - public string RealName { get; set; } = string.Empty; - public string UserName { get; set; } = string.Empty; - } - - - ///TrialSiteUserSurveyQuery 列表查询参数模型 - public class TrialSiteUserSurveyQuery - { - - public Guid TrialSiteSurveyId { get; set; } - - ///// UserName - //public string Name { get; set; } - - ///// Phone - //public string Phone { get; set; } - - ///// Email - //public string Email { get; set; } - - } - - /// TrialSiteUserSurveyAddOrEdit 列表查询参数模型 - public class TrialSiteUserSurveyAddOrEdit - { - public Guid? Id { get; set; } - - public Guid TrialSiteSurveyId { get; set; } - public Guid? UserTypeId { get; set; } - public string FirstName { get; set; } = string.Empty; - public string LastName { get; set; } = string.Empty; - public string Phone { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - - [DictionaryTranslateAttribute("YesOrNo")] - public bool IsGenerateAccount { get; set; } - - [DictionaryTranslateAttribute("SiteSurvey_UserRoles")] - public int TrialRoleCode { get; set; } - - public string OrganizationName { get; set; } = string.Empty; - - public bool IsHistoryUser { get; set; } - public bool? IsHistoryUserDeleted { get; set; } - } - - public class TrialSiteUserSurverQuery - { - public Guid TrialSiteSurveyId { get; set; } - - public bool? IsHistoryUser { get; set; } - } - - public class TrialSiteUserSurveyVerfyResult - { - public Guid TrialSiteUserSurveyId { get; set; } - - public List ErroMsgList { get; set; } = new List(); - } - - public class SiteSurveyUserImportUploadDto - { - [NotDefault] - public Guid TrialId { get; set; } - - public string BaseUrl { get; set; } - public string RouteUrl { get; set; } - } - - public class SiteSurveyUserImportDto - { - public string TrialSiteCode { get; set; } = string.Empty; - public string FirstName { get; set; } = string.Empty; - public string LastName { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - public string Phone { get; set; } = string.Empty; - public string OrganizationName { get; set; } = string.Empty; - - [ExcelColumnName("UserType")] - public string UserTypeStr { get; set; } - - [JsonIgnore] - public Guid TrialSiteId { get; set; } - - [JsonIgnore] - public UserTypeEnum UserTypeEnum { get; set; } = UserTypeEnum.Undefined; - - - [JsonIgnore] - public Guid UserTypeId { get; set; } - - - [JsonIgnore] - public bool IsGeneratedAccount { get; set; } - [JsonIgnore] - public bool IsJoinedTrial { get; set; } - } - -} - - diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteEquipmentSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteEquipmentSurveyService.cs deleted file mode 100644 index 66780456b..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteEquipmentSurveyService.cs +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:20:59 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - - -namespace IRaCIS.Core.Application.Contracts -{ - public interface ITrialSiteEquipmentSurveyService - { - Task AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey); - Task DeleteTrialSiteEquipmentSurvey(Guid trialSiteEquipmentSurveyId); - Task> GetTrialSiteEquipmentSurveyList(Guid trialSiteSurveyId, string? scannerType); - } -} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs deleted file mode 100644 index 211a5d897..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs +++ /dev/null @@ -1,25 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:20:59 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using IRaCIS.Core.Application.Auth; -using Microsoft.AspNetCore.Mvc; - -namespace IRaCIS.Core.Application.Contracts -{ - public interface ITrialSiteSurveyService - { - Task AddOrUpdateTrialSiteSurvey(TrialSiteSurveyAddOrEdit addOrEditTrialSiteSurvey); - Task DeleteTrialSiteSurvey(Guid trialSiteSurveyId); - Task GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId); - Task> GetTrialSiteSurveyList(TrialSiteSurveyQueryDTO surveyQueryDTO); - Task GetTrialSurveyInitInfo(Guid trialId); - Task SendVerifyCode(SiteSurveySendVerifyCode userInfo); - //Task TrialSurveyLock(Guid trialSiteSurveyId, bool isLock); - //IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId); - Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService); - - Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl, string routeUrl, List list); - } -} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs deleted file mode 100644 index 10de23ac1..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs +++ /dev/null @@ -1,15 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:20:59 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -namespace IRaCIS.Core.Application.Contracts -{ - public interface ITrialSiteUserSurveyService - { - Task AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey); - Task DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId); - Task> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery); - } -} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs deleted file mode 100644 index 5d6a965bf..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs +++ /dev/null @@ -1,66 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:20:59 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Application.Filter; -using IRaCIS.Core.Domain.Share; -using Microsoft.AspNetCore.Mvc; - -namespace IRaCIS.Core.Application.Contracts -{ - /// - /// TrialSiteEquipmentSurveyService - /// - [ApiExplorerSettings(GroupName = "Trial")] - public class TrialSiteEquipmentSurveyService(IRepository _trialSiteEquipmentSurveyRepository, - IRepository _trialSiteSurveyRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialSiteEquipmentSurveyService - { - - - - [HttpGet("{trialSiteSurveyId:guid}")] - public async Task> GetTrialSiteEquipmentSurveyList(Guid trialSiteSurveyId, string? scannerType) - { - var trialSiteEquipmentSurveyQueryable = _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId) - .WhereIf(!string.IsNullOrEmpty(scannerType), t => t.ScannerType.Contains(scannerType!)) - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }); - - return await trialSiteEquipmentSurveyQueryable.ToListAsync(); - } - - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - [HttpPost("{trialId:guid}")] - public async Task AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey) - { - - if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteEquipmentSurvey.TrialSiteSurveyId && (t.IsDeleted == true || t.State == TrialSiteSurveyEnum.PMCreatedAndLock), true)) - { - return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Invalid"]); - } - - var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true); - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - [HttpDelete("{trialSiteEquipmentSurveyId:guid}/{trialId:guid}")] - public async Task DeleteTrialSiteEquipmentSurvey(Guid trialSiteEquipmentSurveyId) - { - if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == trialSiteEquipmentSurveyId).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock)) - { - //---已锁定,不允许操作 - return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]); - } - await _trialSiteEquipmentSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteEquipmentSurveyId); - var success = await _trialSiteEquipmentSurveyRepository.SaveChangesAsync(); - - return ResponseOutput.Result(success); - } - - - } -} diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs deleted file mode 100644 index 98c8d96bd..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ /dev/null @@ -1,1056 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:20:59 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using IRaCIS.Application.Contracts; -using IRaCIS.Core.Application.Service; -using IRaCIS.Core.Application.Auth; -using IRaCIS.Core.Application.Filter; -using IRaCIS.Core.Application.Helper; -using IRaCIS.Core.Domain.Share; -using IRaCIS.Core.Infrastructure; -using Medallion.Threading; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using Microsoft.VisualBasic; -using MimeKit; -using Newtonsoft.Json; -using System.Text.RegularExpressions; -using static MassTransit.ValidationResultExtensions; -using DocumentFormat.OpenXml.Vml.Spreadsheet; - -namespace IRaCIS.Core.Application.Contracts -{ - /// - /// TrialSiteSurveyService - /// - [ApiExplorerSettings(GroupName = "Trial")] - public class TrialSiteSurveyService(IRepository _trialSiteSurveyRepository, - IRepository _trialSiteUserSurveyRepository, - IRepository _userRoleRepository, - IRepository _trialRepository, - IRepository _trialSiteRepository, - IRepository _doctorRepository, - IRepository _verificationCodeRepository, - IRepository _trialUserRepository, - IRepository _trialSiteUserRepository, - IDistributedLockProvider _distributedLockProvider, - ITokenService _tokenService, - IRepository _userTypeRepository, - IMailVerificationService _mailVerificationService, - IOptionsMonitor systemEmailConfig, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialSiteSurveyService - { - private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue; - - - - - /// - /// 发送验证码 - /// - /// - /// - [AllowAnonymous] - public async Task SendEmialVerifyCode(SendEmialVerifyCodeInDto userInfo) - { - //检查手机或者邮箱是否有效 - if (!Regex.IsMatch(userInfo.Email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")) - { - //---请输入正确的邮箱地址。 - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_InvalidEmail"]); - } - - //邮箱 - - //验证码 6位 - int verificationCode = new Random().Next(100000, 1000000); - await _mailVerificationService.SendEmailVerification(userInfo.Email, verificationCode); - return ResponseOutput.Ok(); - } - - /// - /// 通过UserId获取Doctorid - /// - /// - /// - [HttpPost] - public async Task UseUserIDGetDoctorID(UseUserIDGetDoctorIDInDto inDto) - { - - var userinfo = await _userRoleRepository.Where(x => x.Id == inDto.UserID).FirstOrDefaultAsync(); - - if (userinfo != null && userinfo.DoctorId != null) - { - return new UseUserIDGetDoctorIDOutDto() - { - - DoctorID = userinfo.DoctorId - }; - } - else - { - Doctor doctor = new Doctor() - { - - }; - - var info = await _doctorRepository.AddAsync(doctor, true); - - await _userRoleRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.UserID, x => new UserRole() - { - - DoctorId = info.Id - }); - - return new UseUserIDGetDoctorIDOutDto() - { - - DoctorID = info.Id - }; - } - - - } - - /// - /// 验证邮箱验证码 获取医生信息Id - /// - /// - /// - [HttpPost] - [AllowAnonymous] - public async Task VerifyEmialGetDoctorInfo(VerifyEmialGetDoctorInfoInDto inDto) - { - var verificationRecord = await _verificationCodeRepository.Where().OrderByDescending(x => x.ExpirationTime).Where(t => (t.EmailOrPhone == inDto.EmailOrPhone) && t.Code == inDto.VerificationCode && t.CodeType == VerifyType.Email).FirstOrDefaultAsync(); - VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto(); - - //检查数据库是否存在该验证码 - if (verificationRecord == null) - { - //---验证码错误。 - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_WrongVerificationCode"]); - } - else - { - //检查验证码是否失效 - if (verificationRecord.ExpirationTime < DateTime.Now) - { - //---验证码已经过期。 - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); - } - else //验证码正确 并且 没有超时 - { - - //删除验证码历史记录 - await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.Id == verificationRecord.Id); - - var dockerInfo = await _doctorRepository.Where(t => t.EMail == inDto.EmailOrPhone || t.Phone == inDto.EmailOrPhone).FirstOrDefaultAsync(); - - if (dockerInfo != null) - { - result.DoctorId = dockerInfo.Id; - result.ReviewStatus = dockerInfo.ReviewStatus; - } - else - { - Doctor doctor = new Doctor() - { - EMail = inDto.EmailOrPhone - }; - - var info=await _doctorRepository.AddAsync(doctor,true); - - //await _userRoleRepository.BatchUpdateNoTrackingAsync(x => x.EMail == inDto.EmailOrPhone, x => new User() - //{ - // DoctorId = info.DoctorId, - - //}); - - result.DoctorId = info.Id; - result.ReviewStatus = info.ReviewStatus; - } - - result.Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo())); - } - } - - return result; - } - - /// - ///site 调研 发送验证码 - /// - /// - /// - [AllowAnonymous] - public async Task SendVerifyCode(SiteSurveySendVerifyCode userInfo) - { - //检查手机或者邮箱是否有效 - if (!Regex.IsMatch(userInfo.Email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")) - { - //---请输入正确的邮箱地址。 - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_InvalidEmail"]); - } - - //邮箱 - - //验证码 6位 - int verificationCode = new Random().Next(100000, 1000000); - - var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == userInfo.TrialId); - - await _mailVerificationService.AnolymousSendEmail(trialInfo.ResearchProgramNo, userInfo.Email, verificationCode); - - - return ResponseOutput.Ok(); - - - } - - /// - /// 验证后 如果数据库该项目不存在该邮箱 那么就插入记录 存在 - /// - /// - /// - /// - /// - [HttpPost] - [UnitOfWork] - [AllowAnonymous] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - public async Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService) - { - - - #region 20230804 修改调研表逻辑 - - var verifyRecord = await _verificationCodeRepository.FirstOrDefaultAsync(t => (t.EmailOrPhone == userInfo.EmailOrPhone) && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType); - //检查数据库是否存在该验证码 - if (verifyRecord == null) - { - //---验证码错误。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]); - } - else if (verifyRecord.ExpirationTime < DateTime.Now) - { - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]); - } - else - { - //删除验证码历史记录 - await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.Id == verifyRecord.Id); - - //验证码正确 不处理 - } - - TrialSiteSurvey? currentEntity = null; - - var userList = await _trialSiteUserRepository.Where(t => t.TrialId == userInfo.TrialId && t.TrialSiteId == userInfo.TrialSiteId, false, true).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - - //普通登录 - if (userInfo.IsUpdate == false) - { - - var dbEntityList = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.TrialSiteId == userInfo.TrialSiteId).ToListAsync(); - - - //没有记录 new一份 - if (dbEntityList.Count == 0) - { - var addSurvey = _mapper.Map(userInfo); - - - //从项目site 中找到已存在的 加到历史人员中 - addSurvey.TrialSiteUserSurveyList = userList; - - currentEntity = await _trialSiteSurveyRepository.AddAsync(addSurvey); - - } - else - { - - //找到当前最新的调研表 - - var currentLatest = dbEntityList.OrderByDescending(t => t.CreateTime).FirstOrDefault(); - - if (currentLatest!.Email != userInfo.EmailOrPhone) - { - //---该中心下已经有其他用户已填写的调研表,您不被允许继续填写 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_AlreadyFilledByOtherUsers"]); - } - - currentEntity = currentLatest; - - if (currentEntity.State != TrialSiteSurveyEnum.PMCreatedAndLock) - { - - - await UnlockSyncSiteUserAsync(userInfo.TrialId, userInfo.TrialSiteId, currentEntity.Id, userList); - - } - - } - - - - } - //更新调研表 - else - { - //找到最新的调研表 - - var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.TrialSiteId == userInfo.TrialSiteId, true) - .Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); - - if (currentLatest == null) - { - return ResponseOutput.NotOk(_localizer["TrialSite_NoSurveyToUpdate"]); - } - - if (currentLatest.Email != userInfo.ReplaceUserEmailOrPhone) - { - //---该中心不存在该交接人的中心调研记录表,不允许选择更新。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]); - } - - - - //未锁定的状态 就改为废除 - if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock) - { - currentLatest.IsDeleted = true; - } - //锁定的 需要改状态么? - else - { - - } - var copy = currentLatest.Clone(); - - copy.State = TrialSiteSurveyEnum.ToSubmit; - copy.IsDeleted = false; - - copy.Phone = string.Empty; - copy.UserName = string.Empty; - copy.Email = userInfo.EmailOrPhone; - copy.Id = Guid.Empty; - copy.CreateTime = DateAndTime.Now; - - if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone) - { - copy.UserName = String.Empty; - copy.Phone = String.Empty; - } - - - - copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone(); - copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; }); - - //锁定了的话,就不拷贝 - if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock) - { - copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone().Where(t => t.IsHistoryUser == false).ToList(); - copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; }); - } - - //从项目site 中找到已存在的 加到历史人员中 - - - copy.TrialSiteUserSurveyList.AddRange(userList); - - currentEntity = await _trialSiteSurveyRepository.AddAsync(copy); - - - - } - - - //删除验证码历史记录 - await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType); - - await _trialSiteSurveyRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(new - { - TrialSiteSurveyId = currentEntity!.Id, - Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo() - { - Id = Guid.NewGuid(), - IsReviewer = false, - IsAdmin = false, - RealName = "SiteSurvey", - UserName = "SiteSurvey", - Sex = 0, - //UserType = "ShareType", - UserTypeEnum = UserTypeEnum.Undefined, - Code = "SiteSurvey", - })) - }); - - #endregion - } - - private async Task UnlockSyncSiteUserAsync(Guid trialId, Guid siteId, Guid trialSiteSurveyId, List userList) - { - var existList = await _trialSiteUserSurveyRepository.Where(t => t.IsHistoryUser && t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.TrialSiteId == siteId, true).ToListAsync(); - - foreach (var item in userList) - { - var find = existList.FirstOrDefault(t => t.SystemUserId == item.SystemUserId); - //不存在就加入 - if (find == null) - { - item.TrialSiteSurveyId = trialSiteSurveyId; - await _trialSiteUserSurveyRepository.AddAsync(item); - } - else - { - find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted; - } - } - - await _trialSiteUserSurveyRepository.SaveChangesAsync(); - } - - - /// - /// 直接查询相关所有数据 - /// - /// - [HttpGet("{trialId:guid}/{trialSiteSurveyId:guid}")] - public async Task GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId) - { - - //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑) - var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId, true); - - - if (find.State != TrialSiteSurveyEnum.PMCreatedAndLock && find.IsDeleted != true) - { - var userList = await _trialSiteUserRepository.Where(t => t.TrialId == find.TrialId && t.TrialSiteId == find.TrialSiteId, false, true).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - - await UnlockSyncSiteUserAsync(find.TrialId, find.TrialSiteId, find.Id, userList); - } - - - var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).FirstOrDefaultAsync().IfNullThrowException(); - - var siteSurveryConfig = _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).IgnoreQueryFilters().Select(t => t.Trial.TrialExtraConfigJsonStr).FirstOrDefault() ?? string.Empty; - - result.SiteSurveyFiledConfig = JsonConvert.DeserializeObject(siteSurveryConfig) ?? new TrialExtraConfig(); - return result; - } - - - /// - /// 实际这里只会是更新 添加在login的时候做了 - /// - /// - /// - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - public async Task AddOrUpdateTrialSiteSurvey(TrialSiteSurveyAddOrEdit addOrEditTrialSiteSurvey) - { - - if (addOrEditTrialSiteSurvey.Id != null) - { - if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)) - { - //---中心调研已锁定,不允许操作。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]); - } - } - - - if (addOrEditTrialSiteSurvey.Id == null) - { - var entity = _mapper.Map(addOrEditTrialSiteSurvey); - await _trialSiteSurveyRepository.AddAsync(entity, true); - return ResponseOutput.Ok(entity.Id.ToString()); - } - else - { - - var entity = await _trialSiteSurveyRepository.Where(t => t.Id == addOrEditTrialSiteSurvey.Id, true).Include(x => x.ReviewerUser).Include(x => x.PreliminaryUser).FirstOrDefaultAsync(); - _mapper.Map(addOrEditTrialSiteSurvey, entity); - await _trialSiteSurveyRepository.SaveChangesAsync(); - - } - return ResponseOutput.Ok(true); - } - - - /// - /// 删除调研表 - /// - /// - /// - [HttpDelete("{trialSiteSurveyId:guid}/{trialId:guid}")] - public async Task DeleteTrialSiteSurvey(Guid trialSiteSurveyId) - { - - if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)) - { - //---中心调研已锁定,不允许操作。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]); - } - - var success = await _trialSiteSurveyRepository.BatchDeleteNoTrackingAsync(t => t.Id == trialSiteSurveyId); - - return ResponseOutput.Result(success); - } - - - /// - /// 获取 项目 site的调研记录 New - /// - /// - [HttpPost] - public async Task> GetTrialSiteSurveyList(TrialSiteSurveyQueryDTO inQuery) - { - var trialSiteSurveyQueryable = _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters() - .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) - .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.UserName.Contains(inQuery.UserKeyInfo) || t.Phone.Contains(inQuery.UserKeyInfo) || t.Email.Contains(inQuery.UserKeyInfo)) - .WhereIf(inQuery.State != null, t => t.State == inQuery.State) - .WhereIf(inQuery.UpdateTimeBegin != null, t => t.UpdateTime >= inQuery.UpdateTimeBegin) - .WhereIf(inQuery.UpdateTimeEnd != null, t => t.UpdateTime <= inQuery.UpdateTimeEnd) - - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.PreliminaryUserName), t => t.PreliminaryUser.RealName.Contains(inQuery.PreliminaryUserName)) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ReviewerUserName), t => t.ReviewerUser.RealName.Contains(inQuery.ReviewerUserName)) - ; - - return await trialSiteSurveyQueryable.ToPagedListAsync(inQuery); - } - - [HttpPost] - public async Task> GetTrialSiteSurveySelectList(TrialSiteSurveySelectquery inQuery) - { - var trialSiteSurveyQueryable = _trialSiteSurveyRepository - .Where(t => t.Id != inQuery.TrialSiteSurveyId) - .Where(t => t.TrialId == inQuery.TrialId && t.TrialSiteId == inQuery.TrialSiteId).IgnoreQueryFilters() - .ProjectTo(_mapper.ConfigurationProvider); - - return await trialSiteSurveyQueryable.ToListAsync(); - } - - /// - /// 项目Site调研用户列表 所有site的调研用户 最新的调研表的记录的用户 new - /// - /// - public async Task> TrialSiteSurveyUserList(TrialSiteUserSurveyAllQuery inQuery) - { - - - var groupSelectIdQuery = - _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId) - .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) - - .WhereIf(!string.IsNullOrEmpty(inQuery.FormWriterKeyInfo), t => (t.UserName).Contains(inQuery.FormWriterKeyInfo) || t.Email.Contains(inQuery.FormWriterKeyInfo) || t.Phone.Contains(inQuery.FormWriterKeyInfo)) - .GroupBy(t => t.TrialSiteId) - .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); - - - var query = _trialSiteUserSurveyRepository - .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) - .WhereIf(inQuery.TrialRoleCode != null, t => t.TrialRoleCode == inQuery.TrialRoleCode) - .WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId) - .WhereIf(inQuery.IsGenerateAccount != null, t => t.IsGenerateAccount == inQuery.IsGenerateAccount) - .WhereIf(inQuery.State != null && inQuery.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == inQuery.State) - .WhereIf(!string.IsNullOrEmpty(inQuery.UserName), t => (t.LastName + " / " + t.FirstName).Contains(inQuery.UserName)) - .WhereIf(!string.IsNullOrEmpty(inQuery.OrganizationName), t => t.OrganizationName.Contains(inQuery.OrganizationName)) - - .ProjectTo(_mapper.ConfigurationProvider); - - - return await query.ToPagedListAsync(inQuery); - - - - - //return await query.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, queryParam.SortField, queryParam.Asc); - } - - - - /// - /// 初始登陆界面 项目基本信息+下拉框数据 - /// - /// - /// - [AllowAnonymous] - [HttpGet("{trialId:guid}")] - public async Task GetTrialSurveyInitInfo(Guid trialId) - { - var info = await _trialRepository.Where(t => t.Id == trialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); - - return info; - } - - - /// - /// 驳回 New - /// - /// - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - - public async Task SubmissionRejection(TrialSiteSubmitBackCommand trialSiteSubmitBackCommand, [FromServices] IMailVerificationService _IMailVerificationService) - { - var trialSiteSurveyId = trialSiteSubmitBackCommand.TrialSiteSurveyId; - - var survey = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId); - - survey.LatestBackReason = trialSiteSubmitBackCommand.LatestBackReason; - - //User? user = null; - - //var messageToSend = new MimeMessage(); - - - if (await _trialSiteSurveyRepository.AnyAsync(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id == trialSiteSurveyId)) - { - //---中心调研已锁定,不允许操作。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]); - } - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) - { - - ////SPM 给填表人发 - //messageToSend.To.Add(new MailboxAddress(String.Empty, survey.Email)); - - survey.State = TrialSiteSurveyEnum.ToSubmit; - } - else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) - { - var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId && t.Trial.TrialUserList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM)); - - if (hasSPMOrCPM) - { - - ////PM 给SPM发 (初审人) - //user = await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == survey.PreliminaryUserId); - - //messageToSend.To.Add(new MailboxAddress(String.Empty, survey.PreliminaryUserId == null ? survey.Email : user.EMail)); - - survey.State = TrialSiteSurveyEnum.CRCSubmitted; - - survey.ReviewerUserId = null; - survey.ReviewerTime = null; - } - else - { - - ////没有SPM 给填表人发 - //messageToSend.To.Add(new MailboxAddress(String.Empty, survey.Email)); - - survey.State = TrialSiteSurveyEnum.ToSubmit; - - survey.PreliminaryUserId = null; - survey.ReviewerUserId = null; - survey.PreliminaryTime = null; - survey.ReviewerTime = null; - - - } - } - - //await _IMailVerificationService.SiteSurveyRejectEmail(messageToSend, survey, trialSiteSubmitBackCommand.RouteUrl, user); - - await _trialSiteSurveyRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(); - } - - - - - - [HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - - public async Task AbandonSiteSurvey(Guid trialSiteSurveyId) - { - var survey = (await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId, true)).IfNullThrowException(); - - if (survey.State != TrialSiteSurveyEnum.ToSubmit) - { - //---只允许废除未提交的记录。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_CancelUnsubmittedRecord"]); - } - - survey.IsDeleted = true; - - await _trialSiteSurveyRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(); - - } - - - - /// - /// 提交 后台自动识别是谁提交 - /// - /// - /// - [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - [UnitOfWork] - public async Task TrialSurveySubmit(TrialSiteSurvyeSubmitDTO siteSurvyeSubmit) - { - - var trialId = siteSurvyeSubmit.TrialId; - var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId; - - var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId, false, true).FirstOrDefaultAsync()).IfNullThrowException(); - - - if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock) - { - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_Invalid"]); - } - - - - - var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId) - .Where(t => !(t.IsHistoryUser && t.IsHistoryUserDeleted == true)) - .Select(t => - new - { - t.TrialSiteSurveyId, - t.IsGenerateAccount, - t.IsGenerateSuccess, - t.UserTypeId, - UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum, - t.TrialRoleCode, - t.Email, - }).ToListAsync(); - - //var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - - - if (!siteUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.CRA)) - { - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_MissingAccount"]); - } - - if (siteUserList.Where(t => t.IsGenerateAccount && t.UserTypeId != null).GroupBy(t => new { t.UserTypeId, t.Email }) - .Any(g => g.Count() > 1)) - { - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_DuplicateEmail"]); - } - - - - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator) - { - var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM)); - - if (hasSPMOrCPM) - { - await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted }); - - } - else - { - await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved }); - - } - - } - else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) - { - - await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now }); - - } - else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) - { - - var allUserList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ProjectTo(_mapper.ConfigurationProvider).ToList(); - - //已生成的不管 管的只需要是 生成失败的并且需要生成账号的 - var needGenerateList = allUserList.Where(t => t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true).ToList(); - - await GenerateAccountAsync(needGenerateList, trialId); - - //新加入的 或者历史人员退出改为加入的 - var needSendEmailList = allUserList.Where(t => (t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true) || (t.IsHistoryUser == true && t.IsHistoryUserOriginDeleted == true && t.IsHistoryUserDeleted == false)).ToList(); - - await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needSendEmailList }); - - - var needQuitUserList = allUserList.Where(t => t.IsHistoryUser && t.IsHistoryUserOriginDeleted == false && t.IsHistoryUserDeleted == true).ToList(); - - await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.TrialSiteId, needQuitUserList); - - //将历史锁定的调研表废弃 - await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.TrialSiteId == trialSiteSurvey.TrialSiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id != trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true }); - - } - await _trialSiteSurveyRepository.SaveChangesAsync(); - return ResponseOutput.Ok(); - } - - - - private async Task GenerateAccountAsync(List needGenerateList, Guid trialId) - { - var trialType = _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); - - foreach (var item in needGenerateList) - { - - //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 - var sysUserInfo = await _userRoleRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - - - if (sysUserInfo == null) - { - - var @lock = _distributedLockProvider.CreateLock($"UserCode"); - - using (await @lock.AcquireAsync()) - { - var saveItem = _mapper.Map(item); - - - if (trialType == TrialType.NoneOfficial) - { - saveItem.IsTestUser = true; - } - - // 中心调研生成账号 都是外部的 - saveItem.IsZhiZhun = false; - saveItem.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(UserRole)); - - saveItem.UserName = saveItem.UserCode; - - saveItem.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); - - saveItem.UserTypeEnum = _userTypeRepository.Where(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First(); - - - var newUser = _userRoleRepository.AddAsync(saveItem).Result; - - - _ = _userRoleRepository.SaveChangesAsync().Result; - - - sysUserInfo = newUser; - - } - - await _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id }); - - } - - - //发送邮件的时候需要用到该字段 - item.SystemUserId = sysUserInfo.Id; - - } - - await _trialSiteUserSurveyRepository.SaveChangesAsync(); - } - - - private async Task SendSiteSurveyUserJoinEmail(TrialSiteUserSurveyJoinCommand joinCommand) - { - var trialSiteSurvey = await _trialSiteSurveyRepository.FirstAsync(t => t.Id == joinCommand.TrialSiteSurveyId); - - - foreach (var userInfo in joinCommand.UserList) - { - - if (userInfo.SystemUserId == null) - { - //---生成账户Id 未取到值,请排查 - throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_FailedToGenerateAccountId"]); - } - - var trialId = joinCommand.TrialId; - var userId = (Guid)userInfo.SystemUserId; - var trialSiteId = trialSiteSurvey.TrialSiteId; - - - - //判断TrialUser中是否存在 不存在就插入 - - var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true); - if (findTrialUser == null) - { - await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); - - } - else if (findTrialUser.IsDeleted == true) - { - await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUserRole() - { - IsDeleted = false, - DeletedTime = null, - JoinTime = DateTime.Now, - }); - - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); - } - - var findTrialSiteUser = await _trialSiteUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId && t.TrialSiteId == trialSiteId, true); - - if (findTrialSiteUser == null) - { - await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, TrialSiteId = trialSiteId, UserId = userId }); - - } - else - { - findTrialSiteUser.IsDeleted = false; - findTrialSiteUser.DeletedTime = null; - } - - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new UserRole() { Status = UserStateEnum.Enable }); - - - await _trialSiteUserSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == userInfo.Id, u => new TrialSiteUserSurvey() { IsJoin = true }); - } - - await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now }); - - await _userRoleRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(); - - - } - - - private async Task DealSiteUserQuitSiteAsync(Guid trialId, Guid siteId, List list) - { - - var userIdList = list.Select(t => t.SystemUserId).ToList(); - - - await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.TrialSiteId == siteId && userIdList.Contains(t.UserId), c => new TrialSiteUser() - { - IsDeleted = true, - DeletedTime = DateTime.Now, - }); - - - await _trialSiteUserRepository.SaveChangesAsync(); - } - - - - public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl, string routeUrl, List list) - { - - - var trialType = _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); - - //判断是否有系统账号 - foreach (var item in list) - { - //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 - var sysUserInfo = await _userRoleRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - - if (sysUserInfo == null) - { - - var @lock = _distributedLockProvider.CreateLock($"UserCode"); - - using (await @lock.AcquireAsync()) - { - var saveItem = _mapper.Map(item); - - - if (trialType == TrialType.NoneOfficial) - { - saveItem.IsTestUser = true; - } - - // 中心调研生成账号 都是外部的 - saveItem.IsZhiZhun = false; - saveItem.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(UserRole)); - - saveItem.UserName = saveItem.UserCode; - - //saveItem.UserTypeEnum = _userTypeRepository.Where(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First(); - - var newUser = _userRoleRepository.AddAsync(saveItem).Result; - - _ = _userRoleRepository.SaveChangesAsync().Result; - - sysUserInfo = newUser; - - } - - item.IsGeneratedAccount = true; - - } - - var userId = sysUserInfo.Id; - var trialSiteId = item.TrialSiteId; - - //判断是否加入到项目 - var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true); - if (findTrialUser == null) - { - await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl); - - } - else if (findTrialUser.IsDeleted == true) - { - await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUserRole() - { - IsDeleted = false, - DeletedTime = null, - JoinTime = DateTime.Now, - }); - - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl); - } - - - var findTrialSiteUser = await _trialSiteUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId && t.TrialSiteId == trialSiteId, true); - - if (findTrialSiteUser == null) - { - await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, TrialSiteId = trialSiteId, UserId = userId }); - - } - else - { - findTrialSiteUser.IsDeleted = false; - findTrialSiteUser.DeletedTime = null; - } - - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new UserRole() { Status = UserStateEnum.Enable }); - - await _trialSiteUserRepository.SaveChangesAsync(); - - } - - - - } - - - - } -} diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs deleted file mode 100644 index 2f4008ac8..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ /dev/null @@ -1,152 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2021-12-23 13:20:59 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using IRaCIS.Core.Application.Filter; -using IRaCIS.Core.Domain.Share; -using IRaCIS.Core.Infrastructure; -using Microsoft.AspNetCore.Mvc; - -namespace IRaCIS.Core.Application.Contracts -{ - /// - /// TrialSiteUserSurveyService - /// - [ApiExplorerSettings(GroupName = "Trial")] - public class TrialSiteUserSurveyService(IRepository _trialSiteUserSurveyRepository, - IRepository _trialRepository, - IRepository _userRoleRepository, - IRepository _trialSiteSurveyRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialSiteUserSurveyService - { - - - [HttpPost] - public async Task> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery) - { - - var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == inquery.TrialSiteSurveyId) - .WhereIf(inquery.IsHistoryUser != null, t => t.IsHistoryUser == inquery.IsHistoryUser) - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }); - - return await trialSiteUserSurveyQueryable.ToListAsync(); - } - - - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - [HttpPost("{trialId:guid}")] - public async Task AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey) - { - - - - if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId && (t.IsDeleted == true || t.State == TrialSiteSurveyEnum.PMCreatedAndLock), true)) - { - //当前调研表已废除,或者调研表状态已锁定,不允许操作 - return ResponseOutput.NotOk(_localizer["TrialSiteUserSurvey_Invalid"]); - } - - - if (addOrEditTrialSiteUserSurvey.IsGenerateAccount) - { - var trialId = _trialSiteSurveyRepository.Where(t => t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId, false, true).Select(t => t.TrialId).FirstOrDefault(); - - var trialType = _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); - - var item = addOrEditTrialSiteUserSurvey; - - //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 - var sysUserInfo = await _userRoleRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - - if (sysUserInfo != null) - { - - if (trialType == TrialType.OfficialTrial || trialType == TrialType.Training) - { - - if (sysUserInfo.IsTestUser) - { - //---正式类型 、培训类型的项目 不允许加入测试用户 - throw new BusinessValidationFailedException(_localizer["TrialSiteUser_NoTestUserForFormal"]); - - } - } - - if (trialType == TrialType.NoneOfficial) - { - - if (sysUserInfo.IsTestUser == false) - { - //---测试项目 不允许加入正式用户 - throw new BusinessValidationFailedException(_localizer["TrialSiteUser_NoFormalUserForTest"]); - - } - } - } - - - } - - var verifyExp1 = new EntityVerifyExp() - { - VerifyExp = u => u.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId && u.Email == addOrEditTrialSiteUserSurvey.Email && u.TrialSiteSurveyId == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId, - VerifyMsg = _localizer["TrialSiteUser_SingleAccountPerEmailAndUserType"],// "同一邮箱同一用户类型,生成账号的数据只允许存在一条!", - IsVerify = addOrEditTrialSiteUserSurvey.IsGenerateAccount - - }; - - if (addOrEditTrialSiteUserSurvey.UserTypeId != null) - { - var existSysUser = await _userRoleRepository.Where(t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d => d.UserTypeRole).FirstOrDefaultAsync(); - - - if (existSysUser != null) - { - if (existSysUser.LastName != addOrEditTrialSiteUserSurvey.LastName || existSysUser.FirstName != addOrEditTrialSiteUserSurvey.FirstName) - { - - - var optEntity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1); - - //$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存" - return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.UserTypeRole.UserTypeShortName, existSysUser.EMail, existSysUser.LastName + " / " + existSysUser.FirstName, existSysUser.Phone], - new { Id = optEntity.Id, existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone, existSysUser.IsTestUser, existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips); - } - - } - } - - - var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1); - - - - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - [HttpDelete("{trialSiteUserSurveyId:guid}/{trialId:guid}")] - public async Task DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId) - { - - if (await _trialSiteUserSurveyRepository.Where(t => t.Id == trialSiteUserSurveyId).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock)) - { - //---已锁定,不允许操作 - return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]); - } - - await _trialSiteUserSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteUserSurveyId); - var success = await _trialSiteUserSurveyRepository.SaveChangesAsync(); - - return ResponseOutput.Result(success); - } - - - - - - - } -} diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs deleted file mode 100644 index b2666e81f..000000000 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ /dev/null @@ -1,100 +0,0 @@ -using AutoMapper; -using IRaCIS.Core.Application.Contracts; - -namespace IRaCIS.Core.Application.AutoMapper -{ - /// - /// 映射配置 - /// - public partial class SiteSurveyConfig : Profile - { - public SiteSurveyConfig() - { - var isEn_Us = false; - //编辑 - CreateMap().ReverseMap(); - - CreateMap().ReverseMap(); - - CreateMap().ReverseMap(); - - CreateMap().ForMember(d => d.Email, t => t.MapFrom(t => t.EmailOrPhone)); - - CreateMap() - .ForMember(d => d.Id, u => u.Ignore()) - .ForMember(d => d.Phone, u => u.MapFrom(c => c.User.Phone)) - .ForMember(d => d.Email, u => u.MapFrom(c => c.User.EMail)) - .ForMember(d => d.OrganizationName, u => u.MapFrom(c => c.User.OrganizationName)) - .ForMember(d => d.UserTypeId, u => u.MapFrom(c => c.User.UserTypeId)) - .ForMember(d => d.IsHistoryUser, u => u.MapFrom(c => true)) - .ForMember(d => d.IsHistoryUserOriginDeleted, u => u.MapFrom(c => c.IsDeleted)) - .ForMember(d => d.IsHistoryUserDeleted, u => u.MapFrom(c => c.IsDeleted)) - .ForMember(d => d.FirstName, u => u.MapFrom(c => c.User.FirstName)) - .ForMember(d => d.LastName, u => u.MapFrom(c => c.User.LastName)) - .ForMember(d => d.IsGenerateAccount, u => u.MapFrom(c => true)) - .ForMember(d => d.IsGenerateSuccess, u => u.MapFrom(c => true)) - .ForMember(d => d.SystemUserId, u => u.MapFrom(c => c.UserId)) - .ForMember(d => d.IsJoin, u => u.MapFrom(c => !c.IsDeleted)) - .ForMember(d => d.CreateUserRole, u => u.Ignore()); - - - //列表 - CreateMap() - .ForMember(t => t.EquipmentType, u => u.MapFrom(d => isEn_Us ? d.EquipmentType.Value : d.EquipmentType.ValueCN)); - - - - CreateMap() - .ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSite.TrialSiteAliasName)) - .ForMember(d => d.SiteName, u => u.MapFrom(s => s.TrialSite.TrialSiteName)) - .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)); - - CreateMap(); - - - CreateMap() - .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) - .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)); - - - CreateMap() - .ForMember(d => d.Sponsor, u => u.MapFrom(s => s.Sponsor)) - .ForMember(d => d.IndicationType, u => u.MapFrom(s => s.IndicationType.Value)) - .ForMember(d => d.TrialSiteSelectList, u => u.MapFrom(s => s.TrialSiteList)) - .ForMember(d => d.TrialId, u => u.MapFrom(s => s.Id)); - - CreateMap() - .ForMember(t => t.IsHaveSiteSurveyRecord, u => u.MapFrom(t => t.TrialSiteSurveyList.Any())); - - CreateMap() - .ForMember(d => d.TrialSiteSurvey, u => u.MapFrom(s => s)) - .ForMember(d => d.TrialInfo, u => u.MapFrom(s => s.Trial)) - .ForMember(d => d.TrialSiteUserSurveyList, u => u.MapFrom(s => s.TrialSiteUserSurveyList)); - - - - - CreateMap(); - - CreateMap() - .ForMember(d => d.EMail, u => u.MapFrom(s => s.Email)); - - - CreateMap(); - - - CreateMap().ForMember(d => d.RealName, u => u.MapFrom(s => s.LastName + " / " + s.FirstName)); - - - - CreateMap() - .ForMember(t => t.TrialSiteSurvey, u => u.MapFrom(c => c.TrialSiteSurvey)) - .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) - .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)); - - - - - } - } -} \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs b/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs index 66b3415d4..22eccf419 100644 --- a/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs +++ b/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs @@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.Service else //不管是精鼎的pm还是我们的pm 还是运维人员 只能看到自己参与项目的统计 { - List trialIdList = _userTrialRepository.Where(u => u.UserId == _userInfo.Id).Select(u => u.TrialId).ToList(); + List trialIdList = _userTrialRepository.Where(u => u.UserId == _userInfo.UserRoleId).Select(u => u.TrialId).ToList(); trialLambda = trialLambda.And(u => trialIdList.Contains(u.Id)); } if (!string.IsNullOrWhiteSpace(inQuery.TrialCode)) @@ -385,7 +385,7 @@ namespace IRaCIS.Core.Application.Service } var userTypeEnumStr = _userInfo.UserTypeEnumStr; - var userId = _userInfo.Id; + var userId = _userInfo.UserRoleId; //PM 进来只能看到他负责的项目下的参与人员列表 @@ -441,7 +441,7 @@ namespace IRaCIS.Core.Application.Service Expression> userTrialLambda = x => x.UserId == userId; var userTypeEnum = _userInfo.UserTypeEnumStr; - var loginUserId = _userInfo.Id; + var loginUserId = _userInfo.UserRoleId; //PM 进来只能看到他负责的项目下的参与人员列表 diff --git a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs index 48a890e72..56a4d4e6f 100644 --- a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs +++ b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs @@ -41,7 +41,7 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject .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, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) .Select(t => new TrialListDTO_UltrasonicDicom() { TrialId = t.Id, diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs index a93d32166..3270d3e00 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs @@ -216,29 +216,6 @@ namespace IRaCIS.Application.Contracts public string TrialSiteAliasName { get; set; } = String.Empty; } - public class TrialSiteUserSummaryExportDto : ExcelExportInfo - { - - public List TrialSiteUserList { get; set; } = new List(); - - } - - public class TrialSiteUserSummaryDto : TrialSiteUserSurveyView - { - - - public string TrialSiteCode { get; set; } = String.Empty; - public string TrialSiteAliasName { get; set; } = String.Empty; - - public string UserRealName => LastName + " / " + FirstName; - - - //public string IsGenerateAccountStr => IsGenerateAccount ? "是" : "否"; - - - //public string StateStr => State.GetDescription(); - - } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs index db575651f..90f91bc92 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs @@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Interfaces Task> GetTrialExternalUserList(TrialExternalUserQuery queryTrialExternalUser); - Task AddOrUpdateTrialExternalUser(TrialExternalUserAddAndSendEmail addOrEditTrialExternalUser); + Task DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser, Guid systemUserId); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialSiteService.cs index 306554843..029ec46b6 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialSiteService.cs @@ -13,6 +13,5 @@ namespace IRaCIS.Core.Application.Interfaces Task> GetSiteCRCList(SiteCrcQueryDTO param); Task> GetSiteCRCSimpleList(SiteCrcQueryDTO param); Task> GetTrialSiteScreeningList(TrialSiteQuery trialSiteQuery); - Task> GetTrialSiteSelect(Guid trialId); } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index c5342bc97..8f3a0e639 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -12,8 +12,6 @@ namespace IRaCIS.Core.Application [ApiExplorerSettings(GroupName = "Trial")] public class PersonalWorkstation( IRepository _trialRepository, - IRepository _trialDocumentRepository, - IRepository _systemDocumentRepository, IClinicalAnswerService _clinicalAnswerService, IRepository _systemNoticeRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService @@ -39,10 +37,10 @@ namespace IRaCIS.Core.Application { return await _trialRepository .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id }) + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId }) .OrderByDescending(t => t.ApprovalRequiredCount).ToPagedListAsync(inQuery); } @@ -55,34 +53,8 @@ namespace IRaCIS.Core.Application } - /// - /// 待签署的项目文件 需要签署文件数量 系统级别的在第一行 - /// - /// - /// - [HttpPost] - public async Task> GetTrialDocStatList(TrialSiteSurveyStatQuery inQuery) - { - if (_userInfo.IsAdmin) - { - return new PageOutput(inQuery.PageIndex, inQuery.PageSize, 0, new List()); - } - else - { - var trialDocStat = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) - .Count() > 0) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, userTypeId = _userInfo.UserTypeId }) - .OrderByDescending(t => t.WaitSignCount) - .ToPagedListAsync(inQuery); - return trialDocStat; - } - - } - #region PM APM 待办 @@ -101,7 +73,7 @@ namespace IRaCIS.Core.Application var query = _trialRepository .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new CheckToBeDoneDto() { TrialId = t.Id, @@ -122,11 +94,11 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var totalToBeCheckedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.ToCheck).CountAsync(); var totalToBeRepliedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).CountAsync(); @@ -148,7 +120,7 @@ namespace IRaCIS.Core.Application { var query = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) .Select(g => new ReReadingApplyToBeDoneDto() @@ -169,7 +141,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed).Count(); return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); @@ -190,7 +162,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ReviewerSelectToBeDoneDto() { TrialId = t.Id, @@ -208,7 +180,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).CountAsync(); return ResponseOutput.Ok(result, new { ToBeApprovalCount = toBeApprovalCount }); ; @@ -226,7 +198,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { TrialId = t.Id, @@ -246,7 +218,7 @@ namespace IRaCIS.Core.Application var all = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { @@ -275,7 +247,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ReviewerSelectToBeDoneDto() { TrialId = t.Id, @@ -294,7 +266,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).CountAsync(); return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); ; @@ -315,7 +287,7 @@ namespace IRaCIS.Core.Application { var query = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) .Select(g => new ReReadingApprovalToBeDoneDto() @@ -336,7 +308,7 @@ namespace IRaCIS.Core.Application var toBeApprovalCount = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed).Count(); return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); @@ -363,7 +335,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.Where(t => t.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Select(t => new ImageClinicalDataToBeDoneDto() { @@ -405,7 +377,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) //.Where(t => t.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Select(t => new ImageClinicalDataToBeDoneDto() { @@ -466,7 +438,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageQuestionToBeDoneDto() { TrialId = t.Id, @@ -474,11 +446,11 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC && u.SubjectVisit.IsUrgent).Count(), - ToBeDealedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + ToBeDealedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count(), @@ -491,8 +463,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC).Count(); @@ -514,7 +486,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageCheckQuestionToBeDoneDto() { TrialId = t.Id, @@ -522,10 +494,10 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + UrgentCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply && u.IsUrgent).Count(), - ToBeReplyedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + ToBeReplyedCount = t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() }).Where(x => x.ToBeReplyedCount > 0); @@ -537,8 +509,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count(); return ResponseOutput.Ok(result, new { TotalToBeReplyedCount = toBeDealedCount }); @@ -560,7 +532,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageReUploadToBeDoneDto() { TrialId = t.Id, @@ -568,11 +540,11 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.IsUrgent && ((u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || u.IsQCConfirmedReupload)).Count(), ToBeReUploadCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count(), }).Where(x => x.ToBeReUploadCount > 0); @@ -583,7 +555,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count(); return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); @@ -607,7 +579,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) .Select(t => new ImageSubmittedToBeDoneDto() { TrialId = t.Id, @@ -615,12 +587,12 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && (u.IsEnrollmentConfirm || u.PDState == PDStateEnum.PDProgress || u.Trial.IsUrgent || u.Subject.IsUrgent)/*u.IsUrgent*/).Count(), ToBeDealedCount = t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(), }).Where(x => x.ToBeDealedCount > 0); @@ -633,8 +605,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(); return ResponseOutput.Ok(result, new { TotalToBeDealedCount = toBeDealedCount }); @@ -663,7 +635,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit) .Select(t => new ImageQualityToBeDoneDto() { @@ -673,15 +645,15 @@ namespace IRaCIS.Core.Application TrialCode = t.TrialCode, // 待审核 加急的(待领取 已领取)-- 领取了 还没做完 就是待审核 - UrgentCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && u.IsUrgent).Count(), + UrgentCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && u.IsUrgent).Count(), //待领取量 ToBeClaimedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed && t.AuditState != AuditStateEnum.QCFailed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(), + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count(), //待审核通过,统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了) - ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count() + ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId).Count() }).Where(x => x.ToBeClaimedCount + x.ToBeReviewedCount > 0); @@ -693,13 +665,13 @@ namespace IRaCIS.Core.Application var toBeClaimedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed && t.AuditState != AuditStateEnum.QCFailed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(); + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId) && t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed && t.AuditState != AuditStateEnum.QCFailed) + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count(); var toBeReviwedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(u => u.CurrentActionUserId == _userInfo.Id).Count(); + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(u => u.CurrentActionUserId == _userInfo.UserRoleId).Count(); return ResponseOutput.Ok(result, new { TotalToBeClaimedCount = toBeClaimedCount, TotalToBeReviewedCount = toBeReviwedCount }); @@ -721,7 +693,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new ImageQuestionToBeDoneDto() { TrialId = t.Id, @@ -729,10 +701,10 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.SubjectVisit.IsUrgent).Count(), + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.SubjectVisit.IsUrgent).Count(), ToBeDealedCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(), + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(), }).Where(x => x.ToBeDealedCount > 0); ; @@ -742,9 +714,9 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(); + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(); return ResponseOutput.Ok(result, new { TotalToBeDealedCount = toBeDealedCount }); @@ -775,7 +747,7 @@ namespace IRaCIS.Core.Application { - var newQuery = _trialReadingCriterionRepository.Where(t => t.IsSigned && t.IsConfirm && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var newQuery = _trialReadingCriterionRepository.Where(t => t.IsSigned && t.IsConfirm && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(c => new IRImageReadingToBeDoneDto() { TrialId = c.TrialId, @@ -785,7 +757,7 @@ namespace IRaCIS.Core.Application CriterionName = c.CriterionName, TrialReadingCriterionId = c.Id, - UrgentCount = c.VisitTaskList.AsQueryable().Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + UrgentCount = c.VisitTaskList.AsQueryable().Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -795,7 +767,7 @@ namespace IRaCIS.Core.Application .Count(t => t.IsUrgent), - UnReadCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + UnReadCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -807,7 +779,7 @@ namespace IRaCIS.Core.Application - HaveSignedCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) + HaveSignedCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count(), }).Where(x => x.UnReadCount > 0); @@ -885,9 +857,9 @@ namespace IRaCIS.Core.Application var result = await newQuery.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .SelectMany(t => t.VisitTaskList) - .Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect && t.TrialReadingCriterion.IsSigned == true && t.TrialReadingCriterion.IsConfirm == true) + .Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect && t.TrialReadingCriterion.IsSigned == true && t.TrialReadingCriterion.IsConfirm == true) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -913,8 +885,8 @@ namespace IRaCIS.Core.Application { var query = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.UserRoleId) .GroupBy(t => new { t.TrialId, @@ -957,8 +929,8 @@ namespace IRaCIS.Core.Application var toBeDealedCount = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.DoctorUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.DoctorUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM) //.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM) .Count(); @@ -990,8 +962,8 @@ namespace IRaCIS.Core.Application #region 废弃不能对包含聚合或子查询的表达式执行聚合函数 var query = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .GroupBy(t => new { t.TrialId, @@ -1028,16 +1000,16 @@ namespace IRaCIS.Core.Application var toBeReplyedQuery = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing); var toBeReplyedCount = toBeReplyedQuery.Count(); var tobeReviewedCount = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count(); @@ -1084,282 +1056,6 @@ namespace IRaCIS.Core.Application #region 项目列表查询 + 待办详情 - public async Task> GetNeedSignTrialDocTrialIdList() - { - if (!_userInfo.IsAdmin) - { - var list = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && - !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0) - .Select(t => t.Id).ToListAsync(); - - return list; - - } - return new List(); - } - - public async Task GetUserTobeDoneRecord([FromServices] IRepository _subjectVisitRepository, - [FromServices] IRepository _visitTaskReReadingRepository, - [FromServices] IRepository _taskMedicalReviewRepository, - [FromServices] IRepository _trialReadingCriterionRepository) - { - var isPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM; - var isCRC = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator; - var isIQC = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC; - var isMIM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.MIM; - var isSPMOrCPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM; - var isIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer; - - var isInternal = _userInfo.IsZhiZhun; - - var needSignTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) - && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0).CountAsync(); - - var needSignSysDocCont = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) - //外部人员 只签署 文档类型枚举值有值的 - .WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter) - .SelectMany(t => t.NeedConfirmedUserTypeList) - .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); - - var signedTrialCount = await _trialDocumentRepository.AsQueryable(true) - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).CountAsync(); - - var signedSysDocCont = await _systemDocumentRepository - .Where(t => t.IsDeleted == false && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) - .SelectMany(t => t.NeedConfirmedUserTypeList) - .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); - - - var siteSurveyCount = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) - .CountAsync(); - - //var trialNeedSignList = new List(); - - //if (!_userInfo.IsAdmin) - //{ - // trialNeedSignList = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) - // .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - // .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && - // !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0) - // .Select(t=>new TrialDocNeedSign() - // { - // TrialId=t.Id, - // TrialCode=t.TrialCode, - // ExperimentName=t.ExperimentName, - // ResearchProgramNo=t.ResearchProgramNo, - // IsHaveTrialDocNeedSign=true - // }).ToListAsync(); - - //} - - //防止生成sql生成GETDATE() 时区导致的问题 - var appDateTimeNow = DateTime.Now; - - var record = new UserToBeDoneRecord() - { - - IsHaveSysDocNeedNeedSign = needSignSysDocCont > 0, - //TrialNeedSignList= trialNeedSignList, - - SysWaitSignDocCount = needSignSysDocCont, - TrialWaitSignDocCount = needSignTrialCount, - - TrialSignedDocCount = signedTrialCount, - SysSignedDocCount = signedSysDocCont, - - SysNoticeUnReadCount = await _systemNoticeRepository.Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished - && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.Id)) - .Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > appDateTimeNow) - .CountAsync(), - - #region PM - - PM_SiteSurveryCount = isPM ? siteSurveyCount : 0, - - PM_CheckCount = isPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(u => u.SubjectVisitList.Any(t => t.CheckState == CheckStateEnum.ToCheck || (t.CheckState == CheckStateEnum.CVIng && - t.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator))).CountAsync() : 0, - - PM_ReviewerSelectCount = isPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup).Count() > 0).CountAsync() : 0, - - PM_ReReadingApprovalCount = isPM ? await _visitTaskReReadingRepository - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed) - .GroupBy(t => t.OriginalReReadingTask.TrialId) - .Select(g => new ReReadingApplyToBeDoneDto() - { - TrialId = g.Key, - ToBeApprovalCount = g.Count(), - - }).Where(x => x.ToBeApprovalCount > 0).CountAsync() : 0, - - PM_ClinicalDataCount = isPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.ReadModuleList.Where(u => u.IsCRCConfirm && !u.IsPMConfirm).Count() > 0).CountAsync() : 0, - - #endregion - - #region CRC - - CRC_ImageSubmitCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) - .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count() > 0).CountAsync() : 0, - - - CRC_ImageQuestionCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).SelectMany(c => c.QCChallengeList) - .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count() > 0).CountAsync() : 0, - - - - CRC_CheckQuestionCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) - .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() > 0).CountAsync() : 0, - - CRC_ImageReUploadCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.SubjectVisitList - .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) - .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count() > 0).CountAsync() : 0, - - CRC_ClinicalDataTobeDoneCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.ReadingClinicalDataList.Where(x => !x.IsSign && x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC).Count() > 0).CountAsync() : 0, - - CRC_ClinialDataTobeConfirmCount = isCRC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.ReadModuleList.Where(x => !x.IsCRCConfirm).Count() > 0).CountAsync() : 0, - - - - #endregion - - - #region SPM - - - SPM_SiteSurveryCount = isSPMOrCPM ? siteSurveyCount : 0, - - SPM_ReviewerApprovalCount = isSPMOrCPM ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() > 0).CountAsync() : 0, - - SPM_ReReadingApprovalCount = isSPMOrCPM ? await _visitTaskReReadingRepository - .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) - .GroupBy(t => t.OriginalReReadingTask.TrialId) - .Select(g => new ReReadingApplyToBeDoneDto() - { - TrialId = g.Key, - ToBeApprovalCount = g.Count(), - - }).Where(x => x.ToBeApprovalCount > 0).CountAsync() : 0, - - #endregion - - - #region IQC - - - IQC_IamgeQCCount = isIQC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit) - .Select(t => new - { - //待领取量 - ToBeClaimedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(), - - //待审核通过,统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了) - ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count() - - }).Where(x => x.ToBeClaimedCount + x.ToBeReviewedCount > 0).CountAsync() : 0, - - IQC_QCQuestionCount = isIQC ? await _trialRepository - .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() > 0).CountAsync() : 0, - - - - #endregion - - - #region IR - - IR_IamgeWaitReadingCount = isIR ? - - // await _trialRepository - //.Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - //.Where(c=>c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect && t.TrialReadingCriterion.IsSigned && t.TrialReadingCriterion.IsConfirm ) - // // 前序 不存在 未一致性核查未通过的 - // .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) - // //前序 不存在 未生成任务的访视 - // .Where(t => t.TrialReadingCriterion.IsAutoCreate == false ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) : true) - - // .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)).Count()>0).CountAsync() : 0, - - - await _trialReadingCriterionRepository.Where(t => t.IsSigned == true && t.IsConfirm == true && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) - // 前序 不存在 未一致性核查未通过的 - .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) - //前序 不存在 未生成任务的访视 - //.WhereIf(g.Key.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum)) - .Where(t => c.IsAutoCreate ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) : true) - - .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)).Count() > 0).CountAsync() - - : 0, - - - IR_MedicalReviewCount = isIR ? await _taskMedicalReviewRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.Id) - .GroupBy(t => new { t.TrialId, t.VisitTask.TrialReadingCriterionId }) - .Where(g => g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM && u.AuditState == MedicalReviewAuditState.Auditing).Count() > 0).CountAsync() : 0, - - - #endregion - - #region MIM - - MIM_MedicalReviewCount = isMIM ? await _taskMedicalReviewRepository - .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) - .GroupBy(t => new { t.TrialId, t.VisitTask.TrialReadingCriterionId }) - .Select(g => new - { - TrialId = g.Key, - - ToBeReplyedCount = g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing).Count(), - - ToBeReviewedCount = g.Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count() - - }).Where(t => t.ToBeReviewedCount + t.ToBeReplyedCount > 0).CountAsync() : 0, - - #endregion - - }; - - return record; - } - - [HttpPost] public async Task>> GetTrialToBeDoneList(TrialToBeDoneQuery inQuery, [FromServices] IRepository _taskMedicalReviewRepository) @@ -1379,7 +1075,7 @@ namespace IRaCIS.Core.Application .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.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.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.TrialUserList.Any(t => t.UserRole.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM))) .Select(t => new TrialToBeDoneDto() @@ -1406,49 +1102,49 @@ namespace IRaCIS.Core.Application SPM_ReviewerSelectApprovalCount = isSPMOrCPM ? t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() : 0, - MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_UrgentCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.VisitTask.IsUrgent && u.AuditState != MedicalReviewAuditState.HaveSigned).Count() : 0, - MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingResponseCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing).Count() : 0, - MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) + MIM_PendingReviewCount = isMIM ? t.TaskMedicalReviewList.Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.UserRoleId) .Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count() : 0, - CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id) && t.IsUrgent).Count() : 0, + CRC_UrgentCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId) && t.IsUrgent).Count() : 0, - CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + CRC_CheckQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() : 0, - CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).SelectMany(c => c.QCChallengeList) + CRC_QCQuestionCount = isCRC ? t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.UserRoleId)).SelectMany(c => c.QCChallengeList) .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count() : 0, //待审核 审核中 加急的数量 - IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, + IQC_UrgentCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit && t.IsUrgent).Count() : 0, //审核未完成 - IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, + IQC_AuditToBeDealedCount = isIQC ? t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.UserRoleId && t.QCProcessEnum != TrialQCProcess.NotAudit).Count() : 0, //质疑待处理 IQC_QuestionToBeDealedCount = isIQC ? t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, + .Where(u => u.CreateUserId == _userInfo.UserRoleId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0, //待领取 IQC_ToBeClaimedCount = isIQC ? t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed) - .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0, + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count() : 0, IR_ReadingCriterionList = isIR ? t.TrialReadingCriterionList.Where(t => t.IsConfirm && t.IsSigned).OrderBy(t => t.CriterionName).Select(t => t.CriterionName).ToList() : null, IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.EMail).Select(t => t.UserRole.EMail).ToList() : null, - IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, + IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, IR_UnReadCount = isIR ? t.VisitTaskList - .Where(c => c.DoctorUserId == _userInfo.Id && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) + .Where(c => c.DoctorUserId == _userInfo.UserRoleId && c.ReadingTaskState != ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterion.IsSigned) // 前序 不存在 未一致性核查未通过的 .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //前序 不存在 未生成任务的访视 @@ -1511,7 +1207,7 @@ namespace IRaCIS.Core.Application // QC IQC 待领取 QC_IQC_ToBeClaimedCount = (t.UserRole.UserTypeEnum == UserTypeEnum.IQC) ? - t.Trial.SubjectVisitList.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0, + t.Trial.SubjectVisitList.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.UserRoleId && u.ReviewAuditUserId == null))).Count() : 0, // CRC 质疑待回复 --区分人 diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index e7dd24115..fb50c7c2b 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -804,7 +804,7 @@ namespace IRaCIS.Core.Application throw new BusinessValidationFailedException(_localizer["TrialConfig_InvalidParentQuestionId"]); } - if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.Id)) + if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.UserRoleId)) { //---影像质控审核问题已被其他人员确认,不允许再次确认。 throw new BusinessValidationFailedException(_localizer["TrialConfig_AuditQuestionConfirmed"]); @@ -874,7 +874,7 @@ namespace IRaCIS.Core.Application throw new BusinessValidationFailedException(_localizer["TrialConfig_InvalidParentQuestionId"]); } - if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.Id)) + if (await _trialRepository.AnyAsync(t => t.Id == signConfirmDTO.TrialId && t.QCQuestionConfirmedUserId != null && t.QCQuestionConfirmedUserId != _userInfo.UserRoleId)) { //---影像质控审核问题已被其他人员确认,不允许再次确认。 throw new BusinessValidationFailedException(_localizer["TrialConfig_AuditQuestionConfirmed"]); @@ -884,7 +884,7 @@ namespace IRaCIS.Core.Application { IsConfirm = true }); - await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true }); + await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.UserRoleId, IsQCQuestionConfirmed = true }); await _trialRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 1fb49eacd..517789f18 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -47,162 +47,6 @@ namespace IRaCIS.Core.Application.Service - /// - /// 添加和更新接口 已验证邮箱和账户类型不允许添加重复项 - /// - /// - /// - //[Authorize(Policy = IRaCISPolicy.PM_APM)] - [UnitOfWork] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - public async Task AddOrUpdateTrialExternalUser(TrialExternalUserAddAndSendEmail addOrEditTrialExternalUser) - { - - if (addOrEditTrialExternalUser.Id == null) - { - var @lock = _distributedLockProvider.CreateLock($"UserCode"); - - using (await @lock.AcquireAsync()) - { - var existSysUser = await _userRoleRepository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId); - - if (existSysUser != null) - { - if (existSysUser.LastName != addOrEditTrialExternalUser.LastName || existSysUser.FirstName != addOrEditTrialExternalUser.FirstName) - { - //$"该用户在系统中的用户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} 电话:{existSysUser.Phone},与填写信息存在不一致项, 请将界面信息修改为与系统一致,再进行保存", - return ResponseOutput.NotOk(_localizer["TrialExternalUser_Inconsistency", existSysUser.LastName + " / " + existSysUser.FirstName, existSysUser.Phone], new { existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone, existSysUser.IsZhiZhun, existSysUser.IsTestUser }, ApiResponseCodeEnum.NeedTips); - } - - } - - //处理 生成账户 - - if (await _trialExternalUseRepository.AnyAsync(t => - t.Email == addOrEditTrialExternalUser.Email && - t.UserTypeId == addOrEditTrialExternalUser.UserTypeId && t.TrialId == addOrEditTrialExternalUser.TrialId)) - { - //---系统已经存在与列表中填写的邮箱和用户类型相同的账户,请确认。 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_EmailTypeDuplicate"]); - } - - - - var addEntity = _mapper.Map(addOrEditTrialExternalUser); - - await _trialExternalUseRepository.AddAsync(addEntity); - - - var existUser = await _userRoleRepository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId); - var trialType = await _trialRepository.Where(t => t.Id == addOrEditTrialExternalUser.TrialId).Select(t => t.TrialType).FirstOrDefaultAsync(); - - if (existUser != null) - { - addEntity.IsSystemUser = true; - addEntity.SystemUserId = existUser.Id; - - } - else - { - - //生成账户 并插入 - - var generateUser = _mapper.Map(addOrEditTrialExternalUser); - - if (trialType == TrialType.NoneOfficial) - { - generateUser.IsTestUser = true; - } - - // 外部人员生成账号 都是外部的 - generateUser.IsZhiZhun = false; - - generateUser.Code = _userRoleRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - - - generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(UserRole)); - - generateUser.UserName = generateUser.UserCode; - - generateUser.UserTypeEnum = _userTypeRepository.Where(t => t.Id == generateUser.UserTypeId).Select(t => t.UserTypeEnum).First(); - - generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); - - generateUser.Status = UserStateEnum.Disable; - - var newAddUser = await _userRoleRepository.AddAsync(generateUser); - - - addEntity.IsSystemUser = false; - addEntity.SystemUserId = newAddUser.Id; - - - existUser = newAddUser; - - } - - #region 验证用户 能否加入 - - if (trialType == TrialType.OfficialTrial || trialType == TrialType.Training) - { - - if (existUser.IsTestUser) - { - //---正式类型 、培训类型的项目 不允许加入测试用户 - throw new BusinessValidationFailedException(_localizer["TrialExternalUser_TestUserNotAllowed"]); - - } - } - - if (trialType == TrialType.NoneOfficial) - { - - if (existUser.IsTestUser == false) - { - //---测试项目 不允许加入正式用户 - throw new BusinessValidationFailedException(_localizer["TrialExternalUser_FormalUserNotAllowed"]); - } - } - - #endregion - - - await _trialExternalUseRepository.SaveChangesAsync(); - - - //添加的时候就发邮件 现在省略 - if (addOrEditTrialExternalUser.IsSendEmail) - { - await SendExternalUserJoinEmail(new TrialExternalUserSendEmail() - { - BaseUrl = addOrEditTrialExternalUser.BaseUrl, - RouteUrl = addOrEditTrialExternalUser.RouteUrl, - TrialId = addOrEditTrialExternalUser.TrialId, - SendUsers = new List() - { - new UserEmail() - { - Id = addEntity.Id, - Email=addEntity.Email, - IsSystemUser=addEntity.IsSystemUser, - SystemUserId=addEntity.SystemUserId - } - } - }); - } - - - return ResponseOutput.Ok(addEntity.Id.ToString()); - } - - } - else - { - //---人员信息不支持编辑,请删除后重新添加。 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_NotEditable"]); - - } - } @@ -231,43 +75,6 @@ namespace IRaCIS.Core.Application.Service } - //New 省掉邀请流程 - [HttpPost] - //[Authorize(Policy = IRaCISPolicy.PM_APM)] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - [UnitOfWork] - public async Task SendExternalUserJoinEmail(TrialExternalUserSendEmail sendEmail) - { - var trialId = sendEmail.TrialId; - - foreach (var userInfo in sendEmail.SendUsers) - { - var userId = userInfo.SystemUserId; - - - - - //判断TrialUser中是否存在 不存在就插入 注意退出了,也不能再加进来 - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true)) - { - - await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new UserRole() { Status = UserStateEnum.Enable }); - - await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { IsJoin = true }); - - - await _userRoleRepository.SaveChangesAsync(); - } - - await _mailVerificationService.ExternalUserJoinEmail(trialId, userId, sendEmail.BaseUrl, sendEmail.RouteUrl); - - } - - return ResponseOutput.Ok(); - - } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index b9689701c..90342d6a7 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -90,8 +90,8 @@ namespace IRaCIS.Core.Application.Service .WhereIf(multiModalityIdSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Modality) == multiModalityIdSelectCount) .WhereIf(multiCriteriaSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Criterion) == multiCriteriaSelectCount) .WhereIf(multiReviewTypeSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.ReviewType) == multiReviewTypeSelectCount) - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, isEn_Us = _userInfo.IsEn_Us }); return await query.ToPagedListAsync(inQuery); @@ -102,7 +102,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetTrialSelect() { return await _trialRepository.AsQueryable() - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.IsDeleted == false) + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId) && t.IsDeleted == false) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); } @@ -208,7 +208,7 @@ namespace IRaCIS.Core.Application.Service //如果是PM, 则需要将该人员添加到 运维人员表 //添加运维人员PM - await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trial.Id, UserId = _userInfo.Id, JoinTime = DateTime.Now }); + await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trial.Id, UserId = _userInfo.UserRoleId, JoinTime = DateTime.Now }); // 添加扩展信息表记录 await _trialPaymentPriceRepository.AddAsync(new TrialPaymentPrice() { TrialId = trial.Id }); @@ -510,10 +510,7 @@ namespace IRaCIS.Core.Application.Service await _repository.BatchDeleteNoTrackingAsync(t => t.TrialReadingCriterion.TrialId == trialId); await _repository.BatchDeleteNoTrackingAsync(t => t.TrialId == trialId); await _trialDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.TrialId == trialId); - await _repository.BatchDeleteNoTrackingAsync(t => t.TrialDocument.TrialId == trialId); - await _repository.BatchDeleteNoTrackingAsync(t => t.TrialId == trialId); - await _repository.BatchDeleteNoTrackingAsync(t => t.TrialDocument.TrialId == trialId); await _repository.BatchDeleteNoTrackingAsync(t => t.TrialEmailNoticeConfig.TrialId == trialId); @@ -577,7 +574,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.Status == 8, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup)) .WhereIf(inQuery.Status == 10, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) .WhereIf(inQuery.Status == 14, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.Finished)) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, isEn_Us = _userInfo.IsEn_Us }); return await query.ToPagedListAsync(inQuery, nameof(TrialDetailDTO.CreateTime)); @@ -606,13 +603,13 @@ namespace IRaCIS.Core.Application.Service { var query = _trialRepository .WhereIf(inQuery.EnrollStatus != null, o => (int)inQuery.EnrollStatus! == 10 ? - o.EnrollList.Any(o => o.EnrollStatus >= EnrollStatus.ConfirmIntoGroup && o.EnrollStatus <= EnrollStatus.DoctorReading && o.DoctorId == _userInfo.Id) : - o.EnrollList.Any(o => o.EnrollStatus == inQuery.EnrollStatus && o.DoctorId == _userInfo.Id)) + o.EnrollList.Any(o => o.EnrollStatus >= EnrollStatus.ConfirmIntoGroup && o.EnrollStatus <= EnrollStatus.DoctorReading && o.DoctorId == _userInfo.UserRoleId) : + o.EnrollList.Any(o => o.EnrollStatus == inQuery.EnrollStatus && o.DoctorId == _userInfo.UserRoleId)) .WhereIf(inQuery.Expedited != null, o => o.Expedited == inQuery.Expedited) .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Indication), o => o.Indication.Contains(inQuery.Indication)) - .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) + .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.UserRoleId, isEn_Us = _userInfo.IsEn_Us }); return await query.ToPagedListAsync(inQuery, nameof(TrialDetailDTO.CreateTime)); @@ -635,12 +632,12 @@ namespace IRaCIS.Core.Application.Service { await _enrollDetailRepository.AddAsync(new EnrollDetail() { - DoctorId = _userInfo.Id, + DoctorId = _userInfo.UserRoleId, TrialId = trialId, EnrollStatus = status, OptUserType = (int)SystemUserType.DoctorUser, }); - return ResponseOutput.Result(await _enrollRepository.BatchUpdateNoTrackingAsync(u => u.TrialId == trialId && u.DoctorId == _userInfo.Id, e => new Enroll + return ResponseOutput.Result(await _enrollRepository.BatchUpdateNoTrackingAsync(u => u.TrialId == trialId && u.DoctorId == _userInfo.UserRoleId, e => new Enroll { EnrollStatus = status })); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index e3feb10d1..c2225a017 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.TrialSiteName.Contains(inQuery.SiteName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.UserRoleId)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(inQuery.UserKeyInfo) || k.User.UserName.Contains(inQuery.UserKeyInfo) || k.User.EMail.Contains(inQuery.UserKeyInfo))) @@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.TrialSiteName.Contains(inQuery.SiteName) || t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.UserRoleId)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(inQuery.UserKeyInfo) || k.User.UserName.Contains(inQuery.UserKeyInfo) || k.User.EMail.Contains(inQuery.UserKeyInfo))) @@ -244,23 +244,6 @@ namespace IRaCIS.Core.Application.Services return ResponseOutput.Ok(); } - /// - /// 获取项目下的 site 下拉框数据 CRC只看到他负责的 - /// - /// - /// - [HttpGet("{trialId:guid}")] - public async Task> GetTrialSiteSelect(Guid trialId) - { - //CRC只看到他负责的 - - var list = await _trialSiteRepository.Where(t => t.TrialId == trialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id)) - .ProjectTo(_mapper.ConfigurationProvider).OrderBy(t => t.TrialSiteCode).ToListAsync(); - - - return list; - } @@ -269,7 +252,7 @@ namespace IRaCIS.Core.Application.Services //CRC只看到他负责的 var list = await _trialSiteRepository.Where(t => t.TrialId == trialId) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => t.TrialSiteCode).ToListAsync(); var virtualList = await _visitTaskRepository.Where(t => t.IsSelfAnalysis == true && t.TrialId == trialId).Select(t => t.BlindTrialSiteCode).Distinct().ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 1e85a2b64..b4cdaf420 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -275,15 +275,6 @@ namespace IRaCIS.Core.Application.Service - CreateMap() - .ForMember(t => t.TrialSiteUserList, u => u.Ignore()); - - CreateMap() - .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) - .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)) - .ForMember(t => t.TrialSiteCode, u => u.MapFrom(d => d.TrialSiteSurvey.TrialSite.TrialSiteCode)) - .ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSiteSurvey.TrialSite.TrialSiteAliasName)); - CreateMap() .ForMember(t => t.ApprovalRequiredCount, u => @@ -300,12 +291,7 @@ namespace IRaCIS.Core.Application.Service ; var userTypeId = Guid.Empty; - CreateMap() - .ForMember(t => t.WaitSignCount, u => - u.MapFrom(c => userTypeEnumInt == (int)UserTypeEnum.SuperAdmin ? 0 - - : c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == userTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == userId && t.ConfirmTime != null)).Count()) - ); + diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index dcdba4dab..7225513d2 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -202,7 +202,7 @@ namespace IRaCIS.Application.Services .WhereIf(inQuery.TrialType != null, t => t.TrialType == inQuery.TrialType) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialCode), t => t.TrialCode.Contains(inQuery.TrialCode)) .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OA - , t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) + , t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) .ProjectTo(_mapper.ConfigurationProvider); @@ -309,7 +309,7 @@ namespace IRaCIS.Application.Services //如果是PM, 则需要将该人员添加到 运维人员表 //添加运维人员PM - await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trial.Id, UserId = _userInfo.Id, JoinTime = DateTime.Now }); + await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trial.Id, UserId = _userInfo.UserRoleId, JoinTime = DateTime.Now }); //默认采用系统邮件 @@ -639,7 +639,7 @@ namespace IRaCIS.Application.Services StudyCount = patient.SCPStudyList.Count(), - TrialList = patient.SubjectPatientList.Where(t => isAdminOrOA ? true : t.Subject.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)).Select(c => new PatientTrialStatInfo() + TrialList = patient.SubjectPatientList.Where(t => isAdminOrOA ? true : t.Subject.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)).Select(c => new PatientTrialStatInfo() { ExperimentName = c.Subject.Trial.ExperimentName, VisitCount = c.Subject.SubjectVisitList.Count() @@ -693,7 +693,7 @@ namespace IRaCIS.Application.Services var trialQuery = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Filter), t => t.ResearchProgramNo.Contains(inQuery.Filter) || t.ExperimentName.Contains(inQuery.Filter)) - .Where(t => t.TrialUserList.Any(c => c.UserId == _userInfo.Id)) + .Where(t => t.TrialUserList.Any(c => c.UserId == _userInfo.UserRoleId)) .Where(t => !exceptQuery.Any(c => c == t.Id)).ProjectTo(_mapper.ConfigurationProvider); var list = trialQuery.ToList(); @@ -714,7 +714,7 @@ namespace IRaCIS.Application.Services var isAdminOrOA = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.Admin || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.OA || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin; var trialQuery = _subjectPatientRepository.Where(t => t.PatientId == inQuery.PatientId) - .Where(t => isAdminOrOA ? true : t.Subject.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => isAdminOrOA ? true : t.Subject.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await trialQuery.ToPagedListAsync(inQuery); @@ -835,7 +835,7 @@ namespace IRaCIS.Application.Services [FromServices] IOSSService oSSService) { //清理自己管理的项目的数据 - var subjectPatientList = await _subjectPatientRepository.Where(t => t.PatientId == patientId && t.Subject.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var subjectPatientList = await _subjectPatientRepository.Where(t => t.PatientId == patientId && t.Subject.Trial.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .Select(t => new { t.SubjectId, StudyInstanceUidList = t.Patient.SCPStudyList.Select(t => t.StudyInstanceUid).ToList() }).ToListAsync(); if (_studyRepository.Any(t => t.IsUploadFinished == false && t.PatientId == patientId)) @@ -1844,7 +1844,7 @@ namespace IRaCIS.Application.Services { dbSubjectVisit.SubmitState = SubmitStateEnum.Submitted; dbSubjectVisit.SubmitTime = DateTime.Now; - dbSubjectVisit.SubmitUserId = _userInfo.Id; + dbSubjectVisit.SubmitUserId = _userInfo.UserRoleId; //维护统一状态 //dbSubjectVisit.ReadingStatus = ReadingStatusEnum.TaskAllocate; @@ -3283,7 +3283,7 @@ namespace IRaCIS.Application.Services { var trialQuery = _trialRepository .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OA - , t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) + , t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) .Select(t => new NewTrialSelectDTO() { TrialId = t.Id, diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index fd775a7a9..11cc30eaa 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -113,7 +113,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) // CRC 只负责他管理site的受试者 - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId)) .ProjectTo(_mapper.ConfigurationProvider) .WhereIf(inQuery.IsMissingImages != null, t => t.IsMissingImages == inQuery.IsMissingImages); diff --git a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs index 47a4c6a47..ee16337ba 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs @@ -343,181 +343,6 @@ namespace IRaCIS.Core.Application.Service } - /// - /// 入组流程-后台确认医生入组[Confirm] - /// - - [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] - //[Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM_SMM_CMM)] - [UnitOfWork] - public async Task ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand, - [FromServices] IRepository _trialUserRepository, - [FromServices] IRepository _taskAllocationRuleRepository) - { - //var trial = _trialRepository.FirstOrDefault(t => t.Id == trialId); - //var existItem = _trialRepository.FindSingleOrDefault(u => u.Id == trialId && u.TrialStatus >= (int)TrialEnrollStatus.HasConfirmedDoctorNames); - - //trial.TrialStatusStr = "Reading"; - ////trial.TrialStatus = (int)TrialStatus.HasConfirmedDoctorNames; - //_trialRepository.Update(trial); - - var trialId = confirmReviewerCommand.TrialId; - - var trial = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId); - - if (trial == null) return Null404NotFound(trial); - - - //更新入组表 - var intoGroupList = await _enrollRepository.Where(t => t.TrialId == trialId, true).ToListAsync(); - - //验证邮件 - var emaiList = await _doctorRepository.Where(t => intoGroupList.Select(t => t.DoctorId).Contains(t.Id)) - .Select(t => new { t.EMail, t.FirstName, t.LastName }).ToListAsync(); - - - var errorList = emaiList.Where(t => !Regex.IsMatch(t.EMail, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")) - .ToList(); - - if (errorList.Count() > 0) - { - // errorList.Select(c => c.LastName+" / "+c.FirstName)) +"邮箱格式存在问题" - return ResponseOutput.NotOk(string.Join(',', _localizer["Enroll_EmailFormat"], errorList.Select(c => c.LastName + " / " + c.FirstName))); - } - - - - var readingQuestionCriterionTrial = await _ReadingQuestionCriterionTrialRepository.Where(x => x.TrialId == confirmReviewerCommand.TrialId && x.IsConfirm).ToListAsync(); - - - List trialExperienceList = new List(); - // 获取标准字典 - - var criterionTypeList = await _dictionaryRepository.Where(x => x.Parent.Code == "CriterionType").ToListAsync(); - - if (confirmReviewerCommand.ConfirmState == 1) //确认入组 - { - foreach (var intoGroupItem in intoGroupList) - { - if (confirmReviewerCommand.DoctorIdArray.Contains(intoGroupItem.DoctorId)) - { - - //当邮件发送没有问题的时候,才修改状态 如果有问题,就当前不做处理 - try - { - var userId = await _mailVerificationService.DoctorJoinTrialEmail(trialId, intoGroupItem.DoctorId, confirmReviewerCommand.BaseUrl, confirmReviewerCommand.RouteUrl); - - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true)) - { - await _trialUserRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - } - - await _enrollRepository.BatchUpdateNoTrackingAsync(t => t.Id == intoGroupItem.Id, u => new Enroll() { DoctorUserId = userId }); - - if (!await _taskAllocationRuleRepository.AnyAsync(t => t.TrialId == trialId && t.DoctorUserId == userId && t.EnrollId == intoGroupItem.Id, true)) - { - await _taskAllocationRuleRepository.AddAsync(new TaskAllocationRule() { TrialId = trialId, DoctorUserId = userId, EnrollId = intoGroupItem.Id }); - - } - - await _enrollDetailRepository.AddAsync(new EnrollDetail() - { - DoctorId = intoGroupItem.DoctorId, - TrialId = trialId, - EnrollStatus = EnrollStatus.ConfirmIntoGroup, - OptUserType = (int)SystemUserType.AdminUser, //后台用户 - }); - - intoGroupItem.EnrollStatus = EnrollStatus.ConfirmIntoGroup; - intoGroupItem.EnrollTime = DateTime.Now; - - - - } - catch (Exception) - { - intoGroupItem.EnrollStatus = EnrollStatus.ConfirmIntoGroupFailed; - - } - - } - } - - - List dataTypes = new List() - { - ExperienceDataType.TrialAuto, - ExperienceDataType.SystemAuto, - - - }; - - // 添加临床试验经历 - if (trial.TrialType == TrialType.OfficialTrial) - { - foreach (var doctorId in confirmReviewerCommand.DoctorIdArray) - { - foreach (var item in readingQuestionCriterionTrial) - { - foreach (var dataType in dataTypes) - { - trialExperienceList.Add(new TrialExperience() - { - CriterionType = item.CriterionType, - DoctorId = doctorId, - PhaseId = trial.PhaseId, - StartTime = DateTime.Now, - IndicationEnum = trial.IndicationEnum, - IndicationTypeId= trial.IndicationTypeId, - ExperienceDataType = dataType, - TrialId = trial.Id, - VisitReadingCount = 0, - ExperienceCriteriaList = new List() { - - new TrialExperienceCriteria() - { - EvaluationCriteriaId=criterionTypeList.Where(x=>x.Code==item.CriterionType.GetEnumInt()).Select(x=>x.Id).FirstOrDefault() - } - } - }); - } - } - } - await _trialExperienceRepository.AddRangeAsync(trialExperienceList); - await _trialExperienceRepository.SaveChangesAsync(); - - } - - } - else if (confirmReviewerCommand.ConfirmState == 0)//回退上一步 - { - foreach (var intoGroupItem in intoGroupList) - { - if (confirmReviewerCommand.DoctorIdArray.Contains(intoGroupItem.DoctorId)) - { - intoGroupItem.EnrollStatus = EnrollStatus.InviteIntoGroup; - intoGroupItem.EnrollTime = null; - - - var deleteItem = await _enrollDetailRepository.FirstOrDefaultAsync(t => - t.TrialId == trialId && t.DoctorId == intoGroupItem.DoctorId && - t.EnrollStatus == EnrollStatus.ConfirmIntoGroup); - - await _enrollDetailRepository.DeleteAsync(deleteItem); - } - } - - - } - - - - - await _enrollRepository.SaveChangesAsync(); - return ResponseOutput.Ok(); - - } diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index d91030076..fd2b2f72e 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -6,7 +6,6 @@ using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Service.BusinessFilter; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain; -using IRaCIS.Core.Domain.Management; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infrastructure; @@ -39,11 +38,9 @@ namespace IRaCIS.Core.Application.Service IRepository _trialRepository, IOptionsMonitor _systemEmailConfig, IOptionsMonitor _basicConfig, - IRepository _systemDocumentRepository, IRepository _trialClinicalDataSetCriterionRepository, IRepository _dicomInstanceRepository, IRepository _internationalizationRepository, - IRepository _systemDocConfirmedUserRepository, IRepository _dicomStudyRepository, IRepository _clinicalDataTrialSetRepository, IRepository _readingQuestionCriterionTrialRepository, @@ -362,51 +359,11 @@ namespace IRaCIS.Core.Application.Service { var timeSpan = HolidayHelper.GetChinaWorkTimeSpan(startdate, endDate); - _userRoleRepository.Where(t => t.Id == _userInfo.Id).Select(t => t.FullName).FirstOrDefault(); + _userRoleRepository.Where(t => t.Id == _userInfo.UserRoleId).Select(t => t.FullName).FirstOrDefault(); return $"{timeSpan.Days}天,{timeSpan.Hours}小时{timeSpan.Minutes}分钟{timeSpan.Seconds}秒"; } - public async Task TestEFcore8() - { - var systemDocQuery = from sysDoc in _systemDocumentRepository.Where() - - join confirm in _systemDocConfirmedUserRepository.Where().Where(t => t.ConfirmTime != null) on sysDoc.Id equals confirm.SystemDocumentId - select new UnionDocumentWithConfirmInfoView() - { - IsSystemDoc = true, - - Id = sysDoc.Id, - CreateTime = sysDoc.CreateTime, - IsDeleted = sysDoc.IsDeleted, - SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes, - Name = sysDoc.Name, - Path = sysDoc.Path, - FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN, - FileTypeId = sysDoc.FileTypeId, - UpdateTime = sysDoc.UpdateTime, - - - ConfirmUserId = confirm.ConfirmUserId, - ConfirmTime = confirm.ConfirmTime, - RealName = confirm.ConfirmUser.FullName, - UserName = confirm.ConfirmUser.UserName, - UserTypeId = confirm.ConfirmUser.UserTypeId, - UserTypeShortName = confirm.ConfirmUser.UserTypeRole.UserTypeShortName, - - FullFilePath = sysDoc.Path - }; - - var list = systemDocQuery.OrderBy(t => t.ConfirmUserId).ThenBy(t => t.ConfirmTime).ToList(); - - //var aa= _dicRepository._dbContext.Subject.Where(t => t.Id == Guid.Empty).ExecuteUpdate("FirstName","ddd"); - - //await _repository.BatchUpdateAsync(t => t.Id == Guid.Empty, u => new Subject() { FirstName = "fddd", LastName = "sss", UpdateTime = DateTime.Now }); - - //await _subjectRepository.Where().ExecuteUpdateAsync(t => t.SetProperty(t => t.UpdateTime, u => DateTime.Now)); - - return ResponseOutput.Ok(list); - } // 设置 Ne [AllowAnonymous] diff --git a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs index d806df29b..ed2bd9d99 100644 --- a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs @@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.Triggers if (context.ChangeType == ChangeType.Added) { - await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.Id, IP = _userInfo.IP }); + await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.UserRoleId, IP = _userInfo.IP }); } } diff --git a/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs b/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs index d40bc0898..0b73f967c 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ImageFilterState.cs @@ -41,13 +41,20 @@ public enum UserOptType UpdateUser = 11, - MFALogin = 12, + [Description("更新用户角色")] + UpdateUserRole = 12, - MFALoginFail = 13, + TempLockLogin = 13, AddUser = 14, + ModifyCheckCode = 15, + + WebUnlock = 16, + + [Description("选择登录角色")] + LoginSelectRole = 18, } [Description("影像下载打包状态")] diff --git a/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs b/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs deleted file mode 100644 index 86c52d717..000000000 --- a/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace IRaCIS.Core.Domain.Models; - -[Comment("后台 - 系统文档签署记录")] -[Table("SystemDocConfirmedUser")] -public class SystemDocConfirmedUser : BaseAddDeleteAuditEntity - -{ - #region 导航属性 - [JsonIgnore] - public SystemDocument SystemDocument { get; set; } - - [JsonIgnore] - [ForeignKey("ConfirmUserId")] - public UserRole ConfirmUser { get; set; } - #endregion - public Guid SystemDocumentId { get; set; } - - public DateTime? ConfirmTime { get; set; } - public Guid ConfirmUserId { get; set; } - - public DateTime? SignFirstViewTime { get; set; } - - [StringLength(1000)] - public string SignText { get; set; } = string.Empty; -} - diff --git a/IRaCIS.Core.Domain/Document/SystemDocNeedConfirmedUserType.cs b/IRaCIS.Core.Domain/Document/SystemDocNeedConfirmedUserType.cs deleted file mode 100644 index 0c5bc2a95..000000000 --- a/IRaCIS.Core.Domain/Document/SystemDocNeedConfirmedUserType.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace IRaCIS.Core.Domain.Models; - -[Comment("后台 - 系统文档需要签署用户类型")] -[Table("SystemDocNeedConfirmedUserType")] -public class SystemDocNeedConfirmedUserType : Entity -{ - #region 导航属性 - [JsonIgnore] - [ForeignKey("NeedConfirmUserTypeId")] - public UserType UserTypeRole { get; set; } - - [JsonIgnore] - public SystemDocument SystemDocument { get; set; } - #endregion - public Guid SystemDocumentId { get; set; } - - public Guid NeedConfirmUserTypeId { get; set; } - -} - diff --git a/IRaCIS.Core.Domain/Document/SystemDocument.cs b/IRaCIS.Core.Domain/Document/SystemDocument.cs deleted file mode 100644 index 1edc28880..000000000 --- a/IRaCIS.Core.Domain/Document/SystemDocument.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace IRaCIS.Core.Domain.Models; - -[Comment("后台 - 系统签署文档")] -[Table("SystemDocument")] -public class SystemDocument : BaseFullDeleteAuditEntity -{ - #region 导航属性 - [JsonIgnore] - public List SystemDocConfirmedUserList { get; set; } - [JsonIgnore] - public List NeedConfirmedUserTypeList { get; set; } - [JsonIgnore] - [ForeignKey("FileTypeId")] - public Dictionary FileType { get; set; } - #endregion - public Guid FileTypeId { get; set; } - public string Name { get; set; } = string.Empty; - - public int SignViewMinimumMinutes { get; set; } - - [StringLength(1000)] - public string Path { get; set; } = string.Empty; - - public DocUserSignType DocUserSignType { get; set; } -} - -public enum DocUserSignType -{ - //默认 内部 外部都需要签署 - InnerAndOuter=0, - - //仅仅内部需要签署 - OnlyInner=1, - - -} \ No newline at end of file diff --git a/IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs b/IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs deleted file mode 100644 index 1aee269d6..000000000 --- a/IRaCIS.Core.Domain/Document/TrialDocConfirmedUser.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace IRaCIS.Core.Domain.Models; - -[Comment("项目 - 项目文档签署记录")] -[Table("TrialDocConfirmedUser")] -public class TrialDocConfirmedUser : BaseAddDeleteAuditEntity -{ - #region 导航属性 - - [JsonIgnore] - [ForeignKey("ConfirmUserId")] - public UserRole User { get; set; } - [JsonIgnore] - public TrialDocument TrialDocument { get; set; } - #endregion - public Guid TrialDocumentId { get; set; } - public DateTime? ConfirmTime { get; set; } - public Guid ConfirmUserId { get; set; } - public DateTime? SignFirstViewTime { get; set; } - - [StringLength(1000)] - public string SignText { get; set; } = string.Empty; -} diff --git a/IRaCIS.Core.Domain/Document/TrialDocNeedConfirmedUserType.cs b/IRaCIS.Core.Domain/Document/TrialDocNeedConfirmedUserType.cs deleted file mode 100644 index c5d5f0ece..000000000 --- a/IRaCIS.Core.Domain/Document/TrialDocNeedConfirmedUserType.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace IRaCIS.Core.Domain.Models; - -[Comment("项目 - 项目文档需要签署的用户类型")] -[Table("TrialDocNeedConfirmedUserType")] -public class TrialDocNeedConfirmedUserType : Entity -{ - #region 导航属性 - [JsonIgnore] - [ForeignKey("NeedConfirmUserTypeId")] - public UserType UserTypeRole { get; set; } - - [JsonIgnore] - public TrialDocument TrialDocument { get; set; } - #endregion - - public Guid TrialDocumentId { get; set; } - - public Guid NeedConfirmUserTypeId { get; set; } -} - diff --git a/IRaCIS.Core.Domain/Document/TrialDocument.cs b/IRaCIS.Core.Domain/Document/TrialDocument.cs deleted file mode 100644 index f3885b390..000000000 --- a/IRaCIS.Core.Domain/Document/TrialDocument.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace IRaCIS.Core.Domain.Models; - -[Comment("项目 - 项目文档")] -[Table("TrialDocument")] -public class TrialDocument : BaseFullDeleteAuditEntity -{ - #region 导航属性 - [JsonIgnore] - public List TrialDocConfirmedUserList { get; set; } - [JsonIgnore] - public List NeedConfirmedUserTypeList { get; set; } - [JsonIgnore] - public Trial Trial { get; set; } - - [JsonIgnore] - [ForeignKey("FileTypeId")] - public Dictionary FileType { get; set; } - #endregion - [Comment("需要确认的项目用户 通过TrialId 关联 用中间表过滤")] - public Guid FileTypeId { get; set; } - - public string Name { get; set; } = string.Empty; - - public string Path { get; set; } = string.Empty; - - public Guid TrialId { get; set; } - - public string Description { get; set; } = string.Empty; - - public int SignViewMinimumMinutes { get; set; } -} - diff --git a/IRaCIS.Core.Domain/Management/HospitalGroup.cs b/IRaCIS.Core.Domain/Management/HospitalGroup.cs index 2b658f6e7..04882d186 100644 --- a/IRaCIS.Core.Domain/Management/HospitalGroup.cs +++ b/IRaCIS.Core.Domain/Management/HospitalGroup.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace IRaCIS.Core.Domain.Management +namespace IRaCIS.Core.Domain.Models { [Comment("课题组")] public class HospitalGroup : BaseFullAuditEntity @@ -33,7 +33,7 @@ namespace IRaCIS.Core.Domain.Management public Guid IdentityUserId { get; set; } - public bool IsManager { get; set; } + public bool IsManager { get; set; } } @@ -53,6 +53,11 @@ namespace IRaCIS.Core.Domain.Management [Projectable] public string FullName => LastName + " / " + FirstName; + [JsonIgnore] + public Trial Trial { get; set; } + + public Guid? TrialId { get; set; } + #region 用户信息 public int Code { get; set; } diff --git a/IRaCIS.Core.Domain/Management/User.cs b/IRaCIS.Core.Domain/Management/User.cs index 4d82a4e8b..e8969dbab 100644 --- a/IRaCIS.Core.Domain/Management/User.cs +++ b/IRaCIS.Core.Domain/Management/User.cs @@ -9,11 +9,18 @@ public class UserRole : BaseFullAuditEntity { #region + [JsonIgnore] + public IdentityUser IdentityUser { get; set; } + + + [JsonIgnore] + public List UserRoleTrials { get; set; } = new List(); + + + [JsonIgnore] [ForeignKey("UserTypeId")] public UserType UserTypeRole { get; set; } - [JsonIgnore] - public List SystemDocConfirmedList { get; set; } [JsonIgnore] public List UserTrials { get; set; } = new List(); @@ -26,21 +33,45 @@ public class UserRole : BaseFullAuditEntity #endregion + + #region + + public string UserName { get; set; } + public string EMail { get; set; } + public string FirstName { get; set; } + + public string LastName { get; set; } + + [Comment("Զлһ")] public bool AutoCutNextTask { get; set; } - public int Code { get; set; } - public string DepartmentName { get; set; } = null!; + [Comment("ҽ˺ź󣬻ֵ")] public Guid? DoctorId { get; set; } - public string EMail { get; set; } = null!; + public UserTypeEnum UserTypeEnum { get; set; } + + public Guid UserTypeId { get; set; } + + + public Guid IdentityUserId { get; set; } + + public bool IsUserRoleDisabled { get; set; } + + #endregion + + + #region + public int Code { get; set; } + public string DepartmentName { get; set; } = null!; + [StringLength(1000)] public string EmailToken { get; set; } = null!; - public string FirstName { get; set; } = null!; + [Comment("״ε¼Ҫ޸")] public bool IsFirstAdd { get; set; } = true; @@ -57,7 +88,7 @@ public class UserRole : BaseFullAuditEntity public DateTime? LastLoginTime { get; set; } - public string LastName { get; set; } = null!; + public string OrganizationName { get; set; } = null!; @@ -65,10 +96,10 @@ public class UserRole : BaseFullAuditEntity public bool PasswordChanged { get; set; } - + public string Phone { get; set; } = null!; - + public string PositionName { get; set; } = null!; public int? Sex { get; set; } @@ -77,17 +108,10 @@ public class UserRole : BaseFullAuditEntity public bool SuperAdmin { get; set; } - + public string UserCode { get; set; } = null!; - public string UserName { get; set; } = null!; - public UserTypeEnum UserTypeEnum { get; set; } - - public Guid UserTypeId { get; set; } - - - public Guid IdentityUserId { get; set; } #region HIR @@ -97,4 +121,8 @@ public class UserRole : BaseFullAuditEntity public string ThirdUserCode { get; set; } = string.Empty; #endregion + + #endregion + + } diff --git a/IRaCIS.Core.Domain/Management/UserLog.cs b/IRaCIS.Core.Domain/Management/UserLog.cs index 696c40f91..1cb847702 100644 --- a/IRaCIS.Core.Domain/Management/UserLog.cs +++ b/IRaCIS.Core.Domain/Management/UserLog.cs @@ -1,4 +1,3 @@ -using IRaCIS.Core.Domain.Management; using IRaCIS.Core.Domain.Share; namespace IRaCIS.Core.Domain.Models; diff --git a/IRaCIS.Core.Domain/Management/UserType.cs b/IRaCIS.Core.Domain/Management/UserType.cs index b4012b58e..8a9f5e37f 100644 --- a/IRaCIS.Core.Domain/Management/UserType.cs +++ b/IRaCIS.Core.Domain/Management/UserType.cs @@ -11,8 +11,6 @@ public class UserType : Entity [JsonIgnore] public List UserTypeGroupList { get; set; } - [JsonIgnore] - public List SystemDocNeedConfirmedUserTypeList { get; set; } [JsonIgnore] public List UserList { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index 3d627fb2b..337d2f77e 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -31,8 +31,7 @@ public partial class Trial : BaseFullDeleteAuditEntity [JsonIgnore] public List TrialSiteSurveyList { get; set; } = new List(); - [JsonIgnore] - public List TrialDocumentList { get; set; } + [JsonIgnore] public List EnrollList { get; set; } = new List(); [JsonIgnore] diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs index 3af19b958..6f3b8c7a0 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialUser.cs @@ -1,4 +1,3 @@ -using IRaCIS.Core.Domain.Management; namespace IRaCIS.Core.Domain.Models; diff --git a/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs b/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs index 6a99ca4d8..3c146fb3c 100644 --- a/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs +++ b/IRaCIS.Core.Infra.EFCore/AuthUser/IUserInfo.cs @@ -6,12 +6,13 @@ public interface IUserInfo { - Guid Id { get; } + Guid UserRoleId { get; } + + Guid IdentityUserId { get; } string UserName { get; } - string RealName { get; } - string ReviewerCode { get; } + string FullName { get; } bool IsAdmin { get; } @@ -42,6 +43,11 @@ Guid? BatchId { get; set; } + /// + /// 稽查额外字符串 + /// + string AuditIdentification { get; set; } + bool IsNotNeedInspection { get; set; } @@ -49,10 +55,5 @@ /// 字符串形式 标识时区 /// string TimeZoneId { get; } - - /// - /// 稽查额外字符串 - /// - string AuditIdentification { get; set; } } } diff --git a/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs b/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs index 2cc6bf0a7..45bfd41e8 100644 --- a/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs +++ b/IRaCIS.Core.Infra.EFCore/AuthUser/UserInfo.cs @@ -15,13 +15,29 @@ namespace IRaCIS.Core.Domain.Share } /// - /// 用户Id + /// 用户角色Id /// - public Guid Id + public Guid UserRoleId { get { - var id = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.Id); + var id = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.UserRoleId); + if (id != null && !string.IsNullOrEmpty(id.Value)) + { + return Guid.Parse(id.Value); + } + return Guid.Empty; + } + } + + /// + /// 真实用户Id + /// + public Guid IdentityUserId + { + get + { + var id = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.IdentityUserId); if (id != null && !string.IsNullOrEmpty(id.Value)) { return Guid.Parse(id.Value); @@ -51,7 +67,7 @@ namespace IRaCIS.Core.Domain.Share { get { - var name = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.Name); + var name = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.UserName); if (name != null && !string.IsNullOrEmpty(name.Value)) { @@ -63,11 +79,11 @@ namespace IRaCIS.Core.Domain.Share } - public string RealName + public string FullName { get { - var name = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.RealName); + var name = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.FullName); if (name != null && !string.IsNullOrEmpty(name.Value)) { @@ -78,19 +94,7 @@ namespace IRaCIS.Core.Domain.Share } } - public string ReviewerCode - { - get - { - var reviewerCode = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.Code); - if (reviewerCode != null && !string.IsNullOrEmpty(reviewerCode.Value)) - { - return reviewerCode.Value; - } - return string.Empty; - } - } public string UserTypeShortName @@ -165,7 +169,7 @@ namespace IRaCIS.Core.Domain.Share } } - public bool IsTestUser + public bool IsTestUser { get { @@ -258,7 +262,7 @@ namespace IRaCIS.Core.Domain.Share get { - var url = _accessor?.HttpContext?.Request?.Path.ToString()??string.Empty; + var url = _accessor?.HttpContext?.Request?.Path.ToString(); var list = url.Split('/').Where(t => !string.IsNullOrWhiteSpace(t)).ToList(); @@ -310,6 +314,7 @@ namespace IRaCIS.Core.Domain.Share get; set; } + /// /// 是否不需要记录稽查 /// @@ -318,7 +323,7 @@ namespace IRaCIS.Core.Domain.Share /// /// 稽查额外字符串 /// - public string AuditIdentification { get; set; } + public string AuditIdentification { get; set; } = string.Empty; } public static class ClaimAttributes @@ -347,16 +352,16 @@ namespace IRaCIS.Core.Domain.Share public struct JwtIRaCISClaimType { - public const string Id = "id"; + public const string IdentityUserId = "identityUserId"; + public const string UserRoleId = "userRoleId"; public const string Code = "code"; - public const string Name = "name"; - public const string RealName = "realName"; + public const string UserName = "name"; + public const string FullName = "fullName"; public const string UserTypeId = "userTypeId"; public const string UserTypeEnum = "userTypeEnum"; public const string UserTypeEnumName = "userTypeEnumName"; public const string UserTypeEnumInt = "userTypeEnumInt"; public const string UserTypeShortName = "userTypeShortName"; - public const string IsAdmin = "isAdmin"; public const string IsTestUser = "isTestUser"; @@ -390,7 +395,6 @@ namespace IRaCIS.Core.Domain.Share { return string.Empty; } - } static string IpReplace(string inip) diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 1932fb06b..3a9b5b22f 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -77,7 +77,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { return new List() { - typeof(TrialDocument) + }; } } @@ -903,192 +903,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common #endregion - #region 文档相关 - - - - // 系统文件签署 父层级未记录稽查(系统文档初始数据) - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocConfirmedUser))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as SystemDocConfirmedUser; - - var extraIdentification = string.Empty; - - - if (type == AuditOpt.Update) - { - if (entity.IsDeleted == true) - { - extraIdentification = "/" + 2; - } - else - { - extraIdentification = "/" + 1; - } - } - - - var systemDocument = await _dbContext.SystemDocument.Where(x => x.Id == entity.SystemDocumentId).FirstOrDefaultAsync(); - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - GeneralId = x.Id, - ExtraIndentification = extraIdentification, - ObjectRelationParentId = x.SystemDocumentId - - }, new - { - - FileTypeId = systemDocument.FileTypeId, - Name = systemDocument.Name, - UploadTime = systemDocument.CreateTime, - - CreateUserName = _userInfo.UserName, - UserType = _userInfo.UserTypeShortName, - IsSigned = entity.ConfirmTime != null, // 是否签署 添加了就是签署了 - }); - } - - // 项目文件签署 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocConfirmedUser))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as TrialDocConfirmedUser; - - var extraIdentification = string.Empty; - - - if (type == AuditOpt.Update) - { - if (entity.IsDeleted == true) - { - extraIdentification = "/" + 2; - } - else - { - extraIdentification = "/" + 1; - } - } - - var trialDoc = await _dbContext.TrialDocument.Where(x => x.Id == entity.TrialDocumentId).FirstOrDefaultAsync(); - - await InsertInspection(entity as TrialDocConfirmedUser, type, x => new InspectionConvertDTO() - { - TrialId = trialDoc.TrialId, - ExtraIndentification = extraIdentification, - - ObjectRelationParentId = x.TrialDocumentId - }, new - { - - UploadTime = trialDoc.CreateTime, - - CreateUserName = _userInfo.UserName, - - UserType = _userInfo.UserTypeShortName, - - IsSigned = entity.ConfirmTime != null - }); - } - - - //系统文件 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocument))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as SystemDocument; - - List needConfirmedUserTypeIdList = new List(); - - if (entity.NeedConfirmedUserTypeList == null) - { - needConfirmedUserTypeIdList = await _dbContext.SystemDocNeedConfirmedUserType.Where(x => x.SystemDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync(); - } - else - { - needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList(); - } - - - var userTypeNameList = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync(); - var userTypeName = string.Join(",", userTypeNameList); - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false - }, new - { - NeedConfirmedUserType = userTypeName, - }); - } - - // 项目文档 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as TrialDocument; - - List needConfirmedUserTypeIdList = new List(); - - if (entity.NeedConfirmedUserTypeList == null) - { - needConfirmedUserTypeIdList = await _dbContext.TrialDocNeedConfirmedUserType.Where(x => x.TrialDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync(); - } - else - { - needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList(); - } - - var usertypeNames = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync(); - var usertypeName = string.Join(",", usertypeNames); - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false, - ObjectRelationParentId = x.TrialId - }, - new - { - NeedConfirmedUserType = usertypeName, - }); - - - } - - //项目标准自动发送邮件配置 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialEmailNoticeConfig))) - { - var type = GetEntityAuditOpt(item); - - var extraIdentification = string.Empty; - - var entity = item.Entity as TrialEmailNoticeConfig; - - //找到配置的用户 - var configUserTypeList = entitys.Where(x => x.Entity.GetType() == typeof(TrialEmailNoticeUser)).Select(t => t.Entity as TrialEmailNoticeUser) - .Where(t => t.TrialEmailNoticeConfigId == entity.Id).Select(t => - new { t.TrialEmailNoticeConfigId, t.EmailUserType, t.UserType }).ToList(); - - - - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false, - ObjectRelationParentId = x.TrialReadingCriterionId, - ExtraIndentification = extraIdentification - }, - new - { - ToUserTypes = configUserTypeList.Where(t => t.EmailUserType == EmailUserType.To).Select(t => t.UserType).ToList(), - CopyUserTypes = configUserTypeList.Where(t => t.EmailUserType == EmailUserType.Copy).Select(t => t.UserType).ToList(), - }); - - - } - - #endregion #region 热键 模板 个性化配置 @@ -3594,9 +3408,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common inspection.CreateUserName = _userInfo.UserName; - inspection.CreateUserRealName = _userInfo.RealName; + inspection.CreateUserRealName = _userInfo.FullName; inspection.RoleName = _userInfo.UserTypeShortName; - inspection.CreateUserId = _userInfo.Id; + inspection.CreateUserId = _userInfo.UserRoleId; inspection.IP = _userInfo.IP; inspection.CreateTime = inspection.CreateTime == default(DateTime) ? DateTime.Now : inspection.CreateTime; @@ -3779,11 +3593,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { var entityTypeName = entityObj.GetType().Name; - //文档签署这块,不区分系统和项目的 需要处理为同一个标识 - if (typeof(T) == typeof(TrialDocConfirmedUser) || typeof(T) == typeof(SystemDocConfirmedUser)) - { - entityTypeName = "New/" + "UserSigned"; - } + //默认规则 if (IsDistinctionInterface) diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 9e93501bd..de8d84675 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -1,5 +1,4 @@ using IRaCIS.Core.Domain.BaseModel; -using IRaCIS.Core.Domain.Management; using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infrastructure.Encryption; @@ -471,17 +470,7 @@ public class IRaCISDBContext : DbContext #endregion - #region Document - public virtual DbSet SystemDocument { get; set; } - public virtual DbSet TrialDocument { get; set; } - public virtual DbSet TrialDocUserTypeConfirm { get; set; } - public virtual DbSet SystemDocConfirmedUser { get; set; } - public virtual DbSet SystemDocNeedConfirmedUserType { get; set; } - public virtual DbSet TrialDocNeedConfirmedUserType { get; set; } - - public virtual DbSet TrialDocConfirmedUser { get; set; } - #endregion #region 未分类 diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs index 9ab92ec15..733c3434a 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs @@ -55,25 +55,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration } } - public class SystemDocConfirmedUserConfigration : IEntityTypeConfiguration - { - public void Configure(EntityTypeBuilder builder) - { - #region 不用显示配置 - //// 配置 CreateUser 关系 - //builder.HasOne(s => s.CreateUser) - // .WithMany() // 假设 User 表没有对应的反向导航属性,如果有,填入属性名 - // .HasForeignKey(s => s.CreateUserId); - ////.OnDelete(DeleteBehavior.Restrict); // 可根据业务需求调整删除行为 - #endregion - // 配置 ConfirmUser 关系 (一个用户可以签名多个文档) - builder.HasOne(s => s.ConfirmUser) // ConfirmUser - .WithMany(t => t.SystemDocConfirmedList) - .HasForeignKey(s => s.ConfirmUserId); - //.OnDelete(DeleteBehavior.Restrict); - } - } public class TrialUserConfigration : IEntityTypeConfiguration { @@ -82,11 +64,38 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { //TrialUser 和User 之间 一对多 (一个用户可以参与多个项目) builder.HasOne(s => s.UserRole) - .WithMany(t => t.UserTrials) + .WithMany(t => t.UserRoleTrials) .HasForeignKey(s => s.UserId); //TrialUser User 一对一 创建人 } } + public class IdentityUserConfigration : IEntityTypeConfiguration + { + //当一个实体,针对同一个类,有两个一对一导航属性,但是是不同的外键,一个外键是一对一,一个是一对多,那么需要显示配置一对多的关系 + public void Configure(EntityTypeBuilder builder) + { + builder.HasMany(s => s.UserRoleList) + .WithOne(t => t.IdentityUser) + .HasForeignKey(s => s.IdentityUserId); + + + + } + } + + + public class TrialIdentityUserConfigration : IEntityTypeConfiguration + { + //当一个实体,针对同一个类,有两个一对一导航属性,但是是不同的外键,一个外键是一对一,一个是一对多,那么需要显示配置一对多的关系 + public void Configure(EntityTypeBuilder builder) + { + builder.HasMany(s => s.TrialUserRoleList) + .WithOne(t => t.TrialUser) + .HasForeignKey(s => s.TrialUserId); + } + } + + } diff --git a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs index a3224346c..ad1ba2867 100644 --- a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs +++ b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs @@ -104,14 +104,14 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, if (entry.Entity is IAuditUpdate updateEntity1) { updateEntity1.UpdateTime = DateTime.Now; - updateEntity1.UpdateUserId = _userInfo.Id; + updateEntity1.UpdateUserId = _userInfo.UserRoleId; } if (entry.Entity is ISoftDelete softDelete) { if (softDelete.IsDeleted) { - softDelete.DeleteUserId = _userInfo.Id; + softDelete.DeleteUserId = _userInfo.UserRoleId; softDelete.DeletedTime = DateTime.Now; } else @@ -133,7 +133,7 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, } if (addEntity.CreateUserId == default(Guid)) { - addEntity.CreateUserId = _userInfo.Id; + addEntity.CreateUserId = _userInfo.UserRoleId; } } @@ -141,7 +141,7 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, if (entry.Entity is IAuditUpdate updateEntity) { updateEntity.UpdateTime = DateTime.Now; - updateEntity.UpdateUserId = _userInfo.Id; + updateEntity.UpdateUserId = _userInfo.UserRoleId; } break; } diff --git a/IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.Designer.cs b/IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.Designer.cs new file mode 100644 index 000000000..ebf666c86 --- /dev/null +++ b/IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.Designer.cs @@ -0,0 +1,18753 @@ +// +using System; +using IRaCIS.Core.Infra.EFCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IRaCIS.Core.Infra.EFCore.Migrations +{ + [DbContext(typeof(IRaCISDBContext))] + [Migration("20250815014752_secondUserModify")] + partial class secondUserModify + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Attachment", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("编码"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpiryDate") + .HasColumnType("datetime2") + .HasComment("过期时间"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsOfficial") + .HasColumnType("bit") + .HasComment("是否正式简历"); + + b.Property("Language") + .HasColumnType("int") + .HasComment("1 中文 2为英文"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件类型名"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorId"); + + b.ToTable("Attachment", t => + { + t.HasComment("医生 - 简历|证书 文档表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CRO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CROCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CROName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CRONameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsTrialLevel") + .HasColumnType("bit") + .HasComment("是否是项目级别"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("CROCompany", t => + { + t.HasComment("机构 - CRO"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CheckChallengeDialog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCRCNeedReply") + .HasColumnType("bit") + .HasComment("CRC是否需要回复 前端使用"); + + b.Property("ParamInfo") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasComment("核查的检查信息Json"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TalkContent") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserTypeEnum") + .HasColumnType("int") + .HasComment("核查过程中的操作用户类型"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("CheckChallengeDialog", t => + { + t.HasComment("一致性核查 - 对话记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalAnswerRowInfo", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalFormId") + .HasColumnType("uniqueidentifier") + .HasComment("表单Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("问题Id"); + + b.Property("RowIndex") + .HasColumnType("int"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier") + .HasComment("受试者Id"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ClinicalAnswerRowInfo", t => + { + t.HasComment("受试者 - 临床表单表格问题行记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataSystemSet", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalDataLevel") + .HasColumnType("int"); + + b.Property("ClinicalDataSetEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ClinicalDataSetEnum") + .HasColumnType("int") + .HasComment("枚举(字典里面取的)"); + + b.Property("ClinicalDataSetName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ClinicalUploadType") + .HasColumnType("int") + .HasComment("上传方式"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionEnumListStr") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsApply") + .HasColumnType("bit") + .HasComment("是否应用"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("UploadRole") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ClinicalDataSystemSet", t => + { + t.HasComment("系统 - 临床数据配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalDataLevel") + .HasColumnType("int") + .HasComment("临床级别"); + + b.Property("ClinicalDataSetEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ClinicalDataSetName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ClinicalUploadType") + .HasColumnType("int") + .HasComment("上传方式"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionEnumListStr") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsApply") + .HasColumnType("bit") + .HasComment("是否应用"); + + b.Property("IsConfirm") + .HasColumnType("bit"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("SystemClinicalDataSetId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UploadRole") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SystemClinicalDataSetId"); + + b.HasIndex("TrialId"); + + b.ToTable("ClinicalDataTrialSet", t => + { + t.HasComment("项目 - 临床数据适应标准配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalForm", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CheckDate") + .HasColumnType("datetime2") + .HasComment("检查日期"); + + b.Property("ClinicalDataTrialSetId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("PicturePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("截图地址"); + + b.Property("ReadingId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier") + .HasComment("受试者Id"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ClinicalDataTrialSetId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.ToTable("ClinicalForm", t => + { + t.HasComment("受试者 - 临床表单"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalQuestionAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ClinicalDataTrialSetId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalFormId") + .HasColumnType("uniqueidentifier") + .HasComment("表单Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("问题Id"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier") + .HasComment("受试者Id"); + + b.HasKey("Id"); + + b.HasIndex("ClinicalFormId"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ClinicalQuestionAnswer", t => + { + t.HasComment("受试者 - 临床表单问题答案"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalTableAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("答案"); + + b.Property("ClinicalFormId") + .HasColumnType("uniqueidentifier") + .HasComment("表单Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("问题Id"); + + b.Property("RowId") + .HasColumnType("uniqueidentifier") + .HasComment("答案行的Id"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier") + .HasComment("受试者Id"); + + b.Property("TableQuestionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("RowId"); + + b.ToTable("ClinicalTableAnswer", t => + { + t.HasComment("受试者 - 临床表单表格问题答案"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CommonDocument", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessScenarioEnum") + .HasColumnType("int") + .HasComment("业务场景"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionTypeEnum") + .HasColumnType("int") + .HasComment("系统标准枚举"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FileTypeEnum") + .HasColumnType("int") + .HasComment("类型-上传|导出|邮件附件"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("NameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("CommonDocument", t => + { + t.HasComment("数据上传 | 数据导出 | 邮件附件 文件记录表 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CriterionNidusSystem", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsSystemCriterion") + .HasColumnType("bit"); + + b.Property("LesionType") + .HasColumnType("int") + .HasComment("病灶类型"); + + b.Property("OrganType") + .HasColumnType("int") + .HasComment("器官类型"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("CriterionId"); + + b.ToTable("CriterionNidusSystem", t => + { + t.HasComment("系统标准 - 病灶器官表 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CriterionNidusTrial", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("LesionType") + .HasColumnType("int"); + + b.Property("OrganType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("CriterionNidusTrial", t => + { + t.HasComment("项目标准 - 病灶器官表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DataInspection", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BatchId") + .HasColumnType("uniqueidentifier") + .HasComment("批次Id"); + + b.Property("ChildrenTypeId") + .HasColumnType("uniqueidentifier") + .HasComment("子类"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateUserName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("创建人姓名"); + + b.Property("CreateUserRealName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DoctorUserId") + .HasColumnType("uniqueidentifier") + .HasComment("阅片医生"); + + b.Property("EntityName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("被稽查实体名"); + + b.Property("GeneralId") + .HasColumnType("uniqueidentifier") + .HasComment("要稽查对象Id"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Identification") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("标识"); + + b.Property("IsFrontAdd") + .HasColumnType("bit") + .HasComment("是否是前端添加"); + + b.Property("IsSign") + .HasColumnType("bit"); + + b.Property("JsonDetail") + .HasColumnType("nvarchar(max)"); + + b.Property("LastJsonDetail") + .HasColumnType("nvarchar(max)") + .HasComment("上一条json"); + + b.Property("ModuleTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectRelationParentId") + .HasColumnType("uniqueidentifier") + .HasComment("被稽查对象外键1"); + + b.Property("ObjectRelationParentId2") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectRelationParentId3") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("OptTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("父ID"); + + b.Property("Reason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("角色名称"); + + b.Property("SignId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitStageId") + .HasColumnType("uniqueidentifier") + .HasComment("访视计划ID"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("DataInspection", t => + { + t.HasComment("稽查 - 记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomAE", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CalledAE") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsSupportMutiModality") + .HasColumnType("bit") + .HasComment("是否支持多模态查询"); + + b.Property("IsTestOK") + .HasColumnType("bit"); + + b.Property("LatestTestTime") + .HasColumnType("datetime2"); + + b.Property("MaxStudyCount") + .HasColumnType("int"); + + b.Property("ModalityList") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PacsSearchMaxDays") + .HasColumnType("int"); + + b.Property("PacsTypeEnum") + .HasColumnType("int"); + + b.Property("Port") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("DicomAE", t => + { + t.HasComment("医院dicomAE 配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomInstance", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Anonymize") + .HasColumnType("bit"); + + b.Property("CPIStatus") + .HasColumnType("bit"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("FrameOfReferenceUID") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HtmlPath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ImageColumns") + .HasColumnType("int"); + + b.Property("ImageRows") + .HasColumnType("int"); + + b.Property("ImagerPixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InstanceNumber") + .HasColumnType("int"); + + b.Property("InstanceTime") + .HasColumnType("datetime2"); + + b.Property("NumberOfFrames") + .HasColumnType("int"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("PixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("SeriesInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SliceLocation") + .HasColumnType("int"); + + b.Property("SliceThickness") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SopInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WindowCenter") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("WindowWidth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SeriesId"); + + b.HasIndex("StudyId"); + + b.ToTable("DicomInstance", t => + { + t.HasComment("归档 - Instance表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomSeries", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AcquisitionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartExamined") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ImageOrientationPatient") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImagePositionPatient") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImageResizePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ImagerPixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InstanceCount") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsReading") + .HasColumnType("bit"); + + b.Property("Modality") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ProtocolName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SequenceName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesNumber") + .HasColumnType("int"); + + b.Property("SeriesTime") + .HasColumnType("datetime2"); + + b.Property("SliceThickness") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TriggerTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("StudyId"); + + b.ToTable("DicomSeries", t => + { + t.HasComment("归档 - 序列表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomStudy", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier") + .HasComment("序列Id 避免内存移动"); + + b.Property("AccessionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartExamined") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InstanceCount") + .HasColumnType("int"); + + b.Property("InstitutionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDoubleReview") + .HasColumnType("bit"); + + b.Property("IsFromPACS") + .HasColumnType("bit"); + + b.Property("Modalities") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ModalityForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientAge") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientBirthDate") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientId") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("废弃了,用PatientIdStr"); + + b.Property("PatientIdStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientSex") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesCount") + .HasColumnType("int"); + + b.Property("StudyCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("DicomTag.StudyID"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyTime") + .HasColumnType("datetime2"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TriggerTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UploadedTime") + .HasColumnType("datetime2") + .HasComment("上传时间"); + + b.Property("Uploader") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("TrialId"); + + b.ToTable("DicomStudy"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Dictionary", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ChildGroup") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ConfigTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataTypeEnum") + .HasColumnType("int") + .HasComment("字典类型- 枚举|bool|下拉框"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsConfig") + .HasColumnType("bit") + .HasComment("是否字典类型配置"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ValueCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("ConfigTypeId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ParentId"); + + b.ToTable("Dictionary", t => + { + t.HasComment("后台 - 字典表(需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Doctor", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AcceptingNewTrial") + .HasColumnType("bit"); + + b.Property("ActivelyReading") + .HasColumnType("bit"); + + b.Property("AdminComment") + .HasColumnType("nvarchar(max)"); + + b.Property("AuditTime") + .HasColumnType("datetime2"); + + b.Property("AuditUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("BankName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BankNum") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BankPhoneNum") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BlindName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BlindNameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BlindPublications") + .HasColumnType("nvarchar(max)"); + + b.Property("ChineseName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CooperateStatus") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DepartmentId") + .HasColumnType("uniqueidentifier"); + + b.Property("DepartmentOther") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DepartmentOtherCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("EMail") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("GCP") + .HasColumnType("int"); + + b.Property("GCPAgencies") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("GCPId") + .HasColumnType("uniqueidentifier"); + + b.Property("GCPTime") + .HasColumnType("datetime2"); + + b.Property("HospitalId") + .HasColumnType("uniqueidentifier"); + + b.Property("HospitalOther") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalOtherCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IdCard") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Introduction") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsVirtual") + .HasColumnType("bit"); + + b.Property("LastLoginTime") + .HasColumnType("datetime2"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Nation") + .HasColumnType("int"); + + b.Property("OpeningBank") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganizationId") + .HasColumnType("uniqueidentifier"); + + b.Property("OtherClinicalExperience") + .HasColumnType("nvarchar(max)"); + + b.Property("OtherClinicalExperienceCN") + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PhotoPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Physician") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PhysicianCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PhysicianId") + .HasColumnType("uniqueidentifier"); + + b.Property("PositionId") + .HasColumnType("uniqueidentifier"); + + b.Property("PositionOther") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PositionOtherCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RankId") + .HasColumnType("uniqueidentifier"); + + b.Property("RankOther") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RankOtherCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReadingTypeOther") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReadingTypeOtherCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ResumePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ResumeStatus") + .HasColumnType("int"); + + b.Property("ReviewStatus") + .HasColumnType("int"); + + b.Property("ReviewerCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("SpecialityId") + .HasColumnType("uniqueidentifier"); + + b.Property("SpecialityOther") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SpecialityOtherCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubspecialityOther") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubspecialityOtherCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Summarize") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SummarizeEn") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WeChat") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("WorkPartTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("WorkPartTimeEn") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DepartmentId"); + + b.HasIndex("HospitalId"); + + b.HasIndex("PositionId"); + + b.HasIndex("RankId"); + + b.HasIndex("SpecialityId"); + + b.ToTable("Doctor", t => + { + t.HasComment("医生 - 基础信息表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DoctorCriterionFile", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CriterionType") + .HasColumnType("int") + .HasComment("标准类型"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsIRUpload") + .HasColumnType("bit") + .HasComment("是否是IR上传"); + + b.Property("Remark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorId"); + + b.ToTable("DoctorCriterionFile", t => + { + t.HasComment("医生 - 项目标准签名文档"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DoctorDictionary", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DictionaryId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("KeyName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("DictionaryId"); + + b.HasIndex("DoctorId"); + + b.ToTable("DoctorDictionary", t => + { + t.HasComment("医生 - 医生字典关联表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Education", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BeginDate") + .HasColumnType("date"); + + b.Property("City") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CityCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Country") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CountryCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Degree") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DegreeCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndDate") + .HasColumnType("date"); + + b.Property("Major") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("MajorCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Organization") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganizationCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Province") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ProvinceCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("Education", t => + { + t.HasComment("医生 - 教育信息"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AttachCNPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AttachName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AttachNameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AttachPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BusinessLevelEnum") + .HasColumnType("int") + .HasComment("业务级别"); + + b.Property("BusinessModuleEnum") + .HasColumnType("int") + .HasComment("业务模块"); + + b.Property("BusinessScenarioEnum") + .HasColumnType("int") + .HasComment("业务场景"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionTypeEnum") + .HasColumnType("int") + .HasComment("标准枚举"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailCron") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("发送周期"); + + b.Property("EmailDelaySeconds") + .HasColumnType("int") + .HasComment("邮件延时秒数,比如一个事件触发,延迟多少s后才发邮件"); + + b.Property("EmailHtmlContent") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EmailHtmlContentCN") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EmailTopic") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailTopicCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailUrgentEnum") + .HasColumnType("int") + .HasComment("加急枚举"); + + b.Property("IsAutoSend") + .HasColumnType("bit") + .HasComment("是否自动发送"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDistinguishCriteria") + .HasColumnType("bit") + .HasComment("是否区分标准"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsReturnRequired") + .HasColumnType("bit") + .HasComment("是否需要回执"); + + b.Property("SystemLevel") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("EmailNoticeConfig", t => + { + t.HasComment("后台 - 邮件配置表表(需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeUserType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("EmailNoticeConfigId") + .HasColumnType("uniqueidentifier"); + + b.Property("EmailUserType") + .HasColumnType("int"); + + b.Property("UserType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmailNoticeConfigId"); + + b.ToTable("EmailNoticeUserType", t => + { + t.HasComment("后台 - 邮件配置用户类型表(需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Enroll", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Adjudication") + .HasColumnType("int"); + + b.Property("Adjudication24H") + .HasColumnType("int"); + + b.Property("Adjudication48H") + .HasColumnType("int"); + + b.Property("AdjustmentMultiple") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AttachmentId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorUserId") + .HasColumnType("uniqueidentifier") + .HasComment("生成账号 加入到项目中后 赋值"); + + b.Property("Downtime") + .HasColumnType("int"); + + b.Property("EnrollStatus") + .HasColumnType("int"); + + b.Property("EnrollTime") + .HasColumnType("datetime2"); + + b.Property("Global") + .HasColumnType("int"); + + b.Property("Memo") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OutEnrollTime") + .HasColumnType("datetime2"); + + b.Property("RefresherTraining") + .HasColumnType("int"); + + b.Property("ReviewerReadingType") + .HasColumnType("int"); + + b.Property("Timepoint") + .HasColumnType("int"); + + b.Property("Timepoint24H") + .HasColumnType("int"); + + b.Property("Timepoint48H") + .HasColumnType("int"); + + b.Property("Training") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorId"); + + b.HasIndex("DoctorUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("Enroll", t => + { + t.HasComment("医生 - 入组项目中间记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EnrollDetail", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("EnrollId") + .HasColumnType("uniqueidentifier"); + + b.Property("EnrollStatus") + .HasColumnType("int"); + + b.Property("Memo") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OptUserType") + .HasColumnType("int"); + + b.Property("TrialDetailId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorId"); + + b.HasIndex("TrialDetailId"); + + b.ToTable("EnrollDetail", t => + { + t.HasComment("医生 - 入组项目流程记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EnrollReadingCategory", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EnrollId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReadingCategory") + .HasColumnType("int"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("EnrollId"); + + b.ToTable("EnrollReadingCategory", t => + { + t.HasComment("医生 - 项目阅片标准阅片类型配置表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EnrollReadingCriterion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EnrollId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsJoinAnalysis") + .HasColumnType("bit"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("EnrollId"); + + b.ToTable("EnrollReadingCriterion", t => + { + t.HasComment("医生 - 项目阅片标准参与一致性分析配置表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EventStoreRecord", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EventData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EventState") + .HasColumnType("int"); + + b.Property("EventType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("完整的事件类型名"); + + b.Property("EventTypeName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("简单的事件类型名"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("EventStoreRecord", t => + { + t.HasComment("记录触发的事件,以及状态,从而方便重试操作"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ExchangeRate", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("YearMonth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ExchangeRate", t => + { + t.HasComment("医生计费 - 汇率"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ExploreRecommend", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("DownloadUrl") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ExploreType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ExploreRecommend", t => + { + t.HasComment("后台 - 浏览器推荐 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.FrontAuditConfig", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ChildDataEnLabel") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ChildDataLabel") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("前端渲染数组 数组名 和数组值"); + + b.Property("ChildDataValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("子数据Value"); + + b.Property("ChildrenTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("翻译的字段名 这里有可能是一个数组名 那么具体的翻译字段名就不是这个了"); + + b.Property("CodeEn") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ConfigType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("前端使用 C M"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("前端展示类型 Router, Array,Table"); + + b.Property("DateType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("日期格式"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DescriptionCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("翻译的字典名(单个字段翻译的时候)"); + + b.Property("DictionaryKey") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典名称-待废弃核查"); + + b.Property("DictionaryType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("枚举字典Type"); + + b.Property("EnumType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("后端翻译的类型 对应前端界面 Dictionary Date"); + + b.Property("ForeignKeyEnText") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ForeignKeyTableName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("外键表"); + + b.Property("ForeignKeyText") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("外键Text"); + + b.Property("ForeignKeyValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("外键Value"); + + b.Property("Identification") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("标识"); + + b.Property("InterfaceName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("接口名"); + + b.Property("IsConfig") + .HasColumnType("bit") + .HasComment("未知是否有用-废弃核查"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsFinish") + .HasColumnType("bit") + .HasComment("是否完成"); + + b.Property("IsHaveReason") + .HasColumnType("bit") + .HasComment("是否有原因"); + + b.Property("IsHaveSign") + .HasColumnType("bit") + .HasComment("是否有签名"); + + b.Property("IsJoinPlan") + .HasColumnType("bit") + .HasComment("是否加入计划"); + + b.Property("IsShowByTrialConfig") + .HasColumnType("bit") + .HasComment("待废弃核查"); + + b.Property("IsShowParent") + .HasColumnType("int"); + + b.Property("IsSpecialType") + .HasColumnType("bit") + .HasComment("是否为特殊类型"); + + b.Property("ModuleTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("OptTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Sort") + .HasColumnType("int"); + + b.Property("TableConfigJsonStr") + .HasColumnType("nvarchar(max)"); + + b.Property("TrialConfigRelyFieldName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("待废弃核查"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UrlConfigJsonStr") + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ValueCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("FrontAuditConfig", t => + { + t.HasComment("稽查 - 配置表 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HIRHospital", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Country") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("HospitalAliasName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalLogoPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsCanConnectInternet") + .HasColumnType("bit"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Province") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialKeepCount") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("HIRHospital"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Hospital", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("City") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CityCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Country") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CountryCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("HospitalName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalNameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Province") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ProvinceCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SiteId") + .HasColumnType("uniqueidentifier") + .HasComment("中心Id"); + + b.Property("UniversityAffiliated") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UniversityAffiliatedCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SiteId"); + + b.ToTable("Hospital", t => + { + t.HasComment("机构 - 医院"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroup", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Affiliation") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("所属科室"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ContactName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ContactPhone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("HospitalGroup", t => + { + t.HasComment("课题组"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroupIdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("HospitalGroupId") + .HasColumnType("uniqueidentifier"); + + b.Property("IdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsManager") + .HasColumnType("bit"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("HospitalGroupIdentityUser", t => + { + t.HasComment("用户课题组中间关系表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AutoCutNextTask") + .HasColumnType("bit") + .HasComment("这个字段废除,放在用户角色上面,后续删除"); + + b.Property("CheckCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DepartmentName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EMail") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailToken") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsFirstAdd") + .HasColumnType("bit") + .HasComment("首次登录需要修改密码"); + + b.Property("IsTestUser") + .HasColumnType("bit"); + + b.Property("IsZhiZhun") + .HasColumnType("bit") + .HasComment("内部用户 外部用户"); + + b.Property("LastChangePassWordTime") + .HasColumnType("datetime2") + .HasComment("上一次修改密码的时间"); + + b.Property("LastLoginIP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("LastLoginTime") + .HasColumnType("datetime2"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganizationName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PasswordChanged") + .HasColumnType("bit"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PositionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("ThirdUserCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("IdentityUser", t => + { + t.HasComment("后台 - 系统真实账户表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ImageShare", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpireTime") + .HasColumnType("datetime2"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("ImageShare", t => + { + t.HasComment("影像 - 影像分享记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.InspectionFile", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RelativePath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("InspectionFile", t => + { + t.HasComment("一致性核查文件"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Internationalization", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FrontType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InternationalizationType") + .HasColumnType("int"); + + b.Property("Module") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PublishLogId") + .HasColumnType("uniqueidentifier") + .HasComment("关联版本历史记录表Id"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("State") + .HasColumnType("int") + .HasComment("0 1 2 预翻译 已确认 废除"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ValueCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("PublishLogId"); + + b.ToTable("Internationalization", t => + { + t.HasComment("后台 - 国际化配置表 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Menu", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ApiPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("Api 接口地址"); + + b.Property("Component") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("组件路径"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCache") + .HasColumnType("bit"); + + b.Property("IsDisplay") + .HasColumnType("bit"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("启用 禁用"); + + b.Property("IsExternalLink") + .HasColumnType("bit"); + + b.Property("IsInTabDisplay") + .HasColumnType("bit"); + + b.Property("LanguageMark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("MenuIcon") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("MenuName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("MenuType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型(M目录 C菜单 F按钮 L链接)"); + + b.Property("Meta") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("上级菜单"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("路由地址"); + + b.Property("PermissionStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("权限点"); + + b.Property("Redirect") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("Menu", t => + { + t.HasComment("后台 - 系统菜单 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.NoneDicomStudy", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BodyPart") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FileCount") + .HasColumnType("int"); + + b.Property("ImageDate") + .HasColumnType("datetime2"); + + b.Property("Modality") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UploadVideoTime") + .HasColumnType("datetime2"); + + b.Property("VideoName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("VideoObjectName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("VideoUrl") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("NoneDicomStudy", t => + { + t.HasComment("影像 - 非dicom检查"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.NoneDicomStudyFile", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("NoneDicomStudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("OriginNoneDicomStudyId") + .HasColumnType("uniqueidentifier") + .HasComment("为了不影响原始检查,跟任务绑定的 NoneDicomStudyId 为guid空 这个字段记录跟原始检查绑"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("NoneDicomStudyId"); + + b.HasIndex("OriginNoneDicomStudyId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("NoneDicomStudyFile", t => + { + t.HasComment("影像 - 非dicom检查关联文件表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.OrganInfo", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Classification") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类"); + + b.Property("ClassificationEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类 英文"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCanEditPosition") + .HasColumnType("bit") + .HasComment("是否可编辑位置"); + + b.Property("IsLymphNodes") + .HasColumnType("int") + .HasComment("是否是淋巴结"); + + b.Property("OrganType") + .HasColumnType("int") + .HasComment("器官类型"); + + b.Property("Part") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("部位"); + + b.Property("PartEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("部位 英文"); + + b.Property("Remark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("备注"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("序号"); + + b.Property("SystemCriterionId") + .HasColumnType("uniqueidentifier") + .HasComment("标准Id"); + + b.Property("TULAT") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("位置"); + + b.Property("TULATEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("位置 英文"); + + b.Property("TULOC") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("TULOC 器官"); + + b.Property("TULOCEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("TULOC 器官 英文"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("OrganInfo", t => + { + t.HasComment("后台 - 系统标准器官 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.OrganTrialInfo", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Classification") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类"); + + b.Property("ClassificationEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类 英文"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCanEditPosition") + .HasColumnType("bit") + .HasComment("是否可编辑位置"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsLymphNodes") + .HasColumnType("int") + .HasComment("是否是淋巴结"); + + b.Property("OrganInfoId") + .HasColumnType("uniqueidentifier") + .HasComment("器官Id"); + + b.Property("OrganType") + .HasColumnType("int") + .HasComment("器官类型"); + + b.Property("Part") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("部位"); + + b.Property("PartEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("部位 英文"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("序号"); + + b.Property("TULAT") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("位置"); + + b.Property("TULATEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("位置 英文"); + + b.Property("TULOC") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("TULOC 器官"); + + b.Property("TULOCEN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("TULOC 器官 英文"); + + b.Property("TrialCriterionId") + .HasColumnType("uniqueidentifier") + .HasComment("标准Id"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目Id"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("OrganInfoId"); + + b.ToTable("OrganTrialInfo", t => + { + t.HasComment("项目标准 - 器官"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PIAudit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsEnrollment") + .HasColumnType("bit"); + + b.Property("IsPDConfirm") + .HasColumnType("bit"); + + b.Property("NotAgreeReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PIAuditImagePath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PIAuditNote") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PIAuditState") + .HasColumnType("int"); + + b.Property("ReplyContent") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("PIAudit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Payment", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AdjustmentCNY") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("AdjustmentUSD") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CalculateTime") + .HasColumnType("datetime2"); + + b.Property("CalculateUser") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExchangeRate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsLock") + .HasColumnType("bit"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PaymentCNY") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PaymentUSD") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("YearMonth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("YearMonthDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("Payment", t => + { + t.HasComment("医生计费 - 每月支付记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PaymentAdjustment", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AdjustmentCNY") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("AdjustmentUSD") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExchangeRate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("IsLock") + .HasColumnType("bit"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("YearMonth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("YearMonthDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("PaymentAdjustment", t => + { + t.HasComment("医生计费 - 每月支付记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PaymentDetail", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BasePrice") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExchangeRate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("PaymentCNY") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PaymentId") + .HasColumnType("uniqueidentifier"); + + b.Property("PaymentType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PaymentUSD") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("PersonalAdditional") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShowCodeOrder") + .HasColumnType("int"); + + b.Property("ShowTypeOrder") + .HasColumnType("int"); + + b.Property("TrialAdditional") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TrialCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("YearMonth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("PaymentDetail", t => + { + t.HasComment("医生计费 - 每月支付详情表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Postgraduate", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BeginDate") + .HasColumnType("date"); + + b.Property("City") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CityCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Country") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CountryCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndDate") + .HasColumnType("date"); + + b.Property("Hospital") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalId") + .HasColumnType("uniqueidentifier"); + + b.Property("Major") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("MajorCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Province") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ProvinceCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("School") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SchoolCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Training") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrainingCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("Postgraduate", t => + { + t.HasComment("医生 - 继续教育经历"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousHistory", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalDataTrialSetId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsPD") + .HasColumnType("int"); + + b.Property("IsSubjectLevel") + .HasColumnType("bit"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Position") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("PreviousHistory", t => + { + t.HasComment("受试者访视 - 既往放疗史"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousOther", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalDataTrialSetId") + .HasColumnType("uniqueidentifier") + .HasComment("临床数据类型Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsPD") + .HasColumnType("bit"); + + b.Property("IsSubjectLevel") + .HasColumnType("bit"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TreatmentType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("PreviousOther", t => + { + t.HasComment("受试者访视 - 既往其他治疗史"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousPDF", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalLevel") + .HasColumnType("int") + .HasComment("临床级别"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataType") + .HasColumnType("int") + .HasComment("数据类型"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsVisist") + .HasColumnType("bit"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UploadType") + .HasColumnType("int") + .HasComment("上传方式"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("PreviousPDF", t => + { + t.HasComment("受试者访视 - 临床数据配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousSurgery", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalDataTrialSetId") + .HasColumnType("uniqueidentifier") + .HasComment("临床数据类型Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsSubjectLevel") + .HasColumnType("bit"); + + b.Property("OperationName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OperationTime") + .HasColumnType("datetime2"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("PreviousSurgery", t => + { + t.HasComment("受试者访视 - 既往手术史"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PublishLog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCurrentVersion") + .HasColumnType("bit"); + + b.Property("PublishTime") + .HasColumnType("datetime2"); + + b.Property("State") + .HasColumnType("int") + .HasComment("0 开发中 ,已发布"); + + b.Property("UpdateContent") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Version_US") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("PublishLog", t => + { + t.HasComment("后台 - 系统发布日志 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.QCChallenge", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActionContent") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ChallengeCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ChallengeType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CloseResonEnum") + .HasColumnType("int"); + + b.Property("ClosedTime") + .HasColumnType("datetime2"); + + b.Property("ClosedUser") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(1200) + .HasColumnType("nvarchar(1200)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CurrentQCEnum") + .HasColumnType("int"); + + b.Property("DeadlineTime") + .HasColumnType("datetime2"); + + b.Property("IsClosed") + .HasColumnType("bit"); + + b.Property("LatestMsgTime") + .HasColumnType("datetime2"); + + b.Property("LatestReplyUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("QCProcessEnum") + .HasColumnType("int"); + + b.Property("ReUploadUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReUploadedTime") + .HasColumnType("datetime2"); + + b.Property("ReUploader") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReuploadEnum") + .HasColumnType("int"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserTypeEnum") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("LatestReplyUserId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("QCChallenge", t => + { + t.HasComment("受试者访视 - QC质疑"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.QCChallengeDialog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("QCChallengeId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TalkContent") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("UserTypeEnum") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("QCChallengeId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("QCChallengeDialog", t => + { + t.HasComment("受试者访视 - QC质疑对话"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.QCQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsRequired") + .HasColumnType("bit"); + + b.Property("LanguageType") + .HasColumnType("int") + .HasComment("语言类型"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("下拉框、文本、单选、多选"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ParentId"); + + b.ToTable("QCQuestion", t => + { + t.HasComment("后台 - QC质控问题(需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.RankPrice", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Adjudication") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AdjudicationIn24H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AdjudicationIn48H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Downtime") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Global") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RankName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RefresherTraining") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("Timepoint") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TimepointIn24H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TimepointIn48H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Training") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("RankPrice", t => + { + t.HasComment("医生计费 - 不同时间点价格设置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadModule", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IsCRCApplicationRevoke") + .HasColumnType("bit") + .HasComment("CRC是否正在申请撤回"); + + b.Property("IsCRCConfirm") + .HasColumnType("bit"); + + b.Property("IsClinicalDataBlind") + .HasColumnType("bit") + .HasComment("临床数据是否盲化"); + + b.Property("IsClinicalDataComplete") + .HasColumnType("bit") + .HasComment("临床数据是否完整"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsNotNeedPMConfirm") + .HasColumnType("bit"); + + b.Property("IsPMConfirm") + .HasColumnType("bit"); + + b.Property("IsUrgent") + .HasColumnType("bit") + .HasComment("是否加急"); + + b.Property("ModuleName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("模块名称"); + + b.Property("ModuleType") + .HasColumnType("int") + .HasComment("模块类型"); + + b.Property("ReadingPeriodSetId") + .HasColumnType("uniqueidentifier") + .HasComment("阅片计划ID"); + + b.Property("ReadingSetType") + .HasColumnType("int") + .HasComment("阅片配置的类型"); + + b.Property("ReadingStatus") + .HasColumnType("int"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingPeriodSetId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("ReadModule", t => + { + t.HasComment("读片模块"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadModuleCriterionFrom", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalFormId") + .HasColumnType("uniqueidentifier") + .HasComment("表单Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReadModuleId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ClinicalFormId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadModuleId"); + + b.ToTable("ReadModuleCriterionFrom", t => + { + t.HasComment("受试者 - 阅片模块临床表单"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingClinicalData", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalDataTrialSetId") + .HasColumnType("uniqueidentifier") + .HasComment("临床数据类型Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileCount") + .HasColumnType("int"); + + b.Property("IsBlind") + .HasColumnType("bit") + .HasComment("是否盲化"); + + b.Property("IsComplete") + .HasColumnType("bit") + .HasComment("是否完整"); + + b.Property("IsSign") + .HasColumnType("bit") + .HasComment("是否签名"); + + b.Property("IsVisit") + .HasColumnType("bit") + .HasComment("是否为访视"); + + b.Property("ReadingClinicalDataState") + .HasColumnType("int") + .HasComment("临床数据状态"); + + b.Property("ReadingId") + .HasColumnType("uniqueidentifier") + .HasComment("访视Id 或者模块Id"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ClinicalDataTrialSetId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingId"); + + b.HasIndex("StudyId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("TrialId"); + + b.ToTable("ReadingClinicalData", t => + { + t.HasComment("项目的临床数据"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingClinicalDataPDF", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ReadingClinicalDataId") + .HasColumnType("uniqueidentifier") + .HasComment("阅片临床数据ID"); + + b.Property("Size") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingClinicalDataId"); + + b.ToTable("ReadingClinicalDataPDF", t => + { + t.HasComment("项目的临床数据"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingConsistentClinicalData", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalDataTrialSetId") + .HasColumnType("uniqueidentifier") + .HasComment("临床数据类型Id"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileCount") + .HasColumnType("int"); + + b.Property("IsBlind") + .HasColumnType("bit") + .HasComment("是否盲化"); + + b.Property("IsComplete") + .HasColumnType("bit") + .HasComment("是否完整"); + + b.Property("IsSign") + .HasColumnType("bit") + .HasComment("是否签名"); + + b.Property("IsVisit") + .HasColumnType("bit") + .HasComment("是否为访视"); + + b.Property("ReadingClinicalDataState") + .HasColumnType("int") + .HasComment("临床数据状态"); + + b.Property("ReadingId") + .HasColumnType("uniqueidentifier") + .HasComment("访视Id 或者模块Id"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier") + .HasComment("受试者ID"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目ID"); + + b.HasKey("Id"); + + b.HasIndex("ClinicalDataTrialSetId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingId"); + + b.HasIndex("StudyId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("TrialId"); + + b.ToTable("ReadingConsistentClinicalData", t => + { + t.HasComment("一致性分析临床数据"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingConsistentClinicalDataPDF", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ReadingConsistentClinicalDataId") + .HasColumnType("uniqueidentifier") + .HasComment("阅片临床数据ID"); + + b.Property("Size") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件类型"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingConsistentClinicalDataId"); + + b.ToTable("ReadingConsistentClinicalDataPDF", t => + { + t.HasComment("一致性分析临床数据"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingCriterionPage", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("是否启用"); + + b.Property("IsPublicPage") + .HasColumnType("bit") + .HasComment("是否公共分页"); + + b.Property("PageName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分页名称"); + + b.Property("ReadingQuestionCriterionTrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目ID"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ReadingCriterionPage", t => + { + t.HasComment("阅片标准分页"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingCustomTag", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("InstanceId") + .HasColumnType("uniqueidentifier"); + + b.Property("MeasureData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfFrames") + .HasColumnType("int"); + + b.Property("SeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ReadingCustomTag", t => + { + t.HasComment("项目阅片 - 自定义标记"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("问题答案"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("GlobalAnswerType") + .HasColumnType("int") + .HasComment("全局答案类型"); + + b.Property("GlobalTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("全局任务Id"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("问题ID"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TaskId") + .HasColumnType("uniqueidentifier") + .HasComment("原任务ID"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("GlobalTaskId"); + + b.HasIndex("QuestionId"); + + b.HasIndex("TaskId"); + + b.ToTable("ReadingGlobalTaskInfo", t => + { + t.HasComment("阅片全局任务信息"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingJudgeInfo", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("JudgeTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("裁判任务ID"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TaskIdOne") + .HasColumnType("uniqueidentifier") + .HasComment("第一个任务ID"); + + b.Property("TaskIdTwo") + .HasColumnType("uniqueidentifier") + .HasComment("第二个任务ID"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ReadingJudgeInfo", t => + { + t.HasComment("阅片裁判信息"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicalReviewDialog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AuditAdviceEnum") + .HasColumnType("int") + .HasComment("审核建议"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("对话内容"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DisagreeReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("不同意重阅原因"); + + b.Property("DoctorUserIdeaEnum") + .HasColumnType("int") + .HasComment("阅片人是否认同"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件名称"); + + b.Property("ImagePath") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasComment("图片路径"); + + b.Property("IsApplyHeavyReading") + .HasColumnType("bit") + .HasComment("是否申请重阅"); + + b.Property("IsHaveQuestion") + .HasColumnType("bit") + .HasComment("是否有问题"); + + b.Property("MedicalDialogCloseEnum") + .HasColumnType("int") + .HasComment("医学审核对话关闭原因"); + + b.Property("Questioning") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("质询问题"); + + b.Property("TaskMedicalReviewId") + .HasColumnType("uniqueidentifier") + .HasComment("医学审核Id"); + + b.Property("UserTypeEnumInt") + .HasColumnType("int") + .HasComment("用户角色枚举"); + + b.Property("UserTypeShortName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("用户角色"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("任务Id"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TaskMedicalReviewId"); + + b.ToTable("ReadingMedicalReviewDialog", t => + { + t.HasComment("阅片医学审核对话"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicineQuestionAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReadingMedicineQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("医学审核问题Id"); + + b.Property("TaskMedicalReviewId") + .HasColumnType("uniqueidentifier") + .HasComment("医学审核Id"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TaskMedicalReviewId"); + + b.ToTable("ReadingMedicineQuestionAnswer", t => + { + t.HasComment("阅片医学问题答案"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicineSystemQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionTypeEnum") + .HasColumnType("int"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("是否启用"); + + b.Property("IsGeneral") + .HasColumnType("bit"); + + b.Property("IsRequired") + .HasColumnType("bit") + .HasComment("是否是必须"); + + b.Property("LanguageType") + .HasColumnType("int") + .HasComment("语言类型"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("父问题ID"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("父问题触发"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("ReadingCategory") + .HasColumnType("int") + .HasComment("任务类型"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型值"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ParentId"); + + b.ToTable("ReadingMedicineSystemQuestion", t => + { + t.HasComment("阅片医学审核系统问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicineTrialQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsConfirm") + .HasColumnType("bit") + .HasComment("是否确认"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("是否启用"); + + b.Property("IsRequired") + .HasColumnType("bit") + .HasComment("是否必须"); + + b.Property("LanguageType") + .HasColumnType("int") + .HasComment("语言类型"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("父问题"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("父问题触发值"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("ReadingCategory") + .HasColumnType("int") + .HasComment("任务类型"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("SystemQuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目ID"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier") + .HasComment("项目标准"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型值"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ParentId"); + + b.ToTable("ReadingMedicineTrialQuestion", t => + { + t.HasComment("阅片医学审核项目问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EvaluationReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("原因"); + + b.Property("EvaluationResult") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("结果"); + + b.Property("OncologyTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("肿瘤学 阅片任务ID"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier") + .HasComment("受试者Id"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目Id"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("产生肿瘤学阅片任务的 访视类型的阅片任务Id"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("OncologyTaskId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("ReadingOncologyTaskInfo", t => + { + t.HasComment("阅片肿瘤学 针对访视任务 添加了一个结果"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingPeriodPlan", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ReadingPeriodSetId") + .HasColumnType("uniqueidentifier") + .HasComment("阅片期配置ID"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier") + .HasComment("访视"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingPeriodSetId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("ReadingPeriodPlan", t => + { + t.HasComment("阅片计划"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingPeriodSet", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("EffectOfTime") + .HasColumnType("datetime2") + .HasComment("生效时间"); + + b.Property("ExpirationDate") + .HasColumnType("datetime2") + .HasComment("截止日期"); + + b.Property("ExpirationVisitNum") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasComment("截止访视"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsGlobal") + .HasColumnType("bit") + .HasComment("是否为全局阅片"); + + b.Property("IsTakeEffect") + .HasColumnType("int") + .HasComment("是否生效"); + + b.Property("ReadingPeriodName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("阅片期名称"); + + b.Property("ReadingScope") + .HasColumnType("int") + .HasComment("阅片范围"); + + b.Property("ReadingSetType") + .HasColumnType("int") + .HasComment("阅片配置的类型"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitStageId") + .HasColumnType("uniqueidentifier") + .HasComment("访视计划ID"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("VisitStageId"); + + b.ToTable("ReadingPeriodSet", t => + { + t.HasComment("阅片期设置 只会设计到所有人 或者某个Site 针对全局"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingPeriodSite", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReadingPeriodSetId") + .HasColumnType("uniqueidentifier") + .HasComment("阅片期配置ID"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingPeriodSetId"); + + b.HasIndex("TrialSiteId"); + + b.ToTable("ReadingPeriodSite", t => + { + t.HasComment("阅片期和中心关联"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConfirmTime") + .HasColumnType("datetime2") + .HasComment("确认时间"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("标准"); + + b.Property("CriterionType") + .HasColumnType("int") + .HasComment("标准类型"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("描述"); + + b.Property("IsCompleteConfig") + .HasColumnType("bit") + .HasComment("是否完成配置"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("是否启用"); + + b.Property("IsMustGlobalReading") + .HasColumnType("bit") + .HasComment("是否必须全局阅片"); + + b.Property("IsOncologyReading") + .HasColumnType("bit") + .HasComment("肿瘤学阅片"); + + b.Property("IseCRFShowInDicomReading") + .HasColumnType("bit") + .HasComment("eCRF报告是否显示在图像页面"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ReadingQuestionCriterionSystem", t => + { + t.HasComment("系统阅片标准"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ArbitrationRule") + .HasColumnType("int") + .HasComment("仲裁对象"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionModalitys") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CriterionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("标准"); + + b.Property("CriterionType") + .HasColumnType("int") + .HasComment("标准类型"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("描述"); + + b.Property("DigitPlaces") + .HasColumnType("int") + .HasComment("修约小数点"); + + b.Property("EvaluationReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("评估原因"); + + b.Property("EvaluationResult") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("评估结果"); + + b.Property("FollowGlobalVisitAutoAssignDefaultState") + .HasColumnType("int") + .HasComment("后续全局自动分配默认状态"); + + b.Property("FollowJudgeTaskAutoAssignDefaultState") + .HasColumnType("int"); + + b.Property("FollowVisitAutoAssignDefaultState") + .HasColumnType("int") + .HasComment("后续访视自动分配默认状态"); + + b.Property("FormType") + .HasColumnType("int") + .HasComment("表单类型"); + + b.Property("GlobalUpdateType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("全局阅片评估更新类型"); + + b.Property("ImageDownloadEnum") + .HasColumnType("int") + .HasComment("阅片过程下载影像"); + + b.Property("ImagePlatform") + .HasColumnType("int") + .HasComment("阅片平台"); + + b.Property("ImageUploadEnum") + .HasColumnType("int") + .HasComment("阅片过程上传影像"); + + b.Property("IsAdditionalAssessment") + .HasColumnType("bit") + .HasComment("是否附加评估"); + + b.Property("IsArbitrationReading") + .HasColumnType("bit") + .HasComment("仲裁阅片"); + + b.Property("IsAutoCreate") + .HasColumnType("bit") + .HasComment("自动 手动生成任务"); + + b.Property("IsCompleteConfig") + .HasColumnType("bit") + .HasComment("是否完成配置"); + + b.Property("IsConfirm") + .HasColumnType("bit") + .HasComment("是否确认"); + + b.Property("IsConfirmMedicineQuestion") + .HasColumnType("bit") + .HasComment("是确认医学审核问题"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("是否启用"); + + b.Property("IsFollowGlobalVisitAutoAssign") + .HasColumnType("bit") + .HasComment("后续全局自动分配"); + + b.Property("IsFollowJudgeTaskAutoAssign") + .HasColumnType("bit"); + + b.Property("IsFollowVisitAutoAssign") + .HasColumnType("bit") + .HasComment("后续访视任务自动分配"); + + b.Property("IsGlobalReading") + .HasColumnType("bit") + .HasComment("是否生成全局阅片任务"); + + b.Property("IsImageFilter") + .HasColumnType("bit") + .HasComment("是否影像筛选"); + + b.Property("IsMustGlobalReading") + .HasColumnType("bit") + .HasComment("是否必须全局阅片"); + + b.Property("IsOncologyReading") + .HasColumnType("bit") + .HasComment("肿瘤学阅片 原字段 IsClinicalReading"); + + b.Property("IsReadingPeriod") + .HasColumnType("bit") + .HasComment("存在阅片期"); + + b.Property("IsReadingShowPreviousResults") + .HasColumnType("bit") + .HasComment("IR阅片页面是否可以查看既往任务结果"); + + b.Property("IsReadingShowSubjectInfo") + .HasColumnType("bit") + .HasComment("阅片是否显示受试者信息"); + + b.Property("IsReadingTaskViewInOrder") + .HasColumnType("int") + .HasComment("任务展示访视 读片任务显示是否顺序"); + + b.Property("IsShowDetail") + .HasColumnType("bit") + .HasComment("是否显示详情"); + + b.Property("IsSigned") + .HasColumnType("bit") + .HasComment("是否签名"); + + b.Property("IsSystemSetOncology") + .HasColumnType("bit") + .HasComment("是否系统设置了 肿瘤学"); + + b.Property("IsUrgent") + .HasColumnType("bit") + .HasComment("是否加急"); + + b.Property("IseCRFShowInDicomReading") + .HasColumnType("bit") + .HasComment("eCRF报告是否显示在图像页面"); + + b.Property("PIReadingScopenEnum") + .HasColumnType("int"); + + b.Property("ReadingDivisionEnum") + .HasColumnType("int"); + + b.Property("ReadingInfoSignTime") + .HasColumnType("datetime2") + .HasComment("阅片信息签名时间"); + + b.Property("ReadingQuestionCriterionSystemId") + .HasColumnType("uniqueidentifier") + .HasComment("系统标准ID"); + + b.Property("ReadingTaskViewEnum") + .HasColumnType("int") + .HasComment("任务组织级别"); + + b.Property("ReadingTool") + .HasColumnType("int") + .HasComment("阅片工具"); + + b.Property("ReadingType") + .HasColumnType("int") + .HasComment("阅片模式"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("SynchronizeOriginalTime") + .HasColumnType("datetime2") + .HasComment("同步器官时间"); + + b.Property("SynchronizeTime") + .HasColumnType("datetime2") + .HasComment("同步时间"); + + b.Property("TaskAllocateObjEnum") + .HasColumnType("int") + .HasComment("任务分配对象"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目Id"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("ReadingQuestionCriterionTrial", t => + { + t.HasComment("项目阅片标准"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionSystem", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClassifyAlgorithms") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类算法"); + + b.Property("ClassifyEditType") + .HasColumnType("int"); + + b.Property("ClassifyQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("分类问题Id"); + + b.Property("ClassifyShowType") + .HasColumnType("int"); + + b.Property("ClassifyType") + .HasColumnType("int") + .HasComment("分类类型"); + + b.Property("ConvertShowType") + .HasColumnType("int") + .HasComment("转化显示类型"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataSource") + .HasColumnType("int") + .HasComment("数据来源"); + + b.Property("DefaultValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("默认值"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典code"); + + b.Property("ExportIdentification") + .HasColumnType("int") + .HasComment("导出标识"); + + b.Property("ExportResultStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("导出结果"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件类型"); + + b.Property("GlobalReadingShowType") + .HasColumnType("int") + .HasComment("全局阅片显示类型"); + + b.Property("GroupClassify") + .HasColumnType("int") + .HasComment("分组分类"); + + b.Property("GroupEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文分组"); + + b.Property("GroupId") + .HasColumnType("uniqueidentifier") + .HasComment("分组ID"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分组"); + + b.Property("HighlightAnswer") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("高亮问题的答案"); + + b.Property("ImageCount") + .HasColumnType("int") + .HasComment("图片数量"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("是否启用"); + + b.Property("IsJudgeQuestion") + .HasColumnType("bit") + .HasComment("是否是裁判问题"); + + b.Property("IsRequired") + .HasColumnType("int") + .HasComment("是否是必须"); + + b.Property("IsShowInDicom") + .HasColumnType("bit") + .HasComment("是否显示在Dicom阅片中"); + + b.Property("LesionType") + .HasColumnType("int") + .HasComment("病灶类型"); + + b.Property("LimitEdit") + .HasColumnType("int") + .HasComment("限制编辑"); + + b.Property("LimitShow") + .HasColumnType("int") + .HasComment("限制显示"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大答案长度"); + + b.Property("MaxQuestionCount") + .HasColumnType("int") + .HasComment("最大问题数"); + + b.Property("OrderMark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("序号标记"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("父问题ID"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("父问题触发"); + + b.Property("QuestionClassify") + .HasColumnType("int") + .HasComment("问题分类"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionGenre") + .HasColumnType("int") + .HasComment("问题类型"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("QuestionType") + .HasColumnType("int") + .HasComment("问题类型"); + + b.Property("ReadingQuestionCriterionSystemId") + .HasColumnType("uniqueidentifier") + .HasComment("系统标准Id"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier") + .HasComment("关联ID"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("关联Value"); + + b.Property("Remark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("备注"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("ShowQuestion") + .HasColumnType("int") + .HasComment("是否显示"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型值"); + + b.Property("Unit") + .HasColumnType("int") + .HasComment("单位"); + + b.Property("ValueType") + .HasColumnType("int") + .HasComment("数值类型"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("GroupId"); + + b.HasIndex("ParentId"); + + b.HasIndex("ReadingQuestionCriterionSystemId"); + + b.HasIndex("RelevanceId"); + + b.ToTable("ReadingQuestionSystem", t => + { + t.HasComment("系统阅片问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AnswerCombination") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("答案组合"); + + b.Property("AnswerGroup") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("答案分组"); + + b.Property("CalculateQuestions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasComment("自定义计算标记"); + + b.Property("ClassifyAlgorithms") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类算法"); + + b.Property("ClassifyEditType") + .HasColumnType("int"); + + b.Property("ClassifyQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("分类问题Id"); + + b.Property("ClassifyShowType") + .HasColumnType("int"); + + b.Property("ClassifyType") + .HasColumnType("int") + .HasComment("分类类型"); + + b.Property("ConvertShowType") + .HasColumnType("int") + .HasComment("转化显示类型"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomCalculateMark") + .HasColumnType("int") + .HasComment("自定义计算标记"); + + b.Property("CustomUnit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("自定义单位"); + + b.Property("DataSource") + .HasColumnType("int") + .HasComment("数据来源"); + + b.Property("DefaultValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("默认值"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典code"); + + b.Property("ExportIdentification") + .HasColumnType("int") + .HasComment("导出标识"); + + b.Property("ExportResultStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("导出结果"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件类型"); + + b.Property("GlobalReadingShowType") + .HasColumnType("int") + .HasComment("全局阅片显示类型"); + + b.Property("GroupClassify") + .HasColumnType("int") + .HasComment("分组分类"); + + b.Property("GroupEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文分组"); + + b.Property("GroupId") + .HasColumnType("uniqueidentifier") + .HasComment("分组ID"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分组"); + + b.Property("HighlightAnswer") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("高亮问题的答案"); + + b.Property("ImageCount") + .HasColumnType("int") + .HasComment("图片数量"); + + b.Property("IsAdditional") + .HasColumnType("bit"); + + b.Property("IsCopyLesions") + .HasColumnType("bit") + .HasComment("是否复制病灶"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsJudgeQuestion") + .HasColumnType("bit") + .HasComment("是否是裁判问题"); + + b.Property("IsRequired") + .HasColumnType("int") + .HasComment("是否是必须"); + + b.Property("IsShowInDicom") + .HasColumnType("bit") + .HasComment("是否显示在Dicom阅片中"); + + b.Property("JudgeDifferenceType") + .HasColumnType("int") + .HasComment("裁判百分比或绝对值的相差值匹配规则"); + + b.Property("JudgeDifferenceValue") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasComment("裁判百分比或绝对值的相差值"); + + b.Property("JudgeType") + .HasColumnType("int") + .HasComment("裁判类型"); + + b.Property("LesionType") + .HasColumnType("int") + .HasComment("病灶类型"); + + b.Property("LimitEdit") + .HasColumnType("int") + .HasComment("限制编辑"); + + b.Property("LimitShow") + .HasColumnType("int") + .HasComment("限制显示"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大答案长度"); + + b.Property("MaxQuestionCount") + .HasColumnType("int") + .HasComment("最大问题数"); + + b.Property("OrderMark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("序号标记"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("父问题ID"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("父问题触发"); + + b.Property("QuestionClassify") + .HasColumnType("int") + .HasComment("问题分类"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionGenre") + .HasColumnType("int") + .HasComment("问题类型"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("QuestionType") + .HasColumnType("int") + .HasComment("问题类型"); + + b.Property("ReadingCriterionPageId") + .HasColumnType("uniqueidentifier") + .HasComment("标准分页Id"); + + b.Property("ReadingQuestionCriterionTrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目标准Id"); + + b.Property("ReadingQuestionSystemId") + .HasColumnType("uniqueidentifier") + .HasComment("系统问题ID"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier") + .HasComment("关联ID"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("关联Value"); + + b.Property("Remark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("备注"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("ShowQuestion") + .HasColumnType("int") + .HasComment("是否显示"); + + b.Property("SystemParentId") + .HasColumnType("uniqueidentifier") + .HasComment("系统标准的ParentId"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目Id"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("类型值"); + + b.Property("Unit") + .HasColumnType("int") + .HasComment("单位"); + + b.Property("ValueType") + .HasColumnType("int") + .HasComment("数值类型"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("GroupId"); + + b.HasIndex("ParentId"); + + b.HasIndex("ReadingCriterionPageId"); + + b.HasIndex("ReadingQuestionCriterionTrialId"); + + b.HasIndex("RelevanceId"); + + b.ToTable("ReadingQuestionTrial", t => + { + t.HasComment("项目阅片问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("CrterionDictionaryGroup") + .HasColumnType("int") + .HasComment("标准字典分组"); + + b.Property("DictionaryId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsBaseLineUse") + .HasColumnType("bit"); + + b.Property("IsFollowVisitUse") + .HasColumnType("bit"); + + b.Property("IsSystemCriterion") + .HasColumnType("bit"); + + b.Property("ParentCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DictionaryId"); + + b.ToTable("ReadingSystemCriterionDictionary", t => + { + t.HasComment("系统标准 - 全局配置 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BlindName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CTSeriesId") + .HasColumnType("uniqueidentifier") + .HasComment("融合的CTSeriesId"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("FristAddTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("首次添加任务ID"); + + b.Property("FristAddTaskNum") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasComment("第一次添加的任务ID"); + + b.Property("FromMark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("来自于哪个标记"); + + b.Property("InstanceId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCanEditPosition") + .HasColumnType("bit"); + + b.Property("IsCurrentTaskAdd") + .HasColumnType("bit") + .HasComment("是否是当前任务添加"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDicomReading") + .HasColumnType("bit") + .HasComment("是Dicom阅片"); + + b.Property("MarkTool") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("标记工具"); + + b.Property("MeasureData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MergeRowId") + .HasColumnType("uniqueidentifier"); + + b.Property("NumberOfFrames") + .HasColumnType("int"); + + b.Property("OrderMark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganInfoId") + .HasColumnType("uniqueidentifier") + .HasComment("器官Id"); + + b.Property("OtherInstanceId") + .HasColumnType("uniqueidentifier"); + + b.Property("OtherMarkTool") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OtherMeasureData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OtherNumberOfFrames") + .HasColumnType("int"); + + b.Property("OtherPicturePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("OtherSeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("OtherStudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("PTSeriesId") + .HasColumnType("uniqueidentifier") + .HasComment("融合的PTSeriesId"); + + b.Property("PicturePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("截图地址"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReportMark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("报告页面显示来自于哪个标记"); + + b.Property("RowIndex") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RowMark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("病灶编号"); + + b.Property("SeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("SplitOrMergeType") + .HasColumnType("int"); + + b.Property("SplitRowId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.Property("WL") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasComment("窗位WL"); + + b.Property("WW") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasComment("窗宽WW"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("InstanceId"); + + b.HasIndex("MergeRowId"); + + b.HasIndex("OrganInfoId"); + + b.HasIndex("QuestionId"); + + b.HasIndex("SplitRowId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("ReadingTableAnswerRowInfo", t => + { + t.HasComment("表格问题答案行数据"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("RowId") + .HasColumnType("uniqueidentifier"); + + b.Property("RowIndex") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TableQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("表格问题Id"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("QuestionId"); + + b.HasIndex("RowId"); + + b.HasIndex("TableQuestionId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("ReadingTableQuestionAnswer", t => + { + t.HasComment("项目阅片 - 表格问题行记录子项答案"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClassifyAlgorithms") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类算法"); + + b.Property("ClassifyEditType") + .HasColumnType("int"); + + b.Property("ClassifyShowType") + .HasColumnType("int"); + + b.Property("ClassifyTableQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("分类问题表格Id"); + + b.Property("ClassifyType") + .HasColumnType("int") + .HasComment("分类类型"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataSource") + .HasColumnType("int") + .HasComment("数据来源"); + + b.Property("DataTableColumn") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("数据列"); + + b.Property("DataTableName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("数据表名称"); + + b.Property("DependParentId") + .HasColumnType("uniqueidentifier") + .HasComment("关联父问题"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典code"); + + b.Property("ExportIdentification") + .HasColumnType("int") + .HasComment("导出标识"); + + b.Property("ExportResultStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("导出结果"); + + b.Property("FileType") + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件类型"); + + b.Property("ImageCount") + .HasColumnType("int") + .HasComment("图片数量"); + + b.Property("IsCopy") + .HasColumnType("bit") + .HasComment("复制病灶的时候 是否复制这个问题"); + + b.Property("IsDepend") + .HasColumnType("int") + .HasComment("是否关联"); + + b.Property("IsEnable") + .HasColumnType("bit") + .HasComment("是否启用"); + + b.Property("IsRequired") + .HasColumnType("int"); + + b.Property("LimitEdit") + .HasColumnType("int") + .HasComment("限制编辑"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大答案长度"); + + b.Property("MaxRowCount") + .HasColumnType("int") + .HasComment("最大问题数"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("父问题触发值"); + + b.Property("QuestionClassify") + .HasColumnType("int") + .HasComment("问题分类"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionMark") + .HasColumnType("int") + .HasComment("问题标识"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("ReadingQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("系统表的问题Id ReadingQuestionSystem的Id"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier") + .HasComment("显示父问题"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("显示父问题的值"); + + b.Property("Remark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("备注"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序号"); + + b.Property("ShowQuestion") + .HasColumnType("int") + .HasComment("是否显示"); + + b.Property("SystemCriterionId") + .HasColumnType("uniqueidentifier") + .HasComment("系统标准Id"); + + b.Property("TableQuestionType") + .HasColumnType("int") + .HasComment("表格问题类型"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("值"); + + b.Property("Unit") + .HasColumnType("int") + .HasComment("单位"); + + b.Property("ValueType") + .HasColumnType("int") + .HasComment("数值类型"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DependParentId"); + + b.HasIndex("ReadingQuestionId"); + + b.ToTable("ReadingTableQuestionSystem", t => + { + t.HasComment("系统表格问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CalculateQuestions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasComment("自定义计算标记"); + + b.Property("ClassifyAlgorithms") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("分类算法"); + + b.Property("ClassifyEditType") + .HasColumnType("int"); + + b.Property("ClassifyShowType") + .HasColumnType("int"); + + b.Property("ClassifyTableQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("分类问题表格Id"); + + b.Property("ClassifyType") + .HasColumnType("int") + .HasComment("分类类型"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomCalculateMark") + .HasColumnType("int") + .HasComment("自定义计算标记"); + + b.Property("CustomUnit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("自定义单位"); + + b.Property("DataSource") + .HasColumnType("int") + .HasComment("数据来源"); + + b.Property("DataTableColumn") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DataTableName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DependParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典code"); + + b.Property("ExportIdentification") + .HasColumnType("int") + .HasComment("导出标识"); + + b.Property("ExportResultStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("导出结果"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件类型"); + + b.Property("ImageCount") + .HasColumnType("int") + .HasComment("图片数量"); + + b.Property("IsCopy") + .HasColumnType("bit") + .HasComment("复制病灶的时候 是否复制这个问题"); + + b.Property("IsDepend") + .HasColumnType("int"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsRequired") + .HasColumnType("int"); + + b.Property("LimitEdit") + .HasColumnType("int") + .HasComment("限制编辑"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大答案长度"); + + b.Property("MaxRowCount") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("QuestionClassify") + .HasColumnType("int") + .HasComment("问题分类"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionMark") + .HasColumnType("int") + .HasComment("问题标识"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReadingQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("项目问题的Id ReadingQuestionTrial的id"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Remark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("注释"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("ShowQuestion") + .HasColumnType("int"); + + b.Property("SystemTableQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("系统表格问题Id"); + + b.Property("TableQuestionType") + .HasColumnType("int"); + + b.Property("TrialCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Unit") + .HasColumnType("int") + .HasComment("单位"); + + b.Property("ValueType") + .HasColumnType("int") + .HasComment("数值类型"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DependParentId"); + + b.HasIndex("ReadingQuestionId"); + + b.ToTable("ReadingTableQuestionTrial", t => + { + t.HasComment("项目阅片问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("答案"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("GlobalChangeAnswer") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("全局阅片修改的答案"); + + b.Property("IsGlobalChange") + .HasColumnType("bit") + .HasComment("全局阅片是否修改"); + + b.Property("ReadingQuestionCriterionTrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目问题标准Id"); + + b.Property("ReadingQuestionTrialId") + .HasColumnType("uniqueidentifier") + .HasComment("项目问题Id"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ReadingQuestionTrialId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("ReadingTaskQuestionAnswer", t => + { + t.HasComment("阅片任务答案"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FirstAddTaskId") + .HasColumnType("uniqueidentifier"); + + b.Property("InstanceId") + .HasColumnType("uniqueidentifier"); + + b.Property("MarkTool") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MeasureData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfFrames") + .HasColumnType("int"); + + b.Property("OrderMarkName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OtherInstanceId") + .HasColumnType("uniqueidentifier"); + + b.Property("OtherMarkTool") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OtherMeasureData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OtherNumberOfFrames") + .HasColumnType("int"); + + b.Property("OtherPicturePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("OtherSeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("OtherStudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("PicturePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuestionType") + .HasColumnType("int"); + + b.Property("SeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("QuestionId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("ReadingTaskQuestionMark", t => + { + t.HasComment("项目阅片 - 任务问题标记"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTaskRelation", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RelevanceTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("关联的任务ID"); + + b.Property("RelevanceType") + .HasColumnType("int") + .HasComment("类型具体解释 看枚举"); + + b.Property("TaskId") + .HasColumnType("uniqueidentifier") + .HasComment("任务ID"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TaskId"); + + b.ToTable("ReadingTaskRelation", t => + { + t.HasComment("任务关系表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("CrterionDictionaryGroup") + .HasColumnType("int"); + + b.Property("DictionaryId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsBaseLineUse") + .HasColumnType("bit"); + + b.Property("IsFollowVisitUse") + .HasColumnType("bit"); + + b.Property("ParentCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("CriterionId"); + + b.HasIndex("DictionaryId"); + + b.ToTable("ReadingTrialCriterionDictionary", t => + { + t.HasComment("项目阅片标准 - 全局配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ResearchPublication", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AwardsHonors") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("AwardsHonorsCN") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Grants") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GrantsCN") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Publications") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PublicationsCN") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Research") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ResearchCN") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ResearchPublication", t => + { + t.HasComment("医生 - 科研学术记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReviewerPayInformation", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Additional") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("BankCardNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BankName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorNameInBank") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IDCard") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RankId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("DoctorPayInformation", t => + { + t.HasComment("医生计费 - 支付信息表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPImageUpload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CalledAE") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CallingAE") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CallingAEIP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("FileCount") + .HasColumnType("int"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("StudyCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("SCPImageUpload", t => + { + t.HasComment("项目中心 - 影像推送记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPInstance", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Anonymize") + .HasColumnType("bit"); + + b.Property("CPIStatus") + .HasColumnType("bit"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("FrameOfReferenceUID") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ImageColumns") + .HasColumnType("int"); + + b.Property("ImageRows") + .HasColumnType("int"); + + b.Property("ImagerPixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InstanceNumber") + .HasColumnType("int"); + + b.Property("InstanceTime") + .HasColumnType("datetime2"); + + b.Property("NumberOfFrames") + .HasColumnType("int"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("PixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("SeriesInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SliceLocation") + .HasColumnType("int"); + + b.Property("SliceThickness") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SopInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WindowCenter") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("WindowWidth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SeriesId"); + + b.HasIndex("StudyId"); + + b.ToTable("SCPInstance", t => + { + t.HasComment("项目中心 - 推送Instance"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPPatient", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EarliestStudyTime") + .HasColumnType("datetime2"); + + b.Property("LatestPushTime") + .HasColumnType("datetime2"); + + b.Property("LatestStudyTime") + .HasColumnType("datetime2"); + + b.Property("PatientAge") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientBirthDate") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientIdStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientSex") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("SCPPatient", t => + { + t.HasComment("项目中心 - 推送检查患者"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPSeries", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AcquisitionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartExamined") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ImageOrientationPatient") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImagePositionPatient") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImageResizePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ImagerPixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InstanceCount") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Modality") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ProtocolName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SequenceName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesNumber") + .HasColumnType("int"); + + b.Property("SeriesTime") + .HasColumnType("datetime2"); + + b.Property("SliceThickness") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TriggerTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("StudyId"); + + b.ToTable("SCPSeries", t => + { + t.HasComment("项目中心 - 推送序列"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPStudy", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartExamined") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CalledAE") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CallingAE") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InstanceCount") + .HasColumnType("int"); + + b.Property("InstitutionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsUploadFinished") + .HasColumnType("bit"); + + b.Property("Modalities") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ModalityForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientAge") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientBirthDate") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientId") + .HasColumnType("uniqueidentifier"); + + b.Property("PatientIdStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientSex") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesCount") + .HasColumnType("int"); + + b.Property("StudyId") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyTime") + .HasColumnType("datetime2"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("TriggerTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("PatientId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialSiteId"); + + b.ToTable("SCPStudy", t => + { + t.HasComment("项目中心 - 推送检查"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPStudySubjectVisit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SCPStudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SCPStudyId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("SCPStudySubjectVisit", t => + { + t.HasComment("访视检查关联表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ShortcutKey", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AltKey") + .HasColumnType("bit"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CtrlKey") + .HasColumnType("bit"); + + b.Property("ImageToolType") + .HasColumnType("int") + .HasComment("影像工具类型"); + + b.Property("Keyboardkey") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("对应的键盘按键"); + + b.Property("MetaKey") + .HasColumnType("bit"); + + b.Property("ShiftKey") + .HasColumnType("bit"); + + b.Property("ShortcutKeyEnum") + .HasColumnType("int") + .HasComment("按键枚举"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("ShortcutKey", t => + { + t.HasComment("用户配置 - 快捷键"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Site", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AliasName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("ContactName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ContactPhone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Country") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DirectorName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DirectorPhone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HospitalId") + .HasColumnType("uniqueidentifier"); + + b.Property("Province") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SiteCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SiteName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SiteNameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("UniqueCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("HospitalId"); + + b.ToTable("Site", t => + { + t.HasComment("机构 - Site"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Sponsor", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsTrialLevel") + .HasColumnType("bit"); + + b.Property("SponsorCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SponsorName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SponsorNameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("Sponsor", t => + { + t.HasComment("机构 - Sponsor"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.StudyMonitor", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ArchiveFinishedTime") + .HasColumnType("datetime2"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FailedFileCount") + .HasColumnType("int"); + + b.Property("FileCount") + .HasColumnType("int"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDicom") + .HasColumnType("bit"); + + b.Property("IsDicomReUpload") + .HasColumnType("bit"); + + b.Property("IsSuccess") + .HasColumnType("bit"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RecordPath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("StudyCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier") + .HasComment("Dicom/非Dicom"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UploadFinishedTime") + .HasColumnType("datetime2"); + + b.Property("UploadStartTime") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("StudyId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("TrialId"); + + b.ToTable("StudyMonitor", t => + { + t.HasComment("项目 - 影像上传监控"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubejctVisitDownload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DownloadEndTime") + .HasColumnType("datetime2"); + + b.Property("DownloadStartTime") + .HasColumnType("datetime2"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImageCount") + .HasColumnType("int"); + + b.Property("ImageSize") + .HasColumnType("bigint"); + + b.Property("IsSuccess") + .HasColumnType("bit"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectVisitId"); + + b.ToTable("SubejctVisitDownload", t => + { + t.HasComment("访视下载记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Subject", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Age") + .HasColumnType("int"); + + b.Property("BirthDate") + .HasColumnType("datetime2"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("FinalSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("FirstGiveMedicineTime") + .HasColumnType("datetime2"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Height") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsEnrollment") + .HasColumnType("bit"); + + b.Property("IsReReadingOrBackInfluenceAnalysis") + .HasColumnType("bit") + .HasComment("重阅或者退回影响一致性分析"); + + b.Property("IsUrgent") + .HasColumnType("bit"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("LatestSubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("MedicalNo") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OutEnrollmentTime") + .HasColumnType("datetime2"); + + b.Property("Reason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Sex") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SignDate") + .HasColumnType("datetime2") + .HasComment("知情同意书签署日期"); + + b.Property("Status") + .HasColumnType("int") + .HasComment("1 访视中,2 出组 3 访视结束"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitOverTime") + .HasColumnType("datetime2"); + + b.Property("Weight") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("FinalSubjectVisitId"); + + b.HasIndex("LatestSubjectVisitId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialSiteId"); + + b.ToTable("Subject", t => + { + t.HasComment("项目 - 受试者"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectAdditionalEvaluationResult", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FinalAnswer") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("最终结果"); + + b.Property("FinalTranslateDictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("最终结果翻字典"); + + b.Property("IsFinalResult") + .HasColumnType("bit") + .HasComment("是否是最终结果"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TranslateDictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("附加评估答案翻译字典"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingQuestionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("TrialReadingQuestionId"); + + b.ToTable("SubjectAdditionalEvaluationResult", t => + { + t.HasComment("受试者 - 附加评估标准结果"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCanceDoctor", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.ToTable("SubjectCanceDoctor", t => + { + t.HasComment("受试者 - 阅片标准取消分配医生记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCriteriaEvaluation", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsJoinEvaluation") + .HasColumnType("bit") + .HasComment("是否参与评估"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("SubjectCriteriaEvaluation", t => + { + t.HasComment("受试者 - 参与附加评估标准配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCriteriaEvaluationVisitFilter", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ImageDeterminationResultState") + .HasColumnType("int") + .HasComment("影像判断结果"); + + b.Property("ImageFilterState") + .HasColumnType("int") + .HasComment("影像筛选状态"); + + b.Property("IsGeneratedTask") + .HasColumnType("bit") + .HasComment("是否已生成任务"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("SubjectCriteriaEvaluationVisitFilter", t => + { + t.HasComment("受试者 - 附加评估标准影像筛选"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCriteriaEvaluationVisitStudyFilter", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsConfirmed") + .HasColumnType("bit"); + + b.Property("IsReading") + .HasColumnType("bit"); + + b.Property("SeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SeriesId"); + + b.HasIndex("StudyId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("SubjectCriteriaEvaluationVisitStudyFilter", t => + { + t.HasComment("受试者 - 附加评估标准影像筛选检查"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectPatient", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IsBinded") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("PatientId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("PatientId"); + + b.HasIndex("SubjectId"); + + b.ToTable("SubjectPatient", t => + { + t.HasComment("受试者患者绑定关系"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectPatientSCPStudy", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("PatientId") + .HasColumnType("uniqueidentifier"); + + b.Property("SCPStudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("SubjectPatientSCPStudy", t => + { + t.HasComment("受试者患者检查绑定关系"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ArmEnum") + .HasColumnType("int"); + + b.Property("AssignTime") + .HasColumnType("datetime2"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsConfirmed") + .HasColumnType("bit"); + + b.Property("ReplacedSubjectUserId") + .HasColumnType("uniqueidentifier") + .HasComment("该属性有值 说明该医生被替换了 分配的时候 要过滤掉"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorUserId"); + + b.HasIndex("ReplacedSubjectUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("TrialId"); + + b.ToTable("SubjectUser"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectVisit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AuditState") + .HasColumnType("int") + .HasComment("审核状态"); + + b.Property("Auditor") + .HasColumnType("uniqueidentifier"); + + b.Property("BlindName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ChallengeState") + .HasColumnType("int"); + + b.Property("CheckBackTime") + .HasColumnType("datetime2"); + + b.Property("CheckChallengeState") + .HasColumnType("int"); + + b.Property("CheckPassedTime") + .HasColumnType("datetime2"); + + b.Property("CheckResult") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CheckState") + .HasColumnType("int") + .HasComment("核查状态"); + + b.Property("CheckTime") + .HasColumnType("datetime2"); + + b.Property("CheckUserId") + .HasColumnType("uniqueidentifier") + .HasComment("一致性核查人Id"); + + b.Property("CloseTheReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("关闭一致性质疑原因"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CurrentActionUserExpireTime") + .HasColumnType("datetime2"); + + b.Property("CurrentActionUserId") + .HasColumnType("uniqueidentifier") + .HasComment("当前质控领取人"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("EarliestScanDate") + .HasColumnType("datetime2"); + + b.Property("ForwardState") + .HasColumnType("int"); + + b.Property("ForwardTime") + .HasColumnType("datetime2"); + + b.Property("ForwardUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("InPlan") + .HasColumnType("bit"); + + b.Property("IsBaseLine") + .HasColumnType("bit"); + + b.Property("IsCheckBack") + .HasColumnType("bit") + .HasComment("是否一致性核查回退"); + + b.Property("IsConfirmedClinicalData") + .HasColumnType("bit") + .HasComment("是否确认了、签名了 临床数据完整性"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsEnrollmentConfirm") + .HasColumnType("bit"); + + b.Property("IsFinalVisit") + .HasColumnType("bit"); + + b.Property("IsLostVisit") + .HasColumnType("bit"); + + b.Property("IsPMBackOrReReading") + .HasColumnType("bit"); + + b.Property("IsQCConfirmedReupload") + .HasColumnType("bit"); + + b.Property("IsTake") + .HasColumnType("bit"); + + b.Property("IsUrgent") + .HasColumnType("bit"); + + b.Property("IsVisitTaskGenerated") + .HasColumnType("bit"); + + b.Property("LatestScanDate") + .HasColumnType("datetime2") + .HasComment("最晚拍片日期"); + + b.Property("ManualPassReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("通过原因"); + + b.Property("OutPlanPreviousVisitId") + .HasColumnType("uniqueidentifier") + .HasComment("计划外上一访视"); + + b.Property("PDState") + .HasColumnType("int"); + + b.Property("PreliminaryAuditTime") + .HasColumnType("datetime2"); + + b.Property("PreliminaryAuditUserId") + .HasColumnType("uniqueidentifier") + .HasComment("单审通过人"); + + b.Property("ReadingStatus") + .HasColumnType("int"); + + b.Property("RequestBackState") + .HasColumnType("int"); + + b.Property("ReviewAuditTime") + .HasColumnType("datetime2"); + + b.Property("ReviewAuditUserId") + .HasColumnType("uniqueidentifier") + .HasComment("双审通过人"); + + b.Property("SVENDTC") + .HasColumnType("datetime2"); + + b.Property("SVSTDTC") + .HasColumnType("datetime2"); + + b.Property("SVUPDES") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubmitState") + .HasColumnType("int") + .HasComment("提交状态"); + + b.Property("SubmitTime") + .HasColumnType("datetime2"); + + b.Property("SubmitUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitDay") + .HasColumnType("int"); + + b.Property("VisitExecuted") + .HasColumnType("int") + .HasComment("0 未执行 1 执行了 2 不可用"); + + b.Property("VisitName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("VisitNum") + .HasPrecision(18, 1) + .HasColumnType("decimal(18,1)"); + + b.Property("VisitStageId") + .HasColumnType("uniqueidentifier") + .HasComment("访视计划Id,计划外没有"); + + b.Property("VisitWindowLeft") + .HasColumnType("int"); + + b.Property("VisitWindowRight") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("CurrentActionUserId"); + + b.HasIndex("ForwardUserId"); + + b.HasIndex("OutPlanPreviousVisitId"); + + b.HasIndex("PreliminaryAuditUserId"); + + b.HasIndex("ReviewAuditUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubmitUserId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialSiteId"); + + b.ToTable("SubjectVisit", t => + { + t.HasComment("受试者访视"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectVisitClinicalDialog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("SubjectVisitClinicalDialog"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemAnonymization", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Element") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsAdd") + .HasColumnType("bit"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsFixed") + .HasColumnType("bit"); + + b.Property("ReplaceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TagDescription") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TagDescriptionCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ValueRepresentation") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("SystemAnonymization", t => + { + t.HasComment("系统 - 匿名化配置(需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemBasicData", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BasicDataTypeEnum") + .HasColumnType("int"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ValueCN") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ParentId"); + + b.ToTable("SystemBasicData", t => + { + t.HasComment("系统 - 签名模板场景配置 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemClinicalQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CalculateQuestions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasComment("自定义计算问题"); + + b.Property("ClinicalOptionTypeEnum") + .HasColumnType("int") + .HasComment("临床数据选项类型(无,自定义)"); + + b.Property("ClinicalQuestionMarkEnum") + .HasColumnType("int") + .HasComment("问题标识"); + + b.Property("ClinicalQuestionShowEnum") + .HasColumnType("int") + .HasComment("显示类型"); + + b.Property("ClinicalQuestionType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("临床问题类型(分组,单选。)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomCalculateMark") + .HasColumnType("int") + .HasComment("自定义计算标记"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典Code"); + + b.Property("DigitPlaces") + .HasColumnType("int") + .HasComment("小数点位数"); + + b.Property("GroupId") + .HasColumnType("uniqueidentifier") + .HasComment("分组Id"); + + b.Property("IsCheckDate") + .HasColumnType("bit") + .HasComment("是否是检查日期"); + + b.Property("IsRequired") + .HasColumnType("int") + .HasComment("是否必填"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大长度"); + + b.Property("MaxQuestionCount") + .HasColumnType("int") + .HasComment("最大行数"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("父问题Id"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("父问题触发值"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier") + .HasComment("关联ID"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("关联Value"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("SystemClinicalId") + .HasColumnType("uniqueidentifier") + .HasComment("项目临床数据Id"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("自定义选项"); + + b.Property("Unit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("单位"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("GroupId"); + + b.ToTable("SystemClinicalQuestion", t => + { + t.HasComment("系统临床数据问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemClinicalTableQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClinicalOptionTypeEnum") + .HasColumnType("int") + .HasComment("临床数据选项类型(无,自定义)"); + + b.Property("ClinicalTableQuestionMarkEnum") + .HasColumnType("int") + .HasComment("问题标识"); + + b.Property("ClinicalTableQuestionType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("临床问题类型(分组,单选。)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典Code"); + + b.Property("DigitPlaces") + .HasColumnType("int") + .HasComment("小数点位数"); + + b.Property("IsRequired") + .HasColumnType("int") + .HasComment("是否必填"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大长度"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("外层问题Id"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier") + .HasComment("关联ID"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("关联Value"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("SystemClinicalId") + .HasColumnType("uniqueidentifier") + .HasComment("系统临床数据Id"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("自定义选项"); + + b.Property("Unit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("单位"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("SystemClinicalTableQuestion", t => + { + t.HasComment("系统临床表格问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemCriterionDictionaryCode", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SystemCriterionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("SystemCriterionDictionaryCode", t => + { + t.HasComment("系统标准 - 字典配置 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNotice", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicableProjectEnum") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("NoticeContent") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NoticeLevelEnum") + .HasColumnType("int"); + + b.Property("NoticeModeEnum") + .HasColumnType("int"); + + b.Property("NoticeStateEnum") + .HasColumnType("int"); + + b.Property("NoticeTypeEnum") + .HasColumnType("int"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PublishedTime") + .HasColumnType("datetime2"); + + b.Property("PublishedUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("PublishedUserId"); + + b.ToTable("SystemNotice", t => + { + t.HasComment("后台 - 系统通知"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNoticeUserRead", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SystemNoticeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SystemNoticeId"); + + b.ToTable("SystemNoticeUserRead", t => + { + t.HasComment("后台 - 系统通知用户读取记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNoticeUserType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SystemNoticeId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SystemNoticeId"); + + b.HasIndex("UserTypeId"); + + b.ToTable("SystemNoticeUserType", t => + { + t.HasComment("后台 - 系统通知用户类型配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskAllocationRule", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EnrollId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsJudgeDoctor") + .HasColumnType("bit") + .HasComment("是否是裁判医生 裁判医生单独加入"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PlanReadingRatio") + .HasColumnType("int"); + + b.Property("PlanSubjectCount") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorUserId"); + + b.HasIndex("EnrollId"); + + b.HasIndex("TrialId"); + + b.ToTable("TaskAllocationRule", t => + { + t.HasComment("项目阅片 - 分配规则"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskConsistentRule", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BlindSubjectNumberOfPlaces") + .HasColumnType("int"); + + b.Property("BlindTrialSiteCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IntervalWeeks") + .HasColumnType("int"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsGenerateGlobalTask") + .HasColumnType("bit"); + + b.Property("IsHaveReadingPeriod") + .HasColumnType("bit"); + + b.Property("IsSelfAnalysis") + .HasColumnType("bit"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PlanSubjectCount") + .HasColumnType("int"); + + b.Property("PlanVisitCount") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("TaskConsistentRule", t => + { + t.HasComment("项目阅片 - 一致性分析生成任务配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskInfluence", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("InfluenceTaskId") + .HasColumnType("uniqueidentifier"); + + b.Property("OptType") + .HasColumnType("int") + .HasComment("对影响任务进行的操作"); + + b.Property("OriginalTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("InfluenceTaskId"); + + b.HasIndex("OriginalTaskId"); + + b.ToTable("TaskInfluence", t => + { + t.HasComment("项目阅片 - 退回重阅影响"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskInstance", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Anonymize") + .HasColumnType("bit"); + + b.Property("CPIStatus") + .HasColumnType("bit"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("FrameOfReferenceUID") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("HtmlPath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ImageColumns") + .HasColumnType("int"); + + b.Property("ImageRows") + .HasColumnType("int"); + + b.Property("ImagerPixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InstanceNumber") + .HasColumnType("int"); + + b.Property("InstanceTime") + .HasColumnType("datetime2"); + + b.Property("NumberOfFrames") + .HasColumnType("int"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesId") + .HasColumnType("uniqueidentifier"); + + b.Property("SeriesInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SliceLocation") + .HasColumnType("int"); + + b.Property("SliceThickness") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SopInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.Property("WindowCenter") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("WindowWidth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SeriesId"); + + b.HasIndex("StudyId"); + + b.ToTable("TaskInstance", t => + { + t.HasComment("项目阅片 - 任务后处理Instance"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskMedicalReview", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllocateTime") + .HasColumnType("datetime2") + .HasComment("分配时间"); + + b.Property("AuditAdviceEnum") + .HasColumnType("int") + .HasComment("审核建议"); + + b.Property("AuditSignTime") + .HasColumnType("datetime2") + .HasComment("审核通过时间"); + + b.Property("AuditState") + .HasColumnType("int") + .HasComment("审核状态"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DialogCloseReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("对话关闭原因"); + + b.Property("DisagreeReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("不同意重阅原因"); + + b.Property("DoctorUserIdeaEnum") + .HasColumnType("int") + .HasComment("阅片人是否认同"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("文件名称"); + + b.Property("ImagePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("图片路径"); + + b.Property("IsApplyHeavyReading") + .HasColumnType("bit") + .HasComment("是否申请重阅"); + + b.Property("IsAutoGenerate") + .HasColumnType("bit"); + + b.Property("IsClosedDialog") + .HasColumnType("bit") + .HasComment("是否关闭对话"); + + b.Property("IsHaveQuestion") + .HasColumnType("bit") + .HasComment("是否有问题"); + + b.Property("IsInvalid") + .HasColumnType("bit") + .HasComment("无效的 为True无效"); + + b.Property("IsSendMessage") + .HasColumnType("bit") + .HasComment("是否发送消息"); + + b.Property("LatestReplyUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("MedicalDialogCloseEnum") + .HasColumnType("int") + .HasComment("医学审核对话关闭原因"); + + b.Property("MedicalManagerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("PDRelationTaskIdListStr") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Questioning") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("质询问题"); + + b.Property("SaveConclusionTime") + .HasColumnType("datetime2") + .HasComment("保存结论时间"); + + b.Property("SaveQuestionTime") + .HasColumnType("datetime2") + .HasComment("保存问题的时间"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("LatestReplyUserId"); + + b.HasIndex("MedicalManagerUserId"); + + b.HasIndex("TrialId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("TaskMedicalReview", t => + { + t.HasComment("项目阅片 - 医学审核"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskMedicalReviewRule", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PlanGlobalCount") + .HasColumnType("int"); + + b.Property("PlanJudgeCount") + .HasColumnType("int"); + + b.Property("PlanTumorCount") + .HasColumnType("int"); + + b.Property("PlanVisitCount") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorUserId"); + + b.ToTable("TaskMedicalReviewRule", t => + { + t.HasComment("项目阅片 - 一致性分析规则"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskSeries", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AcquisitionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartExamined") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ImageOrientationPatient") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImagePositionPatient") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImageResizePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ImagerPixelSpacing") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InstanceCount") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Modality") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ProtocolName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SequenceName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesNumber") + .HasColumnType("int"); + + b.Property("SeriesTime") + .HasColumnType("datetime2"); + + b.Property("SliceThickness") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TriggerTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("StudyId"); + + b.ToTable("TaskSeries", t => + { + t.HasComment("项目阅片 - 任务后上传序列"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskStudy", b => + { + b.Property("SeqId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionNumber") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AcquisitionTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartExamined") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InstanceCount") + .HasColumnType("int"); + + b.Property("InstitutionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Modalities") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ModalityForEdit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientAge") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientBirthDate") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientId") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PatientSex") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SeriesCount") + .HasColumnType("int"); + + b.Property("StudyCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyInstanceUid") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyTime") + .HasColumnType("datetime2"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TriggerTime") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SeqId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("TaskStudy", t => + { + t.HasComment("项目阅片 - 任务后上传检查"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Trial", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AttendedReviewerTypes") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AuthorizationDate") + .HasColumnType("datetime2"); + + b.Property("AuthorizationDuration") + .HasColumnType("int"); + + b.Property("AuthorizationEncrypt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("BlindBaseLineName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BlindFollowUpPrefix") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BodyPartTypes") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CRO") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CROId") + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeDefalutDays") + .HasColumnType("int"); + + b.Property("ClinicalInformationTransmissionEnum") + .HasColumnType("int") + .HasComment("临床信息传输 1:系统录入 2:系统录入+PDF 0:无"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("ContactPhone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ContactUser") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionTypes") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DeclarationTypes") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("DigitPlaces") + .HasColumnType("int"); + + b.Property("EmailAuthorizationCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("密码/授权码"); + + b.Property("EmailFromEmail") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("发件箱账号"); + + b.Property("EmailFromName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("发件人"); + + b.Property("EmailSMTPServerAddress") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("SMTP服务器"); + + b.Property("EmailSMTPServerPort") + .HasColumnType("int") + .HasComment("SMTP端口"); + + b.Property("EnrollConfirmDefaultUserType") + .HasColumnType("int"); + + b.Property("ExpectedPatients") + .HasColumnType("int"); + + b.Property("Expedited") + .HasColumnType("int"); + + b.Property("ExperimentName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("实验名称"); + + b.Property("GRRReviewers") + .HasColumnType("int"); + + b.Property("HeadPI") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("负责人PI"); + + b.Property("Indication") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IndicationEnum") + .HasColumnType("int"); + + b.Property("IndicationTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCRAAuditClinicalInformation") + .HasColumnType("bit") + .HasComment("是否审核 临床信息"); + + b.Property("IsConfigureEmail") + .HasColumnType("bit") + .HasComment("是否配置过邮箱"); + + b.Property("IsDeclaration") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsEnrollementQualificationConfirm") + .HasColumnType("bit") + .HasComment("是否有 入组性确认"); + + b.Property("IsHaveFirstGiveMedicineDate") + .HasColumnType("bit") + .HasComment("是否 有基准时间(首次给药时间)"); + + b.Property("IsHaveSubjectAge") + .HasColumnType("bit") + .HasComment("是否有 受试者年龄"); + + b.Property("IsImageConsistencyVerification") + .HasColumnType("bit") + .HasComment("影像一致性核查"); + + b.Property("IsImageExport") + .HasColumnType("bit") + .HasComment("影像导出"); + + b.Property("IsImageReplicationAcrossTrial") + .HasColumnType("bit") + .HasComment("跨项目复制"); + + b.Property("IsMedicalReview") + .HasColumnType("bit"); + + b.Property("IsNoticeSubjectCodeRule") + .HasColumnType("bit") + .HasComment("是否 提醒受试者编号规则"); + + b.Property("IsPACSConnect") + .HasColumnType("bit"); + + b.Property("IsPDProgressView") + .HasColumnType("bit") + .HasComment("PD 进展是否显示 配置访视 是否显示 PD进展 (从而可以设置状态)"); + + b.Property("IsQCQuestionConfirmed") + .HasColumnType("bit"); + + b.Property("IsSubjectExpeditedView") + .HasColumnType("bit") + .HasComment("配置Suject Edit页面 是否显示 加急"); + + b.Property("IsSubjectSecondCodeView") + .HasColumnType("bit"); + + b.Property("IsSubjectSexView") + .HasColumnType("bit"); + + b.Property("IsTrialBasicLogicConfirmed") + .HasColumnType("bit"); + + b.Property("IsTrialPACSConfirmed") + .HasColumnType("bit"); + + b.Property("IsTrialProcessConfirmed") + .HasColumnType("bit"); + + b.Property("IsTrialStart") + .HasColumnType("bit"); + + b.Property("IsTrialUrgentConfirmed") + .HasColumnType("bit"); + + b.Property("IsUrgent") + .HasColumnType("bit"); + + b.Property("IsVerifyVisitImageDate") + .HasColumnType("bit") + .HasComment("是否 验证拍片日期"); + + b.Property("MainResearchUnit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("主研单位"); + + b.Property("MedicineName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("MessageFromClient") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("MessageFromClientName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Modalitys") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OutEnrollmentVisitName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("出组后计划外访视名称"); + + b.Property("PDProgressDefaultUserType") + .HasColumnType("int"); + + b.Property("PhaseId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlanSiteCount") + .HasColumnType("int"); + + b.Property("PlanVisitCount") + .HasColumnType("int"); + + b.Property("PreliminaryAuditReuploadText") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ProjectCycle") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("QCProcessEnum") + .HasColumnType("int") + .HasComment("QC流程 0 不审,1 单审,2双审"); + + b.Property("QCQuestionConfirmedTime") + .HasColumnType("datetime2"); + + b.Property("QCQuestionConfirmedUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReadingMode") + .HasColumnType("int") + .HasComment("阅片方式"); + + b.Property("ResearchProgramNo") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("研究方案号"); + + b.Property("ReviewAuditReuploadText") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReviewModeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReviewProtocol") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReviewProtocolName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Sponsor") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SponsorId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectCodeRule") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("受试者编号具体规则"); + + b.Property("SyncClinicalDataTime") + .HasColumnType("datetime2") + .HasComment("同步临床数据时间"); + + b.Property("TimePointsPerPatient") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TotalReviewers") + .HasColumnType("int"); + + b.Property("TrialCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialEnrollStatus") + .HasColumnType("int") + .HasComment("入组那一块的状态"); + + b.Property("TrialExtraConfigJsonStr") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("TrialFinishTime") + .HasColumnType("datetime2") + .HasComment("项目完成时间"); + + b.Property("TrialFinishedTime") + .HasColumnType("datetime2"); + + b.Property("TrialStatusStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("启动状态"); + + b.Property("TrialType") + .HasColumnType("int") + .HasComment("项目类型 1 正式项目、0 非正式项目 2是培训项目"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitBaseDataDes") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("VisitPlanConfirmed") + .HasColumnType("bit"); + + b.Property("VitrualSiteCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("IndicationTypeId"); + + b.HasIndex("PhaseId"); + + b.HasIndex("QCQuestionConfirmedUserId"); + + b.HasIndex("ReviewModeId"); + + b.ToTable("Trial", t => + { + t.HasComment("项目 - 项目基本信息与配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialBodyPart", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsHandAdd") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("NameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialBodyPart", t => + { + t.HasComment("项目 - 项目部位配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialClinicalDataSetCriterion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialClinicalDataSetId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialClinicalDataSetId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("TrialClinicalDataSetCriterion", t => + { + t.HasComment("项目标准 - 临床数据配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialClinicalQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CalculateQuestions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasComment("自定义计算问题"); + + b.Property("ClinicalOptionTypeEnum") + .HasColumnType("int") + .HasComment("临床数据选项类型(无,自定义)"); + + b.Property("ClinicalQuestionMarkEnum") + .HasColumnType("int") + .HasComment("问题标识"); + + b.Property("ClinicalQuestionShowEnum") + .HasColumnType("int") + .HasComment("显示类型"); + + b.Property("ClinicalQuestionType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("临床问题类型(分组,单选。)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CustomCalculateMark") + .HasColumnType("int") + .HasComment("自定义计算标记"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典Code"); + + b.Property("DigitPlaces") + .HasColumnType("int") + .HasComment("小数点位数"); + + b.Property("GroupId") + .HasColumnType("uniqueidentifier") + .HasComment("分组Id"); + + b.Property("IsCheckDate") + .HasColumnType("bit") + .HasComment("是否是检查日期"); + + b.Property("IsRequired") + .HasColumnType("int") + .HasComment("是否必填"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大长度"); + + b.Property("MaxQuestionCount") + .HasColumnType("int") + .HasComment("最大行数"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier") + .HasComment("父问题Id"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("父问题触发值"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier") + .HasComment("关联ID"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("关联Value"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("SystemClinicalQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("系统临床问题Id"); + + b.Property("TrialClinicalId") + .HasColumnType("uniqueidentifier") + .HasComment("项目临床数据Id"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("自定义选项"); + + b.Property("Unit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("单位"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("GroupId"); + + b.HasIndex("TrialClinicalId"); + + b.ToTable("TrialClinicalQuestion", t => + { + t.HasComment("项目临床数据问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialClinicalTableQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CalculateQuestions") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasComment("自定义计算问题"); + + b.Property("ClinicalCalculateMarkEnum") + .HasColumnType("int") + .HasComment("自定义计算标记"); + + b.Property("ClinicalOptionTypeEnum") + .HasColumnType("int") + .HasComment("临床数据选项类型(无,自定义)"); + + b.Property("ClinicalTableQuestionMarkEnum") + .HasColumnType("int") + .HasComment("问题标识"); + + b.Property("ClinicalTableQuestionType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("临床问题类型(分组,单选。)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DictionaryCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("字典Code"); + + b.Property("DigitPlaces") + .HasColumnType("int") + .HasComment("小数点位数"); + + b.Property("IsRequired") + .HasColumnType("int") + .HasComment("是否必填"); + + b.Property("MaxAnswerLength") + .HasColumnType("int") + .HasComment("最大长度"); + + b.Property("QuestionEnName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题英文名称"); + + b.Property("QuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("外层问题Id"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("问题名称"); + + b.Property("RelevanceId") + .HasColumnType("uniqueidentifier") + .HasComment("关联ID"); + + b.Property("RelevanceValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("关联Value"); + + b.Property("ShowOrder") + .HasColumnType("int") + .HasComment("排序"); + + b.Property("SystemTableQuestionId") + .HasColumnType("uniqueidentifier") + .HasComment("系统表格问题Id"); + + b.Property("TrialClinicalId") + .HasColumnType("uniqueidentifier") + .HasComment("项目临床数据Id"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("自定义选项"); + + b.Property("Unit") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("单位"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("TrialClinicalTableQuestion", t => + { + t.HasComment("项目临床表格问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialCriterionAdditionalAssessmentType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AdditionalAssessmentType") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionType") + .HasColumnType("int"); + + b.Property("IsSelected") + .HasColumnType("bit"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("TrialCriterionAdditionalAssessmentType", t => + { + t.HasComment("项目 - 项目标准附加评估配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialCriterionDictionaryCode", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialCriterionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialCriterionId"); + + b.ToTable("TrialCriterionDictionaryCode"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDicomAE", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CalledAE") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsTestOK") + .HasColumnType("bit"); + + b.Property("LatestTestTime") + .HasColumnType("datetime2"); + + b.Property("Modality") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Port") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("TrialDicomAE", t => + { + t.HasComment("项目 - 项目DicomAE"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDictionary", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DictionaryId") + .HasColumnType("uniqueidentifier"); + + b.Property("KeyName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("DictionaryId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialDictionary", t => + { + t.HasComment("项目 - 项目字典关系表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailBlackUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialEmailNoticeConfigId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TrialEmailNoticeConfigId"); + + b.HasIndex("UserId"); + + b.ToTable("TrialEmailBlackUser", t => + { + t.HasComment("项目 - 项目邮件用户黑名单"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AttachCNPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AttachName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AttachNameCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AttachPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("AuthorizationCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BusinessLevelEnum") + .HasColumnType("int"); + + b.Property("BusinessModuleEnum") + .HasColumnType("int"); + + b.Property("BusinessScenarioEnum") + .HasColumnType("int"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionTypeEnum") + .HasColumnType("int"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailCron") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailDelaySeconds") + .HasColumnType("int") + .HasComment("邮件延时秒数,比如一个事件触发,延迟多少s后才发邮件"); + + b.Property("EmailHtmlContent") + .HasColumnType("nvarchar(max)"); + + b.Property("EmailHtmlContentCN") + .HasColumnType("nvarchar(max)"); + + b.Property("EmailTopic") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailTopicCN") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailTypeEnum") + .HasColumnType("int"); + + b.Property("EmailUrgentEnum") + .HasColumnType("int"); + + b.Property("FromEmail") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FromName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsAutoSend") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDistinguishCriteria") + .HasColumnType("bit"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsReturnRequired") + .HasColumnType("bit"); + + b.Property("SMTPServerAddress") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SMTPServerPort") + .HasColumnType("int"); + + b.Property("SysEmailNoticeConfigId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SysEmailNoticeConfigId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("TrialEmailNoticeConfig", t => + { + t.HasComment("项目 - 项目发送邮件配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailNoticeUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("EmailUserType") + .HasColumnType("int"); + + b.Property("TrialEmailNoticeConfigId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TrialEmailNoticeConfigId"); + + b.ToTable("TrialEmailNoticeUser", t => + { + t.HasComment("项目 - 项目邮件收发配置用户类型"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialExperience", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CriterionType") + .HasColumnType("int"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("EvaluationContent") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ExperienceDataType") + .HasColumnType("int"); + + b.Property("IndicationEnum") + .HasColumnType("int"); + + b.Property("IndicationTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("OtherCriterion") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OtherStages") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PhaseId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitReadingCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("PhaseId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialExperience", t => + { + t.HasComment("医生 - 项目临床经历"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialExperienceCriteria", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("EvaluationCriteriaId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialExperienceId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("DoctorId"); + + b.HasIndex("EvaluationCriteriaId"); + + b.HasIndex("TrialExperienceId"); + + b.ToTable("TrialExperienceCriteria", t => + { + t.HasComment("医生 - 项目临床经历评估标准"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialExternalUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConfirmTime") + .HasColumnType("datetime2"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ExpireTime") + .HasColumnType("datetime2"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InviteState") + .HasColumnType("int") + .HasComment("邀请状态"); + + b.Property("IsJoin") + .HasColumnType("bit"); + + b.Property("IsSystemUser") + .HasColumnType("bit"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganizationName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RejectReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SystemUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialExternalUser", t => + { + t.HasComment("项目 - 项目外部人员"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialIdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("JoinTime") + .HasColumnType("datetime2"); + + b.Property("RemoveTime") + .HasColumnType("datetime2"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialIdentityUser", t => + { + t.HasComment("项目用户表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialImageDownload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DicomStudyCount") + .HasColumnType("int"); + + b.Property("DownloadEndTime") + .HasColumnType("datetime2"); + + b.Property("DownloadStartTime") + .HasColumnType("datetime2"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImageCount") + .HasColumnType("int"); + + b.Property("ImageSize") + .HasColumnType("bigint"); + + b.Property("ImageType") + .HasColumnType("int"); + + b.Property("IsSuccess") + .HasColumnType("bit"); + + b.Property("NoneDicomStudyCount") + .HasColumnType("int"); + + b.Property("SubjectCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("一致性分析的就显示一致性分析的中心"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialImageDownload", t => + { + t.HasComment("项目 - 影像下载监控"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialPaymentPrice", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AdjustmentMultiple") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsNewTrial") + .HasColumnType("bit") + .HasComment("是否有 为新项目"); + + b.Property("SowName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SowPath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialAdditional") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialPaymentPrice", t => + { + t.HasComment("医生计费 - 项目支付配置"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialQCQuestion", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsConfirm") + .HasColumnType("bit"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("IsRequired") + .HasColumnType("bit"); + + b.Property("LanguageType") + .HasColumnType("int") + .HasComment("语言类型"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentTriggerValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("QuestionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("下拉框、文本、单选、多选"); + + b.Property("TypeValue") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("ParentId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialQCQuestion", t => + { + t.HasComment("项目 - 质控问题"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialQCQuestionAnswer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Answer") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CurrentQCEnum") + .HasColumnType("int") + .HasComment("1代表第一个人QC数据 2 代表第二个人QC数据"); + + b.Property("QCProcessEnum") + .HasColumnType("int"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialQCQuestionConfigureId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialQCQuestionConfigureId"); + + b.ToTable("TrialQCQuestionAnswer", t => + { + t.HasComment("项目 - 质控问题表单答案"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialRevenuesPrice", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Adjudication") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AdjudicationIn24H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("AdjudicationIn48H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Downtime") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Global") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("RefresherTraining") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Timepoint") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TimepointIn24H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TimepointIn48H") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("Training") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("TrialRevenuesPrice", t => + { + t.HasComment("医生计费 - 项目工作量收入单价"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialRevenuesPriceVerification", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Adjudication") + .HasColumnType("bit"); + + b.Property("AdjudicationIn24H") + .HasColumnType("bit"); + + b.Property("AdjudicationIn48H") + .HasColumnType("bit"); + + b.Property("Downtime") + .HasColumnType("bit"); + + b.Property("Global") + .HasColumnType("bit"); + + b.Property("RefresherTraining") + .HasColumnType("bit"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Timepoint") + .HasColumnType("bit"); + + b.Property("TimepointIn24H") + .HasColumnType("bit"); + + b.Property("TimepointIn48H") + .HasColumnType("bit"); + + b.Property("Training") + .HasColumnType("bit"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkLoadDate") + .HasColumnType("datetime2"); + + b.Property("YearMonth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.ToTable("TrialRevenuesPriceVerification", t => + { + t.HasComment("医生计费 - 项目收入价格验证"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSign", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("SignCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SignCodeId") + .HasColumnType("uniqueidentifier"); + + b.Property("SignText") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("TrialSign", t => + { + t.HasComment("项目 - 项目操作签名表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSite", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("EnabledTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("SiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteAliasName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialSiteCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialSiteName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SiteId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialSite", t => + { + t.HasComment("项目 - 项目中心表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteDicomAE", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CallingAE") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Port") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialSiteId"); + + b.ToTable("TrialSiteDicomAE", t => + { + t.HasComment("项目 - 项目中心DicomAE表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteEquipmentSurvey", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EquipmentTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ManufacturerName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Parameters") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ScannerType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialSiteSurveyId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("EquipmentTypeId"); + + b.HasIndex("TrialSiteSurveyId"); + + b.ToTable("TrialSiteEquipmentSurvey", t => + { + t.HasComment("项目 - 项目中心调研设备表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteSurvey", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AverageEngravingCycle") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("EfficacyEvaluatorType") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsConfirmImagingTechnologist") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsFollowStudyParameters") + .HasColumnType("bit"); + + b.Property("LatestBackReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("NotConfirmReson") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("NotFollowReson") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PreliminaryTime") + .HasColumnType("datetime2"); + + b.Property("PreliminaryUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReviewerTime") + .HasColumnType("datetime2"); + + b.Property("ReviewerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("PreliminaryUserId"); + + b.HasIndex("ReviewerUserId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialSiteId"); + + b.ToTable("TrialSiteSurvey", t => + { + t.HasComment("项目 - 项目中心调研表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialSiteId"); + + b.HasIndex("UserId"); + + b.ToTable("TrialSiteUser", t => + { + t.HasComment("项目 - 项目中心用户关系表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteUserSurvey", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("InviteState") + .HasColumnType("int"); + + b.Property("IsGenerateAccount") + .HasColumnType("bit"); + + b.Property("IsGenerateSuccess") + .HasColumnType("bit"); + + b.Property("IsHistoryUser") + .HasColumnType("bit"); + + b.Property("IsHistoryUserDeleted") + .HasColumnType("bit"); + + b.Property("IsHistoryUserOriginDeleted") + .HasColumnType("bit"); + + b.Property("IsJoin") + .HasColumnType("bit"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganizationName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("SystemUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialRoleCode") + .HasColumnType("int"); + + b.Property("TrialSiteSurveyId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialSiteSurveyId"); + + b.HasIndex("UserTypeId"); + + b.ToTable("TrialSiteUserSurvey", t => + { + t.HasComment("项目 - 项目中心调研用户表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialStateChange", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("NowState") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OriginState") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Reason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialStateChange", t => + { + t.HasComment("项目 - 项目状态变更记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialStatusDetail", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Memo") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OptUserType") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialStatus") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialStatus", t => + { + t.HasComment("项目 - 入组流程记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialUserRole", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("JoinTime") + .HasColumnType("datetime2"); + + b.Property("RemoveTime") + .HasColumnType("datetime2"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasComment("这里实际是UserRoleId"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialUserId"); + + b.HasIndex("UserId"); + + b.ToTable("TrialUser", t => + { + t.HasComment("运维人员与项目关联关系表 - 实体"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialVirtualSiteCodeUpdate", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("VirturalSiteCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("TrialVirtualSiteCodeUpdate", t => + { + t.HasComment("项目 - 虚拟中心编号更新记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TumorAssessment_IRECIST1Point1", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("NewLesion") + .HasColumnType("int") + .HasComment("新病灶"); + + b.Property("NonTargetLesions") + .HasColumnType("int") + .HasComment("非靶病灶"); + + b.Property("OverallEfficacy") + .HasColumnType("int") + .HasComment("整体疗效"); + + b.Property("TargetLesion") + .HasColumnType("int") + .HasComment("靶病灶"); + + b.HasKey("Id"); + + b.ToTable("TumorAssessment_IRECIST1Point1", t => + { + t.HasComment("IRECIST1Point1肿瘤评估(系统标准)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TumorAssessment_RECIST1Point1", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("NewLesion") + .HasColumnType("int") + .HasComment("新病灶"); + + b.Property("NonTargetLesions") + .HasColumnType("int") + .HasComment("非靶病灶"); + + b.Property("OverallEfficacy") + .HasColumnType("int") + .HasComment("整体疗效"); + + b.Property("TargetLesion") + .HasColumnType("int") + .HasComment("靶病灶"); + + b.HasKey("Id"); + + b.ToTable("TumorAssessment_RECIST1Point1", t => + { + t.HasComment("RECIST1Point1肿瘤评估(系统标准)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TumorAssessment_RECIST1Point1BM", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("NewLesion") + .HasColumnType("int") + .HasComment("新病灶"); + + b.Property("NonTargetLesions") + .HasColumnType("int") + .HasComment("非靶病灶"); + + b.Property("OverallEfficacy") + .HasColumnType("int") + .HasComment("整体疗效"); + + b.Property("TargetLesion") + .HasColumnType("int") + .HasComment("靶病灶"); + + b.HasKey("Id"); + + b.ToTable("TumorAssessment_RECIST1Point1BM", t => + { + t.HasComment("RECIST1Point1BM肿瘤评估(系统标准)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserFeedBack", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuestionDescription") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("QuestionType") + .HasColumnType("int"); + + b.Property("ScreenshotListStr") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialSiteId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialSiteId"); + + b.HasIndex("VisitTaskId"); + + b.ToTable("UserFeedBack", t => + { + t.HasComment("后台 - 用户反馈"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserLog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActionIdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ActionUserName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ActionUserType") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IPRegion") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsIgnoreUncommonly") + .HasColumnType("bit") + .HasComment("是否忽略异地登录"); + + b.Property("IsLoginUncommonly") + .HasColumnType("bit") + .HasComment("异地登录"); + + b.Property("JsonObj") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LoginFaildName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("LoginPassword") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("LoginUserId") + .HasColumnType("uniqueidentifier") + .HasComment("后续删除"); + + b.Property("OptType") + .HasColumnType("int"); + + b.Property("OptUserId") + .HasColumnType("uniqueidentifier") + .HasComment("被操作的人,自己操作的就是自己--后续删除"); + + b.Property("TargetIdentityUserId") + .HasColumnType("uniqueidentifier") + .HasComment("被操作的对象 admin 修改张三信息 张三是被操作对象"); + + b.HasKey("Id"); + + b.HasIndex("ActionIdentityUserId"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TargetIdentityUserId"); + + b.ToTable("UserLog", t => + { + t.HasComment("后台 - 用户账户操作日志"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserPassWordLog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("PassWord") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("密码"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasComment("用户Id"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("UserPassWordLog", t => + { + t.HasComment("后台 - 用户修改密码"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserRole", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AutoCutNextTask") + .HasColumnType("bit") + .HasComment("自动切换下一个任务"); + + b.Property("CheckCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DepartmentName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier") + .HasComment("医生生成账号后,会有值"); + + b.Property("EMail") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailToken") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsFirstAdd") + .HasColumnType("bit") + .HasComment("首次登录需要修改密码"); + + b.Property("IsTestUser") + .HasColumnType("bit"); + + b.Property("IsUserRoleDisabled") + .HasColumnType("bit"); + + b.Property("IsZhiZhun") + .HasColumnType("bit") + .HasComment("内部用户 外部用户"); + + b.Property("LastChangePassWordTime") + .HasColumnType("datetime2") + .HasComment("上一次修改密码的时间"); + + b.Property("LastLoginIP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("LastLoginTime") + .HasColumnType("datetime2"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganizationName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PasswordChanged") + .HasColumnType("bit"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PositionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SuperAdmin") + .HasColumnType("bit"); + + b.Property("ThirdUserCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserTypeEnum") + .HasColumnType("int"); + + b.Property("UserTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorId") + .IsUnique() + .HasFilter("[DoctorId] IS NOT NULL"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("UserTypeId"); + + b.ToTable("User", t => + { + t.HasComment("后台 - 系统账户"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsEnable") + .HasColumnType("bit"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("PermissionStr") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserTypeEnum") + .HasColumnType("int"); + + b.Property("UserTypeName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserTypeShortName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.ToTable("UserType", t => + { + t.HasComment("后台 - 系统用户类型 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserTypeGroup", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DictionaryId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("DictionaryId"); + + b.HasIndex("UserTypeId"); + + b.ToTable("UserTypeGroup", t => + { + t.HasComment("后台 - 用户类型组(需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserTypeMenu", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("MenuId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("MenuId"); + + b.HasIndex("UserTypeId"); + + b.ToTable("UserTypeMenu", t => + { + t.HasComment("后台 - 系统用户类型菜单中间关系表 (需要同步)"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserWLTemplate", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsPitchOn") + .HasColumnType("bit") + .HasComment("是否为默认"); + + b.Property("ShowOrder") + .HasColumnType("int"); + + b.Property("TemplateName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WL") + .HasColumnType("int"); + + b.Property("WW") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("UserWLTemplate", t => + { + t.HasComment("用户配置 - WL模板"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Vacation", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("Vacation", t => + { + t.HasComment("医生 - 假期安排"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VerificationCode", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("验证码"); + + b.Property("CodeType") + .HasColumnType("int") + .HasComment("什么类型的验证码 邮箱|手机"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EmailOrPhone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("发送的邮箱或者手机"); + + b.Property("ExpirationTime") + .HasColumnType("datetime2") + .HasComment("过期时间"); + + b.Property("HasSend") + .HasColumnType("bit"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("VerificationCode", t => + { + t.HasComment("后台 - 验证码记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitPlanInfluenceStat", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("InconsistentCount") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("VisitPlanInfluenceStat", t => + { + t.HasComment("项目配置 - 访视计划调整不一致数量记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitPlanInfluenceStudy", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("HistoryWindow") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsDicomStudy") + .HasColumnType("bit"); + + b.Property("IsOverWindowNowNotOverWindow") + .HasColumnType("bit"); + + b.Property("Modality") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("NowWindow") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StudyId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudyTime") + .HasColumnType("datetime2"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitPlanInfluenceStatId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("SubjectVisitId"); + + b.HasIndex("VisitPlanInfluenceStatId"); + + b.ToTable("VisitPlanInfluenceStudy", t => + { + t.HasComment("项目配置 - 访视计划调整影像检查"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitStage", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BlindName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsBaseLine") + .HasColumnType("bit"); + + b.Property("IsConfirmed") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsHaveFirstConfirmed") + .HasColumnType("bit"); + + b.Property("NeedGlobal") + .HasColumnType("bit"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitDay") + .HasColumnType("int"); + + b.Property("VisitName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("VisitNum") + .HasPrecision(18, 1) + .HasColumnType("decimal(18,1)"); + + b.Property("VisitWindowLeft") + .HasColumnType("int"); + + b.Property("VisitWindowRight") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("VisitStage", t => + { + t.HasComment("项目配置 - 访视记录"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitTask", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllocateTime") + .HasColumnType("datetime2") + .HasComment("分配时间"); + + b.Property("ArmEnum") + .HasColumnType("int") + .HasComment("0 代表 单重阅片 产生的任务 否则就是双重 任务 1 任务 2"); + + b.Property("BeforeConvertedTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("转换之前的任务Id(转化的任务才有该值)"); + + b.Property("BlindSubjectCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("BlindTrialSiteCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("ConsistentAnalysisOriginalTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("针对产生的一致性任务而言,这个字段存储的是原始任务"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DoctorUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpetidEmailNoticeTime") + .HasColumnType("datetime2") + .HasComment("通知IR加急阅片时间"); + + b.Property("FirstAuditTime") + .HasColumnType("datetime2"); + + b.Property("FirstAuditUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("FirstReadingTime") + .HasColumnType("datetime2") + .HasComment("首次阅片时间"); + + b.Property("ImageStudyState") + .HasColumnType("int"); + + b.Property("IsAnalysisCreate") + .HasColumnType("bit") + .HasComment("是否是一致性分析产生"); + + b.Property("IsAnalysisDiffToOriginalData") + .HasColumnType("bit") + .HasComment("阅片结果是否和原数据有差异"); + + b.Property("IsCanEditUrgentState") + .HasColumnType("bit") + .HasComment("是否和编辑加急状态"); + + b.Property("IsChangeTumorEvaluate") + .HasColumnType("bit") + .HasComment("是否修改了整体肿瘤评估"); + + b.Property("IsClinicalDataSign") + .HasColumnType("bit") + .HasComment("临床数据是否签名"); + + b.Property("IsConfirmReminder") + .HasColumnType("bit"); + + b.Property("IsEnrollment") + .HasColumnType("bit"); + + b.Property("IsFrontTaskNeedSignButNotSign") + .HasColumnType("bit") + .HasComment("前序任务需要签名 但是未签名"); + + b.Property("IsGlobalHaveUpdate") + .HasColumnType("bit") + .HasComment("全局是否有更新"); + + b.Property("IsGroupDiffArm1") + .HasColumnType("bit") + .HasComment("组件一致性和原Arm1是否有差异"); + + b.Property("IsGroupDiffArm2") + .HasColumnType("bit") + .HasComment("组件一致性和原Arm2是否有差异"); + + b.Property("IsHistoryConvertedTask") + .HasColumnType("bit") + .HasComment("重阅重置任务的 标注是转化之前的 还是转化之后的"); + + b.Property("IsNeedClinicalDataSign") + .HasColumnType("bit") + .HasComment("临床数据"); + + b.Property("IsPDConfirm") + .HasColumnType("bit"); + + b.Property("IsPMSetBack") + .HasColumnType("bit") + .HasComment("PM 对该任务进行了回退 影响的任务不设置"); + + b.Property("IsReReadingCreate") + .HasColumnType("bit") + .HasComment("是否是重阅产生的,方便过滤数据"); + + b.Property("IsReadClinicalData") + .HasColumnType("bit") + .HasComment("IR是否阅读临床数据"); + + b.Property("IsSelfAnalysis") + .HasColumnType("bit") + .HasComment("是否是自身一致性"); + + b.Property("IsUrgent") + .HasColumnType("bit"); + + b.Property("JudgeResultImagePath") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)") + .HasComment("裁判结果的图片路径"); + + b.Property("JudgeResultRemark") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("裁判结果的备注"); + + b.Property("JudgeResultTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("在裁判任务上记录 裁判结果的任务ID(访视或者全局)"); + + b.Property("JudgeVisitTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("在访视或者全局任务上记录 裁判任务的Id"); + + b.Property("LatestReplyTime") + .HasColumnType("datetime2"); + + b.Property("LatestReplyUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("NotAgreeReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PIAuditImagePath") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PIAuditNote") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PIAuditState") + .HasColumnType("int"); + + b.Property("PastResultTaskIds") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasComment("既往任务Id 不包括自己"); + + b.Property("ReReadingApplyState") + .HasColumnType("int") + .HasComment("重阅状态"); + + b.Property("ReadingCategory") + .HasColumnType("int") + .HasComment("任务类型"); + + b.Property("ReadingTaskState") + .HasColumnType("int") + .HasComment("任务阅片状态"); + + b.Property("RelatedVisitTaskIds") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasComment("关联的访视任务ID (当前任务是访视任务的话会有自己)"); + + b.Property("ReportExportDate") + .HasColumnType("datetime2"); + + b.Property("ReportExportNum") + .HasColumnType("int"); + + b.Property("ReportExportUrl") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ReportRelatedTaskIds") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasComment("报告任务关系 包含冻结"); + + b.Property("SignTime") + .HasColumnType("datetime2") + .HasComment("签名时间"); + + b.Property("SouceReadModuleId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceSubjectVisitId") + .HasColumnType("uniqueidentifier") + .HasComment("任务来源访视Id 方便回更访视读片状态"); + + b.Property("SubjectCriterionClaimUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggesteFinishedTime") + .HasColumnType("datetime2"); + + b.Property("TaskAllocationState") + .HasColumnType("int") + .HasComment("分配状态"); + + b.Property("TaskBlindName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TaskCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TaskName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TaskState") + .HasColumnType("int"); + + b.Property("TaskUrgentRemake") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("任务加急类型"); + + b.Property("TaskUrgentType") + .HasColumnType("int") + .HasComment("加急类型"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("TrialReadingCriterionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TumorEvaluationUrl") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("VisitTaskNum") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasComment("随访任务号 取访视的号 计划外是 访视+0.1 裁判任务在访视任务上+0.002 全局任务在截止访视号上+0.03 肿瘤待定"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("DoctorUserId"); + + b.HasIndex("FirstAuditUserId"); + + b.HasIndex("JudgeResultTaskId"); + + b.HasIndex("JudgeVisitTaskId"); + + b.HasIndex("LatestReplyUserId"); + + b.HasIndex("SouceReadModuleId"); + + b.HasIndex("SourceSubjectVisitId"); + + b.HasIndex("SubjectCriterionClaimUserId"); + + b.HasIndex("SubjectId"); + + b.HasIndex("TrialId"); + + b.HasIndex("TrialReadingCriterionId"); + + b.ToTable("VisitTask", t => + { + t.HasComment("项目阅片 - 阅片任务表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitTaskReReading", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCopyFollowForms") + .HasColumnType("bit") + .HasComment("仅仅包括全局和访视"); + + b.Property("IsCopyOrigenalForms") + .HasColumnType("bit"); + + b.Property("NewReReadingTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("重阅申请 产生的新任务Id"); + + b.Property("OriginalReReadingTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("重阅原始任务Id 重阅会产生新的任务"); + + b.Property("RequestReReadingConfirmUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequestReReadingReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RequestReReadingRejectReason") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("RequestReReadingResultEnum") + .HasColumnType("int"); + + b.Property("RequestReReadingTime") + .HasColumnType("datetime2"); + + b.Property("RequestReReadingType") + .HasColumnType("int") + .HasComment("申请回退类型"); + + b.Property("RequestReReadingUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RootReReadingTaskId") + .HasColumnType("uniqueidentifier") + .HasComment("产生重阅的根任务Id"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("NewReReadingTaskId"); + + b.HasIndex("OriginalReReadingTaskId"); + + b.HasIndex("RequestReReadingConfirmUserId"); + + b.HasIndex("RequestReReadingUserId"); + + b.HasIndex("RootReReadingTaskId"); + + b.HasIndex("TrialId"); + + b.ToTable("VisitTaskReReading", t => + { + t.HasComment("重阅申请流程记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VolumeReward", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Max") + .HasColumnType("int"); + + b.Property("Min") + .HasColumnType("int"); + + b.Property("Price") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("VolumeReward", t => + { + t.HasComment("医生计费 - 奖励"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Workload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Adjudication") + .HasColumnType("int"); + + b.Property("AdjudicationIn24H") + .HasColumnType("int"); + + b.Property("AdjudicationIn48H") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateUserType") + .HasColumnType("int"); + + b.Property("DataFrom") + .HasColumnType("int"); + + b.Property("DoctorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Downtime") + .HasColumnType("int"); + + b.Property("Global") + .HasColumnType("int"); + + b.Property("IsLock") + .HasColumnType("bit"); + + b.Property("RefresherTraining") + .HasColumnType("int"); + + b.Property("Timepoint") + .HasColumnType("int"); + + b.Property("TimepointIn24H") + .HasColumnType("int"); + + b.Property("TimepointIn48H") + .HasColumnType("int"); + + b.Property("Training") + .HasColumnType("int"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkTime") + .HasColumnType("datetime2"); + + b.Property("YearMonth") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("DoctorWorkload", t => + { + t.HasComment("医生计费 - 工作量记录表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Infra.EFCore.TestLength", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateTimeList") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("StringList") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("TestDate") + .HasColumnType("date"); + + b.Property("TestEnumList") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("TestJsonObjectLsit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("TestLength"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Attachment", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Doctor", "Doctor") + .WithMany("AttachmentList") + .HasForeignKey("DoctorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Doctor"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CRO", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CheckChallengeDialog", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("CheckChallengeDialogList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalAnswerRowInfo", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataSystemSet", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalDataSystemSet", "ClinicalDataSystemSet") + .WithMany() + .HasForeignKey("SystemClinicalDataSetId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("ClinicalDataTrialSetList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalDataSystemSet"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalForm", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", "ClinicalDataTrialSet") + .WithMany() + .HasForeignKey("ClinicalDataTrialSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("ClinicalFormList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalDataTrialSet"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalQuestionAnswer", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalForm", "ClinicalForm") + .WithMany() + .HasForeignKey("ClinicalFormId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalForm"); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalTableAnswer", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalAnswerRowInfo", "ClinicalAnswerRowInfo") + .WithMany() + .HasForeignKey("RowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalAnswerRowInfo"); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CommonDocument", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CriterionNidusSystem", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("CriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.CriterionNidusTrial", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DataInspection", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialReadingCriterionId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany() + .HasForeignKey("VisitTaskId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialReadingCriterion"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomAE", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomInstance", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomSeries", "DicomSerie") + .WithMany("DicomInstanceList") + .HasForeignKey("SeriesId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy") + .WithMany() + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DicomSerie"); + + b.Navigation("DicomStudy"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomSeries", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy") + .WithMany("SeriesList") + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DicomStudy"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomStudy", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("StudyList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("StudyList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", null) + .WithMany("StudyList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Dictionary", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "ConfigDictionary") + .WithMany() + .HasForeignKey("ConfigTypeId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Parent") + .WithMany("ChildList") + .HasForeignKey("ParentId"); + + b.Navigation("ConfigDictionary"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Doctor", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Department") + .WithMany() + .HasForeignKey("DepartmentId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Hospital", "Hospital") + .WithMany("DoctorList") + .HasForeignKey("HospitalId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Position") + .WithMany() + .HasForeignKey("PositionId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Rank") + .WithMany() + .HasForeignKey("RankId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Speciality") + .WithMany() + .HasForeignKey("SpecialityId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Department"); + + b.Navigation("Hospital"); + + b.Navigation("Position"); + + b.Navigation("Rank"); + + b.Navigation("Speciality"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DoctorCriterionFile", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Doctor", "Doctor") + .WithMany("CriterionFileList") + .HasForeignKey("DoctorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Doctor"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DoctorDictionary", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Dictionary") + .WithMany("DoctorDicRelationList") + .HasForeignKey("DictionaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Doctor", "Doctor") + .WithMany("DoctorDicRelationList") + .HasForeignKey("DoctorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Dictionary"); + + b.Navigation("Doctor"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Education", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeUserType", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.EmailNoticeConfig", "EmailNoticeConfig") + .WithMany("EmailNoticeUserTypeList") + .HasForeignKey("EmailNoticeConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EmailNoticeConfig"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Enroll", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Doctor", "Doctor") + .WithMany("EnrollList") + .HasForeignKey("DoctorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "DoctorUser") + .WithMany() + .HasForeignKey("DoctorUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("EnrollList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Doctor"); + + b.Navigation("DoctorUser"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EnrollDetail", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Doctor", "Doctor") + .WithMany() + .HasForeignKey("DoctorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialStatusDetail", "TrialDetail") + .WithMany("IntoGroupDetails") + .HasForeignKey("TrialDetailId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Doctor"); + + b.Navigation("TrialDetail"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EnrollReadingCategory", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Enroll", "Enroll") + .WithMany("EnrollReadingCategoryList") + .HasForeignKey("EnrollId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Enroll"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EnrollReadingCriterion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Enroll", "Enroll") + .WithMany("EnrollReadingCriteriaList") + .HasForeignKey("EnrollId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Enroll"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EventStoreRecord", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ExchangeRate", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ExploreRecommend", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.FrontAuditConfig", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HIRHospital", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Hospital", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Site", "Site") + .WithMany() + .HasForeignKey("SiteId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Site"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroup", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroupIdentityUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.InspectionFile", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Internationalization", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.PublishLog", "PublishLog") + .WithMany() + .HasForeignKey("PublishLogId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("PublishLog"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Menu", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.NoneDicomStudy", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany() + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("NoneDicomStudyList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.NoneDicomStudyFile", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.NoneDicomStudy", "NoneDicomStudy") + .WithMany("NoneDicomFileList") + .HasForeignKey("NoneDicomStudyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.NoneDicomStudy", "OriginNoneDicomStudy") + .WithMany("TaskNoneDicomFileList") + .HasForeignKey("OriginNoneDicomStudyId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany("TaskNoneDicomStudyFileList") + .HasForeignKey("VisitTaskId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("NoneDicomStudy"); + + b.Navigation("OriginNoneDicomStudy"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.OrganInfo", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.OrganTrialInfo", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.OrganInfo", "OrganInfo") + .WithMany() + .HasForeignKey("OrganInfoId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("OrganInfo"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PIAudit", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany() + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Payment", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PaymentAdjustment", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PaymentDetail", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Postgraduate", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousHistory", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("PreviousHistoryList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousOther", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("PreviousOtherList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousPDF", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("PreviousPDFList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PreviousSurgery", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", null) + .WithMany("PreviousSurgeryList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.PublishLog", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.QCChallenge", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "LatestReplyUser") + .WithMany() + .HasForeignKey("LatestReplyUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("QCChallengeList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("LatestReplyUser"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.QCChallengeDialog", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.QCChallenge", "QCChallenge") + .WithMany("DialogList") + .HasForeignKey("QCChallengeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", null) + .WithMany("QCChallengeDialogList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("QCChallenge"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.QCQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.QCQuestion", "ParentQuestion") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("ParentQuestion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.RankPrice", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadModule", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingPeriodSet", "ReadingPeriodSet") + .WithMany() + .HasForeignKey("ReadingPeriodSetId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("ReadModuleList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("ReadModuleList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("ReadModuleList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ReadingPeriodSet"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + + b.Navigation("Trial"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadModuleCriterionFrom", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalForm", "ClinicalForm") + .WithMany() + .HasForeignKey("ClinicalFormId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadModule", null) + .WithMany("ReadModuleCriterionFromList") + .HasForeignKey("ReadModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalForm"); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingClinicalData", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", "ClinicalDataTrialSet") + .WithMany("ReadingClinicalDataList") + .HasForeignKey("ClinicalDataTrialSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadModule", "ReadModule") + .WithMany("ReadingClinicalDataList") + .HasForeignKey("ReadingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("ReadingClinicalDataList") + .HasForeignKey("ReadingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy") + .WithMany("ReadingClinicalDataList") + .HasForeignKey("StudyId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("ClinicalDataList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("ReadingClinicalDataList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalDataTrialSet"); + + b.Navigation("CreateUserRole"); + + b.Navigation("DicomStudy"); + + b.Navigation("ReadModule"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingClinicalDataPDF", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingClinicalData", "ReadingClinicalData") + .WithMany("ReadingClinicalDataPDFList") + .HasForeignKey("ReadingClinicalDataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ReadingClinicalData"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingConsistentClinicalData", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", "ClinicalDataTrialSet") + .WithMany() + .HasForeignKey("ClinicalDataTrialSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadModule", "ReadModule") + .WithMany() + .HasForeignKey("ReadingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("ReadingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy") + .WithMany("ReadingConsistentClinicalDataList") + .HasForeignKey("StudyId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany() + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalDataTrialSet"); + + b.Navigation("CreateUserRole"); + + b.Navigation("DicomStudy"); + + b.Navigation("ReadModule"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingConsistentClinicalDataPDF", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingConsistentClinicalData", "ReadingConsistentClinicalData") + .WithMany("ReadingClinicalDataPDFList") + .HasForeignKey("ReadingConsistentClinicalDataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ReadingConsistentClinicalData"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingCriterionPage", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingCustomTag", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "GlobalVisitTask") + .WithMany("GlobalVisitResultList") + .HasForeignKey("GlobalTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "TrialReadingQuestion") + .WithMany() + .HasForeignKey("QuestionId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany() + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("GlobalVisitTask"); + + b.Navigation("TrialReadingQuestion"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingJudgeInfo", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicalReviewDialog", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TaskMedicalReview", "TaskMedicalReview") + .WithMany("ReadingMedicalReviewDialogList") + .HasForeignKey("TaskMedicalReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TaskMedicalReview"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicineQuestionAnswer", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TaskMedicalReview", "TaskMedicalReview") + .WithMany() + .HasForeignKey("TaskMedicalReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TaskMedicalReview"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicineSystemQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingMedicineSystemQuestion", "ParentQuestion") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("ParentQuestion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingMedicineTrialQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingMedicineTrialQuestion", "ParentQuestion") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("ParentQuestion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "OncologyVisitTask") + .WithMany() + .HasForeignKey("OncologyTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany() + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("OncologyVisitTask"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingPeriodPlan", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingPeriodSet", "ReadingPeriodSet") + .WithMany("ReadingPeriodPlanList") + .HasForeignKey("ReadingPeriodSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ReadingPeriodSet"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingPeriodSet", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitStage", "VisitStage") + .WithMany() + .HasForeignKey("VisitStageId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("VisitStage"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingPeriodSite", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingPeriodSet", "ReadingPeriodSet") + .WithMany("ReadingPeriodSites") + .HasForeignKey("ReadingPeriodSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany() + .HasForeignKey("TrialSiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ReadingPeriodSet"); + + b.Navigation("TrialSite"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialReadingCriterionList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionSystem", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionSystem", "GroupInfo") + .WithMany() + .HasForeignKey("GroupId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionSystem", "ParentReadingQuestionSystem") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem", "ReadingQuestionCriterionSystem") + .WithMany("ReadingQuestionSystemList") + .HasForeignKey("ReadingQuestionCriterionSystemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionSystem", "RelevanceReadingQuestionSystem") + .WithMany() + .HasForeignKey("RelevanceId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("GroupInfo"); + + b.Navigation("ParentReadingQuestionSystem"); + + b.Navigation("ReadingQuestionCriterionSystem"); + + b.Navigation("RelevanceReadingQuestionSystem"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "GroupInfo") + .WithMany() + .HasForeignKey("GroupId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "ParentReadingQuestionTrial") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingCriterionPage", "ReadingCriterionPage") + .WithMany("ReadingQuestionList") + .HasForeignKey("ReadingCriterionPageId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "ReadingQuestionCriterionTrial") + .WithMany() + .HasForeignKey("ReadingQuestionCriterionTrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "RelevanceReadingQuestionTrial") + .WithMany() + .HasForeignKey("RelevanceId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("GroupInfo"); + + b.Navigation("ParentReadingQuestionTrial"); + + b.Navigation("ReadingCriterionPage"); + + b.Navigation("ReadingQuestionCriterionTrial"); + + b.Navigation("RelevanceReadingQuestionTrial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Dictionary") + .WithMany() + .HasForeignKey("DictionaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Dictionary"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomInstance", "Instance") + .WithMany("ReadingTableAnswerRowInfoList") + .HasForeignKey("InstanceId") + .HasPrincipalKey("Id"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo", "MergeRow") + .WithMany() + .HasForeignKey("MergeRowId"); + + b.HasOne("IRaCIS.Core.Domain.Models.OrganInfo", "OrganInfo") + .WithMany() + .HasForeignKey("OrganInfoId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "ReadingQuestionTrial") + .WithMany() + .HasForeignKey("QuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo", "SplitRow") + .WithMany() + .HasForeignKey("SplitRowId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany("LesionList") + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Instance"); + + b.Navigation("MergeRow"); + + b.Navigation("OrganInfo"); + + b.Navigation("ReadingQuestionTrial"); + + b.Navigation("SplitRow"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "ReadingQuestionTrial") + .WithMany() + .HasForeignKey("QuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo", "Lesion") + .WithMany("LesionAnswerList") + .HasForeignKey("RowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial", "ReadingTableQuestionTrial") + .WithMany() + .HasForeignKey("TableQuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany() + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Lesion"); + + b.Navigation("ReadingQuestionTrial"); + + b.Navigation("ReadingTableQuestionTrial"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem", "DependParentQuestion") + .WithMany() + .HasForeignKey("DependParentId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionSystem", "ReadingQuestionSystem") + .WithMany("ReadingTableQuestionTrialList") + .HasForeignKey("ReadingQuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DependParentQuestion"); + + b.Navigation("ReadingQuestionSystem"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial", "DependParentQuestion") + .WithMany() + .HasForeignKey("DependParentId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "ReadingQuestionTrial") + .WithMany("ReadingTableQuestionTrialList") + .HasForeignKey("ReadingQuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DependParentQuestion"); + + b.Navigation("ReadingQuestionTrial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "ReadingQuestionTrial") + .WithMany() + .HasForeignKey("ReadingQuestionTrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", null) + .WithMany("ReadingTaskQuestionAnswerList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany("ReadingTaskQuestionAnswerList") + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ReadingQuestionTrial"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "ReadingQuestionTrial") + .WithMany() + .HasForeignKey("QuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany() + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ReadingQuestionTrial"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTaskRelation", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany() + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("CriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Dictionary") + .WithMany() + .HasForeignKey("DictionaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Dictionary"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ResearchPublication", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReviewerPayInformation", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPImageUpload", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPInstance", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SCPSeries", "SCPSeries") + .WithMany("SCPInstanceList") + .HasForeignKey("SeriesId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy") + .WithMany("InstanceList") + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SCPSeries"); + + b.Navigation("SCPStudy"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPPatient", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPSeries", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy") + .WithMany("SeriesList") + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SCPStudy"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPStudy", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SCPPatient", "Patient") + .WithMany("SCPStudyList") + .HasForeignKey("PatientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany() + .HasForeignKey("TrialSiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Patient"); + + b.Navigation("SubjectVisit"); + + b.Navigation("Trial"); + + b.Navigation("TrialSite"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPStudySubjectVisit", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy") + .WithMany("SCPStudySubjectVisitList") + .HasForeignKey("SCPStudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany() + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("SCPStudySubjectVisitList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SCPStudy"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ShortcutKey", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Site", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Hospital", "Hospital") + .WithMany() + .HasForeignKey("HospitalId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Hospital"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Sponsor", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.StudyMonitor", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy") + .WithMany("DicomStudyMonitorList") + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.NoneDicomStudy", "NoneDicomStudy") + .WithMany() + .HasForeignKey("StudyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TaskStudy", "TaskStudy") + .WithMany() + .HasForeignKey("StudyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany() + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DicomStudy"); + + b.Navigation("NoneDicomStudy"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + + b.Navigation("TaskStudy"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubejctVisitDownload", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SubjectVisit"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Subject", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "FinalSubjectVisit") + .WithMany() + .HasForeignKey("FinalSubjectVisitId"); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "LatestSubjectVisit") + .WithMany() + .HasForeignKey("LatestSubjectVisitId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("SubjectList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany("SubjectList") + .HasForeignKey("TrialSiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("FinalSubjectVisit"); + + b.Navigation("LatestSubjectVisit"); + + b.Navigation("Trial"); + + b.Navigation("TrialSite"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectAdditionalEvaluationResult", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", null) + .WithMany("SubjectAdditionalEvaluationResult") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", "TrialReadingQuestion") + .WithMany() + .HasForeignKey("TrialReadingQuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialReadingQuestion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCanceDoctor", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("SubjectCanceDoctorList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCriteriaEvaluation", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "subject") + .WithMany("SubjectCriteriaEvaluationList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialReadingCriterion"); + + b.Navigation("subject"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCriteriaEvaluationVisitFilter", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", null) + .WithMany("SubjectCriteriaEvaluationVisitFilterList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany("SubjectCriteriaEvaluationVisitFilterList") + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SubjectVisit"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectCriteriaEvaluationVisitStudyFilter", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomSeries", "Series") + .WithMany("SubjectCriteriaEvaluationVisitStudyFilterList") + .HasForeignKey("SeriesId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "Study") + .WithMany("SubjectCriteriaEvaluationVisitStudyFilterList") + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Series"); + + b.Navigation("Study"); + + b.Navigation("SubjectVisit"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectPatient", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SCPPatient", "Patient") + .WithMany("SubjectPatientList") + .HasForeignKey("PatientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("SubjectPatientList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Patient"); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectPatientSCPStudy", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "DoctorUser") + .WithMany() + .HasForeignKey("DoctorUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectUser", "ReplacedSubjectUser") + .WithMany("EarlierSubjectUserList") + .HasForeignKey("ReplacedSubjectUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("SubjectDoctorList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("SubjectDoctorUserList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DoctorUser"); + + b.Navigation("ReplacedSubjectUser"); + + b.Navigation("Subject"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectVisit", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CurrentActionUser") + .WithMany() + .HasForeignKey("CurrentActionUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "ForwardUser") + .WithMany() + .HasForeignKey("ForwardUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "OutPlanPreviousVisit") + .WithMany() + .HasForeignKey("OutPlanPreviousVisitId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "PreliminaryAuditUser") + .WithMany() + .HasForeignKey("PreliminaryAuditUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "ReviewAuditUser") + .WithMany() + .HasForeignKey("ReviewAuditUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("SubjectVisitList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "SubmitUser") + .WithMany() + .HasForeignKey("SubmitUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("SubjectVisitList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany("SubjectVisitList") + .HasForeignKey("TrialSiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("CurrentActionUser"); + + b.Navigation("ForwardUser"); + + b.Navigation("OutPlanPreviousVisit"); + + b.Navigation("PreliminaryAuditUser"); + + b.Navigation("ReviewAuditUser"); + + b.Navigation("Subject"); + + b.Navigation("SubmitUser"); + + b.Navigation("Trial"); + + b.Navigation("TrialSite"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectVisitClinicalDialog", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemAnonymization", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemBasicData", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SystemBasicData", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemClinicalQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SystemClinicalQuestion", "GroupQuestin") + .WithMany() + .HasForeignKey("GroupId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("GroupQuestin"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemClinicalTableQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemCriterionDictionaryCode", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNotice", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "PublishedUser") + .WithMany() + .HasForeignKey("PublishedUserId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("PublishedUser"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNoticeUserRead", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SystemNotice", null) + .WithMany("NoticeUserReadList") + .HasForeignKey("SystemNoticeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNoticeUserType", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SystemNotice", null) + .WithMany("NoticeUserTypeList") + .HasForeignKey("SystemNoticeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserType", "NoticeUserType") + .WithMany() + .HasForeignKey("UserTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("NoticeUserType"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskAllocationRule", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "DoctorUser") + .WithMany() + .HasForeignKey("DoctorUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Enroll", "Enroll") + .WithMany() + .HasForeignKey("EnrollId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DoctorUser"); + + b.Navigation("Enroll"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskConsistentRule", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TaskConsistentRuleList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskInfluence", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "InfluenceTask") + .WithMany() + .HasForeignKey("InfluenceTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "OriginalTask") + .WithMany("TaskInfluenceList") + .HasForeignKey("OriginalTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("InfluenceTask"); + + b.Navigation("OriginalTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskInstance", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TaskSeries", "TaskSeries") + .WithMany("InstanceList") + .HasForeignKey("SeriesId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TaskStudy", "TaskStudy") + .WithMany("InstanceList") + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TaskSeries"); + + b.Navigation("TaskStudy"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskMedicalReview", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "LatestReplyUser") + .WithMany() + .HasForeignKey("LatestReplyUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "MedicalManagerUser") + .WithMany() + .HasForeignKey("MedicalManagerUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TaskMedicalReviewList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany("TaskMedicalReviewList") + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("LatestReplyUser"); + + b.Navigation("MedicalManagerUser"); + + b.Navigation("Trial"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskMedicalReviewRule", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "DoctorUser") + .WithMany() + .HasForeignKey("DoctorUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DoctorUser"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskSeries", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TaskStudy", "TaskStudy") + .WithMany("SeriesList") + .HasForeignKey("StudyId") + .HasPrincipalKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TaskStudy"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskStudy", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("TaskStudyList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany("TaskStudyList") + .HasForeignKey("VisitTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Subject"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Trial", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "IndicationType") + .WithMany() + .HasForeignKey("IndicationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Phase") + .WithMany() + .HasForeignKey("PhaseId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "QCQuestionConfirmedUser") + .WithMany() + .HasForeignKey("QCQuestionConfirmedUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "ReviewMode") + .WithMany() + .HasForeignKey("ReviewModeId"); + + b.OwnsMany("IRaCIS.Core.Domain.Models.TrialObjectNameConfig", "TrialObjectNameList", b1 => + { + b1.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("IsDefault") + .HasColumnType("bit"); + + b1.Property("Name") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b1.Property("TrialName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b1.HasKey("TrialId", "Id"); + + b1.ToTable("Trial"); + + b1.ToJson("TrialObjectNameList"); + + b1.WithOwner() + .HasForeignKey("TrialId"); + }); + + b.Navigation("CreateUserRole"); + + b.Navigation("IndicationType"); + + b.Navigation("Phase"); + + b.Navigation("QCQuestionConfirmedUser"); + + b.Navigation("ReviewMode"); + + b.Navigation("TrialObjectNameList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialBodyPart", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialBodyPartList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialClinicalDataSetCriterion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", "TrialClinicalDataSet") + .WithMany("TrialClinicalDataSetCriteriaList") + .HasForeignKey("TrialClinicalDataSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany("TrialClinicalDataSetCriterionList") + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialClinicalDataSet"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialClinicalQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialClinicalQuestion", "GroupQuestin") + .WithMany() + .HasForeignKey("GroupId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", "ClinicalDataTrialSet") + .WithMany("TrialClinicalQuestionList") + .HasForeignKey("TrialClinicalId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClinicalDataTrialSet"); + + b.Navigation("CreateUserRole"); + + b.Navigation("GroupQuestin"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialClinicalTableQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialCriterionAdditionalAssessmentType", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany("TrialCriterionAdditionalAssessmentTypeList") + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialCriterionDictionaryCode", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDicomAE", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDictionary", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Dictionary") + .WithMany() + .HasForeignKey("DictionaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialDicList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Dictionary"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailBlackUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig", "TrialEmailNoticeConfig") + .WithMany("TrialEmailBlackUserList") + .HasForeignKey("TrialEmailNoticeConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TrialEmailNoticeConfig"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.EmailNoticeConfig", "SysEmailNoticeConfig") + .WithMany("TrialEmailNoticeConfigList") + .HasForeignKey("SysEmailNoticeConfigId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany() + .HasForeignKey("TrialReadingCriterionId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("SysEmailNoticeConfig"); + + b.Navigation("Trial"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailNoticeUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig", "TrialEmailNoticeConfig") + .WithMany("TrialEmailNoticeUserList") + .HasForeignKey("TrialEmailNoticeConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TrialEmailNoticeConfig"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialExperience", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Phase") + .WithMany() + .HasForeignKey("PhaseId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Phase"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialExperienceCriteria", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.Doctor", null) + .WithMany("TrialExperienceCriteriaList") + .HasForeignKey("DoctorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "EvaluationCriteria") + .WithMany() + .HasForeignKey("EvaluationCriteriaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialExperience", null) + .WithMany("ExperienceCriteriaList") + .HasForeignKey("TrialExperienceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EvaluationCriteria"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialExternalUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialIdentityUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "IdentityUser") + .WithMany("UserTrialList") + .HasForeignKey("IdentityUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("IdentityUser"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialImageDownload", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany() + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Subject"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialPaymentPrice", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialQCQuestion", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialQCQuestion", "ParentQCQuestion") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("ParentQCQuestion"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialQCQuestionAnswer", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialQCQuestion", "TrialQCQuestionConfigure") + .WithMany("TrialQCQuestionAnswerList") + .HasForeignKey("TrialQCQuestionConfigureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialQCQuestionConfigure"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialRevenuesPrice", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSign", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSite", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Site", "Site") + .WithMany("TrialSiteList") + .HasForeignKey("SiteId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialSiteList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Site"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteDicomAE", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany("TrialSiteDicomAEList") + .HasForeignKey("TrialSiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialSite"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteEquipmentSurvey", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "EquipmentType") + .WithMany() + .HasForeignKey("EquipmentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSiteSurvey", "TrialSiteSurvey") + .WithMany("TrialSiteEquipmentSurveyList") + .HasForeignKey("TrialSiteSurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("EquipmentType"); + + b.Navigation("TrialSiteSurvey"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteSurvey", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "PreliminaryUser") + .WithMany() + .HasForeignKey("PreliminaryUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "ReviewerUser") + .WithMany() + .HasForeignKey("ReviewerUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialSiteSurveyList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany("TrialSiteSurveyList") + .HasForeignKey("TrialSiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("PreliminaryUser"); + + b.Navigation("ReviewerUser"); + + b.Navigation("Trial"); + + b.Navigation("TrialSite"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialSiteUserList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany("CRCUserList") + .HasForeignKey("TrialSiteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + + b.Navigation("TrialSite"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteUserSurvey", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSiteSurvey", "TrialSiteSurvey") + .WithMany("TrialSiteUserSurveyList") + .HasForeignKey("TrialSiteSurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserType", "UserTypeRole") + .WithMany() + .HasForeignKey("UserTypeId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("TrialSiteSurvey"); + + b.Navigation("UserTypeRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialStateChange", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialStateChangeList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialStatusDetail", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("ClinicalTrialProjectDetails") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialUserRole", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany("UserTrials") + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("TrialUserList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialIdentityUser", "TrialUser") + .WithMany("TrialUserRoleList") + .HasForeignKey("TrialUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "UserRole") + .WithMany("UserRoleTrials") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + + b.Navigation("TrialUser"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialVirtualSiteCodeUpdate", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserFeedBack", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany() + .HasForeignKey("SubjectId"); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("SubjectVisitId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("UserFeedBackList") + .HasForeignKey("TrialId"); + + b.HasOne("IRaCIS.Core.Domain.Models.TrialSite", "TrialSite") + .WithMany() + .HasForeignKey("TrialSiteId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask") + .WithMany("UserFeedBackList") + .HasForeignKey("VisitTaskId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Subject"); + + b.Navigation("SubjectVisit"); + + b.Navigation("Trial"); + + b.Navigation("TrialSite"); + + b.Navigation("VisitTask"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserLog", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "ActionIdentityUser") + .WithMany() + .HasForeignKey("ActionIdentityUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "TargetIdentityUser") + .WithMany() + .HasForeignKey("TargetIdentityUserId"); + + b.Navigation("ActionIdentityUser"); + + b.Navigation("CreateUserRole"); + + b.Navigation("TargetIdentityUser"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserPassWordLog", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserRole", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Doctor", null) + .WithOne("User") + .HasForeignKey("IRaCIS.Core.Domain.Models.UserRole", "DoctorId"); + + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "IdentityUser") + .WithMany("UserRoleList") + .HasForeignKey("IdentityUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserType", "UserTypeRole") + .WithMany("UserList") + .HasForeignKey("UserTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("IdentityUser"); + + b.Navigation("UserTypeRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserTypeGroup", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "Group") + .WithMany() + .HasForeignKey("DictionaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserType", "UserType") + .WithMany("UserTypeGroupList") + .HasForeignKey("UserTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Group"); + + b.Navigation("UserType"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserTypeMenu", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.Menu", "Menu") + .WithMany("UserTypeMenuList") + .HasForeignKey("MenuId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserType", "UserType") + .WithMany("UserTypeMenuList") + .HasForeignKey("UserTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Menu"); + + b.Navigation("UserType"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserWLTemplate", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Vacation", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VerificationCode", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitPlanInfluenceStat", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitPlanInfluenceStudy", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SubjectVisit") + .WithMany() + .HasForeignKey("SubjectVisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitPlanInfluenceStat", "VisitPlanInfluenceStat") + .WithMany("InfluenceStudyList") + .HasForeignKey("VisitPlanInfluenceStatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("SubjectVisit"); + + b.Navigation("VisitPlanInfluenceStat"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitStage", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitTask", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "DoctorUser") + .WithMany("VisitTaskList") + .HasForeignKey("DoctorUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "FirstAuditUser") + .WithMany() + .HasForeignKey("FirstAuditUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "JudgeResultTask") + .WithMany() + .HasForeignKey("JudgeResultTaskId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "JudgeVisitTask") + .WithMany("JudgeVisitList") + .HasForeignKey("JudgeVisitTaskId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "LatestReplyUser") + .WithMany() + .HasForeignKey("LatestReplyUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadModule", "ReadModule") + .WithMany("ModuleTaskList") + .HasForeignKey("SouceReadModuleId"); + + b.HasOne("IRaCIS.Core.Domain.Models.SubjectVisit", "SourceSubjectVisit") + .WithMany("VisitTaskList") + .HasForeignKey("SourceSubjectVisitId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "SubjectCriterionClaimUser") + .WithMany() + .HasForeignKey("SubjectCriterionClaimUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.Subject", "Subject") + .WithMany("SubjectVisitTaskList") + .HasForeignKey("SubjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("VisitTaskList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", "TrialReadingCriterion") + .WithMany("VisitTaskList") + .HasForeignKey("TrialReadingCriterionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("DoctorUser"); + + b.Navigation("FirstAuditUser"); + + b.Navigation("JudgeResultTask"); + + b.Navigation("JudgeVisitTask"); + + b.Navigation("LatestReplyUser"); + + b.Navigation("ReadModule"); + + b.Navigation("SourceSubjectVisit"); + + b.Navigation("Subject"); + + b.Navigation("SubjectCriterionClaimUser"); + + b.Navigation("Trial"); + + b.Navigation("TrialReadingCriterion"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitTaskReReading", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "NewReReadingTask") + .WithMany() + .HasForeignKey("NewReReadingTaskId"); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "OriginalReReadingTask") + .WithMany() + .HasForeignKey("OriginalReReadingTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "RequestReReadingConfirmUser") + .WithMany() + .HasForeignKey("RequestReReadingConfirmUserId"); + + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "RequestReReadingUser") + .WithMany() + .HasForeignKey("RequestReReadingUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "RootReReadingTask") + .WithMany() + .HasForeignKey("RootReReadingTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany("VisitTaskReReadingList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("NewReReadingTask"); + + b.Navigation("OriginalReReadingTask"); + + b.Navigation("RequestReReadingConfirmUser"); + + b.Navigation("RequestReReadingUser"); + + b.Navigation("RootReReadingTask"); + + b.Navigation("Trial"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VolumeReward", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Workload", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", null) + .WithMany("WorkloadList") + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", b => + { + b.Navigation("ReadingClinicalDataList"); + + b.Navigation("TrialClinicalDataSetCriteriaList"); + + b.Navigation("TrialClinicalQuestionList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomInstance", b => + { + b.Navigation("ReadingTableAnswerRowInfoList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomSeries", b => + { + b.Navigation("DicomInstanceList"); + + b.Navigation("SubjectCriteriaEvaluationVisitStudyFilterList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.DicomStudy", b => + { + b.Navigation("DicomStudyMonitorList"); + + b.Navigation("ReadingClinicalDataList"); + + b.Navigation("ReadingConsistentClinicalDataList"); + + b.Navigation("SeriesList"); + + b.Navigation("SubjectCriteriaEvaluationVisitStudyFilterList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Dictionary", b => + { + b.Navigation("ChildList"); + + b.Navigation("DoctorDicRelationList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Doctor", b => + { + b.Navigation("AttachmentList"); + + b.Navigation("CriterionFileList"); + + b.Navigation("DoctorDicRelationList"); + + b.Navigation("EnrollList"); + + b.Navigation("TrialExperienceCriteriaList"); + + b.Navigation("User") + .IsRequired(); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b => + { + b.Navigation("EmailNoticeUserTypeList"); + + b.Navigation("TrialEmailNoticeConfigList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Enroll", b => + { + b.Navigation("EnrollReadingCategoryList"); + + b.Navigation("EnrollReadingCriteriaList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Hospital", b => + { + b.Navigation("DoctorList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b => + { + b.Navigation("UserRoleList"); + + b.Navigation("UserTrialList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Menu", b => + { + b.Navigation("UserTypeMenuList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.NoneDicomStudy", b => + { + b.Navigation("NoneDicomFileList"); + + b.Navigation("TaskNoneDicomFileList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.QCChallenge", b => + { + b.Navigation("DialogList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadModule", b => + { + b.Navigation("ModuleTaskList"); + + b.Navigation("ReadModuleCriterionFromList"); + + b.Navigation("ReadingClinicalDataList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingClinicalData", b => + { + b.Navigation("ReadingClinicalDataPDFList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingConsistentClinicalData", b => + { + b.Navigation("ReadingClinicalDataPDFList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingCriterionPage", b => + { + b.Navigation("ReadingQuestionList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingPeriodSet", b => + { + b.Navigation("ReadingPeriodPlanList"); + + b.Navigation("ReadingPeriodSites"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem", b => + { + b.Navigation("ReadingQuestionSystemList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial", b => + { + b.Navigation("TrialClinicalDataSetCriterionList"); + + b.Navigation("TrialCriterionAdditionalAssessmentTypeList"); + + b.Navigation("VisitTaskList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionSystem", b => + { + b.Navigation("ReadingTableQuestionTrialList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingQuestionTrial", b => + { + b.Navigation("ReadingTableQuestionTrialList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo", b => + { + b.Navigation("LesionAnswerList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPPatient", b => + { + b.Navigation("SCPStudyList"); + + b.Navigation("SubjectPatientList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPSeries", b => + { + b.Navigation("SCPInstanceList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPStudy", b => + { + b.Navigation("InstanceList"); + + b.Navigation("SCPStudySubjectVisitList"); + + b.Navigation("SeriesList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Site", b => + { + b.Navigation("TrialSiteList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Subject", b => + { + b.Navigation("ClinicalDataList"); + + b.Navigation("ClinicalFormList"); + + b.Navigation("ReadModuleList"); + + b.Navigation("ReadingTaskQuestionAnswerList"); + + b.Navigation("StudyList"); + + b.Navigation("SubjectAdditionalEvaluationResult"); + + b.Navigation("SubjectCanceDoctorList"); + + b.Navigation("SubjectCriteriaEvaluationList"); + + b.Navigation("SubjectCriteriaEvaluationVisitFilterList"); + + b.Navigation("SubjectDoctorList"); + + b.Navigation("SubjectPatientList"); + + b.Navigation("SubjectVisitList"); + + b.Navigation("SubjectVisitTaskList"); + + b.Navigation("TaskStudyList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectUser", b => + { + b.Navigation("EarlierSubjectUserList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SubjectVisit", b => + { + b.Navigation("CheckChallengeDialogList"); + + b.Navigation("NoneDicomStudyList"); + + b.Navigation("PreviousHistoryList"); + + b.Navigation("PreviousOtherList"); + + b.Navigation("PreviousPDFList"); + + b.Navigation("PreviousSurgeryList"); + + b.Navigation("QCChallengeDialogList"); + + b.Navigation("QCChallengeList"); + + b.Navigation("ReadModuleList"); + + b.Navigation("ReadingClinicalDataList"); + + b.Navigation("SCPStudySubjectVisitList"); + + b.Navigation("StudyList"); + + b.Navigation("SubjectCriteriaEvaluationVisitFilterList"); + + b.Navigation("VisitTaskList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNotice", b => + { + b.Navigation("NoticeUserReadList"); + + b.Navigation("NoticeUserTypeList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskMedicalReview", b => + { + b.Navigation("ReadingMedicalReviewDialogList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskSeries", b => + { + b.Navigation("InstanceList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskStudy", b => + { + b.Navigation("InstanceList"); + + b.Navigation("SeriesList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Trial", b => + { + b.Navigation("ClinicalDataTrialSetList"); + + b.Navigation("ClinicalTrialProjectDetails"); + + b.Navigation("EnrollList"); + + b.Navigation("ReadModuleList"); + + b.Navigation("ReadingClinicalDataList"); + + b.Navigation("StudyList"); + + b.Navigation("SubjectDoctorUserList"); + + b.Navigation("SubjectList"); + + b.Navigation("SubjectVisitList"); + + b.Navigation("TaskConsistentRuleList"); + + b.Navigation("TaskMedicalReviewList"); + + b.Navigation("TrialBodyPartList"); + + b.Navigation("TrialDicList"); + + b.Navigation("TrialReadingCriterionList"); + + b.Navigation("TrialSiteList"); + + b.Navigation("TrialSiteSurveyList"); + + b.Navigation("TrialSiteUserList"); + + b.Navigation("TrialStateChangeList"); + + b.Navigation("TrialUserList"); + + b.Navigation("UserFeedBackList"); + + b.Navigation("VisitTaskList"); + + b.Navigation("VisitTaskReReadingList"); + + b.Navigation("WorkloadList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig", b => + { + b.Navigation("TrialEmailBlackUserList"); + + b.Navigation("TrialEmailNoticeUserList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialExperience", b => + { + b.Navigation("ExperienceCriteriaList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialIdentityUser", b => + { + b.Navigation("TrialUserRoleList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialQCQuestion", b => + { + b.Navigation("TrialQCQuestionAnswerList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSite", b => + { + b.Navigation("CRCUserList"); + + b.Navigation("SubjectList"); + + b.Navigation("SubjectVisitList"); + + b.Navigation("TrialSiteDicomAEList"); + + b.Navigation("TrialSiteSurveyList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteSurvey", b => + { + b.Navigation("TrialSiteEquipmentSurveyList"); + + b.Navigation("TrialSiteUserSurveyList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialStatusDetail", b => + { + b.Navigation("IntoGroupDetails"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserRole", b => + { + b.Navigation("UserRoleTrials"); + + b.Navigation("UserTrials"); + + b.Navigation("VisitTaskList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserType", b => + { + b.Navigation("UserList"); + + b.Navigation("UserTypeGroupList"); + + b.Navigation("UserTypeMenuList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitPlanInfluenceStat", b => + { + b.Navigation("InfluenceStudyList"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.VisitTask", b => + { + b.Navigation("GlobalVisitResultList"); + + b.Navigation("JudgeVisitList"); + + b.Navigation("LesionList"); + + b.Navigation("ReadingTaskQuestionAnswerList"); + + b.Navigation("TaskInfluenceList"); + + b.Navigation("TaskMedicalReviewList"); + + b.Navigation("TaskNoneDicomStudyFileList"); + + b.Navigation("TaskStudyList"); + + b.Navigation("UserFeedBackList"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.cs b/IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.cs new file mode 100644 index 000000000..70161e424 --- /dev/null +++ b/IRaCIS.Core.Infra.EFCore/Migrations/20250815014752_secondUserModify.cs @@ -0,0 +1,364 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IRaCIS.Core.Infra.EFCore.Migrations +{ + /// + public partial class secondUserModify : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "SystemDocConfirmedUser"); + + migrationBuilder.DropTable( + name: "SystemDocNeedConfirmedUserType"); + + migrationBuilder.DropTable( + name: "TrialDocConfirmedUser"); + + migrationBuilder.DropTable( + name: "TrialDocNeedConfirmedUserType"); + + migrationBuilder.DropTable( + name: "SystemDocument"); + + migrationBuilder.DropTable( + name: "TrialDocument"); + + migrationBuilder.AddColumn( + name: "IsUserRoleDisabled", + table: "User", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "TrialId", + table: "IdentityUser", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityUser_TrialId", + table: "IdentityUser", + column: "TrialId"); + + migrationBuilder.AddForeignKey( + name: "FK_IdentityUser_Trial_TrialId", + table: "IdentityUser", + column: "TrialId", + principalTable: "Trial", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_IdentityUser_Trial_TrialId", + table: "IdentityUser"); + + migrationBuilder.DropIndex( + name: "IX_IdentityUser_TrialId", + table: "IdentityUser"); + + migrationBuilder.DropColumn( + name: "IsUserRoleDisabled", + table: "User"); + + migrationBuilder.DropColumn( + name: "TrialId", + table: "IdentityUser"); + + migrationBuilder.CreateTable( + name: "SystemDocument", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), + FileTypeId = table.Column(type: "uniqueidentifier", nullable: false), + CreateTime = table.Column(type: "datetime2", nullable: false), + DeleteUserId = table.Column(type: "uniqueidentifier", nullable: true), + DeletedTime = table.Column(type: "datetime2", nullable: true), + DocUserSignType = table.Column(type: "int", nullable: false), + IsDeleted = table.Column(type: "bit", nullable: false), + Name = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: false), + Path = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false), + SignViewMinimumMinutes = table.Column(type: "int", nullable: false), + UpdateTime = table.Column(type: "datetime2", nullable: false), + UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SystemDocument", x => x.Id); + table.ForeignKey( + name: "FK_SystemDocument_Dictionary_FileTypeId", + column: x => x.FileTypeId, + principalTable: "Dictionary", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SystemDocument_User_CreateUserId", + column: x => x.CreateUserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "后台 - 系统签署文档"); + + migrationBuilder.CreateTable( + name: "TrialDocument", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), + FileTypeId = table.Column(type: "uniqueidentifier", nullable: false, comment: "需要确认的项目用户 通过TrialId 关联 用中间表过滤"), + TrialId = table.Column(type: "uniqueidentifier", nullable: false), + CreateTime = table.Column(type: "datetime2", nullable: false), + DeleteUserId = table.Column(type: "uniqueidentifier", nullable: true), + DeletedTime = table.Column(type: "datetime2", nullable: true), + Description = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: false), + IsDeleted = table.Column(type: "bit", nullable: false), + Name = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: false), + Path = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: false), + SignViewMinimumMinutes = table.Column(type: "int", nullable: false), + UpdateTime = table.Column(type: "datetime2", nullable: false), + UpdateUserId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TrialDocument", x => x.Id); + table.ForeignKey( + name: "FK_TrialDocument_Dictionary_FileTypeId", + column: x => x.FileTypeId, + principalTable: "Dictionary", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TrialDocument_Trial_TrialId", + column: x => x.TrialId, + principalTable: "Trial", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TrialDocument_User_CreateUserId", + column: x => x.CreateUserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "项目 - 项目文档"); + + migrationBuilder.CreateTable( + name: "SystemDocConfirmedUser", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ConfirmUserId = table.Column(type: "uniqueidentifier", nullable: false), + CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), + SystemDocumentId = table.Column(type: "uniqueidentifier", nullable: false), + ConfirmTime = table.Column(type: "datetime2", nullable: true), + CreateTime = table.Column(type: "datetime2", nullable: false), + DeleteUserId = table.Column(type: "uniqueidentifier", nullable: true), + DeletedTime = table.Column(type: "datetime2", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + SignFirstViewTime = table.Column(type: "datetime2", nullable: true), + SignText = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SystemDocConfirmedUser", x => x.Id); + table.ForeignKey( + name: "FK_SystemDocConfirmedUser_SystemDocument_SystemDocumentId", + column: x => x.SystemDocumentId, + principalTable: "SystemDocument", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SystemDocConfirmedUser_User_ConfirmUserId", + column: x => x.ConfirmUserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SystemDocConfirmedUser_User_CreateUserId", + column: x => x.CreateUserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "后台 - 系统文档签署记录"); + + migrationBuilder.CreateTable( + name: "SystemDocNeedConfirmedUserType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + NeedConfirmUserTypeId = table.Column(type: "uniqueidentifier", nullable: false), + SystemDocumentId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SystemDocNeedConfirmedUserType", x => x.Id); + table.ForeignKey( + name: "FK_SystemDocNeedConfirmedUserType_SystemDocument_SystemDocumentId", + column: x => x.SystemDocumentId, + principalTable: "SystemDocument", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SystemDocNeedConfirmedUserType_UserType_NeedConfirmUserTypeId", + column: x => x.NeedConfirmUserTypeId, + principalTable: "UserType", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "后台 - 系统文档需要签署用户类型"); + + migrationBuilder.CreateTable( + name: "TrialDocConfirmedUser", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ConfirmUserId = table.Column(type: "uniqueidentifier", nullable: false), + CreateUserId = table.Column(type: "uniqueidentifier", nullable: false), + TrialDocumentId = table.Column(type: "uniqueidentifier", nullable: false), + ConfirmTime = table.Column(type: "datetime2", nullable: true), + CreateTime = table.Column(type: "datetime2", nullable: false), + DeleteUserId = table.Column(type: "uniqueidentifier", nullable: true), + DeletedTime = table.Column(type: "datetime2", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + SignFirstViewTime = table.Column(type: "datetime2", nullable: true), + SignText = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TrialDocConfirmedUser", x => x.Id); + table.ForeignKey( + name: "FK_TrialDocConfirmedUser_TrialDocument_TrialDocumentId", + column: x => x.TrialDocumentId, + principalTable: "TrialDocument", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TrialDocConfirmedUser_User_ConfirmUserId", + column: x => x.ConfirmUserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TrialDocConfirmedUser_User_CreateUserId", + column: x => x.CreateUserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "项目 - 项目文档签署记录"); + + migrationBuilder.CreateTable( + name: "TrialDocNeedConfirmedUserType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + NeedConfirmUserTypeId = table.Column(type: "uniqueidentifier", nullable: false), + TrialDocumentId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TrialDocNeedConfirmedUserType", x => x.Id); + table.ForeignKey( + name: "FK_TrialDocNeedConfirmedUserType_TrialDocument_TrialDocumentId", + column: x => x.TrialDocumentId, + principalTable: "TrialDocument", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TrialDocNeedConfirmedUserType_UserType_NeedConfirmUserTypeId", + column: x => x.NeedConfirmUserTypeId, + principalTable: "UserType", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "项目 - 项目文档需要签署的用户类型"); + + migrationBuilder.CreateIndex( + name: "IX_SystemDocConfirmedUser_ConfirmUserId", + table: "SystemDocConfirmedUser", + column: "ConfirmUserId"); + + migrationBuilder.CreateIndex( + name: "IX_SystemDocConfirmedUser_CreateUserId", + table: "SystemDocConfirmedUser", + column: "CreateUserId"); + + migrationBuilder.CreateIndex( + name: "IX_SystemDocConfirmedUser_SystemDocumentId", + table: "SystemDocConfirmedUser", + column: "SystemDocumentId"); + + migrationBuilder.CreateIndex( + name: "IX_SystemDocNeedConfirmedUserType_NeedConfirmUserTypeId", + table: "SystemDocNeedConfirmedUserType", + column: "NeedConfirmUserTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_SystemDocNeedConfirmedUserType_SystemDocumentId", + table: "SystemDocNeedConfirmedUserType", + column: "SystemDocumentId"); + + migrationBuilder.CreateIndex( + name: "IX_SystemDocument_CreateUserId", + table: "SystemDocument", + column: "CreateUserId"); + + migrationBuilder.CreateIndex( + name: "IX_SystemDocument_FileTypeId", + table: "SystemDocument", + column: "FileTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocConfirmedUser_ConfirmUserId", + table: "TrialDocConfirmedUser", + column: "ConfirmUserId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocConfirmedUser_CreateUserId", + table: "TrialDocConfirmedUser", + column: "CreateUserId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocConfirmedUser_TrialDocumentId", + table: "TrialDocConfirmedUser", + column: "TrialDocumentId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocNeedConfirmedUserType_NeedConfirmUserTypeId", + table: "TrialDocNeedConfirmedUserType", + column: "NeedConfirmUserTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocNeedConfirmedUserType_TrialDocumentId", + table: "TrialDocNeedConfirmedUserType", + column: "TrialDocumentId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocument_CreateUserId", + table: "TrialDocument", + column: "CreateUserId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocument_FileTypeId", + table: "TrialDocument", + column: "FileTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_TrialDocument_TrialId", + table: "TrialDocument", + column: "TrialId"); + } + } +} diff --git a/IRaCIS.Core.Infra.EFCore/Migrations/IRaCISDBContextModelSnapshot.cs b/IRaCIS.Core.Infra.EFCore/Migrations/IRaCISDBContextModelSnapshot.cs index 635e884cd..688b27f45 100644 --- a/IRaCIS.Core.Infra.EFCore/Migrations/IRaCISDBContextModelSnapshot.cs +++ b/IRaCIS.Core.Infra.EFCore/Migrations/IRaCISDBContextModelSnapshot.cs @@ -22,278 +22,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("IRaCIS.Core.Domain.Management.HospitalGroup", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Affiliation") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)") - .HasComment("所属科室"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreateUserId"); - - b.ToTable("HospitalGroup", t => - { - t.HasComment("课题组"); - }); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Management.HospitalGroupIdentityUser", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("HospitalGroupId") - .HasColumnType("uniqueidentifier"); - - b.Property("IdentityUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("IsManager") - .HasColumnType("bit"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreateUserId"); - - b.ToTable("HospitalGroupIdentityUser", t => - { - t.HasComment("用户课题组中间关系表"); - }); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Management.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AutoCutNextTask") - .HasColumnType("bit") - .HasComment("这个字段废除,放在用户角色上面,后续删除"); - - b.Property("CheckCode") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("Code") - .HasColumnType("int"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DepartmentName") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("EMail") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("EmailToken") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("IsFirstAdd") - .HasColumnType("bit") - .HasComment("首次登录需要修改密码"); - - b.Property("IsTestUser") - .HasColumnType("bit"); - - b.Property("IsZhiZhun") - .HasColumnType("bit") - .HasComment("内部用户 外部用户"); - - b.Property("LastChangePassWordTime") - .HasColumnType("datetime2") - .HasComment("上一次修改密码的时间"); - - b.Property("LastLoginIP") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("LastLoginTime") - .HasColumnType("datetime2"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("OrganizationName") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("Password") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("PasswordChanged") - .HasColumnType("bit"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("PositionName") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("Sex") - .HasColumnType("int"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("ThirdUserCode") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserCode") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.HasKey("Id"); - - b.HasIndex("CreateUserId"); - - b.ToTable("IdentityUser", t => - { - t.HasComment("后台 - 系统真实账户表"); - }); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Management.TrialIdentityUser", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleteUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletedTime") - .HasColumnType("datetime2"); - - b.Property("IdentityUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("JoinTime") - .HasColumnType("datetime2"); - - b.Property("RemoveTime") - .HasColumnType("datetime2"); - - b.Property("TrialId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreateUserId"); - - b.HasIndex("IdentityUserId"); - - b.HasIndex("TrialId"); - - b.ToTable("TrialIdentityUser", t => - { - t.HasComment("项目用户表"); - }); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.Attachment", b => { b.Property("Id") @@ -3047,6 +2775,231 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations }); }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroup", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Affiliation") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)") + .HasComment("所属科室"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ContactName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ContactPhone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("HospitalGroup", t => + { + t.HasComment("课题组"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroupIdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("HospitalGroupId") + .HasColumnType("uniqueidentifier"); + + b.Property("IdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsManager") + .HasColumnType("bit"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.ToTable("HospitalGroupIdentityUser", t => + { + t.HasComment("用户课题组中间关系表"); + }); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AutoCutNextTask") + .HasColumnType("bit") + .HasComment("这个字段废除,放在用户角色上面,后续删除"); + + b.Property("CheckCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DepartmentName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EMail") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("EmailToken") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("IsFirstAdd") + .HasColumnType("bit") + .HasComment("首次登录需要修改密码"); + + b.Property("IsTestUser") + .HasColumnType("bit"); + + b.Property("IsZhiZhun") + .HasColumnType("bit") + .HasComment("内部用户 外部用户"); + + b.Property("LastChangePassWordTime") + .HasColumnType("datetime2") + .HasComment("上一次修改密码的时间"); + + b.Property("LastLoginIP") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("LastLoginTime") + .HasColumnType("datetime2"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("OrganizationName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PasswordChanged") + .HasColumnType("bit"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("PositionName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("ThirdUserCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserCode") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("IdentityUser", t => + { + t.HasComment("后台 - 系统真实账户表"); + }); + }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.ImageShare", b => { b.Property("Id") @@ -9707,137 +9660,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations }); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemDocConfirmedUser", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ConfirmTime") - .HasColumnType("datetime2"); - - b.Property("ConfirmUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleteUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletedTime") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("SignFirstViewTime") - .HasColumnType("datetime2"); - - b.Property("SignText") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("SystemDocumentId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ConfirmUserId"); - - b.HasIndex("CreateUserId"); - - b.HasIndex("SystemDocumentId"); - - b.ToTable("SystemDocConfirmedUser", t => - { - t.HasComment("后台 - 系统文档签署记录"); - }); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemDocNeedConfirmedUserType", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("NeedConfirmUserTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("SystemDocumentId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NeedConfirmUserTypeId"); - - b.HasIndex("SystemDocumentId"); - - b.ToTable("SystemDocNeedConfirmedUserType", t => - { - t.HasComment("后台 - 系统文档需要签署用户类型"); - }); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemDocument", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleteUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletedTime") - .HasColumnType("datetime2"); - - b.Property("DocUserSignType") - .HasColumnType("int"); - - b.Property("FileTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("Path") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("SignViewMinimumMinutes") - .HasColumnType("int"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreateUserId"); - - b.HasIndex("FileTypeId"); - - b.ToTable("SystemDocument", t => - { - t.HasComment("后台 - 系统签署文档"); - }); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNotice", b => { b.Property("Id") @@ -11667,145 +11489,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations }); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDocConfirmedUser", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ConfirmTime") - .HasColumnType("datetime2"); - - b.Property("ConfirmUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleteUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletedTime") - .HasColumnType("datetime2"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("SignFirstViewTime") - .HasColumnType("datetime2"); - - b.Property("SignText") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("TrialDocumentId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ConfirmUserId"); - - b.HasIndex("CreateUserId"); - - b.HasIndex("TrialDocumentId"); - - b.ToTable("TrialDocConfirmedUser", t => - { - t.HasComment("项目 - 项目文档签署记录"); - }); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDocNeedConfirmedUserType", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("NeedConfirmUserTypeId") - .HasColumnType("uniqueidentifier"); - - b.Property("TrialDocumentId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NeedConfirmUserTypeId"); - - b.HasIndex("TrialDocumentId"); - - b.ToTable("TrialDocNeedConfirmedUserType", t => - { - t.HasComment("项目 - 项目文档需要签署的用户类型"); - }); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDocument", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreateTime") - .HasColumnType("datetime2"); - - b.Property("CreateUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleteUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletedTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("FileTypeId") - .HasColumnType("uniqueidentifier") - .HasComment("需要确认的项目用户 通过TrialId 关联 用中间表过滤"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("Path") - .IsRequired() - .HasMaxLength(400) - .HasColumnType("nvarchar(400)"); - - b.Property("SignViewMinimumMinutes") - .HasColumnType("int"); - - b.Property("TrialId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateTime") - .HasColumnType("datetime2"); - - b.Property("UpdateUserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreateUserId"); - - b.HasIndex("FileTypeId"); - - b.HasIndex("TrialId"); - - b.ToTable("TrialDocument", t => - { - t.HasComment("项目 - 项目文档"); - }); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailBlackUser", b => { b.Property("Id") @@ -12200,6 +11883,58 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations }); }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialIdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleteUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletedTime") + .HasColumnType("datetime2"); + + b.Property("IdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("JoinTime") + .HasColumnType("datetime2"); + + b.Property("RemoveTime") + .HasColumnType("datetime2"); + + b.Property("TrialId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreateUserId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TrialId"); + + b.ToTable("TrialIdentityUser", t => + { + t.HasComment("项目用户表"); + }); + }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialImageDownload", b => { b.Property("Id") @@ -13557,6 +13292,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Property("IsTestUser") .HasColumnType("bit"); + b.Property("IsUserRoleDisabled") + .HasColumnType("bit"); + b.Property("IsZhiZhun") .HasColumnType("bit") .HasComment("内部用户 外部用户"); @@ -14605,66 +14343,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.ToTable("TestLength"); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Management.HospitalGroup", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreateUserRole"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Management.HospitalGroupIdentityUser", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreateUserRole"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Management.IdentityUser", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreateUserRole"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Management.TrialIdentityUser", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Management.IdentityUser", "IdentityUser") - .WithMany("UserTrialList") - .HasForeignKey("IdentityUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") - .WithMany() - .HasForeignKey("TrialId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreateUserRole"); - - b.Navigation("IdentityUser"); - - b.Navigation("Trial"); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.Attachment", b => { b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") @@ -15288,6 +14966,45 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("Site"); }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroup", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.HospitalGroupIdentityUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + }); + + modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId"); + + b.Navigation("CreateUserRole"); + + b.Navigation("Trial"); + }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.InspectionFile", b => { b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") @@ -17189,71 +16906,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("CreateUserRole"); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemDocConfirmedUser", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "ConfirmUser") - .WithMany("SystemDocConfirmedList") - .HasForeignKey("ConfirmUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.SystemDocument", "SystemDocument") - .WithMany("SystemDocConfirmedUserList") - .HasForeignKey("SystemDocumentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ConfirmUser"); - - b.Navigation("CreateUserRole"); - - b.Navigation("SystemDocument"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemDocNeedConfirmedUserType", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserType", "UserTypeRole") - .WithMany("SystemDocNeedConfirmedUserTypeList") - .HasForeignKey("NeedConfirmUserTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.SystemDocument", "SystemDocument") - .WithMany("NeedConfirmedUserTypeList") - .HasForeignKey("SystemDocumentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("SystemDocument"); - - b.Navigation("UserTypeRole"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemDocument", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "FileType") - .WithMany() - .HasForeignKey("FileTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreateUserRole"); - - b.Navigation("FileType"); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNotice", b => { b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") @@ -17757,79 +17409,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("Trial"); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDocConfirmedUser", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "User") - .WithMany() - .HasForeignKey("ConfirmUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.TrialDocument", "TrialDocument") - .WithMany("TrialDocConfirmedUserList") - .HasForeignKey("TrialDocumentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreateUserRole"); - - b.Navigation("TrialDocument"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDocNeedConfirmedUserType", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserType", "UserTypeRole") - .WithMany() - .HasForeignKey("NeedConfirmUserTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.TrialDocument", "TrialDocument") - .WithMany("NeedConfirmedUserTypeList") - .HasForeignKey("TrialDocumentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("TrialDocument"); - - b.Navigation("UserTypeRole"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDocument", b => - { - b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() - .HasForeignKey("CreateUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.Dictionary", "FileType") - .WithMany() - .HasForeignKey("FileTypeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") - .WithMany("TrialDocumentList") - .HasForeignKey("TrialId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreateUserRole"); - - b.Navigation("FileType"); - - b.Navigation("Trial"); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailBlackUser", b => { b.HasOne("IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig", "TrialEmailNoticeConfig") @@ -17956,6 +17535,33 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("Trial"); }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialIdentityUser", b => + { + b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") + .WithMany() + .HasForeignKey("CreateUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "IdentityUser") + .WithMany("UserTrialList") + .HasForeignKey("IdentityUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial") + .WithMany() + .HasForeignKey("TrialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreateUserRole"); + + b.Navigation("IdentityUser"); + + b.Navigation("Trial"); + }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialImageDownload", b => { b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") @@ -18279,7 +17885,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialUserRole", b => { b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole") - .WithMany() + .WithMany("UserTrials") .HasForeignKey("CreateUserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -18290,14 +17896,14 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("IRaCIS.Core.Domain.Management.TrialIdentityUser", "TrialUser") + b.HasOne("IRaCIS.Core.Domain.Models.TrialIdentityUser", "TrialUser") .WithMany("TrialUserRoleList") .HasForeignKey("TrialUserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "UserRole") - .WithMany("UserTrials") + .WithMany("UserRoleTrials") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -18365,7 +17971,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserLog", b => { - b.HasOne("IRaCIS.Core.Domain.Management.IdentityUser", "ActionIdentityUser") + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "ActionIdentityUser") .WithMany() .HasForeignKey("ActionIdentityUserId"); @@ -18375,7 +17981,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("IRaCIS.Core.Domain.Management.IdentityUser", "TargetIdentityUser") + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "TargetIdentityUser") .WithMany() .HasForeignKey("TargetIdentityUserId"); @@ -18409,7 +18015,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations .WithOne("User") .HasForeignKey("IRaCIS.Core.Domain.Models.UserRole", "DoctorId"); - b.HasOne("IRaCIS.Core.Domain.Management.IdentityUser", null) + b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "IdentityUser") .WithMany("UserRoleList") .HasForeignKey("IdentityUserId") .OnDelete(DeleteBehavior.Cascade) @@ -18423,6 +18029,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("CreateUserRole"); + b.Navigation("IdentityUser"); + b.Navigation("UserTypeRole"); }); @@ -18720,18 +18328,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("CreateUserRole"); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Management.IdentityUser", b => - { - b.Navigation("UserRoleList"); - - b.Navigation("UserTrialList"); - }); - - modelBuilder.Entity("IRaCIS.Core.Domain.Management.TrialIdentityUser", b => - { - b.Navigation("TrialUserRoleList"); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", b => { b.Navigation("ReadingClinicalDataList"); @@ -18808,6 +18404,13 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("DoctorList"); }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b => + { + b.Navigation("UserRoleList"); + + b.Navigation("UserTrialList"); + }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.Menu", b => { b.Navigation("UserTypeMenuList"); @@ -18978,13 +18581,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("VisitTaskList"); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemDocument", b => - { - b.Navigation("NeedConfirmedUserTypeList"); - - b.Navigation("SystemDocConfirmedUserList"); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.SystemNotice", b => { b.Navigation("NoticeUserReadList"); @@ -19037,8 +18633,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("TrialDicList"); - b.Navigation("TrialDocumentList"); - b.Navigation("TrialReadingCriterionList"); b.Navigation("TrialSiteList"); @@ -19060,13 +18654,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("WorkloadList"); }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialDocument", b => - { - b.Navigation("NeedConfirmedUserTypeList"); - - b.Navigation("TrialDocConfirmedUserList"); - }); - modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig", b => { b.Navigation("TrialEmailBlackUserList"); @@ -19079,6 +18666,11 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations b.Navigation("ExperienceCriteriaList"); }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialIdentityUser", b => + { + b.Navigation("TrialUserRoleList"); + }); + modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialQCQuestion", b => { b.Navigation("TrialQCQuestionAnswerList"); @@ -19111,7 +18703,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserRole", b => { - b.Navigation("SystemDocConfirmedList"); + b.Navigation("UserRoleTrials"); b.Navigation("UserTrials"); @@ -19120,8 +18712,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserType", b => { - b.Navigation("SystemDocNeedConfirmedUserTypeList"); - b.Navigation("UserList"); b.Navigation("UserTypeGroupList"); diff --git a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs index ddecbf4d5..0b2e88343 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs @@ -395,7 +395,7 @@ namespace IRaCIS.Core.Infra.EFCore public async Task BatchUpdateNoTrackingAsync(Expression> whereFilter, Expression> updateFactory) where T : Entity { - return await _dbContext.BatchUpdateNoTrackingAsync(whereFilter, updateFactory, _userInfo.Id); + return await _dbContext.BatchUpdateNoTrackingAsync(whereFilter, updateFactory, _userInfo.UserRoleId); //return await _dbContext.Set().IgnoreQueryFilters().Where(whereFilter).BatchUpdateAsync(updateFactory).ConfigureAwait(false) > 0; diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 300fe9ef1..741686c83 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -268,7 +268,7 @@ namespace IRaCIS.Core.Infra.EFCore Expression> updateFactory) { - return await _dbContext.BatchUpdateNoTrackingAsync(where, updateFactory, _userInfo.Id); + return await _dbContext.BatchUpdateNoTrackingAsync(where, updateFactory, _userInfo.UserRoleId); }