From 11baf5e8876d4508a62cb2230731f7e860485ac5 Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Fri, 2 Dec 2022 09:08:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Allocation/VisitTaskHelpeService.cs | 10 ---------- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- .../Service/Visit/SubjectVisitService.cs | 8 ++++++++ IRaCIS.Core.Domain/Visit/VisitStage.cs | 4 +++- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 48a3d7f00..15914d14c 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -221,10 +221,6 @@ namespace IRaCIS.Core.Application.Service } - - - - public async Task AddTaskAsync(GenerateTaskCommand generateTaskCommand) { @@ -233,10 +229,6 @@ namespace IRaCIS.Core.Application.Service var trialReadingCriterionConfigList = _trialReadingCriterionRepository.Where(t => t.TrialId == trialId && t.ReadingInfoSignTime !=null).Select(t => new { TrialReadingCriterionId= t.Id ,t.ReadingTool,t.ReadingType, t.IsReadingTaskViewInOrder, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState,t.TaskAllocateObjEnum } ).ToList(); - //var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, }).FirstOrDefaultAsync()).IfNullThrowException(); - - //var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == trialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); - var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max(); @@ -250,11 +242,9 @@ namespace IRaCIS.Core.Application.Service foreach (var subjectVisit in generateTaskCommand.VisitGenerataTaskList) { - foreach (var trialReadingCriterionConfig in trialReadingCriterionConfigList) { - var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index ecee1ebe3..c7f80bdc4 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -782,7 +782,7 @@ namespace IRaCIS.Core.Application.Contracts if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true)) { - await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId }); + await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId ,JoinTime=DateTime.Now}); await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 08968b6bc..8a20af5e7 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -84,6 +84,8 @@ namespace IRaCIS.Core.Application.Services svCommand.VisitExecuted = svCommand.IsLostVisit ? VisitExecutedEnum.Executed : svCommand.VisitExecuted; + + SubjectVisit? dbBeforeEntity = null; //Add if (svCommand.Id == null) @@ -96,6 +98,12 @@ namespace IRaCIS.Core.Application.Services { throw new BusinessValidationFailedException("设置末次评估后,不允许添加计划外访视。"); } + + if (await _repository.AnyAsync(t=>t.SubjectId==svCommand.SubjectId && t.TaskState==TaskState.Effect && t.VisitTaskNum > svCommand.VisitNum && t.SignTime != null)) + { + throw new BusinessValidationFailedException("该受试者后续访视已有任务完成阅片,不允许在此添加,如果确实需要,请回退"); + } + } dbBeforeEntity = await _subjectVisitRepository.InsertFromDTOAsync(svCommand, false, verifyExp1, verifyExp2, verifyExp3); diff --git a/IRaCIS.Core.Domain/Visit/VisitStage.cs b/IRaCIS.Core.Domain/Visit/VisitStage.cs index 51941a78c..2504f9cd7 100644 --- a/IRaCIS.Core.Domain/Visit/VisitStage.cs +++ b/IRaCIS.Core.Domain/Visit/VisitStage.cs @@ -10,7 +10,9 @@ namespace IRaCIS.Core.Domain.Models public Trial Trial { get; set; } public Guid TrialId { get; set; } - public string BlindName { get; set; }=string.Empty; + public string BlindName { get; set; } = string.Empty; + + [Column(TypeName = "decimal(18,1)")] public decimal VisitNum { get; set; }