修改一致性分析
parent
fe2bc9d5d6
commit
2ea06759ef
|
@ -77,84 +77,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId);
|
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId);
|
||||||
|
|
||||||
|
var(group, query) = GetIQueryableDoctorConsistentRuleSubjectView(filterObj);
|
||||||
bool isSelfAnalysis = filterObj.CompareDoctorUserId == null;
|
|
||||||
|
|
||||||
IQueryable<Guid> subjectfilter = null;
|
|
||||||
|
|
||||||
if (isSelfAnalysis == false)
|
|
||||||
{
|
|
||||||
//过滤不满足的Subject
|
|
||||||
|
|
||||||
subjectfilter = _subjectUserRepository.Where(t => t.TrialId == filterObj.TrialId).GroupBy(t => t.SubjectId)
|
|
||||||
.Where(g => g.Any(t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) && !g.Any(t => t.DoctorUserId == filterObj.CompareDoctorUserId)).Select(g => g.Key);
|
|
||||||
}
|
|
||||||
|
|
||||||
var doctorUserId = isSelfAnalysis ? filterObj.AnalysisDoctorUserId : filterObj.CompareDoctorUserId;
|
|
||||||
|
|
||||||
|
|
||||||
#region 以任务为维度
|
|
||||||
var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.IsAnalysisCreate==false)
|
|
||||||
// 自身一致性分析
|
|
||||||
.WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId)
|
|
||||||
// 组内一致性分析
|
|
||||||
.WhereIf(isSelfAnalysis == false && subjectfilter != null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId))
|
|
||||||
.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
|
|
||||||
.Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now)
|
|
||||||
//重阅产生的访视任务 要把之前的访视任务去除
|
|
||||||
.Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject)
|
|
||||||
|
|
||||||
.WhereIf(filterObj.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit)
|
|
||||||
.WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)
|
|
||||||
.GroupBy(t => t.SubjectId)
|
|
||||||
.Where(g => g.Count() >= filterObj.PlanVisitCount);
|
|
||||||
|
|
||||||
var query = group.Select(g => new DoctorConsistentRuleSubjectView()
|
|
||||||
{
|
|
||||||
SubjectId = g.Key,
|
|
||||||
|
|
||||||
IsHaveGeneratedTask = g.Any(c => c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)),
|
|
||||||
|
|
||||||
VisitTaskList = g.OrderBy(t => t.VisitTaskNum)
|
|
||||||
|
|
||||||
.Select(c => new VisitTaskSimpleView()
|
|
||||||
{
|
|
||||||
Id = c.Id,
|
|
||||||
ReadingCategory = c.ReadingCategory,
|
|
||||||
ReadingTaskState = c.ReadingTaskState,
|
|
||||||
TaskBlindName = c.TaskBlindName,
|
|
||||||
TaskCode = c.TaskCode,
|
|
||||||
TaskName = c.TaskName,
|
|
||||||
TaskState = c.TaskState,
|
|
||||||
ArmEnum = c.ArmEnum,
|
|
||||||
SubjectId = c.SubjectId,
|
|
||||||
TrialId = c.TrialId,
|
|
||||||
SiteId = c.Subject.SiteId,
|
|
||||||
SubjectCode = c.Subject.Code,
|
|
||||||
TrialSiteCode = c.Subject.TrialSite.TrialSiteCode,
|
|
||||||
|
|
||||||
RelationDoctorUserList=c.SameVisitTaskList/*Where(t=>t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)*/.Select(c=> new UserSimpleInfo()
|
|
||||||
{
|
|
||||||
FullName = c.DoctorUser.FullName,
|
|
||||||
UserCode = c.DoctorUser.UserCode,
|
|
||||||
UserId = c.DoctorUser.Id,
|
|
||||||
UserName = c.DoctorUser.UserName
|
|
||||||
}).ToList(),
|
|
||||||
|
|
||||||
IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id),
|
|
||||||
|
|
||||||
}).ToList(),
|
|
||||||
|
|
||||||
ValidTaskCount = g.Count()
|
|
||||||
|
|
||||||
});
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var count = group.Count();
|
var count = group.Count();
|
||||||
|
|
||||||
query = query.OrderByDescending(t => t.IsHaveGeneratedTask).Skip((inQuery.PageIndex - 1) * inQuery.PageSize);
|
query = query.OrderByDescending(t => t.IsHaveGeneratedTask).Skip((inQuery.PageIndex - 1) * inQuery.PageSize);
|
||||||
|
|
||||||
var items = await query.Take(inQuery.PageSize).ToArrayAsync().ConfigureAwait(false);
|
var items = await query.Take(inQuery.PageSize).ToArrayAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
var pagedList = new PageOutput<DoctorConsistentRuleSubjectView>()
|
var pagedList = new PageOutput<DoctorConsistentRuleSubjectView>()
|
||||||
|
@ -179,6 +107,39 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId);
|
var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId);
|
||||||
|
|
||||||
|
var doctorUserId = filterObj.CompareDoctorUserId == null ? filterObj.AnalysisDoctorUserId : filterObj.CompareDoctorUserId;
|
||||||
|
|
||||||
|
var (group, query) = GetIQueryableDoctorConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList);
|
||||||
|
|
||||||
|
var list = query.OrderByDescending(t=>t.IsHaveGeneratedTask).ToList();
|
||||||
|
|
||||||
|
foreach (var subject in list)
|
||||||
|
{
|
||||||
|
subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => { t.DoctorUserId = doctorUserId; t.TaskConsistentRuleId = filterObj.Id; });
|
||||||
|
|
||||||
|
|
||||||
|
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
|
||||||
|
{
|
||||||
|
TrialId = filterObj.TrialId,
|
||||||
|
ReadingCategory = ReadingCategory.Consistent,
|
||||||
|
//产生的过滤掉已经生成的
|
||||||
|
GenerataConsistentTaskList = subject.VisitTaskList.Where(t=>t.IsHaveGeneratedTask==false).ToList()
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private (IQueryable<IGrouping<Guid,VisitTask>>, IQueryable<DoctorConsistentRuleSubjectView>) GetIQueryableDoctorConsistentRuleSubjectView(TaskConsistentRule filterObj, List<Guid>? subejctIdList=null)
|
||||||
|
{
|
||||||
|
|
||||||
bool isSelfAnalysis = filterObj.CompareDoctorUserId == null;
|
bool isSelfAnalysis = filterObj.CompareDoctorUserId == null;
|
||||||
|
|
||||||
IQueryable<Guid> subjectfilter = default;
|
IQueryable<Guid> subjectfilter = default;
|
||||||
|
@ -195,15 +156,17 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && inCommand.SubejctIdList.Contains(t.SubjectId) && t.IsAnalysisCreate == false)
|
var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.IsAnalysisCreate == false)
|
||||||
|
|
||||||
|
.WhereIf(subejctIdList!=null && subejctIdList?.Count>0, t => subejctIdList.Contains(t.SubjectId))
|
||||||
// 自身一致性分析
|
// 自身一致性分析
|
||||||
.WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId)
|
.WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId)
|
||||||
// 组内一致性分析
|
// 组内一致性分析
|
||||||
.WhereIf(isSelfAnalysis == false && subjectfilter != null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId))
|
.WhereIf(isSelfAnalysis == false && subjectfilter != null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId))
|
||||||
.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
|
.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
|
||||||
.Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now)
|
.Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now)
|
||||||
//重阅产生的访视任务 要把之前的访视任务去除
|
//重阅产生的访视任务 要把之前的访视任务去除
|
||||||
.Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject)
|
.Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject)
|
||||||
|
|
||||||
.WhereIf(filterObj.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit)
|
.WhereIf(filterObj.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit)
|
||||||
.WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)
|
.WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)
|
||||||
|
@ -217,53 +180,43 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
IsHaveGeneratedTask = g.Any(c => c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)),
|
IsHaveGeneratedTask = g.Any(c => c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)),
|
||||||
|
|
||||||
VisitTaskList = g.OrderBy(t => t.VisitTaskNum).Select(c => new VisitTaskSimpleView()
|
VisitTaskList = g.OrderBy(t => t.VisitTaskNum)
|
||||||
{
|
|
||||||
Id = c.Id,
|
|
||||||
ReadingCategory = c.ReadingCategory,
|
|
||||||
TaskBlindName = c.TaskBlindName,
|
|
||||||
TaskCode = c.TaskCode,
|
|
||||||
TaskName = c.TaskName,
|
|
||||||
TaskState = c.TaskState,
|
|
||||||
ArmEnum = c.ArmEnum,
|
|
||||||
SubjectId = c.SubjectId,
|
|
||||||
SiteId = c.Subject.SiteId,
|
|
||||||
TrialId = c.TrialId,
|
|
||||||
SubjectCode = c.Subject.Code,
|
|
||||||
TrialSiteCode = c.Subject.TrialSite.TrialSiteCode,
|
|
||||||
|
|
||||||
IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id),
|
.Select(c => new VisitTaskSimpleView()
|
||||||
|
{
|
||||||
|
Id = c.Id,
|
||||||
|
ReadingCategory = c.ReadingCategory,
|
||||||
|
ReadingTaskState = c.ReadingTaskState,
|
||||||
|
TaskBlindName = c.TaskBlindName,
|
||||||
|
TaskCode = c.TaskCode,
|
||||||
|
TaskName = c.TaskName,
|
||||||
|
TaskState = c.TaskState,
|
||||||
|
ArmEnum = c.ArmEnum,
|
||||||
|
SubjectId = c.SubjectId,
|
||||||
|
TrialId = c.TrialId,
|
||||||
|
SiteId = c.Subject.SiteId,
|
||||||
|
SubjectCode = c.Subject.Code,
|
||||||
|
TrialSiteCode = c.Subject.TrialSite.TrialSiteCode,
|
||||||
|
|
||||||
}).ToList(),
|
RelationDoctorUserList = c.SameVisitTaskList/*Where(t=>t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)*/.Select(c => new UserSimpleInfo()
|
||||||
|
{
|
||||||
|
FullName = c.DoctorUser.FullName,
|
||||||
|
UserCode = c.DoctorUser.UserCode,
|
||||||
|
UserId = c.DoctorUser.Id,
|
||||||
|
UserName = c.DoctorUser.UserName
|
||||||
|
}).ToList(),
|
||||||
|
|
||||||
|
IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id),
|
||||||
|
|
||||||
|
}).ToList(),
|
||||||
|
|
||||||
ValidTaskCount = g.Count()
|
ValidTaskCount = g.Count()
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var list = query.OrderByDescending(t=>t.IsHaveGeneratedTask).ToList();
|
return (group, query);
|
||||||
|
|
||||||
foreach (var subject in list)
|
|
||||||
{
|
|
||||||
subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => { t.DoctorUserId = doctorUserId; t.TaskConsistentRuleId = filterObj.Id; });
|
|
||||||
|
|
||||||
|
|
||||||
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
|
|
||||||
{
|
|
||||||
TrialId = filterObj.TrialId,
|
|
||||||
ReadingCategory = ReadingCategory.Consistent,
|
|
||||||
GenerataConsistentTaskList = subject.VisitTaskList.Where(t=>t.IsHaveGeneratedTask==false).ToList()
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 一致性分配 配置+ 统计已经生成数量统计表
|
/// 一致性分配 配置+ 统计已经生成数量统计表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -969,21 +969,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
task.ReReadingApplyState = ReReadingApplyState.HaveApplyed;
|
task.ReReadingApplyState = ReReadingApplyState.HaveApplyed;
|
||||||
|
|
||||||
////产生了裁判
|
|
||||||
//if (task.JudgeVisitTaskId != null)
|
|
||||||
//{
|
|
||||||
// if (task.ReadingTaskState == ReadingTaskState.WaitReading || task.ReadingTaskState == ReadingTaskState.Reading)
|
|
||||||
// {
|
|
||||||
// task.JudgeVisitTask.TaskState = TaskState.Adbandon;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
|
|
||||||
// task.JudgeVisitTask.TaskState = TaskState.HaveReturned;
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
var rootReReadingTaskId = _visitTaskReReadingRepository.Where(t => t.NewReReadingTaskId == task.Id).Select(u => u.RootReReadingTaskId).FirstOrDefault();
|
var rootReReadingTaskId = _visitTaskReReadingRepository.Where(t => t.NewReReadingTaskId == task.Id).Select(u => u.RootReReadingTaskId).FirstOrDefault();
|
||||||
|
|
||||||
|
@ -1222,7 +1207,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1242,79 +1227,72 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException();
|
var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||||
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
var task = (await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == taskId)).IfNullThrowException();
|
||||||
|
|
||||||
|
//申请的任务 肯定是未完成阅片的 并且是访视类型的
|
||||||
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && task.ReadingCategory == ReadingCategory.Visit && task.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||||
{
|
{
|
||||||
var task = (await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == taskId)).IfNullThrowException();
|
|
||||||
|
|
||||||
//申请的任务 肯定是未完成阅片的 并且是访视类型的
|
#region 有序 无序公用流程
|
||||||
if (task.ReadingTaskState != ReadingTaskState.HaveSigned && task.ReadingCategory == ReadingCategory.Visit)
|
|
||||||
|
// 当前任务标为失效
|
||||||
|
task.TaskState = TaskState.Adbandon;
|
||||||
|
|
||||||
|
//执行类似一致性核查回退流程 回退访视到影像上传流程
|
||||||
|
await VisitBackAsync(task.SourceSubjectVisitId);
|
||||||
|
|
||||||
|
|
||||||
|
//考虑该访视 另外一个阅片人的任务
|
||||||
|
var otherReviewerTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.SourceSubjectVisitId == task.SourceSubjectVisitId && t.Id != task.Id && t.TaskState == TaskState.Effect);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//有序
|
||||||
|
if (trialConfig.IsReadingTaskViewInOrder)
|
||||||
{
|
{
|
||||||
|
//本身自己 有序 PM 申请回退流程
|
||||||
|
|
||||||
|
if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||||
#region 有序 无序公用流程
|
|
||||||
|
|
||||||
// 当前任务标为失效
|
|
||||||
task.TaskState = TaskState.Adbandon;
|
|
||||||
|
|
||||||
//执行类似一致性核查回退流程 回退访视到影像上传流程
|
|
||||||
await VisitBackAsync(task.SourceSubjectVisitId);
|
|
||||||
|
|
||||||
|
|
||||||
//考虑该访视 另外一个阅片人的任务
|
|
||||||
var otherReviewerTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.SourceSubjectVisitId == task.SourceSubjectVisitId && t.Id != task.Id && t.TaskState == TaskState.Effect);
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
//有序
|
|
||||||
if (trialConfig.IsReadingTaskViewInOrder)
|
|
||||||
{
|
{
|
||||||
//本身自己 有序 PM 申请回退流程
|
//另外阅片人完成阅片了 就设置为重阅重置
|
||||||
|
otherReviewerTask.TaskState = TaskState.HaveReturned;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned)
|
|
||||||
{
|
|
||||||
//另外阅片人完成阅片了 就设置为重阅重置
|
|
||||||
otherReviewerTask.TaskState = TaskState.HaveReturned;
|
|
||||||
|
|
||||||
|
|
||||||
//另外一个阅片人 有序PM 申请重阅流程
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
otherReviewerTask.TaskState = TaskState.Adbandon;
|
|
||||||
|
|
||||||
|
|
||||||
//另外一个阅片人 有序 PM 申请回退流程
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//另外一个阅片人 有序PM 申请重阅流程
|
||||||
}
|
}
|
||||||
//无序 无序阅片没有 全局 肿瘤学
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned)
|
|
||||||
{
|
|
||||||
//另外阅片人完成阅片了 就设置为重阅重置
|
|
||||||
otherReviewerTask.TaskState = TaskState.HaveReturned;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
otherReviewerTask.TaskState = TaskState.Adbandon;
|
otherReviewerTask.TaskState = TaskState.Adbandon;
|
||||||
}
|
|
||||||
|
//另外一个阅片人 有序 PM 申请回退流程
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//无序 无序阅片没有 全局 肿瘤学
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||||
|
{
|
||||||
|
//另外阅片人完成阅片了 就设置为重阅重置
|
||||||
|
otherReviewerTask.TaskState = TaskState.HaveReturned;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
otherReviewerTask.TaskState = TaskState.Adbandon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("仅仅未完成的访视类型的任务支持PM退回");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _visitTaskRepository.SaveChangesAsync();
|
await _visitTaskRepository.SaveChangesAsync();
|
||||||
|
@ -1368,12 +1346,13 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重阅影响提示列表 仅仅针对已完成的任务申请
|
/// 影响提示列表 重阅仅仅针对已完成的任务申请 退回针对的是未完成的(退回仅仅针对是访视类型的)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="taskId"></param>
|
/// <param name="taskId"></param>
|
||||||
|
/// <param name="isReReading"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{taskId:guid}")]
|
[HttpGet("{taskId:guid}/{isReReading;bool}")]
|
||||||
public async Task<List<VisitTaskSimpleView>> GetReReadingInfluenceTaskList(Guid taskId)
|
public async Task<List<VisitTaskSimpleView>> GetReReadingOrBackInfluenceTaskList(Guid taskId, bool isReReading)
|
||||||
{
|
{
|
||||||
var filterObj = (await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId)).IfNullThrowException();
|
var filterObj = (await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId)).IfNullThrowException();
|
||||||
var trialId = filterObj.TrialId;
|
var trialId = filterObj.TrialId;
|
||||||
|
@ -1382,40 +1361,120 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && t.TaskState == TaskState.Effect;
|
Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && t.TaskState == TaskState.Effect;
|
||||||
|
|
||||||
|
//重阅影响
|
||||||
//有序
|
if (isReReading)
|
||||||
if (trialConfig.IsReadingTaskViewInOrder)
|
|
||||||
{
|
{
|
||||||
//当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务
|
//有序
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer)
|
if (trialConfig.IsReadingTaskViewInOrder)
|
||||||
{
|
{
|
||||||
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId);
|
//当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务
|
||||||
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer)
|
||||||
|
{
|
||||||
|
switch (filterObj.ReadingCategory)
|
||||||
|
{
|
||||||
|
case ReadingCategory.Visit:
|
||||||
|
|
||||||
|
//访视影响当前医生 以及当前医生之后的
|
||||||
|
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ReadingCategory.Global:
|
||||||
|
//全局的影响所有 不加额外过滤
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ReadingCategory.Judge:
|
||||||
|
|
||||||
|
//裁判的仅仅影响自己
|
||||||
|
filterExpression = filterExpression.And(t => t.Id == filterObj.Id);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ReadingCategory.Oncology:
|
||||||
|
throw new BusinessValidationFailedException("不支持的任务类型");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new BusinessValidationFailedException("不支持的任务类型");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//影响所有阅片人
|
||||||
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||||
|
{
|
||||||
|
switch (filterObj.ReadingCategory)
|
||||||
|
{
|
||||||
|
case ReadingCategory.Visit:
|
||||||
|
|
||||||
|
//访视影响当前以及当前之后的
|
||||||
|
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ReadingCategory.Global:
|
||||||
|
//全局的影响所有 不加额外过滤
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ReadingCategory.Judge:
|
||||||
|
//裁判的仅仅影响自己
|
||||||
|
filterExpression = filterExpression.And(t => t.Id == filterObj.Id);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ReadingCategory.Oncology:
|
||||||
|
|
||||||
|
throw new BusinessValidationFailedException("不支持的任务类型");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new BusinessValidationFailedException("不支持的任务类型");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//无序
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//1.当前任务及裁判任务
|
||||||
|
//2.影响当前阅片人的任务
|
||||||
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer)
|
||||||
|
{
|
||||||
|
filterExpression = filterExpression.And(t => t.Id == filterObj.Id || t.Id == filterObj.JudgeVisitTaskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1.当前任务及裁判任务
|
||||||
|
// 2.影响所有阅片人的任务
|
||||||
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||||
|
{
|
||||||
|
var judegTaskNum = filterObj.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge];
|
||||||
|
|
||||||
|
filterExpression = filterExpression.And(t => t.VisitTaskNum == filterObj.VisitTaskNum || t.VisitTaskNum == judegTaskNum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//影响所有阅片人
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
|
||||||
{
|
|
||||||
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//无序
|
//退回影响 仅仅针对是访视类型的
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//1.当前任务及裁判任务
|
if (filterObj.ReadingCategory == ReadingCategory.Visit && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||||
//2.影响当前阅片人的任务
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer)
|
|
||||||
{
|
{
|
||||||
filterExpression = filterExpression.And(t => t.Id == filterObj.Id || t.Id == filterObj.JudgeVisitTaskId);
|
//有序
|
||||||
|
if (trialConfig.IsReadingTaskViewInOrder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//无序
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//自己和另一个人的当前任务
|
||||||
|
filterExpression = filterExpression.And(t => t.VisitTaskNum == filterObj.VisitTaskNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("仅仅访视类型的任务支持PM退回");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.当前任务及裁判任务
|
|
||||||
// 2.影响所有阅片人的任务
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
|
||||||
{
|
|
||||||
var judegTaskNum = filterObj.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge];
|
|
||||||
|
|
||||||
filterExpression = filterExpression.And(t => t.VisitTaskNum == filterObj.VisitTaskNum || t.VisitTaskNum == judegTaskNum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = await _visitTaskRepository.Where(filterExpression).ProjectTo<VisitTaskSimpleView>(_mapper.ConfigurationProvider).ToListAsync();
|
var list = await _visitTaskRepository.Where(filterExpression).ProjectTo<VisitTaskSimpleView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
|
@ -165,17 +165,24 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
CreateMap<TaskMedicalReviewRule, TaskMedicalReviewRuleView>()
|
CreateMap<TaskMedicalReviewRule, TaskMedicalReviewRuleView>()
|
||||||
.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser))
|
.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser))
|
||||||
.ForMember(o => o.ActualVisitTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
.ForMember(o => o.ActualVisitTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||||
|
.OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||||
|
|
||||||
.ForMember(o => o.ActualJudgeTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.TaskState == TaskState.Effect &&
|
.ForMember(o => o.ActualJudgeTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.TaskState == TaskState.Effect &&
|
||||||
t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||||
|
|
||||||
.ForMember(o => o.ActualGlobalTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.TaskState == TaskState.Effect &&
|
.ForMember(o => o.ActualGlobalTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.TaskState == TaskState.Effect &&
|
||||||
t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||||
|
|
||||||
.ForMember(o => o.ActualTumorTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.TaskState == TaskState.Effect &&
|
.ForMember(o => o.ActualTumorTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.TaskState == TaskState.Effect &&
|
||||||
t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||||
|
|
||||||
.ForMember(o => o.GeneratedGlobalTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Global && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
.ForMember(o => o.GeneratedGlobalTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Global && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||||
|
|
||||||
.ForMember(o => o.GeneratedJudgeTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Judge && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
.ForMember(o => o.GeneratedJudgeTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Judge && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||||
|
|
||||||
.ForMember(o => o.GeneratedTumorTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Oncology && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
.ForMember(o => o.GeneratedTumorTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Oncology && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })))
|
||||||
|
|
||||||
.ForMember(o => o.GeneratedVisitTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Visit && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })));
|
.ForMember(o => o.GeneratedVisitTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Visit && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId })));
|
||||||
|
|
||||||
CreateMap<TaskMedicalReviewRuleAddOrEdit, TaskMedicalReviewRule>();
|
CreateMap<TaskMedicalReviewRuleAddOrEdit, TaskMedicalReviewRule>();
|
||||||
|
|
Loading…
Reference in New Issue