Uat_Study
he 2022-08-05 13:16:39 +08:00
parent 412ca21ba2
commit 035f39f217
7 changed files with 140 additions and 102 deletions

View File

@ -245,6 +245,7 @@ namespace IRaCIS.Core.Application.ViewModel
public bool IsUrgent { get; set; }
public string ReadingName { get; set; }
public ReadingCategory ReadingCategory { get; set; }

View File

@ -581,6 +581,7 @@ namespace IRaCIS.Core.Application.Image.QA
}
/// <summary>
/// 1、设置为不读片2 设置为读片(取消 先前设置为不读片) 4 设置为删除(数据库记录软删除) 5 恢复为未删除
/// </summary>

View File

@ -195,6 +195,9 @@ namespace IRaCIS.Core.Application.Contracts
}
[HttpDelete("{trialId:guid}/{trialQCQuestionConfigureId:guid}")]
[Authorize(Policy = IRaCISPolicy.IQC)]
public async Task<IResponseOutput> DeleteTrialQCQuestionConfigure(Guid trialQCQuestionConfigureId, Guid trialId)

View File

@ -18,5 +18,10 @@ namespace IRaCIS.Core.Application.Contracts
Task<IResponseOutput> ReadClinicalDataSign(ReadingClinicalDataSignIndto inDto);
Task<List<GetReadingClinicalDataListOutDto>> GetClinicalDataList(GetReadingOrTaskClinicalDataListInDto inDto);
Task<(List<GetReadingClinicalDataListOutDto>, object)> GetReadingClinicalDataList(GetReadingClinicalDataListIndto inDto);
Task<List<GetReadingClinicalDataListOutDto>> GetReadingClinicalList(GetReadingClinicalDataListIndto inDto);
}
}

View File

@ -21,5 +21,7 @@ namespace IRaCIS.Core.Application.Contracts
Task<IResponseOutput> SubmitGlobalReadingInfo(SubmitGlobalReadingInfoInDto inDto);
Task<IResponseOutput> SubmitOncologyReadingInfo(SubmitOncologyReadingInfoInDto inDto);
Task AddOncologyTask(Guid oncologModuleId);
}
}

View File

@ -32,6 +32,7 @@ namespace IRaCIS.Application.Services
private readonly IRepository<PreviousHistory> _previousHistoryRepository;
private readonly IRepository<PreviousOther> _previousOtherRepository;
private readonly IRepository<PreviousSurgery> _previousSurgeryRepository;
private readonly IReadingImageTaskService readingImageTaskService;
private readonly IRepository<Subject> _subjectRepository;
private readonly IRepository<ReadModule> _readModuleRepository;
private readonly IRepository<ReadingClinicalDataPDF> _readingClinicalDataPDFRepository;
@ -43,6 +44,7 @@ namespace IRaCIS.Application.Services
IRepository<PreviousHistory> previousHistoryRepository,
IRepository<PreviousOther> previousOtherRepository,
IRepository<PreviousSurgery> previousSurgeryRepository,
IReadingImageTaskService readingImageTaskService,
IRepository<Subject> subjectRepository,
IRepository<ReadModule> readModuleRepository,
IRepository<ReadingClinicalDataPDF> readingClinicalDataPDFRepository,
@ -55,6 +57,7 @@ namespace IRaCIS.Application.Services
this._previousHistoryRepository = previousHistoryRepository;
this._previousOtherRepository = previousOtherRepository;
this._previousSurgeryRepository = previousSurgeryRepository;
this.readingImageTaskService = readingImageTaskService;
this._subjectRepository = subjectRepository;
this._readModuleRepository = readModuleRepository;
this._readingClinicalDataPDFRepository = readingClinicalDataPDFRepository;
@ -281,6 +284,11 @@ namespace IRaCIS.Application.Services
var result = await _readingClinicalDataRepository.SaveChangesAsync();
var readingId = await _readingClinicalDataRepository.Where(x => x.Id == inDto.ReadingClinicalDataId).Select(x => x.ReadingId).FirstOrDefaultAsync();
await readingImageTaskService.AddOncologyTask(readingId);
return ResponseOutput.Result(result);
}
@ -396,31 +404,10 @@ namespace IRaCIS.Application.Services
inDto.UploadRole = UploadRole.CRC;
}
var isBaseLine = await _subjectVisitRepository.AnyAsync(x => x.Id == inDto.ReadingId && x.IsBaseLine);
var resultQuery = _readingClinicalDataRepository.Where(x => x.SubjectId == inDto.SubjectId)
.Where(x => x.ReadingId == inDto.ReadingId)
.WhereIf(inDto.UploadRole == UploadRole.CRC, x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC)
.Select(x => new GetReadingClinicalDataListOutDto()
{
ClinicalDataLevel = x.ClinicalDataTrialSet.ClinicalDataLevel,
SubjectId = x.SubjectId,
ClinicalDataSetName = x.ClinicalDataTrialSet.ClinicalDataSetName,
ClinicalDataTrialSetId = x.ClinicalDataTrialSetId,
IsSign = x.IsSign,
ClinicalUploadType = x.ClinicalDataTrialSet.ClinicalUploadType,
Id = x.Id,
UploadRole = x.ClinicalDataTrialSet.UploadRole,
IsCRCUpload = x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC,
FileList = x.ReadingClinicalDataPDFList.Select(y => new GetFileDto()
{
Id = y.Id,
FileName = y.FileName,
Path = y.Path,
CreateTime = y.CreateTime,
}).ToList()
});
var result = await resultQuery.ToListAsync();
result = result.Where(x => !(x.UploadRole == UploadRole.CRC && x.ClinicalUploadType == ClinicalUploadType.PDF && x.FileList.Count() == 0)).ToList();
var result =await this.GetReadingClinicalList(inDto);
var previousHistoryList = await _previousHistoryRepository.Where(x => x.SubjectVisitId == inDto.ReadingId).ProjectTo<PreviousHistoryView>(_mapper.ConfigurationProvider).ToListAsync();
var previousOtherList = await _previousOtherRepository.Where(x => x.SubjectVisitId == inDto.ReadingId).ProjectTo<PreviousOtherView>(_mapper.ConfigurationProvider).ToListAsync();
@ -441,6 +428,40 @@ namespace IRaCIS.Application.Services
}) ;
}
/// <summary>
/// 获取临床数据集合
/// </summary>
/// <returns></returns>
[NonDynamicMethod]
public async Task<List<GetReadingClinicalDataListOutDto>> GetReadingClinicalList(GetReadingClinicalDataListIndto inDto)
{
var resultQuery = _readingClinicalDataRepository.Where(x => x.SubjectId == inDto.SubjectId)
.Where(x => x.ReadingId == inDto.ReadingId)
.WhereIf(inDto.UploadRole == UploadRole.CRC, x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC)
.Select(x => new GetReadingClinicalDataListOutDto()
{
ClinicalDataLevel = x.ClinicalDataTrialSet.ClinicalDataLevel,
SubjectId = x.SubjectId,
ClinicalDataSetName = x.ClinicalDataTrialSet.ClinicalDataSetName,
ClinicalDataTrialSetId = x.ClinicalDataTrialSetId,
IsSign = x.IsSign,
ClinicalUploadType = x.ClinicalDataTrialSet.ClinicalUploadType,
Id = x.Id,
UploadRole = x.ClinicalDataTrialSet.UploadRole,
IsCRCUpload = x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC,
FileList = x.ReadingClinicalDataPDFList.Select(y => new GetFileDto()
{
Id = y.Id,
FileName = y.FileName,
Path = y.Path,
CreateTime = y.CreateTime,
}).ToList()
});
var result = await resultQuery.ToListAsync();
result = result.Where(x => !(x.UploadRole == UploadRole.CRC && x.ClinicalUploadType == ClinicalUploadType.PDF && x.FileList.Count() == 0)).ToList();
return result;
}
/// <summary>
/// 获取单个阅片临床数据的所有文件

View File

@ -53,6 +53,7 @@ namespace IRaCIS.Application.Services
IRepository<VisitTask> visitTaskRepository,
IRepository<Trial> TrialRepository,
IRepository<ReadingOncologyTaskInfo> ReadingOncologyTaskInfoRepository,
IVisitTaskHelpeService visitTaskHelpeService,
IVisitTaskService visitTaskService,
IReadingClinicalDataService readingClinicalDataService,
@ -1214,28 +1215,9 @@ namespace IRaCIS.Application.Services
var visitId = await _readModuleRepository.Where(x => x.Id == taskInfo.SouceReadModuleId).Select(x => x.SubjectVisitId).FirstOrDefaultAsync();
// 肿瘤学信息
List<ReadingGenerataTaskDTO> needReadList = await _readModuleRepository.Where(x => x.SubjectVisitId == visitId && x.ModuleType == ModuleTypeEnum.Oncology)
.Select(x => new ReadingGenerataTaskDTO
{
IsUrgent = x.IsUrgent ?? false,
SubjectId = x.SubjectId,
ReadingName = x.ModuleName,
VisitNum = x.VisitNum,
ReadModuleId = x.Id,
ReadingCategory = ReadingCategory.Oncology,
}).ToListAsync();
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
{
ReadingCategory = GenerateTaskCategory.Oncology,
TrialId = taskInfo.TrialId,
ReadingGenerataTaskList = needReadList
});
var oncologModuleId = await _readModuleRepository.Where(x => x.SubjectVisitId == visitId && x.ModuleType == ModuleTypeEnum.Oncology).Select(x => x.Id).FirstOrDefaultAsync();
await AddOncologyTask(oncologModuleId);
}
@ -1384,34 +1366,8 @@ namespace IRaCIS.Application.Services
// 肿瘤学
case ReadingCategory.Global:
var subjectVisitId = await _readModuleRepository.Where(x => x.Id == taskInfo.SouceReadModuleId).Select(x => x.SubjectVisitId).FirstOrDefaultAsync();
needReadList=await _readModuleRepository.Where(x => x.SubjectVisitId == subjectVisitId && x.ModuleType==ModuleTypeEnum.Oncology)
.Select(x => new ReadingGenerataTaskDTO
{
IsUrgent = x.IsUrgent ?? false,
SubjectId = x.SubjectId,
ReadingName = x.ModuleName,
VisitNum = x.VisitNum,
ReadModuleId = x.Id,
ReadingCategory = typeChangeDic[x.ModuleType],
}).ToListAsync();
var readingType=await _trialRepository.Where(x => x.Id == taskInfo.TrialId).Select(x => x.ReadingType).FirstOrDefaultAsync();
if (taskInfo.JudgeVisitTaskId == null&&(await _visitTaskRepository.Where(x=>x.TaskState==TaskState.Effect&&x.ReadingCategory==ReadingCategory.Global
&&x.ReadingTaskState==ReadingTaskState.HaveSigned
).CountAsync()== (int)readingType))
{
// 有裁判要等裁判完成之后才进行添加
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
{
ReadingCategory = GenerateTaskCategory.Oncology,
TrialId = taskInfo.TrialId,
ReadingGenerataTaskList = needReadList
});
}
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
var oncologyReadId= await _readModuleRepository.Where(x => x.SubjectVisitId == subjectVisitId && x.ModuleType == ModuleTypeEnum.Oncology).Select(x => x.Id).FirstOrDefaultAsync();
await AddOncologyTask(oncologyReadId);
break;
}
}
@ -1423,39 +1379,88 @@ namespace IRaCIS.Application.Services
}
/// <summary>
/// 添加肿瘤学阅片任务
/// 添加肿瘤学阅片任务 其实这里无非是要判断临床数据是否签名 但是对于添加新的阅片期 其实没有临床数据 可以走之前的逻辑
/// </summary>
/// <returns></returns>
//public async Task<bool> AddOncologyTask(Guid readModuleId)
//{
// var readModuleInfo=await _readModuleRepository.Where(x=>x.Id==readModuleId&& x.ModuleType == ModuleTypeEnum.Oncology).Select(x => new ReadingGenerataTaskDTO
// {
// IsUrgent = x.IsUrgent ?? false,
// SubjectId = x.SubjectId,
// ReadingName = x.ModuleName,
// VisitNum = x.VisitNum,
// ReadModuleId = x.Id,
// ReadingCategory = ReadingCategory.Oncology,
// }).ToListAsync();
[NonDynamicMethod]
public async Task AddOncologyTask(Guid oncologModuleId)
{
// // 如果当前是肿瘤学
// if (readModuleInfo.Count != 0)
// {
// if (taskInfo.JudgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.TaskState == TaskState.Effect && x.ReadingCategory == ReadingCategory.Global
// && x.ReadingTaskState == ReadingTaskState.HaveSigned
// ).CountAsync() == (int)readingType))
// {
// // 有裁判要等裁判完成之后才进行添加
// await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
// {
// 判断是否读片完成
var finishReading = false;
// ReadingCategory = GenerateTaskCategory.Oncology,
// TrialId = taskInfo.TrialId,
// ReadingGenerataTaskList = needReadList
// });
// }
// }
//}
var readModuleInfo = await _readModuleRepository.Where(x => x.Id == oncologModuleId && x.ModuleType == ModuleTypeEnum.Oncology).FirstOrDefaultAsync();
// 如果当前是肿瘤学
if (readModuleInfo != null)
{
// 先找到对应的全局阅片模块Id
var globalreadModuleId = await _readModuleRepository.Where(x => x.SubjectVisitId == readModuleInfo.SubjectVisitId && x.ModuleType == ModuleTypeEnum.Global).Select(x => x.Id).FirstOrDefaultAsync();
// 找到一个全局阅片任务是否有裁判任务
var judgeVisitTaskId = await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModuleId && x.TaskState == TaskState.Effect && x.ReadingCategory == ReadingCategory.Global
&& x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.JudgeVisitTaskId).FirstOrDefaultAsync();
// 获取系统配置
var readingType = await _trialRepository.Where(x => x.Id == readModuleInfo.TrialId).Select(x => x.ReadingType).FirstOrDefaultAsync();
// 判断阅片是否完成
if (judgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModuleId && x.TaskState == TaskState.Effect && x.ReadingCategory == ReadingCategory.Global
&& x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate
).CountAsync() == (int)readingType))
{
finishReading = true;
}
else if(judgeVisitTaskId!=null&& (await _visitTaskRepository.AnyAsync(x=>x.Id== judgeVisitTaskId.Value&&x.ReadingTaskState== ReadingTaskState.HaveSigned)))
{
finishReading = true;
}
if (finishReading)
{
// 获取临床数据
var clinicalData = await _readingClinicalDataService.GetReadingClinicalList(new GetReadingClinicalDataListIndto()
{
SubjectId = readModuleInfo.SubjectId,
ReadingId = readModuleInfo.Id,
TrialId = readModuleInfo.TrialId,
});
// 判断是否临床数据都已经签名
if (!clinicalData.Any(x => !x.IsSign))
{
List<ReadingGenerataTaskDTO> needReadList = new List<ReadingGenerataTaskDTO>();
needReadList.Add(new ReadingGenerataTaskDTO()
{
IsUrgent = readModuleInfo.IsUrgent ?? false,
SubjectId = readModuleInfo.SubjectId,
ReadingName = readModuleInfo.ModuleName,
VisitNum = readModuleInfo.VisitNum,
ReadModuleId = readModuleInfo.Id,
ReadingCategory = ReadingCategory.Oncology,
});
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
{
ReadingCategory = GenerateTaskCategory.Oncology,
TrialId = readModuleInfo.TrialId,
ReadingGenerataTaskList = needReadList
});
}
}
}
}
/// <summary>