跳过阅片修改
parent
baf8f39bc6
commit
9e8ab8acca
|
@ -1705,6 +1705,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
{
|
{
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SetSkipReadingCacheInDto
|
||||||
|
{
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
}
|
||||||
public class GetNextTaskInDto
|
public class GetNextTaskInDto
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ using AutoMapper.QueryableExtensions;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -2700,7 +2701,44 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.Ok(true);
|
return ResponseOutput.Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除跳过阅片的缓存
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<bool> ClearSkipReadingCache()
|
||||||
|
{
|
||||||
|
var clearSkipReadingCacheKey = _userInfo.Id.ToString() + "SkipReadingCache";
|
||||||
|
_provider.Remove(clearSkipReadingCacheKey);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置跳过阅片的缓存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<bool> SetSkipReadingCache(SetSkipReadingCacheInDto inDto )
|
||||||
|
{
|
||||||
|
var clearSkipReadingCacheKey = _userInfo.Id.ToString() + "SkipReadingCache";
|
||||||
|
var clearSkipReadingCache = _provider.Get<string>(clearSkipReadingCacheKey).Value;
|
||||||
|
if (clearSkipReadingCache == null|| clearSkipReadingCache==string.Empty)
|
||||||
|
{
|
||||||
|
List<Guid> cacheIds = new List<Guid>();
|
||||||
|
cacheIds.Add(inDto.VisitTaskId);
|
||||||
|
|
||||||
|
_provider.Set(clearSkipReadingCacheKey, JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<Guid>? cacheIds=JsonConvert.DeserializeObject<List<Guid>>(clearSkipReadingCache);
|
||||||
|
cacheIds.Add(inDto.VisitTaskId);
|
||||||
|
_provider.Set(clearSkipReadingCacheKey, JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2728,6 +2766,19 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var trialReadingCriterion = await _readingQuestionCriterionTrialRepository.FindAsync(trialReadingCriterionId ?? Guid.Empty);
|
var trialReadingCriterion = await _readingQuestionCriterionTrialRepository.FindAsync(trialReadingCriterionId ?? Guid.Empty);
|
||||||
|
|
||||||
|
|
||||||
|
#region 跳过阅片
|
||||||
|
var clearSkipReadingCacheKey = _userInfo.Id.ToString() + "SkipReadingCache";
|
||||||
|
var clearSkipReadingCache = _provider.Get<string>(clearSkipReadingCacheKey).Value;
|
||||||
|
List<Guid> cacheSkipIds = new List<Guid>();
|
||||||
|
if (clearSkipReadingCache != null && clearSkipReadingCache != string.Empty)
|
||||||
|
{
|
||||||
|
cacheSkipIds = JsonConvert.DeserializeObject<List<Guid>>(clearSkipReadingCache);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (inDto.VisitTaskId != null)
|
if (inDto.VisitTaskId != null)
|
||||||
{
|
{
|
||||||
task = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => new GetReadingTaskDto()
|
task = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => new GetReadingTaskDto()
|
||||||
|
@ -2746,6 +2797,7 @@ namespace IRaCIS.Application.Services
|
||||||
trialReadingCriterionId = task.TrialReadingCriterionId;
|
trialReadingCriterionId = task.TrialReadingCriterionId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 有序
|
||||||
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||||
{
|
{
|
||||||
var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
|
var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
|
||||||
|
@ -2766,14 +2818,22 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var subjectIndex = subjectTaskList.Where(x => x.SubjectId == inDto.SubjectId && x.SubjectCode == inDto.SubjectCode).Select(x => x.Index).FirstOrDefault();
|
var subjectIndex = subjectTaskList.Where(x => x.SubjectId == inDto.SubjectId && x.SubjectCode == inDto.SubjectCode).Select(x => x.Index).FirstOrDefault();
|
||||||
|
|
||||||
var currentSubject = subjectTaskList.Where(x => x.Index >= subjectIndex && !x.ExistReadingApply).OrderBy(x => x.Index).FirstOrDefault();
|
|
||||||
|
var currentSubject = subjectTaskList.Where(x => x.Index >= subjectIndex && !x.ExistReadingApply)
|
||||||
|
// 排除跳过的
|
||||||
|
.Where(x=> x.UnReadCanReadTaskList.Select(y => y.Id).Except(cacheSkipIds).Count()>0)
|
||||||
|
.OrderBy(x => x.Index).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
if (currentSubject == null)
|
if (currentSubject == null)
|
||||||
{
|
{
|
||||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
|
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
|
||||||
}
|
}
|
||||||
|
|
||||||
task = currentSubject.UnReadCanReadTaskList.Select(x => new GetReadingTaskDto()
|
task = currentSubject.UnReadCanReadTaskList
|
||||||
|
// 排除跳过的
|
||||||
|
.Where(x=> !cacheSkipIds.Contains(x.Id))
|
||||||
|
.Select(x => new GetReadingTaskDto()
|
||||||
{
|
{
|
||||||
ReadingCategory = x.ReadingCategory,
|
ReadingCategory = x.ReadingCategory,
|
||||||
SubjectCode = currentSubject.SubjectCode,
|
SubjectCode = currentSubject.SubjectCode,
|
||||||
|
@ -2789,8 +2849,12 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 受试者无序
|
||||||
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
|
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
|
var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
|
||||||
{
|
{
|
||||||
TrialId = inDto.TrialId,
|
TrialId = inDto.TrialId,
|
||||||
|
@ -2802,6 +2866,11 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
})).CurrentPageData;
|
})).CurrentPageData;
|
||||||
|
|
||||||
|
|
||||||
|
subjectTaskList = subjectTaskList
|
||||||
|
// 排除跳过的
|
||||||
|
.Where(x => x.UnReadCanReadTaskList.Select(y => y.Id).Except(cacheSkipIds).Count() > 0).ToList();
|
||||||
|
|
||||||
if (subjectTaskList.Count() == 0)
|
if (subjectTaskList.Count() == 0)
|
||||||
{
|
{
|
||||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
|
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
|
||||||
|
@ -2829,11 +2898,14 @@ namespace IRaCIS.Application.Services
|
||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 完全随机
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id
|
var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id
|
||||||
&& x.TrialReadingCriterionId == trialReadingCriterionId
|
&& x.TrialReadingCriterionId == trialReadingCriterionId
|
||||||
&& x.TaskState == TaskState.Effect);
|
&& x.TaskState == TaskState.Effect)
|
||||||
|
// 排除跳过的
|
||||||
|
.Where(x => !cacheSkipIds.Contains(x.Id));
|
||||||
var count = await query.CountAsync();
|
var count = await query.CountAsync();
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue