修改一版
parent
2cde33e9ec
commit
0c744c12f8
|
@ -78,9 +78,9 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode;
|
int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode;
|
||||||
|
|
||||||
if (generateTaskCommand.ReadingCategory == ReadingCategory.Visit)
|
switch (generateTaskCommand.ReadingCategory)
|
||||||
{
|
{
|
||||||
|
case ReadingCategory.Visit:
|
||||||
foreach (var subjectVisit in generateTaskCommand.VisitGenerataTaskList)
|
foreach (var subjectVisit in generateTaskCommand.VisitGenerataTaskList)
|
||||||
{
|
{
|
||||||
var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync();
|
var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync();
|
||||||
|
@ -282,17 +282,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Id == subjectVisit.Id, u => new SubjectVisit() { IsVisitTaskGenerated = true });
|
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Id == subjectVisit.Id, u => new SubjectVisit() { IsVisitTaskGenerated = true });
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
case ReadingCategory.Judge:
|
||||||
|
|
||||||
else if (generateTaskCommand.ReadingCategory == 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,
|
||||||
Id= NewId.NextGuid(),
|
Id = NewId.NextGuid(),
|
||||||
SubjectId = firstTask.SubjectId,
|
SubjectId = firstTask.SubjectId,
|
||||||
ReadingTaskState = ReadingTaskState.WaitReading,
|
ReadingTaskState = ReadingTaskState.WaitReading,
|
||||||
TaskName = firstTask.TaskName,
|
TaskName = firstTask.TaskName,
|
||||||
|
@ -302,7 +299,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
await _visitTaskRepository.AddAsync(visitTask);
|
await _visitTaskRepository.AddAsync(visitTask);
|
||||||
currentMaxCodeInt = currentMaxCodeInt + 1;
|
currentMaxCodeInt = currentMaxCodeInt + 1;
|
||||||
|
|
||||||
|
@ -312,11 +308,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
JudgeVisitTaskId = visitTask.Id
|
JudgeVisitTaskId = visitTask.Id
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ReadingCategory.ReadingPeriod:
|
||||||
}
|
case ReadingCategory.Global:
|
||||||
else if(generateTaskCommand.ReadingCategory == ReadingCategory.ReadingPeriod)
|
case ReadingCategory.Oncology:
|
||||||
{
|
|
||||||
if (trialConfig.ReadingType == ReadingMethod.Double)
|
if (trialConfig.ReadingType == ReadingMethod.Double)
|
||||||
{
|
{
|
||||||
foreach (var item in generateTaskCommand.ReadingGenerataTaskList)
|
foreach (var item in generateTaskCommand.ReadingGenerataTaskList)
|
||||||
|
@ -330,9 +326,9 @@ namespace IRaCIS.Core.Application.Service
|
||||||
TaskName = item.ReadingName,
|
TaskName = item.ReadingName,
|
||||||
ArmEnum = Arm.DoubleReadingArm1,//特殊
|
ArmEnum = Arm.DoubleReadingArm1,//特殊
|
||||||
Code = currentMaxCodeInt + 1,
|
Code = currentMaxCodeInt + 1,
|
||||||
SouceReadModuleId=item.ReadModuleId,
|
SouceReadModuleId = item.ReadModuleId,
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
||||||
ReadingCategory = ReadingCategory.ReadingPeriod
|
ReadingCategory = item.ReadingCategory
|
||||||
});
|
});
|
||||||
var task2 = await _visitTaskRepository.AddAsync(new VisitTask()
|
var task2 = await _visitTaskRepository.AddAsync(new VisitTask()
|
||||||
{
|
{
|
||||||
|
@ -344,7 +340,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
Code = currentMaxCodeInt + 2,
|
Code = currentMaxCodeInt + 2,
|
||||||
SouceReadModuleId = item.ReadModuleId,
|
SouceReadModuleId = item.ReadModuleId,
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)),
|
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)),
|
||||||
ReadingCategory = ReadingCategory.ReadingPeriod
|
ReadingCategory = item.ReadingCategory
|
||||||
});
|
});
|
||||||
currentMaxCodeInt = currentMaxCodeInt + 2;
|
currentMaxCodeInt = currentMaxCodeInt + 2;
|
||||||
_provider.Set<int>($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 2, TimeSpan.FromMinutes(30));
|
_provider.Set<int>($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 2, TimeSpan.FromMinutes(30));
|
||||||
|
@ -364,7 +360,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
Code = currentMaxCodeInt + 1,
|
Code = currentMaxCodeInt + 1,
|
||||||
SouceReadModuleId = item.ReadModuleId,
|
SouceReadModuleId = item.ReadModuleId,
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
||||||
ReadingCategory = ReadingCategory.ReadingPeriod
|
ReadingCategory = item.ReadingCategory
|
||||||
});
|
});
|
||||||
|
|
||||||
singleTask.AllocateTime = DateTime.Now;
|
singleTask.AllocateTime = DateTime.Now;
|
||||||
|
@ -373,73 +369,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
_provider.Set<int>($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 1, TimeSpan.FromMinutes(30));
|
_provider.Set<int>($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 1, TimeSpan.FromMinutes(30));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (generateTaskCommand.ReadingCategory == ReadingCategory.Oncology)
|
|
||||||
{
|
|
||||||
if (trialConfig.ReadingType == ReadingMethod.Double)
|
|
||||||
{
|
|
||||||
foreach (var item in generateTaskCommand.ReadingGenerataTaskList)
|
|
||||||
{
|
|
||||||
//每个访视 根据项目配置生成任务 双审生成两个
|
|
||||||
var task1 = await _visitTaskRepository.AddAsync(new VisitTask()
|
|
||||||
{
|
|
||||||
TrialId = trialId,
|
|
||||||
SubjectId = item.SubjectId,
|
|
||||||
IsUrgent = item.IsUrgent,
|
|
||||||
TaskName = item.ReadingName,
|
|
||||||
ArmEnum = Arm.DoubleReadingArm1,//特殊
|
|
||||||
Code = currentMaxCodeInt + 1,
|
|
||||||
SouceReadModuleId = item.ReadModuleId,
|
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
|
||||||
ReadingCategory = ReadingCategory.Oncology
|
|
||||||
});
|
|
||||||
var task2 = await _visitTaskRepository.AddAsync(new VisitTask()
|
|
||||||
{
|
|
||||||
TrialId = trialId,
|
|
||||||
SubjectId = item.SubjectId,
|
|
||||||
IsUrgent = item.IsUrgent,
|
|
||||||
TaskName = item.ReadingName,
|
|
||||||
ArmEnum = Arm.DoubleReadingArm2,//特殊
|
|
||||||
Code = currentMaxCodeInt + 2,
|
|
||||||
SouceReadModuleId = item.ReadModuleId,
|
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)),
|
|
||||||
ReadingCategory = ReadingCategory.Oncology
|
|
||||||
});
|
|
||||||
currentMaxCodeInt = currentMaxCodeInt + 2;
|
|
||||||
_provider.Set<int>($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 2, TimeSpan.FromMinutes(30));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (var item in generateTaskCommand.ReadingGenerataTaskList)
|
|
||||||
{
|
|
||||||
var singleTask = await _visitTaskRepository.AddAsync(new VisitTask()
|
|
||||||
{
|
|
||||||
TrialId = trialId,
|
|
||||||
SubjectId = item.SubjectId,
|
|
||||||
IsUrgent = item.IsUrgent,
|
|
||||||
TaskName = item.ReadingName,
|
|
||||||
ArmEnum = Arm.SingleReadingArm, //特殊
|
|
||||||
Code = currentMaxCodeInt + 1,
|
|
||||||
SouceReadModuleId = item.ReadModuleId,
|
|
||||||
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
|
|
||||||
ReadingCategory = ReadingCategory.Oncology
|
|
||||||
});
|
|
||||||
|
|
||||||
singleTask.AllocateTime = DateTime.Now;
|
|
||||||
|
|
||||||
currentMaxCodeInt = currentMaxCodeInt + 1;
|
|
||||||
|
|
||||||
_provider.Set<int>($"{trialId }_{ StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt + 1, TimeSpan.FromMinutes(30));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue