Uat_Study
parent
ab6a965a90
commit
ebd2f08a2c
|
@ -154,6 +154,8 @@ namespace IRaCIS.Core.API
|
|||
|
||||
//services.AddSingleton<IImportResultFilter, ImportResultFilteTest>();
|
||||
|
||||
services.AddMemoryCache();
|
||||
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Panda.DynamicWebApi.Attributes;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
@ -19,19 +20,22 @@ namespace IRaCIS.Application.Services
|
|||
private readonly IRepository<Doctor> _doctorRepository;
|
||||
private readonly IRepository<TrialUser> _userTrialRepository;
|
||||
|
||||
private readonly IMemoryCache _cache;
|
||||
|
||||
private readonly IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig;
|
||||
public UserService(IRepository<User> userRepository,
|
||||
|
||||
IMailVerificationService mailVerificationService,
|
||||
IRepository<VerificationCode> verificationCodeRepository,
|
||||
IRepository<Doctor> doctorRepository,
|
||||
IMemoryCache cache,
|
||||
IRepository<TrialUser> userTrialRepository,
|
||||
IOptionsMonitor<ServiceVerifyConfigOption> verifyConfig
|
||||
|
||||
)
|
||||
{
|
||||
_verifyConfig = verifyConfig;
|
||||
|
||||
_cache = cache;
|
||||
_userRepository = userRepository;
|
||||
_mailVerificationService = mailVerificationService;
|
||||
_verificationCodeRepository = verificationCodeRepository;
|
||||
|
@ -610,7 +614,8 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
userLoginReturnModel.BasicInfo = loginDoctor;
|
||||
|
||||
|
||||
// 登录 清除缓存
|
||||
_cache.Remove(userLoginReturnModel.BasicInfo.Id.ToString());
|
||||
return ResponseOutput.Ok(userLoginReturnModel);
|
||||
|
||||
}
|
||||
|
@ -622,7 +627,8 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
userLoginReturnModel.BasicInfo = loginUser;
|
||||
|
||||
|
||||
// 登录 清除缓存
|
||||
_cache.Remove(userLoginReturnModel.BasicInfo.Id.ToString());
|
||||
return ResponseOutput.Ok(userLoginReturnModel);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ using IRaCIS.Core.Application.ViewModel;
|
|||
using IRaCIS.Core.Application.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
@ -49,6 +50,7 @@ namespace IRaCIS.Application.Services
|
|||
private readonly IRepository<NoneDicomStudyFile> _noneDicomStudyFileSystem;
|
||||
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
||||
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly ITrialEmailNoticeConfigService _trialEmailNoticeConfigService;
|
||||
|
||||
|
||||
|
@ -69,6 +71,7 @@ namespace IRaCIS.Application.Services
|
|||
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
|
||||
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
|
||||
IRepository<ReadModule> readModuleRepository,
|
||||
IMemoryCache cache,
|
||||
IRepository<ReadingCriterionDictionary> readingCriterionDictionaryRepository,
|
||||
IRepository<TumorAssessment> tumorAssessmentRepository,
|
||||
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
|
||||
|
@ -110,7 +113,7 @@ namespace IRaCIS.Application.Services
|
|||
this._readingQuestionSystem = ReadingQuestionSystem;
|
||||
this._noneDicomStudyFileSystem = noneDicomStudyFileSystem;
|
||||
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||
|
||||
this._cache = cache;
|
||||
this._trialEmailNoticeConfigService = trialEmailNoticeConfigService;
|
||||
}
|
||||
|
||||
|
@ -1189,6 +1192,11 @@ namespace IRaCIS.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<GetReadingTaskDto> GetNextTask(GetNextTaskInDto inDto)
|
||||
{
|
||||
if (inDto.VisitTaskId == null)
|
||||
{
|
||||
await VerifyReadingRestTime();
|
||||
}
|
||||
|
||||
GetReadingTaskDto? task = new GetReadingTaskDto();
|
||||
|
||||
var trialReadingCriterionId = inDto.TrialReadingCriterionId;
|
||||
|
@ -1318,7 +1326,55 @@ namespace IRaCIS.Application.Services
|
|||
return task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证阅片休息时间
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task VerifyReadingRestTime()
|
||||
{
|
||||
var cacheKey = _userInfo.Id.ToString();
|
||||
var value = _cache.Get(cacheKey);
|
||||
if (value == null)
|
||||
{
|
||||
_cache.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//var cacheDate = DateTime.Parse(value.ToString());
|
||||
//int timespanMin = (DateTime.Now - cacheDate).Minutes;
|
||||
//if (timespanMin > 120 && timespanMin < 140)
|
||||
//{
|
||||
// throw new BusinessValidationFailedException("您已连续阅片两个小时,请休息一会!");
|
||||
//}
|
||||
//else if (timespanMin > 140)
|
||||
//{
|
||||
// cacheDate = cacheDate.AddMinutes((Math.Floor((double)(timespanMin / 140)))*140);
|
||||
// _cache.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
|
||||
|
||||
//}
|
||||
|
||||
|
||||
var cacheDate = DateTime.Parse(value.ToString());
|
||||
int timespanMin = (DateTime.Now - cacheDate).Minutes;
|
||||
if (timespanMin > 5 && timespanMin < 10)
|
||||
{
|
||||
throw new BusinessValidationFailedException("您已连续阅片两个小时,请休息一会!");
|
||||
}
|
||||
else if (timespanMin > 10)
|
||||
{
|
||||
cacheDate = cacheDate.AddMinutes((Math.Floor((double)(timespanMin / 10))) * 10);
|
||||
_cache.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 签名提交任务修改状态
|
||||
|
|
Loading…
Reference in New Issue