修改一版
parent
0f9c391f28
commit
d1064cce02
|
@ -495,6 +495,11 @@
|
|||
是否来自于系统数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataTrialSetView.IsUsed">
|
||||
<summary>
|
||||
是否使用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataSystemSetView.ClinicalDataSetName">
|
||||
<summary>
|
||||
名称
|
||||
|
|
|
@ -107,29 +107,23 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<IResponseOutput> 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();
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public Guid? TrialId { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统的ClinicalDataSetId
|
||||
|
@ -89,6 +89,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
return this.SystemClinicalDataSetId == null ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用
|
||||
/// </summary>
|
||||
public bool IsUsed { get; set; } = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -199,6 +199,8 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public List<Guid> CriterionIds { get; set; } = new List<Guid>();
|
||||
|
||||
public List<string> ClinicalDataSetNames { get; set; } = new List<string>();
|
||||
|
||||
public bool IsTrialProcessConfirmed { get; set; }
|
||||
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<AssginSiteCRCCommand, TrialSiteUser>();
|
||||
CreateMap<Domain.Models.Trial, TrialConfigDTO>().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<Domain.Models.Trial, TrialSubjectConfig>();
|
||||
CreateMap<Domain.Models.Trial, TrialSubjectAndSVConfig>();
|
||||
|
|
|
@ -12,12 +12,23 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
public class SubjectVisitFinalVisitTrigger : IAfterSaveTrigger<SubjectVisit>
|
||||
{
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
private readonly IRepository<ReadingPeriodSet> _readingPeriodSetRepository;
|
||||
private readonly IRepository<ReadingPeriodPlan> _readingPeriodPlanRepository;
|
||||
private readonly IRepository<ReadModule> _readModuleRepository;
|
||||
private readonly IRepository<Subject> _subjectRepository;
|
||||
private readonly IRepository _repository;
|
||||
|
||||
public SubjectVisitFinalVisitTrigger(IRepository<SubjectVisit> subjectVisitRepository, IRepository<Subject> subjectRepository, IRepository repository)
|
||||
public SubjectVisitFinalVisitTrigger(IRepository<SubjectVisit> subjectVisitRepository,
|
||||
|
||||
IRepository<ReadingPeriodSet> readingPeriodSetRepository,
|
||||
IRepository<ReadingPeriodPlan> readingPeriodPlanRepository,
|
||||
IRepository<ReadModule> readModuleRepository,
|
||||
IRepository<Subject> 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<ReadingPeriodSet>(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<ReadModule>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
|
@ -53,16 +52,16 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否勾选
|
||||
/// </summary>
|
||||
public bool IsCheck { get; set; }
|
||||
|
||||
|
||||
|
||||
[ForeignKey("TrialId")]
|
||||
public Trial Trial { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
|
||||
|
||||
public List<ClinicalDataTrialSet> clinicalDataTrialSets { get; set; }=new List<ClinicalDataTrialSet> { };
|
||||
|
||||
public virtual ICollection<TrialStatusDetail> ClinicalTrialProjectDetails { get; set; }
|
||||
public virtual ICollection<TrialDictionary> TrialDicList { get; set; }
|
||||
|
|
Loading…
Reference in New Issue