定时任务
This commit is contained in:
+145
-63
@@ -15,6 +15,8 @@ using Newtonsoft.Json.Linq;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using Quartz;
|
||||
using IRaCIS.Application.Services.BackGroundJob;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
@@ -57,7 +59,7 @@ namespace IRaCIS.Application.Services
|
||||
private readonly IRepository<ReadingQuestionSystem> _readingQuestionSystem;
|
||||
private readonly IRepository<NoneDicomStudyFile> _noneDicomStudyFileSystem;
|
||||
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
||||
|
||||
private readonly IScheduler _scheduler;
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly ITrialEmailNoticeConfigService _trialEmailNoticeConfigService;
|
||||
|
||||
@@ -97,9 +99,11 @@ namespace IRaCIS.Application.Services
|
||||
IRepository<ReadingQuestionSystem> ReadingQuestionSystem,
|
||||
ITrialEmailNoticeConfigService trialEmailNoticeConfigService,
|
||||
IRepository<NoneDicomStudyFile> noneDicomStudyFileSystem,
|
||||
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository
|
||||
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
|
||||
IScheduler scheduler
|
||||
)
|
||||
{
|
||||
_scheduler = scheduler;
|
||||
base._mapper = mapper;
|
||||
this._noneDicomStudyRepository = noneDicomStudyRepository;
|
||||
this._visitTaskRepository = visitTaskRepository;
|
||||
@@ -159,9 +163,9 @@ namespace IRaCIS.Application.Services
|
||||
return await _trialDocumentRepository.Where(x => x.TrialId == inDto.TrialId
|
||||
&& x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.Id && y.ConfirmTime != null)
|
||||
&& x.NeedConfirmedUserTypeList.Any(y => y.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.WhereIf(userType== UserTypeEnum.IndependentReviewer, t => t.FileType.Code == "2" || t.FileType.Code == "6")
|
||||
.WhereIf(userType == UserTypeEnum.IndependentReviewer, t => t.FileType.Code == "2" || t.FileType.Code == "6")
|
||||
.WhereIf(userType == UserTypeEnum.IQC, t => t.FileType.Code == "4" || t.FileType.Code == "5")
|
||||
.WhereIf(!canViewUserType.Contains(userType),t=>false)
|
||||
.WhereIf(!canViewUserType.Contains(userType), t => false)
|
||||
.IgnoreQueryFilters()
|
||||
.Select(x => new GetManualListOutDto()
|
||||
{
|
||||
@@ -490,8 +494,8 @@ namespace IRaCIS.Application.Services
|
||||
VisitTaskNum = x.VisitTaskNum,
|
||||
IsBaseLineTask = x.SourceSubjectVisitId == baselineVisitId,
|
||||
IsCurrentTask = x.Id == inDto.VisitTaskId,
|
||||
IsConvertedTask=x.IsConvertedTask,
|
||||
IsFirstChangeTask=x.BeforeConvertedTaskId!=null,
|
||||
IsConvertedTask = x.IsConvertedTask,
|
||||
IsFirstChangeTask = x.BeforeConvertedTaskId != null,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
@@ -627,9 +631,9 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
if (await _visitTaskRepository.AnyAsync(x => x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
&&x.IsAnalysisCreate&&taskInfo.IsAnalysisCreate
|
||||
&&x.SubjectId== taskInfo.SubjectId&&x.TaskState==TaskState.Effect&&
|
||||
((x.ReReadingApplyState==ReReadingApplyState.DocotorHaveApplyed && x.DoctorUserId == taskInfo.DoctorUserId)|| x.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed)
|
||||
&& x.IsAnalysisCreate && taskInfo.IsAnalysisCreate
|
||||
&& x.SubjectId == taskInfo.SubjectId && x.TaskState == TaskState.Effect &&
|
||||
((x.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed && x.DoctorUserId == taskInfo.DoctorUserId) || x.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed)
|
||||
|
||||
))
|
||||
{
|
||||
@@ -708,7 +712,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
questions.ForEach(x =>
|
||||
{
|
||||
x.IsFirstChangeTask =true;
|
||||
x.IsFirstChangeTask = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -786,7 +790,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
||||
|
||||
if (taskInfo.IsConvertedTask &&taskInfo.BeforeConvertedTaskId!=null)
|
||||
if (taskInfo.IsConvertedTask && taskInfo.BeforeConvertedTaskId != null)
|
||||
{
|
||||
result.ForEach(x =>
|
||||
{
|
||||
@@ -960,7 +964,7 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
|
||||
if (inDto.TaskId != null )
|
||||
if (inDto.TaskId != null)
|
||||
{
|
||||
if (taskInfo.IsConvertedTask)
|
||||
{
|
||||
@@ -968,9 +972,9 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
qusetionList = qusetionList.Where(x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.BeforeShow).OrderBy(x => x.ShowOrder).ToList();
|
||||
}
|
||||
|
||||
qusetionList = qusetionList.Where(x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.BeforeShow).OrderBy(x => x.ShowOrder).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var usedGuropIds = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupId).ToList();
|
||||
@@ -1031,18 +1035,18 @@ namespace IRaCIS.Application.Services
|
||||
&& x.VisitTaskNum < taskInfo.VisitTaskNum
|
||||
&& x.ArmEnum == taskInfo.ArmEnum
|
||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit)||x.Id==taskInfo.BeforeConvertedTaskId
|
||||
).OrderByDescending(x=>x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
&& x.ReadingCategory == ReadingCategory.Visit) || x.Id == taskInfo.BeforeConvertedTaskId
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
if (!criterionInfo.IsReadingTaskViewInOrder)
|
||||
{
|
||||
// 无序的话 不要查
|
||||
laskTaskId = Guid.NewGuid();
|
||||
}
|
||||
|
||||
lastTaskTableAnswer= await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == laskTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
|
||||
lastTaskTableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == laskTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
|
||||
|
||||
|
||||
if (taskInfo.BeforeConvertedTaskId!=null )
|
||||
if (taskInfo.BeforeConvertedTaskId != null)
|
||||
{
|
||||
isFirstChangeTask = true;
|
||||
|
||||
@@ -1104,7 +1108,7 @@ namespace IRaCIS.Application.Services
|
||||
/// <param name="item"></param>
|
||||
/// <param name="questionlists"></param>
|
||||
/// <param name="tableQuestionLists"></param>
|
||||
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer,bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer,Guid? TaskId)
|
||||
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer, bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer, Guid? TaskId)
|
||||
{
|
||||
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (x.GroupId == item.Id && x.ParentId == null)).ToList();
|
||||
item.TableQuestions = new TrialReadTableQuestion();
|
||||
@@ -1230,7 +1234,7 @@ namespace IRaCIS.Application.Services
|
||||
});
|
||||
|
||||
|
||||
answers.Add("LesionType", rowInfo.LesionType.GetEnumNullInt());
|
||||
answers.Add("LesionType", rowInfo.LesionType.GetEnumNullInt());
|
||||
answers.Add("BlindName", rowInfo.BlindName);
|
||||
answers.Add("IsFirstChangeTask", isFirstChangeTask.ToString());
|
||||
answers.Add("FromMark", rowInfo.FromMark);
|
||||
@@ -1238,20 +1242,20 @@ namespace IRaCIS.Application.Services
|
||||
answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData);
|
||||
answers.Add("RowIndex", x.ToString());
|
||||
answers.Add("RowId", rowInfo.Id.ToString());
|
||||
answers.Add("MarkTool", rowInfo.MarkTool);
|
||||
answers.Add("StudyId", rowInfo.StudyId.ToString());
|
||||
answers.Add("MarkTool", rowInfo.MarkTool);
|
||||
answers.Add("StudyId", rowInfo.StudyId.ToString());
|
||||
answers.Add("OrganInfoId", rowInfo.OrganInfoId.ToString());
|
||||
answers.Add("IsFristAdd", (rowInfo.FristAddTaskId== TaskId).ToString());
|
||||
answers.Add("IsCanEditPosition", rowInfo.IsCanEditPosition.ToString());
|
||||
answers.Add("IsFristAdd", (rowInfo.FristAddTaskId == TaskId).ToString());
|
||||
answers.Add("IsCanEditPosition", rowInfo.IsCanEditPosition.ToString());
|
||||
answers.Add("InstanceId", rowInfo == null ? string.Empty : rowInfo.InstanceId.ToString());
|
||||
answers.Add("SeriesId", rowInfo == null ? string.Empty : rowInfo.SeriesId.ToString());
|
||||
answers.Add("IsCurrentTaskAdd", rowInfo == null ? false.ToString() : rowInfo.IsCurrentTaskAdd.ToString());
|
||||
answers.Add("SplitOrMergeLesionName", rowInfo.SplitName.IsNullOrEmpty() ? rowInfo.MergeName : rowInfo.SplitName);
|
||||
answers.Add("SplitOrMergeType", rowInfo.SplitOrMergeType == null ? string.Empty : ((int)rowInfo.SplitOrMergeType).ToString());
|
||||
answers.Add("LastTaskState", lastTaskTableAnswer.Where(n=>n.QuestionId== item.Id&&n.ReadingTableQuestionTrial.QuestionMark==QuestionMark.State&&n.RowIndex==x).Select(n=>n.Answer).FirstOrDefault()??string.Empty);
|
||||
answers.Add("LastTaskMajorAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
|
||||
answers.Add("LastTaskShortAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
|
||||
if (rowInfo.LesionType == LesionType.BaselineLesions)
|
||||
answers.Add("LastTaskState", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
|
||||
answers.Add("LastTaskMajorAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
|
||||
answers.Add("LastTaskShortAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
|
||||
if (rowInfo.LesionType == LesionType.BaselineLesions)
|
||||
{
|
||||
answers.Add("BaseLineLesionNumber", baseLineTableAnswer.Where(n => n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && n.RowIndex == rowInfo.RowIndex).Select(x => x.Answer).FirstIsNullReturnEmpty());
|
||||
}
|
||||
@@ -1436,10 +1440,11 @@ namespace IRaCIS.Application.Services
|
||||
if (tumorAnswer != null)
|
||||
{
|
||||
var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.IsConvertedTask).FirstOrDefaultAsync();
|
||||
var reportVerify = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto() {
|
||||
BeforeConvertedTaskId= taskInfo.BeforeConvertedTaskId,
|
||||
IsConvertTask= isConvertedTask,
|
||||
VisitTaskId=inDto.VisitTaskId
|
||||
var reportVerify = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto()
|
||||
{
|
||||
BeforeConvertedTaskId = taskInfo.BeforeConvertedTaskId,
|
||||
IsConvertTask = isConvertedTask,
|
||||
VisitTaskId = inDto.VisitTaskId
|
||||
});
|
||||
|
||||
if (tumorAnswer.Answer == reportVerify.TumorEvaluate)
|
||||
@@ -1619,7 +1624,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
// 自动计算
|
||||
await this._readingCalculateService.CalculateTask(new CalculateTaskInDto()
|
||||
{
|
||||
@@ -1997,7 +2002,7 @@ namespace IRaCIS.Application.Services
|
||||
StudyId = rowInfo.StudyId,
|
||||
IsCanEditPosition = rowInfo.IsCanEditPosition,
|
||||
ReportMark = rowInfo.ReportMark
|
||||
}) ;
|
||||
});
|
||||
|
||||
|
||||
foreach (var item in inDto.AnswerList)
|
||||
@@ -2159,13 +2164,13 @@ namespace IRaCIS.Application.Services
|
||||
return ResponseOutput.Ok(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 验证访视提交
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
/// 验证访视提交
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||
{
|
||||
@@ -2174,9 +2179,9 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
// 转化后的任务不应该有新病灶
|
||||
|
||||
var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x=>x.IsConvertedTask).FirstNotNullAsync();
|
||||
var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
|
||||
|
||||
if (isConvertedTask&&(await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.ReadingQuestionTrial.LesionType == LesionType.NewLesions && x.VisitTaskId == inDto.VisitTaskId)))
|
||||
if (isConvertedTask && (await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.ReadingQuestionTrial.LesionType == LesionType.NewLesions && x.VisitTaskId == inDto.VisitTaskId)))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_NotNewFocus"]);
|
||||
}
|
||||
@@ -2266,6 +2271,7 @@ namespace IRaCIS.Application.Services
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_IDMust"]);
|
||||
}
|
||||
|
||||
//看已阅的任务
|
||||
if (inDto.VisitTaskId != null)
|
||||
{
|
||||
task = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => new GetReadingTaskDto()
|
||||
@@ -2327,25 +2333,37 @@ namespace IRaCIS.Application.Services
|
||||
}).FirstOrDefault();
|
||||
|
||||
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
// 有序 自动领取该Subject
|
||||
await ClaimOrCancelSubjectAsync(new ClaimSubjectDto() { IsClaim = true, SubejctId = task.SubjectId, IsInOrder = true }, _scheduler);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
task = await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id
|
||||
//无序取数据
|
||||
task = await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned /*&& x.DoctorUserId == _userInfo.Id*/
|
||||
&& x.TrialReadingCriterionId == trialReadingCriterionId
|
||||
&& x.TaskState == TaskState.Effect).Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
ArmEnum = x.ArmEnum,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.VisitTaskNum,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectCode = x.Subject.Code,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).FirstOrDefaultAsync();
|
||||
&& x.TaskState == TaskState.Effect)
|
||||
.Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign)
|
||||
.Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
ArmEnum = x.ArmEnum,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.VisitTaskNum,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectCode = x.Subject.Code,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync();
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
// 有序 自动领取该Subject
|
||||
await ClaimOrCancelSubjectAsync(new ClaimSubjectDto() { IsClaim = true, VisitTaskId = task.VisitTaskId, IsInOrder = false }, _scheduler);
|
||||
}
|
||||
}
|
||||
|
||||
if (task == null)
|
||||
@@ -2420,7 +2438,7 @@ namespace IRaCIS.Application.Services
|
||||
task.SubjectCode = blindSubjectCode.IsNullOrEmpty() ? task.SubjectCode : blindSubjectCode;
|
||||
task.ExistsManual = (await GetManualList(new GetManualListInDto() { TrialId = visitTaskInfo.TrialId })).Count() > 0;
|
||||
task.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
return task;
|
||||
return task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2474,6 +2492,70 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task ClaimOrCancelSubjectAsync(ClaimSubjectDto claimSubjectDto, IScheduler _scheduler)
|
||||
{
|
||||
if (claimSubjectDto.IsInOrder)
|
||||
{
|
||||
if (claimSubjectDto.IsClaim)
|
||||
{
|
||||
await _subjectRepository.UpdatePartialFromQueryAsync(t => t.Id == claimSubjectDto.SubejctId, u => new Subject() { ClaimUserId = _userInfo.Id }, true);
|
||||
|
||||
//定时任务24h取消
|
||||
|
||||
// 创建一个任务
|
||||
IJobDetail job = JobBuilder.Create<CancelTaskQuartZJob>()
|
||||
.WithIdentity($"CancelTaskQuartZJob_{_userInfo.Id}", "group")
|
||||
.UsingJobData("SubjectId", claimSubjectDto.SubejctId) // 传递GUID参数给任务
|
||||
.UsingJobData("IsInOrder", claimSubjectDto.IsInOrder)
|
||||
.Build();
|
||||
|
||||
// 创建一个触发器,设置任务执行时间为24小时后
|
||||
ITrigger trigger = TriggerBuilder.Create()
|
||||
.WithIdentity("CancelTaskQuartZJob", "group1")
|
||||
.StartAt(DateTimeOffset.UtcNow.AddHours(24))
|
||||
.Build();
|
||||
|
||||
// 将任务和触发器关联起来,将任务安排到调度器中
|
||||
await _scheduler.ScheduleJob(job, trigger);
|
||||
|
||||
//BackgroundJob.Schedule<IObtainTaskAutoCancelJob>(t => t.CancelQCObtaion(subjectVisitId, DateTime.Now), TimeSpan.FromHours(1));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
await _subjectRepository.UpdatePartialFromQueryAsync(t => t.Id == claimSubjectDto.SubejctId, u => new Subject() { ClaimUserId = null }, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (claimSubjectDto.IsClaim)
|
||||
{
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == claimSubjectDto.VisitTaskId, u => new VisitTask() { ClaimUserId = _userInfo.Id }, true);
|
||||
|
||||
IJobDetail job = JobBuilder.Create<CancelTaskQuartZJob>()
|
||||
.WithIdentity($"CancelTaskQuartZJob_{_userInfo.Id}", "group")
|
||||
.UsingJobData("VisitTaskId",(Guid) claimSubjectDto.VisitTaskId) // 传递GUID参数给任务
|
||||
.UsingJobData("IsInOrder", claimSubjectDto.IsInOrder).Build();
|
||||
|
||||
// 创建一个触发器,设置任务执行时间为24小时后
|
||||
ITrigger trigger = TriggerBuilder.Create()
|
||||
.WithIdentity($"CancelTaskQuartZJob_{_userInfo.Id}", "group")
|
||||
.StartAt(DateTimeOffset.UtcNow.AddHours(24))
|
||||
.Build();
|
||||
|
||||
// 将任务和触发器关联起来,将任务安排到调度器中
|
||||
await _scheduler.ScheduleJob(job, trigger);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2494,9 +2576,9 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
bool isConverted = false;
|
||||
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
|
||||
var isConvertedTask=await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x=>x.IsConvertedTask).FirstNotNullAsync();
|
||||
var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
|
||||
switch (taskinfo.TrialReadingCriterion.CriterionType)
|
||||
{
|
||||
case CriterionType.IRECIST1Point1:
|
||||
@@ -2505,7 +2587,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (!isConvertedTask &&
|
||||
(await _readingTaskQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId
|
||||
&& x.ReadingQuestionTrial.QuestionType == QuestionType.Tumor && x.Answer==(((int)OverallAssessment.PD)).ToString()))
|
||||
&& x.ReadingQuestionTrial.QuestionType == QuestionType.Tumor && x.Answer == (((int)OverallAssessment.PD)).ToString()))
|
||||
)
|
||||
{
|
||||
|
||||
@@ -2539,7 +2621,7 @@ namespace IRaCIS.Application.Services
|
||||
await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(visitTaskId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2583,7 +2665,7 @@ namespace IRaCIS.Application.Services
|
||||
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
|
||||
x.ReadingCategory == taskInfo.ReadingCategory &&
|
||||
x.Id != taskInfo.Id
|
||||
).OrderBy(x=>x.VisitTaskNum).ThenBy(x=>x.TaskState).Select(x => x.Id).ToListAsync();
|
||||
).OrderBy(x => x.VisitTaskNum).ThenBy(x => x.TaskState).Select(x => x.Id).ToListAsync();
|
||||
|
||||
|
||||
reportRelatedTaskIdList = await _visitTaskRepository.Where(x =>
|
||||
@@ -2594,7 +2676,7 @@ namespace IRaCIS.Application.Services
|
||||
x.DoctorUserId == taskInfo.DoctorUserId &&
|
||||
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
|
||||
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
||||
(x.TaskState == TaskState.Effect||x.TaskState==TaskState.Freeze) &&
|
||||
(x.TaskState == TaskState.Effect || x.TaskState == TaskState.Freeze) &&
|
||||
x.IsSelfAnalysis == taskInfo.IsSelfAnalysis &&
|
||||
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
|
||||
x.ReadingCategory == taskInfo.ReadingCategory &&
|
||||
|
||||
Reference in New Issue
Block a user