重阅任务产生和确认提交
parent
a9022b4c02
commit
97b01343d7
|
@ -143,6 +143,11 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
/// 阅片期
|
||||
/// </summary>
|
||||
public List<ReadingGenerataTaskDTO> ReadingGenerataTaskList= new List<ReadingGenerataTaskDTO>();
|
||||
|
||||
|
||||
//重阅 产生任务
|
||||
|
||||
public List<VisitTask> ReReadingTaskList = new List<VisitTask>();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -412,6 +412,31 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
}
|
||||
|
||||
|
||||
public class ApplyReReadingCommand
|
||||
{
|
||||
|
||||
|
||||
public List<Guid> TaskIdList { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public RequestReReadingType RequestReReadingTypeEnum { get; set; }
|
||||
|
||||
public string RequestReReadingReason { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public class ConfirmReReadingCommand
|
||||
{
|
||||
public List<Guid> TaskIdList { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public RequestReReadingResult RequestReReadingResultEnum { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public enum TaskOptType
|
||||
{
|
||||
Assign = 1,
|
||||
|
|
|
@ -199,9 +199,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
#endregion
|
||||
|
||||
await _visitTaskRepository.AddAsync(task1);
|
||||
await _visitTaskRepository.AddAsync(task2);
|
||||
|
||||
}
|
||||
else if (trialConfig.ReadingType == ReadingMethod.Single)
|
||||
{
|
||||
|
@ -222,7 +219,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
ReadingCategory = ReadingCategory.Visit
|
||||
});
|
||||
|
||||
singleTask.AllocateTime = DateTime.Now;
|
||||
|
||||
currentMaxCodeInt = currentMaxCodeInt + 1;
|
||||
|
||||
|
@ -260,6 +256,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
singleTask.TaskState = defaultState;
|
||||
|
||||
singleTask.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == 0).DoctorUserId;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,16 +270,36 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
}
|
||||
|
||||
singleTask.AllocateTime = DateTime.Now;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
await _visitTaskRepository.AddAsync(singleTask);
|
||||
}
|
||||
|
||||
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Id == subjectVisit.Id, u => new SubjectVisit() { IsVisitTaskGenerated = true });
|
||||
}
|
||||
break;
|
||||
case ReadingCategory.ReReading:
|
||||
|
||||
foreach (var reReadingVisitTask in generateTaskCommand.ReReadingTaskList)
|
||||
{
|
||||
reReadingVisitTask.OriginalReReadingId = reReadingVisitTask.Id;
|
||||
reReadingVisitTask.OriginalReReadingId = Guid.Empty;
|
||||
reReadingVisitTask. Code = currentMaxCodeInt + 1;
|
||||
reReadingVisitTask.TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask));
|
||||
|
||||
//是否增加任务类别
|
||||
|
||||
currentMaxCodeInt = currentMaxCodeInt + 1;
|
||||
|
||||
_provider.Set<int>($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 1, TimeSpan.FromMinutes(30));
|
||||
|
||||
await _visitTaskRepository.AddAsync(reReadingVisitTask);
|
||||
}
|
||||
|
||||
break;
|
||||
case ReadingCategory.Judge:
|
||||
var firstTask = await _visitTaskRepository.Where(x => generateTaskCommand.JudgeVisitTaskIdList.Contains(x.Id)).FirstOrDefaultAsync();
|
||||
|
|
|
@ -268,7 +268,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
var result = await subjectQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc);
|
||||
return (result, new {
|
||||
return (result, new
|
||||
{
|
||||
RandomReadInfo = new IRUnReadOutDto(),
|
||||
IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
|
||||
});
|
||||
|
@ -611,7 +612,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
var subjectList = _subjectRepository.Where(t => t.TrialId == trialId)
|
||||
.WhereIf(isJudge == false, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum != Arm.JudgeArm).Any())
|
||||
.WhereIf(isJudge, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum == Arm.JudgeArm).Any())
|
||||
.Select(t => new {
|
||||
.Select(t => new
|
||||
{
|
||||
SubjectId = t.Id,
|
||||
DoctorUserList = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Select(t => new { t.DoctorUserId, t.ArmEnum }),
|
||||
IsApplyed = t.SubjectDoctorList.Where(t => isJudge ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).SelectMany(t => t.SubjectArmVisitTaskList).Any(c => c.DoctorUserId != null)
|
||||
|
@ -866,5 +868,71 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 申请重阅 1:IR 2:PM
|
||||
/// </summary>
|
||||
/// <param name="applyReReadingCommand"></param>
|
||||
/// <param name="_visitTaskCommonService"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public async Task<IResponseOutput> ApplyReReading(ApplyReReadingCommand applyReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
|
||||
{
|
||||
var taskList = await _visitTaskRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.Id), true).ToListAsync();
|
||||
|
||||
var reReadingTaskList = taskList.Clone();
|
||||
|
||||
foreach (var task in taskList)
|
||||
{
|
||||
task.IsReReading = true;
|
||||
task.RequestReReadingReason = applyReReadingCommand.RequestReReadingReason;
|
||||
task.RequestReReadingType = applyReReadingCommand.RequestReReadingTypeEnum;
|
||||
task.RequestReReadingTime = DateTime.Now;
|
||||
task.RequestReReadingUserId = _userInfo.Id;
|
||||
}
|
||||
|
||||
await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
|
||||
{
|
||||
TrialId = applyReReadingCommand.TrialId,
|
||||
ReadingCategory = ReadingCategory.ReReading,
|
||||
ReReadingTaskList = reReadingTaskList
|
||||
});
|
||||
|
||||
//产生新的任务
|
||||
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 确认重阅与否 1同意 2 拒绝
|
||||
/// </summary>
|
||||
/// <param name="agreeReReadingCommand"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
public async Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand)
|
||||
{
|
||||
//var taskList = await _visitTaskRepository.Where(t => agreeReReadingCommand.TaskIdList.Contains(t.Id), true).ToListAsync();
|
||||
|
||||
//foreach (var task in taskList)
|
||||
//{
|
||||
// task.RequestReReadingResultEnum = agreeReReadingCommand.RequestReReadingResultEnum;
|
||||
// task.RequestReReadingConfirmUserId = _userInfo.Id;
|
||||
//}
|
||||
//await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => agreeReReadingCommand.TaskIdList.Contains(t.Id), u => new VisitTask()
|
||||
{
|
||||
RequestReReadingResultEnum = agreeReReadingCommand.RequestReReadingResultEnum,
|
||||
RequestReReadingConfirmUserId = _userInfo.Id
|
||||
}, true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace IRaCIS.Core.Domain.Share
|
|||
Oncology=5,
|
||||
|
||||
|
||||
|
||||
ReReading=6,
|
||||
}
|
||||
|
||||
public enum TaskState
|
||||
|
|
|
@ -171,7 +171,13 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public string RequestReReadingReason { get; set; } = string.Empty;
|
||||
|
||||
public Guid? RequestReReadingUserId { get; set; }
|
||||
|
||||
public User RequestReReadingUser { get; set; }
|
||||
|
||||
public Guid? RequestReReadingConfirmUserId { get; set; }
|
||||
|
||||
public User RequestReReadingConfirmUser { get; set; }
|
||||
|
||||
public RequestReReadingResult RequestReReadingResultEnum { get; set; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue