修改一版
parent
f3b21e4cd4
commit
f47978bca2
|
@ -865,6 +865,11 @@
|
|||
阅片期名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.ReadingSetType">
|
||||
<summary>
|
||||
类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto">
|
||||
<summary>
|
||||
获取影像阅片预览的Dto
|
||||
|
|
|
@ -82,7 +82,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public class PreviewTheReadingListInDto : PageInput
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 中心ID
|
||||
/// </summary>
|
||||
|
@ -113,6 +112,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public string ReadingPeriodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public ReadingSetType ReadingSetType { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -171,6 +175,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public string SubjectVisitName { get; set; }
|
||||
|
||||
public DateTime? EffectOfTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class ReadingPeriodSetView
|
||||
|
@ -221,6 +228,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生效时间
|
||||
/// </summary>
|
||||
public DateTime? EffectOfTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
|
|
|
@ -420,6 +420,7 @@ namespace IRaCIS.Application.Services
|
|||
ModuleName = dto.Name,
|
||||
SubjectVisitId = visit.Id,
|
||||
ReadingSetType= dto.ReadingSetType,
|
||||
TrialId= dto.TrialId,
|
||||
Status = ReadingCommon.GetVisitSubmitStateEnum(visit),
|
||||
|
||||
});
|
||||
|
|
|
@ -49,6 +49,14 @@ namespace IRaCIS.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddOrUpdateReadingPeriodSet(ReadingPeriodSetAddOrEdit addOrEditReadingPeriodSet)
|
||||
{
|
||||
if (await _readingPeriodSetRepository.AnyAsync(x => x.Id != addOrEditReadingPeriodSet.Id && x.ReadingPeriodName == addOrEditReadingPeriodSet.ReadingPeriodName))
|
||||
{
|
||||
return ResponseOutput.NotOk("阅片期名称重复,操作失败");
|
||||
}
|
||||
if (addOrEditReadingPeriodSet.ReadingPeriodName == "Global")
|
||||
{
|
||||
return ResponseOutput.NotOk("阅片期名称不能为");
|
||||
}
|
||||
if (addOrEditReadingPeriodSet.Id == null)
|
||||
{
|
||||
var entity = _mapper.Map<ReadingPeriodSet>(addOrEditReadingPeriodSet);
|
||||
|
@ -113,9 +121,18 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
|
||||
visitQuery = visitQuery.Where(x => inDto.SiteIds.Contains(x.SiteId));
|
||||
|
||||
}
|
||||
visitQuery = visitQuery.WhereIf(inDto.ExpirationDate != null, x => x.LatestScanDate <= inDto.ExpirationDate.Value)
|
||||
|
||||
//var
|
||||
var existsBubjectVisits = await _readModuleRepository.Where(y => y.ReadingSetType == inDto.ReadingSetType && y.TrialId == inDto.TrialId).Select(x => x.SubjectVisitId).ToListAsync();
|
||||
visitQuery = visitQuery.Where(x => existsBubjectVisits.Where(y =>x.Id == y).Count() == 0)
|
||||
.WhereIf(inDto.ExpirationDate != null, x => x.LatestScanDate <= inDto.ExpirationDate.Value)
|
||||
.WhereIf(inDto.ExpirationVisitNum != null, x => x.VisitNum == inDto.ExpirationVisitNum);
|
||||
|
||||
|
||||
|
||||
|
||||
var subjectIdlist = await visitQuery.OrderBy(x => x.SubjectId).Select(x => x.SubjectId).Distinct().Skip((inDto.PageIndex - 1) * inDto.PageSize).Take(inDto.PageSize).ToListAsync();
|
||||
var totalCount = visitQuery.Select(x => x.SubjectId).Distinct().Count();
|
||||
var visitlist= await visitQuery.Include(x=>x.Subject).Include(x=>x.TrialSite).Where(x => subjectIdlist.Contains(x.SubjectId)).ToListAsync();
|
||||
|
@ -216,7 +233,8 @@ namespace IRaCIS.Application.Services
|
|||
SubjectCode = x.SubjectVisit.Subject.Code,
|
||||
SubjectId = x.SubjectVisit.SubjectId,
|
||||
SubjectVisitName = x.SubjectVisit.VisitName,
|
||||
});
|
||||
EffectOfTime=x.ReadingPeriodSet.EffectOfTime,
|
||||
});
|
||||
|
||||
return await plans.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField == null ? "SubjectId" : inDto.SortField,
|
||||
inDto.Asc);
|
||||
|
@ -237,6 +255,11 @@ namespace IRaCIS.Application.Services
|
|||
.ProjectTo<ReadingPeriodSetView>(_mapper.ConfigurationProvider);
|
||||
var pageList= await readQuery.ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField == null ? "CreateTime" : query.SortField,
|
||||
query.Asc);
|
||||
|
||||
pageList.CurrentPageData.ForEach(x =>
|
||||
{
|
||||
x.SubjectVisitName = x.ReadingPeriodName == "Global" ? "末次访视" : x.SubjectVisitName;
|
||||
});
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
@ -266,10 +289,12 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
if (indto.IsTakeEffect == ReadingPeriodStatus.TakeEffect)
|
||||
{
|
||||
var readingPeriodSet =await _readingPeriodSetRepository.FirstOrDefaultAsync(x => x.Id == indto.Id);
|
||||
var plans = _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == indto.Id).Include(x=>x.SubjectVisit)
|
||||
.Include(x => x.ReadingPeriodSet).ToList();
|
||||
var needAddVisitIds = plans.Select(x => x.SubjectVisitId).ToList();
|
||||
var repeatVisitNames = _readModuleRepository.Where(x => x.ReadingSetType == ReadingSetType.ImageReading && needAddVisitIds.Contains(x.SubjectVisitId)).Select(x => x.SubjectVisit.VisitName).ToList();
|
||||
var repeatVisitNames = _readModuleRepository.Where(x => x.ReadingSetType == ReadingSetType.ImageReading && needAddVisitIds.Contains(x.SubjectVisitId)).Select(x =>x.Subject.Code+"的"+ x.SubjectVisit.VisitName).ToList();
|
||||
|
||||
if(repeatVisitNames.Count!=0)
|
||||
{
|
||||
return ResponseOutput.NotOk($"{string.Join(",", repeatVisitNames)}已经添加过阅片期,无法设置生效");
|
||||
|
@ -288,7 +313,8 @@ namespace IRaCIS.Application.Services
|
|||
SubjectVisitId = item.SubjectVisitId,
|
||||
ReadingSetType = item.ReadingPeriodSet.ReadingSetType,
|
||||
ReadingPeriodSetId= item.ReadingPeriodSet.Id,
|
||||
Status = ReadingCommon.GetVisitSubmitStateEnum(item.SubjectVisit),
|
||||
Status = ReadModuleEnum.TaskAllocation,
|
||||
TrialId = readingPeriodSet.TrialId,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -300,7 +326,8 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
var readQuery =await _readingPeriodSetRepository.UpdatePartialFromQueryAsync(indto.Id, x => new ReadingPeriodSet() {
|
||||
IsTakeEffect = indto.IsTakeEffect
|
||||
IsTakeEffect = indto.IsTakeEffect,
|
||||
EffectOfTime= indto.IsTakeEffect== ReadingPeriodStatus.TakeEffect?DateTime.Now:null,
|
||||
});
|
||||
|
||||
var result = await _readingPeriodSetRepository.SaveChangesAsync();
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -113,19 +113,24 @@ namespace IRaCIS.Core.Domain.Share.Reading
|
|||
ImageQuality = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 一致性核查及分配
|
||||
/// 一致性核查
|
||||
/// </summary>
|
||||
ConsistencyCheck = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 任务分配
|
||||
/// </summary>
|
||||
TaskAllocation = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 影像阅片
|
||||
/// </summary>
|
||||
ImageRead = 3,
|
||||
ImageRead = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 阅片完成
|
||||
/// </summary>
|
||||
ReadComplete = 4,
|
||||
ReadComplete = 5,
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,11 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public Guid? ReadModuleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对应
|
||||
/// </summary>
|
||||
|
|
|
@ -52,10 +52,15 @@ namespace IRaCIS.Core.Domain.Models
|
|||
[ForeignKey("VisitStageId")]
|
||||
public VisitStage? VisitStage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否生效
|
||||
/// </summary>
|
||||
public ReadingPeriodStatus IsTakeEffect { get; set; }
|
||||
/// <summary>
|
||||
/// 是否生效
|
||||
/// </summary>
|
||||
public ReadingPeriodStatus IsTakeEffect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生效时间
|
||||
/// </summary>
|
||||
public DateTime? EffectOfTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
|
|
Loading…
Reference in New Issue