随机阅片NextTask-4
parent
c49a74d742
commit
180b02b28c
|
@ -3117,17 +3117,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
&& x.TrialReadingCriterionId == trialReadingCriterionId
|
&& x.TrialReadingCriterionId == trialReadingCriterionId
|
||||||
&& x.TaskState == TaskState.Effect)
|
&& x.TaskState == TaskState.Effect)
|
||||||
.Where(x => !cacheSkipIds.Contains(x.Id));
|
.Where(x => !cacheSkipIds.Contains(x.Id));
|
||||||
var count = await query.CountAsync();
|
|
||||||
if (count == 0)
|
//如果是随机阅片
|
||||||
{
|
|
||||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
|
|
||||||
}
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
var skipcount = 0;
|
var skipcount = 0;
|
||||||
if (count >= 2)
|
|
||||||
{
|
|
||||||
skipcount = random.Next(0, count - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
var maxReadingTime = query.MaxOrDefault(x => x.FirstReadingTime);
|
var maxReadingTime = query.MaxOrDefault(x => x.FirstReadingTime);
|
||||||
if (maxReadingTime != null)
|
if (maxReadingTime != null)
|
||||||
|
@ -3135,6 +3129,29 @@ namespace IRaCIS.Core.Application.Service
|
||||||
query = query.Where(x => x.FirstReadingTime == maxReadingTime);
|
query = query.Where(x => x.FirstReadingTime == maxReadingTime);
|
||||||
skipcount = 0;
|
skipcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var minRandomOrder = query.Where(t => t.RandomOrder != null).Select(t => t.RandomOrder).MinOrDefault();
|
||||||
|
|
||||||
|
//阅片中的可能没序号,以阅片中优先先给IR
|
||||||
|
if (minRandomOrder != null && maxReadingTime == null)
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.RandomOrder == minRandomOrder);
|
||||||
|
skipcount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var count = await query.CountAsync();
|
||||||
|
if (count >= 2)
|
||||||
|
{
|
||||||
|
skipcount = random.Next(0, count - 1);
|
||||||
|
}
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
task = await query
|
task = await query
|
||||||
.Select(x => new GetReadingTaskDto()
|
.Select(x => new GetReadingTaskDto()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue