From 70039bcedfcd551a1432e926a56cf5d5cf9a36dc Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 14:02:42 +0800
Subject: [PATCH 01/15] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=8F=91=E9=80=81?=
=?UTF-8?q?=E9=82=AE=E4=BB=B6=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Helper/FileStoreHelper.cs | 20 ++
.../IRaCIS.Core.Application.xml | 20 +-
.../ITrialEmailNoticeConfigService.cs | 26 ++-
.../Document/TrialEmailNoticeConfigService.cs | 208 +++++++++++++-----
.../ReadingMedicalReviewService.cs | 2 +-
.../Common/EmailStoreMode.cs | 28 +++
6 files changed, 240 insertions(+), 64 deletions(-)
create mode 100644 IRaCIS.Core.Domain.Share/Common/EmailStoreMode.cs
diff --git a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs
index 0656f480..e64c16be 100644
--- a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs
+++ b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs
@@ -409,6 +409,26 @@ public static class FileStoreHelper
return (serverFilePath, relativePath, fileRealName);
}
+ // 获取 入组确认 PD 进展发送邮件Word|PDF 存放路径
+
+ public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid siteId, Guid subjectId)
+ {
+ var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
+
+ string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), siteId.ToString(), subjectId.ToString());
+
+ if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
+
+ var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName);
+
+
+ var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{trustedFileNameForFileStorage}";
+
+ var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
+
+ return (serverFilePath, relativePath, fileRealName);
+ }
+
public static string GetSubjectVisitDicomFolderPhysicalPath(IWebHostEnvironment _hostEnvironment,Guid trialId, Guid siteId, Guid subjectId, Guid subjectVisitId)
{
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 335c47f0..becbece6 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -602,14 +602,32 @@
-
+
测试邮件 带附件 填充word --前端不需要用
+
+
+
+
+
+ 手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
+
+
+
+
+
+
+ 手动发送邮件
+
+
+
+
+
选择人员下拉
diff --git a/IRaCIS.Core.Application/Service/Document/Interface/ITrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/Interface/ITrialEmailNoticeConfigService.cs
index 4fb10d3e..b30ba64f 100644
--- a/IRaCIS.Core.Application/Service/Document/Interface/ITrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/Interface/ITrialEmailNoticeConfigService.cs
@@ -6,23 +6,31 @@
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
+using IRaCIS.Core.Domain.Share.Common;
namespace IRaCIS.Core.Application.Interfaces
-{
+{
///
/// ITrialEmailNoticeConfigService
///
public interface ITrialEmailNoticeConfigService
- {
+ {
-
- Task> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery);
-
- Task AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig);
- Task DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId);
+ Task> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery);
- Task BaseBusinessScenarioSendEmailAsync( Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading = null);
+ Task AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig);
+
+ Task DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId);
+
+ Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading = null, EmailStoreSendMode emailStoreMode = EmailStoreSendMode.StoreLocalSend, string sendFileRelativePath="");
}
-}
+
+ public class EmailStoreSendDto
+ {
+ public EmailStoreSendMode EmailStoreSendMode { get; set; } = EmailStoreSendMode.StoreLocalSend;
+
+ public string SendFileRelativePath { get; set; }
+ }
+}
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 0ba787b5..f9f73a8b 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -17,6 +17,8 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Filter;
using MiniSoftware;
using IRaCIS.Core.Application.Service.Reading.Dto;
+using IRaCIS.Core.Domain.Share.Common;
+using System.IO;
namespace IRaCIS.Core.Application.Service
{
@@ -165,7 +167,7 @@ namespace IRaCIS.Core.Application.Service
- private async Task DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isMedicalReviewAndSuggestApplyReReading,string pdAnswer, List taskIdList, List minUserIdList)
+ private async Task DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isMedicalReviewAndSuggestApplyReReading, string pdAnswer, List taskIdList, List minUserIdList)
{
var isNeedSend = true;
@@ -177,7 +179,7 @@ namespace IRaCIS.Core.Application.Service
}
else
{
-
+ //正常阅片为否的
if (isMedicalReviewAndSuggestApplyReReading == null)
{
isNeedSend = false;
@@ -202,7 +204,7 @@ namespace IRaCIS.Core.Application.Service
}
-
+
return isNeedSend;
@@ -213,9 +215,11 @@ namespace IRaCIS.Core.Application.Service
///
///
///
+ ///
+ ///
///
///
- public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading)
+ public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading, EmailStoreSendMode emailStoreMode, string sendFileRelativePath)
{
CommonDocumentBusinessScenario? businessScenarioEnum = null;
@@ -292,7 +296,7 @@ namespace IRaCIS.Core.Application.Service
}
else
{
- return;
+ return string.Empty;
}
}
@@ -317,7 +321,7 @@ namespace IRaCIS.Core.Application.Service
{
//throw new BusinessValidationFailedException("找不到该项目标准场景下邮件的配置");
- return;
+ return string.Empty;
}
@@ -382,7 +386,6 @@ namespace IRaCIS.Core.Application.Service
}
#endregion
-
#region 确保 邮件Html存在
//邮件附件
@@ -403,6 +406,46 @@ namespace IRaCIS.Core.Application.Service
#endregion
+ #region 不同场景 Tile 设置
+
+ if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
+ {
+ sendEmailConfig.TopicDescription = $"【入组确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
+
+ using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
+ {
+ var templateInfo = SourceReader.ReadToEnd();
+
+
+ sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
+ $" 附件为入组确认报告,请查收 "
+ );
+ }
+ }
+ else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
+ {
+ sendEmailConfig.TopicDescription = $"【疾病进展确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
+
+ using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
+ {
+ var templateInfo = SourceReader.ReadToEnd();
+
+
+ sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
+ $" 附件为疾病进展确认报告,请查收 "
+ );
+ }
+ }
+ else
+ {
+ //
+ }
+
+ #endregion
+
+
+ #region 不同标准 不同项目配置 发送邮件的时机 处理具体逻辑
+
var answer = "否";
var isNeedSend = true;
var minUserIdList = _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
@@ -418,35 +461,23 @@ namespace IRaCIS.Core.Application.Service
}
else
{
- sendEmailConfig.TopicDescription = $"【入组确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
- using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
+ if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
+ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
{
- var templateInfo = SourceReader.ReadToEnd();
+ answer = "是";
- sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
- $" 附件为入组确认报告,请查收 "
- );
- }
+ //把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否)
+ var urgent = _repository.Where(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault();
-
- if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
- x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
+ if (urgent?.IsUrgent == false || urgent?.IsSubjectUrgent == false)
{
-
- answer = "是";
-
- //把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否)
- var urgent = _repository.Where(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault();
-
- if (urgent?.IsUrgent == false || urgent?.IsSubjectUrgent == false)
- {
- await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
- t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false });
- }
-
+ await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
+ t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false });
}
+
+ }
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List() { visitTaskId }, minUserIdList);
}
@@ -455,17 +486,7 @@ namespace IRaCIS.Core.Application.Service
}
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
{
- sendEmailConfig.TopicDescription = $"【疾病进展确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
- using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
- {
- var templateInfo = SourceReader.ReadToEnd();
-
-
- sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
- $" 附件为疾病进展确认报告,请查收 "
- );
- }
//有序
@@ -535,7 +556,7 @@ namespace IRaCIS.Core.Application.Service
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
-
+
}
//双人 产生裁判,并且裁判完成 发
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
@@ -657,7 +678,7 @@ namespace IRaCIS.Core.Application.Service
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
{
@@ -699,7 +720,7 @@ namespace IRaCIS.Core.Application.Service
-
+
}
else
@@ -707,21 +728,62 @@ namespace IRaCIS.Core.Application.Service
isNeedSend = false;
}
+ #endregion
+
+
#region MiniWord 组织字典 发送
+
+
+ if (emailStoreMode == EmailStoreSendMode.NotStoreLocalOnlySentEmail)
+ {
+
+ var phyPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, sendFileRelativePath);
+
+ //先预先生成了邮件,发送预先生成的邮件
+ sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
+ {
+ FileName = emailConfig.FileName,
+
+ FileStream = File.OpenRead(phyPath),
+ });
+
+
+ await SendEmailHelper.SendEmailAsync(sendEmailConfig);
+ }
+
+ var value = new Dictionary()
+ {
+ ["SponsorName"] = taskInfo.SponsorName,
+ ["ResearchProgramNo"] = taskInfo.ResearchProgramNo,
+ ["TrialSiteCode"] = taskInfo.TrialSiteCode,
+ ["SubjectCode"] = taskInfo.SubjectCode,
+ ["VisitName"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitName : taskInfo.ModuleVisitName,
+ ["EarliestScanDate"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitEarliestScanDate : taskInfo.ModuleEarliestScanDate,
+ ["SignTime"] = taskInfo.SignTime,
+ ["Result"] = answer
+
+ };
+
+ var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.SiteId, taskInfo.SubjectId);
+
+ if (emailStoreMode == EmailStoreSendMode.StoreLocalSend || emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail)
+ {
+ MiniSoftware.MiniWord.SaveAsByTemplate(serverFilePath, path, value);
+
+ }
+ //手动生成发送的邮件内容,但是并不发送
+ if (emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail)
+ {
+ isNeedSend = false;
+
+ return relativePath;
+ }
+
+
+ //正常的即时生成邮件 并发送邮件
if (isNeedSend)
{
- var value = new Dictionary()
- {
- ["SponsorName"] = taskInfo.SponsorName,
- ["ResearchProgramNo"] = taskInfo.ResearchProgramNo,
- ["TrialSiteCode"] = taskInfo.TrialSiteCode,
- ["SubjectCode"] = taskInfo.SubjectCode,
- ["VisitName"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitName : taskInfo.ModuleVisitName,
- ["EarliestScanDate"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitEarliestScanDate : taskInfo.ModuleEarliestScanDate,
- ["SignTime"] = taskInfo.SignTime,
- ["Result"] = answer
- };
MemoryStream memoryStream = new MemoryStream();
@@ -740,6 +802,15 @@ namespace IRaCIS.Core.Application.Service
await SendEmailHelper.SendEmailAsync(sendEmailConfig);
}
+
+
+
+ return string.Empty;
+
+
+
+
+
#endregion
@@ -747,6 +818,37 @@ namespace IRaCIS.Core.Application.Service
+ ///
+ /// 手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
+ ///
+ ///
+ ///
+ public async Task ManualGenerateEmailFile(Guid visitTaskId)
+ {
+ var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ if (string.IsNullOrEmpty(filePath))
+ {
+ return ResponseOutput.NotOk("该任务不符合发送邮件的条件");
+ }
+
+ return ResponseOutput.Ok(filePath);
+ }
+
+ ///
+ /// 手动发送邮件
+ ///
+ ///
+ ///
+ ///
+ public async Task ManualSendEmail(Guid visitTaskId, string sendFileRelativePath)
+ {
+ var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.NotStoreLocalOnlySentEmail, sendFileRelativePath);
+
+ return ResponseOutput.Ok();
+
+ }
+
private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType)
{
diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs
index 12c128eb..39f86256 100644
--- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs
@@ -684,7 +684,7 @@ namespace IRaCIS.Core.Application.Service
});
- await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(medicalReviewInfo.VisitTaskId, true&& medicalReviewInfo.IsApplyHeavyReading);
+ await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(medicalReviewInfo.VisitTaskId, true&& medicalReviewInfo.IsApplyHeavyReading);
var result = await _taskMedicalReviewRepository.SaveChangesAsync();
return ResponseOutput.Result(result);
diff --git a/IRaCIS.Core.Domain.Share/Common/EmailStoreMode.cs b/IRaCIS.Core.Domain.Share/Common/EmailStoreMode.cs
new file mode 100644
index 00000000..7ea28611
--- /dev/null
+++ b/IRaCIS.Core.Domain.Share/Common/EmailStoreMode.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IRaCIS.Core.Domain.Share.Common
+{
+
+
+ public enum EmailStoreSendMode
+ {
+ //不存储本地 发送
+ NotStoreLocalSend = 0,
+
+ //存储本地发送
+ StoreLocalSend = 1,
+
+ //存储本地不发送
+ OnlyStoreLocalNotSentEmail = 2,
+
+ //不存储本地 发送
+ NotStoreLocalOnlySentEmail = 3,
+
+ }
+
+}
From 752d47c023d10b2f64d84fbade06c7bff4e8854e Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 14:07:55 +0800
Subject: [PATCH 02/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 2 +-
.../Service/Document/TrialEmailNoticeConfigService.cs | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 23c31152..71e993e8 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -602,7 +602,7 @@
-
+
测试邮件 带附件 填充word --前端不需要用
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index f9f73a8b..3f46f170 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -823,6 +823,7 @@ namespace IRaCIS.Core.Application.Service
///
///
///
+ [HttpPut]
public async Task ManualGenerateEmailFile(Guid visitTaskId)
{
var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
@@ -841,6 +842,7 @@ namespace IRaCIS.Core.Application.Service
///
///
///
+ [HttpPut]
public async Task ManualSendEmail(Guid visitTaskId, string sendFileRelativePath)
{
var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.NotStoreLocalOnlySentEmail, sendFileRelativePath);
From 1a39de861bdb70f169a378bf8d59f6bb6055b257 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 16:39:25 +0800
Subject: [PATCH 03/15] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=8F=91=E9=80=81?=
=?UTF-8?q?=E9=82=AE=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Hangfire/HangfireConfig.cs | 2 +-
.../BackGroundJob/IRaCISCacheHangfireJob.cs | 62 ++++-
.../IRaCIS.Core.Application.xml | 6 +-
.../Document/TrialEmailNoticeConfigService.cs | 242 +++++++++++++++++-
IRaCIS.Core.Domain/Management/UserTypeMenu.cs | 1 +
IRaCIS.Core.Domain/_Config/_StaticData.cs | 3 +
6 files changed, 292 insertions(+), 24 deletions(-)
diff --git a/IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs b/IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs
index 5c588303..48423534 100644
--- a/IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs
+++ b/IRaCIS.Core.API/_PipelineExtensions/Hangfire/HangfireConfig.cs
@@ -31,7 +31,7 @@ namespace IRaCIS.Core.API
//周期性任务,1天执行一次
- RecurringJob.AddOrUpdate(t => t.MemoryCacheTrialStatus(), Cron.Daily);
+ RecurringJob.AddOrUpdate(t => t.ProjectStartCache(), Cron.Daily);
#endregion
diff --git a/IRaCIS.Core.Application/BackGroundJob/IRaCISCacheHangfireJob.cs b/IRaCIS.Core.Application/BackGroundJob/IRaCISCacheHangfireJob.cs
index 577c2615..80a3d16a 100644
--- a/IRaCIS.Core.Application/BackGroundJob/IRaCISCacheHangfireJob.cs
+++ b/IRaCIS.Core.Application/BackGroundJob/IRaCISCacheHangfireJob.cs
@@ -1,5 +1,6 @@
using EasyCaching.Core;
using IRaCIS.Core.Domain.Share;
+using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
using Microsoft.Extensions.Logging;
namespace IRaCIS.Application.Services.BackGroundJob
@@ -7,7 +8,13 @@ namespace IRaCIS.Application.Services.BackGroundJob
public interface IIRaCISCacheHangfireJob
{
+
+ Task ProjectStartCache();
Task MemoryCacheTrialStatus();
+
+ Task MemoryCacheAnonymizeData();
+
+ Task CacheUserTypePermission(Guid? cacheUserTypeId);
}
public class IRaCISCacheHangfireJob: IIRaCISCacheHangfireJob
{
@@ -16,50 +23,77 @@ namespace IRaCIS.Application.Services.BackGroundJob
private readonly ILogger _logger;
private readonly IRepository _systemAnonymizationRepository;
- public IRaCISCacheHangfireJob(IRepository trialRepository, IRepository systemAnonymizationRepository, IEasyCachingProvider provider,ILogger logger)
+ private readonly IRepository _userTypeMenuRepository;
+
+ public IRaCISCacheHangfireJob(IRepository trialRepository,
+ IRepository systemAnonymizationRepository, IRepository userTypeMenuRepository,
+ IEasyCachingProvider provider,ILogger logger)
{
_trialRepository = trialRepository;
_provider = provider;
_logger = logger;
_systemAnonymizationRepository = systemAnonymizationRepository;
+ _userTypeMenuRepository = userTypeMenuRepository;
}
- public async Task MemoryCacheTrialStatus()
+
+
+ public async Task ProjectStartCache()
{
- _logger.LogInformation("hangfire 定时任务开始~");
+ _logger.LogInformation("hangfire 定时缓存项目状态任务开始~");
try
{
- await CacheTrialStatusAsync();
+ await MemoryCacheTrialStatus();
- await CacheAnonymizeAsync();
+ await MemoryCacheAnonymizeData();
+
+ await CacheUserTypePermission();
}
catch (Exception e)
{
- _logger.LogError("hangfire 定时任务执行失败"+e.Message);
+ _logger.LogError("hangfire 定时任务执行失败" + e.Message);
}
-
- _logger.LogInformation("hangfire 定时任务执行结束");
+ _logger.LogInformation("hangfire 定时任务执行结束");
}
-
-
- private async Task CacheTrialStatusAsync()
+ public async Task MemoryCacheTrialStatus()
{
- var list = await _trialRepository.Select(t => new { TrialId = t.Id, TrialStatusStr = t.TrialStatusStr })
+ var list = await _trialRepository.Select(t => new { TrialId = t.Id, TrialStatusStr = t.TrialStatusStr })
.ToListAsync();
list.ForEach(t => _provider.Set(t.TrialId.ToString(), t.TrialStatusStr, TimeSpan.FromDays(7)));
+
}
- private async Task CacheAnonymizeAsync()
+
+
+
+
+
+
+ public async Task MemoryCacheAnonymizeData()
{
- var systemAnonymizationList = await _systemAnonymizationRepository.Where(t => t.IsEnable).ToListAsync();
+ var systemAnonymizationList = await _systemAnonymizationRepository.Where(t => t.IsEnable).ToListAsync();
_provider.Set(StaticData.Anonymize.Anonymize_AddFixedFiled, systemAnonymizationList.Where(t => t.IsAdd && t.IsFixed).ToList(), TimeSpan.FromDays(7));
_provider.Set(StaticData.Anonymize.Anonymize_AddIRCInfoFiled, systemAnonymizationList.Where(t => t.IsAdd && t.IsFixed == false).ToList(), TimeSpan.FromDays(7));
_provider.Set(StaticData.Anonymize.Anonymize_FixedField, systemAnonymizationList.Where(t => t.IsAdd == false && t.IsFixed).ToList(), TimeSpan.FromDays(7));
_provider.Set(StaticData.Anonymize.Anonymize_IRCInfoField, systemAnonymizationList.Where(t => t.IsAdd == false && t.IsFixed == false).ToList(), TimeSpan.FromDays(7));
}
+
+ public async Task CacheUserTypePermission(Guid? cacheUserTypeId=null)
+ {
+
+ var permissionList = await _userTypeMenuRepository.Where(t => t.Menu.MenuType == "F")
+ .WhereIf(cacheUserTypeId != null, t => t.UserTypeId == cacheUserTypeId.Value).Select(t => new { t.UserTypeId, t.Menu.PermissionStr }).ToListAsync();
+
+ foreach (var userTypeGroup in permissionList.GroupBy(t => t.UserTypeId))
+ {
+ _provider.Set($"{StaticData.CacheKey.UserTypeId}_{userTypeGroup.Key}", userTypeGroup.Select(t => t.PermissionStr).ToList(), TimeSpan.FromDays(7));
+ }
+ }
+
+
}
}
\ No newline at end of file
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 71e993e8..b7712116 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -613,11 +613,13 @@
-
+
手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
-
+
+
+
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 3f46f170..bfe39b7a 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -19,6 +19,7 @@ using MiniSoftware;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Share.Common;
using System.IO;
+using System.Linq;
namespace IRaCIS.Core.Application.Service
{
@@ -38,15 +39,22 @@ namespace IRaCIS.Core.Application.Service
public IRepository _visitTaskRepository { get; }
public IRepository _trialUserRepository { get; }
+ public IRepository _subjectRepository { get; }
+
+ public IRepository _subjectVisitRepository { get; }
+
public TrialEmailNoticeConfigService(IRepository trialEmailNoticeConfigRepository, IRepository visitTaskRepository,
IRepository trialRepository,
- IRepository trialUserRepository, IRepository taskMedicalReviewRepository)
+ IRepository trialUserRepository, IRepository taskMedicalReviewRepository, IRepository subjectRepository, IRepository subjectVisitRepository)
{
_trialEmailNoticeConfigRepository = trialEmailNoticeConfigRepository;
_visitTaskRepository = visitTaskRepository;
this._trialRepository = trialRepository;
_trialUserRepository = trialUserRepository;
_taskMedicalReviewRepository = taskMedicalReviewRepository;
+ _subjectRepository = subjectRepository;
+
+ _subjectVisitRepository = subjectVisitRepository;
}
///
@@ -821,19 +829,239 @@ namespace IRaCIS.Core.Application.Service
///
/// 手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
///
- ///
+ ///
+ ///
+ ///
///
[HttpPut]
- public async Task ManualGenerateEmailFile(Guid visitTaskId)
+ public async Task ManualGenerateEmailFile(Guid subjectId, Guid trialReadingCriterionId, CommonDocumentBusinessScenario businessScenarioEnum)
{
- var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- if (string.IsNullOrEmpty(filePath))
+ var trialConfig = await _subjectRepository.Where(t => t.Id == subjectId).Select(t => new { t.Trial.IsEnrollementQualificationConfirm, t.Trial.IsPDProgressView }).FirstNotNullAsync();
+
+ //找到入组确认 或者Pd 进展 已生成任务的 访视
+ var subjectVisitList = await _subjectVisitRepository.Where(t => t.SubjectId == subjectId & t.CheckState == CheckStateEnum.CVPassed && (t.IsEnrollmentConfirm == true || t.PDState == PDStateEnum.PDProgress)).ToListAsync();
+
+ if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
{
- return ResponseOutput.NotOk("该任务不符合发送邮件的条件");
+
+ if (trialConfig.IsEnrollementQualificationConfirm == false)
+ {
+ return ResponseOutput.NotOk("项目未配置入组确认!");
+
+ }
+ var exisitBaseline = subjectVisitList.FirstOrDefault(t => t.IsEnrollmentConfirm);
+ if (exisitBaseline == null)
+ {
+ return ResponseOutput.NotOk("不存在配置了入组确认的并且生成任务的基线访视");
+ }
+ else
+ {
+ //入组确认不用管项目的 有序 无序 单重 双重 阅片
+
+ var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false
+ && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync();
+
+ //如果存在做完的该任务
+
+ if (task == null)
+ {
+ return ResponseOutput.NotOk("基线任务没有阅片完!");
+ }
+ else
+ {
+ var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+
+
+ }
+
+ }
}
- return ResponseOutput.Ok(filePath);
+ else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
+ {
+
+ if (trialConfig.IsPDProgressView == false)
+ {
+ return ResponseOutput.NotOk("项目未配置PD进展!");
+ }
+
+ //是否是截止访视 截止访视在全局发 否则就在当前访视发
+
+ var pdSubjectVisitIdList = subjectVisitList.Where(t => t.PDState == PDStateEnum.PDProgress).OrderBy(t => t.VisitNum).Select(t => (Guid?)t.Id).ToList();
+
+ if (pdSubjectVisitIdList.Count == 0)
+ {
+ return ResponseOutput.NotOk("不存在配置了Pd进展的并且生成任务的基线访视");
+ }
+
+
+ var currentLatestPdVisitId = pdSubjectVisitIdList.Last();
+ //标准配置
+ var trialReadingCriterionConfig = await _repository.Where(t => t.Id == trialReadingCriterionId).Select(t => new
+ { TrialReadingCriterionId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder, t.CriterionType, t.ArbitrationRule }).FirstNotNullAsync();
+
+ // 项目双重
+ if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Double)
+ {
+ //仲裁在访视上面
+ if (trialReadingCriterionConfig.ArbitrationRule == ArbitrationRule.Visit)
+ {
+ //在两位阅片人读完访视后,如果有裁判者等裁判读完,如果无裁判则等第二个人的读完
+
+ var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == currentLatestPdVisitId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false
+ && t.TaskState == TaskState.Effect && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync();
+
+ var totalTaskCount = taskList.Count;
+ var finishedCount = taskList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).Count();
+
+
+ //发送随访的
+ if (totalTaskCount == 2 && totalTaskCount == finishedCount)
+ {
+ var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Visit);
+
+ var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ }
+ //发送全局
+ else if (totalTaskCount == 3 && totalTaskCount == finishedCount)
+ {
+ var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Judge);
+
+ var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ }
+ else
+ {
+ return ResponseOutput.NotOk("当前Subject最新PD访视阅片任务完成状态不符合发送条件");
+ }
+
+
+
+
+ }
+ //仲裁在阅片期上
+ else if (trialReadingCriterionConfig.ArbitrationRule == ArbitrationRule.Reading)
+ {
+ var existReadModule = await _repository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectVisitId == currentLatestPdVisitId && t.ReadingSetType == ReadingSetType.ImageReading)
+ .FirstOrDefaultAsync();
+
+ if (existReadModule == null)
+ {
+ return ResponseOutput.NotOk("项目配置了阅片期仲裁,但是当前Subject最新PD访视没有影像学阅片期");
+ }
+ else
+ {
+ var taskList = await _visitTaskRepository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.SouceReadModuleId == existReadModule.Id
+ && (t.ReadingCategory == ReadingCategory.Global || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync();
+
+ var totalTaskCount = taskList.Count;
+ var finishedCount = taskList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).Count();
+
+
+
+ //发送全局的
+ if (totalTaskCount == 2 && totalTaskCount == finishedCount)
+ {
+ var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Global);
+
+ var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ }
+ //发送全局裁判的
+ else if (totalTaskCount == 3 && totalTaskCount == finishedCount)
+ {
+ var task = taskList.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Judge);
+
+ var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ }
+
+
+ else
+ {
+ return ResponseOutput.NotOk("当前Subject最新PD访视阅片期任务完成状态不符合发送条件");
+ }
+ }
+
+
+ }
+ else
+ {
+ return ResponseOutput.NotOk("未定义该仲裁规则发送业务逻辑!");
+ }
+ }
+ // 项目单重 判断最新的Pd 访视是否完成 是否有阅片期即可
+ else if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Single)
+ {
+
+
+
+ var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == currentLatestPdVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false
+ && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync();
+
+
+ if (task == null)
+ {
+ return ResponseOutput.NotOk("当前Subject最新PD访视任务未阅片完成");
+ }
+ else
+ {
+ //存在阅片期 那么就是截止访视
+
+ var existReadModule = await _repository.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectVisitId == currentLatestPdVisitId && t.ReadingSetType == ReadingSetType.ImageReading)
+ .FirstOrDefaultAsync();
+ if (existReadModule != null)
+ {
+
+ var global = await _visitTaskRepository.Where(t => t.SouceReadModuleId == currentLatestPdVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false
+ && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync();
+
+
+ if (global != null)
+ {
+ var filePath = await BaseBusinessScenarioSendEmailAsync(global.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ }
+ else
+ {
+ return ResponseOutput.NotOk("当前Subject阅片期任务未阅片完成");
+ }
+
+ }
+ else//非截止访视 在访视读完后,发送
+ {
+ var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ }
+ }
+
+
+ }
+ else
+ {
+ return ResponseOutput.NotOk("当前项目配置,未定义单双重外发送业务逻辑!");
+ }
+
+ }
+
+ else
+ {
+ return ResponseOutput.NotOk("当前项目配置,未定义发送业务逻辑!");
+ }
+
+
+
+
}
///
diff --git a/IRaCIS.Core.Domain/Management/UserTypeMenu.cs b/IRaCIS.Core.Domain/Management/UserTypeMenu.cs
index b32311ee..017cf37a 100644
--- a/IRaCIS.Core.Domain/Management/UserTypeMenu.cs
+++ b/IRaCIS.Core.Domain/Management/UserTypeMenu.cs
@@ -15,6 +15,7 @@ namespace IRaCIS.Core.Domain.Models
[JsonIgnore]
[ForeignKey("UserTypeId")]
public UserType UserType { get; set; }
+
}
}
diff --git a/IRaCIS.Core.Domain/_Config/_StaticData.cs b/IRaCIS.Core.Domain/_Config/_StaticData.cs
index ac9372d2..41f9c6de 100644
--- a/IRaCIS.Core.Domain/_Config/_StaticData.cs
+++ b/IRaCIS.Core.Domain/_Config/_StaticData.cs
@@ -72,6 +72,9 @@ public static class StaticData
public static string StudyMaxCode = "StudyMaxCode";
public static string TaskMaxCode = "TaskMaxCode";
+
+ public const string UserTypeId = "UserTypeId";
+
}
From 4543a696987bed226546db032920bf8ad38b81d7 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 16:40:33 +0800
Subject: [PATCH 04/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?=
=?UTF-8?q?=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Document/TrialEmailNoticeConfigService.cs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index bfe39b7a..e2aebad5 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -872,7 +872,7 @@ namespace IRaCIS.Core.Application.Service
{
var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
}
@@ -925,7 +925,7 @@ namespace IRaCIS.Core.Application.Service
var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
}
//发送全局
else if (totalTaskCount == 3 && totalTaskCount == finishedCount)
@@ -934,7 +934,7 @@ namespace IRaCIS.Core.Application.Service
var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
}
else
{
@@ -972,7 +972,7 @@ namespace IRaCIS.Core.Application.Service
var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
}
//发送全局裁判的
else if (totalTaskCount == 3 && totalTaskCount == finishedCount)
@@ -981,7 +981,7 @@ namespace IRaCIS.Core.Application.Service
var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
}
@@ -1029,7 +1029,7 @@ namespace IRaCIS.Core.Application.Service
{
var filePath = await BaseBusinessScenarioSendEmailAsync(global.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
}
else
{
@@ -1041,7 +1041,7 @@ namespace IRaCIS.Core.Application.Service
{
var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
- return ResponseOutput.Ok(new { RelaTivePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
}
}
From f51380d27452d2dc062a32428429c1d4ec80be85 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 16:53:22 +0800
Subject: [PATCH 05/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=B1=E5=83=8F?=
=?UTF-8?q?=E4=B8=8A=E4=BC=A0modality=20=E9=80=82=E9=85=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Document/TrialEmailNoticeConfigService.cs | 3 ---
.../Service/ImageAndDoc/DicomArchiveService.cs | 17 ++++++++++++++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index e2aebad5..0bd377e1 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -941,9 +941,6 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.NotOk("当前Subject最新PD访视阅片任务完成状态不符合发送条件");
}
-
-
-
}
//仲裁在阅片期上
else if (trialReadingCriterionConfig.ArbitrationRule == ArbitrationRule.Reading)
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs
index b335fa5e..559964f1 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs
@@ -209,6 +209,21 @@ namespace IRaCIS.Core.Application.Services
var dicModalityList = _dictionaryRepository.Where(t => t.Code == "Modality").SelectMany(t => t.ChildList.Select(c => c.Value)).ToList();
+ var modalityForEdit = dicModalityList.Contains(modality) ? modality : String.Empty;
+
+ if (modality == "MR")
+ {
+ modalityForEdit = "MRI";
+ }
+
+ if (modality == "PT")
+ {
+ modalityForEdit = "PET";
+ }
+ if(modality== "PT、CT")
+ {
+ modalityForEdit = "PET-CT";
+ }
dicomStudy = new DicomStudy
{
@@ -217,7 +232,7 @@ namespace IRaCIS.Core.Application.Services
/* StudyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, DateTime.Now).Add(dataset.GetSingleValueOrDefault(DicomTag.StudyTime, DateTime.Now).TimeOfDay),*///dataset.GetDateTime(DicomTag.StudyDate, DicomTag.StudyTime),
StudyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, string.Empty) == string.Empty ? null : dataset.GetSingleValue(DicomTag.StudyDate).Add(dataset.GetSingleValueOrDefault(DicomTag.StudyTime, string.Empty) == string.Empty ? TimeSpan.Zero : dataset.GetSingleValue(DicomTag.StudyTime).TimeOfDay),
Modalities = modality,
- ModalityForEdit = modality == "MR" ? "MRI": (dicModalityList.Contains(modality) ? modality : String.Empty),
+ ModalityForEdit = modalityForEdit,
Description = dataset.GetSingleValueOrDefault(DicomTag.StudyDescription, string.Empty),
InstitutionName = dataset.GetSingleValueOrDefault(DicomTag.InstitutionName, string.Empty),
PatientId = dataset.GetSingleValueOrDefault(DicomTag.PatientID, string.Empty),
From 3807db1b86c108fd6aca693e308fbd011bec0fcf Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 17:04:34 +0800
Subject: [PATCH 06/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?=
=?UTF-8?q?=E4=BC=A0=E9=80=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 6 ++----
.../Document/DTO/TrialEmailNoticeConfigViewModel.cs | 10 ++++++++++
.../Document/TrialEmailNoticeConfigService.cs | 13 ++++++++-----
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index b7712116..49b15b43 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -613,13 +613,11 @@
-
+
手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
-
-
-
+
diff --git a/IRaCIS.Core.Application/Service/Document/DTO/TrialEmailNoticeConfigViewModel.cs b/IRaCIS.Core.Application/Service/Document/DTO/TrialEmailNoticeConfigViewModel.cs
index a789b269..7cd8ad0a 100644
--- a/IRaCIS.Core.Application/Service/Document/DTO/TrialEmailNoticeConfigViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Document/DTO/TrialEmailNoticeConfigViewModel.cs
@@ -108,6 +108,16 @@ namespace IRaCIS.Core.Application.ViewModel
}
+
+ public class GenerateEmailCommand
+ {
+ public Guid SubjectId { get; set; }
+
+ public Guid TrialReadingCriterionId { get; set; }
+
+ public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
+ }
+
/// TrialEmailNoticeConfigAddOrEdit 列表查询参数模型
public class TrialEmailNoticeConfigAddOrEdit
{
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 0bd377e1..3069a7d6 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -829,13 +829,16 @@ namespace IRaCIS.Core.Application.Service
///
/// 手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
///
- ///
- ///
- ///
+ ///
+
///
- [HttpPut]
- public async Task ManualGenerateEmailFile(Guid subjectId, Guid trialReadingCriterionId, CommonDocumentBusinessScenario businessScenarioEnum)
+ [HttpPost]
+ public async Task ManualGenerateEmailFile(GenerateEmailCommand generateEmailCommand)
{
+ var subjectId = generateEmailCommand.SubjectId;
+ var businessScenarioEnum = generateEmailCommand.BusinessScenarioEnum;
+ var trialReadingCriterionId = generateEmailCommand.TrialReadingCriterionId;
+
var trialConfig = await _subjectRepository.Where(t => t.Id == subjectId).Select(t => new { t.Trial.IsEnrollementQualificationConfirm, t.Trial.IsPDProgressView }).FirstNotNullAsync();
From f750f2d4c95184eef888cbfea5111dfab5ee65f2 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 17:44:57 +0800
Subject: [PATCH 07/15] x
---
.../Service/Document/TrialEmailNoticeConfigService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 3069a7d6..01b6a21c 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -219,7 +219,7 @@ namespace IRaCIS.Core.Application.Service
}
///
- /// 测试邮件 带附件 填充word --前端不需要用
+ /// 测试邮件 带附件 填充word --前端不需
///
///
///
From ec93a4f4dce4d6836b6cff817d48ec7613fd4b03 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 18:17:27 +0800
Subject: [PATCH 08/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?=
=?UTF-8?q?=E5=8F=91=E9=80=81=E5=A4=9A=E6=AC=A1bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 2 +-
.../Service/Document/TrialEmailNoticeConfigService.cs | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 49b15b43..2635cb74 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -604,7 +604,7 @@
- 测试邮件 带附件 填充word --前端不需要用
+ 测试邮件 带附件 填充word --前端不需
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 01b6a21c..8b4f6e2b 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -180,7 +180,7 @@ namespace IRaCIS.Core.Application.Service
var isNeedSend = true;
- if (pdAnswer == "是")
+ if (pdAnswer == "是" && isMedicalReviewAndSuggestApplyReReading==null)
{
isNeedSend = true;
@@ -458,6 +458,8 @@ namespace IRaCIS.Core.Application.Service
var isNeedSend = true;
var minUserIdList = _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
+
+
//入组确认 根据每个标准配置的是否自动发送,发送邮件与否
if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
{
@@ -757,6 +759,8 @@ namespace IRaCIS.Core.Application.Service
await SendEmailHelper.SendEmailAsync(sendEmailConfig);
+
+ return string.Empty;
}
var value = new Dictionary()
From 4e587b5b18dec8c117445e431041a8b22abbc0b2 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 28 Feb 2023 18:29:08 +0800
Subject: [PATCH 09/15] x
---
.../Service/Document/TrialEmailNoticeConfigService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 8b4f6e2b..91c91716 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -901,7 +901,7 @@ namespace IRaCIS.Core.Application.Service
if (pdSubjectVisitIdList.Count == 0)
{
- return ResponseOutput.NotOk("不存在配置了Pd进展的并且生成任务的基线访视");
+ return ResponseOutput.NotOk("不存在配置了PD进展的并且生成任务的访视");
}
From 2c4ca4905901858434b8e0b09ed4fd47944fad89 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 1 Mar 2023 10:32:47 +0800
Subject: [PATCH 10/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E6=88=90PD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Document/TrialEmailNoticeConfigService.cs | 1 +
IRaCIS.Core.Application/Service/QC/QCOperationService.cs | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 91c91716..94357f9d 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -180,6 +180,7 @@ namespace IRaCIS.Core.Application.Service
var isNeedSend = true;
+ //手动发送的时候,也有可能答案是是 此时是 这里不发送,发送已经生成的文件
if (pdAnswer == "是" && isMedicalReviewAndSuggestApplyReReading==null)
{
isNeedSend = true;
diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
index fef04e65..720724c3 100644
--- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
+++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
@@ -1335,11 +1335,9 @@ namespace IRaCIS.Core.Application.Image.QA
}
//非基线设置为PD的话 或者设置为末次访视 根据配置自动生成阅片期
- if (!dbSubjectVisit.IsBaseLine && dbSubjectVisit.PDState == PDStateEnum.PDProgress && dbSubjectVisit.IsFinalVisit)
+ if (!dbSubjectVisit.IsBaseLine && (dbSubjectVisit.PDState == PDStateEnum.PDProgress || dbSubjectVisit.IsFinalVisit) )
{
-
-
//该标准需要添加阅片期
foreach (var trialReadingCriterionId in trialReadingCriterionIdList)
{
From 15a2294688d1b36fc435930477720b9052728107 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 1 Mar 2023 11:06:14 +0800
Subject: [PATCH 11/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E9=80=81?=
=?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 11 +++++
.../Document/TrialEmailNoticeConfigService.cs | 49 ++++++++++++-------
2 files changed, 41 insertions(+), 19 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 2635cb74..374e0f2e 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -628,6 +628,17 @@
+
+
+
+
+ 任务Id
+ 任务类型
+ 标准类型
+ 是否是全局产生(区分裁判任务)
+
+
+
选择人员下拉
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 94357f9d..b7bdc4cf 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -572,8 +572,8 @@ namespace IRaCIS.Core.Application.Service
//双人 产生裁判,并且裁判完成 发
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
{
-
- answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge, taskInfo.CriterionType);
+ var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value;
+ answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
@@ -618,7 +618,8 @@ namespace IRaCIS.Core.Application.Service
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Global).Count() == 2)
{
- answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge, taskInfo.CriterionType);
+ var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value;
+ answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Global, taskInfo.CriterionType);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
@@ -681,7 +682,8 @@ namespace IRaCIS.Core.Application.Service
{
//在两位阅片人读完访视后,如果有裁判者等裁判读完,如果无裁判则等第二个人的读完
- var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync();
+ var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect
+ && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync();
//这里要求 到这里已经如果有裁判 已经生成裁判了保存数据库
if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) == 2)
@@ -693,8 +695,9 @@ namespace IRaCIS.Core.Application.Service
}
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
{
+ var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value;
+ answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType);
- answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge, taskInfo.CriterionType);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
@@ -1084,8 +1087,16 @@ namespace IRaCIS.Core.Application.Service
}
-
- private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType)
+ ///
+ ///
+ ///
+ /// 任务Id
+ /// 任务类型
+ /// 标准类型
+ /// 是否是全局产生(区分裁判任务)
+ ///
+ ///
+ private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType, bool? IsGlobalGenerate=null)
{
var answer = string.Empty;
@@ -1123,15 +1134,15 @@ namespace IRaCIS.Core.Application.Service
}
}
- else if (readingCategory == ReadingCategory.Judge)
- {
- //var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync();
+ //else if (readingCategory == ReadingCategory.Judge)
+ //{
+ // var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync();
- var questionAnsewer = await _repository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync();
+ // var questionAnsewer = await _repository.Where(t => t.VisitTaskId == judgeResultTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync();
- answer = questionAnsewer.Answer;
- }
+ // answer = questionAnsewer.Answer;
+ //}
else
{
throw new BusinessValidationFailedException("不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑");
@@ -1163,14 +1174,14 @@ namespace IRaCIS.Core.Application.Service
answer = questionAnsewer.Answer;
}
- else if (readingCategory == ReadingCategory.Judge)
- {
- //var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync();
+ //else if (readingCategory == ReadingCategory.Judge)
+ //{
+ // //var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync();
- var questionAnsewer = await _repository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync();
+ // var questionAnsewer = await _repository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation).FirstNotNullAsync();
- answer = questionAnsewer.Answer;
- }
+ // answer = questionAnsewer.Answer;
+ //}
else
{
throw new BusinessValidationFailedException("不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑");
From 45a52e1f587c3210ddc904a5fc56b6035461df95 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 1 Mar 2023 11:49:55 +0800
Subject: [PATCH 12/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?=
=?UTF-8?q?=E5=8F=91=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 2 +-
.../Document/TrialEmailNoticeConfigService.cs | 57 ++++++++++---------
.../ReadingJudgeTaskService.cs | 3 +
3 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 374e0f2e..6044df4f 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -607,7 +607,7 @@
测试邮件 带附件 填充word --前端不需
-
+ 为空 代表 正常任务自动发送,为true 代表医学审核手动发送 为false 代表医学审核自动发送
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index b7bdc4cf..846d73da 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -175,13 +175,13 @@ namespace IRaCIS.Core.Application.Service
- private async Task DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isMedicalReviewAndSuggestApplyReReading, string pdAnswer, List taskIdList, List minUserIdList)
+ private async Task DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isHandSend, string pdAnswer, List taskIdList, List minUserIdList)
{
var isNeedSend = true;
//手动发送的时候,也有可能答案是是 此时是 这里不发送,发送已经生成的文件
- if (pdAnswer == "是" && isMedicalReviewAndSuggestApplyReReading==null)
+ if (pdAnswer == "是" && isHandSend==null)
{
isNeedSend = true;
@@ -189,7 +189,7 @@ namespace IRaCIS.Core.Application.Service
else
{
//正常阅片为否的
- if (isMedicalReviewAndSuggestApplyReReading == null)
+ if (isHandSend == null)
{
isNeedSend = false;
@@ -200,7 +200,7 @@ namespace IRaCIS.Core.Application.Service
}
}
- else if (isMedicalReviewAndSuggestApplyReReading == true)
+ else if (isHandSend == true)
{
//手动发送
isNeedSend = false;
@@ -223,12 +223,12 @@ namespace IRaCIS.Core.Application.Service
/// 测试邮件 带附件 填充word --前端不需
///
///
- ///
+ /// 为空 代表 正常任务自动发送,为true 代表医学审核手动发送 为false 代表医学审核自动发送
///
///
///
///
- public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading, EmailStoreSendMode emailStoreMode, string sendFileRelativePath)
+ public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isHandSend, EmailStoreSendMode emailStoreMode, string sendFileRelativePath)
{
CommonDocumentBusinessScenario? businessScenarioEnum = null;
@@ -464,6 +464,13 @@ namespace IRaCIS.Core.Application.Service
//入组确认 根据每个标准配置的是否自动发送,发送邮件与否
if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
{
+ if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
+ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
+ {
+ answer = "是";
+ }
+
+
//如果其他阅片人已经做了,说明发送了入组确认报告,第二个人做完就不发送了
if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
t.Id != visitTaskId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId))
@@ -472,13 +479,8 @@ namespace IRaCIS.Core.Application.Service
}
else
{
-
- if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
- x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
+ if (answer == "是")
{
-
- answer = "是";
-
//把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否)
var urgent = _repository.Where(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault();
@@ -487,9 +489,10 @@ namespace IRaCIS.Core.Application.Service
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false });
}
-
}
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List() { visitTaskId }, minUserIdList);
+
+
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList);
}
@@ -541,7 +544,7 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException("单重有序阅片 该类型的任务不应进入此处逻辑,请联系后台开发核查!");
}
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List() { visitTaskId }, minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList);
}
@@ -566,7 +569,7 @@ namespace IRaCIS.Core.Application.Service
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
//双人 产生裁判,并且裁判完成 发
@@ -575,7 +578,7 @@ namespace IRaCIS.Core.Application.Service
var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value;
answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
else
@@ -612,7 +615,7 @@ namespace IRaCIS.Core.Application.Service
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
//双人全局产生裁判
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Global).Count() == 2)
@@ -621,7 +624,7 @@ namespace IRaCIS.Core.Application.Service
var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value;
answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Global, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
else
@@ -675,7 +678,7 @@ namespace IRaCIS.Core.Application.Service
{
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List() { visitTaskId }, minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList);
}
//双重 截止访视只在阅片期的时候存在 要求PD确认的访视 肯定是非截止访视
else if (taskInfo.ReadingType == ReadingMethod.Double && taskInfo.ArbitrationRule == ArbitrationRule.Visit)
@@ -691,14 +694,14 @@ namespace IRaCIS.Core.Application.Service
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
{
var judgeResultId = taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().JudgeResultTaskId.Value;
answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType);
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
@@ -949,7 +952,7 @@ namespace IRaCIS.Core.Application.Service
}
else
{
- return ResponseOutput.NotOk("当前Subject最新PD访视阅片任务完成状态不符合发送条件");
+ return ResponseOutput.NotOk("当前受试者最新PD访视阅片任务完成状态不符合发送条件");
}
}
@@ -961,7 +964,7 @@ namespace IRaCIS.Core.Application.Service
if (existReadModule == null)
{
- return ResponseOutput.NotOk("项目配置了阅片期仲裁,但是当前Subject最新PD访视没有影像学阅片期");
+ return ResponseOutput.NotOk("项目配置了阅片期仲裁,但是当前受试者最新PD访视没有影像学阅片期");
}
else
{
@@ -995,7 +998,7 @@ namespace IRaCIS.Core.Application.Service
else
{
- return ResponseOutput.NotOk("当前Subject最新PD访视阅片期任务完成状态不符合发送条件");
+ return ResponseOutput.NotOk("当前受试者最新PD访视阅片期任务完成状态不符合发送条件");
}
}
@@ -1018,7 +1021,7 @@ namespace IRaCIS.Core.Application.Service
if (task == null)
{
- return ResponseOutput.NotOk("当前Subject最新PD访视任务未阅片完成");
+ return ResponseOutput.NotOk("当前受试者最新PD访视任务未阅片完成");
}
else
{
@@ -1041,7 +1044,7 @@ namespace IRaCIS.Core.Application.Service
}
else
{
- return ResponseOutput.NotOk("当前Subject阅片期任务未阅片完成");
+ return ResponseOutput.NotOk("当前受试者阅片期任务未阅片完成");
}
}
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs
index 80dcbd86..e94290fb 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs
@@ -11,6 +11,7 @@ using Newtonsoft.Json;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Filter;
+using IRaCIS.Core.Domain.Models;
namespace IRaCIS.Application.Services
{
@@ -451,6 +452,8 @@ namespace IRaCIS.Application.Services
// 创建任务关联关系
await this.CreateTaskRelated(inDto.VisitTaskId);
+
+ await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(inDto.VisitTaskId);
return ResponseOutput.Ok(result);
}
From 7aa4b719e55973977c69ed7b5411faa7f1977e01 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 1 Mar 2023 13:18:33 +0800
Subject: [PATCH 13/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E7=BB=84?=
=?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Document/TrialEmailNoticeConfigService.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 846d73da..8920b42f 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -873,8 +873,9 @@ namespace IRaCIS.Core.Application.Service
{
//入组确认不用管项目的 有序 无序 单重 双重 阅片
+ //找到最早签名的
var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false
- && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).FirstOrDefaultAsync();
+ && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).OrderBy(t=>t.SignTime).FirstOrDefaultAsync();
//如果存在做完的该任务
From f0414fcdc34c0f1dec5231e93342acce494b2582 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 1 Mar 2023 14:17:43 +0800
Subject: [PATCH 14/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E7=BB=84?=
=?UTF-8?q?=E7=A1=AE=E8=AE=A4=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81=E9=80=BB?=
=?UTF-8?q?=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Document/TrialEmailNoticeConfigService.cs | 37 +++++++++++++------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 8920b42f..a117c8b5 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -759,7 +759,7 @@ namespace IRaCIS.Core.Application.Service
//先预先生成了邮件,发送预先生成的邮件
sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
{
- FileName = emailConfig.FileName,
+ FileName = $"{taskInfo.SubjectCode}_{emailConfig.FileName}",
FileStream = File.OpenRead(phyPath),
});
@@ -812,7 +812,7 @@ namespace IRaCIS.Core.Application.Service
sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
{
- FileName = emailConfig.FileName,
+ FileName =$"{taskInfo.SubjectCode}_{emailConfig.FileName}" ,
FileStream = memoryStream
});
@@ -874,23 +874,38 @@ namespace IRaCIS.Core.Application.Service
//入组确认不用管项目的 有序 无序 单重 双重 阅片
//找到最早签名的
- var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false
+ var firstSignTask = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id /*&& t.TaskState == TaskState.Effect*/ && t.IsAnalysisCreate == false
&& t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).OrderBy(t=>t.SignTime).FirstOrDefaultAsync();
- //如果存在做完的该任务
- if (task == null)
+ if (firstSignTask != null)
{
- return ResponseOutput.NotOk("基线任务没有阅片完!");
+ var task = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == exisitBaseline.Id && t.TaskState == TaskState.Effect && t.DoctorUserId== firstSignTask.DoctorUserId && t.IsAnalysisCreate == false
+ && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == trialReadingCriterionId).OrderBy(t => t.SignTime).FirstOrDefaultAsync();
+
+ //如果存在做完的该任务
+
+ if (task == null)
+ {
+ return ResponseOutput.NotOk("做入组确认的阅片人基线任务没有阅片完!");
+ }
+ else
+ {
+ var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
+
+ return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
+
+
+ }
}
else
{
- var filePath = await BaseBusinessScenarioSendEmailAsync(task.Id, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
-
- return ResponseOutput.Ok(new { RelativePath = filePath, TaskName = task.TaskName, VisitTaskId = task.Id });
-
-
+ return ResponseOutput.NotOk("当前未有阅片人读完基线任务!");
}
+
+
+
+
}
}
From 2b3d5b49600dc7433c0506a0e1d5a361493c1d1b Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 1 Mar 2023 14:43:03 +0800
Subject: [PATCH 15/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E7=BB=84?=
=?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8F=91=E9=80=81=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Document/TrialEmailNoticeConfigService.cs | 39 ++++++++++++++++---
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index a117c8b5..dd5efbb0 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -262,6 +262,7 @@ namespace IRaCIS.Core.Application.Service
t.SubjectId,
t.Subject.SiteId,
+ t.DoctorUserId,
t.ReadingTaskState,
t.ReadingCategory,
t.SignTime,
@@ -472,13 +473,41 @@ namespace IRaCIS.Core.Application.Service
//如果其他阅片人已经做了,说明发送了入组确认报告,第二个人做完就不发送了
- if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
- t.Id != visitTaskId && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId))
+
+ //入组确认一直交给第一个人,如果第一个人重阅 还未做完,第二个人先做完了,此时不发
+
+ var existFirstEnrollTask= await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.IsAnalysisCreate == false
+ && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId).OrderBy(t=>t.SignTime).FirstOrDefaultAsync();
+
+ //入组确认的医生已确定
+ if(existFirstEnrollTask!= null)
{
- isNeedSend = false;
+ if(taskInfo.DoctorUserId==existFirstEnrollTask.DoctorUserId)
+ {
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList);
+
+ if (answer == "是")
+ {
+ //把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否)
+ var urgent = _repository.Where(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault();
+
+ if (urgent?.IsUrgent == false || urgent?.IsSubjectUrgent == false)
+ {
+ await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
+ t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false });
+ }
+ }
+ }
+ else
+ {
+ isNeedSend = false;
+ }
}
else
{
+ isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList);
+
+
if (answer == "是")
{
//把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否)
@@ -491,11 +520,11 @@ namespace IRaCIS.Core.Application.Service
}
}
-
- isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List() { visitTaskId }, minUserIdList);
}
+
+
}
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)