diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 2615f37f1..c16a14530 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -495,6 +495,11 @@
是否来自于系统数据
+
+
+ 是否使用
+
+
名称
diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs
index d90ffa6d1..2d3852321 100644
--- a/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs
@@ -107,29 +107,23 @@ namespace IRaCIS.Application.Services
public async Task SetClinicalDataCheckd(SetClinicalDataCheckdIndto setClinicalData)
{
// 为了后面稽查这样写
-
var nocheckids =await _clinicalDataTrialSetRepository.Where(x => x.TrialId == setClinicalData.TrialId && setClinicalData.ClinicalDataTrialIds.Contains(x.Id)).Select(x => x.Id).ToListAsync();
-
foreach (var item in setClinicalData.ClinicalDataTrialIds)
{
-
-
await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet()
{
IsCheck = true
});
-
}
+
+
foreach (var item in nocheckids)
{
-
-
await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet()
{
IsCheck = false
});
-
}
await _clinicalDataTrialSetRepository.SaveChangesAsync();
@@ -157,7 +151,7 @@ namespace IRaCIS.Application.Services
ClinicalDataLevel=x.ClinicalDataLevel,
ClinicalUploadType=x.ClinicalUploadType,
TrialId= trialId,
- IsEnable=x.IsEnable,
+
}).ToList();
await _clinicalDataTrialSetRepository.AddRangeAsync(dataSets);
var result= await _clinicalDataTrialSetRepository.SaveChangesAsync();
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.cs
index 90c17b9e8..aab53210f 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalDataServiceViewModel.cs
@@ -67,7 +67,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
///
/// 项目ID
///
- public Guid? TrialId { get; set; }
+ public Guid TrialId { get; set; }
///
/// 系统的ClinicalDataSetId
@@ -89,6 +89,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
return this.SystemClinicalDataSetId == null ? false : true;
}
}
+
+ ///
+ /// 是否使用
+ ///
+ public bool IsUsed { get; set; } = false;
}
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
index ac3e23409..06c2782a4 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs
@@ -199,6 +199,8 @@ namespace IRaCIS.Core.Application.Contracts
public List CriterionIds { get; set; } = new List();
+ public List ClinicalDataSetNames { get; set; } = new List();
+
public bool IsTrialProcessConfirmed { get; set; }
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs
index 83e98c540..9388e9c77 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs
@@ -143,6 +143,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap();
CreateMap().ForMember(t => t.TrialId, u => u.MapFrom(c => c.Id))
+ .ForMember(t => t.ClinicalDataSetNames, u => u.MapFrom(c => c.clinicalDataTrialSets.Where(v => v.IsCheck).Select(r => r.ClinicalDataSetName)))
.ForMember(t => t.CriterionIds, u => u.MapFrom(c => c.TrialDicList.Where(v => v.KeyName == StaticData.Criterion).Select(r => r.DictionaryId)));
CreateMap();
CreateMap();
diff --git a/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs b/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs
index 40ba64e38..0715165cc 100644
--- a/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs
+++ b/IRaCIS.Core.Application/Triggers/SubjectVisitFinalVisitTrigger.cs
@@ -12,12 +12,23 @@ namespace IRaCIS.Core.Application.Triggers
public class SubjectVisitFinalVisitTrigger : IAfterSaveTrigger
{
private readonly IRepository _subjectVisitRepository;
+ private readonly IRepository _readingPeriodSetRepository;
+ private readonly IRepository _readingPeriodPlanRepository;
+ private readonly IRepository _readModuleRepository;
private readonly IRepository _subjectRepository;
private readonly IRepository _repository;
- public SubjectVisitFinalVisitTrigger(IRepository subjectVisitRepository, IRepository subjectRepository, IRepository repository)
+ public SubjectVisitFinalVisitTrigger(IRepository subjectVisitRepository,
+
+ IRepository readingPeriodSetRepository,
+ IRepository readingPeriodPlanRepository,
+ IRepository readModuleRepository,
+ IRepository subjectRepository, IRepository repository)
{
_subjectVisitRepository = subjectVisitRepository;
+ this._readingPeriodSetRepository = readingPeriodSetRepository;
+ this._readingPeriodPlanRepository = readingPeriodPlanRepository;
+ this._readModuleRepository = readModuleRepository;
_subjectRepository = subjectRepository;
_repository = repository;
}
@@ -46,6 +57,20 @@ namespace IRaCIS.Core.Application.Triggers
u => new Subject() { Status = SubjectStatus.OnVisit, FinalSubjectVisitId = null });
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == subjectVisit.SubjectId && t.VisitExecuted == VisitExecutedEnum.Unavailable, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.UnExecuted });
+
+ var readingPeriodSet =await _readingPeriodSetRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.IsGlobal).FirstOrDefaultAsync();
+
+ if (readingPeriodSet != null)
+ {
+ await _readingPeriodPlanRepository.DeleteFromQueryAsync(x => x.ReadingPeriodSetId == readingPeriodSet.Id && x.SubjectVisitId == subjectVisit.Id);
+ await _readModuleRepository.DeleteFromQueryAsync(x => x.SubjectVisitId == subjectVisit.Id && x.ReadingPeriodSetId == readingPeriodSet.Id);
+
+ await _readModuleRepository.SaveChangesAsync();
+
+ }
+
+
+
}
}
@@ -54,12 +79,8 @@ namespace IRaCIS.Core.Application.Triggers
{
await VerifyDealFinalVisitAsync(subjectVisit);
}
-
-
-
}
-
private async Task VerifyDealFinalVisitAsync(SubjectVisit subjectVisit)
{
if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == subjectVisit.SubjectId && t.VisitNum > subjectVisit.VisitNum &&
@@ -86,9 +107,11 @@ namespace IRaCIS.Core.Application.Triggers
if (isGlobalReading)
{
- if (!await _repository.AnyAsync(x => x.TrialId == trialId && x.IsGlobal))
+ ReadingPeriodSet? readingPeriodSet =await _readingPeriodSetRepository.FirstOrDefaultNoTrackingAsync(x => x.TrialId == trialId && x.IsGlobal);
+
+ if (readingPeriodSet==null)
{
- var readingPeriodSet = new ReadingPeriodSet()
+ readingPeriodSet = new ReadingPeriodSet()
{
Id = NewId.NextGuid(),
ReadingScope = ReadingScopeEnum.All,
@@ -96,50 +119,42 @@ namespace IRaCIS.Core.Application.Triggers
IsTakeEffect = ReadingPeriodStatus.TakeEffect,
ReadingPeriodName = "Global",
TrialId = trialId,
-
EffectOfTime = DateTime.Now,
IsGlobal = true,
-
};
- readingPeriodSet.ReadingPeriodPlanList.Add(new ReadingPeriodPlan()
- {
- SubjectVisitId = subjectVisitId,
- ReadingPeriodSetId = readingPeriodSet.Id,
- });
-
-
- // 当前访视没有阅片期才添加
- if (!await _repository.AnyAsync(x => x.SubjectVisitId == subjectVisitId && x.ReadingSetType == ReadingSetType.ImageReading))
- {
- await _repository.AddAsync(new ReadModule()
- {
- ReadingPeriodSetId = readingPeriodSet.Id,
- IsUrgent = subjectVisit.IsUrgent,
- SubjectVisitId = subjectVisitId,
- Status = ReadModuleEnum.TaskAllocation,
- SubjectId = subjectVisit.SubjectId,
- ModuleName = "Global",// 全局阅片
- ReadingSetType = ReadingSetType.ImageReading,
- ModuleType = ModuleTypeEnum.Global,
- TrialId = subjectVisit.TrialId,
- VisitNum = subjectVisit.VisitNum,
- });
- }
-
-
- await _repository.AddAsync(readingPeriodSet);
+ await _readingPeriodSetRepository.AddAsync(readingPeriodSet);
}
+ await _readingPeriodPlanRepository.AddAsync(new ReadingPeriodPlan()
+ {
+ SubjectVisitId = subjectVisitId,
+ ReadingPeriodSetId = readingPeriodSet.Id,
+ });
+
+ // 当前访视没有阅片期才添加
+ if (!await _readModuleRepository.AnyAsync(x => x.SubjectVisitId == subjectVisitId && x.ReadingSetType == ReadingSetType.ImageReading))
+ {
+ await _readModuleRepository.AddAsync(new ReadModule()
+ {
+ ReadingPeriodSetId = readingPeriodSet.Id,
+ IsUrgent = subjectVisit.IsUrgent,
+ SubjectVisitId = subjectVisitId,
+ Status = ReadModuleEnum.TaskAllocation,
+ SubjectId = subjectVisit.SubjectId,
+ ModuleName = "Global",// 全局阅片
+ ReadingSetType = ReadingSetType.ImageReading,
+ ModuleType = ModuleTypeEnum.Global,
+ TrialId = subjectVisit.TrialId,
+ VisitNum = subjectVisit.VisitNum,
+ });
+ }
-
-
-
+ await _readModuleRepository.SaveChangesAsync();
}
}
}
}
-}
\ No newline at end of file
diff --git a/IRaCIS.Core.Domain/Reading/ClinicalDataTrialSet.cs b/IRaCIS.Core.Domain/Reading/ClinicalDataTrialSet.cs
index 582aefea5..7de81f08d 100644
--- a/IRaCIS.Core.Domain/Reading/ClinicalDataTrialSet.cs
+++ b/IRaCIS.Core.Domain/Reading/ClinicalDataTrialSet.cs
@@ -20,7 +20,6 @@ namespace IRaCIS.Core.Domain.Models
///
public Guid TrialId { get; set; }
-
///
/// 名称
///
@@ -53,16 +52,16 @@ namespace IRaCIS.Core.Domain.Models
///
public Guid CreateUserId { get; set; }
- ///
- /// 是否启用
- ///
- public bool IsEnable { get; set; }
-
///
/// 是否勾选
///
public bool IsCheck { get; set; }
+
+
+ [ForeignKey("TrialId")]
+ public Trial Trial { get; set; }
+
}
diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs
index 8607c2aca..e644561a7 100644
--- a/IRaCIS.Core.Domain/Trial/Trial.cs
+++ b/IRaCIS.Core.Domain/Trial/Trial.cs
@@ -59,6 +59,7 @@ namespace IRaCIS.Core.Domain.Models
+ public List clinicalDataTrialSets { get; set; }=new List { };
public virtual ICollection ClinicalTrialProjectDetails { get; set; }
public virtual ICollection TrialDicList { get; set; }