Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-01-12 10:23:45 +08:00
commit 6865c7f4a1
7 changed files with 116 additions and 51 deletions

View File

@ -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<IResponseOutput<DoctorDetailDTO>> 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<IResponseOutput<LoginReturnDTO>> 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;
}

View File

@ -29,7 +29,7 @@
<param name="doctorId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,EasyCaching.Core.IEasyCachingProvider,IRaCIS.Application.Services.IUserService,IRaCIS.Core.Application.Auth.ITokenService,Microsoft.Extensions.Configuration.IConfiguration)">
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,EasyCaching.Core.IEasyCachingProvider,IRaCIS.Application.Services.IUserService,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Application.Contracts.IReadingImageTaskService,Microsoft.Extensions.Configuration.IConfiguration)">
<summary> 系统用户登录接口[New] </summary>
</member>
<member name="M:IRaCIS.Core.API.Controllers.Special.FinancialChangeController.AddOrUpdateTrialInspection(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Application.Contracts.TrialCommand})">

View File

@ -1968,6 +1968,19 @@
<param name="spleenLength"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.LuganoCalculateService.GetLowSpleenLength(IRaCIS.Core.Domain.Models.VisitTask)">
<summary>
获取最低垂直径
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.LuganoCalculateService.GetSplenicVerify(System.Guid)">
<summary>
获取脾脏验证
</summary>
<param name="visitTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.LuganoCalculateService.GetSplenicEvaluation(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
获取脾脏评估
@ -13392,6 +13405,12 @@
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.ResetReadingRestTime(System.Nullable{System.Guid})">
<summary>
重置阅片时间 登录和解锁调用
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.SubmitTaskChangeState(System.Guid)">
<summary>
签名提交任务修改状态

View File

@ -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<ServiceVerifyConfigOption> _verifyConfig;
private readonly IReadingImageTaskService _readingImageTaskService;
private readonly IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig;
public UserService(IRepository<User> userRepository,
@ -38,7 +40,8 @@ namespace IRaCIS.Application.Services
IRepository<VerificationCode> verificationCodeRepository,
IRepository<Doctor> doctorRepository,
IEasyCachingProvider cache,
IRepository<TrialUser> userTrialRepository,
IReadingImageTaskService readingImageTaskService,
IRepository<TrialUser> userTrialRepository,
IOptionsMonitor<ServiceVerifyConfigOption> verifyConfig,
IRepository<UserLog> 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);
}

View File

@ -36,5 +36,8 @@ namespace IRaCIS.Core.Application.Contracts
Task AddOncologyTask(Guid oncologModuleId);
Task<List<GetManualListOutDto>> GetManualList(GetManualListInDto inDto);
}
Task ResetReadingRestTime(Guid? userId);
}
}

View File

@ -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<string>(cacheKey).Value;
if (value == null)
int readingMinute = 120; // 为60整数
int restMinute = 10; //
var startReadingTime = _provider.Get<string>(startReadingTimeKey).Value;
var startRestTime = _provider.Get<string>(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
}
}
/// <summary>
/// 签名提交任务修改状态
/// 重置阅片时间 登录和解锁调用
/// </summary>
/// <param name="visitTaskId"></param>
/// <returns></returns>
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<string>(startReadingTimeKey).Value;
var startRestTime = _provider.Get<string>(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));
}
}
/// <summary>
/// 签名提交任务修改状态
/// </summary>
/// <param name="visitTaskId"></param>
/// <returns></returns>
private async Task SubmitTaskChangeState(Guid visitTaskId)
{
await VerifyTaskIsSign(visitTaskId);
await _visitTaskRepository.UpdatePartialFromQueryAsync(visitTaskId, x => new VisitTask()

View File

@ -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;
}