修改一版

This commit is contained in:
he
2022-06-08 11:40:52 +08:00
parent f3b21e4cd4
commit f47978bca2
8 changed files with 108 additions and 15 deletions
@@ -10,6 +10,7 @@ using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Application.Auth;
using IRaCIS.Core.Domain.Share.Reading;
using IRaCIS.Core.Infra.EFCore.Common;
using MassTransit;
namespace IRaCIS.Core.Application.Services
{
@@ -18,14 +19,20 @@ namespace IRaCIS.Core.Application.Services
{
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository<ReadModule> _readModuleRepository;
private readonly IRepository<ReadingPeriodSet> _readingPeriodSetRepository;
private readonly IRepository<ReadingPeriodPlan> _readingPeriodPlanRepository;
private readonly IRepository<Subject> _subjectRepository;
public SubjectVisitService(IRepository<SubjectVisit> subjectVisitRepository,
IRepository<ReadModule> readModuleRepository,
IRepository<ReadingPeriodSet> readingPeriodSetRepository,
IRepository<ReadingPeriodPlan> readingPeriodPlanRepository,
IRepository<Subject> subjectRepository)
{
_subjectVisitRepository = subjectVisitRepository;
this._readModuleRepository = readModuleRepository;
this._readingPeriodSetRepository = readingPeriodSetRepository;
this._readingPeriodPlanRepository = readingPeriodPlanRepository;
_subjectRepository = subjectRepository;
}
@@ -103,6 +110,32 @@ namespace IRaCIS.Core.Application.Services
// 末次访视添加全局阅片
if (dbBeforeEntity.IsFinalVisit == false && svCommand.IsFinalVisit == true)
{
ReadingPeriodSet? readingPeriodSet =await _readingPeriodSetRepository.FirstOrDefaultNoTrackingAsync(x => x.TrialId == dbBeforeEntity.TrialId && x.ReadingPeriodName == "Global");
if (readingPeriodSet == null)
{
readingPeriodSet = new ReadingPeriodSet()
{
Id = NewId.NextGuid(),
ReadingScope = ReadingScopeEnum.All,
ReadingSetType = ReadingSetType.ImageReading,
IsTakeEffect = ReadingPeriodStatus.TakeEffect,
ReadingPeriodName = "Global",
TrialId = dbBeforeEntity.TrialId,
};
await _readingPeriodSetRepository.AddAsync(readingPeriodSet);
}
await _readingPeriodPlanRepository.AddAsync(new ReadingPeriodPlan()
{
SubjectVisitId = dbBeforeEntity.Id,
ReadingPeriodSetId = readingPeriodSet.Id,
});
// 当前访视没有阅片期才添加
if (!await _readModuleRepository.AnyAsync(x => x.SubjectVisitId == svCommand.Id && x.ReadingSetType == ReadingSetType.ImageReading))
{
@@ -110,9 +143,9 @@ namespace IRaCIS.Core.Application.Services
{
IsUrgent = dbBeforeEntity.IsUrgent,
SubjectVisitId = svCommand.Id.Value,
Status = ReadingCommon.GetVisitSubmitStateEnum(dbBeforeEntity),
Status = ReadModuleEnum.TaskAllocation,
SubjectId = dbBeforeEntity.SubjectId,
ModuleName="G",// 全局阅片
ModuleName= "Global",// 全局阅片
ReadingSetType= ReadingSetType.ImageReading,
ModuleType=ModuleTypeEnum.Global,
});