修改任务生成

This commit is contained in:
2022-07-19 13:14:59 +08:00
parent 3d996e2a15
commit 273bfcc2e8
4 changed files with 70 additions and 59 deletions
@@ -173,6 +173,36 @@ namespace IRaCIS.Core.Application.ViewModel
// //public List<UserSimpleInfo> HistoryDoctorUserList => VisitTaskList.SelectMany(t => t.RelationDoctorUserList).DistinctBy(t=>t.UserId).ToList();
//}
public class InfluenceTaskInfo
{
public Guid Id { get; set; }
public Guid TrialId { get; set; }
public Guid SiteId { get; set; }
public Guid SubjectId { get; set; }
public Arm ArmEnum { get; set; }
public string TaskCode { get; set; }
public string TaskName { get; set; }
public string TaskBlindName { get; set; }
public decimal VisitTaskNum { get; set; }
public ReadingCategory ReadingCategory { get; set; }
//任务阅片状态
public ReadingTaskState ReadingTaskState { get; set; }
public TaskState TaskState { get; set; }
public String TrialSiteCode { get; set; } = String.Empty;
public string SubjectCode { get; set; } = String.Empty;
public UserSimpleInfo DoctorUser { get; set; }
}
public class VisitTaskSimpleView
{
public Guid Id { get; set; }
@@ -1283,11 +1283,12 @@ namespace IRaCIS.Core.Application.Service.Allocation
//影响后续访视已经读完的,未读的不做处理 以及其他类型任务
filterExpression = filterExpression.And(t => t.VisitTaskNum > origenalTask.VisitTaskNum && t.DoctorUserId == origenalTask.DoctorUserId &&
(t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit ||
(t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState==ReadingTaskState.HaveSigned ||
t.ReadingCategory == ReadingCategory.Global ||
t.ReadingCategory == ReadingCategory.Oncology ||
t.ReadingCategory == ReadingCategory.Judge)
);
)
;
break;
case ReadingCategory.Global:
@@ -1327,41 +1328,16 @@ namespace IRaCIS.Core.Application.Service.Allocation
foreach (var influenceTask in influenceTaskList)
{
if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned)
{
influenceTask.TaskState = TaskState.HaveReturned;
}
else
{
influenceTask.TaskState = TaskState.Adbandon;
}
//影响其他的任务 如果是访视类型 需要重新生成
if (influenceTask.ReadingCategory == ReadingCategory.Visit)
{
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned)
{
TrialId = trialId,
ReadingCategory = GenerateTaskCategory.ReReading,
ReReadingTask = origenalTask,
//同步才可以
Action = (newTask) =>
{
//申请表 设置新任务Id
visitTaskReReadingAppply.NewReReadingTaskId = newTask.Id;
//生成的任务分配给原始医生
newTask.DoctorUserId = origenalTask.DoctorUserId;
newTask.TaskAllocationState = TaskAllocationState.Allocated;
newTask.AllocateTime = DateTime.Now;
}
});
}
influenceTask.TaskState = TaskState.HaveReturned;
}
else
{
influenceTask.TaskState = TaskState.Adbandon;
}
}
#endregion
@@ -1764,7 +1740,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <param name="isReReading"></param>
/// <returns></returns>
[HttpGet("{taskId:guid}/{isReReading:bool}")]
public async Task<List<VisitTaskSimpleView>> GetReReadingOrBackInfluenceTaskList(Guid taskId, bool isReReading, Guid? applyId)
public async Task<List<InfluenceTaskInfo>> GetReReadingOrBackInfluenceTaskList(Guid taskId, bool isReReading, Guid? applyId)
{
var filterObj = (await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId)).IfNullThrowException();
var trialId = filterObj.TrialId;
@@ -1795,15 +1771,16 @@ namespace IRaCIS.Core.Application.Service.Allocation
switch (filterObj.ReadingCategory)
{
case ReadingCategory.Visit:
//影响当前医生 以及当前医生之后的 1、访视任务 已经读完的(未读完的或者未读的 不处理)
//影响当前医生 以及当前医生之后的 1、访视任务 已经读完的
//2、后续任务如果是全局、肿瘤学阅片任务,状态为阅片完成标记为重阅重置;若在阅片中,则标记为失效;若为待阅片,则标记为失效;
//3、当前任务、后续访视任务或者全局任务触发了裁判任务,若裁判任务状态为阅片完成,则标记为重阅重置;若在阅片中或待阅片,则标记为失效
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId &&
(t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit ||
(t.ReadingCategory == ReadingCategory.Visit &&t.ReadingTaskState==ReadingTaskState.HaveSigned||
t.ReadingCategory == ReadingCategory.Global ||
t.ReadingCategory == ReadingCategory.Oncology ||
t.ReadingCategory == ReadingCategory.Judge)
);
)
;
break;
case ReadingCategory.Global:
@@ -1943,7 +1920,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
}
var list = await _visitTaskRepository.Where(filterExpression).OrderBy(t => t.VisitTaskNum).ProjectTo<VisitTaskSimpleView>(_mapper.ConfigurationProvider).ToListAsync();
var list = await _visitTaskRepository.Where(filterExpression).OrderBy(t => t.VisitTaskNum).ProjectTo<InfluenceTaskInfo>(_mapper.ConfigurationProvider).ToListAsync();
return list;
@@ -217,7 +217,11 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code));
CreateMap<VisitTask, InfluenceTaskInfo>()
//.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code));
}
}