diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index c83d4a445..5e694807f 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -326,6 +326,11 @@ 是否有签名 + + + 批次Id + + 传入参数记录ID @@ -725,6 +730,41 @@ PreviousPDFAddOrEdit 列表查询参数模型 + + + 文件名称 + + + + + 文件路径 + + + + + 相对路径 + + + + + 创建人 + + + + + 创建时间 + + + + + 项目ID + + + + + 创建者名称 + + 关闭一致性质疑Dto @@ -1429,6 +1469,12 @@ + + + 获取一致性核查文件上传记录 + + + 添加计划外访视 下拉框 选择上一次访视 diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index d3c62f4c7..b2aa1add4 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -448,7 +448,10 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO /// public bool? IsSign { get; set; } - + /// + /// 批次Id + /// + public Guid? BatchId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 276a12882..4137c8c28 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -132,11 +132,13 @@ namespace IRaCIS.Core.Application.Service.Inspection OptType = leftOptType.Id, VisitNum=leftsubjectVisit.VisitNum, IsFrontAdd=data.IsFrontAdd, + BatchId=data.BatchId, OptTypeName = leftOptType.Value, }; query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId) + .WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId) .WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) .WhereIf(dto.VisitPlanInfo != null, x => x.VisitNum == dto.VisitPlanInfo) .WhereIf(dto.StartTime != null, x => x.CreateTime >= dto.StartTime) diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs index a02459bf3..cf41306fa 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs @@ -152,6 +152,57 @@ namespace IRaCIS.Core.Application.Contracts.DTO } + + public class GetConsistencyCheckFileDto/*: ConsistencyCheckFile*/ + { + /// + /// 文件名称 + /// + public string FileName { get; set; } + + /// + /// 文件路径 + /// + public string FilePath { get; set; } + + /// + /// 相对路径 + /// + public string RelativePaths { get; set; } + + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 项目ID + /// + public Guid TrialId { get; set; } + + /// + /// 创建者名称 + /// + public string CreateUserName { get; set; } + } + + + public class GetConsistencyCheckFileInDto + { + public Guid TrialId { get; set; } + + public int PageIndex { get; set; } = 1; + public int PageSize { set; get; } = 10; + } + + public class QCChanllengeCreatorDto { public Guid CreateUserId { get; set; } diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index 60eddcb34..cea253e6e 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -11,11 +11,15 @@ namespace IRaCIS.Core.Application.Image.QA public class QCListService : BaseService, IQCListService { private readonly IRepository _subjectVisitRepository; + private readonly IRepository _consistencyCheckFileRepository; - - public QCListService(IRepository subjectVisitRepository) + public QCListService( + IRepository subjectVisitRepository, + IRepository consistencyCheckFileRepository + ) { _subjectVisitRepository = subjectVisitRepository; + this._consistencyCheckFileRepository = consistencyCheckFileRepository; } @@ -796,6 +800,20 @@ namespace IRaCIS.Core.Application.Image.QA + /// + /// 获取一致性核查文件上传记录 + /// + /// + [HttpPost] + public async Task> GetConsistencyCheckFile(GetConsistencyCheckFileInDto indto) + { + var query = _repository.Where(t => t.TrialId == indto.TrialId) + .ProjectTo(_mapper.ConfigurationProvider); + + return await query.ToPagedListAsync(indto.PageIndex, indto.PageSize, "CreateTime", false); + } + + /// /// 添加计划外访视 下拉框 选择上一次访视 /// diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index b8562a065..e7f2c5de4 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -38,6 +38,7 @@ namespace IRaCIS.Core.Application.Image.QA private readonly IRepository _qCChallengeDialogrepository; private readonly IRepository _checkChallengeDialogrepository; private readonly IRepository _trialRepository; + private readonly IRepository _consistencyCheckFileRepository; private readonly IMediator _mediator; private readonly AsyncLock _mutex = new AsyncLock(); @@ -45,6 +46,7 @@ namespace IRaCIS.Core.Application.Image.QA public QCOperationService(DicomFileStoreHelper dicomFileStoreHelper, IRepository subjectVisitRepository, IRepository qcChallengeRepository, IRepository trialRepository, + IRepository consistencyCheckFileRepository, IMediator mediator, IRepository dicomStudyRepository, IRepository dicomSeriesrepository, @@ -63,6 +65,7 @@ namespace IRaCIS.Core.Application.Image.QA this._checkChallengeDialogrepository = checkChallengeDialogrepository; _mediator = mediator; _trialRepository = trialRepository; + this._consistencyCheckFileRepository = consistencyCheckFileRepository; } #region QC质疑 以及回复 关闭 @@ -703,6 +706,16 @@ namespace IRaCIS.Core.Application.Image.QA } + await _consistencyCheckFileRepository.AddAsync(new ConsistencyCheckFile() + { + TrialId = trialId, + CreateTime = DateTime.Now, + FileName = fileName, + FilePath = filePath, + RelativePaths = filePath.Replace(rootPath, ""), + CreateUserId = _userInfo.Id + }); + //new() //{ // TrialId = trialId, diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 1ebbd5026..7ccdf773d 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -22,7 +22,7 @@ namespace IRaCIS.Core.Application.Service //CreateMap(); //CreateMap(); - + //CreateMap(); @@ -73,7 +73,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.ParentShowOrder, u => u.MapFrom(s => s.ParentQCQuestion.ShowOrder)); CreateMap(); - + CreateMap(); CreateMap().ReverseMap(); @@ -104,11 +104,11 @@ namespace IRaCIS.Core.Application.Service //影像质控 CreateMap() .ForMember(d => d.ChallengeCount, u => u.MapFrom(s => s.QCChallengeList.Count())) - - //.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code)) - //.ForMember(d => d.IsEnrollmentConfirm, u => u.MapFrom(s => s.Subject.IsEnrollmentConfirm)) - //.ForMember(d => d.FistGiveMedicineTime, u => u.MapFrom(s => s.Subject.FistGiveMedicineTime)) - //.ForMember(d => d.SubjectVisitId, u => u.MapFrom(s => s.Id)) + + //.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code)) + //.ForMember(d => d.IsEnrollmentConfirm, u => u.MapFrom(s => s.Subject.IsEnrollmentConfirm)) + //.ForMember(d => d.FistGiveMedicineTime, u => u.MapFrom(s => s.Subject.FistGiveMedicineTime)) + //.ForMember(d => d.SubjectVisitId, u => u.MapFrom(s => s.Id)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) .ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum)) .ForMember(d => d.SubjectStatus, u => u.MapFrom(s => s.Subject.Status)) @@ -116,7 +116,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.CurrentActionUserName, u => u.MapFrom(s => s.CurrentActionUser.UserName)) .ForMember(d => d.PreliminaryAuditUserName, u => u.MapFrom(s => s.PreliminaryAuditUser.UserName)) .ForMember(d => d.ReviewAuditUserName, u => u.MapFrom(s => s.ReviewAuditUser.UserName)) - .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.PreviousPDFList.Any() || t.PreviousSurgeryList.Any() : false)) + .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.PreviousPDFList.Any() || t.PreviousSurgeryList.Any() : false)) .ForMember(d => d.DicomStudyCount, u => u.MapFrom(t => t.StudyList.Count())) .ForMember(d => d.NoneDicomStudyCount, u => u.MapFrom(t => t.NoneDicomStudyList.Count(t => t.NoneDicomFileList.Any()))); @@ -130,21 +130,21 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum)) .ForMember(d => d.SubjectId, u => u.MapFrom(t => t.Subject.Id)) .ForMember(d => d.MedicalNo, u => u.MapFrom(s => s.Subject.MedicalNo)) - .ForMember(d => d.Sex, u=> u.MapFrom(s => s.Subject.Sex)) + .ForMember(d => d.Sex, u => u.MapFrom(s => s.Subject.Sex)) .ForMember(d => d.Age, u => u.MapFrom(t => t.Subject.Age)) - .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t=> t.IsBaseLine? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.PreviousPDFList.Any() || t.PreviousSurgeryList.Any() :false)) - + .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.PreviousPDFList.Any() || t.PreviousSurgeryList.Any() : false)) + //.ForMember(d => d.VisitName, u => u.MapFrom(t =>t.InPlan? t.VisitStage.VisitName : t.VisitName)) //.ForMember(d => d.VisitNum, u => u.MapFrom(t => t.InPlan ? t.VisitStage.VisitNum : t.VisitNum)) //.ForMember(d => d.VisitDay, u => u.MapFrom(t => t.InPlan ? t.VisitStage.VisitDay : t.VisitDay)) .ForMember(d => d.DicomStudyCount, u => u.MapFrom(t => t.StudyList.Count())) - .ForMember(d => d.NoneDicomStudyCount, u => u.MapFrom(t => t.NoneDicomStudyList.Count(t=>t.NoneDicomFileList.Any()))); - //.ForMember(d => d.StudyCount, u => u.MapFrom(s => s.StudyList.Count())); + .ForMember(d => d.NoneDicomStudyCount, u => u.MapFrom(t => t.NoneDicomStudyList.Count(t => t.NoneDicomFileList.Any()))); + //.ForMember(d => d.StudyCount, u => u.MapFrom(s => s.StudyList.Count())); CreateMap(); //一致性核查 CreateMap() - .ForMember(d => d.TalkContent, u => u.MapFrom(s =>s.CheckChallengeDialogList.OrderByDescending(y=>y.CreateTime).Select(x=>x.TalkContent).FirstOrDefault())) + .ForMember(d => d.TalkContent, u => u.MapFrom(s => s.CheckChallengeDialogList.OrderByDescending(y => y.CreateTime).Select(x => x.TalkContent).FirstOrDefault())) .ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)); @@ -154,12 +154,12 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUser.FullName)); CreateMap() - .ForMember(d => d.SubjectVisitCheck, u => u.MapFrom(t => t)) + .ForMember(d => d.SubjectVisitCheck, u => u.MapFrom(t => t)) .ForMember(d => d.DialogList, u => u.MapFrom(t => t.CheckChallengeDialogList.OrderBy(t => t.CreateTime))); CreateMap() - .ForMember(d => d.ForwardUserName, u => u.MapFrom(s => s.ForwardUser.UserName)) + .ForMember(d => d.ForwardUserName, u => u.MapFrom(s => s.ForwardUser.UserName)) .ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)); @@ -172,7 +172,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.SubjectFirstGiveMedicineTime, u => u.MapFrom(s => s.Subject.FirstGiveMedicineTime)) .ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName)) .ForMember(d => d.TotalChallengeCount, u => u.MapFrom(s => s.QCChallengeList.Count())) - .ForMember(d => d.NotClosedChallengeCount, u => u.MapFrom(s => s.QCChallengeList.Count(c=>c.IsClosed==false))); + .ForMember(d => d.NotClosedChallengeCount, u => u.MapFrom(s => s.QCChallengeList.Count(c => c.IsClosed == false))); CreateMap(MemberList.None); @@ -188,7 +188,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); - + @@ -197,7 +197,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.UserName)) .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUser.FullName)) - + .ForMember(d => d.IsCurrentUser, u => u.MapFrom(s => s.CreateUserId == currentUserId)); //质疑编号 CreateMap() @@ -206,7 +206,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.CurrentActionUserId, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUserId)) .ForMember(d => d.CurrentActionUserName, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUser.UserName)) - .ForMember(d => d.SubjectId, u => u.MapFrom(t => t.SubjectVisit.SubjectId )) + .ForMember(d => d.SubjectId, u => u.MapFrom(t => t.SubjectVisit.SubjectId)) .ForMember(d => d.ChallengeCode, u => u.MapFrom(s => "Q" + s.ChallengeCode.ToString("D5"))); @@ -217,9 +217,14 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.CurrentActionUserName, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUser.UserName)) .ForMember(d => d.SubjectId, u => u.MapFrom(t => t.SubjectVisit.SubjectId)) - .ForMember(d => d.DialogList, u => u.MapFrom(t => t.DialogList.OrderBy(t=>t.CreateTime))) + .ForMember(d => d.DialogList, u => u.MapFrom(t => t.DialogList.OrderBy(t => t.CreateTime))) .ForMember(d => d.ChallengeCode, u => u.MapFrom(s => "Q" + s.ChallengeCode.ToString("D5"))); + // 一致性核查文件 + CreateMap() + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.User.FirstName +"/"+ t.User.LastName)); + + //CRC 质疑列表 CreateMap() .ForMember(d => d.PreliminaryAuditUserName, u => u.MapFrom(s => s.SubjectVisit.PreliminaryAuditUser.UserName)) diff --git a/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs b/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs index 895102dd1..4fddb69c5 100644 --- a/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs +++ b/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs @@ -149,10 +149,10 @@ namespace IRaCIS.Core.Application.MediatR.Handlers dbSV.CheckTime = DateTime.Now; - await _subjectVisitRepository.SaveChangesAsync(); + } - + await _subjectVisitRepository.SaveChangesAsync(); return "OK"; } diff --git a/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs b/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs index a34aaa292..b719b0d67 100644 --- a/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs +++ b/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs @@ -46,5 +46,8 @@ namespace IRaCIS.Core.Domain.Share string RequestUrl { get; } Guid? SignId { get; set; } + + Guid? BatchId { get; set; } + } } diff --git a/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs b/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs index 3095839c8..b198fd938 100644 --- a/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs +++ b/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs @@ -242,6 +242,12 @@ namespace IRaCIS.Core.Domain.Share get; set; } + + public Guid? BatchId + { + + get; set; + } } public static class ClaimAttributes diff --git a/IRaCIS.Core.Domain/QC/ConsistencyCheckFile.cs b/IRaCIS.Core.Domain/QC/ConsistencyCheckFile.cs new file mode 100644 index 000000000..2107721db --- /dev/null +++ b/IRaCIS.Core.Domain/QC/ConsistencyCheckFile.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace IRaCIS.Core.Domain.Models +{ + /// + /// 一致性核查文件 + /// + [Table("ConsistencyCheckFile")] + public class ConsistencyCheckFile : Entity, IAuditAdd + { + /// + /// 文件名称 + /// + public string FileName { get; set; } + + /// + /// 文件路径 + /// + public string FilePath { get; set; } + + /// + /// 相对路径 + /// + public string RelativePaths { get; set; } + + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 项目ID + /// + public Guid TrialId { get; set; } + + + /// + /// 创建人 + /// + [ForeignKey("CreateUserId")] + public User User { get; set; } + + } + + +} diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index 27548b937..ae43f1356 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -154,7 +154,6 @@ namespace IRaCIS.Core.Domain.Models /// public Guid? VisitStageId { get; set; } - /// /// 通用Id /// @@ -169,6 +168,11 @@ namespace IRaCIS.Core.Domain.Models /// 上一条json /// public string LastJsonDetail { get; set; } + + /// + /// 批次Id + /// + public Guid BatchId { get; set; } } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index b3d385c6c..b10c5efa6 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3,6 +3,7 @@ using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore.Common.Dto; using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure.Extention; +using MassTransit; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; @@ -40,6 +41,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { _dbContext = dbContext; _userInfo = userInfo; + _userInfo.BatchId = _userInfo.BatchId == null ? NewId.NextGuid() : _userInfo.BatchId; } /// @@ -749,6 +751,17 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } + + // 一致性核查文件 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ConsistencyCheckFile))) + { + await InsertInspection(item.Entity, type, x => new DataInspection() + { + GeneralId = x.Id, + CreateTime=x.CreateTime, + }); + } + // Qc 问题答案 if (entitys.Any(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer))) { @@ -1021,7 +1034,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common Inspection = generalData }; add.JsonDetail = inspectionData.ToJsonStr(); - + add.BatchId = _userInfo.BatchId.Value; await _dbContext.DataInspection.AddAsync(add); } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 7c861226a..c2316a26a 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -348,6 +348,8 @@ namespace IRaCIS.Core.Infra.EFCore public virtual DbSet FrontAuditConfig { get; set; } + public virtual DbSet ConsistencyCheckFile { get; set; } + public virtual DbSet CommonDocument { get; set; } public virtual DbSet SystemNotice { get; set; }