From 00e915c26d77b4fa383e75200510a0db72f9919b Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 18 May 2022 17:37:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialDocumentService.cs | 18 ++++++--- .../TrialSiteUser/TrialConfigService.cs | 10 ++++- IRaCIS.Core.Domain/QC/TrialQCQuestion.cs | 7 ++++ .../Common/AuditingData.cs | 38 ++++++++++++------- .../Context/IRaCISDBContext.cs | 2 + 5 files changed, 54 insertions(+), 21 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index b632695f1..551c1ef1e 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -24,12 +24,18 @@ namespace IRaCIS.Core.Application.Services private readonly IRepository _trialDocumentRepository; + private readonly IRepository _trialDocUserTypeConfirmedUserRepository; + private readonly IRepository _systemDocConfirmedUserRepository; private readonly IRepository _systemDocumentRepository; - public TrialDocumentService(IRepository trialDocumentRepository + public TrialDocumentService(IRepository trialDocumentRepository, + IRepository trialDocUserTypeConfirmedUserRepository, + IRepository systemDocConfirmedUserRepository , IRepository systemDocumentRepository) { _trialDocumentRepository = trialDocumentRepository; + this._trialDocUserTypeConfirmedUserRepository = trialDocUserTypeConfirmedUserRepository; + this._systemDocConfirmedUserRepository = systemDocConfirmedUserRepository; _systemDocumentRepository = systemDocumentRepository; } @@ -408,7 +414,7 @@ namespace IRaCIS.Core.Application.Services } //entity.Id = NewId.NextGuid(); - await _repository.AddAsync(entity, true); + await _trialDocumentRepository.AddAsync(entity, true); return ResponseOutput.Ok(entity.Id.ToString()); } else @@ -540,7 +546,7 @@ namespace IRaCIS.Core.Application.Services return ResponseOutput.NotOk("文件已删除或者废除,签署失败!"); } - await _repository.AddAsync(new SystemDocConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, SystemDocumentId = userConfirmCommand.DocumentId }); + await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, SystemDocumentId = userConfirmCommand.DocumentId },true); } else { @@ -554,7 +560,7 @@ namespace IRaCIS.Core.Application.Services return ResponseOutput.NotOk("文件已删除或者废除,签署失败!"); } - await _repository.AddAsync(new TrialDocUserTypeConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, TrialDocumentId = userConfirmCommand.DocumentId }); + await _trialDocUserTypeConfirmedUserRepository.AddAsync(new TrialDocUserTypeConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, TrialDocumentId = userConfirmCommand.DocumentId },true); } await _repository.SaveChangesAsync(); @@ -574,11 +580,11 @@ namespace IRaCIS.Core.Application.Services { if (isSystemDoc) { - await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true }); + await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true },true); } else { - await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true }); + await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true }, true); } await _systemDocumentRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index a98a41fc9..404f6b76a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -15,13 +15,16 @@ namespace IRaCIS.Core.Application public class TrialConfigService : BaseService, ITrialConfigService { private readonly IRepository _trialRepository; + private readonly IRepository _trialQCQuestionRepository; private readonly IEasyCachingProvider _provider; public TrialConfigService(IRepository trialRepository, + IRepository trialQCQuestionRepository, IEasyCachingProvider provider ) { _trialRepository = trialRepository; + this._trialQCQuestionRepository = trialQCQuestionRepository; this._provider = provider; } @@ -161,7 +164,12 @@ namespace IRaCIS.Core.Application throw new BusinessValidationFailedException("QC审核问题已被其他QC确认,不允许再次确认"); } - await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true },true); + await _trialQCQuestionRepository.UpdatePartialFromQueryAsync(t => t.TrialId == signConfirmDTO.TrialId, x => new TrialQCQuestion + { + IsConfirm = true + }); + await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true }); + await _trialRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs b/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs index 0b9342474..dd3309fc6 100644 --- a/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs +++ b/IRaCIS.Core.Domain/QC/TrialQCQuestion.cs @@ -94,6 +94,13 @@ namespace IRaCIS.Core.Domain.Models [Required] public Guid UpdateUserId { get; set; } + /// + /// 是否确认 + /// + public bool? IsConfirm { get; set; } + + + public List TrialQCQuestionAnswerList { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 8351f3949..648646036 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -177,7 +177,26 @@ namespace IRaCIS.Core.Infra.EFCore.Common // 项目文档 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument))) { - await InsertInspection(item, type); + + var entity = item.Entity as TrialDocument; + var userTypes = entity.NeedConfirmedUserTypeList; + if (userTypes == null) + { + userTypes = await _dbContext.TrialDocNeedConfirmedUserType.Where(x => x.TrialDocumentId == entity.Id).ToListAsync(); + } + + var userTypeIds = userTypes.Select(x => x.NeedConfirmUserTypeId).ToList(); + var usertypeNames = await _dbContext.UserType.Where(x => userTypeIds.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync(); + var usertypeName = string.Join(",", usertypeNames); + await InsertInspection(item, type, x => new DataInspection() + { + GeneralId = x.Id + }, new + { + NeedConfirmedUserType = usertypeName, + }); + + } // 项目中心 @@ -224,7 +243,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - // 项目中心人员 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteUser))) { @@ -270,8 +288,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - - // 中心调研表 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteSurvey))) { @@ -310,9 +326,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common // 项目问题 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestion))) { - var entity = item.Entity as TrialQCQuestion; - var isQCQuestionConfirmed = await _dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.IsQCQuestionConfirmed).FirstOrDefaultAsync(); var paretName = await _dbContext.TrialQCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); await InsertInspection(item, type, x => new DataInspection() { @@ -326,7 +340,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common ParentName= paretName, ParentTriggerValue=entity.ParentTriggerValue, IsEnable=entity.IsEnable, - IsQCQuestionConfirmed= isQCQuestionConfirmed, + IsQCQuestionConfirmed= entity.IsConfirm, }); } @@ -346,8 +360,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - - // 检查 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy))) { @@ -357,7 +369,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - // 序列 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomSeries))) { @@ -508,7 +519,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - // 既往手术史 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousSurgery))) { @@ -529,7 +539,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - // 既往放疗史 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousHistory))) { @@ -597,7 +606,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - // 质疑信息 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallengeDialog))) { @@ -676,7 +684,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - // Qc 问题答案 if (entitys.Any(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer))) { @@ -737,6 +744,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common } + #region 备注 ////Qc 问题答案 //foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer))) //{ @@ -754,6 +762,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common //} #endregion + #endregion + } /// diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 8495a1034..5797c6d01 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -293,6 +293,8 @@ namespace IRaCIS.Core.Infra.EFCore public virtual DbSet SystemDocConfirmedUser { get; set; } public virtual DbSet SystemDocNeedConfirmedUserType { get; set; } + public virtual DbSet TrialDocNeedConfirmedUserType { get; set; } + public virtual DbSet TrialDocUserTypeConfirmUser { get; set; } #endregion