代码整理
parent
7aa5f9355e
commit
ae88921049
|
@ -108,25 +108,6 @@ namespace IRaCIS.Application.Services
|
||||||
#region 病灶的拆分与合并
|
#region 病灶的拆分与合并
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 阅片期 -全局和肿瘤学任务的生成
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region 阅片页面 关联信息查询
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拆分病灶
|
/// 拆分病灶
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -227,6 +208,149 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 阅片期 -全局和肿瘤学任务的生成
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加阅片期任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task AddReadingTask(Guid visitTaskId)
|
||||||
|
{
|
||||||
|
// ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********////
|
||||||
|
#region 建立关系
|
||||||
|
// 访视阅完产生 全局
|
||||||
|
Dictionary<ModuleTypeEnum, ReadingCategory> typeChangeDic = new Dictionary<ModuleTypeEnum, ReadingCategory>();
|
||||||
|
typeChangeDic.Add(ModuleTypeEnum.InPlanSubjectVisit, ReadingCategory.Visit);
|
||||||
|
typeChangeDic.Add(ModuleTypeEnum.OutPlanSubjectVisit, ReadingCategory.Visit);
|
||||||
|
//typeChange.Add(ModuleTypeEnum.Read, ReadingCategory.ReadingPeriod);
|
||||||
|
typeChangeDic.Add(ModuleTypeEnum.Global, ReadingCategory.Global);
|
||||||
|
typeChangeDic.Add(ModuleTypeEnum.Referee, ReadingCategory.Judge);
|
||||||
|
typeChangeDic.Add(ModuleTypeEnum.Oncology, ReadingCategory.Oncology);
|
||||||
|
#endregion
|
||||||
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||||
|
List<ReadingGenerataTaskDTO> needReadList = new List<ReadingGenerataTaskDTO>();
|
||||||
|
if (!taskInfo.IsAnalysisCreate)
|
||||||
|
{
|
||||||
|
// 任务类型
|
||||||
|
switch (taskInfo.ReadingCategory)
|
||||||
|
{
|
||||||
|
case ReadingCategory.Visit:
|
||||||
|
needReadList = await _readModuleRepository.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId &&
|
||||||
|
|
||||||
|
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
|
||||||
|
x.ReadingSetType == ReadingSetType.ImageReading)
|
||||||
|
.Select(x => new ReadingGenerataTaskDTO
|
||||||
|
{
|
||||||
|
IsUrgent = x.IsUrgent ?? false,
|
||||||
|
SubjectId = x.SubjectId,
|
||||||
|
VisitNum = x.VisitNum,
|
||||||
|
ReadingName = x.ModuleName,
|
||||||
|
ReadModuleId = x.Id,
|
||||||
|
ReadingCategory = typeChangeDic[x.ModuleType],
|
||||||
|
}).ToListAsync();
|
||||||
|
if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global))
|
||||||
|
{
|
||||||
|
needReadList = needReadList.Where(x => x.ReadingCategory != ReadingCategory.Oncology).ToList();
|
||||||
|
}
|
||||||
|
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
|
||||||
|
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
|
||||||
|
{
|
||||||
|
OriginalVisitId = visitTaskId,
|
||||||
|
ReadingCategory = GenerateTaskCategory.Global,
|
||||||
|
TrialId = taskInfo.TrialId,
|
||||||
|
ReadingGenerataTaskList = needReadList
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
// 肿瘤学
|
||||||
|
case ReadingCategory.Global:
|
||||||
|
var subjectVisitId = await _readModuleRepository.Where(x => x.Id == taskInfo.SouceReadModuleId).Select(x => x.SubjectVisitId).FirstOrDefaultAsync();
|
||||||
|
var oncologyReadId = await _readModuleRepository.Where(x => x.SubjectVisitId == subjectVisitId && x.ModuleType == ModuleTypeEnum.Oncology
|
||||||
|
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||||
|
|
||||||
|
|
||||||
|
).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
await AddOncologyTask(oncologyReadId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 阅片页面 关联信息查询 以及基本验证
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取既往任务名称和编号
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<List<GetReadingPastResultListOutDto>> GetReadingPastResultList(GetReadingPastResultListInDto inDto)
|
||||||
|
{
|
||||||
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||||
|
var readingPastResultList = await _visitTaskRepository.Where(x =>
|
||||||
|
x.TrialId == taskInfo.TrialId &&
|
||||||
|
x.SubjectId == taskInfo.SubjectId &&
|
||||||
|
x.ArmEnum == taskInfo.ArmEnum &&
|
||||||
|
x.Id != inDto.VisitTaskId &&
|
||||||
|
x.DoctorUserId == taskInfo.DoctorUserId &&
|
||||||
|
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
|
||||||
|
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
||||||
|
x.TaskState == TaskState.Effect &&
|
||||||
|
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate)
|
||||||
|
.WhereIf(taskInfo.ReadingCategory != ReadingCategory.Visit, x => x.ReadingCategory == taskInfo.ReadingCategory)
|
||||||
|
|
||||||
|
.ProjectTo<GetReadingPastResultListOutDto>(_mapper.ConfigurationProvider).OrderBy(x => x.VisitTaskNum).ToListAsync();
|
||||||
|
return readingPastResultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取阅片的受试者信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<GetReadingSubjectInfoOutDto> GetReadingSubjectInfo(GetReadingSubjectInfoInDto inDto)
|
||||||
|
{
|
||||||
|
var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstOrDefaultAsync();
|
||||||
|
var subjectCode = await _subjectRepository.Where(x => x.Id == visitTask.SubjectId).Select(x => x.Code).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).Select(x => new
|
||||||
|
{
|
||||||
|
x.IsReadingShowPreviousResults,
|
||||||
|
x.IsReadingShowSubjectInfo
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
var trialInfo = await _trialRepository.Where(x => x.Id == visitTask.TrialId).Select(x => new
|
||||||
|
{
|
||||||
|
x.ClinicalInformationTransmissionEnum,
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return new GetReadingSubjectInfoOutDto()
|
||||||
|
{
|
||||||
|
VisitTaskId = visitTask.Id,
|
||||||
|
SubjectId = visitTask.SubjectId,
|
||||||
|
SubjectCode = visitTask.BlindSubjectCode.IsNullOrEmpty() ? subjectCode : visitTask.BlindSubjectCode,
|
||||||
|
ReadingCategory = visitTask.ReadingCategory,
|
||||||
|
TaskBlindName = visitTask.TaskBlindName,
|
||||||
|
IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults,
|
||||||
|
IsReadingShowSubjectInfo = criterionInfo.IsReadingShowSubjectInfo,
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证是否为基线访视任务
|
/// 验证是否为基线访视任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -247,6 +371,10 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据任务ID获取ReadingTool
|
/// 根据任务ID获取ReadingTool
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -261,6 +389,11 @@ namespace IRaCIS.Application.Services
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 表格问题相关
|
#region 表格问题相关
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -854,9 +987,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 获取下一个阅片任务
|
#region 获取下一个阅片任务
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取下一个阅片任务
|
/// 获取下一个阅片任务
|
||||||
|
@ -1091,67 +1221,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取阅片的受试者信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inDto"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public async Task<GetReadingSubjectInfoOutDto> GetReadingSubjectInfo(GetReadingSubjectInfoInDto inDto)
|
|
||||||
{
|
|
||||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstOrDefaultAsync();
|
|
||||||
var subjectCode = await _subjectRepository.Where(x => x.Id == visitTask.SubjectId).Select(x => x.Code).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).Select(x => new
|
|
||||||
{
|
|
||||||
x.IsReadingShowPreviousResults,
|
|
||||||
x.IsReadingShowSubjectInfo
|
|
||||||
}).FirstOrDefaultAsync();
|
|
||||||
var trialInfo = await _trialRepository.Where(x => x.Id == visitTask.TrialId).Select(x => new
|
|
||||||
{
|
|
||||||
x.ClinicalInformationTransmissionEnum,
|
|
||||||
}).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
return new GetReadingSubjectInfoOutDto()
|
|
||||||
{
|
|
||||||
VisitTaskId = visitTask.Id,
|
|
||||||
SubjectId = visitTask.SubjectId,
|
|
||||||
SubjectCode = visitTask.BlindSubjectCode.IsNullOrEmpty() ? subjectCode : visitTask.BlindSubjectCode,
|
|
||||||
ReadingCategory = visitTask.ReadingCategory,
|
|
||||||
TaskBlindName = visitTask.TaskBlindName,
|
|
||||||
IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults,
|
|
||||||
IsReadingShowSubjectInfo = criterionInfo.IsReadingShowSubjectInfo,
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 获取既往结果
|
|
||||||
/// <summary>
|
|
||||||
/// 获取既往结果
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public async Task<List<GetReadingPastResultListOutDto>> GetReadingPastResultList(GetReadingPastResultListInDto inDto)
|
|
||||||
{
|
|
||||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
|
||||||
var readingPastResultList = await _visitTaskRepository.Where(x =>
|
|
||||||
x.TrialId == taskInfo.TrialId &&
|
|
||||||
x.SubjectId == taskInfo.SubjectId &&
|
|
||||||
x.ArmEnum == taskInfo.ArmEnum &&
|
|
||||||
x.Id != inDto.VisitTaskId &&
|
|
||||||
x.DoctorUserId == taskInfo.DoctorUserId &&
|
|
||||||
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
|
|
||||||
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
|
||||||
x.TaskState == TaskState.Effect &&
|
|
||||||
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate)
|
|
||||||
.WhereIf(taskInfo.ReadingCategory != ReadingCategory.Visit, x => x.ReadingCategory == taskInfo.ReadingCategory)
|
|
||||||
|
|
||||||
.ProjectTo<GetReadingPastResultListOutDto>(_mapper.ConfigurationProvider).OrderBy(x => x.VisitTaskNum).ToListAsync();
|
|
||||||
return readingPastResultList;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 找子问题
|
#region 找子问题
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 找子问题
|
/// 找子问题
|
||||||
|
@ -1227,7 +1296,10 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 保存访视任务阅片问题答案
|
|
||||||
|
|
||||||
|
#region 阅片任务 提交填写表单
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存任务问题
|
/// 保存任务问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1258,10 +1330,6 @@ namespace IRaCIS.Application.Services
|
||||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||||
return ResponseOutput.Ok(result);
|
return ResponseOutput.Ok(result);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region 阅片任务 提交填写表单
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证访视提交
|
/// 验证访视提交
|
||||||
|
@ -1567,75 +1635,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加阅片期任务
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task AddReadingTask(Guid visitTaskId)
|
|
||||||
{
|
|
||||||
// ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********////
|
|
||||||
#region 建立关系
|
|
||||||
// 访视阅完产生 全局
|
|
||||||
Dictionary<ModuleTypeEnum, ReadingCategory> typeChangeDic = new Dictionary<ModuleTypeEnum, ReadingCategory>();
|
|
||||||
typeChangeDic.Add(ModuleTypeEnum.InPlanSubjectVisit, ReadingCategory.Visit);
|
|
||||||
typeChangeDic.Add(ModuleTypeEnum.OutPlanSubjectVisit, ReadingCategory.Visit);
|
|
||||||
//typeChange.Add(ModuleTypeEnum.Read, ReadingCategory.ReadingPeriod);
|
|
||||||
typeChangeDic.Add(ModuleTypeEnum.Global, ReadingCategory.Global);
|
|
||||||
typeChangeDic.Add(ModuleTypeEnum.Referee, ReadingCategory.Judge);
|
|
||||||
typeChangeDic.Add(ModuleTypeEnum.Oncology, ReadingCategory.Oncology);
|
|
||||||
#endregion
|
|
||||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
|
||||||
List<ReadingGenerataTaskDTO> needReadList = new List<ReadingGenerataTaskDTO>();
|
|
||||||
if (!taskInfo.IsAnalysisCreate)
|
|
||||||
{
|
|
||||||
// 任务类型
|
|
||||||
switch (taskInfo.ReadingCategory)
|
|
||||||
{
|
|
||||||
case ReadingCategory.Visit:
|
|
||||||
needReadList = await _readModuleRepository.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId &&
|
|
||||||
|
|
||||||
x.TrialReadingCriterionId==taskInfo.TrialReadingCriterionId&&
|
|
||||||
x.ReadingSetType == ReadingSetType.ImageReading)
|
|
||||||
.Select(x => new ReadingGenerataTaskDTO
|
|
||||||
{
|
|
||||||
IsUrgent = x.IsUrgent ?? false,
|
|
||||||
SubjectId = x.SubjectId,
|
|
||||||
VisitNum = x.VisitNum,
|
|
||||||
ReadingName = x.ModuleName,
|
|
||||||
ReadModuleId = x.Id,
|
|
||||||
ReadingCategory = typeChangeDic[x.ModuleType],
|
|
||||||
}).ToListAsync();
|
|
||||||
if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global))
|
|
||||||
{
|
|
||||||
needReadList = needReadList.Where(x => x.ReadingCategory != ReadingCategory.Oncology).ToList();
|
|
||||||
}
|
|
||||||
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
|
|
||||||
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
|
|
||||||
{
|
|
||||||
OriginalVisitId = visitTaskId,
|
|
||||||
ReadingCategory = GenerateTaskCategory.Global,
|
|
||||||
TrialId = taskInfo.TrialId,
|
|
||||||
ReadingGenerataTaskList = needReadList
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
// 肿瘤学
|
|
||||||
case ReadingCategory.Global:
|
|
||||||
var subjectVisitId = await _readModuleRepository.Where(x => x.Id == taskInfo.SouceReadModuleId).Select(x => x.SubjectVisitId).FirstOrDefaultAsync();
|
|
||||||
var oncologyReadId = await _readModuleRepository.Where(x => x.SubjectVisitId == subjectVisitId && x.ModuleType == ModuleTypeEnum.Oncology
|
|
||||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
|
||||||
|
|
||||||
|
|
||||||
).Select(x => x.Id).FirstOrDefaultAsync();
|
|
||||||
await AddOncologyTask(oncologyReadId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue