任务分配

Uat_Study
hang 2022-06-28 17:53:46 +08:00
parent 319cc7faf3
commit 84049af89d
3 changed files with 20 additions and 13 deletions

View File

@ -233,8 +233,8 @@ namespace IRaCIS.Core.Application.ViewModel
public class SelfConsistentView public class SelfConsistentView
{ {
public Guid TrialId { get; set; } //public Guid TrialId { get; set; }
public Guid SiteId { get; set; } //public Guid SiteId { get; set; }
public Guid SubjectId { get; set; } public Guid SubjectId { get; set; }
public String TrialSiteCode { get; set; } = String.Empty; public String TrialSiteCode { get; set; } = String.Empty;
@ -259,7 +259,6 @@ namespace IRaCIS.Core.Application.ViewModel
public ReadingCategory ReadingCategory { get; set; } public ReadingCategory ReadingCategory { get; set; }
public TaskAllocationState TaskAllocationState { get; set; }
public TaskState TaskState { get; set; } public TaskState TaskState { get; set; }
} }

View File

@ -318,7 +318,7 @@ namespace IRaCIS.Core.Application.Service
ArmEnum = reReadingVisitTask.ArmEnum, ArmEnum = reReadingVisitTask.ArmEnum,
TaskName = reReadingVisitTask.TaskName, TaskName = reReadingVisitTask.TaskName,
TaskBlindName = reReadingVisitTask.TaskBlindName, TaskBlindName = reReadingVisitTask.TaskBlindName,
TaskAllocationState = reReadingVisitTask.TaskAllocationState,
ReadingCategory = reReadingVisitTask.ReadingCategory, ReadingCategory = reReadingVisitTask.ReadingCategory,
SourceSubjectVisitId = reReadingVisitTask.SourceSubjectVisitId, SourceSubjectVisitId = reReadingVisitTask.SourceSubjectVisitId,
@ -327,8 +327,8 @@ namespace IRaCIS.Core.Application.Service
Code = currentMaxCodeInt + 1, Code = currentMaxCodeInt + 1,
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
// TaskAllocationState = reReadingVisitTask.TaskAllocationState,
// AllocateTime = DateTime.Now, // AllocateTime = DateTime.Now,
//DoctorUserId = reReadingVisitTask.DoctorUserId, //DoctorUserId = reReadingVisitTask.DoctorUserId,
}); });
@ -364,6 +364,8 @@ namespace IRaCIS.Core.Application.Service
case ReadingCategory.Judge: case ReadingCategory.Judge:
var firstTask = await _visitTaskRepository.Where(x => generateTaskCommand.JudgeVisitTaskIdList.Contains(x.Id)).FirstOrDefaultAsync(); var firstTask = await _visitTaskRepository.Where(x => generateTaskCommand.JudgeVisitTaskIdList.Contains(x.Id)).FirstOrDefaultAsync();
VisitTask visitTask = new VisitTask() VisitTask visitTask = new VisitTask()
{ {
ArmEnum = Arm.JudgeArm, ArmEnum = Arm.JudgeArm,
@ -377,6 +379,12 @@ namespace IRaCIS.Core.Application.Service
SourceSubjectVisitId = firstTask.SourceSubjectVisitId, SourceSubjectVisitId = firstTask.SourceSubjectVisitId,
SouceReadModuleId = firstTask.SouceReadModuleId, SouceReadModuleId = firstTask.SouceReadModuleId,
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
TaskState = TaskState.Effect,
//DoctorUserId = doctorUserId,
TaskAllocationState = TaskAllocationState.Allocated,
AllocateTime = DateTime.Now,
}; };
await _visitTaskRepository.AddAsync(visitTask); await _visitTaskRepository.AddAsync(visitTask);

View File

@ -228,29 +228,30 @@ namespace IRaCIS.Core.Application.Service
} }
[HttpPost]
public async Task<List<SelfConsistentView>> GetSelfConsistentList(SelfConsistentQuery inQuery) public async Task<List<SelfConsistentView>> GetSelfConsistentList(SelfConsistentQuery inQuery)
{ {
var query = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.DoctorUserId == inQuery.AnalysisDoctorUserId) var query = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.DoctorUserId == inQuery.AnalysisDoctorUserId)
.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(inQuery.IntervalWeeks * 7 + 1) > DateTime.Now) .Where(t => t.SignTime!.Value.AddDays(inQuery.IntervalWeeks * 7 + 1) > DateTime.Now)
//重阅产生的访视任务 要把之前的访视任务去除 //重阅产生的访视任务 要把之前的访视任务去除
.Where(t => t.ReReadingApplyState != ReReadingApplyState.Agree) .Where(t => t.ReReadingApplyState != ReReadingApplyState.Agree)
.WhereIf(inQuery.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit) .WhereIf(inQuery.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit)
.WhereIf(inQuery.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global) .WhereIf(inQuery.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)
.GroupBy(t => new { t.SubjectId, t.Subject.SiteId, t.Subject.Code, t.TrialId, t.Subject.TrialSite.TrialSiteCode }) .GroupBy(t => new { t.SubjectId, /*t.TrialId, t.Subject.SiteId,*/ t.Subject.Code, t.Subject.TrialSite.TrialSiteCode })
.Select(g => new SelfConsistentView() .Select(g => new SelfConsistentView()
{ {
SubjectId = g.Key.SubjectId, SubjectId = g.Key.SubjectId,
TrialId = g.Key.TrialId, //TrialId = g.Key.TrialId,
//SiteId = g.Key.SiteId,
SubjectCode = g.Key.Code, SubjectCode = g.Key.Code,
TrialSiteCode = g.Key.TrialSiteCode, TrialSiteCode = g.Key.TrialSiteCode,
SiteId = g.Key.SiteId,
VisitTaskList = g.OrderBy(t => t.SubjectVisit.VisitNum).Select(c => new VisitTaskSimpleView() VisitTaskList = g.OrderBy(t => t.SubjectVisit.VisitNum).Select(c => new VisitTaskSimpleView()
{ {
Id = c.Id, Id = c.Id,
ReadingCategory = c.ReadingCategory, ReadingCategory = c.ReadingCategory,
TaskAllocationState = c.TaskAllocationState,
TaskBlindName = c.TaskBlindName, TaskBlindName = c.TaskBlindName,
TaskCode = c.TaskCode, TaskCode = c.TaskCode,
TaskName = c.TaskName, TaskName = c.TaskName,
@ -1060,9 +1061,8 @@ namespace IRaCIS.Core.Application.Service
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == item.NewReReadingTaskId, u => new VisitTask() await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == item.NewReReadingTaskId, u => new VisitTask()
{ {
TaskState = TaskState.Effect, TaskState = TaskState.Effect,
DoctorUserId = doctorUserId, DoctorUserId = doctorUserId,
TaskAllocationState=TaskAllocationState.Allocated,
AllocateTime = DateTime.Now, AllocateTime = DateTime.Now,
}); });
} }