修改一版
parent
7db0a20426
commit
6a9faa690a
|
@ -737,6 +737,71 @@
|
||||||
是否生效
|
是否生效
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingToGenerateInDto.ReadingPeriodSetId">
|
||||||
|
<summary>
|
||||||
|
阅片期ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingToGenerateInDto.SubjectVisitIds">
|
||||||
|
<summary>
|
||||||
|
访视ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.ReadingPeriodSetId">
|
||||||
|
<summary>
|
||||||
|
阅片期ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto">
|
||||||
|
<summary>
|
||||||
|
获取影像阅片预览的Dto
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.TrialSiteCode">
|
||||||
|
<summary>
|
||||||
|
项目中心Code
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.SubjectVisitId">
|
||||||
|
<summary>
|
||||||
|
访视Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.SubjectId">
|
||||||
|
<summary>
|
||||||
|
受试者Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.SubjectCode">
|
||||||
|
<summary>
|
||||||
|
受试者名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.Remark">
|
||||||
|
<summary>
|
||||||
|
备注
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.LatestScanDate">
|
||||||
|
<summary>
|
||||||
|
最晚拍片日期
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.ExpirationDate">
|
||||||
|
<summary>
|
||||||
|
截止日期
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.ReadingPeriodSetId">
|
||||||
|
<summary>
|
||||||
|
阅片期ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.ReadingPeriodName">
|
||||||
|
<summary>
|
||||||
|
阅片期名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingPeriodSetView.Id">
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingPeriodSetView.Id">
|
||||||
<summary>
|
<summary>
|
||||||
id
|
id
|
||||||
|
@ -2985,6 +3050,19 @@
|
||||||
<param name="addOrEditReadingPeriodSet"></param>
|
<param name="addOrEditReadingPeriodSet"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.GetPreviewTheReadingList(IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto)">
|
||||||
|
<summary>
|
||||||
|
获取影像阅片的预览
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.ReadingToGenerate(IRaCIS.Core.Application.Service.Reading.Dto.ReadingToGenerateInDto)">
|
||||||
|
<summary>
|
||||||
|
添加对应的阅片
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.GetReadingPeriodSetList(IRaCIS.Core.Application.Service.Reading.Dto.ReadingPeriodSetQuery)">
|
<member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.GetReadingPeriodSetList(IRaCIS.Core.Application.Service.Reading.Dto.ReadingPeriodSetQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
分页获取
|
分页获取
|
||||||
|
@ -3023,13 +3101,6 @@
|
||||||
获取读片模块
|
获取读片模块
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.ReadModuleService.GetVisitSubmitStateEnum(IRaCIS.Core.Domain.Models.SubjectVisit)">
|
|
||||||
<summary>
|
|
||||||
获取访视的状态
|
|
||||||
</summary>
|
|
||||||
<param name="visit"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Application.Services.ReadModuleService.GetReadModuleSingle(IRaCIS.Core.Application.Service.Reading.Dto.GetReadModuleSingleIndto)">
|
<member name="M:IRaCIS.Application.Services.ReadModuleService.GetReadModuleSingle(IRaCIS.Core.Application.Service.Reading.Dto.GetReadModuleSingleIndto)">
|
||||||
<summary>
|
<summary>
|
||||||
获取单条信息
|
获取单条信息
|
||||||
|
|
|
@ -48,12 +48,89 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ReadingPeriodStatus IsTakeEffect { get; set; } = ReadingPeriodStatus.NotTakeEffect;
|
public ReadingPeriodStatus IsTakeEffect { get; set; } = ReadingPeriodStatus.NotTakeEffect;
|
||||||
|
|
||||||
|
public ReadingSetType ReadingSetType { get; set; } = ReadingSetType.ImageReading;
|
||||||
|
|
||||||
public List<Guid> SiteIds { get; set; } = new List<Guid>();
|
public List<Guid> SiteIds { get; set; } = new List<Guid>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class ReadingToGenerateInDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 阅片期ID
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public Guid ReadingPeriodSetId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访视ID
|
||||||
|
/// </summary>
|
||||||
|
public List<Guid> SubjectVisitIds { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PreviewTheReadingListInDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 阅片期ID
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public Guid ReadingPeriodSetId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取影像阅片预览的Dto
|
||||||
|
/// </summary>
|
||||||
|
public class PreviewTheReadingListOutDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 项目中心Code
|
||||||
|
/// </summary>
|
||||||
|
public string TrialSiteCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访视Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 受试者Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid SubjectId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 受试者名称
|
||||||
|
/// </summary>
|
||||||
|
public string SubjectCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最晚拍片日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? LatestScanDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 截止日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ExpirationDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 阅片期ID
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public Guid ReadingPeriodSetId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 阅片期名称
|
||||||
|
/// </summary>
|
||||||
|
public string ReadingPeriodName { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public class ReadingPeriodSetView
|
public class ReadingPeriodSetView
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||||
|
// 生成时间 2021-12-23 13:20:59
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
using IRaCIS.Core.Domain.Share.Reading;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
|
{
|
||||||
|
public interface IReadModuleService
|
||||||
|
{
|
||||||
|
ReadModuleEnum GetVisitSubmitStateEnum(SubjectVisit visit);
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,8 @@ using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Domain.Share.Reading;
|
using IRaCIS.Core.Domain.Share.Reading;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Panda.DynamicWebApi.Attributes;
|
using Panda.DynamicWebApi.Attributes;
|
||||||
|
using IRaCIS.Core.Application.Contracts;
|
||||||
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -17,7 +19,7 @@ namespace IRaCIS.Application.Services
|
||||||
/// 生成的阅片模块(在大列表上展示的) 阅片期
|
/// 生成的阅片模块(在大列表上展示的) 阅片期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiExplorerSettings(GroupName = "Reading")]
|
[ApiExplorerSettings(GroupName = "Reading")]
|
||||||
public class ReadModuleService : BaseService
|
public class ReadModuleService : BaseService
|
||||||
{
|
{
|
||||||
|
|
||||||
public IRepository<SubjectVisit> _subjectVisitRepository;
|
public IRepository<SubjectVisit> _subjectVisitRepository;
|
||||||
|
@ -50,10 +52,10 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
var subjectquery = _subjectRepository.WhereIf(dto.TrialId!=null, x => x.TrialId == dto.TrialId)
|
var subjectquery = _subjectRepository.WhereIf(dto.TrialId!=null, x => x.TrialId == dto.TrialId)
|
||||||
.WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId)
|
.WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId)
|
||||||
.Include(x => x.SubjectVisitList).Include(x=>x.Site)
|
.Include(x => x.SubjectVisitList).Include(x=>x.Site).Include(x => x.TrialSite)
|
||||||
.Select(x => new GetReadModuleDtoOut
|
.Select(x => new GetReadModuleDtoOut
|
||||||
{
|
{
|
||||||
SiteCode = x.Site.SiteCode,
|
SiteCode = x.TrialSite.TrialSiteCode,
|
||||||
SiteId = x.SiteId,
|
SiteId = x.SiteId,
|
||||||
SubjectCode = x.Code,
|
SubjectCode = x.Code,
|
||||||
SubjectId = x.Id,
|
SubjectId = x.Id,
|
||||||
|
@ -65,10 +67,10 @@ namespace IRaCIS.Application.Services
|
||||||
IsUrgent = x.IsUrgent, // 是否加急
|
IsUrgent = x.IsUrgent, // 是否加急
|
||||||
SubjectVisitId = y.Id, // 访视ID
|
SubjectVisitId = y.Id, // 访视ID
|
||||||
SubjectVisitName=y.VisitName, // 访视名称
|
SubjectVisitName=y.VisitName, // 访视名称
|
||||||
Status= GetVisitSubmitStateEnum(y), // 状态
|
Status= ReadingCommon.GetVisitSubmitStateEnum(y), // 状态
|
||||||
CreateTime = y.CreateTime, // 创建时间
|
CreateTime = y.CreateTime, // 创建时间
|
||||||
SubjectCode = y.Subject.Code, // 受试者code
|
SubjectCode = y.Subject.Code, // 受试者code
|
||||||
SiteCode = x.Site.SiteCode, // 中心Code
|
SiteCode = x.TrialSite.TrialSiteCode, // 中心Code
|
||||||
|
|
||||||
IsFinalVisit=y.IsFinalVisit, // 是否为末次评估
|
IsFinalVisit=y.IsFinalVisit, // 是否为末次评估
|
||||||
OutPlanPreviousVisitId = y.OutPlanPreviousVisitId, // 上一访视
|
OutPlanPreviousVisitId = y.OutPlanPreviousVisitId, // 上一访视
|
||||||
|
@ -101,7 +103,7 @@ namespace IRaCIS.Application.Services
|
||||||
Name=y.ModuleName,
|
Name=y.ModuleName,
|
||||||
SubjectId=x.SubjectId,
|
SubjectId=x.SubjectId,
|
||||||
ModuleType=y.ModuleType,
|
ModuleType=y.ModuleType,
|
||||||
Status= GetVisitSubmitStateEnum(y.SubjectVisit),
|
Status= ReadingCommon.GetVisitSubmitStateEnum(y.SubjectVisit),
|
||||||
SubjectCode= x.SubjectCode,
|
SubjectCode= x.SubjectCode,
|
||||||
SiteCode=x.SiteCode,
|
SiteCode=x.SiteCode,
|
||||||
SubjectVisitId= y.SubjectVisitId,
|
SubjectVisitId= y.SubjectVisitId,
|
||||||
|
@ -123,31 +125,7 @@ namespace IRaCIS.Application.Services
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取访视的状态
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="visit"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[NonDynamicMethod]
|
|
||||||
public static ReadModuleEnum GetVisitSubmitStateEnum(SubjectVisit visit)
|
|
||||||
{
|
|
||||||
if (visit.SubmitState != SubmitStateEnum.Submitted) // 未提交
|
|
||||||
{
|
|
||||||
return ReadModuleEnum.ImageUpload;
|
|
||||||
}
|
|
||||||
else if (visit.AuditState != AuditStateEnum.QCPassed) // 审核未通过
|
|
||||||
{
|
|
||||||
return ReadModuleEnum.ImageUpload;
|
|
||||||
}
|
|
||||||
else if (visit.ForwardState != ForwardStateEnum.Forwarded) // 未通过一致性核查
|
|
||||||
{
|
|
||||||
return ReadModuleEnum.ConsistencyCheck;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// 暂时
|
|
||||||
return ReadModuleEnum.ReadComplete;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
///// <summary>
|
||||||
|
@ -183,12 +161,12 @@ namespace IRaCIS.Application.Services
|
||||||
}).FirstOrDefault();
|
}).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
var visit = (await _subjectVisitRepository.Where(x => x.Id == GetReadModuleOutDto.SubjectVisitId).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
SubjectVisit visit = (await _subjectVisitRepository.Where(x => x.Id == GetReadModuleOutDto.SubjectVisitId).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
||||||
|
|
||||||
//switch (GetVisitSubmitStateEnum(visit))
|
//switch (GetVisitSubmitStateEnum(visit))
|
||||||
//{
|
//{
|
||||||
// case ReadModuleEnum.ImageUpload:
|
// case ReadModuleEnum.ImageUpload:
|
||||||
|
// case
|
||||||
// break;
|
// break;
|
||||||
//};
|
//};
|
||||||
|
|
||||||
|
@ -205,26 +183,15 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> AddReadModule(ReadModuleAddDto dto)
|
public async Task<IResponseOutput> AddReadModule(ReadModuleAddDto dto)
|
||||||
{
|
{
|
||||||
var visits =await _subjectVisitRepository.Where(x => x.SubjectId == dto.SubjectId && x.InPlan).Select(x => new
|
var visitquery = _subjectVisitRepository.Where(x => x.SubjectId == dto.SubjectId && x.InPlan);
|
||||||
{
|
|
||||||
x.Id,
|
|
||||||
x.LatestScanDate,
|
|
||||||
x.VisitNum,
|
|
||||||
x.IsUrgent,
|
|
||||||
|
|
||||||
}).ToListAsync();
|
|
||||||
|
|
||||||
if (dto.ExpirationDate != null)
|
visitquery = visitquery.WhereIf(dto.ExpirationDate != null,x => x.LatestScanDate <= dto.ExpirationDate.Value);
|
||||||
{
|
|
||||||
visits = visits.Where(x => x.LatestScanDate <= dto.ExpirationDate.Value).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dto.ExpirationVisitNum != null)
|
visitquery = visitquery.WhereIf(dto.ExpirationVisitNum != null, x => x.VisitNum <= dto.ExpirationVisitNum.Value);
|
||||||
{
|
|
||||||
visits = visits.Where(x => x.VisitNum <= dto.ExpirationVisitNum).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
var visit = visits.OrderByDescending(x => x.VisitNum).FirstOrDefault();
|
|
||||||
|
|
||||||
|
var visit = visitquery.OrderByDescending(x => x.VisitNum).FirstOrDefault();
|
||||||
|
|
||||||
if (visit != null)
|
if (visit != null)
|
||||||
{
|
{
|
||||||
|
@ -236,7 +203,8 @@ namespace IRaCIS.Application.Services
|
||||||
IsUrgent = visit.IsUrgent,
|
IsUrgent = visit.IsUrgent,
|
||||||
ModuleName = dto.Name,
|
ModuleName = dto.Name,
|
||||||
SubjectVisitId = visit.Id,
|
SubjectVisitId = visit.Id,
|
||||||
Status = ReadModuleEnum.ImageRead,
|
ReadingSetType= ReadingSetType.ImageReading,
|
||||||
|
Status = ReadingCommon.GetVisitSubmitStateEnum(visit),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
using IRaCIS.Core.Application.Auth;
|
using IRaCIS.Core.Application.Auth;
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Domain.Share.Reading;
|
using IRaCIS.Core.Domain.Share.Reading;
|
||||||
|
using MassTransit;
|
||||||
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -20,15 +22,18 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
public IRepository<SubjectVisit> _subjectVisitRepository;
|
public IRepository<SubjectVisit> _subjectVisitRepository;
|
||||||
private readonly IRepository<ReadingPeriodSet> _readingPeriodSetRepository;
|
private readonly IRepository<ReadingPeriodSet> _readingPeriodSetRepository;
|
||||||
|
private readonly IRepository<ReadModule> _readModuleRepository;
|
||||||
private readonly IRepository<Site> _siteSetRepository;
|
private readonly IRepository<Site> _siteSetRepository;
|
||||||
|
|
||||||
public ReadingPeriodSetService(IRepository<SubjectVisit> subjectVisitRepository,
|
public ReadingPeriodSetService(IRepository<SubjectVisit> subjectVisitRepository,
|
||||||
IRepository<ReadingPeriodSet> ReadingPeriodSetRepository,
|
IRepository<ReadingPeriodSet> ReadingPeriodSetRepository,
|
||||||
|
IRepository<ReadModule> readModuleRepository,
|
||||||
IRepository<Site> SiteSetRepository
|
IRepository<Site> SiteSetRepository
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_subjectVisitRepository = subjectVisitRepository;
|
_subjectVisitRepository = subjectVisitRepository;
|
||||||
_readingPeriodSetRepository = ReadingPeriodSetRepository;
|
_readingPeriodSetRepository = ReadingPeriodSetRepository;
|
||||||
|
this._readModuleRepository = readModuleRepository;
|
||||||
_siteSetRepository = SiteSetRepository;
|
_siteSetRepository = SiteSetRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +75,81 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取影像阅片的预览
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<PreviewTheReadingListOutDto>> GetPreviewTheReadingList(PreviewTheReadingListInDto inDto)
|
||||||
|
{
|
||||||
|
var readset = (await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Include(x => x.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
||||||
|
var visitquery = _subjectVisitRepository.Where(x => x.TrialId == readset.TrialId && x.LatestScanDate != null && x.InPlan);
|
||||||
|
if (readset.ReadingScope == ReadingScopeEnum.Site)
|
||||||
|
{
|
||||||
|
var siteids = readset.ReadingPeriodSites.Select(x => x.Id);
|
||||||
|
visitquery = visitquery.Where(x => siteids.Contains(x.SiteId));
|
||||||
|
}
|
||||||
|
|
||||||
|
visitquery = visitquery.WhereIf(readset.ExpirationDate != null, x => x.LatestScanDate <= readset.ExpirationDate.Value);
|
||||||
|
visitquery = visitquery.WhereIf(readset.ExpirationVisitNum != null, x => x.VisitNum <= readset.ExpirationVisitNum);
|
||||||
|
var visits = (await visitquery.Include(x=>x.Subject).Include(x=>x.TrialSite).GroupBy(x => x.SubjectId).Select(x => new
|
||||||
|
{
|
||||||
|
SubjectId = x.Key,
|
||||||
|
visit = x.OrderByDescending(x => x.VisitNum).FirstOrDefault()
|
||||||
|
}).ToListAsync()).Select(x => x.visit).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
return visits.Where(x => _readModuleRepository.Where(y => y.ReadingSetType == readset.ReadingSetType && x.Id == y.SubjectVisitId).Count() == 0)
|
||||||
|
.Select(x => new PreviewTheReadingListOutDto
|
||||||
|
{
|
||||||
|
ExpirationDate= readset.ExpirationDate,
|
||||||
|
SubjectVisitId=x.Id,
|
||||||
|
TrialSiteCode = x.TrialSite.TrialSiteCode,
|
||||||
|
LatestScanDate=x.LatestScanDate,
|
||||||
|
ReadingPeriodName= readset.ReadingPeriodName,
|
||||||
|
ReadingPeriodSetId=readset.Id,
|
||||||
|
SubjectCode=x.Subject.Code,
|
||||||
|
SubjectId=x.SubjectId,
|
||||||
|
Remark= readset.Remark
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加对应的阅片
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IResponseOutput> ReadingToGenerate(ReadingToGenerateInDto inDto)
|
||||||
|
{
|
||||||
|
var readset = (await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Include(x => x.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
||||||
|
var visits = await _subjectVisitRepository.Where(x => inDto.SubjectVisitIds.Contains(x.Id)).ToListAsync();
|
||||||
|
|
||||||
|
List<ReadModule> readModules = new List<ReadModule>();
|
||||||
|
|
||||||
|
foreach (var item in visits)
|
||||||
|
{
|
||||||
|
readModules.Add(new ReadModule()
|
||||||
|
{
|
||||||
|
|
||||||
|
Id = NewId.NextGuid(),
|
||||||
|
SubjectId = item.SubjectId,
|
||||||
|
ModuleType = readset.ReadingSetType == ReadingSetType.ImageReading ? ModuleTypeEnum.Read : ModuleTypeEnum.Oncology,
|
||||||
|
IsUrgent = item.IsUrgent,
|
||||||
|
ModuleName = readset.ReadingPeriodName,
|
||||||
|
SubjectVisitId = item.Id,
|
||||||
|
ReadingSetType = readset.ReadingSetType,
|
||||||
|
Status = ReadingCommon.GetVisitSubmitStateEnum(item),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
await _readModuleRepository.AddRangeAsync(readModules);
|
||||||
|
|
||||||
|
|
||||||
|
var res = await _subjectVisitRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
|
return ResponseOutput.Result(res);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页获取
|
/// 分页获取
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
CreateMap<ReadingPeriodSet, ReadingPeriodSetView>()
|
CreateMap<ReadingPeriodSet, ReadingPeriodSetView>()
|
||||||
.ForMember(d => d.SiteIds, u => u.MapFrom(s => s.ReadingPeriodSites.Select(x => x.SiteId)))
|
.ForMember(d => d.SiteIds, u => u.MapFrom(s => s.ReadingPeriodSites.Select(x => x.SiteId)))
|
||||||
.ForMember(d => d.SiteCodes, u => u.MapFrom(s => s.ReadingPeriodSites.Select(x => x.Site.SiteCode)));
|
.ForMember(d => d.SiteCodes, u => u.MapFrom(s => s.ReadingPeriodSites.Select(x => x.TrialSite.TrialSiteCode)));
|
||||||
|
|
||||||
//.ForMember(d => d.SiteNames, u => u.MapFrom(s => s.ReadingPeriodSites.SelectMany(x => x.Site.SiteName).ToList()));
|
//.ForMember(d => d.SiteNames, u => u.MapFrom(s => s.ReadingPeriodSites.SelectMany(x => x.Site.SiteName).ToList()));
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,18 @@ namespace IRaCIS.Core.Domain.Share.Reading
|
||||||
Oncology = 4,
|
Oncology = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ReadingSetType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 影像阅片
|
||||||
|
/// </summary>
|
||||||
|
ImageReading=0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 肿瘤阅片
|
||||||
|
/// </summary>
|
||||||
|
TumorReading=1,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 阅片期范围
|
/// 阅片期范围
|
||||||
|
|
|
@ -90,6 +90,11 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public SubjectVisit SubjectVisit { get; set; }
|
public SubjectVisit SubjectVisit { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 阅片配置的类型
|
||||||
|
/// </summary>
|
||||||
|
public ReadingSetType ReadingSetType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 访视
|
/// 访视
|
||||||
|
|
|
@ -61,11 +61,15 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid CreateUserId { get; set; }
|
public Guid CreateUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备注
|
/// 阅片配置的类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Remark { get; set; } = string.Empty;
|
public ReadingSetType ReadingSetType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
public List<ReadingPeriodSite> ReadingPeriodSites { get; set; } = new List<ReadingPeriodSite>();
|
public List<ReadingPeriodSite> ReadingPeriodSites { get; set; } = new List<ReadingPeriodSite>();
|
||||||
|
|
|
@ -49,6 +49,8 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public TrialSite TrialSite { get; set; }
|
||||||
|
|
||||||
public ReadingPeriodSet ReadingPeriodSet { get; set; }
|
public ReadingPeriodSet ReadingPeriodSet { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,5 +55,8 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
|
|
||||||
public List<StudyMonitor> StudyMonitorList { get; set; }
|
public List<StudyMonitor> StudyMonitorList { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public List<ReadingPeriodSite> ReadingPeriodSites { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using IRaCIS.Core.Domain.Share.Reading;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
{
|
||||||
|
public static class ReadingCommon
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取访视的状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visit"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public static ReadModuleEnum GetVisitSubmitStateEnum(SubjectVisit visit)
|
||||||
|
{
|
||||||
|
if (visit.SubmitState != SubmitStateEnum.Submitted) // 未提交
|
||||||
|
{
|
||||||
|
return ReadModuleEnum.ImageUpload;
|
||||||
|
}
|
||||||
|
else if (visit.AuditState != AuditStateEnum.QCPassed) // 审核未通过
|
||||||
|
{
|
||||||
|
return ReadModuleEnum.ImageUpload;
|
||||||
|
}
|
||||||
|
else if (visit.ForwardState != ForwardStateEnum.Forwarded) // 未通过一致性核查
|
||||||
|
{
|
||||||
|
return ReadModuleEnum.ConsistencyCheck;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 暂时
|
||||||
|
return ReadModuleEnum.ReadComplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||||
|
{
|
||||||
|
public class ReadingPeriodSiteConfigration : IEntityTypeConfiguration<ReadingPeriodSite>
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public void Configure(EntityTypeBuilder<ReadingPeriodSite> builder)
|
||||||
|
{
|
||||||
|
|
||||||
|
builder
|
||||||
|
.HasOne(s => s.TrialSite)
|
||||||
|
.WithMany(c => c.ReadingPeriodSites)
|
||||||
|
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||||
|
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue