diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 2c055e3b5..339499d90 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -705,7 +705,7 @@ namespace IRaCIS.Core.Application.Service case GenerateTaskCategory.Judge: var firstTask = await _visitTaskRepository.Where(x => generateTaskCommand.JudgeVisitTaskIdList.Contains(x.Id)).FirstOrDefaultAsync(); - var subjectUser = await _subjectUserRepository.Where(x => x.SubjectId == firstTask.SubjectId && x.ArmEnum == Arm.JudgeArm).FirstOrDefaultAsync(); + var subjectUser = await _subjectUserRepository.Where(x => x.SubjectId == firstTask.SubjectId && x.ArmEnum == Arm.JudgeArm && x.IsConfirmed).FirstOrDefaultAsync(); VisitTask visitTask = new VisitTask() { @@ -726,6 +726,7 @@ namespace IRaCIS.Core.Application.Service DoctorUserId = subjectUser == null ? null : subjectUser.DoctorUserId, TaskAllocationState = subjectUser == null ? TaskAllocationState.NotAllocate : TaskAllocationState.Allocated, AllocateTime = subjectUser == null ? null : DateTime.Now, + SuggesteFinishedTime = subjectUser == null ? null : DateTime.Now.AddDays(7), }; @@ -768,6 +769,7 @@ namespace IRaCIS.Core.Application.Service DoctorUserId = originalTaskInfo.DoctorUserId, AllocateTime = DateTime.Now, TaskAllocationState = TaskAllocationState.Allocated, + SuggesteFinishedTime = DateTime.Now.AddDays(7), Code = currentMaxCodeInt + 1, TaskBlindName = item.ReadingName, @@ -781,8 +783,12 @@ namespace IRaCIS.Core.Application.Service } break; case GenerateTaskCategory.Oncology: + + + foreach (var item in generateTaskCommand.ReadingGenerataTaskList) { + var oncologySubjectUser = await _subjectUserRepository.Where(x => x.SubjectId == item.SubjectId && x.ArmEnum == Arm.TumorArm && x.IsConfirmed).FirstOrDefaultAsync(); var singleTask = await _visitTaskRepository.AddAsync(new VisitTask() { TrialId = trialId, @@ -794,6 +800,12 @@ namespace IRaCIS.Core.Application.Service Code = currentMaxCodeInt + 1, SouceReadModuleId = item.ReadModuleId, TaskBlindName = item.ReadingName, + + DoctorUserId = oncologySubjectUser == null ? null : oncologySubjectUser.DoctorUserId, + AllocateTime = oncologySubjectUser == null ? null : DateTime.Now, + TaskAllocationState = oncologySubjectUser == null ? TaskAllocationState.NotAllocate : TaskAllocationState.Allocated, + SuggesteFinishedTime = oncologySubjectUser == null ? null : DateTime.Now.AddDays(7), + TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), ReadingCategory = item.ReadingCategory diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs index 65c55e024..8211ebe75 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs @@ -187,11 +187,7 @@ namespace IRaCIS.Core.Application.Service medicalReviewInfo.QuestionAnswerList = await this.GetMedicalQuestionAnswer(inDto); - await _taskMedicalReviewRepository.BatchUpdateNoTrackingAsync(x=>x.Id== inDto.TaskMedicalReviewId&&x.AuditState!= MedicalReviewAuditState.HaveSigned, x => new TaskMedicalReview() - { - AuditState = MedicalReviewAuditState.Auditing, - }); - + var result = await _readingMedicineQuestionAnswerRepository.SaveChangesAsync(); return medicalReviewInfo; @@ -277,6 +273,14 @@ namespace IRaCIS.Core.Application.Service }); + + + await _taskMedicalReviewRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.TaskMedicalReviewId && x.AuditState != MedicalReviewAuditState.HaveSigned, x => new TaskMedicalReview() + { + AuditState = MedicalReviewAuditState.Auditing, + }); + + var result = await _readingMedicineQuestionAnswerRepository.SaveChangesAsync(); return ResponseOutput.Result(result);