diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index 9f6d3bcb2..7a3b3504d 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -28,6 +28,8 @@ using Aliyun.Acs.Core.Auth.Sts; using Aliyun.Acs.Core; using IRaCIS.Core.Application.Helper; using Microsoft.Extensions.Options; +using IRaCIS.Core.Application.Contracts; +using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO; namespace IRaCIS.Api.Controllers { @@ -54,6 +56,7 @@ namespace IRaCIS.Api.Controllers public async Task> GetDoctorDetail([FromServices] IAttachmentService attachmentService, [FromServices] IDoctorService _doctorService, [FromServices] IEducationService _educationService, [FromServices] ITrialExperienceService _trialExperienceService, + [FromServices] IResearchPublicationService _researchPublicationService, [FromServices] IVacationService _vacationService, Guid doctorId) { var education = await _educationService.GetEducation(doctorId); @@ -94,7 +97,10 @@ namespace IRaCIS.Api.Controllers [HttpPost, Route("user/login")] [AllowAnonymous] public async Task> Login(UserLoginDTO loginUser, [FromServices] IEasyCachingProvider provider, [FromServices] IUserService _userService, - [FromServices] ITokenService _tokenService, [FromServices] IConfiguration configuration) + [FromServices] ITokenService _tokenService, + + [FromServices] IReadingImageTaskService readingImageTaskService, + [FromServices] IConfiguration configuration) { @@ -180,8 +186,9 @@ namespace IRaCIS.Api.Controllers var userId = returnModel.Data.BasicInfo.Id.ToString(); //provider.Set(userId, userId, TimeSpan.FromMinutes(AppSettings.LoginExpiredTimeSpan)); - - await provider.SetAsync(userId.ToString(), returnModel.Data.JWTStr, TimeSpan.FromDays(7)); + // 验证阅片休息时间 + await readingImageTaskService.ResetReadingRestTime(returnModel.Data.BasicInfo.Id); + await provider.SetAsync(userId.ToString(), returnModel.Data.JWTStr, TimeSpan.FromDays(7)); return returnModel; } diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 5b5c02b0c..008e1add6 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -29,7 +29,7 @@ - + 系统用户登录接口[New] diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 163fe9223..5e287a9fd 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1968,6 +1968,19 @@ + + + 获取最低垂直径 + + + + + + 获取脾脏验证 + + + + 获取脾脏评估 @@ -13392,6 +13405,12 @@ + + + 重置阅片时间 登录和解锁调用 + + + 签名提交任务修改状态 diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index e24721232..259080a76 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -13,6 +13,8 @@ using static IRaCIS.Core.Domain.Share.StaticData; using IRaCIS.Core.Application.ViewModel; using Medallion.Threading; using EasyCaching.Core; +using IRaCIS.Core.Application.Contracts; +using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO; namespace IRaCIS.Application.Services { @@ -28,8 +30,8 @@ namespace IRaCIS.Application.Services private readonly IDistributedLockProvider _distributedLockProvider; private readonly IEasyCachingProvider _cache; - - private readonly IOptionsMonitor _verifyConfig; + private readonly IReadingImageTaskService _readingImageTaskService; + private readonly IOptionsMonitor _verifyConfig; public UserService(IRepository userRepository, @@ -38,7 +40,8 @@ namespace IRaCIS.Application.Services IRepository verificationCodeRepository, IRepository doctorRepository, IEasyCachingProvider cache, - IRepository userTrialRepository, + IReadingImageTaskService readingImageTaskService, + IRepository userTrialRepository, IOptionsMonitor verifyConfig, IRepository userLogRepository , @@ -48,7 +51,8 @@ namespace IRaCIS.Application.Services _verifyConfig = verifyConfig; _cache = cache; - _userRepository = userRepository; + this._readingImageTaskService = readingImageTaskService; + _userRepository = userRepository; _mailVerificationService = mailVerificationService; _verificationCodeRepository = verificationCodeRepository; _doctorRepository = doctorRepository; @@ -689,6 +693,8 @@ namespace IRaCIS.Application.Services // 登录 清除缓存 _cache.Remove(userLoginReturnModel.BasicInfo.Id.ToString()); + + return ResponseOutput.Ok(userLoginReturnModel); } diff --git a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs index 6cba1b928..5ad43cb66 100644 --- a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs @@ -36,5 +36,8 @@ namespace IRaCIS.Core.Application.Contracts Task AddOncologyTask(Guid oncologModuleId); Task> GetManualList(GetManualListInDto inDto); - } + + Task ResetReadingRestTime(Guid? userId); + + } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index b8fcd4d37..51774b859 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2573,62 +2573,92 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task VerifyReadingRestTime() { - var cacheKey = _userInfo.Id.ToString()+ "RestTime"; + var startReadingTimeKey = _userInfo.Id.ToString()+ "StartReadingTime"; + var startRestTimeKey = _userInfo.Id.ToString() + "StartRestTime"; - - var value = _provider.Get(cacheKey).Value; - if (value == null) + int readingMinute = 120; // 为60整数 + int restMinute = 10; // + + var startReadingTime = _provider.Get(startReadingTimeKey).Value; + var startRestTime = _provider.Get(startReadingTimeKey).Value; + if (startReadingTime == null && startRestTime == null) { - _provider.Set(cacheKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(5)); - // _cache.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5)); - + _provider.Set(startReadingTimeKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); } - else + else if (startRestTimeKey != null) { + var cacheStartRestTime = DateTime.Parse(startRestTime!.ToString()); + int timespanMin = (DateTime.Now - cacheStartRestTime).Minutes; + if (timespanMin <= restMinute) + { + throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", readingMinute/60, restMinute]); + } + else + { + // 休息时间>10分钟 删除休息时间的缓存 记录开始阅片时间 + _provider.Remove(startRestTimeKey); + _provider.Set(startReadingTimeKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + } + + } + // 如果开始阅片时间 不为空 + else if (startReadingTime != null) + { #region 两小时 - var cacheDate = DateTime.Parse(value.ToString()); + var cacheDate = DateTime.Parse(startReadingTime!.ToString()); int timespanMin = (DateTime.Now - cacheDate).Minutes; - if (timespanMin > 120 && timespanMin < 130) + if (timespanMin > readingMinute) { - throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", 2, 10]); + + _provider.Remove(startReadingTimeKey); + _provider.Set(startRestTimeKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", readingMinute / 60, restMinute]); } - else if (timespanMin > 130) - { - cacheDate = cacheDate.AddMinutes((Math.Floor((double)(timespanMin / 130))) * 130); - _provider.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5)); - // _cache.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5)); - } #endregion - - #region 测试用的5分钟 - //var cacheDate = DateTime.Parse(value.ToString()); - //int timespanMin = (DateTime.Now - cacheDate).Minutes; - //if (timespanMin >= 5 && timespanMin <= 10) - //{ - // throw new BusinessValidationFailedException("您已连续阅片2个小时,请休息20分钟后,再继续阅片。"); - //} - //else if (timespanMin > 10) - //{ - // cacheDate = cacheDate.AddMinutes((Math.Floor((double)(timespanMin / 10))) * 10); - // _provider.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5)); - - //} - #endregion - - } - - - } /// - /// 签名提交任务修改状态 + /// 重置阅片时间 登录和解锁调用 /// - /// /// - private async Task SubmitTaskChangeState(Guid visitTaskId) + [HttpPost] + public async Task ResetReadingRestTime(Guid? userID) + { + if(userID == null) + { + userID = _userInfo.Id; + } + + var startReadingTimeKey = userID.ToString() + "StartReadingTime"; + var startRestTimeKey = userID.ToString() + "StartRestTime"; + //int readingMinute = 120; // 为60整数 + int restMinute = 10; // + + var startReadingTime = _provider.Get(startReadingTimeKey).Value; + var startRestTime = _provider.Get(startReadingTimeKey).Value; + if (startRestTime != null) + { + var cacheStartRestTime = DateTime.Parse(startRestTime!.ToString()); + int timespanMin = (DateTime.Now - cacheStartRestTime).Minutes; + if (timespanMin > restMinute) + { + _provider.Remove(startRestTimeKey); + } + } + else if (startReadingTime != null) + { + _provider.Set(startReadingTimeKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48)); + } + } + + /// + /// 签名提交任务修改状态 + /// + /// + /// + private async Task SubmitTaskChangeState(Guid visitTaskId) { await VerifyTaskIsSign(visitTaskId); await _visitTaskRepository.UpdatePartialFromQueryAsync(visitTaskId, x => new VisitTask() diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 0bd350aaf..1b9696b62 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -1822,8 +1822,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate result = SpleenAssessment.Normal; } //1、基线期 状态为“肿大” - //与基线相比脾肿大增加的百分比 < 50% - else if (baseLineState.EqEnum(SpleenAssessment.Swelling) && percentage < 50) + //与基线相比脾肿大增加的百分比 < -50% + else if (baseLineState.EqEnum(SpleenAssessment.Swelling) && percentage < -50) { result = SpleenAssessment.Remission; }