Compare commits

..

No commits in common. "f92ace189460205c9e889995622c86c8f63e0064" and "ae2907ad5ded7a2a97446ffa5db73425461237cc" have entirely different histories.

3 changed files with 38 additions and 55 deletions

View File

@ -184,7 +184,6 @@ namespace IRaCIS.Core.Application.ViewModel
public string TaskCode { get; set; } public string TaskCode { get; set; }
[JsonIgnore]
//可以不查询 //可以不查询
public List<VisitTaskSimpleDTO> GlobalVisitTaskList { get; set; } public List<VisitTaskSimpleDTO> GlobalVisitTaskList { get; set; }

View File

@ -19,7 +19,6 @@ using Medallion.Threading;
using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Infrastructure.Extention;
using System; using System;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NPOI.SS.Formula.Functions;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
@ -179,7 +178,9 @@ namespace IRaCIS.Core.Application.Service
var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, doctorUserId, inCommand.SubejctIdList).ToListAsync(); var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, doctorUserId, inCommand.SubejctIdList).ToListAsync();
//var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList);
//var list = query.OrderByDescending(t => t.IsHaveGeneratedTask).ToList();
var @lock = _distributedLockProvider.CreateLock($"VisitTaskCode"); var @lock = _distributedLockProvider.CreateLock($"VisitTaskCode");
@ -551,8 +552,7 @@ namespace IRaCIS.Core.Application.Service
var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId && var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId &&
t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count() >= filterObj.PlanVisitCount) t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count() >= filterObj.PlanVisitCount)
.WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter) .WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).OrderBy(t => t.VisitTaskNum).Take(filterObj.PlanVisitCount + 1).Any(t => t.ReadingCategory == ReadingCategory.Global))
.Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).Any(t => t.ReadingCategory == ReadingCategory.Global))
; ;
@ -596,27 +596,29 @@ namespace IRaCIS.Core.Application.Service
IsClinicalDataSign = c.IsClinicalDataSign, IsClinicalDataSign = c.IsClinicalDataSign,
IsNeedClinicalDataSign = c.IsNeedClinicalDataSign, IsNeedClinicalDataSign = c.IsNeedClinicalDataSign,
//自身一致性才有意义
//IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id),
//GlobalVisitTaskList = c.Subject.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).Select(c => new VisitTaskSimpleDTO() GlobalVisitTaskList = c.Subject.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).Select(c => new VisitTaskSimpleDTO()
//{ {
// Id = c.Id, Id = c.Id,
// ReadingCategory = c.ReadingCategory, ReadingCategory = c.ReadingCategory,
// ReadingTaskState = c.ReadingTaskState, ReadingTaskState = c.ReadingTaskState,
// TaskBlindName = c.TaskBlindName, TaskBlindName = c.TaskBlindName,
// TaskCode = c.TaskCode, TaskCode = c.TaskCode,
// TaskName = c.TaskName, TaskName = c.TaskName,
// TaskState = c.TaskState, TaskState = c.TaskState,
// ArmEnum = c.ArmEnum, ArmEnum = c.ArmEnum,
// SubjectId = c.SubjectId, SubjectId = c.SubjectId,
// VisitTaskNum = c.VisitTaskNum, VisitTaskNum = c.VisitTaskNum,
// TrialId = c.TrialId, TrialId = c.TrialId,
// SourceSubjectVisitId = c.SourceSubjectVisitId, SourceSubjectVisitId = c.SourceSubjectVisitId,
// SouceReadModuleId = c.SouceReadModuleId, SouceReadModuleId = c.SouceReadModuleId,
// TrialReadingCriterionId = c.TrialReadingCriterionId, TrialReadingCriterionId = c.TrialReadingCriterionId,
// IsClinicalDataSign = c.IsClinicalDataSign, IsClinicalDataSign = c.IsClinicalDataSign,
// IsNeedClinicalDataSign = c.IsNeedClinicalDataSign, IsNeedClinicalDataSign = c.IsNeedClinicalDataSign,
//}).ToList(), }).ToList(),
}).ToList() }).ToList()
}); });
@ -793,14 +795,7 @@ namespace IRaCIS.Core.Application.Service
t.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter) t.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter)
.Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SignTime!.Value.AddDays(taskConsistentRule.IntervalWeeks * 7) < DateTime.Now && t.DoctorUserId == user.Id) .Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SignTime!.Value.AddDays(taskConsistentRule.IntervalWeeks * 7) < DateTime.Now && t.DoctorUserId == user.Id)
.Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).Any(t => t.ReadingCategory == ReadingCategory.Global) .Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).OrderBy(t => t.VisitTaskNum).Take(taskConsistentRule.PlanVisitCount + 1).Any(t => t.ReadingCategory == ReadingCategory.Global))
&&
t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter)
.Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SignTime!.Value.AddDays(taskConsistentRule.IntervalWeeks * 7) < DateTime.Now && t.DoctorUserId == user.Id)
.Count()>= taskConsistentRule.PlanVisitCount
)
.Count(), .Count(),

View File

@ -1374,7 +1374,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (IsPMOrAPm()) if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
{ {
if (criterionConfig.IsAutoCreate == false) if (criterionConfig.IsAutoCreate == false)
{ {
@ -1634,7 +1634,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (criterionConfig.CriterionType == CriterionType.RECIST1Point1 && criterionConfig.IsAdditionalAssessment) if (criterionConfig.CriterionType == CriterionType.RECIST1Point1 && criterionConfig.IsAdditionalAssessment)
{ {
// PM申请 SPM / CPM审批 // PM申请 SPM / CPM审批
if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.TrialGroupApply && (IsSpmOrCPM())) if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.TrialGroupApply && (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM))
{ {
filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB); filterExpression = filterExpression.And(t => t.TrialReadingCriterionId == origenalTask.TrialReadingCriterionId || t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB);
} }
@ -1643,7 +1643,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
// 1.1 基线任务影响BM任务 // 1.1 基线任务影响BM任务
if ((IsPMOrAPm()) && _subjectVisitRepository.Any(t => t.Id == origenalTask.SourceSubjectVisitId && t.IsBaseLine == true)) if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && _subjectVisitRepository.Any(t => t.Id == origenalTask.SourceSubjectVisitId && t.IsBaseLine == true))
{ {
isIR1Point1AdditionalAssessmentBaseline = true; isIR1Point1AdditionalAssessmentBaseline = true;
@ -1666,7 +1666,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree) if (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree)
{ {
//PM申请 SPM / CPM审批 回退访视,因此这里不生成访视任务 影响多个标准的任务 //PM申请 SPM / CPM审批 回退访视,因此这里不生成访视任务 影响多个标准的任务
if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.TrialGroupApply && (IsSpmOrCPM())) if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.TrialGroupApply && (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM))
{ {
// 不管有序 无序 都会 回退访视 // 不管有序 无序 都会 回退访视
@ -1786,7 +1786,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
} }
//IR申请 PM 审批 注意这里有一致性分析的申请同意 不会回退访视,在此要生成影响的访视任务 //IR申请 PM 审批 注意这里有一致性分析的申请同意 不会回退访视,在此要生成影响的访视任务
else if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && (IsPMOrAPm() || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.AIR)) else if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.AIR))
{ {
@ -2291,7 +2291,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
//PM 才允许操作 //PM 才允许操作
if (IsPMOrAPm()) if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
{ {
#region 有序 无序公用流程 #region 有序 无序公用流程
@ -2556,16 +2556,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
} }
private bool IsPMOrAPm()
{
return _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM;
}
private bool IsSpmOrCPM()
{
return _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM;
}
/// <summary> /// <summary>
/// 影响提示列表 重阅仅仅针对已完成的任务申请 退回针对的是未完成的(退回仅仅针对是访视类型的) /// 影响提示列表 重阅仅仅针对已完成的任务申请 退回针对的是未完成的(退回仅仅针对是访视类型的)
/// </summary> /// </summary>
@ -2597,12 +2587,12 @@ namespace IRaCIS.Core.Application.Service.Allocation
{ {
// IR 申请 PM 同意 // IR 申请 PM 同意
if ((( IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer)) if (((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer))
|| (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null))) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null)))
{ {
// 1.1 基线任务影响BM任务 // 1.1 基线任务影响BM任务
if (IsPMOrAPm() && _subjectVisitRepository.Any(t => t.Id == filterObj.SourceSubjectVisitId && t.IsBaseLine == true)) if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && _subjectVisitRepository.Any(t => t.Id == filterObj.SourceSubjectVisitId && t.IsBaseLine == true))
{ {
isIR1Point1AdditionalAssessmentBaseline = true; isIR1Point1AdditionalAssessmentBaseline = true;
@ -2640,7 +2630,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
//IR 申请 PM 同意 仅仅影响自己 //IR 申请 PM 同意 仅仅影响自己
if ((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer)) if ((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer))
|| (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null)) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null))
{ {
@ -2758,9 +2748,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
} }
//PM 影响所有阅片人 仅仅针对访视 SPM CPM 调用 //PM 影响所有阅片人 仅仅针对访视 SPM CPM 调用
else if (((IsSpmOrCPM()) && applyId != null && else if (((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.ProjectManager) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit)
await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && (t.CreateUser.UserTypeEnum == UserTypeEnum.ProjectManager || t.CreateUser.UserTypeEnum == UserTypeEnum.APM)) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit) || (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId == null))
|| (IsPMOrAPm() && applyId == null))
{ {
@ -2823,7 +2812,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
throw new BusinessValidationFailedException(_localizer["VisitTask_NoConsistencyReturn"]); throw new BusinessValidationFailedException(_localizer["VisitTask_NoConsistencyReturn"]);
} }
if (filterObj.ReadingCategory == ReadingCategory.Visit && IsPMOrAPm()) if (filterObj.ReadingCategory == ReadingCategory.Visit && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
{ {
//有序 //有序
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder) if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)