diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 1317e3467..97021d794 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2213,6 +2213,11 @@ 文件路径 + + + 限制编辑 + + 是否显示在Dicom阅片中 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index ad88fbdbc..6bbf104e1 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -167,6 +167,10 @@ namespace IRaCIS.Core.Application.ViewModel public ReReadingApplyState ReReadingApplyState { get; set; } public DateTime? SuggesteFinishedTime { get; set; } + //任务来源访视Id 方便回更访视读片状态 + public Guid? SourceSubjectVisitId { get; set; } + public Guid? SouceReadModuleId { get; set; } + } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index ee6d68232..92b79eda0 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -39,15 +39,19 @@ namespace IRaCIS.Core.Application.Service.Allocation private readonly IRepository _readingTaskQuestionAnswerRepository; private readonly IRepository _trialReadingCriterionRepository; + private readonly IRepository _readingClinicalDataReposiotry; + public VisitTaskService(IRepository subjectVisitRepository, IRepository visitTaskRepository, IRepository trialRepository, IRepository subjectRepository, IRepository subjectUserRepository, IRepository taskAllocationRuleRepository, IRepository readModuleRepository, IRepository visitTaskReReadingRepository, IRepository taskMedicalReviewRepository, IRepository readingTaskQuestionAnswerRepository - , IRepository trialReadingCriterionRepository + , IRepository trialReadingCriterionRepository, + IRepository readingClinicalDataReposiotry ) { + _readingClinicalDataReposiotry = readingClinicalDataReposiotry; _taskAllocationRuleRepository = taskAllocationRuleRepository; _visitTaskRepository = visitTaskRepository; _trialRepository = trialRepository; @@ -2188,7 +2192,7 @@ namespace IRaCIS.Core.Application.Service.Allocation return ResponseOutput.Ok(); } - + //包括临床数据签名状态 private async Task VisitBackAsync(Guid? subjectVisitId) { var sv = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId)).IfNullThrowException(); @@ -2224,6 +2228,18 @@ namespace IRaCIS.Core.Application.Service.Allocation sv.ReviewAuditUserId = null; + if (sv.IsBaseLine) + { + await _readingClinicalDataReposiotry.UpdatePartialFromQueryAsync(t => t.ReadingId == sv.Id && (t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.Subject || t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.SubjectVisit),c=>new ReadingClinicalData() { IsSign=false,ReadingClinicalDataState=ReadingClinicalDataStatus.HaveUploaded}); + + } + else + { + await _readingClinicalDataReposiotry.UpdatePartialFromQueryAsync(t => t.ReadingId == sv.Id && t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.SubjectVisit, c => new ReadingClinicalData() { IsSign = false, ReadingClinicalDataState =ReadingClinicalDataStatus.HaveUploaded }); + } + + + //await _repository.AddAsync(new CheckChallengeDialog() { SubjectVisitId = subjectVisitId, TalkContent = "PM/APM同意一致性核查回退。", UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt }); await _repository.BatchDeleteAsync(t => t.SubjectVisitId == subjectVisitId); diff --git a/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs b/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs index 08eaaee10..07449491a 100644 --- a/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/SubjectVisitCheckPassedTrigger.cs @@ -44,7 +44,7 @@ namespace IRaCIS.Core.Application.Triggers //退回或者重阅的任务一致性核查通过了 此时设置Subject 重阅影响状态 if (context.Entity.IsPMBackOrReReading == true) { - await _subjectRepository.UpdatePartialFromQueryAsync(t => t.Id == context.Entity.SubjectId, u => new Subject() { IsReReadingOrBackInfluenceAnalysis = false }); + await _subjectRepository.UpdatePartialFromQueryAsync(context.Entity.SubjectId, u => new Subject() { IsReReadingOrBackInfluenceAnalysis = false }); } context.Entity.IsPMBackOrReReading = false; diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 41244011d..39351ae80 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -2737,350 +2737,5 @@ namespace IRaCIS.Core.Infra.EFCore.Common - #region 待废弃 -by zhouhang 调整 - - - ///// - ///// 传入实体对象 - ///// - //public async Task IncomingEntitys(List entitys) - //{ - // // 修改 - // await InsertAddEntitys( - // entitys.Where(x => x.State == EntityState.Modified && - // (!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) || !(bool)x.Entity.GetType().GetProperty(nameof(ISoftDelete.IsDeleted)).GetValue(x.Entity) || NodeleteTableTypes.Contains(x.Entity.GetType())) - // ).ToList(), AuditOpt.Update); - - // // 新增 - // await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Added).ToList(), AuditOpt.Add); - - // // 删除 - // await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Deleted - // || (typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) && (bool)x.Entity.GetType().GetProperty(nameof(ISoftDelete.IsDeleted)).GetValue(x.Entity) && x.State == EntityState.Modified && !NodeleteTableTypes.Contains(x.Entity.GetType())) - // ).ToList(), AuditOpt.Deleted); - - - //} - - //// 非Dicom文件 - //if (entitys.Any(x => x.Entity.GetType() == typeof(NoneDicomStudyFile))) - //{ - // var noneDicomStudyfile = entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)).Select(x => x.Entity).FirstOrDefault() as NoneDicomStudyFile; - // var noneDicomStudy = await _dbContext.NoneDicomStudy.Where(x => x.Id == noneDicomStudyfile.NoneDicomStudyId).FirstOrDefaultAsync(); - // if (noneDicomStudy != null) - // { - // var filecount = await _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == noneDicomStudyfile.NoneDicomStudyId).CountAsync(); - // var count = entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)).ToList().Count; - // if (type == "Deleted") - // { - // filecount = filecount - count; - // } - // else - // { - // filecount = filecount + count; - // } - - // await InsertInspection(noneDicomStudy, type, null, new - // { - // FileCount = filecount, - // }); - - // } - //} - - /// - /// 获取稽查通用数据 (每条稽查记录必须查询的) - /// - /// - /// - public async Task GetInspectionGeneralDataAsync(InspectionConvertDTO inspection) - { - - InspectionGeneralData generalData = new InspectionGeneralData() - { - SiteCode = inspection.SiteCode, - SiteId = inspection.SiteId, - //SiteName = inspection.SiteName, - SubjectCode = inspection.SubjectCode, - SubjectId = inspection.SubjectId, - SubjectVisitId = inspection.SubjectVisitId, - SubjectVisitName = inspection.SubjectVisitName, - ResearchProgramNo = inspection.ResearchProgramNo, - TrialId = inspection.TrialId, - TrialName = inspection.TrialName - }; - - - - - #region 访视 阅片期那里关联了访视 - - //if (generalData.SubjectVisitId != null) - //{ - // //添加访视的时候,会带信息过来 - // if (string.IsNullOrEmpty(generalData.SubjectVisitName)) - // { - // var info = (await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x => - // new { x.VisitName, x.SubjectId, x.SiteId, SubjectCode = x.Subject.Code, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException(); - - // generalData.SubjectVisitName = info.VisitName; - - // generalData.TrialId = info.TrialId; - // generalData.TrialName = info.ExperimentName; - // generalData.ResearchProgramNo = info.ResearchProgramNo; - // generalData.SiteId = info.SiteId; - // generalData.SubjectCode = info.SubjectCode; - // generalData.SubjectId = info.SubjectId; - // generalData.SiteCode = info.TrialSiteCode; - // } - //} - - - #endregion - - - #region 受试者 - - if (generalData.SubjectId != null) - { - - // 添加Subject 哪里会带信息过来 - if (string.IsNullOrEmpty(generalData.SubjectCode)) - { - var info = (await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => new { SubjectId = x.Id, SubjectCode = x.Code, x.SiteId, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException(); - - - generalData.TrialId = info.TrialId; - generalData.TrialName = info.ExperimentName; - generalData.ResearchProgramNo = info.ResearchProgramNo; - generalData.SiteId = info.SiteId; - generalData.SubjectCode = info.SubjectCode; - generalData.SubjectId = info.SubjectId; - generalData.SiteCode = info.TrialSiteCode; - - } - } - - #endregion - - - - #region 中心Code - - if (generalData.TrialId != null && generalData.SiteId != null) - { - - generalData.SiteCode = (await _dbContext.TrialSite.IgnoreQueryFilters().Where(x => x.TrialId == generalData.TrialId && x.SiteId == generalData.SiteId).Select(t => t.TrialSiteCode).FirstOrDefaultAsync()).IfNullThrowException(); - - - } - - - #endregion - - - #region 项目名称 - - - if (generalData.TrialId != null) - { - - //项目添加哪里 直接会带信息过来,不用查询数据库 其他的地方需要查询数据库 - if (string.IsNullOrEmpty(generalData.ResearchProgramNo) || string.IsNullOrEmpty(generalData.TrialName)) - { - var trialdata = (await _dbContext.Trial.Select(x => new { x.Id, x.ResearchProgramNo, x.ExperimentName, }).FirstOrDefaultAsync(x => x.Id == generalData.TrialId)).IfNullThrowException(); - - generalData.ResearchProgramNo = trialdata.ResearchProgramNo; - - generalData.TrialName = trialdata.ExperimentName; - } - } - - #endregion - - - - return generalData; - } - - - - - - ///// - ///// 映射数据 - ///// - ///// - ///// 要赋值的对象 - //public void MapData(dynamic data, dynamic mapData) - //{ - // List column = new List() { "TrialId", "SiteId", "SubjectId", "SubjectVisitId", "CreateUserName", "TrialName", "SiteName", "SubjectCode", "VisitName", "SubjectVisitName", "RoleName", "SiteCode", "ResearchProgramNo" }; - // foreach (var item in column) - // { - // try - // { - // var i = mapData.GetType().GetProperty(item).GetValue(mapData); - // if (i == null || i == default(Guid)) - // { - // var value = data.GetType().GetProperty(item).GetValue(data); - // mapData.GetType().GetProperty(item).SetValue(mapData, value); - // } - - // } - // catch (Exception) - // { - // continue; - - // } - // } - //} - - ///// - ///// 添加稽查 - ///// - ///// 新增的稽查对象 - ///// 数据 - ///// - ///// - //public async Task AddInspectionRecordAsync(T data, InspectionConvertDTO add, object otherItem = null) where T : class - //{ - // //MapData(data, add); - - // MapEntityPropertyToAuditEntity(data, add); - - // InspectionGeneralData generalData = new InspectionGeneralData() - // { - // //CreateUserName = add.CreateUserName, - // SiteCode = add.SiteCode, - // SiteId = add.SiteId, - // //SiteName = add.SiteName, - // SubjectCode = add.SubjectCode, - // SubjectId = add.SubjectId, - // SubjectVisitId = add.SubjectVisitId, - // SubjectVisitName = add.SubjectVisitName, - // ResearchProgramNo = add.ResearchProgramNo, - // //RoleName = add.RoleName, - // TrialId = add.TrialId, - // TrialName = add.TrialName - // }; - - // await SetInspectionNameValue(generalData); - - // #region 处理标识 - - // var from = await _dbContext.FrontAuditConfig.FirstOrDefaultAsync(x => x.Identification == add.Identification); - // add.ObjectTypeId = from?.ObjectTypeId; - // add.OptTypeId = from?.OptTypeId; - // add.ChildrenTypeId = from?.ChildrenTypeId; - // add.ModuleTypeId = from?.ModuleTypeId; - - // #endregion - // if (add.ParentId == null) - // { - // add.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.VisitStageId == add.VisitStageId && x.GeneralId == add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; - // } - // add.CreateUserId = _userInfo.Id; - // add.IP = _userInfo.IP; - // add.CreateTime = add.CreateTime == default(DateTime) ? DateTime.Now : add.CreateTime; - - // if (_userInfo.SignId != null) - // { - // add.SignId = _userInfo.SignId; - // add.IsSign = true; - // } - - // var inspectionData = new InspectionJsonDetail() - // { - // //稽查实体,加上扩充的信息 - // Data = AddJsonItem(data, otherItem), - - // //通用信息 - // CommonData = generalData - // }; - // add.JsonDetail = inspectionData.ToJsonStr(); - // add.BatchId = _userInfo.BatchId.Value; - // await _dbContext.DataInspection.AddAsync(add); - //} - - - ///// - ///// 设置项目以及名称 - ///// - ///// - ///// - //public async Task SetInspectionNameValue(InspectionGeneralData generalData) - //{ - // #region 项目名称 - - - // if (generalData.TrialId != null) - // { - - // //项目添加哪里 直接会带信息过来,不用查询数据库 其他的地方需要查询数据库 - // if (string.IsNullOrEmpty(generalData.ResearchProgramNo) || string.IsNullOrEmpty(generalData.TrialName)) - // { - // var trialdata = (await _dbContext.Trial.Select(x => new { x.Id, x.ResearchProgramNo, x.ExperimentName, }).FirstOrDefaultAsync(x => x.Id == generalData.TrialId)).IfNullThrowException(); - - // generalData.ResearchProgramNo = trialdata.ResearchProgramNo; - - // generalData.TrialName = trialdata.ExperimentName; - // } - // } - - // #endregion - - // #region 测试中心名称 - - // if (generalData.TrialId != null && generalData.SiteId != null) - // { - - // generalData.SiteCode = (await _dbContext.TrialSite.IgnoreQueryFilters().Where(x => x.TrialId == generalData.TrialId && x.SiteId == generalData.SiteId).Select(t => t.TrialSiteCode).FirstOrDefaultAsync()).IfNullThrowException(); - - - // //// 添加Site 哪里会带信息过来 - // //if (string.IsNullOrEmpty(generalData.SiteName)) - // //{ - // // generalData.SiteName = (await _dbContext.Site.Where(x => x.Id == generalData.SiteId).Select(x => x.SiteName).FirstOrDefaultAsync()).IfNullThrowException(); - - // //} - // } - - - // #endregion - - // #region 受试者 - - // if (generalData.SubjectId != null) - // { - - // // 添加Subject 哪里会带信息过来 - // if (string.IsNullOrEmpty(generalData.SubjectCode)) - // { - // generalData.SubjectCode = (await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => x.Code).FirstOrDefaultAsync()).IfNullThrowException(); - - // } - // } - - // #endregion - - // #region 访视 - - // if (generalData.SubjectVisitId != null) - // { - // //添加访视的时候,会带信息过来 - // if (string.IsNullOrEmpty(generalData.SubjectVisitName)) - // { - // generalData.SubjectVisitName = (await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x => x.VisitName).FirstOrDefaultAsync()).IfNullThrowException(); - // } - // } - - - // #endregion - - //} - - - #endregion - } }