From 3ddbd599956636e7764d8391ef12a400119d9a68 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 6 Jul 2023 10:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83=E8=B0=83?= =?UTF-8?q?=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 35 +++++++++++ Dockerfile1 | 35 +++++++++++ IRaCIS.Core.API/IRaCIS.Core.API.csproj | 13 ++-- IRaCIS.Core.API/NLog.config | 18 ------ .../SiteSurvey/TrialSiteSurveyService.cs | 59 ++++++++++--------- .../ReadingQuestionCriterionTrial.cs | 10 ++-- 6 files changed, 116 insertions(+), 54 deletions(-) create mode 100644 Dockerfile create mode 100644 Dockerfile1 delete mode 100644 IRaCIS.Core.API/NLog.config diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..45ee7591a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed. +#For more information, please see https://aka.ms/containercompat + + + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 7050 + + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["IRaCIS.Core.API/IRaCIS.Core.API.csproj", "IRaCIS.Core.API/"] +COPY ["IRaCIS.Core.Application/IRaCIS.Core.Application.csproj", "IRaCIS.Core.Application/"] +COPY ["IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj", "IRaCIS.Core.Infra.EFCore/"] +COPY ["IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj", "IRaCIS.Core.Domain/"] +COPY ["IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj", "IRaCIS.Core.Domain.Share/"] +COPY ["IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj", "IRaCIS.Core.Infrastructure/"] +RUN dotnet restore "IRaCIS.Core.API/IRaCIS.Core.API.csproj" +COPY . . +WORKDIR "/src/IRaCIS.Core.API" +RUN dotnet build "IRaCIS.Core.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "IRaCIS.Core.API.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . + +ENV ASPNETCORE_ENVIRONMENT=Development + +ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"] \ No newline at end of file diff --git a/Dockerfile1 b/Dockerfile1 new file mode 100644 index 000000000..45ee7591a --- /dev/null +++ b/Dockerfile1 @@ -0,0 +1,35 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed. +#For more information, please see https://aka.ms/containercompat + + + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 7050 + + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["IRaCIS.Core.API/IRaCIS.Core.API.csproj", "IRaCIS.Core.API/"] +COPY ["IRaCIS.Core.Application/IRaCIS.Core.Application.csproj", "IRaCIS.Core.Application/"] +COPY ["IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj", "IRaCIS.Core.Infra.EFCore/"] +COPY ["IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj", "IRaCIS.Core.Domain/"] +COPY ["IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj", "IRaCIS.Core.Domain.Share/"] +COPY ["IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj", "IRaCIS.Core.Infrastructure/"] +RUN dotnet restore "IRaCIS.Core.API/IRaCIS.Core.API.csproj" +COPY . . +WORKDIR "/src/IRaCIS.Core.API" +RUN dotnet build "IRaCIS.Core.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "IRaCIS.Core.API.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . + +ENV ASPNETCORE_ENVIRONMENT=Development + +ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"] \ No newline at end of file diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index c6af611a4..da285c560 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -5,7 +5,7 @@ false 354572d4-9e15-4099-807c-63a2d29ff9f2 default - Linux + Windows 1.0.1.001 上海展影医疗科技有限公司 IRC影像系统 (EICS) @@ -105,9 +105,6 @@ - - Always - Always @@ -170,5 +167,13 @@ + + + + + + + + diff --git a/IRaCIS.Core.API/NLog.config b/IRaCIS.Core.API/NLog.config deleted file mode 100644 index bf1dbbb1b..000000000 --- a/IRaCIS.Core.API/NLog.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 09a8225d9..995efa958 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -102,7 +102,7 @@ namespace IRaCIS.Core.Application.Contracts //检查验证码是否失效 if (verificationRecord.ExpirationTime < DateTime.Now) { - //---验证码已经过期。 + //---验证码已经过期。 throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); } else //验证码正确 并且 没有超时 @@ -220,7 +220,7 @@ namespace IRaCIS.Core.Application.Contracts //检查验证码是否失效 if (verificationRecord.ExpirationTime < DateTime.Now) { - //---验证码已经过期。 + //---验证码已经过期。 return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); } else //验证码正确 并且 没有超时 @@ -323,7 +323,7 @@ namespace IRaCIS.Core.Application.Contracts //该site 下不存在该邮箱的记录 if (!dbEntityList.Any(t => t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone)) { - //---该中心下已经有其他用户已填写的调研表,您不被允许继续填写 + //---该中心下已经有其他用户已填写的调研表,您不被允许继续填写 return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_AlreadyFilledByOtherUsers"]); } @@ -407,7 +407,7 @@ namespace IRaCIS.Core.Application.Contracts { if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)) { - //---中心调研已锁定,不允许操作。 + //---中心调研已锁定,不允许操作。 return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]); } } @@ -734,39 +734,44 @@ namespace IRaCIS.Core.Application.Contracts var trialId = siteSurvyeSubmit.TrialId; var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId; - if (_userInfo.IsAdmin) - { - //---不允许管理员操作。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoAdminAcces"]); - } + var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefaultAsync()).IfNullThrowException(); + + var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId).Select(t => new { t.TrialSiteSurveyId, t.IsGenerateAccount, t.UserTypeId, t.UserTypeRole.UserTypeEnum, t.TrialRoleName.Code }).ToListAsync(); + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined) { - var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM)); - - if (hasSPMOrCPM) + //是第一次 + if(!siteUserList.Any(t=>t.IsGenerateAccount)) { - 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 }); + var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); + if(!currentUserList.Any(t=>t.Code=="1")|| !currentUserList.Any(t => t.Code == "4")) + { + throw new BusinessValidationFailedException("本次提交,必须有CRC和影像负责人信息"); + } } } - else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) + + else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { - 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.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) - { + //是第一次 + if (!siteUserList.Any(t => t.IsGenerateAccount)) + { + var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); + + if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) || + !currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.SR)) + { + throw new BusinessValidationFailedException("本次提交,生成账号必须要有CRC 和SR"); + } + } + - var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefaultAsync()).IfNullThrowException(); @@ -862,7 +867,7 @@ namespace IRaCIS.Core.Application.Contracts if (userInfo.SystemUserId == null) { - //---生成账户Id 未取到值,请排查 + //---生成账户Id 未取到值,请排查 throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_FailedToGenerateAccountId"]); } @@ -875,9 +880,9 @@ namespace IRaCIS.Core.Application.Contracts //判断TrialUser中是否存在 不存在就插入 if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true)) { - await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); + await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); } - if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId==siteId, true)) + if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); } diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs index 19a937a5a..96ee51a61 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs @@ -170,25 +170,25 @@ namespace IRaCIS.Core.Domain.Models /// /// 仲裁对象 /// - public ArbitrationRule ArbitrationRule { get; set; } = ArbitrationRule.Reading; + public ArbitrationRule ArbitrationRule { get; set; } = ArbitrationRule.None; /// /// 阅片模式 /// - public ReadingMethod ReadingType { get; set; } = ReadingMethod.Double; + public ReadingMethod ReadingType { get; set; } = ReadingMethod.Single; /// /// 是否有阅片期 /// - public bool IsReadingPeriod { get; set; } = true; + public bool IsReadingPeriod { get; set; } = false; /// /// 是否生成全局阅片任务 /// - public bool IsGlobalReading { get; set; } = true; + public bool IsGlobalReading { get; set; } = false; /// /// 是否签名 @@ -199,7 +199,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 仲裁阅片 /// - public bool IsArbitrationReading { get; set; } = true; + public bool IsArbitrationReading { get; set; } = false; ///