Compare commits

...

144 Commits

Author SHA1 Message Date
he 266917bb4f 添加任务名称
continuous-integration/drone/push Build is passing
2026-06-29 17:31:20 +08:00
he 01b48982bb 数据通知
continuous-integration/drone/push Build is running
2026-06-29 17:29:53 +08:00
he 47825b2239 修改名称
continuous-integration/drone/push Build is passing
2026-06-29 16:47:26 +08:00
he 1fa3dcadae 异常提醒修改
continuous-integration/drone/push Build is passing
2026-06-29 16:42:15 +08:00
he 92fecfa024 Merge branch 'Uat_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
2026-06-29 16:09:36 +08:00
he cea0d7f346 只限制 changeDicomReadingQuestionAnswer 接口 以及微信通知 2026-06-29 16:09:28 +08:00
he c02fe93ad8 任务答案数量验证 2026-06-29 16:09:24 +08:00
he c58b52d1bb Revert "临时去掉锁"
This reverts commit e045302d38.
2026-06-29 16:07:15 +08:00
he 7a2720fd0e 重新发布 2026-06-29 16:07:14 +08:00
he 34f1e9452b 临时去掉锁 2026-06-29 16:07:09 +08:00
he 967438d4da 验证重复请求加锁 2026-06-29 16:06:18 +08:00
hang 420804d539 更新缓存提交
continuous-integration/drone/push Build is passing
2026-06-22 16:04:12 +08:00
hang c182f2d91c 中心接口增加参数
continuous-integration/drone/push Build is passing
2026-06-16 17:16:03 +08:00
hang e3fd35f72d 中心调研增加字段返回禁用的中心
continuous-integration/drone/push Build is passing
2026-06-16 17:11:10 +08:00
hang 5118186892 项目配置增加培训类型呢
continuous-integration/drone/push Build is passing
2026-06-16 13:31:37 +08:00
hang 6b6253eb76 阅片期查询bug
continuous-integration/drone/push Build is passing
2026-06-15 14:28:23 +08:00
he 5275c86a02 修复bug 2026-06-05 09:40:04 +08:00
he 47480a5d4d 添加新增修改表格问题限制
continuous-integration/drone/push Build is passing
2026-06-05 09:24:27 +08:00
hang 8d6c554e2a Merge branch 'Test_IRC_Net8' into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
2026-06-04 13:09:39 +08:00
hang d719015fa2 zip 流方式demo
continuous-integration/drone/push Build is failing
2026-06-04 13:08:37 +08:00
hang 73fa62e6a2 增加续期备注 2026-06-03 17:56:07 +08:00
hang bb3f612772 临时token 续期以服务器时间比较
continuous-integration/drone/push Build is running
2026-06-03 17:44:31 +08:00
hang 99b6c63de7 开启压缩包任务索引增加
continuous-integration/drone/push Build is running
2026-06-03 15:33:03 +08:00
hang 8b046e61ab 后端长时间下载,临时token 续期bug 修复
continuous-integration/drone/push Build is running
2026-06-03 14:34:25 +08:00
hang ff2c619df7 增加下载额外日志提示
continuous-integration/drone/push Build is running
2026-06-03 14:09:12 +08:00
hang c9ffa64560 遮盖影像修改
continuous-integration/drone/push Build is running
2026-06-03 13:54:10 +08:00
hang 2969306d1e 合并多帧不保留偏移表
continuous-integration/drone/push Build is running
2026-06-03 11:07:04 +08:00
hang 2fb558d388 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-06-02 17:23:27 +08:00
hang 9a0859f915 后端增加默认排序 2026-06-02 17:23:27 +08:00
he 19bf8210f6 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-06-02 16:25:42 +08:00
he 7a30fd0f28 验证修改 2026-06-02 16:25:41 +08:00
hang 432bf1ae12 项目删除,导致参与项目列表查询bug
continuous-integration/drone/push Build is running
2026-06-02 16:03:55 +08:00
hang 967c0114d8 导出下载访视修改
continuous-integration/drone/push Build is pending
2026-06-02 15:03:00 +08:00
hang 0f55c6da9d Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-06-02 14:13:20 +08:00
hang 5e345418fb 分配阅片人bug 2026-06-02 14:13:17 +08:00
he de19c5bc32 修改密码发送邮件 2026-06-02 10:55:47 +08:00
he 1998842200 验证修改
continuous-integration/drone/push Build is pending
2026-06-02 10:38:15 +08:00
he 25a18e8366 项目查询排序
continuous-integration/drone/push Build is passing
2026-06-02 10:04:42 +08:00
he a2966e761c Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-06-02 09:27:44 +08:00
he 0508b8ffb3 功能修改 2026-06-02 09:27:41 +08:00
hang 9d4c69b39a 通过Excel 读取信息进行下载
continuous-integration/drone/push Build is running
2026-06-02 01:17:01 +08:00
hang e11790ea92 合并多帧失败,日志记录修改
continuous-integration/drone/push Build is running
2026-06-01 23:30:51 +08:00
he e559c2503b Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-06-01 16:41:44 +08:00
he c0a383ef58 MRIPDFF 修改1 2026-06-01 16:41:40 +08:00
hang 9b6ddb0f16 不压缩打包
continuous-integration/drone/push Build is running
2026-06-01 15:52:06 +08:00
hang 45db942f66 修改下载代码
continuous-integration/drone/push Build is running
2026-06-01 15:37:01 +08:00
hang 41efcbfdf1 修改事件环境配置,增加windows部署识别环境参数
continuous-integration/drone/push Build is running
2026-06-01 12:41:54 +08:00
hang 76c69a8464 下载增加区间
continuous-integration/drone/push Build is running
2026-05-29 17:51:27 +08:00
hang abe42ef3cf Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-29 15:16:36 +08:00
hang 40f744ea4a 后端下载影像打成压缩包 2026-05-29 15:16:35 +08:00
he 08d5e54fe0 Merge branch 'Test_IRC_Net8' into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
2026-05-29 13:19:23 +08:00
he 7bc0d7f3dc 功能修改
continuous-integration/drone/push Build is running
2026-05-29 11:02:24 +08:00
he 9bbac291b6 邮件内容替换
continuous-integration/drone/push Build is passing
2026-05-29 09:29:43 +08:00
hang 140cc3ce94 Merge branch 'Test_IRC_Net8' into Uat_IRC_Net8
continuous-integration/drone/push Build is pending
2026-05-28 17:00:42 +08:00
hang d7da7b69d4 修改字段类型 2026-05-28 16:49:11 +08:00
hang f6530cfb32 删除多余的分号
continuous-integration/drone/push Build is failing
2026-05-28 16:08:14 +08:00
hang 376dcc5bd5 增加创建项目调研默认值
continuous-integration/drone/push Build is running
2026-05-28 15:47:57 +08:00
hang 89546b9874 修改默认配置
continuous-integration/drone/push Build is passing
2026-05-28 14:55:00 +08:00
hang 385c40c895 修改默认值
continuous-integration/drone/push Build is running
2026-05-28 13:48:56 +08:00
hang 8b9580abc8 修改中心调研增加字段
continuous-integration/drone/push Build is running
2026-05-28 13:28:52 +08:00
hang 906b6f1d25 Merge branch 'Test_IRC_Net8' into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
2026-05-28 09:08:26 +08:00
hang 3b9c8efeba 配置生产bucket 信息
continuous-integration/drone/push Build is failing
2026-05-27 15:35:49 +08:00
hang 5ba831c044 测试模型默认值
continuous-integration/drone/push Build is running
2026-05-27 10:31:53 +08:00
hang 1141cc20e9 修改配置字段更新位置
continuous-integration/drone/push Build is running
2026-05-27 09:31:14 +08:00
hang 11a439a48f 质控下载默认值修改
continuous-integration/drone/push Build is running
2026-05-26 17:12:50 +08:00
hang 9ef3e53d77 修改项目配置默认值
continuous-integration/drone/push Build is running
2026-05-26 16:31:49 +08:00
hang e34c3268ea Merge branch 'Test_IRC_Net8' into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
2026-05-26 13:57:10 +08:00
hang 104f46c9db 修改oss 配置文件 2026-05-26 13:56:45 +08:00
hang 0f0c670ec8 增加参数判断,是否导出阅片影像
continuous-integration/drone/push Build is running
2026-05-26 13:34:44 +08:00
he 655aad4119 Merge branch 'Test_IRC_Net8' into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
2026-05-26 09:47:39 +08:00
hang c901f0e3d1 增加uat scp 同步配置 2026-05-25 16:49:42 +08:00
he 63e9428d6d Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-25 16:38:42 +08:00
he cbe7270f4b 稽查功能修改 2026-05-25 16:38:38 +08:00
hang c4301f848c 测试合并Uat 2026-05-25 13:46:27 +08:00
hang fd67dad4b2 增加uat 部署测试lili同步配置
continuous-integration/drone/push Build is failing
2026-05-25 13:14:05 +08:00
hang 38b8f0085b 调整中心调研视图接收模型
continuous-integration/drone/push Build is running
2026-05-21 14:28:22 +08:00
hang ab0e7afdb8 中心调研国际化修改 2026-05-21 14:23:13 +08:00
hang 8045f96106 修改中心调研配置字段
continuous-integration/drone/push Build is running
2026-05-21 14:13:09 +08:00
hang 6481aa37e7 将项目配置从json中挪出来
continuous-integration/drone/push Build is running
2026-05-21 11:35:54 +08:00
hang 0b9ee87039 增加系统配置修改
continuous-integration/drone/push Build is running
2026-05-21 09:22:51 +08:00
hang 9b0d68d26d 修改order
continuous-integration/drone/push Build is passing
2026-05-20 15:28:57 +08:00
hang 8ee7d7018f 修改默认值
continuous-integration/drone/push Build is running
2026-05-20 15:27:16 +08:00
hang 7c1c45417f 中心调研初步调整
continuous-integration/drone/push Build is running
2026-05-20 14:10:10 +08:00
hang 1fbda0327c 修改dcm默认值
continuous-integration/drone/push Build is running
2026-05-20 11:49:25 +08:00
hang 12f91c3b99 dicom没有类型时,给默认值dcm
continuous-integration/drone/push Build is passing
2026-05-20 09:23:46 +08:00
hang 7d7c350df6 修改scp默认设置的区域
continuous-integration/drone/push Build is running
2026-05-19 13:24:23 +08:00
hang caffff259e 删除检查不删除pacs推送过来的
continuous-integration/drone/push Build is running
2026-05-19 10:10:59 +08:00
hang 80b3defd37 从pacs 添加检查修改项目检查最大编号
continuous-integration/drone/push Build is running
2026-05-18 17:57:10 +08:00
hang bbe1642786 回更同步记录的 subjectId svId
continuous-integration/drone/push Build is running
2026-05-18 17:30:22 +08:00
hang 4a2b9fdb41 输入错误修改
continuous-integration/drone/push Build is passing
2026-05-18 17:15:43 +08:00
hang f7bc32ed90 修改绑定配置
continuous-integration/drone/push Build is running
2026-05-18 17:13:59 +08:00
hang 592de4deb4 增加同步配置
continuous-integration/drone/push Build is running
2026-05-18 16:53:26 +08:00
hang ad5c36930e 修改SCP服务配置文件
continuous-integration/drone/push Build is running
2026-05-18 16:22:04 +08:00
hang c4570ebe62 修改SCP服务同步
continuous-integration/drone/push Build is pending
2026-05-18 15:33:09 +08:00
hang fdaf7180c0 修改医学审核判断
continuous-integration/drone/push Build is passing
2026-05-15 18:06:35 +08:00
hang ee9152bbc4 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-15 13:54:43 +08:00
hang 413503e0f4 一致性核查 核查结果根据中心设置的语言进行调整 2026-05-15 13:54:41 +08:00
he 27c41af918 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8 2026-05-15 13:39:02 +08:00
he fd21cf2539 项目文档 中英文 2026-05-15 13:39:00 +08:00
hang da485e1dde 修改周期性邮件语言设置
continuous-integration/drone/push Build is passing
2026-05-15 13:31:58 +08:00
hang 24dfa32ad4 优化liquid 生成模板
continuous-integration/drone/push Build is running
2026-05-14 11:11:26 +08:00
hang 1f9d9b2831 修改文档统计数字
continuous-integration/drone/push Build is failing
2026-05-14 09:06:21 +08:00
he 6211506aee Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-13 17:54:50 +08:00
he e1bd659dc5 过期邮件修改 2026-05-13 17:54:48 +08:00
hang b56d45f411 外部人员邮件
continuous-integration/drone/push Build is running
2026-05-13 16:45:23 +08:00
hang 35a2a0cc61 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-13 16:02:02 +08:00
hang ff43a5e71b 修改创建用户语言赋值 2026-05-13 16:02:01 +08:00
hang 8bdbc67535 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-13 15:20:22 +08:00
hang 85261bc3cf 入组和PD 邮件修改 2026-05-13 15:20:21 +08:00
he 311359f6b8 邮件内容修改
continuous-integration/drone/push Build is running
2026-05-13 14:38:13 +08:00
he 0cb3646554 修改邮件中英文
continuous-integration/drone/push Build is running
2026-05-13 14:25:24 +08:00
he cd02042d63 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is pending
2026-05-13 13:40:44 +08:00
he db73a841b2 修改删除阅片期操作逻辑 2026-05-13 13:40:43 +08:00
hang a3e773cb4f Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8 2026-05-13 13:36:07 +08:00
hang 09ed4adc93 访视质控以及一致性核查相关邮件根据收件人工作语言进行分组发送 2026-05-13 13:36:06 +08:00
he 530e4d412c Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-13 13:29:08 +08:00
he bff593394f 重新发布 2026-05-13 13:29:07 +08:00
hang 32c38e9f95 整理MailServer 修改发送邮件根据工作语言
continuous-integration/drone/push Build is running
2026-05-13 13:08:49 +08:00
hang 005b0b9e0d Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-13 11:05:25 +08:00
hang fdb124b12e 邮件根据接收人工作语言,动态设置邮件模板 2026-05-13 11:05:22 +08:00
he 652a446737 修改阅片期删除的逻辑
continuous-integration/drone/push Build is running
2026-05-13 10:47:56 +08:00
he 098196b599 修改分割版本
continuous-integration/drone/push Build is running
2026-05-12 17:05:31 +08:00
he 01c5b96bc7 修改
continuous-integration/drone/push Build is passing
2026-05-12 16:33:17 +08:00
he 334743f3f0 修改分割
continuous-integration/drone/push Build is running
2026-05-12 16:17:14 +08:00
he bd60f48cd1 修改版本
continuous-integration/drone/push Build is running
2026-05-12 15:32:16 +08:00
he 4fe915cfd8 修改版本 2026-05-12 15:24:02 +08:00
he 14cc78cffc 修改
continuous-integration/drone/push Build is passing
2026-05-12 14:46:34 +08:00
he a04ae45402 修改 2026-05-12 14:40:32 +08:00
he 0f68f170ad 重新发布
continuous-integration/drone/push Build is running
2026-05-12 14:29:05 +08:00
he 4033c8d004 重新发布 2026-05-12 14:23:38 +08:00
he 68d320d9cf Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
2026-05-12 14:10:25 +08:00
he 603a522c4b 修改历史版本 2026-05-12 14:10:22 +08:00
hang 030aa36f94 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2026-05-12 11:45:56 +08:00
hang 577f35a3fe 用户增加工作语言,系统文档增加文档适用语言用户 2026-05-12 11:45:55 +08:00
he 790ac40f4e 生成历史版本逻辑修改
continuous-integration/drone/push Build is running
2026-05-11 16:30:33 +08:00
he 44d9c23c0c 添加字段
continuous-integration/drone/push Build is passing
2026-05-11 15:33:41 +08:00
he 547bd54085 修改
continuous-integration/drone/push Build is running
2026-05-11 14:48:13 +08:00
hang d98d8a0729 放开非肿瘤CDISC导出限制
continuous-integration/drone/push Build is passing
2026-03-18 15:56:37 +08:00
he 2ab8323291 OCT修改3
continuous-integration/drone/push Build is passing
2026-03-18 11:00:19 +08:00
he 1ac6bcd79f OCT修改2 2026-03-18 11:00:17 +08:00
he 3eab14960e OCT IVUS 修改1 2026-03-18 11:00:15 +08:00
hang bccb9bbbbb 增加查询条件以及导表修改
continuous-integration/drone/push Build is passing
2026-03-09 09:51:27 +08:00
hang fa29e1a53c 修改域名拼写错误
continuous-integration/drone/push Build is passing
2026-03-06 15:55:38 +08:00
hang f790193350 增加通知企业微信
continuous-integration/drone/push Build is passing
2026-03-06 15:37:05 +08:00
123 changed files with 204050 additions and 22089 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Extention;
using IRaCIS.Core.SCP.Service;
using MassTransit;
using Medallion.Threading;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
using Microsoft.Extensions.DependencyInjection;
@@ -95,7 +96,7 @@ namespace IRaCIS.Core.SCP.Service
public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
{
_upload = new SCPImageUpload() { StartTime = DateTime.Now, CallingAE = association.CallingAE, CalledAE = association.CalledAE, CallingAEIP = association.RemoteHost };
_upload = new SCPImageUpload() { Id = NewId.NextSequentialGuid(), StartTime = DateTime.Now, CallingAE = association.CallingAE, CalledAE = association.CalledAE, CallingAEIP = association.RemoteHost };
Log.Logger.Warning($"接收到来自{association.CallingAE}的连接");
@@ -644,7 +645,7 @@ namespace IRaCIS.Core.SCP.Service
ms.Position = 0;
//irc 从路径最后一截取Guid
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive });
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive, UploadBatchId = _upload.Id.ToString() });
fileSize = ms.Length;
@@ -63,6 +63,8 @@ public class FileUploadRecordAddOrEdit
public bool? IsNeedSync { get; set; }
public string UploadRegion { get; set; }
public string TargetRegion { get; set; }
public bool? IsSync { get; set; }
}
public interface IFileUploadRecordService
{
@@ -113,6 +115,19 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
}
}
//SCP推送过来IP为空,后端归档的,设置区域
if (_userInfo.IP.IsNullOrEmpty() && _userInfo.Domain.IsNullOrEmpty())
{
var apiDefalut = ObjectStoreServiceConfig.SyncConfigList.FirstOrDefault(t => t.UploadRegion == ObjectStoreServiceConfig.ApiDeployRegion);
if (apiDefalut != null)
{
addOrEditFileUploadRecord.UploadRegion = apiDefalut.UploadRegion;
addOrEditFileUploadRecord.TargetRegion = apiDefalut.TargetRegion;
}
}
if (addOrEditFileUploadRecord.TrialId != null)
{
@@ -129,9 +144,9 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
{
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.Priority = 0;
addOrEditFileUploadRecord.Priority = addOrEditFileUploadRecord.Priority ?? 0;
addOrEditFileUploadRecord.IsSync = false;
}
else
{
@@ -147,7 +162,9 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
//系统文件,默认同步
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.Priority = 0;
addOrEditFileUploadRecord.IsSync = false;
addOrEditFileUploadRecord.Priority = addOrEditFileUploadRecord.Priority ?? 0;
}
var entity = await _fileUploadRecordRepository.InsertOrUpdateAsync(addOrEditFileUploadRecord, true);
+101 -38
View File
@@ -194,7 +194,7 @@ public interface IOSSService
List<string> GetRootFolderNames();
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null);
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null);
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
@@ -825,10 +825,12 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
if (ObjectStoreServiceOptions.IsOpenStoreSync && uploadInfo != null)
{
var fileType = Path.GetExtension(returnPath).TrimStart('.');
uploadInfo.FileSize = fileStream.CanSeek ? fileStream.Length : 0;
uploadInfo.Path = returnPath;
uploadInfo.FileName = fileRealName;
uploadInfo.FileType = Path.GetExtension(returnPath);
uploadInfo.FileType = fileType.IsNullOrEmpty()?"dcm": fileType;
await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo);
@@ -964,10 +966,14 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
if (ObjectStoreServiceOptions.IsOpenStoreSync && uploadInfo != null)
{
var fileType = Path.GetExtension(returnPath).TrimStart('.');
uploadInfo.FileSize = fileSize;
uploadInfo.Path = returnPath;
uploadInfo.FileName = Path.GetFileName(localFilePath);
uploadInfo.FileType = Path.GetExtension(returnPath);
uploadInfo.FileType = fileType.IsNullOrEmpty() ? "dcm" : fileType;
await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo);
@@ -1856,23 +1862,39 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null)
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null)
{
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty())
string objectStoreUse = string.Empty;
//使用指定配置
if (objectUse != null)
{
var userDomain = domain?.Trim();
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == userDomain);
if (find != null)
objectStoreUse = objectUse?.Trim() ?? string.Empty;
}
//根据域名动态判断
else
{
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty() && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.Domain == domain))
{
ObjectStoreServiceOptions.ObjectStoreUse = find.Primary;
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == domain);
if (find != null)
{
objectStoreUse = find.Primary;
}
}
else
{
//兜底,如果是本地测试环境,那就使用部署默认配置
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
}
}
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS" || isGetAllTempToken == true)
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
if (objectStoreUse == "AliyunOSS" || isGetAllTempToken == true)
{
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
@@ -1920,11 +1942,11 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
objectStoreDTO.AliyunOSS = tempToken;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
if (objectStoreUse == "MinIO")
{
objectStoreDTO.MinIO = ObjectStoreServiceOptions.MinIO;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS" || isGetAllTempToken == true)
if (objectStoreUse == "AWS" || isGetAllTempToken == true)
{
var awsOptions = ObjectStoreServiceOptions.AWS;
@@ -1969,7 +1991,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
objectStoreDTO.AWS = tempToken;
}
else
if (objectStoreUse.IsNullOrEmpty())
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
@@ -1980,7 +2003,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public async Task SyncFileAsync(string objectKey, ObjectStoreUse source, ObjectStoreUse destination, CancellationToken ct = default)
{
GetObjectStoreTempToken(isGetAllTempToken: true);
var tempConfig = GetObjectStoreTempToken(isGetAllTempToken: true);
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
@@ -1999,36 +2022,76 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
// ⭐ 关键变量
IDisposable? owner = null;
Stream sourceStream;
long contentLength;
// 根据源选择流式下载
Stream sourceStream = source switch
// ========= 获取流 + 长度 =========
switch (source)
{
ObjectStoreUse.AliyunOSS => _ossClient.GetObject(aliConfig.BucketName, objectKey).Content,
ObjectStoreUse.AWS => (await amazonS3Client.GetObjectAsync(awsConfig.BucketName, objectKey, ct)).ResponseStream,
_ => throw new BusinessValidationFailedException("未定义的同步类型")
};
case ObjectStoreUse.AliyunOSS:
{
if (source == ObjectStoreUse.AliyunOSS)
var obj = _ossClient.GetObject(
aliConfig.BucketName,
objectKey);
owner = obj;
sourceStream = obj.Content;
contentLength = obj.ContentLength;
break;
}
case ObjectStoreUse.AWS:
{
var response = await amazonS3Client.GetObjectAsync(
awsConfig.BucketName,
objectKey,
ct);
owner = response;
sourceStream = response.ResponseStream;
contentLength = response.Headers.ContentLength;
break;
}
default:
throw new BusinessValidationFailedException("未定义的同步类型");
}
try
{
var putRequest = new Amazon.S3.Model.PutObjectRequest
// ========= 上传 =========
if (destination == ObjectStoreUse.AWS)
{
BucketName = awsConfig.BucketName,
Key = objectKey,
InputStream = sourceStream
};
var putRequest = new Amazon.S3.Model.PutObjectRequest
{
BucketName = awsConfig.BucketName,
Key = objectKey,
InputStream = sourceStream,
Headers = { ContentLength = contentLength }
};
await amazonS3Client.PutObjectAsync(putRequest, ct);
await amazonS3Client.PutObjectAsync(putRequest, ct);
}
else if (destination == ObjectStoreUse.AliyunOSS)
{
_ossClient.PutObject(
aliConfig.BucketName,
objectKey,
sourceStream);
}
else
{
throw new BusinessValidationFailedException("未定义的同步类型");
}
}
else if (source == ObjectStoreUse.AWS)
finally
{
_ossClient.PutObject(aliConfig.BucketName, objectKey, sourceStream);
// ⭐⭐⭐ 真正释放 HTTP 连接
owner?.Dispose();
}
else
{
throw new BusinessValidationFailedException("未定义的同步类型");
}
await sourceStream.DisposeAsync(); // 释放流
}
}
+16
View File
@@ -0,0 +1,16 @@
using AutoMapper;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.SCP.Service;
namespace IRaCIS.Core.Application.Service
{
public class CommonConfig : Profile
{
public CommonConfig()
{
CreateMap<FileUploadRecordAddOrEdit, FileUploadRecord>().ReverseMap();
}
}
}
@@ -8,6 +8,26 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "eiirc.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
@@ -19,6 +39,18 @@
"ViewEndpoint": "https://zy-irc-cache.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
"UseSSL": true,
"RoleArn": "arn:aws:iam::471112624751:role/lili_s3_access",
"AccessKeyId": "AKIAW3MEAFJXZ2TZK7GM",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-irc-store",
"ViewEndpoint": "https://ei-med-s3-irc-store.s3.amazonaws.com",
"DurationSeconds": 7200
}
},
@@ -7,7 +7,28 @@
}
},
"ObjectStoreService": {
// 使用的对象存储服务类型
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.test.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.test.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
@@ -29,6 +50,27 @@
"secretKey": "TzgvyA3zGXMUnpilJNUlyMYHfosl1hBMl6lxPmjy",
"bucketName": "hir-test",
"viewEndpoint": "http://106.14.89.110:9001/hir-test/"
},
// AWS S3 对象存储服务的配置
"AWS": {
// AWS S3 的Region
"Region": "us-east-1",
// AWS S3 的内部访问端点
"EndPoint": "s3.us-east-1.amazonaws.com",
// 是否使用 SSL
"UseSSL": true,
// AWS S3 的角色 ARN
"RoleArn": "arn:aws:iam::471112624751:role/uat_s3_access",
// AWS S3 的访问密钥 ID
"AccessKeyId": "AKIAW3MEAFJX7IPXISP4",
// AWS S3 的访问密钥 Secret
"SecretAccessKey": "Pgrg3le5jPxZQ7MR1yYNS30J0XRyJeKVyIIjElXc",
// AWS S3 的Bucket名称
"BucketName": "ei-med-s3-lili-uat-store",
// AWS S3 的访问端点
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com",
// AWS S3 的持续数秒
"DurationSeconds": 7200
}
},
+32
View File
@@ -8,6 +8,38 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AWS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "US",
"SyncConfigList": [
{
"Domain": "eilili.elevateimaging.ai",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.elevateimaging.ai",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tNRTsqL6aWmHkDmTwoH",
"AccessKeySecret": "7mtGz3qrYWI6JMMBZiLeC119VWicZH",
"RoleArn": "acs:ram::1899121822495495:role/irc-oss-access",
"BucketName": "zy-lili-store",
"ViewEndpoint": "https://zy-lili-cache.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
+46 -5
View File
@@ -8,17 +8,58 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.uat.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.uat.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tFUCCmz5TwghZHsj45Y",
"AccessKeySecret": "8evrBy1fVfzJG25i67Jm0xqn9Xcw2T",
"RoleArn": "acs:ram::1078130221702011:role/uat-oss-access",
"BucketName": "tl-med-irc-uat-store",
"ViewEndpoint": "https://tl-med-irc-uat-store.oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tRRZehUp2V9pyTPtAJm",
"AccessKeySecret": "FLizxkHsMm4CGYHtkV8E3PNJJZU7oV",
"RoleArn": "acs:ram::1899121822495495:role/dev-oss-access",
"BucketName": "zy-irc-test-store",
"ViewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
// AWS S3 对象存储服务的配置
"AWS": {
// AWS S3 的Region
"Region": "us-east-1",
// AWS S3 的内部访问端点
"EndPoint": "s3.us-east-1.amazonaws.com",
// 是否使用 SSL
"UseSSL": true,
// AWS S3 的角色 ARN
"RoleArn": "arn:aws:iam::471112624751:role/uat_s3_access",
// AWS S3 的访问密钥 ID
"AccessKeyId": "AKIAW3MEAFJX7IPXISP4",
// AWS S3 的访问密钥 Secret
"SecretAccessKey": "Pgrg3le5jPxZQ7MR1yYNS30J0XRyJeKVyIIjElXc",
// AWS S3 的Bucket名称
"BucketName": "ei-med-s3-lili-uat-store",
// AWS S3 的访问端点
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com",
// AWS S3 的持续数秒
"DurationSeconds": 7200
}
},
"ConnectionStrings": {
@@ -857,7 +857,7 @@ namespace IRaCIS.Core.API.Controllers
throw new BusinessValidationFailedException(_localizer["UploadDownLoad_TemplateUploadData"]);
}
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/SiteSurvey", realFileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId ,BatchDataType=BatchDataType.SiteUserSurvey});
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/SiteSurvey", realFileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId, BatchDataType = BatchDataType.SiteUserSurvey });
await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = realFileName, RelativePath = ossRelativePath, TrialId = trialId }, true);
@@ -933,7 +933,7 @@ namespace IRaCIS.Core.API.Controllers
}
//处理好 用户类型 和用户类型枚举
var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList();
var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, TrialSiteId = t.Id }).ToList();
var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, TrialSiteId = t.Id, t.Country }).ToList();
foreach (var item in excelList)
{
@@ -955,6 +955,8 @@ namespace IRaCIS.Core.API.Controllers
}
item.TrialSiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.Trim().ToUpper() == item.TrialSiteCode.Trim().ToUpper()).TrialSiteId;
item.Country = siteList.FirstOrDefault(t => t.TrialSiteCode.Trim().ToUpper() == item.TrialSiteCode.Trim().ToUpper()).Country;
}
var list = excelList.Where(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.CRA).ToList();
+2 -1
View File
@@ -65,7 +65,8 @@ SerilogExtension.AddSerilogSetup(enviromentName);
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
EnvironmentName = enviromentName
EnvironmentName = enviromentName,
Args = args
});
#region
@@ -33,11 +33,11 @@
},
"applicationUrl": "http://0.0.0.0:6100"
},
"IRaCIS.Event_IRC": {
"IRaCIS.Prod_Event_IRC": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Event_IRC"
"ASPNETCORE_ENVIRONMENT": "Prod_Event_IRC"
},
"applicationUrl": "http://0.0.0.0:6100"
},
@@ -46,19 +46,19 @@ namespace IRaCIS.Core.API
var emailConfig = new SystemEmailSendConfig();
configuration.GetSection("SystemEmailSendConfig").Bind(emailConfig);
if (emailConfig.IsOpenErrorNoticeEmail)
{
config.WriteTo.Email(options: new Serilog.Sinks.Email.EmailSinkOptions()
{
From = emailConfig.FromEmail,
To = emailConfig.ErrorNoticeEmailList,
Host = emailConfig.Host,
Port = emailConfig.Port,
Subject = new MessageTemplateTextFormatter("Log Alert - 系统发生了异常,请核查"),
Credentials = new NetworkCredential(emailConfig.FromEmail, emailConfig.AuthorizationCode)
//if (emailConfig.IsOpenErrorNoticeEmail)
//{
// config.WriteTo.Email(options: new Serilog.Sinks.Email.EmailSinkOptions()
// {
// From = emailConfig.FromEmail,
// To = emailConfig.ErrorNoticeEmailList,
// Host = emailConfig.Host,
// Port = emailConfig.Port,
// Subject = new MessageTemplateTextFormatter("Log Alert - 系统发生了异常,请核查"),
// Credentials = new NetworkCredential(emailConfig.FromEmail, emailConfig.AuthorizationCode)
}, restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Error);
}
// }, restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Error);
//}
#endregion
Log.Logger = config.CreateLogger();
+42 -41
View File
@@ -7,8 +7,10 @@
}
},
"ConnectionStrings": {
"RemoteNew": "Server=101.132.253.119,1435;Database=irc_Prpd_bak;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
"Hangfire": "Server=101.132.253.119,1435;Database=irc_Hangfire_bak;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
"RemoteNew": "Server=101.132.193.237,1433;Database=Prod_IRC_pidr_restore;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
"Hangfire": "Server=101.132.193.237,1433;Database=irc_Hangfire_bak;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
//"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
//"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
},
"WeComNoticeConfig": {
"IsOpenWeComNotice": true,
@@ -17,48 +19,51 @@
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621b97b96f74e6f3d" ]
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "eiirc.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tFUCCmz5TwghZHsj45Y",
"AccessKeySecret": "8evrBy1fVfzJG25i67Jm0xqn9Xcw2T",
"RoleArn": "acs:ram::1078130221702011:role/uat-oss-access",
"BucketName": "tl-med-irc-event-store",
"ViewEndpoint": "https://tl-med-irc-event-store.oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tNRTsqL6aWmHkDmTwoH",
"AccessKeySecret": "7mtGz3qrYWI6JMMBZiLeC119VWicZH",
"RoleArn": "acs:ram::1899121822495495:role/irc-oss-access",
"BucketName": "zy-irc-store",
"ViewEndpoint": "https://zy-irc-cache.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"MinIO": {
"endPoint": "hir-oss.uat.extimaging.com",
"port": "80",
"useSSL": false,
"viewEndpoint": "http://hir-oss.uat.extimaging.com/irc-uat",
//"port": "443",
//"useSSL": true,
//"viewEndpoint": "https://hir-oss.uat.extimaging.com/irc-uat",
"accessKey": "b9Ul0e98xPzt6PwRXA1Q",
"secretKey": "DzMaU2L4OXl90uytwOmDXF2encN0Jf4Nxu2XkYqQ",
"bucketName": "irc-uat"
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
"UseSSL": true,
"RoleArn": "arn:aws:iam::471112624751:role/sts_s3_upload",
"AccessKeyId": "AKIAW3MEAFJXWRCGSX5Z",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-lili-uat-store",
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com/",
"RoleArn": "arn:aws:iam::471112624751:role/lili_s3_access",
"AccessKeyId": "AKIAW3MEAFJXZ2TZK7GM",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-irc-store",
"ViewEndpoint": "https://ei-med-s3-irc-store.s3.amazonaws.com",
"DurationSeconds": 7200
}
},
"BasicSystemConfig": {
// 启用质控风险控制功能
"QCRiskControl": true,
@@ -67,7 +72,6 @@
"OpenLoginLimit": true,
"LoginMaxFailCount": 5,
"LoginFailLockMinutes": 30,
"AutoLoginOutMinutes": 120,
@@ -82,17 +86,17 @@
"TemplateType": 2,
//MFA免验证发送天数
"UserMFAVerifyMinutes": 1440
},
"SystemEmailSendConfig": {
"Port": 465,
"Host": "smtp.qiye.aliyun.com",
"Imap": "imap.qiye.aliyun.com",
"ImapPort": 993,
"FromEmail": "uat@extimaging.com",
"FromName": "Uat IRC Imaging System",
"AuthorizationCode": "SHzyyl2021",
"SiteUrl": "http://irc.uat.extimaging.com/login",
"FromEmail": "irc@extimaging.com",
"FromName": "IRC Imaging System",
"AuthorizationCode": "ExtImg@2022",
"SiteUrl": "http://irc.extimaging.com/login",
"PlatformName": "EICS",
"PlatformNameCN": "展影云平台",
@@ -104,15 +108,12 @@
"CompanyShortName": "Extensive Imaging",
"CompanyShortNameCN": "展影医疗",
"IsEnv_US": false,
"IsOpenErrorNoticeEmail": false,
"EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"CronEmailDefaultCulture": "zh-CN",
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
"CronEmailDefaultCulture": "zh-CN"
},
"SystemPacsConfig": {
"Port": "11116",
"IP": "101.132.253.119"
"Port": "11113",
"IP": "101.132.193.237"
},
"RequestDuplicationOptions": {
"IsEnabled": true,
+35 -14
View File
@@ -7,10 +7,10 @@
}
},
"ConnectionStrings": {
"RemoteNew": "Server=10.10.10.49,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
"Hangfire": "Server=10.10.10.49,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
//"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
//"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
//"RemoteNew": "Server=10.10.10.49,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
//"Hangfire": "Server=10.10.10.49,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
},
"WeComNoticeConfig": {
"IsOpenWeComNotice": true,
@@ -20,6 +20,26 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "eiirc.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
@@ -32,13 +52,16 @@
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"MinIO": {
"endpoint": "http://192.168.3.68",
"port": "8001",
"useSSL": false,
"accessKey": "IDFkwEpWej0b4DtiuThL",
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h",
"bucketName": "test"
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
"UseSSL": true,
"RoleArn": "arn:aws:iam::471112624751:role/lili_s3_access",
"AccessKeyId": "AKIAW3MEAFJXZ2TZK7GM",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-irc-store",
"ViewEndpoint": "https://ei-med-s3-irc-store.s3.amazonaws.com",
"DurationSeconds": 7200
}
},
"BasicSystemConfig": {
@@ -85,10 +108,8 @@
"CompanyShortName": "Extensive Imaging",
"CompanyShortNameCN": "展影医疗",
"IsEnv_US": false,
"IsOpenErrorNoticeEmail": false,
"EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"CronEmailDefaultCulture": "zh-CN",
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
"CronEmailDefaultCulture": "zh-CN"
},
"SystemPacsConfig": {
"Port": "11113",
+15 -13
View File
@@ -149,14 +149,15 @@
},
// 邮件服务配置(用于系统通知、找回密码、错误报警等)
"SystemEmailSendConfig": {
// SMTP端口
"Port": 465,
// 企业邮箱SMTP服务器地址
"Host": "smtp.qiye.aliyun.com",
// SMTP端口
"Port": 465,
"Imap": "imap.qiye.aliyun.com",
"ImapPort": 993,
// 发件人邮箱地址
"FromEmail": "test@extimaging.com",
// 发件人显示名称
@@ -166,14 +167,16 @@
// 系统对外访问地址
"SiteUrl": "http://irc.test.extimaging.com/login",
"PlatformName": "EICS",
"PlatformNameCN": "展影云平台",
// 系统简称一致性核查使用
// 系统简称 - 一致性核查使用
"SystemShortName": "IRC",
// 组织英文名称
// 组织英文名称-添加用户默认值
"OrganizationName": "ExtImaging",
// 组织中文名称
"OrganizationNameCN": "ExtImaging",
"PlatformName": "EICS",
"PlatformNameCN": "展影云平台",
// 公司英文全称
"CompanyName": "Extensive Imaging",
// 公司中文全称
@@ -182,15 +185,14 @@
"CompanyShortName": "Extensive Imaging",
// 公司中文简称
"CompanyShortNameCN": "展影医疗",
// 是否为国际版环境
// 是否为国际版环境 方便前端区分,用于区分lili 还是irc 做一些事情
"IsEnv_US": false,
// 是否开启系统异常邮件报警
"IsOpenErrorNoticeEmail": false,
// 邮箱格式校验正则表达式
"EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"CronEmailDefaultCulture": "zh-CN",
// 接收系统异常报警的邮箱列表
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
//后端周期性邮件默认语言
"CronEmailDefaultCulture": "zh-CN"
},
// PACS 连接配置
"SystemPacsConfig": {
+32 -12
View File
@@ -20,16 +20,38 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AWS",
"MinIO": {
"endPoint": "44.210.231.169",
"port": "9001",
"useSSL": false,
"accessKey": "e9bT1isTOqSAUxb6wd4n",
"secretKey": "b5TaDzNdQCBtCvfm8eZ3dR6yY7tfZu2JYze2Po1i",
"bucketName": "prod-irc-us",
"viewEndpoint": "http://44.210.231.169:9001/prod-irc-us/"
"IsOpenStoreSync": true,
"ApiDeployRegion": "US",
"SyncConfigList": [
{
"Domain": "eilili.elevateimaging.ai",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.elevateimaging.ai",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tNRTsqL6aWmHkDmTwoH",
"AccessKeySecret": "7mtGz3qrYWI6JMMBZiLeC119VWicZH",
"RoleArn": "acs:ram::1899121822495495:role/irc-oss-access",
"BucketName": "zy-lili-store",
"ViewEndpoint": "https://zy-lili-cache.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
@@ -90,10 +112,8 @@
"CompanyShortNameCN": "展影医疗",
"SiteUrl": "https://lili.elevateimaging.ai/login",
"IsEnv_US": true,
"IsOpenErrorNoticeEmail": false,
"EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"CronEmailDefaultCulture": "en-US",
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
"CronEmailDefaultCulture": "en-US"
},
"SystemPacsConfig": {
+1 -3
View File
@@ -93,9 +93,7 @@
"CompanyShortName": "Elevate Imaging",
"CompanyShortNameCN": "展影医疗",
"SiteUrl": "https://lili.test.elevateimaging.ai/login",
"IsEnv_US": true,
"IsOpenErrorNoticeEmail": false,
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
"IsEnv_US": true
},
"SystemPacsConfig": {
+1 -3
View File
@@ -97,10 +97,8 @@
"CompanyShortNameCN": "展影医疗",
"SiteUrl": "https://lili.uat.elevateimaging.ai/login",
"IsEnv_US": true,
"IsOpenErrorNoticeEmail": false,
"EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"CronEmailDefaultCulture": "en-US",
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
"CronEmailDefaultCulture": "en-US"
},
"SystemPacsConfig": {
+24 -6
View File
@@ -19,6 +19,26 @@
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.uat.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.uat.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
@@ -50,9 +70,9 @@
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
"UseSSL": true,
"RoleArn": "arn:aws:iam::471112624751:role/sts_s3_upload",
"AccessKeyId": "AKIAW3MEAFJXWRCGSX5Z",
"SecretAccessKey": "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",
"RoleArn": "arn:aws:iam::471112624751:role/uat_s3_access",
"AccessKeyId": "AKIAW3MEAFJX7IPXISP4",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-lili-uat-store",
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com/",
"DurationSeconds": 7200
@@ -104,10 +124,8 @@
"CompanyShortName": "Extensive Imaging",
"CompanyShortNameCN": "展影医疗",
"IsEnv_US": false,
"IsOpenErrorNoticeEmail": false,
"EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"CronEmailDefaultCulture": "zh-CN",
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
"CronEmailDefaultCulture": "zh-CN"
},
"SystemPacsConfig": {
+2 -1
View File
@@ -39,7 +39,8 @@ namespace IRaCIS.Core.Application.Auth
new Claim(JwtIRaCISClaimType.UserTypeShortName,user.UserTypeShortName),
new Claim(JwtIRaCISClaimType.PermissionStr,user.PermissionStr),
new Claim(JwtIRaCISClaimType.IsZhiZhun,user.IsZhiZhun.ToString()),
new Claim(JwtIRaCISClaimType.IsTestUser,user.IsTestUser.ToString())
new Claim(JwtIRaCISClaimType.IsTestUser,user.IsTestUser.ToString()),
new Claim(JwtIRaCISClaimType.UserWorkLanguage,user.UserWorkLanguage.ToString())
};
////创建令牌
@@ -23,5 +23,7 @@ namespace IRaCIS.Core.Application.Auth
public bool IsZhiZhun { get; set; }
public string UserTypeShortName { get; set; } = string.Empty;
public UserWorkLanguage UserWorkLanguage { get; set; }
}
}
@@ -70,6 +70,10 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
{
this.RequestDuplication();
}
catch (BusinessValidationFailedException)
{
throw;
}
catch (Exception)
{
@@ -91,6 +95,8 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
// 验证请求频繁情况
if (
requestPath == "/ReadingImageTask/changeDicomReadingQuestionAnswer"&&
!requestPath
.Split("/", StringSplitOptions.RemoveEmptyEntries)
.Any(segment => segment.StartsWith("get", StringComparison.OrdinalIgnoreCase)) &&
@@ -106,17 +112,14 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
RequestTime = DateTime.Now
};
IRCSystemInfo.RequestRecordList= IRCSystemInfo.RequestRecordList.Where(x => x.RequestTime >= DateTime.Now.AddSeconds(-RequestDuplicationOptionsMonitor.CurrentValue.CacheTimeSeconds)).ToList();
var requestsTimes = IRCSystemInfo.RequestRecordList.Any(x=>
x.RequestTime>= requestInfo.RequestTime.AddMilliseconds(-RequestDuplicationOptionsMonitor.CurrentValue.DuplicationWindowMs)&&
x.RequestKey== requestInfo.RequestKey);
if (requestsTimes)
var isAdded = IRCSystemInfo.TryAddRequestRecord(
requestInfo,
RequestDuplicationOptionsMonitor.CurrentValue.CacheTimeSeconds,
RequestDuplicationOptionsMonitor.CurrentValue.DuplicationWindowMs);
if (!isAdded)
{
throw new BusinessValidationFailedException(_localizer["RequestDuplicationFilter_RequestDuplication"], ApiResponseCodeEnum.BusinessValidationFailed);
}
IRCSystemInfo.RequestRecordList.Add(requestInfo);
}
}
@@ -79,11 +79,12 @@ public class SystemEmailSendConfig
public bool IsEnv_US { get; set; }
public bool IsOpenErrorNoticeEmail { get; set; }
public string EmailRegexStr { get; set; }
public List<string> ErrorNoticeEmailList { get; set; } = new List<string>();
//public bool IsOpenErrorNoticeEmail { get; set; }
//public List<string> ErrorNoticeEmailList { get; set; } = new List<string>();
}
public class SystemEmailSendConfigView
@@ -145,6 +146,31 @@ public class RequestDuplicationOptions
public static class IRCSystemInfo
{
public static List<RequestInfo> RequestRecordList { get; set; } = new List<RequestInfo>();
private static readonly object requestRecordLock = new object();
public static bool TryAddRequestRecord(RequestInfo requestInfo, int cacheTimeSeconds, int duplicationWindowMs)
{
lock (requestRecordLock)
{
var now = DateTime.Now;
RequestRecordList = RequestRecordList
.Where(x => x.RequestTime >= now.AddSeconds(-cacheTimeSeconds))
.ToList();
var isDuplicate = RequestRecordList.Any(x =>
x.RequestTime >= requestInfo.RequestTime.AddMilliseconds(-duplicationWindowMs) &&
x.RequestKey == requestInfo.RequestKey);
if (isDuplicate)
{
return false;
}
RequestRecordList.Add(requestInfo);
return true;
}
}
}
public class RequestInfo
@@ -235,4 +261,4 @@ public static class AppSettings
}
}
}
@@ -3,6 +3,7 @@ using FellowOakDicom;
using FellowOakDicom.Media;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Data;
@@ -160,6 +161,91 @@ namespace IRaCIS.Core.Application.Helper
}
public static async Task GenerateStudyDIR(List<StudyDIRInfo> list, Dictionary<string, string> dic, string? dirSavePath = null, Stream? outputStream = null)
{
var mappings = new List<string>();
int index = 1;
var trialId = Guid.Empty;
var studyUid = list.FirstOrDefault()?.StudyInstanceUid;
var dicomDir = new DicomDirectory();
foreach (var item in list.OrderBy(t => t.SeriesNumber).ThenBy(t => t.InstanceNumber))
{
var dicomUid = DicomUID.Enumerate().FirstOrDefault(uid => uid.UID == item.TransferSytaxUID);
if (dicomUid != null)
{
var ts = DicomTransferSyntax.Query(dicomUid);
var dataset = new DicomDataset(ts)
{
{ DicomTag.PatientID, item.PatientId ?? string.Empty },
{ DicomTag.PatientName, item.PatientName ?? string.Empty },
{ DicomTag.PatientBirthDate, item.PatientBirthDate ?? string.Empty },
{ DicomTag.PatientSex, item.PatientSex ?? string.Empty },
{ DicomTag.StudyInstanceUID, item.StudyInstanceUid ?? string.Empty },
{ DicomTag.StudyID, item.StudyId ?? string.Empty },
{ DicomTag.StudyDate, item.DicomStudyDate ?? string.Empty },
{ DicomTag.StudyTime, item.DicomStudyTime ?? string.Empty },
{ DicomTag.AccessionNumber, item.AccessionNumber ?? string.Empty },
{ DicomTag.StudyDescription, item.StudyDescription ?? string.Empty },
{ DicomTag.SeriesInstanceUID, item.SeriesInstanceUid ?? string.Empty },
{ DicomTag.Modality, item.Modality ?? string.Empty },
{ DicomTag.SeriesDate, item.DicomSeriesDate ?? string.Empty },
{ DicomTag.SeriesTime, item.DicomSeriesTime ?? string.Empty },
{ DicomTag.SeriesNumber, item.SeriesNumber.ToString() ?? string.Empty },
{ DicomTag.SeriesDescription, item.SeriesDescription ?? string.Empty },
{ DicomTag.SOPInstanceUID, item.SopInstanceUid ?? string.Empty },
{ DicomTag.SOPClassUID, item.SOPClassUID ?? string.Empty },
{ DicomTag.InstanceNumber, item.InstanceNumber.ToString() ?? string.Empty },
{ DicomTag.MediaStorageSOPClassUID, item.MediaStorageSOPClassUID ?? string.Empty },
{ DicomTag.MediaStorageSOPInstanceUID, item.MediaStorageSOPInstanceUID ?? string.Empty },
{ DicomTag.TransferSyntaxUID, item.TransferSytaxUID ?? string.Empty },
};
var dicomFile = new DicomFile(dataset);
// 文件名递增格式:IM_00001, IM_00002, ...
string filename = $@"IMAGE\IM_{index:D5}"; // :D5 表示补足5位
mappings.Add($"{filename} => {item.InstanceId}");
dic.Add(item.InstanceId.ToString(), filename.TrimEnd('/', '\\').Split('/', '\\').Last());
dicomDir.AddFile(dicomFile, filename);
index++;
}
}
//有实际的文件
if (mappings.Count > 0)
{
// 保存 DICOMDIR 到临时文件 不能直接写入到流种
if (dirSavePath.IsNotNullOrEmpty())
{
await dicomDir.SaveAsync(dirSavePath);
}
else
{
await dicomDir.SaveAsync(outputStream);
}
}
}
public static StudyDIRInfo ReadDicomDIRInfo(DicomFile dicomFile)
{
@@ -17,7 +17,7 @@ public static class SendEmailHelper
//没有收件人 那么不发送
if (messageToSend.To.Count == 0)
{
{
return string.Empty;
}
@@ -62,8 +62,15 @@ public static class SendEmailHelper
}
public static async Task<string> SendEmailAsync(MimeMessage messageToSend, Trial trial, EventHandler<MessageSentEventArgs>? messageSentSuccess = null)
/// <summary>
/// 发送项目邮件
/// </summary>
/// <param name="messageToSend"></param>
/// <param name="trial"></param>
/// <param name="messageSentSuccess"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static async Task<string> SendTrialEmailAsync(MimeMessage messageToSend, Trial trial, EventHandler<MessageSentEventArgs>? messageSentSuccess = null)
{
// 项目的需要重设 发件地址与邮件地址
@@ -78,12 +85,39 @@ public static class SendEmailHelper
string result = string.Empty;
result = messageToSend.MessageId;
//没有收件人 那么不发送
if (messageToSend.To.Count == 0)
{
return string.Empty;
}
// 替换邮件标题
if (!string.IsNullOrEmpty(messageToSend.Subject))
{
foreach (var item in trial.TrialObjectNameList)
{
// 把标题里的占位符替换成真实名称
messageToSend.Subject = messageToSend.Subject.Replace(item.Name, item.TrialName);
}
}
// 构建替换字典
var replacements = new Dictionary<string, string>();
foreach (var item in trial.TrialObjectNameList)
{
replacements[item.Name] = item.TrialName;
}
// 安全替换 HTML
ReplaceHtmlContent(messageToSend.Body, replacements);
try
{
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
@@ -128,6 +162,27 @@ public static class SendEmailHelper
return result;
}
// 遍历邮件体,找到 HTML 部分并替换
public static void ReplaceHtmlContent(MimeEntity entity, Dictionary<string, string> replacements)
{
if (entity is Multipart multipart)
{
foreach (var part in multipart)
{
ReplaceHtmlContent(part, replacements);
}
}
else if (entity is TextPart textPart && textPart.IsHtml)
{
// 只有这里才是真正的 HTML
foreach (var kv in replacements)
{
textPart.Text = textPart.Text.Replace(kv.Key, kv.Value);
}
}
}
public static async Task<bool> TestEmailConfigAsync(SystemEmailSendConfig _systemEmailConfig)
{
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)))
@@ -147,7 +202,7 @@ public static class SendEmailHelper
return true;
}
public static async Task SendEmailAsync(SMTPEmailConfig sMTPEmailConfig,Trial? trial, EventHandler<MessageSentEventArgs>? messageSentSuccess = null)
public static async Task SendEmailAsync(SMTPEmailConfig sMTPEmailConfig, Trial? trial, EventHandler<MessageSentEventArgs>? messageSentSuccess = null)
{
var messageToSend = new MimeMessage();
@@ -161,8 +216,9 @@ public static class SendEmailHelper
if (sMTPEmailConfig.ToMailAddressList.Count == 0)
{
return;
//---没有收件人
throw new ArgumentException(I18n.T("SendEmail_NoRecipient"));
//throw new ArgumentException(I18n.T("SendEmail_NoRecipient"));
}
else
{
+33 -13
View File
@@ -220,7 +220,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public object result { get; private set; }
private static readonly object _tokenLock = new();
/// <summary>
/// 将指定前缀下的所有现有文件立即转为目标存储类型
@@ -934,32 +934,52 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
//后端批量上传 或者下载,不每个文件获取临时token
private void BackBatchGetToken()
{
// 过期时间 ≤ 当前时间 + 15分钟 时需要续期
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
{
if (AliyunOSSTempToken == null)
if (AliyunOSSTempToken != null && AliyunOSSTempToken.Expiration > DateTime.Now.AddMinutes(15))
{
GetObjectStoreTempToken();
}
//token 过期了
if (AliyunOSSTempToken?.Expiration.AddSeconds(10) <= DateTime.Now)
{
GetObjectStoreTempToken();
return; // 还有15分钟以上,不需要续期
}
lock (_tokenLock)
{
if (AliyunOSSTempToken == null ||
AliyunOSSTempToken.Expiration <= DateTime.Now.AddMinutes(15))
{
GetObjectStoreTempToken();
Log.Logger.Warning("后端获取阿里云临时 Token");
}
}
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
if (AWSTempToken == null)
if (AWSTempToken != null && AWSTempToken.Expiration > DateTime.Now.AddMinutes(15))
{
GetObjectStoreTempToken();
return;
}
//token 过期了
if (AWSTempToken.Expiration?.AddSeconds(10) <= DateTime.Now)
lock (_tokenLock)
{
GetObjectStoreTempToken();
if (AWSTempToken == null ||
AWSTempToken.Expiration <= DateTime.Now.AddMinutes(15))
{
GetObjectStoreTempToken();
Log.Logger.Warning("后端获取s3 临时 Token");
}
}
}
}
@@ -559,119 +559,32 @@
系统模板文档配置表
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.DictionaryService">
<member name="M:IRaCIS.Core.Application.Service.Common.DeployConfigService.GetSystemBasicConfigInfo(Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption})">
<summary>
数据字典-基础数据维护
获取系统基础配置信息
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DoctorDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Doctor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
数据字典-基础数据维护
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBoolDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
添加bool
</summary>
<param name="addOrEditBasic"></param>
<param name="options"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAllDictionaryKey">
<member name="M:IRaCIS.Core.Application.Service.Common.DeployConfigService.UpdateSystemBasicConfig(IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption)">
<summary>
获取所有字典的Key
更新系统基础配置
</summary>
<param name="basicSystemConfigOption"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBasicDicAndChild(IRaCIS.Application.Contracts.AddBasicDicAndChild)">
<member name="M:IRaCIS.Core.Application.Service.Common.DeployConfigService.GetEmailConfigInfo(Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
<summary>
添加字典 的同时 一起添加子项 --New
获取系统邮件配置信息
</summary>
<param name="addBasicDicAndChild"></param>
<param name="options"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDicList(IRaCIS.Application.Contracts.BasicDicQuery)">
<member name="M:IRaCIS.Core.Application.Service.Common.DeployConfigService.UpdateSystemEmailConfig(IRaCIS.Core.Domain.Share.SystemEmailSendConfig)">
<summary>
New 查询条件
更新系统邮件配置
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddOrUpdateBasicDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
添加和编辑
</summary>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetChildList(IRaCIS.Application.Contracts.ChildInQuery)">
<summary>
获取子项数组
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.DeleteDictionary(System.Guid)">
<summary> 删除字典数据 </summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String[])">
<summary>
传递父亲 code 字符串 数组 返回多个下拉框数据
</summary>
<param name="searchArray"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String)">
<summary>
根据父亲Code 获取单个下拉框数据
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicConfigSelect(System.String)">
<summary>
根据父亲字典分组 获取子项
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionaryList(IRaCIS.Application.Contracts.GetCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetTrialCriterionDictionaryList(IRaCIS.Application.Contracts.GetTrialCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionary(IRaCIS.Application.Contracts.GetCriterionDictionaryInDto)">
<summary>
获取标准指定字典
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataAllSelect(IRaCIS.Application.Contracts.GetBasicDataAllSelectInDto)">
<summary>
获取所有下拉框 枚举 bool 数据
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBoolValueState(System.Boolean)">
<summary>
获取是和否
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAuditState``1(System.Guid,``0)">
<summary>
获取审核状态
</summary>
<typeparam name="T"></typeparam>
<param name="trial"></param>
<param name="childCode"></param>
<param name="emailConfig"></param>
<returns></returns>
</member>
<member name="P:IRaCIS.Core.Application.Service.Common.TU_TR_RSBaseModel.ResearchProgramNo">
@@ -1441,6 +1354,121 @@
RSTEST 疗效评估全称
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.DictionaryService">
<summary>
数据字典-基础数据维护
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DoctorDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Doctor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionDictionaryCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingSystemCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
数据字典-基础数据维护
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBoolDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
添加bool
</summary>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAllDictionaryKey">
<summary>
获取所有字典的Key
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddBasicDicAndChild(IRaCIS.Application.Contracts.AddBasicDicAndChild)">
<summary>
添加字典 的同时 一起添加子项 --New
</summary>
<param name="addBasicDicAndChild"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDicList(IRaCIS.Application.Contracts.BasicDicQuery)">
<summary>
New 查询条件
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.AddOrUpdateBasicDic(IRaCIS.Application.Contracts.AddOrEditBasicDic)">
<summary>
添加和编辑
</summary>
<param name="addOrEditBasic"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetChildList(IRaCIS.Application.Contracts.ChildInQuery)">
<summary>
获取子项数组
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.DeleteDictionary(System.Guid)">
<summary> 删除字典数据 </summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String[])">
<summary>
传递父亲 code 字符串 数组 返回多个下拉框数据
</summary>
<param name="searchArray"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataSelect(System.String)">
<summary>
根据父亲Code 获取单个下拉框数据
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicConfigSelect(System.String)">
<summary>
根据父亲字典分组 获取子项
</summary>
<param name="searchKey"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionaryList(IRaCIS.Application.Contracts.GetCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetTrialCriterionDictionaryList(IRaCIS.Application.Contracts.GetTrialCriterionDictionaryListInDto)">
<summary>
获取标准字典
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetCriterionDictionary(IRaCIS.Application.Contracts.GetCriterionDictionaryInDto)">
<summary>
获取标准指定字典
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBasicDataAllSelect(IRaCIS.Application.Contracts.GetBasicDataAllSelectInDto)">
<summary>
获取所有下拉框 枚举 bool 数据
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetBoolValueState(System.Boolean)">
<summary>
获取是和否
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.DictionaryService.GetAuditState``1(System.Guid,``0)">
<summary>
获取审核状态
</summary>
<typeparam name="T"></typeparam>
<param name="trial"></param>
<param name="childCode"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.EmailLogService">
<summary>
邮件日志
@@ -1696,6 +1724,17 @@
<param name="inCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.MailVerificationService.GetEmailSubejctAndHtmlInfoAndBuildAsync(IRaCIS.Core.Domain.Share.EmailBusinessScenario,MimeKit.MimeMessage,System.Func{System.ValueTuple{System.String,System.String},System.ValueTuple{System.String,System.String}},System.Nullable{IRaCIS.Core.Domain.Models.UserWorkLanguage})">
<summary>
获取邮件主题和html 通用封装 以用户语言为主,没有的就用当前的请求语言_userInfo.IsEn_Us
</summary>
<param name="scenario"></param>
<param name="messageToSend"></param>
<param name="emailFunc"></param>
<param name="userWorkLanguage"></param>
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Service.MailVerificationService.SendEmailVerification(System.String,System.Int32)">
<summary>
Reviewer简历录入 发送验证码
@@ -1721,18 +1760,20 @@
<param name="_trialRepository"></param>
<param name="_oSSService"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialImageDownloadService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Application.Helper.IOSSService,Microsoft.AspNetCore.Hosting.IWebHostEnvironment,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomSeries},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance})">
<member name="M:IRaCIS.Core.Application.Service.TrialImageDownloadService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Application.Helper.IOSSService,Microsoft.AspNetCore.Hosting.IWebHostEnvironment,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomSeries},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance})">
<summary>
项目影像后台下载,不打包
</summary>
<param name="_trialRepository"></param>
<param name="_oSSService"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialImageDownloadService.DownloadTrialImage(System.Guid)">
<member name="M:IRaCIS.Core.Application.Service.TrialImageDownloadService.DownloadTrialImage(System.Guid,System.Int32,System.Int32)">
<summary>
后端api swagger 下载项目影像
</summary>
<param name="trialId"></param>
<param name="startIndex"></param>
<param name="endIndex"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialImageDownloadService.DownloadAndUploadTrialData(System.Guid,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomSeries})">
@@ -2329,7 +2370,7 @@
<param name="sendFileRelativePath"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.DealEnrollAnswer(System.Guid,System.Guid,IRaCIS.Core.Domain.Share.CriterionType,System.Guid)">
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.DealEnrollAnswer(System.Guid,System.Guid,IRaCIS.Core.Domain.Share.CriterionType,System.Guid,IRaCIS.Core.Domain.Models.UserWorkLanguage)">
<summary>
获取入组结果
</summary>
@@ -2337,9 +2378,10 @@
<param name="subjectVisitId"></param>
<param name="criterionType"></param>
<param name="trialReadingCriterionId"></param>
<param name="userWorkLanguage"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.TranslatePdStateAsync(System.Guid,IRaCIS.Core.Domain.Share.ReadingCategory,IRaCIS.Core.Domain.Share.CriterionType,System.Nullable{System.Boolean})">
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.TranslatePdStateAsync(System.Guid,IRaCIS.Core.Domain.Share.ReadingCategory,IRaCIS.Core.Domain.Share.CriterionType,IRaCIS.Core.Domain.Models.UserWorkLanguage,System.Nullable{System.Boolean})">
<summary>
获取PD 结果
</summary>
@@ -2347,6 +2389,7 @@
<param name="readingCategory"> 任务类型</param>
<param name="criterionType">标准类型</param>
<param name="IsGlobalGenerate"> 是否是全局产生(区分裁判任务)</param>
<param name="userWorkLanguage"></param>
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
@@ -3038,7 +3081,7 @@
SystemAnonymizationService
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.SystemAnonymizationService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemAnonymization},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<member name="M:IRaCIS.Core.Application.Service.SystemAnonymizationService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemAnonymization},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,ZiggyCreatures.Caching.Fusion.IFusionCache)">
<summary>
SystemAnonymizationService
</summary>
@@ -6009,7 +6052,7 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.MRIPDFFAdvanceCalculateService.CalculateAvg(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.MRIPDFFAdvanceCalculateService.GetReportVerify(IRaCIS.Core.Application.Service.Reading.Dto.GetReportVerifyInDto)">
<summary>
计算平均值
</summary>
@@ -9717,6 +9760,36 @@
单位
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReportsChartDataOutDto.ValueType">
<summary>
数值类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReportsChartDataOutDto.CustomUnit">
<summary>
自定义单位
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReportsChartDataOutDto.Type">
<summary>
类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ChartItem.ValueType">
<summary>
数值类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ChartItem.CustomUnit">
<summary>
自定义单位
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ChartItem.Type">
<summary>
类型
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.SaveTableQuestionMarkInDto">
<summary>
保存表格问题标记
@@ -12308,6 +12381,11 @@
影像工具
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionTrialView.AddDeleteTypeEnum">
<summary>
新增修改类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionTrialView.ImageToolAttribute">
<summary>
影像工具属性
@@ -13253,6 +13331,11 @@
影像工具
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionTrialInDto.AddDeleteTypeEnum">
<summary>
新增修改类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionTrialInDto.ImageToolAttribute">
<summary>
影像工具属性
@@ -14663,7 +14746,7 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMarkBinding},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Segmentation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SegmentBinding},IRaCIS.Core.Application.Service.IVisitTaskHelpeService,IRaCIS.Core.Application.Service.IVisitTaskService,IRaCIS.Core.Application.Contracts.IReadingClinicalDataService,IRaCIS.Core.Application.Service.IReadingCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserFeedBack},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingCriterionPage},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskRelation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingJudgeInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganTrialInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoCalculateService,IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoWithoutPETCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CriterionKeyFileRead},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionKeyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Application.Service.IGeneralCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskStudy},IRaCIS.Core.Application.Service.ImageAndDoc.IDownloadAndUploadService,IRaCIS.Core.Application.Interfaces.ITrialEmailNoticeConfigService,AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,ZiggyCreatures.Caching.Fusion.IFusionCache)">
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMarkBinding},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Segmentation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SegmentBinding},IRaCIS.Core.Application.Service.IVisitTaskHelpeService,IRaCIS.Core.Application.Service.IVisitTaskService,IRaCIS.Core.Application.Contracts.IReadingClinicalDataService,IRaCIS.Core.Application.Service.IReadingCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserFeedBack},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingCriterionPage},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskRelation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingJudgeInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganTrialInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoCalculateService,IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoWithoutPETCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CriterionKeyFileRead},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionKeyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Application.Service.IGeneralCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskStudy},Microsoft.Extensions.Configuration.IConfiguration,IRaCIS.Core.Application.Service.ImageAndDoc.IDownloadAndUploadService,IRaCIS.Core.Application.Interfaces.ITrialEmailNoticeConfigService,AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,ZiggyCreatures.Caching.Fusion.IFusionCache)">
<summary>
IR影像阅片
</summary>
@@ -15105,7 +15188,14 @@
<param name="visitTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.ComputeJudgeResult(System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.GroupTaskAnswerDto})">
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.SendWeComNotifier(System.Guid,System.String)">
<summary>
发送微信通知
</summary>
<param name="visiTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.ComputeJudgeResult(System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.GroupTaskAnswerDto},System.Guid)">
<summary>
计算返回的结果 为True表示不相等
</summary>
@@ -15913,7 +16003,7 @@
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.PatientService.SubmitVisitStudyBinding(IRaCIS.Application.Contracts.SubmitVisitStudyBindingCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomSeries},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance})">
<member name="M:IRaCIS.Core.Application.Service.PatientService.SubmitVisitStudyBinding(IRaCIS.Application.Contracts.SubmitVisitStudyBindingCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomSeries},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.FileUploadRecord})">
<summary>
提交 患者检查和访视的绑定
</summary>
@@ -16071,6 +16161,18 @@
<param name="outEnrollTime"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TestService.SiteSuveryEquipment">
<summary>
维护中心调研设备默认配置
</summary>
<param name="modelVerify"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.TestService.SubjectVisitExcel">
<summary>
访视数据模型
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.TestService.MaskImage">
<summary>
遮挡影像
@@ -16236,6 +16338,16 @@
<param name="email"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Helper.SendEmailHelper.SendTrialEmailAsync(MimeKit.MimeMessage,IRaCIS.Core.Domain.Models.Trial,System.EventHandler{MailKit.MessageSentEventArgs})">
<summary>
发送项目邮件
</summary>
<param name="messageToSend"></param>
<param name="trial"></param>
<param name="messageSentSuccess"></param>
<returns></returns>
<exception cref="T:System.Exception"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Helper.FileConvertHelper.ConvertWordToPdf(System.String,System.String)">
<summary>
镜像里面打入libreoffice 的方案
@@ -16425,23 +16537,25 @@
全量一致性核查
</summary>
</member>
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(IRaCIS.Core.Domain.Models.EmailNoticeConfig,MimeKit.MimeMessage,System.Func{System.ValueTuple{System.String,System.String},System.ValueTuple{System.String,System.String}})">
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(IRaCIS.Core.Domain.Models.EmailNoticeConfig,MimeKit.MimeMessage,System.Func{System.ValueTuple{System.String,System.String},System.ValueTuple{System.String,System.String}},System.Nullable{IRaCIS.Core.Domain.Models.UserWorkLanguage})">
<summary>
系统默认邮件 + 项目默认邮件 (不用添加到项目邮件配置中,才发送)
</summary>
<param name="configInfo"></param>
<param name="messageToSend"></param>
<param name="emailFunc"></param>
<param name="userWorkLanguage"></param>
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig,MimeKit.MimeMessage,System.Func{System.ValueTuple{System.String,System.String},System.ValueTuple{System.String,System.String}})">
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig,MimeKit.MimeMessage,System.Func{System.ValueTuple{System.String,System.String},System.ValueTuple{System.String,System.String}},System.Nullable{IRaCIS.Core.Domain.Models.UserWorkLanguage})">
<summary>
项目手动邮件 (需要添加到项目邮件配置中,才发送)
</summary>
<param name="configInfo"></param>
<param name="messageToSend"></param>
<param name="emailFunc"></param>
<param name="userWorkLanguage"></param>
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
@@ -16812,12 +16926,12 @@
定时过期提醒
</summary>
</member>
<member name="T:IRaCIS.Core.Application.MassTransit.Recurring.SystemDocumentPublishEventConsumer">
<member name="T:IRaCIS.Core.Application.MassTransit.Recurring.SystemDocumentErverDayEventConsumer.SystemDocumentPublishEventConsumer">
<summary>
生效通知
</summary>
</member>
<member name="M:IRaCIS.Core.Application.MassTransit.Recurring.SystemDocumentPublishEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocConfirmedIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
<member name="M:IRaCIS.Core.Application.MassTransit.Recurring.SystemDocumentErverDayEventConsumer.SystemDocumentPublishEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocConfirmedIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
<summary>
生效通知
</summary>
@@ -17399,17 +17513,17 @@
</member>
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
<summary>
质疑
</summary>
</member>
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
<summary>
一致性核查
һԺ˲
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
<summary>
复制
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">
@@ -18212,6 +18326,16 @@
文件大小,单位字节
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SegmentationAddOrEdit.SEGUpdateTime">
<summary>
SEGUpdateTime 更新时间
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SegmentationVersionView.StartTime">
<summary>
版本开始时间
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SegmentBindingView.IsLock">
<summary>
是否锁定
@@ -18843,6 +18967,11 @@
受试者ID
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.DTO.TrialVisitQADTO.IsSupportQCDownloadImage">
<summary>
QC质控下载
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.DTO.QAStudyInfoDTO.PatientSex">
<summary>
性别
@@ -19303,7 +19432,17 @@
检查名称列表
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.TrialProcessConfig.IsImageQualityControl">
<member name="P:IRaCIS.Core.Application.Contracts.BasicTrialConfig.IsSupportQCDownloadImage">
<summary>
QC质控下载
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.BasicTrialConfig.IsOpenLostVistRead">
<summary>
打开失访可读
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.BasicTrialConfig.IsImageQualityControl">
<summary>
影像质控风险控制
</summary>
@@ -19935,7 +20074,7 @@
TrialDocumentService
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Services.TrialDocumentService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.AuditRecord},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocumentAttachment},IRaCIS.Core.Application.Contracts.ISystemDocumentService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocConfirmedIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocNeedConfirmedUserType},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocNeedConfirmedUserType},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocument},Microsoft.Extensions.DependencyInjection.IServiceScopeFactory,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocConfirmedIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<member name="M:IRaCIS.Core.Application.Services.TrialDocumentService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},MassTransit.Mediator.IScopedMediator,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.AuditRecord},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocumentAttachment},IRaCIS.Core.Application.Contracts.ISystemDocumentService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocConfirmedIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocNeedConfirmedUserType},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocNeedConfirmedUserType},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocument},Microsoft.Extensions.DependencyInjection.IServiceScopeFactory,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocConfirmedIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
TrialDocumentService
</summary>
@@ -20123,11 +20262,12 @@
<param name="editTrialSiteCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Services.TrialMaintenanceService.GetTrialSiteSelect(System.Guid)">
<member name="M:IRaCIS.Core.Application.Services.TrialMaintenanceService.GetTrialSiteSelect(System.Guid,System.Nullable{System.Boolean})">
<summary>
获取项目下的 site 下拉框数据 CRC只看到他负责的
</summary>
<param name="trialId"></param>
<param name="ignoreDisable"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Services.TrialMaintenanceService.DeleteTrialSite(System.Guid)">
@@ -34,6 +34,8 @@ namespace IRaCIS.Core.Application.MassTransit.Command
public Guid SubjectVisitId { get; set; }
public Guid StudyId { get; set; }
public string SiteCounty { get; set; }
}
public class FullCheckResult: CheckViewModel
@@ -21,12 +21,14 @@ public static class CommonEmailHelper
/// <param name="configInfo"></param>
/// <param name="messageToSend"></param>
/// <param name="emailFunc"></param>
/// <param name="userWorkLanguage"></param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
public static async Task<EmailNoticeConfig> GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailNoticeConfig configInfo, MimeMessage messageToSend,
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc)
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc, UserWorkLanguage? userWorkLanguage = null)
{
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
bool isEn_US = userWorkLanguage.HasValue ? userWorkLanguage.Value == UserWorkLanguage.US : CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var (topicStr, htmlBodyStr) = isEn_US ? (configInfo.EmailTopic, configInfo.EmailHtmlContent) : (configInfo.EmailTopicCN, configInfo.EmailHtmlContentCN);
@@ -60,13 +62,14 @@ Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr
/// <param name="configInfo"></param>
/// <param name="messageToSend"></param>
/// <param name="emailFunc"></param>
/// <param name="userWorkLanguage"></param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
public static async Task<TrialEmailNoticeConfig> GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(TrialEmailNoticeConfig configInfo, MimeMessage messageToSend,
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc)
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc, UserWorkLanguage? userWorkLanguage = null)
{
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
bool isEn_US = userWorkLanguage.HasValue ? userWorkLanguage.Value == UserWorkLanguage.US : CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var (topicStr, htmlBodyStr) = isEn_US ? (configInfo.EmailTopic, configInfo.EmailHtmlContent) : (configInfo.EmailTopicCN, configInfo.EmailHtmlContentCN);
@@ -94,12 +97,20 @@ Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr
return configInfo;
}
public static string ReplaceCompanyName(SystemEmailSendConfig _systemEmailConfig, string needDealtxt)
public static string ReplacePlatformName(SystemEmailSendConfig _systemEmailConfig, string needDealtxt, UserWorkLanguage? userWorkLanguage = null)
{
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var isEn_US = userWorkLanguage.HasValue ? userWorkLanguage.Value == UserWorkLanguage.US : CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var platformName = isEn_US ? _systemEmailConfig.PlatformName : _systemEmailConfig.PlatformNameCN;
var str = needDealtxt.Replace("{platformName}", platformName);
return str;
}
public static string ReplaceCompanyName(SystemEmailSendConfig _systemEmailConfig, string needDealtxt, UserWorkLanguage? userWorkLanguage = null)
{
var isEn_US = userWorkLanguage.HasValue ? userWorkLanguage.Value == UserWorkLanguage.US : CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var str = needDealtxt.Replace("{company}", isEn_US ? _systemEmailConfig.CompanyName : _systemEmailConfig.CompanyNameCN)
.Replace("{company abbreviation}", isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN);
@@ -10,12 +10,14 @@ using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using MassTransit;
using MaxMind.GeoIP2.Model;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using System.Globalization;
using System.IO;
using System.Text;
@@ -79,6 +81,8 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
Modality = study.ModalityForEdit,
SubjectCode = subject.Code,
VisitName = sv.VisitName,
SiteCounty = sv.TrialSite.Country,
};
var noneDicomQuey = from sv in _subjectVisitRepository.Where(subjectVisitLambda)
@@ -93,6 +97,8 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
Modality = noneDicomStudy.Modality,
SubjectCode = subject.Code,
VisitName = sv.VisitName,
SiteCounty = sv.TrialSite.Country,
};
var dbList = (await dicomQuery.ToListAsync()).Union(await noneDicomQuey.ToListAsync()).ToList();
@@ -120,6 +126,21 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
var dbVisitStudyList = dbList.Where(t => t.SubjectCode == sv.SubjectCode && t.SiteCode == sv.SiteCode && t.VisitName == sv.VisitName).ToList();
//设置当前中心语言
var isEn_us = dbVisitStudyList.First().SiteCounty == StaticData.SiteCountry.US;
var cultureInfoName = StaticData.CultureInfo.en_US;
if (isEn_us == false)
{
cultureInfoName = StaticData.CultureInfo.zh_CN;
}
CultureInfo.CurrentCulture = new CultureInfo(cultureInfoName);
CultureInfo.CurrentUICulture = new CultureInfo(cultureInfoName);
//找到etc 当前visit site 和subject 一致的检查列表
var etcVisitStudyList = etcList.Where(t => t.SubjectCode == sv.SubjectCode && t.SiteCode == sv.SiteCode && t.VisitName == sv.VisitName).ToList();
@@ -27,5 +27,16 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer.Dto
}
public class SendEmailUserDto
{
public UserTypeEnum UserTypeEnum { get; set; }
public string FullName { get; set; }
public UserWorkLanguage UserWorkLanguage { get; set; }
public string EMail { get; set; }
}
}
@@ -273,15 +273,30 @@ public class ImageConsumer(
};
// 根据不同场景获取不同角色的用户 先排除CRC和CRA
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == inDto.TrialId && !x.TrialUser.IsDeleted && !filterUserTypeList.Contains(x.UserRole.UserTypeEnum) ).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == inDto.TrialId && !x.TrialUser.IsDeleted && !filterUserTypeList.Contains(x.UserRole.UserTypeEnum) ).Include(x => x.UserRole).Select(x => x.UserRole)
.Select(x => new SendEmailUserDto()
{
UserTypeEnum = x.UserTypeEnum,
FullName = x.FullName,
UserWorkLanguage = x.IdentityUser.UserWorkLanguage,
EMail=x.EMail,
})
.ToListAsync();
// CRC和CRA单独取
var crcAndcraUserList = await _trialSiteRepository.Where(x => x.Id == inDto.SubjectVisit.TrialSiteId).SelectMany(x => x.CRCUserList.Select(y => y.UserRole)).ToListAsync();
var crcAndcraUserList = await _trialSiteRepository.Where(x => x.Id == inDto.SubjectVisit.TrialSiteId).SelectMany(x => x.CRCUserList.Select(y => y.UserRole))
.Select(x => new SendEmailUserDto()
{
UserTypeEnum = x.UserTypeEnum,
FullName = x.FullName,
UserWorkLanguage = x.IdentityUser.UserWorkLanguage,
EMail = x.EMail,
}).ToListAsync();
trialUserList.AddRange(crcAndcraUserList);
// 根据场景确定收件人
List<UserRole> toUserList = new List<UserRole>();
List<UserRole> ccUserList = new List<UserRole>();
List<SendEmailUserDto> toUserList = new List<SendEmailUserDto>();
List<SendEmailUserDto> ccUserList = new List<SendEmailUserDto>();
var emailNoticeUserList = await _emailNoticeUserTypeRepository.Where(x => x.EmailNoticeConfigId == inDto.EmailNoticeConfig.Id).ToListAsync();
var userTypeEnumList = emailNoticeUserList.Select(x => x.UserType).ToList();
@@ -334,42 +349,55 @@ public class ImageConsumer(
DictionaryList = dictionaryDtos
});
foreach (var userinfo in toUserList)
var userWorkLanguageList = toUserList.Select(x => x.UserWorkLanguage).Distinct().ToList();
foreach (var workLanguage in userWorkLanguageList)
{
var userinfoList = toUserList.Where(x => x.UserWorkLanguage == workLanguage).ToList();
var messageToSend = new MimeMessage();
// 发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
foreach (var userinfo in userinfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
// 添加抄送
foreach (var ccUser in ccUserList)
{
messageToSend.Cc.Add(new MailboxAddress(ccUser.FullName, ccUser.EMail));
}
var userNames = userinfoList.Select(x => x.FullName).ToList();
// 格式化邮件内容
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var subjectCode = inDto.SubjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, inDto.SubjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.FullName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
inDto.SubjectVisit.VisitName, // 访视 {3}
dictionValue[0], // 是否加急 {4}
dictionValue[1], // 审批结果 {5}
_systemEmailConfig.SiteUrl // 链接 {6}
);
{
var subjectCode = inDto.SubjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, inDto.SubjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames), // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
inDto.SubjectVisit.VisitName, // 访视 {3}
dictionValue[0], // 是否加急 {4}
dictionValue[1], // 审批结果 {5}
_systemEmailConfig.SiteUrl // 链接 {6}
);
return (topicStr, htmlBodyStr);
};
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(inDto.EmailNoticeConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(inDto.EmailNoticeConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
@@ -446,11 +474,19 @@ public class ImageConsumer(
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
// 根据不同场景获取不同角色的用户
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == trialId && !x.TrialUser.IsDeleted).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == trialId && !x.TrialUser.IsDeleted).Include(x => x.UserRole).Select(x => x.UserRole)
.Select(x => new SendEmailUserDto()
{
UserTypeEnum = x.UserTypeEnum,
FullName = x.FullName,
UserWorkLanguage = x.IdentityUser.UserWorkLanguage,
EMail = x.EMail,
})
.ToListAsync();
// 根据场景确定收件人
List<UserRole> toUserList = new List<UserRole>();
List<UserRole> ccUserList = new List<UserRole>();
List<SendEmailUserDto> toUserList = new List<SendEmailUserDto>();
List<SendEmailUserDto> ccUserList = new List<SendEmailUserDto>();
var emailNoticeUserList = await _emailNoticeUserTypeRepository.Where(x => x.EmailNoticeConfigId == emailNoticeConfig.Id).ToListAsync();
@@ -469,12 +505,19 @@ public class ImageConsumer(
return;
}
foreach (var userinfo in toUserList)
var userWorkLanguageList = toUserList.Select(x => x.UserWorkLanguage).Distinct().ToList();
foreach (var workLanguage in userWorkLanguageList)
{
var userinfoList = toUserList.Where(x => x.UserWorkLanguage == workLanguage).ToList();
var messageToSend = new MimeMessage();
// 发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
foreach (var userinfo in userinfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
// 添加抄送
foreach (var ccUser in ccUserList)
@@ -482,13 +525,15 @@ public class ImageConsumer(
messageToSend.Cc.Add(new MailboxAddress(ccUser.FullName, ccUser.EMail));
}
var userNames = userinfoList.Select(x => x.FullName).ToList();
// 格式化邮件内容
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.FullName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames), // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
"", // 受试者 {2} - 阅片人筛选不涉及受试者
"", // 访视 {3} - 阅片人筛选不涉及访视
@@ -500,9 +545,9 @@ public class ImageConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailNoticeConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailNoticeConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
}
@@ -1,5 +1,6 @@
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.MassTransit.Command;
using IRaCIS.Core.Application.MassTransit.Consumer.Dto;
using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.BaseModel;
using IRaCIS.Core.Domain.Models;
@@ -68,7 +69,7 @@ public class UrgentMedicalReviewAddedEventConsumer(
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).Include(x => x.IdentityUser).FirstOrDefaultAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
@@ -78,7 +79,8 @@ public class UrgentMedicalReviewAddedEventConsumer(
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == visitid).FirstOrDefaultAsync();
var workLanguage = userinfo.IdentityUser?.UserWorkLanguage;
var userIsEn_US = workLanguage.HasValue ? workLanguage.Value == UserWorkLanguage.US : isEn_US;
var messageToSend = new MimeMessage();
//发件地址
@@ -86,14 +88,14 @@ public class UrgentMedicalReviewAddedEventConsumer(
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == medicalReview.TrialId);
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
IsEn_US = userIsEn_US,
DictionaryList = new List<DictionaryDto>()
@@ -110,7 +112,7 @@ public class UrgentMedicalReviewAddedEventConsumer(
var subjectName = taskInfo.BlindSubjectCode.IsNullOrEmpty() ? taskInfo.Subject.Code : taskInfo.BlindSubjectCode;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectName, taskInfo.TaskBlindName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userinfo.FullName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
criterion.CriterionName, // 阅片标准 {2}
@@ -126,9 +128,9 @@ public class UrgentMedicalReviewAddedEventConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
@@ -177,7 +179,7 @@ public class UrgentIRRepliedMedicalReviewConsumer(
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).Include(x => x.IdentityUser).FirstOrDefaultAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
@@ -187,6 +189,8 @@ public class UrgentIRRepliedMedicalReviewConsumer(
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == visitid).FirstOrDefaultAsync();
var workLanguage = userinfo.IdentityUser?.UserWorkLanguage;
var userIsEn_US = workLanguage.HasValue ? workLanguage.Value == UserWorkLanguage.US : isEn_US;
var messageToSend = new MimeMessage();
@@ -195,14 +199,14 @@ public class UrgentIRRepliedMedicalReviewConsumer(
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == medicalReview.TrialId);
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
IsEn_US = userIsEn_US,
DictionaryList = new List<DictionaryDto>()
@@ -219,7 +223,7 @@ public class UrgentIRRepliedMedicalReviewConsumer(
var subjectCode = taskInfo.BlindSubjectCode.IsNullOrEmpty() ? taskInfo.Subject.Code : taskInfo.BlindSubjectCode;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, taskInfo.TaskBlindName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userinfo.FullName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
criterion.CriterionName, // 阅片标准 {2}
@@ -234,9 +238,9 @@ public class UrgentIRRepliedMedicalReviewConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
@@ -293,7 +297,7 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
var userinfo = await _userRoleRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync();
var userinfo = await _userRoleRepository.Where(x => x.Id == taskInfo.DoctorUserId).Include(x => x.IdentityUser).FirstOrDefaultAsync();
@@ -303,6 +307,9 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == visitid).FirstOrDefaultAsync();
var workLanguage = userinfo.IdentityUser?.UserWorkLanguage;
var userIsEn_US = workLanguage.HasValue ? workLanguage.Value == UserWorkLanguage.US : isEn_US;
var messageToSend = new MimeMessage();
@@ -311,14 +318,14 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == medicalReview.TrialId);
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
IsEn_US = userIsEn_US,
DictionaryList = new List<DictionaryDto>()
@@ -335,7 +342,7 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
var subjectCode = taskInfo.BlindSubjectCode.IsNullOrEmpty() ? taskInfo.Subject.Code : taskInfo.BlindSubjectCode;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, taskInfo.TaskBlindName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userinfo.FullName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
@@ -352,8 +359,8 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
}
@@ -399,7 +406,15 @@ public class UrgentIRApplyedReReadingConsumer(
var doctorInfo = await _userRoleRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == taskInfo.TrialId && x.TrialUser.IsDeleted==false).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == taskInfo.TrialId && x.TrialUser.IsDeleted==false).Include(x => x.UserRole).Select(x => x.UserRole)
.Select(x => new SendEmailUserDto()
{
UserTypeEnum = x.UserTypeEnum,
FullName = x.FullName,
UserWorkLanguage = x.IdentityUser.UserWorkLanguage,
EMail = x.EMail,
})
.ToListAsync();
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.ProjectManager || x.UserTypeEnum == UserTypeEnum.APM).ToList();
if (context.Message.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed)
@@ -412,37 +427,48 @@ public class UrgentIRApplyedReReadingConsumer(
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == visitid).FirstOrDefaultAsync();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == taskInfo.TrialId);
foreach (var userinfo in userinfoList)
var userWorkLanguageList = userinfoList.Select(x => x.UserWorkLanguage).Distinct().ToList();
foreach (var workLanguage in userWorkLanguageList)
{
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == taskInfo.TrialId);
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var langUserinfoList = userinfoList.Where(x => x.UserWorkLanguage == workLanguage).ToList();
if (!langUserinfoList.Any()) continue;
var userIsEn_US = workLanguage == UserWorkLanguage.US;
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
IsEn_US = userIsEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "ReadingCategory",EnumValue=taskInfo.ReadingCategory.GetEnumInt(), }, //任务类型
new DictionaryDto (){DictionaryCode= "RequestReReadingResult",EnumValue="0", }, //审批结果 都是待审批
}
{
new DictionaryDto (){DictionaryCode= "ReadingCategory",EnumValue=taskInfo.ReadingCategory.GetEnumInt(), }, //任务类型
new DictionaryDto (){DictionaryCode= "RequestReReadingResult",EnumValue="0", }, //审批结果 都是待审批
}
});
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
foreach (var userinfo in langUserinfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var userNames = langUserinfoList.Select(x => x.FullName).ToList();
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var subjectCode = taskInfo.BlindSubjectCode.IsNullOrEmpty() ? taskInfo.Subject.Code : taskInfo.BlindSubjectCode;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, taskInfo.TaskBlindName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.FullName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames), // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
taskInfo.TaskBlindName, // 访视 {3}
@@ -451,18 +477,14 @@ public class UrgentIRApplyedReReadingConsumer(
criterion.CriterionName, // 阅片标准 {6}
dictionValue[1], // 审批结果 {7}
_systemEmailConfig.SiteUrl // 链接 {8}
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
@@ -57,73 +57,85 @@ public class UserSiteSurveySubmitedEventConsumer(
if (emailConfig != null)
{
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.Id == siteSurveyInfo.TrialSiteId, true);
var trialUserList = await _trialUserRoleRepository.Where(t => t.TrialId == siteSurveyInfo.TrialId && t.TrialUser.IsDeleted == false)
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM)
.Select(t => new { t.UserRole.FullName, t.UserRole.IdentityUser.EMail, t.UserRole.UserTypeEnum }).ToListAsync();
.Select(t => new { t.UserRole.FullName, t.UserRole.IdentityUser.EMail, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var sPMOrCPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.SPM || t.UserTypeEnum == UserTypeEnum.CPM).ToList();
var pmAndAPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserTypeEnum == UserTypeEnum.APM).ToList();
var messageToSend = new MimeMessage();
var toUserName = string.Empty;
//有SPM 并且参与
if (trialInfo.IsSPMJoinSiteSurvey && sPMOrCPMList.Count > 0)
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
foreach (var user in sPMOrCPMList)
//重新设置当前发送邮件的语言
isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
var toUserName = string.Empty;
//有SPM 并且参与
if (trialInfo.IsSPMJoinSiteSurvey && sPMOrCPMList.Count > 0)
{
messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
var lan_SPMOrCPMList = sPMOrCPMList.Where(t => t.UserWorkLanguage == workLanguage);
foreach (var user in lan_SPMOrCPMList)
{
messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
}
toUserName = string.Join('、', lan_SPMOrCPMList.Select(t => t.FullName));
foreach (var user in pmAndAPMList)
{
messageToSend.Cc.Add(new MailboxAddress(user.FullName, user.EMail));
}
}
else
{
var lan_pmAndAPMList = pmAndAPMList.Where(t => t.UserWorkLanguage == workLanguage);
foreach (var user in lan_pmAndAPMList)
{
messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
}
toUserName = string.Join('、', lan_pmAndAPMList.Select(t => t.FullName));
}
toUserName = string.Join('、', sPMOrCPMList.Select(t => t.FullName));
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
foreach (var user in pmAndAPMList)
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
messageToSend.Cc.Add(new MailboxAddress(user.FullName, user.EMail));
}
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
toUserName,
siteInfo.TrialSiteCode,
siteInfo.TrialSiteAliasName,
siteSurveyInfo.UserName,
siteSurveyInfo.Email,
siteSurveyInfo.Phone,
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
else
{
foreach (var user in pmAndAPMList)
{
messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
}
toUserName = string.Join('、', pmAndAPMList.Select(t => t.FullName));
}
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.Id == siteSurveyInfo.TrialSiteId, true);
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
toUserName,
siteInfo.TrialSiteCode,
siteInfo.TrialSiteAliasName,
siteSurveyInfo.UserName,
siteSurveyInfo.Email,
siteSurveyInfo.Phone,
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
}
}
@@ -152,61 +164,74 @@ public class SiteSurveySPMSubmitedEventConsumer(
var trialId = siteSurveyInfo.TrialId;
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.Id == siteSurveyInfo.TrialSiteId, true);
var trialUserList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false)
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToList();
var scenario = EmailBusinessScenario.Approval_SubmitSiteSurvey;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig != null)
{
var messageToSend = new MimeMessage();
var trialUserList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false)
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList();
var sPMOrCPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.SPM || t.UserTypeEnum == UserTypeEnum.CPM).ToList();
var pmAndAPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserTypeEnum == UserTypeEnum.APM).ToList();
var toUserName = string.Empty;
foreach (var item in pmAndAPMList)
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
messageToSend.To.Add(new MailboxAddress(item.FullName, item.EMail));
//重新设置当前发送邮件的语言
isEn_US = workLanguage == UserWorkLanguage.US;
var sPMOrCPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.SPM || t.UserTypeEnum == UserTypeEnum.CPM).ToList();
var pmAndAPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserTypeEnum == UserTypeEnum.APM).ToList();
var messageToSend = new MimeMessage();
var toUserName = string.Empty;
var lan_pmAndAPMList = pmAndAPMList.Where(t => t.UserWorkLanguage == workLanguage);
foreach (var item in lan_pmAndAPMList)
{
messageToSend.To.Add(new MailboxAddress(item.FullName, item.EMail));
toUserName = string.Join('、', lan_pmAndAPMList.Select(t => t.FullName));
}
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
toUserName,
siteInfo.TrialSiteCode, //中心编号
siteInfo.TrialSiteAliasName,//中心名称
siteSurveyInfo.UserName, //联系人
siteSurveyInfo.Email, //联系邮箱
siteSurveyInfo.Phone, //联系电话
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
toUserName = string.Join('、', pmAndAPMList.Select(t => t.FullName));
}
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.Id == siteSurveyInfo.TrialSiteId, true);
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
toUserName,
siteInfo.TrialSiteCode, //中心编号
siteInfo.TrialSiteAliasName,//中心名称
siteSurveyInfo.UserName, //联系人
siteSurveyInfo.Email, //联系邮箱
siteSurveyInfo.Phone, //联系电话
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
}
@@ -235,92 +260,108 @@ public class SiteSurverRejectedEventConsumer(
var trialSiteSurveyId = context.Message.TrialSiteSurveyId;
var siteSurveyInfo = _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId ,ignoreQueryFilters:true).FirstOrDefault().IfNullThrowException();
var siteSurveyInfo = _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId, ignoreQueryFilters: true).FirstOrDefault().IfNullThrowException();
var trialId = siteSurveyInfo.TrialId;
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.Id == siteSurveyInfo.TrialSiteId, true);
var scenario = EmailBusinessScenario.SiteSurveyReject;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig != null)
{
var messageToSend = new MimeMessage();
var toUserName = siteSurveyInfo.UserName;
if (context.Message.IsHaveSPMOrCPM)
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
//PM 驳回到SPM
if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted)
//重新设置当前发送邮件的语言
isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
var toUserName = siteSurveyInfo.UserName;
if (context.Message.IsHaveSPMOrCPM)
{
//var user = await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == siteSurveyInfo.PreliminaryUserId);
//name = user.FullName;
var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false)
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList();
foreach (var user in sPMOrCPMList)
//PM 驳回到SPM
if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted)
{
messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false)
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToList();
var lan_SPMOrCPMList = sPMOrCPMList.Where(t => t.UserWorkLanguage == workLanguage);
foreach (var user in lan_SPMOrCPMList)
{
messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
}
toUserName = string.Join('、', lan_SPMOrCPMList.Select(t => t.FullName));
}
//SPM 驳回到CRC
else if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit)
{
//使用中心国家语言 一致才发送
if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false))
{
messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email));
}
}
toUserName = string.Join('、', sPMOrCPMList.Select(t => t.FullName));
}
//SPM 驳回到CRC
else if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit)
else
{
messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email));
//没有SPM PM驳回到CRC
//使用中心国家语言 一致才发送
if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false))
{
messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email));
}
}
}
else
{
//没有SPM PM驳回到CRC
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
toUserName,
trialInfo.TrialCode,
trialInfo.ResearchProgramNo,
trialInfo.ExperimentName,
siteInfo.TrialSiteCode, //中心编号
siteInfo.TrialSiteAliasName,//中心名称
siteSurveyInfo.LatestBackReason, //驳回原因
_systemEmailConfig.SiteUrl, //链接
(siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none")
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
messageToSend.To.Add(new MailboxAddress(siteSurveyInfo.UserName, siteSurveyInfo.Email));
}
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.Id == siteSurveyInfo.TrialSiteId, true);
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName,trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
toUserName,
trialInfo.TrialCode,
trialInfo.ResearchProgramNo,
trialInfo.ExperimentName,
siteInfo.TrialSiteCode, //中心编号
siteInfo.TrialSiteAliasName,//中心名称
siteSurveyInfo.LatestBackReason, //驳回原因
_systemEmailConfig.SiteUrl, //链接
(siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none")
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
}
@@ -36,7 +36,7 @@ public class CRCSubmitedAndQCToAuditEventConsumer(
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<CRCSubmitedAndQCToAuditEvent> context)
{
Console.WriteLine("发送(005,006) 【加急项目所有IQC待领取质控任务】邮件!!!");
Log.Logger.Warning("发送(005,006) 【加急项目所有IQC待领取质控任务】邮件!!!");
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var subjectVisitId = context.Message.SubjectVisitId;
@@ -49,80 +49,91 @@ public class CRCSubmitedAndQCToAuditEventConsumer(
var trialEmailConfig = _trialEmailNoticeConfigrepository.Where(t => t.TrialId == trialId && t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
if (trialEmailConfig != null)
{
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.IQC).ToList();
var pmandAPm = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager).ToList();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
var auditStateCode = "AuditStatePE";
if (trialInfo.QCProcessEnum == TrialQCProcess.DoubleAudit)
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
auditStateCode = "AuditStateRC";
}
//重新设置当前发送邮件的语言
isEn_US = workLanguage == UserWorkLanguage.US;
var iqcList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.IQC).Where(t => t.UserWorkLanguage == workLanguage).ToList();
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
var pmandAPm = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager).ToList();
var auditStateCode = "AuditStatePE";
if (trialInfo.QCProcessEnum == TrialQCProcess.DoubleAudit)
{
auditStateCode = "AuditStateRC";
}
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= auditStateCode,EnumValue=subjectVisit.AuditState.GetEnumInt(), }, //审核状态
}
});
});
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
foreach (var userinfo in iqcList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var userNames = iqcList.Select(x => x.FullName).ToList();
foreach (var pm in pmandAPm)
{
messageToSend.Cc.Add(new MailboxAddress(pm.FullName, pm.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames), // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
subjectVisit.VisitName, // 访视 {3}
dictionValue[0], // 审核状态 {4}
_systemEmailConfig.SiteUrl // 链接 {5}
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
foreach (var userinfo in userinfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var userNames = userinfoList.Select(x => x.FullName).ToList();
foreach (var pm in pmandAPm)
{
messageToSend.Cc.Add(new MailboxAddress(pm.FullName, pm.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
string.Join(',', userNames), // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
subjectVisit.VisitName, // 访视 {3}
dictionValue[0], // 审核状态 {4}
_systemEmailConfig.SiteUrl // 链接 {5}
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
}
}
@@ -147,7 +158,7 @@ public class CRCRepliedQCChallengeEventConsumer(
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<CRCRepliedQCChallengeEvent> context)
{
Console.WriteLine("发送(Code012013) 【CRC 回复质控质疑 通知QC】邮件!!!");
Log.Logger.Warning("发送(Code012013) 【CRC 回复质控质疑 通知QC】邮件!!!");
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var subjectVisitId = context.Message.SubjectVisitId;
@@ -158,26 +169,29 @@ public class CRCRepliedQCChallengeEventConsumer(
var scenario = context.Message.IsPd ? EmailBusinessScenario.PDVerification_UnderQCQuery : EmailBusinessScenario.EligibilityVerification_Pending;
var trialEmailConfig = _trialEmailNoticeConfigrepository.Where(t => t.TrialId == trialId && t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (trialEmailConfig != null)
{
var qCChallengeDialog = await _qCChallengeDialogRepository.Where(x => x.Id == context.Message.QCChallengeDialogId).Include(x => x.QCChallenge).FirstNotNullAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.IQC).ToList();
var pmandAPm = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager).ToList();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
var userinfo = subjectVisit.CurrentActionUser;
//重新设置当前发送邮件的语言
var workLanguage = _userRoleRepository.Where(t => t.Id == userinfo.Id).Select(t => t.IdentityUser.UserWorkLanguage).First();
isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -207,7 +221,7 @@ public class CRCRepliedQCChallengeEventConsumer(
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userinfo.FullName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
@@ -219,9 +233,9 @@ public class CRCRepliedQCChallengeEventConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
}
@@ -244,7 +258,7 @@ public class QCRepliedQCChallengeEventConsumer(
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<QCRepliedQCChallengeEvent> context)
{
Console.WriteLine("发送(014015) 【 QC回复 质控质疑,通知CRC】邮件!!!");
Log.Logger.Warning("发送(014015) 【 QC回复 质控质疑,通知CRC】邮件!!!");
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var subjectVisitId = context.Message.SubjectVisitId;
@@ -277,54 +291,61 @@ public class QCRepliedQCChallengeEventConsumer(
}
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).ToList();
var craInfo = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.CRA).FirstOrDefault();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "YesOrNo",EnumValue=isclose.ToString().ToLower(), }, //是否关闭
}
});
//重新设置当前发送邮件的语言
isEn_US = workLanguage == UserWorkLanguage.US;
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Where(t => t.UserWorkLanguage == workLanguage).ToList();
var craInfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.CRA).ToList();
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "YesOrNo",EnumValue=isclose.ToString().ToLower(), }, //是否关闭
}
});
foreach (var userinfo in userinfoList)
{
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
if (craInfo != null)
var toUserName = string.Join('、', userinfoList.Select(t => t.FullName));
foreach (var userinfo in userinfoList)
{
messageToSend.Cc.Add(new MailboxAddress(craInfo.FullName, craInfo.EMail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
foreach (var user in craInfoList)
{
messageToSend.Cc.Add(new MailboxAddress(user.FullName, user.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.FullName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
toUserName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
subjectVisit.VisitName, // 访视 {3}
@@ -337,10 +358,13 @@ public class QCRepliedQCChallengeEventConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
}
}
}
}
@@ -364,7 +388,7 @@ public class CRCRepliedCheckChallengeEventConsumer(
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<CRCRepliedCheckChallengeEvent> context)
{
Console.WriteLine("发送(019,020) 【 CRC 回复一致性核查质疑 通知PM】邮件!!!");
Log.Logger.Warning("发送(019,020) 【 CRC 回复一致性核查质疑 通知PM】邮件!!!");
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
@@ -383,49 +407,58 @@ public class CRCRepliedCheckChallengeEventConsumer(
{
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager).ToList();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "CheckState",EnumValue=subjectVisit.CheckState.GetEnumInt(), }, //审核状态
}
});
//重新设置当前发送邮件的语言
isEn_US = workLanguage == UserWorkLanguage.US;
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "CheckState",EnumValue=subjectVisit.CheckState.GetEnumInt(), }, //审核状态
}
});
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager)
.Where(t => t.UserWorkLanguage == workLanguage).ToList();
foreach (var userinfo in userinfoList)
{
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(String.Empty, userinfo.EMail));
var toUserName = string.Join('、', userinfoList.Select(t => t.FullName));
foreach (var userinfo in userinfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.FullName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
toUserName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
subjectVisit.VisitName, // 访视 {3}
@@ -437,10 +470,17 @@ public class CRCRepliedCheckChallengeEventConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
}
}
}
}
@@ -466,12 +506,12 @@ public class PMRepliedCheckChallengeEventConsumer(
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<PMRepliedCheckChallengeEvent> context)
{
Console.WriteLine("发送(016017) 【 PM 一致性核查 通知CRC】邮件!!!");
Log.Logger.Warning("发送(016017) 【 PM 一致性核查 通知CRC】邮件!!!");
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var subjectVisitId = context.Message.SubjectVisitId;
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.NoneDicomStudyList).Include(x => x.StudyList).Include(x => x.Subject).FirstNotNullAsync();
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.NoneDicomStudyList).Include(x => x.StudyList).Include(x => x.Subject).Include(t => t.TrialSite).FirstNotNullAsync();
var trialId = subjectVisit.TrialId;
@@ -486,11 +526,11 @@ public class PMRepliedCheckChallengeEventConsumer(
var checkChallengeDialog = await _checkChallengeDialogRepository.Where(x => x.Id == context.Message.CheckChallengeDialogId).FirstNotNullAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).ToList();
var craInfo = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.CRA).FirstOrDefault();
var craInfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.CRA).ToList();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
@@ -499,28 +539,46 @@ public class PMRepliedCheckChallengeEventConsumer(
modalities = subjectVisit.NoneDicomStudyList.Select(t => t.Modality)
.Union(subjectVisit.StudyList.Select(k => k.ModalityForEdit)).ToList();
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
//foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
//重新设置当前发送邮件的语言
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "CheckState",EnumValue=subjectVisit.CheckState.GetEnumInt(), }, //核查状态
isEn_US = subjectVisit.TrialSite.Country == StaticData.SiteCountry.US;
}
});
var workLanguage = isEn_US ? UserWorkLanguage.US : UserWorkLanguage.CN;
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Where(t => t.UserWorkLanguage == workLanguage).ToList();
foreach (var userinfo in userinfoList)
{
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "CheckState",EnumValue=subjectVisit.CheckState.GetEnumInt(), }, //核查状态
}
});
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
if (craInfo != null)
var toUserName = string.Join('、', userinfoList.Select(t => t.FullName));
foreach (var userinfo in userinfoList)
{
messageToSend.Cc.Add(new MailboxAddress(craInfo.FullName, craInfo.EMail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
foreach (var user in craInfoList)
{
messageToSend.Cc.Add(new MailboxAddress(user.FullName, user.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
@@ -531,8 +589,8 @@ public class PMRepliedCheckChallengeEventConsumer(
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.FullName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
toUserName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
@@ -547,10 +605,11 @@ public class PMRepliedCheckChallengeEventConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
}
}
@@ -592,49 +651,57 @@ public class CheckStateChangedToAuditEventConsumer(
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
var trialUserList = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId && x.TrialUser.IsDeleted == false)
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager).ToList();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
// 遍历语言枚举 在底层判断收件人是否为空,决定是否跳过邮件发送,避免每个邮件场景的地方都重复判断
foreach (UserWorkLanguage workLanguage in Enum.GetValues<UserWorkLanguage>())
{
//重新设置当前发送邮件的语言
isEn_US = workLanguage == UserWorkLanguage.US;
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "CheckState",EnumValue=subjectVisit.CheckState.GetEnumInt(), }, //审核状态
var userinfoList = trialUserList.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager)
.Where(t => t.UserWorkLanguage == workLanguage).ToList();
}
});
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
{
DictionaryRepository = _dictionaryRepository,
IsEn_US = isEn_US,
DictionaryList = new List<DictionaryDto>()
{
new DictionaryDto (){DictionaryCode= "CheckState",EnumValue=subjectVisit.CheckState.GetEnumInt(), }, //审核状态
}
});
foreach (var userinfo in userinfoList)
{
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
var toUserName = string.Join('、', userinfoList.Select(t => t.FullName));
foreach (var userinfo in userinfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.FullName, // 姓名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
toUserName, // 姓名 {0}
trialInfo.ExperimentName, // 项目 {1}
subjectCode, // 受试者 {2}
subjectVisit.VisitName, // 访视 {3}
@@ -646,10 +713,11 @@ public class CheckStateChangedToAuditEventConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
}
}
@@ -671,7 +739,7 @@ public class QCClaimTaskEventConsumer(
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<QCClaimTaskEvent> context)
{
Console.WriteLine("发送(Code007008) 【QC 领取了质控任务】邮件!!!");
Log.Logger.Warning("发送(Code007008) 【QC 领取了质控任务】邮件!!!");
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
@@ -708,6 +776,10 @@ public class QCClaimTaskEventConsumer(
return;
}
//重新设置当前发送邮件的语言
var workLanguage = _userRoleRepository.Where(t => t.Id == userinfo.Id).Select(t => t.IdentityUser.UserWorkLanguage).First();
isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -745,7 +817,7 @@ public class QCClaimTaskEventConsumer(
var subjectCode = subjectVisit.Subject.Code;
var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userinfo.FullName, // 用户名 {0}
trialInfo.ExperimentName, // 项目 {1}
string.Join(',', subjectcodes), // 受试者 {2}
@@ -759,9 +831,9 @@ public class QCClaimTaskEventConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
}
@@ -74,13 +74,17 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
t.UserRole.IdentityUser.EMail,
t.UserRole.IdentityUser.UserName,
t.Trial.TrialCode,
t.Trial.ResearchProgramNo
t.Trial.ResearchProgramNo,
t.UserRole.IdentityUser.UserWorkLanguage
//TrialReadingCriterionList = t.Trial.TrialReadingCriterionList.Select(t => new { t.CriterionName, TrialReadingCriterionId = t.Id }).ToList()
});
foreach (var trialUser in trialUserList)
{
//重新设置当前发送邮件的语言
var workLanguage = trialUser.UserWorkLanguage;
isEn_US = workLanguage == UserWorkLanguage.US;
var userId = trialUser.UserId;
@@ -153,7 +157,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, emailContent),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, emailContent, workLanguage),
trialUser.FullName,
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
@@ -167,9 +171,9 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
//处理标记已通知的任务
@@ -44,12 +44,17 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
//找到 该项目的CRC 用户Id
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { t.UserId, t.UserRole.FullName }).ToListAsync();
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { t.UserId, t.UserRole.FullName, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
//判断是否任务可以领取 ,可以的话 发送邮件
foreach (var user in userList)
{
//重新设置当前发送邮件的语言
var workLanguage = user.UserWorkLanguage;
isEn_us = workLanguage == UserWorkLanguage.US;
var userId = user.UserId;
//过滤项目 并且 将 _userInfo.Id 换位 当前发送邮件的Id
var query = _trialRepository.Where(t => t.Id == trialId)
@@ -72,7 +77,7 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
{
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
var htmlContent = isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN;
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent, workLanguage),
user.FullName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sendStat.ToBeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
return (topicStr, htmlBodyStr, isEn_us, userId);
@@ -116,12 +121,17 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr, t.DeclarationTypeEnumList }).FirstNotNullAsync();
//找到 该项目的IQC 用户Id
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.UserRole.FullName }).ToListAsync();
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.UserRole.FullName, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
//判断是否任务可以领取 ,可以的话 发送邮件
foreach (var user in userList)
{
//重新设置当前发送邮件的语言
var workLanguage = user.UserWorkLanguage;
isEn_us = workLanguage == UserWorkLanguage.US;
var userId = user.UserId;
//过滤项目 并且 将 _userInfo.Id 换位 当前发送邮件的Id
@@ -147,7 +157,7 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
{
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
var htmlContent = isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN;
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent, workLanguage),
user.FullName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sendStat.ToBeDealedCount - sendStat.ReUploadTobeDealedCount, sendStat.ReUploadTobeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
@@ -181,7 +191,7 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<ImageQCRecurringEvent> context)
{
var trialId=context.Message.TrialId;
var trialId = context.Message.TrialId;
var isEn_us = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
@@ -192,13 +202,17 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
//找到 该项目的IQC 用户Id
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.UserRole.FullName }).ToListAsync();
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.UserRole.FullName, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
//判断是否任务可以领取 ,可以的话 发送邮件
var userIdList = userList.Select(t => t.UserId).ToList();
foreach (var user in userList)
{
//重新设置当前发送邮件的语言
var workLanguage = user.UserWorkLanguage;
isEn_us = workLanguage == UserWorkLanguage.US;
var userId = user.UserId;
//过滤项目 并且 将 _userInfo.Id 换位 当前发送邮件的Id
@@ -222,11 +236,11 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
{
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
var htmlContent = isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN;
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent, workLanguage),
user.FullName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sendStat.ToBeClaimedCount, sendStat.ToBeReviewedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
return (topicStr, htmlBodyStr, false, userId);
@@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.MassTransit.Consumer;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using MassTransit;
using Microsoft.Extensions.Options;
using MimeKit;
@@ -84,203 +85,213 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
Console.WriteLine("发送定时过期提醒:人员数量" + userinfoList.Count);
int index = 1;
foreach (var userinfo in userinfoList)
var scenario = EmailBusinessScenario.GeneralTraining_ExpirationNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig == null)
{
return;
}
var userWorkLanguageList = userinfoList.Select(x => x.UserWorkLanguage).Distinct().ToList();
foreach (var workLanguage in userWorkLanguageList)
{
try
{
Console.WriteLine($"{index}发送定时过期提醒,邮箱:{userinfo.EMail},姓名{userinfo.UserName}");
index++;
var langUserInfoList = userinfoList.Where(x => x.UserWorkLanguage == workLanguage).ToList();
if (!langUserInfoList.Any())
{
continue;
}
var userIsEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
foreach (var userinfo in langUserInfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var userNames = langUserInfoList.Select(x => x.UserName).ToList();
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.UserName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames),
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
var scenario = EmailBusinessScenario.GeneralTraining_ExpirationNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig != null)
{
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
catch (Exception)
{
}
}
}
}
/// <summary>
/// 生效通知
/// </summary>
public class SystemDocumentPublishEventConsumer(
IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository,
IRepository<VisitTask> _visitTaskRepository,
IRepository<SystemDocument> _systemDocumentRepository,
IRepository<IdentityUser> _identityUserRepository,
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<TrialUserRole> _trialUserRoleRepository,
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
/// <summary>
/// 生效通知
/// </summary>
public class SystemDocumentPublishEventConsumer(
IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository,
IRepository<VisitTask> _visitTaskRepository,
IRepository<SystemDocument> _systemDocumentRepository,
IRepository<IdentityUser> _identityUserRepository,
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<TrialUserRole> _trialUserRoleRepository,
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig) : IConsumer<SystemDocumentPublishEvent>
{
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<SystemDocumentPublishEvent> context)
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig) : IConsumer<SystemDocumentPublishEvent>
{
var isEn_US = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
//设置当前事件传递过来的语言
var culture = context.Message.CultureInfoName;
CultureInfo.CurrentCulture = new CultureInfo(culture);
// 记录是否只发送给新增角色的日志
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
public async Task Consume(ConsumeContext<SystemDocumentPublishEvent> context)
{
Console.WriteLine($"只发送给新增的角色,角色数量: {context.Message.NewUserTypeIds.Count}");
}
// 构建查询
IQueryable<UnionDocumentWithConfirmInfoView> systemDocQuery;
var isEn_US = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
{
// 只查询新增角色的用户
systemDocQuery =
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
from identityUser in _identityUserRepository.AsQueryable(false)
.Where(t => t.Status == UserStateEnum.Enable &&
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
.Any(t => context.Message.NewUserTypeIds.Contains(t.UserTypeId) &&
sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
select new UnionDocumentWithConfirmInfoView()
//设置当前事件传递过来的语言
var culture = context.Message.CultureInfoName;
CultureInfo.CurrentCulture = new CultureInfo(culture);
// 记录是否只发送给新增角色的日志
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
{
IsSystemDoc = true,
Id = sysDoc.Id,
CreateTime = sysDoc.CreateTime,
IsDeleted = sysDoc.IsDeleted,
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
Name = sysDoc.Name,
Path = sysDoc.Path,
FileTypeId = sysDoc.FileTypeId,
UpdateTime = sysDoc.UpdateTime,
ConfirmUserId = identityUser.Id,
RealName = identityUser.FullName,
UserName = identityUser.UserName,
IsNeedSendEmial = identityUser.IsZhiZhun || (!identityUser.IsZhiZhun && sysDoc.DocUserSignType == DocUserSignType.InnerAndOuter),
FullFilePath = sysDoc.Path
};
}
else
{
// 查询所有相关角色的用户
systemDocQuery =
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
from identityUser in _identityUserRepository.AsQueryable(false)
.Where(t => t.Status == UserStateEnum.Enable &&
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
select new UnionDocumentWithConfirmInfoView()
Console.WriteLine($"只发送给新增的角色,角色数量: {context.Message.NewUserTypeIds.Count}");
}
// 构建查询
IQueryable<UnionDocumentWithConfirmInfoView> systemDocQuery;
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
{
IsSystemDoc = true,
Id = sysDoc.Id,
CreateTime = sysDoc.CreateTime,
IsDeleted = sysDoc.IsDeleted,
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
Name = sysDoc.Name,
Path = sysDoc.Path,
FileTypeId = sysDoc.FileTypeId,
UpdateTime = sysDoc.UpdateTime,
ConfirmUserId = identityUser.Id,
RealName = identityUser.FullName,
UserName = identityUser.UserName,
IsNeedSendEmial = identityUser.IsZhiZhun || (!identityUser.IsZhiZhun && sysDoc.DocUserSignType == DocUserSignType.InnerAndOuter),
FullFilePath = sysDoc.Path
};
}
var datalist = await systemDocQuery.IgnoreQueryFilters().Where(x => x.IsNeedSendEmial).ToListAsync();
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
int index = 1;
foreach (var userinfo in userinfoList)
{
string msg = $"{index}生效通知,邮箱:{userinfo.EMail},姓名{userinfo.UserName},";
index++;
try
{
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
// 只查询新增角色的用户
systemDocQuery =
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
from identityUser in _identityUserRepository.AsQueryable(false)
.Where(t => t.Status == UserStateEnum.Enable &&
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
.Any(t => context.Message.NewUserTypeIds.Contains(t.UserTypeId) &&
sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
select new UnionDocumentWithConfirmInfoView()
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.UserName, // 用户名 {0}
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
IsSystemDoc = true,
Id = sysDoc.Id,
CreateTime = sysDoc.CreateTime,
IsDeleted = sysDoc.IsDeleted,
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
Name = sysDoc.Name,
Path = sysDoc.Path,
FileTypeId = sysDoc.FileTypeId,
UpdateTime = sysDoc.UpdateTime,
ConfirmUserId = identityUser.Id,
RealName = identityUser.FullName,
UserName = identityUser.UserName,
IsNeedSendEmial = identityUser.IsZhiZhun || (!identityUser.IsZhiZhun && sysDoc.DocUserSignType == DocUserSignType.InnerAndOuter),
FullFilePath = sysDoc.Path
};
var scenario = EmailBusinessScenario.GeneralTraining_EffectiveNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig != null)
}
else
{
// 查询所有相关角色的用户
systemDocQuery =
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
from identityUser in _identityUserRepository.AsQueryable(false)
.Where(t => t.Status == UserStateEnum.Enable &&
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
select new UnionDocumentWithConfirmInfoView()
{
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
IsSystemDoc = true,
Id = sysDoc.Id,
CreateTime = sysDoc.CreateTime,
IsDeleted = sysDoc.IsDeleted,
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
Name = sysDoc.Name,
Path = sysDoc.Path,
FileTypeId = sysDoc.FileTypeId,
UpdateTime = sysDoc.UpdateTime,
ConfirmUserId = identityUser.Id,
RealName = identityUser.FullName,
UserName = identityUser.UserName,
IsNeedSendEmial = identityUser.IsZhiZhun || (!identityUser.IsZhiZhun && sysDoc.DocUserSignType == DocUserSignType.InnerAndOuter),
FullFilePath = sysDoc.Path
};
}
var datalist = await systemDocQuery.IgnoreQueryFilters().Where(x => x.IsNeedSendEmial).ToListAsync();
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
var scenario = EmailBusinessScenario.GeneralTraining_EffectiveNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig == null)
{
return;
}
var userWorkLanguageList = userinfoList.Select(x => x.UserWorkLanguage).Distinct().ToList();
foreach (var workLanguage in userWorkLanguageList)
{
var langUserInfoList = userinfoList.Where(x => x.UserWorkLanguage == workLanguage).ToList();
if (!langUserInfoList.Any())
{
continue;
}
string msg = $"{langUserInfoList.Count}生效通知,";
try
{
var messageToSend = new MimeMessage();
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
foreach (var userinfo in langUserInfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var userIsEn_US = workLanguage == UserWorkLanguage.US;
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var userNames = langUserInfoList.Select(x => x.UserName).ToList();
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames),
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
msg += "发送成功";
}
catch (Exception)
{
msg += "发送失败";
}
}
catch (Exception)
{
msg += "发送失败";
Console.WriteLine(msg);
}
Console.WriteLine(msg);
}
}
}
}
@@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.MassTransit.Consumer;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using MassTransit;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@@ -108,46 +109,65 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
Console.WriteLine("发送定时项目过期提醒:人员数量" + userinfoList.Count);
int index = 1;
foreach (var userinfo in userinfoList)
var scenario = EmailBusinessScenario.TrialTraining_ExpirationNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig == null)
{
return;
}
var userTrialIdList = datalist.Select(t => new { t.ConfirmUserId, t.TrialId }).Distinct().ToList();
var userWithTrialList = (from ut in userTrialIdList
join u in userinfoList on ut.ConfirmUserId equals u.Id
select new { ut.TrialId, User = u }).ToList();
var groupedList = userWithTrialList.GroupBy(x => new { x.TrialId, x.User.UserWorkLanguage }).ToList();
foreach (var groupItem in groupedList)
{
try
{
Console.WriteLine($"{index}发送定时过期提醒,邮箱:{userinfo.EMail},姓名{userinfo.UserName}");
index++;
var trialInfo = _trialRepository.Where(x => x.Id == userinfo.TrialId).FirstOrDefault();
var langUserInfoList = groupItem.Select(x => x.User).Distinct().ToList();
if (!langUserInfoList.Any())
{
continue;
}
Console.WriteLine($"发送定时过期提醒,数量:{langUserInfoList.Count}");
var trialInfo = await _trialRepository.Where(x => x.Id == groupItem.Key.TrialId).FirstOrDefaultAsync();
if (trialInfo == null)
{
continue;
}
var workLanguage = groupItem.Key.UserWorkLanguage;
var userIsEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
foreach (var userinfo in langUserInfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var userNames = langUserInfoList.Select(x => x.UserName).ToList();
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.UserName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames),
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
var scenario = EmailBusinessScenario.TrialTraining_ExpirationNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig != null)
{
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
}
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
catch (Exception)
@@ -264,52 +284,65 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
int index = 1;
foreach (var userinfo in userinfoList)
var scenario = EmailBusinessScenario.TrialTraining_EffectiveNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsEnable).FirstOrDefault();
if (emailConfig == null)
{
string msg = $"{index}项目生效通知,邮箱:{userinfo.EMail},姓名{userinfo.UserName},";
index++;
return;
}
var userTrialIdList = datalist.Select(t => new { t.ConfirmUserId, t.TrialId }).Distinct().ToList();
var userWithTrialList = (from ut in userTrialIdList
join u in userinfoList on ut.ConfirmUserId equals u.Id
select new { ut.TrialId, User = u }).ToList();
var groupedList = userWithTrialList.GroupBy(x => new { x.TrialId, x.User.UserWorkLanguage }).ToList();
foreach (var groupItem in groupedList)
{
var langUserInfoList = groupItem.Select(x => x.User).Distinct().ToList();
if (!langUserInfoList.Any())
{
continue;
}
string msg = $"{langUserInfoList.Count}项目生效通知,";
try
{
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
foreach (var userinfo in langUserInfoList)
{
messageToSend.To.Add(new MailboxAddress(userinfo.FullName, userinfo.EMail));
}
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var workLanguage = groupItem.Key.UserWorkLanguage;
var userIsEn_US = workLanguage == UserWorkLanguage.US;
var companyName = userIsEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var userNames = langUserInfoList.Select(x => x.UserName).ToList();
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
userinfo.UserName, // 用户名 {0}
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
string.Join(',', userNames),
_systemEmailConfig.SiteUrl
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc, workLanguage);
var scenario = EmailBusinessScenario.TrialTraining_EffectiveNotification;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsEnable).FirstOrDefault();
if (emailConfig != null)
var trialInfo = await _trialRepository.Where(x => x.Id == groupItem.Key.TrialId).FirstOrDefaultAsync();
if (trialInfo == null)
{
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
var trial = datalist.Where(x => x.ConfirmUserId == userinfo.Id).FirstOrDefault();
var trialInfo = await _trialRepository.Where(x=>x.Id==trial.TrialId).FirstNotNullAsync();
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
msg += "发送成功";
continue;
}
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
msg += "发送成功";
}
catch (Exception)
@@ -54,8 +54,8 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
.WhereIf(inQuery.IsHaveQuestion != null, t => t.IsHaveQuestion == inQuery.IsHaveQuestion)
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
.WhereIf(inQuery.IsHaveQuestion != null, t => t.IsHaveQuestion == inQuery.IsHaveQuestion)
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime >= inQuery.BeginAllocateDate)
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime <= inQuery.EndAllocateDate)
@@ -211,23 +211,23 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId)
.WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent)
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
.WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState)
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName))
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
.WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState)
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName))
.WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId)
.WhereIf(inQuery.ReadingCategory != null, t => t.VisitTask.ReadingCategory == inQuery.ReadingCategory)
.WhereIf(inQuery.ReadingTaskState != null, t => t.VisitTask.ReadingTaskState == inQuery.ReadingTaskState)
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
.WhereIf(inQuery.IsGetBeRead, x => !x.IsInvalid && x.AuditState != MedicalReviewAuditState.HaveSigned)
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
.WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime)
.WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime)
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime >= inQuery.BeginAllocateDate)
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
.WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime)
.WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime)
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime >= inQuery.BeginAllocateDate)
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime <= inQuery.EndAllocateDate)
.WhereIf(inQuery.ArmEnum != null, t => t.VisitTask.ArmEnum == inQuery.ArmEnum)
.WhereIf(inQuery.ArmEnum != null, t => t.VisitTask.ArmEnum == inQuery.ArmEnum)
.WhereIf(inQuery.MedicalManagerUserId != null, t => t.MedicalManagerUserId == inQuery.MedicalManagerUserId)
.WhereIf(inQuery.BeginSignTime != null, t => t.VisitTask.SignTime > inQuery.BeginSignTime)
.WhereIf(inQuery.EndSignTime != null, t => t.VisitTask.SignTime < inQuery.EndSignTime)
@@ -873,7 +873,7 @@ namespace IRaCIS.Core.Application.Service
{
arm1.TaskAllocationState = TaskAllocationState.Allocated;
arm1.AllocateTime = DateTime.Now;
arm1.DoctorUserId = task1.DoctorUserId;
arm1.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm1)!.DoctorUserId;
arm1.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
}
@@ -913,7 +913,7 @@ namespace IRaCIS.Core.Application.Service
{
taskOne.TaskAllocationState = TaskAllocationState.Allocated;
taskOne.AllocateTime = DateTime.Now;
taskOne.DoctorUserId = task1!.DoctorUserId;
taskOne.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm1)!.DoctorUserId;
taskOne.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
}
@@ -944,7 +944,7 @@ namespace IRaCIS.Core.Application.Service
{
arm2.TaskAllocationState = TaskAllocationState.Allocated;
arm2.AllocateTime = DateTime.Now;
arm2.DoctorUserId = task2.DoctorUserId;
arm2.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm2)!.DoctorUserId;
arm2.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
}
@@ -986,7 +986,7 @@ namespace IRaCIS.Core.Application.Service
{
taskTwo.TaskAllocationState = TaskAllocationState.Allocated;
taskTwo.AllocateTime = DateTime.Now;
taskTwo.DoctorUserId = task2!.DoctorUserId;
taskTwo.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm2)!.DoctorUserId;
taskTwo.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
}
@@ -1016,9 +1016,9 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
if (critrion.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
{
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialExtraConfigJsonStr }).FirstOrDefault();
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.IsOpenLostVistRead }).FirstOrDefault();
var extralConfig = JsonConvert.DeserializeObject<TrialExtraConfig>(extralObj?.TrialExtraConfigJsonStr) ?? new TrialExtraConfig();
//var extralConfig = JsonConvert.DeserializeObject<TrialExtraConfig>(extralObj?.TrialExtraConfigJsonStr) ?? new TrialExtraConfig();
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect && x.Subject.IsSubjectQuit == false)
@@ -1027,7 +1027,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
.WhereIf(critrion.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum))
// 前序 不存在 未一致性核查未通过的
.Where(t => !t.Subject.SubjectVisitList.Where(t => extralConfig.IsOpenLostVistRead ? t.IsLostVisit == false : true).Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum >= sv.VisitNum))
.Where(t => !t.Subject.SubjectVisitList.Where(t => extralObj.IsOpenLostVistRead ? t.IsLostVisit == false : true).Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum >= sv.VisitNum))
//.WhereIf(critrion.IsAutoCreate == false, t => t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(t => t.IsGeneratedTask == false) ?
//t.VisitTaskNum <= t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsGeneratedTask == false).Min(t => t.SubjectVisit.VisitNum) : true)
//.Where(t => t.Subject.SubjectVisitList.Any(t => t.CheckState != CheckStateEnum.CVPassed) ? t.VisitTaskNum <= t.Subject.SubjectVisitList.Where(t => t.CheckState != CheckStateEnum.CVPassed).Min(t => t.VisitNum) : true)
@@ -1050,14 +1050,14 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
UnReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Count(),
//未读 里可读任务量
UnReadCanReadTaskCount = x.Where(t => extralConfig.IsOpenLostVistRead ? true : t.IsFrontTaskNeedSignButNotSign == false).Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)
UnReadCanReadTaskCount = x.Where(t => extralObj.IsOpenLostVistRead ? true : t.IsFrontTaskNeedSignButNotSign == false).Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)
//不能对包含聚合或子查询的表达式执行聚合函数
//&& !x.Any(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.IsNeedClinicalDataSign == true && t.IsClinicalDataSign == false && t.VisitTaskNum<y.VisitTaskNum )
).Count(),
UnReadCanReadTaskList = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
.Where(t => extralConfig.IsOpenLostVistRead ? true : t.IsFrontTaskNeedSignButNotSign == false)
.Where(t => extralObj.IsOpenLostVistRead ? true : t.IsFrontTaskNeedSignButNotSign == false)
.Where(y => /*y.IsFrontTaskNeedSignButNotSign == false &&*/ (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true))
.OrderBy(x => x.VisitTaskNum)
.Select(u => new IRUnreadTaskView()
@@ -0,0 +1,130 @@
using DocumentFormat.OpenXml.Spreadsheet;
using IRaCIS.Application.Contracts;
using Medallion.Threading;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.Common;
[ApiExplorerSettings(GroupName = "Common")]
public class DeployConfigService(IMapper _mapper, IUserInfo _userInfo, IWebHostEnvironment _hostEnvironment, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService
{
/// <summary>
/// 获取系统基础配置信息
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public async Task<ServiceVerifyConfigOption> GetSystemBasicConfigInfo([FromServices] IOptionsMonitor<ServiceVerifyConfigOption> options)
{
return options.CurrentValue;
}
/// <summary>
/// 更新系统基础配置
/// </summary>
/// <param name="basicSystemConfigOption"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> UpdateSystemBasicConfig(ServiceVerifyConfigOption basicSystemConfigOption)
{
var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json";
string text = System.IO.File.ReadAllText(path);
// 修改
JObject obj = JObject.Parse(text);
// QCRiskControl 相关配置
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.QCRiskControl)] = basicSystemConfigOption.QCRiskControl;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenUserComplexPassword)] = basicSystemConfigOption.OpenUserComplexPassword;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenSignDocumentBeforeWork)] = basicSystemConfigOption.OpenSignDocumentBeforeWork;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenTrialRelationDelete)] = basicSystemConfigOption.OpenTrialRelationDelete;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenLoginLimit)] = basicSystemConfigOption.OpenLoginLimit;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.LoginMaxFailCount)] = basicSystemConfigOption.LoginMaxFailCount;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.LoginFailLockMinutes)] = basicSystemConfigOption.LoginFailLockMinutes;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.AutoLoginOutMinutes)] = basicSystemConfigOption.AutoLoginOutMinutes;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenLoginMFA)] = basicSystemConfigOption.OpenLoginMFA;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ContinuousReadingTimeMin)] = basicSystemConfigOption.ContinuousReadingTimeMin;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ReadingRestTimeMin)] = basicSystemConfigOption.ReadingRestTimeMin;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.IsNeedChangePassWord)] = basicSystemConfigOption.IsNeedChangePassWord;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ChangePassWordDays)] = basicSystemConfigOption.ChangePassWordDays;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.TemplateType)] = ((int)basicSystemConfigOption.TemplateType); // 枚举需要转换为字符串
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ThirdPdfUrl)] = basicSystemConfigOption.ThirdPdfUrl;
obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.UserMFAVerifyMinutes)] = basicSystemConfigOption.UserMFAVerifyMinutes;
// 重新写入appsettings.json
string result = obj.ToString();
System.IO.File.WriteAllText(path, result);
return ResponseOutput.Ok();
}
/// <summary>
/// 获取系统邮件配置信息
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public async Task<SystemEmailSendConfig> GetEmailConfigInfo([FromServices] IOptionsMonitor<SystemEmailSendConfig> options)
{
return options.CurrentValue;
}
/// <summary>
/// 更新系统邮件配置
/// </summary>
/// <param name="emailConfig"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> UpdateSystemEmailConfig(SystemEmailSendConfig emailConfig)
{
var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json";
string text = System.IO.File.ReadAllText(path);
// 修改
JObject obj = JObject.Parse(text);
// SystemEmailSendConfig 相关配置
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.Port)] = emailConfig.Port;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.Host)] = emailConfig.Host;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.Imap)] = emailConfig.Imap;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.ImapPort)] = emailConfig.ImapPort;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.FromEmail)] = emailConfig.FromEmail;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.FromName)] = emailConfig.FromName;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.AuthorizationCode)] = emailConfig.AuthorizationCode;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.SiteUrl)] = emailConfig.SiteUrl;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.PlatformName)] = emailConfig.PlatformName;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.PlatformNameCN)] = emailConfig.PlatformNameCN;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.SystemShortName)] = emailConfig.SystemShortName;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.OrganizationName)] = emailConfig.OrganizationName;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.OrganizationNameCN)] = emailConfig.OrganizationNameCN;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyName)] = emailConfig.CompanyName;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyNameCN)] = emailConfig.CompanyNameCN;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyShortName)] = emailConfig.CompanyShortName;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyShortNameCN)] = emailConfig.CompanyShortNameCN;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.IsEnv_US)] = emailConfig.IsEnv_US;
obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.EmailRegexStr)] = emailConfig.EmailRegexStr;
// 重新写入appsettings.json
string result = obj.ToString();
System.IO.File.WriteAllText(path, result);
return ResponseOutput.Ok();
}
}
@@ -1,6 +1,8 @@
using IRaCIS.Application.Contracts;
using DocumentFormat.OpenXml.Spreadsheet;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Auth;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.MassTransit.Consumer;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
@@ -66,7 +68,7 @@ namespace IRaCIS.Core.Application.Service
Task AddUserSendEmailAsync(Guid userId, string baseUrl, string routeUrl);
Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456", string baseUrl="");
Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456", string baseUrl = "");
Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl);
@@ -104,10 +106,18 @@ namespace IRaCIS.Core.Application.Service
{
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
/// <summary>
/// 获取邮件主题和html 通用封装 以用户语言为主,没有的就用当前的请求语言_userInfo.IsEn_Us
/// </summary>
/// <param name="scenario"></param>
/// <param name="messageToSend"></param>
/// <param name="emailFunc"></param>
/// <param name="userWorkLanguage"></param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
private async Task<EmailNoticeConfig> GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario scenario, MimeMessage messageToSend,
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc)
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc, UserWorkLanguage? userWorkLanguage = null)
{
var configInfo = await _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario).FirstOrDefaultAsync();
@@ -119,7 +129,9 @@ namespace IRaCIS.Core.Application.Service
}
var (topicStr, htmlBodyStr) = _userInfo.IsEn_Us ? (configInfo.EmailTopic, configInfo.EmailHtmlContent) : (configInfo.EmailTopicCN, configInfo.EmailHtmlContentCN);
bool isEn_Us = userWorkLanguage.HasValue ? userWorkLanguage.Value == UserWorkLanguage.US : _userInfo.IsEn_Us;
var (topicStr, htmlBodyStr) = isEn_Us ? (configInfo.EmailTopic, configInfo.EmailHtmlContent) : (configInfo.EmailTopicCN, configInfo.EmailHtmlContentCN);
try
{
@@ -182,24 +194,16 @@ namespace IRaCIS.Core.Application.Service
return sucessHandle;
}
private string ReplaceCompanyName(string needDealtxt)
{
var str = needDealtxt.Replace("{company}", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyName : _systemEmailConfig.CompanyNameCN)
.Replace("{company abbreviation}", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN);
return str;
}
private string ReplacePlatformName(string needDealtxt)
{
var platformName = _userInfo.IsEn_Us ? _systemEmailConfig.PlatformName : _systemEmailConfig.PlatformNameCN;
var str = needDealtxt.Replace("{platformName}", platformName);
return str;
}
//MFA
public async Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode, UserMFAType mfaType = UserMFAType.Login)
{
//设置工作语言
var workLanguage = _identityUserRepository.Where(t => t.Id == userId).Select(t => t.UserWorkLanguage).First();
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -207,13 +211,13 @@ namespace IRaCIS.Core.Application.Service
messageToSend.To.Add(new MailboxAddress(userName, emailAddress));
//主题---[来自{0}] 关于MFA邮箱验证的提醒
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userName,
verificationCode
);
@@ -222,7 +226,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(mfaType == UserMFAType.Login ? EmailBusinessScenario.MFALogin : EmailBusinessScenario.MFAUnlock, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(mfaType == UserMFAType.Login ? EmailBusinessScenario.MFALogin : EmailBusinessScenario.MFAUnlock, messageToSend, emailConfigFunc, workLanguage);
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress);
@@ -245,6 +249,11 @@ namespace IRaCIS.Core.Application.Service
public async Task SendEmailVerification(string emailAddress, int verificationCode)
{
//设置工作语言
var isEn_US = _userInfo.IsEn_Us;
var workLanguage = isEn_US ? UserWorkLanguage.US : UserWorkLanguage.CN;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -253,13 +262,13 @@ namespace IRaCIS.Core.Application.Service
//主题
//---[来自展影IRC]的提醒
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
"Sir/Madam",
//---您正在参与展影医疗IRC项目
@@ -271,7 +280,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.ReviewerLogin, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.ReviewerLogin, messageToSend, emailConfigFunc, workLanguage);
//此时不知道用户
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress);
@@ -286,8 +295,10 @@ namespace IRaCIS.Core.Application.Service
//中心调研 登陆 发送验证码
public async Task AnolymousSendEmail(Guid trialId, string emailAddress, int verificationCode)
{
//throw new BusinessValidationFailedException("模拟邮件取数据或者发送异常!!!");
//设置工作语言
var isEn_US = _userInfo.IsEn_Us;
var workLanguage = isEn_US ? UserWorkLanguage.US : UserWorkLanguage.CN;
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
@@ -299,13 +310,13 @@ namespace IRaCIS.Core.Application.Service
//主题
//$"[来自展影IRC] [{researchProgramNo}] 关于中心调研的提醒";
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
"Sir/Madam",
//---您正在参与展影医疗IRC项目中心调研工作
@@ -317,13 +328,13 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurveyLogin, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurveyLogin, messageToSend, emailConfigFunc, workLanguage);
//此时不知道用户
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo, sucessHandle);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo, sucessHandle);
}
@@ -335,6 +346,9 @@ namespace IRaCIS.Core.Application.Service
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).Include(t => t.UserRoleList).ThenInclude(c => c.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
//设置工作语言
var workLanguage = sysUserInfo.UserWorkLanguage;
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
@@ -349,20 +363,19 @@ namespace IRaCIS.Core.Application.Service
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new IdentityUser() { EmailToken = token });
routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (isEn_US ? "en" : "zh") + "&access_token=" + token;
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
sysUserInfo.FullName,
sysUserInfo.EMail,
@@ -374,7 +387,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SysCreateUser, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SysCreateUser, messageToSend, emailConfigFunc, sysUserInfo.UserWorkLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
@@ -385,6 +398,11 @@ namespace IRaCIS.Core.Application.Service
{
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).Include(t => t.UserRoleList).ThenInclude(c => c.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
//设置工作语言
var workLanguage = sysUserInfo.UserWorkLanguage;
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -393,13 +411,13 @@ namespace IRaCIS.Core.Application.Service
//主题
//---[来自展影IRC] 关于重置账户密码的提醒
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
sysUserInfo.FullName,
sysUserInfo.UserName,
@@ -413,7 +431,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SysResetPassword, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SysResetPassword, messageToSend, emailConfigFunc, sysUserInfo.UserWorkLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@@ -421,6 +439,10 @@ namespace IRaCIS.Core.Application.Service
//用户重置邮箱
public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode)
{
//设置工作语言
var workLanguage = _identityUserRepository.Where(t => t.Id == userId).Select(t => t.UserWorkLanguage).First();
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
@@ -430,13 +452,13 @@ namespace IRaCIS.Core.Application.Service
//主题
//---[来自展影IRC] 关于重置邮箱的提醒
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userName,
//---您正在进行邮箱重置操作
@@ -447,7 +469,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc, workLanguage);
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress);
@@ -460,6 +482,11 @@ namespace IRaCIS.Core.Application.Service
//不登录 通过邮箱重置密码
public async Task AnolymousSendEmailForResetAccount(string emailAddress, int verificationCode)
{
//设置工作语言
var isEn_US = _userInfo.IsEn_Us;
var workLanguage = isEn_US ? UserWorkLanguage.US : UserWorkLanguage.CN;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -467,13 +494,13 @@ namespace IRaCIS.Core.Application.Service
messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress));
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
"Sir/Madam",
//---您正在进行邮箱重置密码操作
@@ -484,7 +511,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc, workLanguage);
////此时不知道用户
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress);
@@ -500,6 +527,11 @@ namespace IRaCIS.Core.Application.Service
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
//设置工作语言
var workLanguage = sysUserInfo.UserWorkLanguage;
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -518,18 +550,18 @@ namespace IRaCIS.Core.Application.Service
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (isEn_US ? "en" : "zh") + "&access_token=" + token;
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
sysUserInfo.FullName,
trialInfo.ExperimentName,
@@ -544,9 +576,9 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo, null);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
@@ -555,10 +587,12 @@ namespace IRaCIS.Core.Application.Service
{
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
//设置工作语言
var workLanguage = sysUserInfo.UserWorkLanguage;
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -575,20 +609,20 @@ namespace IRaCIS.Core.Application.Service
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new Domain.Models.IdentityUser() { EmailToken = token });
}
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (isEn_US ? "en" : "zh") + "&access_token=" + token;
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
sysUserInfo.FullName,
trialInfo.ExperimentName,
@@ -603,9 +637,9 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
@@ -644,6 +678,12 @@ namespace IRaCIS.Core.Application.Service
saveItem.IsTestUser = true;
}
//通过医生信息,设置工作语言
var nation = _doctorTypeRepository.Where(t => t.Id == doctorId).Select(t => t.Nation).FirstOrDefault();
saveItem.UserWorkLanguage = nation == DoctorNation.CN ? UserWorkLanguage.CN : UserWorkLanguage.US;
saveItem.UserCeateSource = UserCeateSource.ReviewerSelect;
saveItem.TrialId = trialId;
@@ -686,6 +726,11 @@ namespace IRaCIS.Core.Application.Service
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
//设置工作语言
var workLanguage = sysUserInfo.UserWorkLanguage;
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -701,7 +746,7 @@ namespace IRaCIS.Core.Application.Service
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new Domain.Models.IdentityUser() { EmailToken = token });
}
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (isEn_US ? "en" : "zh") + "&access_token=" + token;
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
@@ -711,13 +756,13 @@ namespace IRaCIS.Core.Application.Service
// $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信";
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
sysUserInfo.FullName,
trialInfo.ExperimentName,
@@ -732,9 +777,9 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.DoctorUserFirstJoinTrial : EmailBusinessScenario.DoctorUserExistJoinTrial, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.DoctorUserFirstJoinTrial : EmailBusinessScenario.DoctorUserExistJoinTrial, messageToSend, emailConfigFunc,workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo, null);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo, null);
//创建账号 和创建角色 一条,更新的时候才记录更新角色
if (isNeedCreateNewUser == false)
@@ -754,6 +799,10 @@ namespace IRaCIS.Core.Application.Service
{
var feedBack = await _userFeedBackRepository.Where(t => t.Id == feedBackId).Include(t => t.CreateUserRole.UserTypeRole).Include(t => t.CreateUserRole.IdentityUser).FirstNotNullAsync();
//设置工作语言
var workLanguage = _identityUserRepository.Where(t => t.Id == _userInfo.IdentityUserId).Select(t => t.UserWorkLanguage).First();
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -762,7 +811,7 @@ namespace IRaCIS.Core.Application.Service
var trialinfo = await _trialRepository.Where(x => x.Id == feedBack.TrialId).FirstOrDefaultAsync();
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var emialScenario = feedBack.VisitTaskId != null ? EmailBusinessScenario.IRImageError : (feedBack.SubjectVisitId != null ? EmailBusinessScenario.TrialSubjectVisitFeedBack : (feedBack.TrialId != null ? EmailBusinessScenario.TrialFeedBack : EmailBusinessScenario.SysFeedBack));
@@ -785,7 +834,7 @@ namespace IRaCIS.Core.Application.Service
if (feedBack.VisitTaskId != null)
{
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "FeedBackTypeToIR" && t.ParentId != null && t.Code == ((int)feedBack.QuestionType).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "FeedBackTypeToIR" && t.ParentId != null && t.Code == ((int)feedBack.QuestionType).ToString()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefaultAsync();
var info = await _visitTaskRepository.Where(t => t.Id == feedBack.VisitTaskId).Select(t => new { t.Trial.ResearchProgramNo, t.Trial.TrialCode, SubejctCode = t.Subject.Code, t.SourceSubjectVisit.VisitName }).FirstNotNullAsync();
@@ -794,7 +843,7 @@ namespace IRaCIS.Core.Application.Service
{
var topicStr = string.Format(input.topicStr, info.ResearchProgramNo, info.SubejctCode, info.VisitName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userNames,
info.TrialCode,
info.SubejctCode,
@@ -810,12 +859,12 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.IRImageError, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.IRImageError, messageToSend, emailConfigFunc, workLanguage);
}
else if (feedBack.SubjectVisitId != null)
{
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialSubjectVisitFeedBack).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialSubjectVisitFeedBack).ToString()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefaultAsync();
var info = await _subjectVisitRepository.Where(t => t.Id == feedBack.SubjectVisitId).Select(t => new { t.Trial.ResearchProgramNo, t.Trial.TrialCode, SubejctCode = t.Subject.Code, t.VisitName }).FirstNotNullAsync();
@@ -824,7 +873,7 @@ namespace IRaCIS.Core.Application.Service
{
var topicStr = string.Format(input.topicStr, info.ResearchProgramNo, info.SubejctCode, info.VisitName);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userNames,
info.TrialCode,
info.SubejctCode,
@@ -840,13 +889,13 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.TrialSubjectVisitFeedBack, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.TrialSubjectVisitFeedBack, messageToSend, emailConfigFunc, workLanguage);
}
//项目相关的反馈 pm admin
else if (feedBack.TrialId != null)
{
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialFeedBack).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialFeedBack).ToString()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefaultAsync();
var info = await _trialRepository.Where(t => t.Id == feedBack.TrialId).Select(t => new { t.ResearchProgramNo, t.TrialCode }).FirstNotNullAsync();
@@ -855,7 +904,7 @@ namespace IRaCIS.Core.Application.Service
{
var topicStr = string.Format(input.topicStr, info.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userNames,
info.TrialCode,
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
@@ -869,7 +918,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.TrialFeedBack, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.TrialFeedBack, messageToSend, emailConfigFunc, workLanguage);
}
//项目无关的反馈 admin
@@ -881,7 +930,7 @@ namespace IRaCIS.Core.Application.Service
{
var topicStr = string.Format(input.topicStr);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
userNames,
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
feedBack.CreateUserRole.IdentityUser.FullName,
@@ -893,7 +942,7 @@ namespace IRaCIS.Core.Application.Service
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SysFeedBack, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SysFeedBack, messageToSend, emailConfigFunc, workLanguage);
}
if (trialinfo == null)
@@ -902,9 +951,9 @@ namespace IRaCIS.Core.Application.Service
}
else
{
await SendEmailHelper.SendEmailAsync(messageToSend, trialinfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialinfo);
}
}
@@ -915,6 +964,10 @@ namespace IRaCIS.Core.Application.Service
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
//设置工作语言
var workLanguage = sysUserInfo.UserWorkLanguage;
var isEn_US = workLanguage == UserWorkLanguage.US;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -923,22 +976,23 @@ namespace IRaCIS.Core.Application.Service
//主题
//---[来自展影IRC] 关于重置邮箱的提醒
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName);
var htmlBodyStr = string.Format(ReplacePlatformName(ReplaceCompanyName(input.htmlBodyStr)) ,
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
sysUserInfo.FullName
sysUserInfo.FullName,
_systemEmailConfig.PlatformName
);
return (topicStr, htmlBodyStr);
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.IdentityUser_ModifyPassword, messageToSend, emailConfigFunc);
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.IdentityUser_ModifyPassword, messageToSend, emailConfigFunc, workLanguage);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@@ -948,6 +1002,10 @@ namespace IRaCIS.Core.Application.Service
{
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).FirstOrDefaultAsync();
//设置工作语言
var isEn_US = _userInfo.IsEn_Us;
var workLanguage = isEn_US ? UserWorkLanguage.US : UserWorkLanguage.CN;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -956,14 +1014,14 @@ namespace IRaCIS.Core.Application.Service
//主题
//---[来自展影IRC] 关于重置邮箱的提醒
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
name,
trialInfo.TrialCode,
trialInfo.ResearchProgramNo
@@ -974,14 +1032,20 @@ namespace IRaCIS.Core.Application.Service
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurvey_CheckUser, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
public async Task SiteSuervyUpdateUser(Guid trialSiteId, string email, string name, string url)
{
var siteInfo = await _trialSiteRepository.Where(t => t.Id == trialSiteId).Include(x=>x.Trial).FirstOrDefaultAsync();
var siteInfo = await _trialSiteRepository.Where(t => t.Id == trialSiteId).Include(x => x.Trial).FirstOrDefaultAsync();
var trialInfo = siteInfo.Trial;
//设置工作语言
var isEn_US = _userInfo.IsEn_Us;
var workLanguage = isEn_US ? UserWorkLanguage.US : UserWorkLanguage.CN;
var messageToSend = new MimeMessage();
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@@ -990,14 +1054,14 @@ namespace IRaCIS.Core.Application.Service
//主题
//---[来自展影IRC] 关于重置邮箱的提醒
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr, workLanguage),
name,
trialInfo.TrialCode,
siteInfo.TrialSiteCode,
@@ -1010,7 +1074,7 @@ namespace IRaCIS.Core.Application.Service
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurvey_UpdateUser, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, trialInfo);
await SendEmailHelper.SendTrialEmailAsync(messageToSend, trialInfo);
}
}
File diff suppressed because it is too large Load Diff
@@ -149,7 +149,7 @@ namespace IRaCIS.Application.Contracts
public bool? AcceptingNewTrial { get; set; }//是否接受新的项目
public bool? ActivelyReading { get; set; }// 是否接受新的读片任务
public int? Nation { get; set; }// 0-中国医生,2-美国医生,3-全部
public DoctorNation? Nation { get; set; }// 0-中国医生,2-美国医生,3-全部
}
/// <summary>
@@ -50,6 +50,7 @@ namespace IRaCIS.Core.Application.Contracts
public bool? OffLine { get; set; }
public Guid? SystemDocumentId { get; set; }
}
@@ -205,7 +206,7 @@ namespace IRaCIS.Core.Application.Contracts
public DateTime? EndCreateTime { get; set; }
public DocLanguageType? DocLanguageType { get; set; }
}
public class GetNextUnSignDocumentInDto
@@ -362,6 +363,8 @@ namespace IRaCIS.Core.Application.Contracts
public bool IsPublish { get; set; } = false;
public DocLanguageType DocLanguageType { get; set; }
}
@@ -62,42 +62,51 @@ namespace IRaCIS.Core.Application.Service
}).FirstNotNullAsync();
var isEn_us = _userInfo.IsEn_Us;
//找到当前收件人语言
var workLanguageList = _trialUserRoleRepository.Where(t => t.TrialId == taskInfo.TrialId && t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => t.UserRole.IdentityUser.UserWorkLanguage).Distinct().ToList();
var resultStr = isEn_us ? (result == true ? "Yes" : "No") : (result == true ? "是" : "否");
if (isEnrollment == true)
foreach (var workLanguage in workLanguageList)
{
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
//设置工作语言
var isEn_us = workLanguage == UserWorkLanguage.US;
var resultStr = isEn_us ? (result == true ? "Yes" : "No") : (result == true ? "是" : "否");
if (isEnrollment == true)
{
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, taskInfo.ResearchProgramNo, taskInfo.SubjectCode);
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
{
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, taskInfo.ResearchProgramNo, taskInfo.SubjectCode);
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
EmailNamePlaceholder, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, resultStr);
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
EmailNamePlaceholder, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, resultStr);
return (topicStr, htmlBodyStr, isEn_us, null);
};
return (topicStr, htmlBodyStr, isEn_us, null);
};
await SendTrialEmailAsync(taskInfo.TrialId, taskInfo.CriterionType, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId);
}
else
{
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
await SendTrialEmailAsync(taskInfo.TrialId, taskInfo.CriterionType, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId);
}
else
{
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, taskInfo.VisitName);
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
{
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, taskInfo.VisitName);
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
EmailNamePlaceholder, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, taskInfo.VisitName, resultStr);
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
EmailNamePlaceholder, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, taskInfo.VisitName, resultStr);
return (topicStr, htmlBodyStr, isEn_us, null);
};
return (topicStr, htmlBodyStr, isEn_us, null);
};
await SendTrialEmailAsync(taskInfo.TrialId, taskInfo.CriterionType, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId);
}
await SendTrialEmailAsync(taskInfo.TrialId, taskInfo.CriterionType, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId);
}
}
@@ -133,8 +142,12 @@ namespace IRaCIS.Core.Application.Service
var (topicStr, htmlBodyStr, isEn_us, onlyToUserId) = topicAndHtmlFunc(trialEmailConfig);
//设置工作语言
var workLanguage = isEn_us ? UserWorkLanguage.US : UserWorkLanguage.CN;
//处理替换公司名
htmlBodyStr = CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlBodyStr);
htmlBodyStr = CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlBodyStr, workLanguage);
sendEmailConfig.TopicDescription = topicStr;
@@ -150,10 +163,10 @@ namespace IRaCIS.Core.Application.Service
var allUserTypeEnumList = toUserTypeEnumList.Union(copyUserTypeEnumList).Distinct().ToList();
var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync();
var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToListAsync();
var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum))
//过滤当前语言
var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum)).Where(t=>t.UserWorkLanguage==workLanguage)
.ToList();
//收件人 有CRC CRA , CRC CRA的账户要按照中心发送
@@ -191,11 +204,6 @@ namespace IRaCIS.Core.Application.Service
sendEmailConfig.HtmlBodyStr = htmlBodyStr.Replace(EmailNamePlaceholder, string.Join(isEn_us ? ", " : "、", toUserList.Select(t => t.FullName).ToList()));
}
if (toUserList.Count == 0)
{
//---没有收件人,无法发送邮件
throw new BusinessValidationFailedException(_localizer["TrialEmailN_NoRecipient"]);
}
if (trialEmailConfig.FromEmail.Contains("@") && !string.IsNullOrEmpty(trialEmailConfig.FromEmail))
@@ -235,20 +243,7 @@ namespace IRaCIS.Core.Application.Service
}
}
//邮件附件 这里是原格式发送,不是PDF
//if (trialEmailConfig.AttachCNPath != string.Empty && trialEmailConfig.AttachPath != string.Empty)
//{
// var phyPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, isEn_us? trialEmailConfig.AttachName: trialEmailConfig.AttachNameCN);
// //先预先生成了邮件,发送预先生成的邮件
// sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
// {
// FileName = $"{attachPrefix}_{Path.GetFileName(_userInfo.IsEn_Us ? trialEmailConfig.AttachName : trialEmailConfig.AttachNameCN)}",
// FileStream = File.OpenRead(phyPath),
// });
//}
return (trialEmailConfig, sendEmailConfig);
@@ -42,6 +42,7 @@ namespace IRaCIS.Core.Application.Services
.WhereIf(inQuery.OffLine != null, t => t.OffLine == inQuery.OffLine)
.WhereIf(inQuery.FileName != null, t => t.FileName == inQuery.FileName)
.WhereIf(inQuery.FileFormat != null, t => t.FileFormat == inQuery.FileFormat)
.ProjectTo<SystemDocumentAttachmentView>(_mapper.ConfigurationProvider);
var pageList = await systemDocumentAttachmentQueryable.ToPagedListAsync(inQuery);
@@ -95,6 +96,7 @@ namespace IRaCIS.Core.Application.Services
.WhereIf(inQuery.EndCreateTime != null, t => t.CreateTime <= inQuery.EndCreateTime)
.WhereIf(inQuery.UserTypeId != null, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId))
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
.WhereIf(inQuery.DocLanguageType != null, t => t.DocLanguageType == inQuery.DocLanguageType)
.ProjectTo<SystemDocumentView>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us, userId = _userInfo.UserRoleId });
return await systemDocumentQueryable.ToPagedListAsync(inQuery);
@@ -171,23 +173,16 @@ namespace IRaCIS.Core.Application.Services
if (newUserTypeIds.Any()&& newUserTypeIds.Count()>0)
{
// 发送邮件给新增的角色
Console.WriteLine("开始 发送系统文档更新邮件给新增角色");
Console.WriteLine(string.Join(",", newUserTypeIds));
Log.Logger.Warning("开始 发送系统文档更新邮件给新增角色");
Log.Logger.Warning(string.Join(",", newUserTypeIds));
Task.Run(async () =>
// 只发送给新增的角色
await _mediatorScoped.Publish(new SystemDocumentPublishEvent
{
// 创建独立作用域
using (var scope = serviceScopeFactory.CreateScope())
{
// 从新作用域解析服务
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
// 只发送给新增的角色
await mediator.Publish(new SystemDocumentPublishEvent {
Ids = new List<Guid> { document.Id },
NewUserTypeIds = newUserTypeIds
});
}
Ids = new List<Guid> { document.Id },
NewUserTypeIds = newUserTypeIds
});
}
}
@@ -212,18 +207,10 @@ namespace IRaCIS.Core.Application.Services
IsDeleted = false,
});
Console.WriteLine("开始 发布系统文档");
Log.Logger.Warning("开始 发布系统文档");
await _mediatorScoped.Publish(new SystemDocumentPublishEvent { Ids = inDto.Ids });
Task.Run(async () =>
{
// 创建独立作用域
using (var scope = serviceScopeFactory.CreateScope())
{
// 从新作用域解析服务
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
await mediator.Publish(new SystemDocumentPublishEvent { Ids = inDto.Ids });
}
});
return ResponseOutput.Result(true);
@@ -286,9 +273,12 @@ namespace IRaCIS.Core.Application.Services
{
var isInternal = _userInfo.IsZhiZhun;
var workLanguage = _userInfo.UserWorkLanguage;
var query = from sysDoc in _systemDocumentRepository.Where(t=>t.IsPublish)
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.WhereIf(workLanguage == UserWorkLanguage.CN, t => t.DocLanguageType == DocLanguageType.CN || t.DocLanguageType == DocLanguageType.CN_US)
.WhereIf(workLanguage == UserWorkLanguage.US, t => t.DocLanguageType == DocLanguageType.US || t.DocLanguageType == DocLanguageType.CN_US)
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
//外部人员 只签署 外部需要签署的
.WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter)
@@ -27,6 +27,7 @@ namespace IRaCIS.Core.Application.Services
[ApiExplorerSettings(GroupName = "Trial")]
public class TrialDocumentService(IRepository<TrialDocument> _trialDocumentRepository,
IRepository<Trial> _trialRepository,
IScopedMediator _mediatorScoped,
IRepository<AuditRecord> _auditRecordRepository,
IRepository<TrialDocumentAttachment> _trialDocumentAttachmentRepository,
ISystemDocumentService _systemDocumentService,
@@ -105,18 +106,11 @@ namespace IRaCIS.Core.Application.Services
IsDeleted = false,
}, false, true);
await _trialDocumentRepository.SaveChangesAsync();
Console.WriteLine("开始 发布项目文档");
Serilog.Log.Logger.Warning("开始 发布项目文档");
Task.Run(async () =>
{
// 创建独立作用域
using (var scope = serviceScopeFactory.CreateScope())
{
// 从新作用域解析服务
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
await mediator.Publish(new TrialDocumentPublishEvent { Ids = inDto.Ids });
}
});
await _mediatorScoped.Publish(new TrialDocumentPublishEvent { Ids = inDto.Ids });
return ResponseOutput.Result(true);
@@ -128,32 +122,20 @@ namespace IRaCIS.Core.Application.Services
/// <returns></returns>
public async Task<IResponseOutput> TestPush()
{
Task.Run(async () =>
{
// 创建独立作用域
using (var scope = serviceScopeFactory.CreateScope())
{
// 从新作用域解析服务
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
await mediator.Publish(new TrialDocumentErverDayEvent { });
}
});
await _mediatorScoped.Publish(new TrialDocumentErverDayEvent { });
return ResponseOutput.Result(true);
}
public async Task<IResponseOutput> TestSendEmail()
{
Task.Run(async () =>
{
// 创建独立作用域
using (var scope = serviceScopeFactory.CreateScope())
{
// 从新作用域解析服务
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
await mediator.Publish(new ImageQCRecurringEvent { TrialId = Guid.Parse("08de2254-5d7d-581a-0242-0a0001000000") });
}
});
await _mediatorScoped.Publish(new ImageQCRecurringEvent { TrialId = Guid.Parse("08de2254-5d7d-581a-0242-0a0001000000") });
return ResponseOutput.Result(true);
}
@@ -351,12 +333,16 @@ namespace IRaCIS.Core.Application.Services
var isInternal = _userInfo.IsZhiZhun;
var workLanguage = _userInfo.UserWorkLanguage;
#region
var systemDocQuery =
from sysDoc in _systemDocumentRepository.Where(t => t.IsPublish).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId))
//外部人员 只签署 外部需要签署的
.WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter)
.WhereIf(workLanguage == UserWorkLanguage.CN, t => t.DocLanguageType == DocLanguageType.CN || t.DocLanguageType == DocLanguageType.CN_US)
.WhereIf(workLanguage == UserWorkLanguage.US, t => t.DocLanguageType == DocLanguageType.US || t.DocLanguageType == DocLanguageType.CN_US)
from trialUser in _trialIdentityUserRepository.AsQueryable(false)
.Where(t => t.TrialId == inQuery.TrialId && t.IdentityUserId == _userInfo.IdentityUserId
&& t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
@@ -584,6 +570,7 @@ namespace IRaCIS.Core.Application.Services
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.IsPublish)
.Where(t => t.TrialId == inQuery.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId)))
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
@@ -591,7 +578,9 @@ namespace IRaCIS.Core.Application.Services
var needSignSystemDocCount = await _systemDocumentRepository.AsQueryable(true).Where(t => t.IsPublish)
.WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter)
.WhereIf(workLanguage == UserWorkLanguage.CN, t => t.DocLanguageType == DocLanguageType.CN || t.DocLanguageType == DocLanguageType.CN_US)
.WhereIf(workLanguage == UserWorkLanguage.US, t => t.DocLanguageType == DocLanguageType.US || t.DocLanguageType == DocLanguageType.CN_US)
.WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter)
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.CountAsync();
@@ -969,7 +958,7 @@ namespace IRaCIS.Core.Application.Services
IsSystemDoc = true,
SysDocUserSignType = sysDoc.DocUserSignType,
IsConfirmIdentityUserInner = identityUser.IsZhiZhun,
IsPublish=sysDoc.IsPublish,
IsPublish = sysDoc.IsPublish,
Id = sysDoc.Id,
CreateTime = sysDoc.CreateTime,
IsDeleted = sysDoc.IsDeleted,
@@ -1115,7 +1104,7 @@ namespace IRaCIS.Core.Application.Services
return ResponseOutput.NotOk(_localizer["TrialD_DuplicateFileInProject"]);
}
var document = (await _trialDocumentRepository.Where(t => t.Id == addOrEditTrialDocument.Id, true,true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync()).IfNullThrowException();
var document = (await _trialDocumentRepository.Where(t => t.Id == addOrEditTrialDocument.Id, true, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync()).IfNullThrowException();
bool beforeIsPublish = document.IsPublish;
bool beforeIsDeleted = document.IsDeleted;
@@ -1163,21 +1152,13 @@ namespace IRaCIS.Core.Application.Services
Console.WriteLine("开始 发送项目文档更新邮件给新增角色");
Console.WriteLine(string.Join(",", newUserTypeIds));
Task.Run(async () =>
await _mediatorScoped.Publish(new TrialDocumentPublishEvent
{
// 创建独立作用域
using (var scope = serviceScopeFactory.CreateScope())
{
// 从新作用域解析服务
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
// 只发送给新增的角色
await mediator.Publish(new TrialDocumentPublishEvent
{
Ids = new List<Guid> { document.Id },
NewUserTypeIds = newUserTypeIds
});
}
Ids = new List<Guid> { document.Id },
NewUserTypeIds = newUserTypeIds
});
}
}
return ResponseOutput.Ok(document.Id.ToString());
@@ -24,6 +24,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Spire.Doc;
using System.Linq.Dynamic.Core;
using System.Runtime;
using System.Runtime.InteropServices;
namespace IRaCIS.Core.Application.Service
@@ -137,7 +138,7 @@ namespace IRaCIS.Core.Application.Service
var isNeedSend = true;
//手动发送的时候,也有可能答案是是 此时是 这里不发送,发送已经生成的文件
if (answer == "是" && isHandSend == null)
if ((answer == "是" || answer == "Yes") && isHandSend == null)
{
isNeedSend = true;
@@ -194,7 +195,15 @@ namespace IRaCIS.Core.Application.Service
/// <exception cref="BusinessValidationFailedException"></exception>
public async Task<string> BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isHandSend, EmailStoreSendMode emailStoreMode, string sendFileRelativePath)
{
var isEn_us = _userInfo.IsEn_Us;
//简单处理,找到该中心的语言 设置工作语言
var country = _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.Subject.TrialSite.Country).First();
var isEn_us = country == StaticData.SiteCountry.US;
var workLanguage = isEn_us ? UserWorkLanguage.US : UserWorkLanguage.CN;
EmailBusinessScenario businessScenarioEnum = EmailBusinessScenario.None;
var enrollReplace = "";
@@ -330,7 +339,7 @@ namespace IRaCIS.Core.Application.Service
{
var findItem = (await _dictionaryService.GetBasicDataSelect("Trial_Enroll_Report")).Where(t => t.Code == ((int)taskInfo.CriterionType).ToString()).FirstOrDefault();
enrollReplace = _userInfo.IsEn_Us ? findItem.Value : findItem.ValueCN;
enrollReplace = isEn_us ? findItem.Value : findItem.ValueCN;
//如果其他阅片人已经做了,说明发送了入组确认报告,第二个人做完就不发送了
@@ -348,7 +357,7 @@ namespace IRaCIS.Core.Application.Service
{
bool isEnroll = false;
(answer, isEnroll) = await DealEnrollAnswer(visitTaskId, (Guid)taskInfo.SourceSubjectVisitId, taskInfo.CriterionType, taskInfo.TrialReadingCriterionId);
(answer, isEnroll) = await DealEnrollAnswer(visitTaskId, (Guid)taskInfo.SourceSubjectVisitId, taskInfo.CriterionType, taskInfo.TrialReadingCriterionId, workLanguage);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, new List<Guid>() { visitTaskId }, minUserIdList);
}
@@ -357,7 +366,7 @@ namespace IRaCIS.Core.Application.Service
{
var findItem = (await _dictionaryService.GetBasicDataSelect("Trial_PD_Report")).Where(t => t.Code == ((int)taskInfo.CriterionType).ToString()).FirstOrDefault();
PdReplace = _userInfo.IsEn_Us ? findItem.Value : findItem.ValueCN;
PdReplace = isEn_us ? findItem.Value : findItem.ValueCN;
//有序
@@ -384,7 +393,7 @@ namespace IRaCIS.Core.Application.Service
if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) == 2)
{
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType, workLanguage);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
@@ -394,7 +403,7 @@ 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(judgeResultId, ReadingCategory.Visit, taskInfo.CriterionType, workLanguage);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Select(t => t.Id).ToList(), minUserIdList);
@@ -431,7 +440,7 @@ namespace IRaCIS.Core.Application.Service
if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Global) == 2)
{
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType, workLanguage);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
}
@@ -440,7 +449,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);
answer = await TranslatePdStateAsync(judgeResultId, ReadingCategory.Global, taskInfo.CriterionType, workLanguage);
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isHandSend, answer, taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Select(t => t.Id).ToList(), minUserIdList);
@@ -613,7 +622,7 @@ namespace IRaCIS.Core.Application.Service
//先预先生成了邮件,发送预先生成的邮件
sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
{
FileName = $"{attachPrefix}_{Path.GetFileNameWithoutExtension(_userInfo.IsEn_Us ? trialEmailConfig.AttachName : trialEmailConfig!.AttachNameCN)}.pdf",
FileName = $"{attachPrefix}_{Path.GetFileNameWithoutExtension(isEn_us ? trialEmailConfig.AttachName : trialEmailConfig!.AttachNameCN)}.pdf",
FileStream = File.OpenRead(phyPath),
});
@@ -639,7 +648,7 @@ namespace IRaCIS.Core.Application.Service
};
var path = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, _userInfo.IsEn_Us ? trialEmailConfig.AttachPath : trialEmailConfig.AttachCNPath);
var path = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, isEn_us ? trialEmailConfig.AttachPath : trialEmailConfig.AttachCNPath);
//获取从word 到 PDF的路径
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.TrialSiteId, taskInfo.SubjectId, true);
@@ -729,7 +738,7 @@ namespace IRaCIS.Core.Application.Service
pdfMemoryStream.Seek(0, SeekOrigin.Begin);
sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
{
FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(_userInfo.IsEn_Us ? trialEmailConfig.AttachName : trialEmailConfig.AttachNameCN)}.pdf",
FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(isEn_us ? trialEmailConfig.AttachName : trialEmailConfig.AttachNameCN)}.pdf",
FileStream = pdfMemoryStream
});
@@ -1067,11 +1076,14 @@ namespace IRaCIS.Core.Application.Service
/// <param name="subjectVisitId"></param>
/// <param name="criterionType"></param>
/// <param name="trialReadingCriterionId"></param>
/// <param name="userWorkLanguage"></param>
/// <returns></returns>
private async Task<(string enrollAnswer, bool isEnroll)> DealEnrollAnswer(Guid visitTaskId, Guid subjectVisitId, CriterionType criterionType, Guid trialReadingCriterionId)
private async Task<(string enrollAnswer, bool isEnroll)> DealEnrollAnswer(Guid visitTaskId, Guid subjectVisitId, CriterionType criterionType, Guid trialReadingCriterionId, UserWorkLanguage userWorkLanguage)
{
var enrollAnswer = _userInfo.IsEn_Us ? "No" : "否";
var isEn_us = userWorkLanguage == UserWorkLanguage.US;
var enrollAnswer = isEn_us ? "No" : "否";
var isEnroll = false;
switch (criterionType)
@@ -1088,7 +1100,7 @@ namespace IRaCIS.Core.Application.Service
if (await _readingTableQuestionAnswerRepository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
{
enrollAnswer = _userInfo.IsEn_Us ? "Yes" : "是";
enrollAnswer = isEn_us ? "Yes" : "是";
isEnroll = true;
}
@@ -1102,7 +1114,7 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
bool exists = list.Any(s => int.TryParse(s, out var n) && n >= 1);
if (exists)
{
enrollAnswer = _userInfo.IsEn_Us ? "Yes" : "是";
enrollAnswer = isEn_us ? "Yes" : "是";
isEnroll = true;
}
@@ -1168,9 +1180,10 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
/// <param name="readingCategory"> 任务类型</param>
/// <param name="criterionType">标准类型</param>
/// <param name="IsGlobalGenerate"> 是否是全局产生(区分裁判任务)</param>
/// <param name="userWorkLanguage"></param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
private async Task<string> TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType, bool? IsGlobalGenerate = null)
private async Task<string> TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType, UserWorkLanguage userWorkLanguage, bool? IsGlobalGenerate = null)
{
var answer = string.Empty;
@@ -1361,6 +1374,7 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidTaskTypeForEmailSending"]);
}
var isEn_us = userWorkLanguage == UserWorkLanguage.US;
switch (criterionType)
{
@@ -1372,11 +1386,11 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
if (answer == OverallAssessment.PD.GetEnumInt())
{
answer = _userInfo.IsEn_Us ? "Yes" : "是";
answer = isEn_us ? "Yes" : "是";
}
else
{
answer = _userInfo.IsEn_Us ? "No" : "否";
answer = isEn_us ? "No" : "否";
}
break;
@@ -1384,11 +1398,11 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
if (answer == OverallAssessment.iCPD.GetEnumInt())
{
answer = _userInfo.IsEn_Us ? "Yes" : "是";
answer = isEn_us ? "Yes" : "是";
}
else
{
answer = _userInfo.IsEn_Us ? "No" : "否";
answer = isEn_us ? "No" : "否";
}
break;
@@ -1396,11 +1410,11 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
if (answer == CTMRIOverallAssessment.PD.GetEnumInt())
{
answer = _userInfo.IsEn_Us ? "Yes" : "是";
answer = isEn_us ? "Yes" : "是";
}
else
{
answer = _userInfo.IsEn_Us ? "No" : "否";
answer = isEn_us ? "No" : "否";
}
break;
@@ -1408,11 +1422,11 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
if (answer == ImagingOverallAssessment_Lugano.PMDPD.GetEnumInt())
{
answer = _userInfo.IsEn_Us ? "Yes" : "是";
answer = isEn_us ? "Yes" : "是";
}
else
{
answer = _userInfo.IsEn_Us ? "No" : "否";
answer = isEn_us ? "No" : "否";
}
break;
@@ -1423,11 +1437,11 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
if (answer == VisitTumorEvaluation.PD.GetEnumInt())
{
answer = _userInfo.IsEn_Us ? "Yes" : "是";
answer = isEn_us ? "Yes" : "是";
}
else
{
answer = _userInfo.IsEn_Us ? "No" : "否";
answer = isEn_us ? "No" : "否";
}
break;
@@ -105,7 +105,7 @@
public string Reviewer { get; set; } = String.Empty;
public DateTime BeginMonth { get; set; }
public DateTime EndMonth { get; set; }
public int? Nation { get; set; }
public DoctorNation? Nation { get; set; }
}
public class MonthlyPaymentDTO
{
@@ -59,7 +59,7 @@
{
public DateTime StatisticsDate { get; set; }
public string KeyWord { get; set; } = String.Empty;
public int? Nation { get; set; }
public DoctorNation? Nation { get; set; }
}
public class MonthlyPaymentDetailQuery
@@ -162,7 +162,7 @@
public DateTime BeginDate { get; set; }
public DateTime EndDate { get; set; }
public int? Nation { get; set; }
public DoctorNation? Nation { get; set; }
}
public class TrialAnalysisQueryDTO
@@ -776,6 +776,9 @@ namespace IRaCIS.Core.Application.Contracts
public List<Guid> DicomStudyIdList { get; set; }
public List<Guid> NoneDicomStudyIdList { get; set; }
// true 导出阅片,null 就是所有影像
public bool? IsExportReading { get; set; }
}
public class IRReadingDownloadQuery : SortInput
@@ -1141,6 +1141,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
var isQueryDicom = inQuery.DicomStudyIdList.Count > 0;
var isQueryNoneDicom = inQuery.NoneDicomStudyIdList.Count > 0;
var isExportReading = inQuery.IsExportReading == true;
var imageType = (isQueryDicom && isQueryNoneDicom) ? ImageType.DicomAndNoneDicom : (isQueryDicom ? ImageType.Dicom : ImageType.NoneDicom);
var dirDic = new Dictionary<string, string>();
@@ -1150,11 +1152,12 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
//有传输语法值的导出 才生成DIR
//if (_subjectVisitRepository.Where(t => t.Id == inQuery.SubjectVisitId).SelectMany(t => t.StudyList.SelectMany(t => t.InstanceList)).All(c => c.TransferSytaxUID != string.Empty))
if (!_instanceRepository.Where(t => inQuery.SubjectVisitId == t.SubjectVisitId).Any(c => c.TransferSytaxUID == string.Empty))
if (!_instanceRepository.Where(t => isExportReading ? (t.IsReading && t.DicomSerie.IsReading) : true)
.Where(t => inQuery.SubjectVisitId == t.SubjectVisitId).Any(c => c.TransferSytaxUID == string.Empty))
{
var list = _subjectVisitRepository.Where(t => t.Id == inQuery.SubjectVisitId).SelectMany(t => t.StudyList)
.Where(t => isQueryDicom ? inQuery.DicomStudyIdList.Contains(t.Id) : false)
.SelectMany(t => t.InstanceList)
.SelectMany(t => t.InstanceList.Where(t => isExportReading ? (t.IsReading && t.DicomSerie.IsReading) : true))
.Select(t => new StudyDIRInfo()
{
@@ -1235,11 +1238,11 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
StudyInstanceUid = u.StudyInstanceUid,
StudyDIRPath = u.StudyDIRPath,
SeriesList = u.SeriesList.Select(z => new DownloadDicomSeriesDto()
SeriesList = u.SeriesList.Where(t => isExportReading ? t.IsReading : true).Select(z => new DownloadDicomSeriesDto()
{
Modality = z.Modality,
InstanceList = z.DicomInstanceList.Select(k => new DownloadDicomInstanceDto()
InstanceList = z.DicomInstanceList.Where(t => isExportReading ? t.IsReading : true).Select(k => new DownloadDicomInstanceDto()
{
IsEncapsulated = k.IsEncapsulated,
InstanceId = k.Id,
@@ -1251,7 +1254,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}).ToList(),
NoneDicomStudyList = sv.NoneDicomStudyList.Where(t => isQueryNoneDicom ? inQuery.NoneDicomStudyIdList.Contains(t.Id) : false)
NoneDicomStudyList = sv.NoneDicomStudyList.Where(t => isExportReading ? t.IsReading : true).Where(t => isQueryNoneDicom ? inQuery.NoneDicomStudyIdList.Contains(t.Id) : false)
.Select(nd => new DownloadNoneDicomStudyDto()
{
@@ -1259,7 +1262,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
StudyCode = nd.StudyCode,
ImageDate = nd.ImageDate,
FileList = nd.NoneDicomFileList.Select(file => new DownloadNoneDicomFileDto()
FileList = nd.NoneDicomFileList.Where(t => isExportReading ? t.IsReading : true).Select(file => new DownloadNoneDicomFileDto()
{
FileName = file.FileName,
Path = file.Path,
@@ -82,9 +82,35 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
{
try
{
#region
//await using var source = await sourceFactory();
//// 如果你是从 stream 打开
//var dicomFile = await DicomFile.OpenAsync(source);
#endregion
#region
await using var source = await sourceFactory();
// 【关键修复】将 OSS 流缓冲到 MemoryStream
using var bufferedStream = new MemoryStream();
if (source.CanSeek)
{
source.Position = 0;
}
else
{
// 完全复制到内存流
await source.CopyToAsync(bufferedStream);
bufferedStream.Position = 0; // 重置位置
}
// 如果你是从 stream 打开
var dicomFile = await DicomFile.OpenAsync(source);
var dicomFile = await DicomFile.OpenAsync(source.CanSeek ? source : bufferedStream);
#endregion
//获取像素是否为封装形式
var syntax = dicomFile.Dataset.InternalTransferSyntax;
@@ -104,11 +130,11 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
newFragments.Fragments.Add(new MemoryByteBuffer(frameData.Data));
}
var frag = dicomFile.Dataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData);
//var frag = dicomFile.Dataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData);
var originOffsetTable = frag?.OffsetTable;
//var originOffsetTable = frag?.OffsetTable;
newFragments.OffsetTable.AddRange(originOffsetTable?.ToArray());
//newFragments.OffsetTable.AddRange(originOffsetTable?.ToArray());
// 替换原有的片段序列
dicomFile.Dataset.AddOrUpdate(newFragments);
}
@@ -4,6 +4,7 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using Microsoft.AspNetCore.Mvc;
@@ -13,7 +14,7 @@ namespace IRaCIS.Core.Application.Service
/// SystemAnonymizationService
/// </summary>
[ApiExplorerSettings(GroupName = "Image")]
public class SystemAnonymizationService(IRepository<SystemAnonymization> _systemAnonymizationRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemAnonymizationService
public class SystemAnonymizationService(IRepository<SystemAnonymization> _systemAnonymizationRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, ISystemAnonymizationService
{
@@ -37,6 +38,7 @@ namespace IRaCIS.Core.Application.Service
var entity = await _systemAnonymizationRepository.InsertOrUpdateAsync(addOrEditSystemAnonymization, true);
await _fusionCache.SetAsync(CacheKeys.SystemAnonymization, CacheHelper.GetSystemAnonymizationListAsync(_systemAnonymizationRepository), TimeSpan.FromDays(7));
return ResponseOutput.Ok(entity.Id.ToString());
@@ -207,7 +207,7 @@ namespace IRaCIS.Application.Contracts
public bool IsTestUser { get; set; }
public UserWorkLanguage UserWorkLanguage { get; set; }
}
/// <summary>
@@ -338,6 +338,8 @@ namespace IRaCIS.Application.Contracts
public Guid? AuditRecordId { get; set; }
public bool? IsAuditRecordUserSelect { get; set; }
public UserWorkLanguage? UserWorkLanguage { get; set; }
}
public class UserRoleInfoDTO
@@ -442,7 +442,16 @@ namespace IRaCIS.Core.Application.Service
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.UnloginModifyPasswoed }, true);
await _mailVerificationService.AfterUserModifyPasswordSendEmailAsync(identityUserId);
try
{
await _mailVerificationService.AfterUserModifyPasswordSendEmailAsync(identityUserId);
}
catch (Exception)
{
}
var find = await _identityUserRepository.FindAsync(identityUserId);
@@ -534,6 +543,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.UserCeateSource != null, t => t.UserCeateSource == inQuery.UserCeateSource)
.WhereIf(inQuery.AuditRecordId != null && inQuery.IsAuditRecordUserSelect == true, t => t.AuditRecordList.Any(t => t.AuditRecordId == inQuery.AuditRecordId))
.WhereIf(inQuery.AuditRecordId != null && inQuery.IsAuditRecordUserSelect == false, t => !t.AuditRecordList.Any(t => t.AuditRecordId == inQuery.AuditRecordId))
.WhereIf(inQuery.UserWorkLanguage != null, t => t.UserWorkLanguage == inQuery.UserWorkLanguage)
.ProjectTo<UserListDTO>(_mapper.ConfigurationProvider);
var pageList = await userQueryable.ToPagedListAsync(inQuery);
@@ -1269,6 +1279,7 @@ namespace IRaCIS.Core.Application.Service
PermissionStr = t.UserTypeRole.PermissionStr,
UserName = t.IdentityUser.UserName,
UserTypeShortName = t.UserTypeRole.UserTypeShortName,
UserWorkLanguage=t.IdentityUser.UserWorkLanguage
}).FirstOrDefaultAsync();
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = userTokenInfo.IdentityUserId, ActionUserName = $"{userTokenInfo.UserName}", ActionUserType = userTokenInfo.UserTypeShortName, OptType = UserOptType.LoginSelectRole }, true);
@@ -263,6 +263,12 @@ namespace IRaCIS.Core.Application.Contracts.DTO
public class TrialVisitQADTO
{
/// <summary>
/// QC质控下载
/// </summary>
public bool IsSupportQCDownloadImage { get; set; } = false;
public bool ExistsManual { get; set; }
public bool IsHaveStudyClinicalData { get; set; }
public bool QCRiskControl { get; set; }
@@ -421,6 +421,7 @@ namespace IRaCIS.Core.Application.Image.QA
List<SecondReviewDto> secondReviewList = new List<SecondReviewDto>();
var isSupportQCImageDownload = _trialRepository.Where(t => t.Id == sv.TrialId).Select(t => t.IsSupportQCDownloadImage).FirstOrDefault();
if (sv.SecondReviewState != SecondReviewState.None)
{
@@ -459,6 +460,7 @@ namespace IRaCIS.Core.Application.Image.QA
return new TrialVisitQADTO
{
IsSupportQCDownloadImage = isSupportQCImageDownload,
QCQuestionAnswerList = qacheckList,
QCRiskControl = _verifyConfig.CurrentValue.QCRiskControl,
SecondReviewList = secondReviewList,
@@ -776,7 +778,7 @@ namespace IRaCIS.Core.Application.Image.QA
var query = _inspectionFileRepository.Where(t => t.TrialId == inQuery.TrialId && (t.CheckState == EDCCheckState.Success || t.CheckState == EDCCheckState.Failed))
.ProjectTo<GetUserUploadFileDto>(_mapper.ConfigurationProvider);
return await query.ToPagedListAsync(inQuery,nameof(GetUserUploadFileDto.CreateTime));
return await query.ToPagedListAsync(inQuery, nameof(GetUserUploadFileDto.CreateTime));
}
@@ -1111,12 +1111,12 @@ namespace IRaCIS.Core.Application.Image.QA
var visit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId);
var isExistStudyClinicalData = await _clinicalDataTrialSetRepository.AnyAsync(t => t.TrialId == visit.TrialId && t.ClinicalDataLevel == ClinicalLevel.Study&&t.IsConfirm&&t.IsApply);
if(isExistStudyClinicalData)
var isExistStudyClinicalData = await _clinicalDataTrialSetRepository.AnyAsync(t => t.TrialId == visit.TrialId && t.ClinicalDataLevel == ClinicalLevel.Study && t.IsConfirm && t.IsApply);
if (isExistStudyClinicalData)
{
List<string> modalitieTypes = new List<string>() { "PT、CT", "CT、PT", "PET-CT" };
var studyList=await _dicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId&& modalitieTypes.Contains(t.Modalities)).ProjectTo<QAStudyInfoDTO>(_mapper.ConfigurationProvider).ToListAsync();
var studyList = await _dicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId && modalitieTypes.Contains(t.Modalities)).ProjectTo<QAStudyInfoDTO>(_mapper.ConfigurationProvider).ToListAsync();
if (studyList.Any(x => x.IsHasEmptyPatientInfo))
{
return ResponseOutput.NotOk(_localizer["QCOperation_IsHasEmptyPatientInfo"]);
@@ -1189,7 +1189,7 @@ namespace IRaCIS.Core.Application.Image.QA
await _scpStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == id, u => new SCPStudy() { SubjectVisitId = null });
if (fisrtPath.IsNotNullOrEmpty())
if (fisrtPath.IsNotNullOrEmpty() && study.IsFromPACS == false)
{
var prefix = fisrtPath.Substring(1, fisrtPath.LastIndexOf('/') - 1);
@@ -1230,7 +1230,7 @@ namespace IRaCIS.Core.Application.Image.QA
string cacheKey = CacheKeys.UserQCSkipTask(_userInfo.UserRoleId);
await _fusionCache.SetAsync(cacheKey, new List<Guid>(), TimeSpan.FromMinutes(60));
return ResponseOutput.Ok();
@@ -1393,12 +1393,12 @@ namespace IRaCIS.Core.Application.Image.QA
// 获取当前缓存中的访视Id集合(如果没有则创建空集合)
var skippedVisits = await _fusionCache.GetOrDefaultAsync<List<Guid>>(CacheKeys.UserQCSkipTask(_userInfo.UserRoleId), new List<Guid>() { });
var skippedVisits = await _fusionCache.GetOrDefaultAsync<List<Guid>>(CacheKeys.UserQCSkipTask(_userInfo.UserRoleId), new List<Guid>() { });
//跳过当前访视
if (inDto.IsSkipCurrentVisit)
{
skippedVisits.Add(inDto.SubjectVisitId);
currentActionList = currentActionList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
}
@@ -1449,7 +1449,7 @@ namespace IRaCIS.Core.Application.Image.QA
//跳过当前访视
if (inDto.IsSkipCurrentVisit)
{
{
visitList = visitList.Where(t => !skippedVisits.Contains(t.SubjectVisitId)).ToList();
}
@@ -1002,6 +1002,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public string ImageTool { get; set; } = string.Empty;
/// <summary>
/// 新增修改类型
/// </summary>
public AddDeleteType AddDeleteTypeEnum { get; set; } = AddDeleteType.Arbitrium;
/// <summary>
/// 影像工具属性
/// </summary>
@@ -2483,6 +2488,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public string ImageTool { get; set; } = string.Empty;
/// <summary>
/// 新增修改类型
/// </summary>
public AddDeleteType AddDeleteTypeEnum { get; set; } = AddDeleteType.Arbitrium;
/// <summary>
/// 影像工具属性
/// </summary>
@@ -59,6 +59,11 @@ public class SegmentationAddOrEdit
/// </summary>
public long FileSize { get; set; } = 0;
/// <summary>
/// SEGUpdateTime 更新时间
/// </summary>
public DateTime? SEGUpdateTime { get; set; }
}
public class SegmentationQuery:PageInput
@@ -94,11 +99,20 @@ public class SegmentationVersionView
public long FileSize { get; set; }
public DateTime CreateTime { get; set; }
public string CreateUserName { get; set; }
/// <summary>
/// 版本开始时间
/// </summary>
public DateTime? StartTime { get; set; }
}
public class SaveSegmentationVersionAsyncInDto
{
public Guid SegmentationId { get; set; }
public string SEGUrl { get; set; }
public bool IsRestore { get; set; } = false;
}
public class SegmentationVersionQuery : PageInput
@@ -5,6 +5,7 @@ using DocumentFormat.OpenXml.Office2019.Excel.ThreadedComments;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Helper.OtherTool;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.Service.ImageAndDoc;
using IRaCIS.Core.Application.Service.OAuth;
@@ -16,6 +17,7 @@ using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
@@ -80,6 +82,7 @@ namespace IRaCIS.Core.Application.Service
IGeneralCalculateService _generalCalculateService,
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
IRepository<TaskStudy> _taskStudyRepository,
IConfiguration _config,
IDownloadAndUploadService _downloadAndUploadService,
ITrialEmailNoticeConfigService _trialEmailNoticeConfigService,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IReadingImageTaskService
@@ -3363,6 +3366,18 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<IResponseOutput> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
{
// 验证一个问题不能有多个答案
bool hasDuplicate = await _readingTaskQuestionAnswerRepository
.Where(x => x.VisitTaskId == inDto.VisitTaskId)
.GroupBy(x => x.ReadingQuestionTrialId)
.AnyAsync(g => g.Count() > 1);
if (hasDuplicate)
{
_ = SendWeComNotifier(inDto.VisitTaskId, "阅片问题答案有重复");
}
//验证后处理影像必须传
if (_visitTaskRepository.Any(t => t.Id == inDto.VisitTaskId && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None))
{
@@ -1,5 +1,6 @@
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Helper.OtherTool;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
@@ -7,6 +8,7 @@ using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Service
@@ -676,7 +678,7 @@ namespace IRaCIS.Core.Application.Service
JudgeDifferenceType = x.Key.JudgeDifferenceType,
TaskAnswerList = x.Select(y => y.Answer).ToList(),
}).ToList();
noteEqual = noteEqual || ComputeJudgeResult(groupTasks);
noteEqual = noteEqual || ComputeJudgeResult(groupTasks, visitTask.Id);
}
}
@@ -708,7 +710,7 @@ namespace IRaCIS.Core.Application.Service
JudgeDifferenceType = x.Key.JudgeDifferenceType,
TaskAnswerList = x.Select(y => y.Answer).ToList(),
}).ToList();
noteEqual = ComputeJudgeResult(groupTasks);
noteEqual = ComputeJudgeResult(groupTasks, visitTask.Id);
}
break;
@@ -757,7 +759,8 @@ namespace IRaCIS.Core.Application.Service
JudgeDifferenceValue = x.Key.JudgeDifferenceValue,
JudgeDifferenceType = x.Key.JudgeDifferenceType,
}).ToList();
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks, visitTask.Id);
}
}
@@ -819,7 +822,8 @@ namespace IRaCIS.Core.Application.Service
JudgeDifferenceType = x.Key.JudgeDifferenceType,
TaskAnswerList = x.Select(y => y.Answer).ToList(),
}).ToList();
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks, visitTask.Id);
}
@@ -922,12 +926,61 @@ namespace IRaCIS.Core.Application.Service
}
/// <summary>
/// 发送微信通知
/// </summary>
/// <param name="visiTaskId"></param>
/// <returns></returns>
public async Task SendWeComNotifier(Guid visiTaskId,string msg)
{
try
{
bool isOpenWeComNotice = _config.GetValue<bool>("WeComNoticeConfig:IsOpenWeComNotice");
if (isOpenWeComNotice)
{
string webhook = _config["WeComNoticeConfig:WebhookUrl"] ?? string.Empty;
var uri = new Uri(_config["SystemEmailSendConfig:SiteUrl"]);
var baseUrl = uri.GetLeftPart(UriPartial.Authority);
var userList = _config.GetSection("WeComNoticeConfig:APINoticeUserList").Get<string[]>();
var visitTask = _visitTaskRepository.Where(x => x.Id == visiTaskId).Include(x=>x.Subject).Include(x=>x.Trial).Include(x=>x.SourceSubjectVisit).FirstOrDefault();
// 🔔 异步告警(不要阻塞请求)
_ = WeComNotifier.SendAlertAsync(
webhook: webhook,
alert: new WeComAlert
{
Env = baseUrl,
UserName = msg,
Api = "",
Message = $"异常信息:{msg}, 项目方案号:{visitTask.Trial.ResearchProgramNo}, 试验参与者:{visitTask.Subject.Code}, 访视:{visitTask.SourceSubjectVisit.VisitName}, 任务名称:{visitTask.TaskName} 任务Id:{visiTaskId}",
Stack = string.Empty,
AtUsers = userList ?? []
}
);
}
}
catch (Exception ex)
{
Log.Logger.Error($"MassTransit里发送企业微信出现错误:{ex.Message}");
}
}
/// <summary>
/// 计算返回的结果 为True表示不相等
/// </summary>
/// <param name="groupTasks"></param>
/// <returns></returns>
private bool ComputeJudgeResult(List<GroupTaskAnswerDto> groupTasks)
private bool ComputeJudgeResult(List<GroupTaskAnswerDto> groupTasks,Guid visiTaskId)
{
var noteEqual = false;
foreach (var item in groupTasks)
@@ -935,11 +988,13 @@ namespace IRaCIS.Core.Application.Service
// 裁判问题可以不必填
if(item.TaskAnswerList.Count()==0)
{
_ = SendWeComNotifier(visiTaskId, "两个阅片任务的答案等于0");
break;
}
else if (item.TaskAnswerList.Count() != 2)
{
noteEqual = true;
// 发送微信通知
_ = SendWeComNotifier(visiTaskId, "两个阅片任务的答案不等于2");
break;
}
else if (noteEqual)
@@ -527,7 +527,7 @@ namespace IRaCIS.Core.Application.Service
var subjectVisitQuery = _subjectVisitRepository.Where(t => t.TrialId == inQuery.TrialId)/*.Where(t => t.IsLostVisit == false)*/
.Where(t => t.Subject.IsSubjectQuit == false || (t.Subject.IsSubjectQuit == true && t.SubmitState == SubmitStateEnum.Submitted))
.Where(sv => sv.Subject.FinalSubjectVisitId == null ? true : sv.VisitNum <= sv.Subject.LatestSubjectVisit.VisitNum).Select(sv => new ReadModuleView()
.Where(sv => sv.Subject.FinalSubjectVisitId == null ? true : sv.VisitNum <= sv.Subject.FinalSubjectVisit.VisitNum).Select(sv => new ReadModuleView()
{
Id = sv.Id,
CreateTime = sv.CreateTime,
@@ -1174,7 +1174,8 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException(_localizer["ReadModule_TumorExists"]);
}
if (await _visitTaskRepository.AnyAsync(x => readModuleId == x.SouceReadModuleId))
if (await _visitTaskRepository.AnyAsync(x => readModuleId == x.SouceReadModuleId && (x.TaskState==TaskState.Effect||x.ReadingTaskState==ReadingTaskState.HaveSigned)))
{
//---当前阅片已生成任务,操作失败。
throw new BusinessValidationFailedException(_localizer["ReadModule_TaskGenerated"]);
@@ -1183,7 +1184,7 @@ namespace IRaCIS.Core.Application.Service
// 如果生成了 访视级别的阅片期裁判 不让删除
if (criterionInfo.IsArbitrationReading && criterionInfo.IsReadingPeriod && !criterionInfo.IsGlobalReading && criterionInfo.ArbitrationRule == ArbitrationRule.Reading)
{
if (await _visitTaskRepository.AnyAsync(x => x.SourceSubjectVisitId == readModule.SubjectVisitId && x.ReadingCategory == ReadingCategory.Judge))
if (await _visitTaskRepository.AnyAsync(x => x.SourceSubjectVisitId == readModule.SubjectVisitId && x.ReadingCategory == ReadingCategory.Judge && (x.TaskState == TaskState.Effect || x.ReadingTaskState == ReadingTaskState.HaveSigned)))
{
//---当前阅片已生成裁判任务,操作失败。
throw new BusinessValidationFailedException(_localizer["ReadModule_JudgeTaskGenerated"]);
@@ -77,8 +77,17 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
if (addOrEditSegmentation.Id != null)
{
var data= await _segmentationRepository.FirstOrDefaultNoTrackingAsync(x => x.Id == addOrEditSegmentation.Id);
if (addOrEditSegmentation.SEGUrl != data.SEGUrl)
{
addOrEditSegmentation.SEGUpdateTime = DateTime.Now;
}
else
{
addOrEditSegmentation.SEGUpdateTime = data.SEGUpdateTime;
}
await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId = addOrEditSegmentation.Id.Value });
await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId = addOrEditSegmentation.Id.Value, SEGUrl = addOrEditSegmentation.SEGUrl });
}
var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true);
return ResponseOutput.Ok(entity.Id.ToString());
@@ -89,21 +98,30 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
private async Task SaveSegmentationVersionAsync(SaveSegmentationVersionAsyncInDto inDto)
public async Task SaveSegmentationVersionAsync(SaveSegmentationVersionAsyncInDto inDto)
{
var data = await _segmentationRepository.FirstOrDefaultNoTrackingAsync(x => x.Id == inDto.SegmentationId);
var segmentList = await _segmentRepository.Where(x => x.SegmentationId == inDto.SegmentationId).OrderBy(x=>x.SegmentNumber).ProjectTo<SegmentVersionData>(_mapper.ConfigurationProvider).ToListAsync();
// 如果是新增或修改,记录一条版本信息
var maxVersion = await _segmentationVersionRepository
.Where(x => x.SegmentationId == data.Id)
.OrderByDescending(x => x.Version)
.FirstOrDefaultAsync();
if (data.SEGUrl != string.Empty)
var startTime = maxVersion != null ? maxVersion.CreateTime :(data.SEGUpdateTime==null? DateTime.MinValue: data.SEGUpdateTime.Value);
var segmentList = await _segmentRepository
.Where(x=>x.CreateTime<= startTime && (!x.IsDeleted||x.DeletedTime> startTime))
.Where(x => x.SegmentationId == inDto.SegmentationId).OrderBy(x=>x.SegmentNumber).IgnoreQueryFilters().ProjectTo<SegmentVersionData>(_mapper.ConfigurationProvider).ToListAsync();
if (data.SEGUrl != string.Empty&&(inDto.SEGUrl!=data.SEGUrl||inDto.IsRestore))
{
// 如果是新增或修改,记录一条版本信息
var maxVersion = await _segmentationVersionRepository
.Where(x => x.SegmentationId == data.Id)
.OrderByDescending(x => x.Version)
.Select(x => x.Version)
.FirstOrDefaultAsync();
var newVersion = maxVersion == null ? 1 : maxVersion.Version + 1;
var newVersion = maxVersion + 1;
var versionEntity = new SegmentationVersion
{
@@ -113,6 +131,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
SEGUrl = data.SEGUrl,
FileSize = data.FileSize,
SegmentList= segmentList,
StartTime= startTime,
};
await _segmentationVersionRepository.AddAsync(versionEntity);
@@ -151,7 +170,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
var version = await _segmentationVersionRepository.Where(x => x.Id == inDto.VersionId && x.SegmentationId == inDto.SegmentationId).FirstNotNullAsync();
var segmentation = await _segmentationRepository.Where(x => x.Id == inDto.SegmentationId).FirstNotNullAsync();
await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId=inDto.SegmentationId});
await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId=inDto.SegmentationId,IsRestore=true,});
await _segmentationRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.SegmentationId, t => new Segmentation
{
SegmentationJson = version.SegmentationJson,
@@ -250,7 +269,7 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
public async Task<IResponseOutput> DeleteSegment(Guid segmentId)
{
await DeleteBindingsAndAnswersAsync(null, segmentId);
var success = await _segmentRepository.DeleteFromQueryAsync(t => t.Id == segmentId, true);
var success = await _segmentRepository.SoftDeleteFromQueryAsync(t => t.Id == segmentId, true);
return ResponseOutput.Ok();
}
@@ -170,7 +170,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "LiverSegmentation").OrderBy(x => x.ShowOrder).ToListAsync();
var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "Liver4Segmentation").OrderBy(x => x.ShowOrder).ToListAsync();
var tableQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FatFraction).FirstNotNullAsync();
@@ -297,7 +297,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
{
await this.CalculateAvg(inDto);
//await this.CalculateAvg(inDto);
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
var needAddList = new List<ReadingTaskQuestionAnswer>();
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
@@ -408,7 +408,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var tableQuestionList = rowInfo.Where(x=>x.TableQuestionList.Any(x=>x.QuestionMark== QuestionMark.IsMeasurable && x.Answer.EqEnum(YesOrNoOrNa.Yes))).SelectMany(x => x.TableQuestionList).ToList();
if (rowInfo.Any(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNullOrEmpty())))
if (rowInfo.Any(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.MRIPDFF && x.Answer.IsNullOrEmpty())))
{
return string.Empty;
}
@@ -416,7 +416,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
return "NE";
}
result = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).Average(x => x.Answer.IsNullOrEmptyReturn0());
result = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.MRIPDFF).Average(x => x.Answer.IsNullOrEmptyReturn0());
return decimal.Round(result, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString()); ;
}
@@ -456,54 +456,54 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// 计算平均值
/// </summary>
/// <returns></returns>
public async Task CalculateAvg(ReadingCalculateDto inDto)
{
// 脂肪分数的表格问题Id
var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault();
//public async Task CalculateAvg(ReadingCalculateDto inDto)
//{
// // 脂肪分数的表格问题Id
// var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault();
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
// List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
foreach (var item in questionInfo.TableRowInfoList)
{
var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault();
var avgAnswer = string.Empty;
List<QuestionMark?> questionMarks = new List<QuestionMark?>()
{
QuestionMark.FirstMeasurement,
QuestionMark.SecondMeasurement,
QuestionMark.ThirdMeasurement,
QuestionMark.FourthMeasurement,
};
var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList();
if (answers.Count() == 4 && !answers.Any(x => x.IsNullOrEmpty()))
{
var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x);
avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
}
if(item.TableQuestionList.Where(x => x.QuestionMark== QuestionMark.IsMeasurable).Select(x => x.Answer).FirstOrDefault().EqEnum(YesOrNoOrNa.No))
{
avgAnswer = "NE";
}
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = avgAnswer,
VisitTaskId = inDto.VisitTaskId,
QuestionId = avg.QuestionId,
TableQuestionId = avg.TableQuestionId,
TrialId = inDto.TrialId,
RowIndex = avg.RowIndex,
RowId = avg.RowId,
// foreach (var item in questionInfo.TableRowInfoList)
// {
// var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault();
// var avgAnswer = string.Empty;
// List<QuestionMark?> questionMarks = new List<QuestionMark?>()
// {
// QuestionMark.FirstMeasurement,
// QuestionMark.SecondMeasurement,
// QuestionMark.ThirdMeasurement,
// QuestionMark.FourthMeasurement,
// };
// var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList();
// if (answers.Count() == 4 && !answers.Any(x => x.IsNullOrEmpty()))
// {
// var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x);
// avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
// }
// if(item.TableQuestionList.Where(x => x.QuestionMark== QuestionMark.IsMeasurable).Select(x => x.Answer).FirstOrDefault().EqEnum(YesOrNoOrNa.No))
// {
// avgAnswer = "NE";
// }
// tableAnswers.Add(new ReadingTableQuestionAnswer()
// {
// Answer = avgAnswer,
// VisitTaskId = inDto.VisitTaskId,
// QuestionId = avg.QuestionId,
// TableQuestionId = avg.TableQuestionId,
// TrialId = inDto.TrialId,
// RowIndex = avg.RowIndex,
// RowId = avg.RowId,
});
// });
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId);
}
// await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId);
// }
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
// await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
// await _readingTableQuestionAnswerRepository.SaveChangesAsync();
}
//}
@@ -523,39 +523,46 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var rowInfo = readingData.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction)
.SelectMany(x => x.TableRowInfoList).ToList();
var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNotNullOrEmpty())).ToList();
var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.MRIPDFF && x.Answer.IsNotNullOrEmpty())).ToList();
if (tableQuestionList.Count() != 8)
if (tableQuestionList.Count() != 4)
{
throw new BusinessValidationFailedException(_localizer["MRIPDFF_AllNeedToBeMark"]);
}
try
{
List<QuestionMark?> questionMarkList = new List<QuestionMark?>() { QuestionMark.FirstMeasurement, QuestionMark.SecondMeasurement, QuestionMark.ThirdMeasurement, QuestionMark.FourthMeasurement };
var measuredValueList = rowInfo.SelectMany(x => x.TableQuestionList).Where(x =>x.Answer.IsNotNullOrEmpty()&& questionMarkList.Contains(x.QuestionMark)).Select(x => decimal.Parse(x.Answer)).ToList();
if (measuredValueList.Any(x => x > 100))
{
throw new BusinessValidationFailedException(_localizer["MRIPDFF_MeasurementGT100"]);
}
}
catch (Exception)
{
var instanceCount = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.InstanceId != null).Select(x => x.InstanceId).Distinct().CountAsync();
throw new BusinessValidationFailedException(_localizer["MRIPDFF_MeasurementGT100"]);
if (instanceCount > 1)
{
throw new BusinessValidationFailedException(_localizer["MRIPDFFAdvance_MarkMustBeSameInstance"]);
}
var notableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsMeasurable && x.Answer.EqEnum(YesOrNoOrNa.No))).ToList();
//try
//{
// List<QuestionMark?> questionMarkList = new List<QuestionMark?>() { QuestionMark.FirstMeasurement, QuestionMark.SecondMeasurement, QuestionMark.ThirdMeasurement, QuestionMark.FourthMeasurement };
// var measuredValueList = rowInfo.SelectMany(x => x.TableQuestionList).Where(x =>x.Answer.IsNotNullOrEmpty()&& questionMarkList.Contains(x.QuestionMark)).Select(x => decimal.Parse(x.Answer)).ToList();
// if (measuredValueList.Any(x => x > 100))
// {
// throw new BusinessValidationFailedException(_localizer["MRIPDFF_MeasurementGT100"]);
// }
//}
//catch (Exception)
//{
// throw new BusinessValidationFailedException(_localizer["MRIPDFF_MeasurementGT100"]);
//}
//var notableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsMeasurable && x.Answer.EqEnum(YesOrNoOrNa.No))).ToList();
foreach (var item in notableQuestionList)
{
if (markList.Any(x => x.RowId == item.RowId && x.MeasureData.IsNotNullOrEmpty()))
{
throw new BusinessValidationFailedException(_localizer["MRIPDFF_NeedClearMark"]);
}
}
//foreach (var item in notableQuestionList)
//{
// if (markList.Any(x => x.RowId == item.RowId && x.MeasureData.IsNotNullOrEmpty()))
// {
// throw new BusinessValidationFailedException(_localizer["MRIPDFF_NeedClearMark"]);
// }
//}
}
}
}
@@ -408,7 +408,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var tableQuestionList = rowInfo.Where(x=>x.TableQuestionList.Any(x=>x.QuestionMark== QuestionMark.IsMeasurable && x.Answer.EqEnum(YesOrNoOrNa.Yes))).SelectMany(x => x.TableQuestionList).ToList();
if (rowInfo.Any(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNullOrEmpty())))
if (rowInfo.Any(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.MRIPDFF && x.Answer.IsNullOrEmpty())))
{
return string.Empty;
}
@@ -416,7 +416,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
return "NE";
}
result = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).Average(x => x.Answer.IsNullOrEmptyReturn0());
result = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.MRIPDFF).Average(x => x.Answer.IsNullOrEmptyReturn0());
return decimal.Round(result, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString()); ;
}
@@ -466,7 +466,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
foreach (var item in questionInfo.TableRowInfoList)
{
var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault();
var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MRIPDFF).FirstOrDefault();
var avgAnswer = string.Empty;
List<QuestionMark?> questionMarks = new List<QuestionMark?>()
{
@@ -522,7 +522,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var rowInfo = readingData.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction)
.SelectMany(x => x.TableRowInfoList).ToList();
var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNotNullOrEmpty())).ToList();
var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.MRIPDFF && x.Answer.IsNotNullOrEmpty())).ToList();
if (tableQuestionList.Count() != 8)
{
@@ -6,17 +6,9 @@
namespace IRaCIS.Core.Application.Contracts
{
/// <summary> TrialSiteEquipmentSurveyView 列表视图模型 </summary>
public class TrialSiteEquipmentSurveyView
public class TrialSiteEquipmentSurveyView: TrialSiteEquipmentSurveyAddOrEdit
{
public Guid Id { get; set; }
public Guid TrialSiteSurveyId { get; set; }
public string EquipmentType { get; set; } = string.Empty;
public Guid? EquipmentTypeId { get; set; }
public string Parameters { get; set; } = string.Empty;
public string ManufacturerName { get; set; } = string.Empty;
public string ScannerType { get; set; } = string.Empty;
public string Note { get; set; } = string.Empty;
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
@@ -56,6 +48,36 @@ namespace IRaCIS.Core.Application.Contracts
public string ManufacturerName { get; set; } = string.Empty;
public string ScannerType { get; set; } = string.Empty;
public string Note { get; set; } = string.Empty;
[Comment("扫描设备-New")]
public int? EquipmentTypeEnum { get; set; }
public string OtherEquipmentType { get; set; }
[Comment("扫描设备厂商")]
public int? ManufacturerType { get; set; }
[Comment("磁场强度 (1.5T / 3.0T)")]
public int? MagneticFieldStrengthType { get; set; }
[Comment("体部线圈通道数 (≥16 或 16)")]
public int? BodyCoilChannelCount { get; set; }
[Comment("是否具备专用的PDFF脂肪定量序列(CSE-MRI序列)")]
public bool? HasDedicatedPdfFatQuantificationSequence { get; set; }
[Comment("专用的PDFF脂肪定量序列类型 (当 HasDedicatedPdfFatQuantificationSequence = true 时有效)")]
public int? PdfFatQuantificationSequenceType { get; set; }
[Comment("其他序列详细说明 (当 PdfFatQuantificationSequenceType = Other 时建议填写)")]
public string OtherSequenceSpecification { get; set; }
[Comment("是否包含 T2/R2 校正(用于铁沉积校正)")]
public bool? HasT2R2Correction { get; set; }
[Comment("是否可完整导出 PDFF 参数图及全部原始 DICOM 数据")]
public bool? CanFullyExportPdfParameterMapsAndRawDicom { get; set; }
}
@@ -130,7 +130,7 @@ namespace IRaCIS.Core.Application.Contracts
/// <summary> TrialSiteSurveyView 列表视图模型 </summary>
public class TrialSiteSurveyView
public class TrialSiteSurveyView: TrialSiteSurveyAddOrEdit
{
public string TrialSiteCode { get; set; } = String.Empty;
@@ -138,22 +138,12 @@ namespace IRaCIS.Core.Application.Contracts
public string SiteName { get; set; } = string.Empty;
public bool IsDeleted { get; set; }
public Guid Id { get; set; }
public Guid TrialId { get; set; }
public Guid? TrialSiteId { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public string UserName { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public int AverageEngravingCycle { get; set; }
public bool IsConfirmImagingTechnologist { get; set; }
public string NotConfirmReson { get; set; } = string.Empty;
public int EfficacyEvaluatorType { get; set; }
public bool IsFollowStudyParameters { get; set; }
public string NotFollowReson { get; set; } = string.Empty;
public TrialSiteSurveyEnum State { get; set; }
@@ -343,6 +333,34 @@ namespace IRaCIS.Core.Application.Contracts
public string NotFollowReson { get; set; } = string.Empty;
[Comment("MRI-PDEE 是否为本中心该适应症的常规诊疗检查项目")]
public bool? IsRoutineMRIPDEE { get; set; }
[Comment("MRI-PDFF 单次检查时长")]
public string MRIPDFFScanTime { get; set; }
[Comment("MRI-PDFF 预约等待时长")]
public string MRIPDFFLeadTime { get; set; }
[Comment("MRI-PDEE 其他")]
public string MRIPDFFOther { get; set; }
[Comment("是否授权影像科老师参与")]
public bool? IsAuthorizeRadiologistsParticipate { get; set; }
[Comment("保持 1-2 名固定技师")]
public bool? AssignFixedTechnologists { get; set; }
[Comment("是否严格按照影像手册参数完成刻盘")]
public bool? ISStrictManualBurnFlag { get; set; }
[Comment("不严格按照影像手册参数完成刻盘原因")]
public string NotStrictManualBurnFlagReason { get; set; }
}
@@ -139,6 +139,7 @@ namespace IRaCIS.Core.Application.Contracts
public class SiteSurveyUserImportDto
{
public string Country { get; set; }
public string TrialSiteCode { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
@@ -153,7 +153,7 @@ namespace IRaCIS.Core.Application.Contracts
if (inDto.TrialId != null)
{
isVirtual = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => x.TrialType != TrialType.OfficialTrial).FirstNotNullAsync();
await _doctorRepository.BatchUpdateNoTrackingAsync(x => x.Id == dockerInfo.Id, y => new Doctor()
{
IsVirtual = isVirtual,
@@ -183,16 +183,16 @@ namespace IRaCIS.Core.Application.Contracts
{
EMail = inDto.EmailOrPhone,
IsVirtual = isVirtual,
AcceptingNewTrial = inDto.TrialId == null? false:true,
AcceptingNewTrial = inDto.TrialId == null ? false : true,
ActivelyReading = false,
ResumeStatus = ResumeStatusEnum.Pass,
CooperateStatus = inDto.TrialId==null? ContractorStatusEnum.Noncooperation: ContractorStatusEnum.Cooperation,
CooperateStatus = inDto.TrialId == null ? ContractorStatusEnum.Noncooperation : ContractorStatusEnum.Cooperation,
ReviewStatus = ReviewerInformationConfirmStatus.ConfirmRefuse
};
doctor.Code = await _doctorRepository.Select(t => t.Code).DefaultIfEmpty().MaxAsync() + 1;
doctor.ReviewerCode= AppSettings.GetCodeStr(doctor.Code, nameof(Doctor));
doctor.ReviewerCode = AppSettings.GetCodeStr(doctor.Code, nameof(Doctor));
var info = await _doctorRepository.AddAsync(doctor, true);
@@ -246,7 +246,7 @@ namespace IRaCIS.Core.Application.Contracts
result.DoctorId = dockerInfo.Id;
result.ReviewStatus = dockerInfo.ReviewStatus;
if(inDto.TrialId != null)
if (inDto.TrialId != null)
{
var isVirtual = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => x.TrialType != TrialType.OfficialTrial).FirstNotNullAsync();
await _doctorRepository.BatchUpdateNoTrackingAsync(x => x.Id == dockerInfo.Id, y => new Doctor()
@@ -678,7 +678,7 @@ namespace IRaCIS.Core.Application.Contracts
if (currentLatest.Email != userInfo.ReplaceUserEmailOrPhone)
{
//---该中心不存在该交接人的中心调研记录表,不允许选择更新。
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]);
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate", currentLatest.Email]);
}
@@ -995,6 +995,10 @@ namespace IRaCIS.Core.Application.Contracts
generateUser.IsTestUser = true;
}
//通过中心国家,设置工作语言
var trialSiteCountry = _trialSiteRepository.Where(t => t.Id == trialSiteId).Select(t => t.Country).FirstOrDefault();
generateUser.UserWorkLanguage = trialSiteCountry == StaticData.SiteCountry.CN ? UserWorkLanguage.CN : UserWorkLanguage.US;
generateUser.Id = NewId.NextSequentialGuid();
// 外部人员生成账号 都是外部的
generateUser.IsZhiZhun = false;
@@ -1187,7 +1191,7 @@ namespace IRaCIS.Core.Application.Contracts
{
var addUserRoleList = item.ToList();
var first = addUserRoleList.FirstOrDefault();
var first = addUserRoleList.First();
var userEmail = item.Key;
@@ -1238,6 +1242,10 @@ namespace IRaCIS.Core.Application.Contracts
generateUser.IsTestUser = true;
}
//通过中心国家,设置工作语言
generateUser.UserWorkLanguage = first.Country == StaticData.SiteCountry.CN ? UserWorkLanguage.CN : UserWorkLanguage.US;
generateUser.Id = NewId.NextSequentialGuid();
// 外部人员生成账号 都是外部的
@@ -39,8 +39,7 @@ namespace IRaCIS.Core.Application.AutoMapper
//列表
CreateMap<TrialSiteEquipmentSurvey, TrialSiteEquipmentSurveyView>()
.ForMember(t => t.EquipmentType, u => u.MapFrom(d => isEn_Us ? d.EquipmentType.Value : d.EquipmentType.ValueCN));
CreateMap<TrialSiteEquipmentSurvey, TrialSiteEquipmentSurveyView>();
@@ -142,7 +142,7 @@
public int StatType { get; set; }
//医生付费类型 CN US
public int? Nation { get; set; }
public DoctorNation? Nation { get; set; }
//public AttendedReviewerType? AttendedReviewerType { get; set; }
}
@@ -87,6 +87,23 @@ namespace IRaCIS.Core.Application.Contracts
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; }
/// <summary>
/// QC质控下载
/// </summary>
public bool IsSupportQCDownloadImage { get; set; } = false;
/// <summary>
/// 打开失访可读
/// </summary>
public bool IsOpenLostVistRead { get; set; } = true;
/// <summary>
/// 影像质控风险控制
/// </summary>
public bool? IsImageQualityControl { get; set; }
}
public class ConfigTrialProcessInfoVerificationInDto
@@ -108,11 +125,6 @@ namespace IRaCIS.Core.Application.Contracts
public List<Guid> TrialCriterionIds { get; set; } = new List<Guid>();
/// <summary>
/// 影像质控风险控制
/// </summary>
public bool? IsImageQualityControl { get; set; }
public Guid TrialId { get; set; }
/// <summary>
@@ -17,6 +17,9 @@ namespace IRaCIS.Core.Application.Contracts.DTO
public string UserKeyInfo { get; set; } = String.Empty;
public string? Country { get; set; }
}
public class SiteCRCExportQueryDTO
@@ -43,6 +46,8 @@ namespace IRaCIS.Core.Application.Contracts.DTO
public string TrialSiteAliasName { get; set; } = String.Empty;
public string Country { get; set; }
public bool IsDeleted { get; set; } = true;
}
@@ -62,6 +67,8 @@ namespace IRaCIS.Core.Application.Contracts.DTO
public string TrialSiteCode { get; set; } = String.Empty;
public string Country { get; set; }
public bool IsDeleted { get; set; }
}
@@ -119,6 +126,8 @@ namespace IRaCIS.Core.Application.Contracts.DTO
public string SiteName { get; set; } = String.Empty;
public string AliasName { get; set; } = string.Empty;
public string Country { get; set; }
}
public class TrialSiteScreeningDTO
@@ -88,6 +88,8 @@ namespace IRaCIS.Application.Contracts
public string CriterionName { get; set; } = string.Empty;
public DateTime CreateTime { get; set; }
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; } = new List<TrialObjectNameConfig>();
}
@@ -243,11 +245,16 @@ namespace IRaCIS.Application.Contracts
}
public class TrialExtraConfig
{
#region QC
#region QC --
//QC质控
//QC质控下载
public bool IsSupportQCDownloadImage { get; set; } = false;
/// <summary>
/// 打开失访可读
/// </summary>
public bool IsOpenLostVistRead { get; set; } = true;
#endregion
@@ -260,20 +267,19 @@ namespace IRaCIS.Application.Contracts
public List<SiteSurveyModifyFiled> ModifyFiledList { get; set; } = new List<SiteSurveyModifyFiled>();
public List<SiteSurveyEquipmentField> EquipmentControlFieldList { get; set; } = new List<SiteSurveyEquipmentField>();
#endregion
/// <summary>
/// 打开失访可读
/// </summary>
public bool IsOpenLostVistRead { get; set; } = true;
}
public class TrialConfigInfo: TrialExtraConfig
public class TrialConfigInfo : TrialExtraConfig
{
#region
public List<TrialObjectNameConfig> TrialObjectNameList { get; set; }
@@ -290,6 +296,8 @@ namespace IRaCIS.Application.Contracts
#endregion
public TrialDataStore TrialDataStoreType { get; set; }
public TrialType TrialType { get; set; }
}
public class TrialPacsInfo
@@ -311,6 +319,14 @@ namespace IRaCIS.Application.Contracts
}
public class SiteSurveyEquipmentField
{
public string FiledName { get; set; }
public int ShowOrder { get; set; }
public bool IsView { get; set; }
}
}
@@ -441,6 +441,8 @@ namespace IRaCIS.Application.Contracts
public Guid TrialSiteId { get; set; }
public string Country { get; set; }
public string TrialSiteCode { get; set; } = String.Empty;
public string TrialSiteName { get; set; } = String.Empty;
@@ -11,8 +11,8 @@ namespace IRaCIS.Core.Application.Interfaces
Task<IResponseOutput> DeleteSiteCRC(Guid id, bool isDelete);
Task<IResponseOutput> DeleteTrialSite(Guid id);
Task<PageOutput<SiteStatDTO>> GetSiteCRCList(SiteCrcQueryDTO param);
Task<(PageOutput<SiteStatSimpleDTO>,object)> GetSiteCRCSimpleList(SiteCrcQueryDTO param);
Task<IResponseOutput<PageOutput<SiteStatSimpleDTO>> > GetSiteCRCSimpleList(SiteCrcQueryDTO param);
Task<PageOutput<TrialSiteScreeningDTO>> GetTrialSiteScreeningList(TrialSiteQuery trialSiteQuery);
Task<IEnumerable<TrialSiteForSelect>> GetTrialSiteSelect(Guid trialId);
Task<IEnumerable<TrialSiteForSelect>> GetTrialSiteSelect(Guid trialId, bool? ignoreDisable);
}
}
@@ -1146,6 +1146,8 @@ namespace IRaCIS.Core.Application
var isInternal = _userInfo.IsZhiZhun;
var workLanguage = _userInfo.UserWorkLanguage;
var needSignTrialCount = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing)
.Where(t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId)))
.Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
@@ -1153,6 +1155,8 @@ namespace IRaCIS.Core.Application
var needSignSysDocCont = await _systemDocumentRepository.Where(t => t.IsPublish)
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null))
.WhereIf(workLanguage == UserWorkLanguage.CN, t => t.DocLanguageType == DocLanguageType.CN || t.DocLanguageType == DocLanguageType.CN_US)
.WhereIf(workLanguage == UserWorkLanguage.US, t => t.DocLanguageType == DocLanguageType.US || t.DocLanguageType == DocLanguageType.CN_US)
//外部人员 只签署 外部需要签署的
.WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter)
.SelectMany(t => t.NeedConfirmedUserTypeList)
@@ -641,7 +641,7 @@ namespace IRaCIS.Core.Application
CriterionModalitys = inDto.CriterionModalitys,
ReadingTool = inDto.ReadingTool,
IsReadingPeriod = inDto.IsReadingPeriod,
DefaultSegmentName=inDto.DefaultSegmentName,
DefaultSegmentName = inDto.DefaultSegmentName,
//DigitPlaces=inDto.DigitPlaces,
IsReadingTaskViewInOrder = inDto.IsReadingTaskViewInOrder,
ReadingTaskViewEnum = inDto.ReadingTaskViewEnum,
@@ -1566,7 +1566,7 @@ namespace IRaCIS.Core.Application
[AllowAnonymous]
public async Task<TrialConfigInfo> GetTrialExtralConfig(Guid trialId)
{
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialExtraConfigJsonStr,t.TrialDataStoreType, t.IsExternalViewTrialChart, t.TrialObjectNameList, t.CollectImagesEnum, t.IsIQCAutoNextTask, t.IsImageQualityControl }).FirstOrDefault();
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialExtraConfigJsonStr, t.TrialDataStoreType, t.IsExternalViewTrialChart, t.TrialObjectNameList, t.CollectImagesEnum, t.IsIQCAutoNextTask, t.IsImageQualityControl, t.TrialType }).FirstOrDefault();
var extralConfig = JsonConvert.DeserializeObject<TrialExtraConfig>(extralObj?.TrialExtraConfigJsonStr) ?? new TrialExtraConfig();
@@ -1578,6 +1578,7 @@ namespace IRaCIS.Core.Application
trialConfig.CollectImagesEnum = extralObj.CollectImagesEnum;
trialConfig.IsIQCAutoNextTask = extralObj.IsIQCAutoNextTask;
trialConfig.TrialDataStoreType = extralObj.TrialDataStoreType;
trialConfig.TrialType = extralObj.TrialType;
return trialConfig;
}
@@ -17,6 +17,7 @@ using DocumentFormat.OpenXml.Spreadsheet;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Application.Contracts;
using MassTransit;
using System.Globalization;
namespace IRaCIS.Core.Application.Service
{
@@ -271,6 +272,11 @@ namespace IRaCIS.Core.Application.Service
generateUser.IsTestUser = true;
}
//外部人员语言类型,根据PM创建时界面语言决定
var isEn_US = _userInfo.IsEn_Us;
generateUser.UserWorkLanguage = isEn_US ? UserWorkLanguage.US : UserWorkLanguage.CN;
// 外部人员生成账号 都是外部的
generateUser.IsZhiZhun = false;
@@ -35,7 +35,10 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<IResponseOutput<PageOutput<IdentityUserJoinedTrialView>>> GetUserJoinedTrialList(IdentityUserJoinedTrialQuery inQuery)
{
var list = await _trialIdentityUserRepository.Where(t => t.IdentityUserId == inQuery.IdentityUserId, false, true)
var defalutSortArray = new string[] { nameof(IdentityUserJoinedTrialView.TrialCreateTime) + " desc" };
var list = await _trialIdentityUserRepository.Where(t => t.IdentityUserId == inQuery.IdentityUserId && t.Trial.IsDeleted==false, false, true)
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialCode), o => o.Trial.TrialCode.Contains(inQuery.TrialCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.Trial.ResearchProgramNo.Contains(inQuery.ResearchProgramNo))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.Trial.ExperimentName.Contains(inQuery.ExperimentName))
@@ -62,7 +65,7 @@ namespace IRaCIS.Core.Application.Service
UpdateTime = t.UpdateTime,
}).ToList(),
}).ToPagedListAsync(inQuery);
}).ToPagedListAsync(inQuery, defalutSortArray);
var info = await _identityUserRepository.Where(t => t.Id == inQuery.IdentityUserId).Select(t =>
new { t.CreateTime, t.UserCeateSource, t.Trial.ResearchProgramNo, t.Trial.ExperimentName, t.Trial.TrialCode }).FirstOrDefaultAsync();
@@ -144,7 +144,8 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(!other.Contains(_userInfo.UserTypeEnumInt), t => t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsDeleted == false
&& t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false))
&& t.IsDeleted == false && t.TrialStatusStr == StaticData.TrialState.TrialOngoing)
.ProjectTo<TrialSelectDTO>(_mapper.ConfigurationProvider).ToListAsync();
.ProjectTo<TrialSelectDTO>(_mapper.ConfigurationProvider)
.OrderByDescending(x=>x.CreateTime).ToListAsync();
}
@@ -222,7 +223,9 @@ namespace IRaCIS.Core.Application.Service
//var test = _trialRepository.Where(t => t.CreateTime.Year == DateTime.Now.Year + 1).Select(t => t.Code).DefaultIfEmpty(1).ToList();
var trial = _mapper.Map<Trial>(trialAddModel);
//trial.Id = NewId.NextGuid();
var yearStr = DateTime.Now.Year.ToString();
trial.Code = currentYearMaxCodeNext;
@@ -255,6 +258,32 @@ namespace IRaCIS.Core.Application.Service
trial.IsConfigureEmail = true;
#endregion
#region
var trialExtalConfig = new TrialExtraConfig()
{
EquipmentControlFieldList = new List<SiteSurveyEquipmentField> {
new SiteSurveyEquipmentField() { FiledName = "EquipmentTypeEnum", ShowOrder = 0, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "OtherEquipmentType", ShowOrder = 1, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "Parameters", ShowOrder = 2, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "ManufacturerType", ShowOrder = 3, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "ManufacturerName", ShowOrder = 4, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "ScannerType", ShowOrder = 5, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "Note", ShowOrder = 6, IsView = true },
},
NotShowFieldList = new List<string>() { "IsRoutineMRIPDEE", "MRIPDFFScanTime", "MRIPDFFLeadTime", "MRIPDFFOther", "IsAuthorizeRadiologistsParticipate", "AssignFixedTechnologists", "ISStrictManualBurnFlag", "NotStrictManualBurnFlagReason" }
};
trial.TrialExtraConfigJsonStr = trialExtalConfig.ToJsonStr();
#endregion
//如果是PM, 则需要将该人员添加到 运维人员表
//添加运维人员PM
await _trialIdentityUserRepository.AddAsync(new TrialIdentityUser()
@@ -341,7 +370,7 @@ namespace IRaCIS.Core.Application.Service
trial.EmailFromName = $"{_systemEmailConfig.FromName}-{trial.TrialCode}";
trial.UpdateTime = DateTime.Now;
var success = await _trialRepository.SaveChangesAsync();
@@ -101,7 +101,7 @@ namespace IRaCIS.Core.Application.Services
/// <summary>[new] setting页面Site列表,和getSiteCRCList对比 没有统计数据,增加了一些site信息 </summary>
[HttpPost]
public async Task<(PageOutput<SiteStatSimpleDTO>,object)> GetSiteCRCSimpleList(SiteCrcQueryDTO inQuery)
public async Task<IResponseOutput<PageOutput<SiteStatSimpleDTO>>> GetSiteCRCSimpleList(SiteCrcQueryDTO inQuery)
{
var trialinfo = await _trialRepository.Where(x => x.Id == inQuery.TrialId).FirstNotNullAsync();
@@ -110,6 +110,7 @@ namespace IRaCIS.Core.Application.Services
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.TrialSiteName.Contains(inQuery.SiteName) || t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Country), t => t.Country.Contains(inQuery.Country))
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.UserRoleId))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.UserRole.FullName).Contains(inQuery.UserKeyInfo)
|| k.UserRole.IdentityUser.UserName.Contains(inQuery.UserKeyInfo) || k.UserRole.IdentityUser.EMail.Contains(inQuery.UserKeyInfo)))
@@ -119,8 +120,9 @@ namespace IRaCIS.Core.Application.Services
var result = await siteStatQuery.ToPagedListAsync(inQuery);
return (result,new {
IsPACSConnectAndIsTrialPACSConfirmed = trialinfo.IsPACSConnect&&trialinfo.IsTrialPACSConfirmed,
return ResponseOutput.Ok(result, new
{
IsPACSConnectAndIsTrialPACSConfirmed = trialinfo.IsPACSConnect && trialinfo.IsTrialPACSConfirmed,
});
}
@@ -150,8 +152,8 @@ namespace IRaCIS.Core.Application.Services
{
var list = _siteRepository
.WhereIf(!string.IsNullOrWhiteSpace(siteName), t => t.SiteName.Contains(siteName) || t.SiteNameCN.Contains(siteName) || t.AliasName.Contains(siteName))
.Select(t => new TrialSiteSelect() { SiteId = t.Id, SiteName = _userInfo.IsEn_Us ? t.SiteName : t.SiteNameCN, AliasName = t.AliasName }).ToList()
.OrderBy(x=>x.SiteName)
.Select(t => new TrialSiteSelect() { SiteId = t.Id, SiteName = _userInfo.IsEn_Us ? t.SiteName : t.SiteNameCN, AliasName = t.AliasName, Country = t.Country }).ToList()
.OrderBy(x => x.SiteName)
.ToList();
return list;
@@ -266,13 +268,21 @@ namespace IRaCIS.Core.Application.Services
/// 获取项目下的 site 下拉框数据 CRC只看到他负责的
/// </summary>
/// <param name="trialId"></param>
/// <param name="ignoreDisable"></param>
/// <returns></returns>
[HttpGet("{trialId:guid}")]
public async Task<IEnumerable<TrialSiteForSelect>> GetTrialSiteSelect(Guid trialId)
public async Task<IEnumerable<TrialSiteForSelect>> GetTrialSiteSelect(Guid trialId, bool? ignoreDisable)
{
//CRC只看到他负责的
var list = await _trialSiteRepository.Where(t => t.TrialId == trialId)
var query = _trialSiteRepository.Where(t => t.TrialId == trialId);
if (ignoreDisable == true)
{
query = query.IgnoreQueryFilters();
}
var list = await query
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))
.ProjectTo<TrialSiteForSelect>(_mapper.ConfigurationProvider).OrderBy(t => t.TrialSiteCode).ToListAsync();
@@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Contracts.Dicom.DTO;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using Microsoft.AspNetCore.Mvc;
using Pipelines.Sockets.Unofficial.Arenas;
using System.Linq.Dynamic.Core;
@@ -42,7 +43,7 @@ namespace IRaCIS.Core.Application.Service
var instanceList = await _instanceRepository.Where(s => s.StudyId == scpStudyId).OrderBy(t => t.SeriesId).ThenBy(t => t.InstanceNumber)
.ThenBy(s => s.InstanceTime).ThenBy(s => s.CreateTime)
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames, t.InstanceNumber,t.FileSize }).ToListAsync();//.GroupBy(u => u.SeriesId);
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames, t.InstanceNumber, t.FileSize }).ToListAsync();//.GroupBy(u => u.SeriesId);
foreach (var series in seriesList)
{
@@ -55,7 +56,7 @@ namespace IRaCIS.Core.Application.Service
//HtmlPath = string.Empty,
Path = k.Path,
InstanceNumber = k.InstanceNumber,
FileSize=k.FileSize,
FileSize = k.FileSize,
}).ToList();
}
@@ -378,11 +379,12 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
public async Task<IResponseOutput> SubmitVisitStudyBinding(SubmitVisitStudyBindingCommand inCommand,
[FromServices] IRepository<DicomStudy> _dicomstudyRepository,
[FromServices] IRepository<DicomSeries> _dicomSeriesRepository,
[FromServices] IRepository<DicomInstance> _dicomInstanceRepository)
[FromServices] IRepository<DicomInstance> _dicomInstanceRepository,
[FromServices] IRepository<FileUploadRecord> _fileUploadRecordRepository)
{
//这里要做校验 + 同时验证本地系统里面的影像是否存在pacs推过来的
@@ -403,11 +405,14 @@ namespace IRaCIS.Core.Application.Service
var subjectVisitId = inCommand.SubjectVisitId;
var trialId = inCommand.TrialId;
var studyCode = "";
var studyUid = "";
var @lock = _distributedLockProvider.CreateLock($"StudyCode");
using (await @lock.AcquireAsync())
{
var dbStudyCodeIntMax = _dicomStudyRepository.Where(s => s.TrialId == inCommand.TrialId).Select(t => t.Code).DefaultIfEmpty().Max();
var dbStudyCodeIntMax = _trialRepository.Where(s => s.Id == trialId, ignoreQueryFilters: true).Select(t => t.MaxDicomCode).DefaultIfEmpty().Max();
int currentNextCodeInt = dbStudyCodeIntMax + 1;
@@ -430,6 +435,8 @@ namespace IRaCIS.Core.Application.Service
newStuty.SubjectId = subjectId;
newStuty.SubjectVisitId = subjectVisitId;
studyCode = newStuty.StudyCode;
await _dicomStudyRepository.AddAsync(newStuty);
@@ -457,12 +464,22 @@ namespace IRaCIS.Core.Application.Service
}
await _dicomInstanceRepository.AddRangeAsync(newInstanceList);
//回更StudyCode
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Path.Contains(newStuty.StudyInstanceUid), u => new FileUploadRecord() { StudyCode = studyCode, SubjectId = newStuty.SubjectId, SubjectVisitId = newStuty.SubjectVisitId });
await _trialRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialId, u => new Trial() { MaxDicomCode = currentNextCodeInt });
await _scpPatientRepository.BatchUpdateNoTrackingAsync(t => t.Id == find.SCPStudy.PatientId, u => new SCPPatient() { SubjectId = subjectId });
await _scpStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudyId, u => new SCPStudy() { SubjectVisitId = subjectVisitId });
}
currentNextCodeInt++;
await _scpPatientRepository.BatchUpdateNoTrackingAsync(t => t.Id == find.SCPStudy.PatientId, u => new SCPPatient() { SubjectId = subjectId });
await _scpStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudyId, u => new SCPStudy() { SubjectVisitId = subjectVisitId });
}
@@ -549,6 +566,10 @@ namespace IRaCIS.Core.Application.Service
}
}
//回更StudyCode
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Path.Contains(study.StudyInstanceUid), u => new FileUploadRecord() { StudyCode = studyCode, SubjectId = study.SubjectId, SubjectVisitId = study.SubjectVisitId });
await _scpPatientRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudy.PatientId, u => new SCPPatient() { SubjectId = subjectId });
await _scpStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudyId, u => new SCPStudy() { SubjectVisitId = subjectVisitId });
}
+207 -23
View File
@@ -1,30 +1,17 @@
using Aliyun.OSS;
using DocumentFormat.OpenXml.Spreadsheet;
using FellowOakDicom;
using FellowOakDicom.Imaging;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.BusinessFilter;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Helper.OtherTool;
using IRaCIS.Core.Application.Service.BusinessFilter;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infra.EFCore.Context;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Encryption;
using IRaCIS.Core.Infrastructure.NewtonsoftJson;
using MassTransit;
using MassTransit.Caching.Internals;
using MassTransit.Mediator;
using MathNet.Numerics;
using MaxMind.GeoIP2;
using Medallion.Threading;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -32,24 +19,15 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MiniExcelLibs;
using Minio.DataModel;
using NPOI.SS.Formula.Functions;
using Newtonsoft.Json;
using NPOI.XWPF.UserModel;
using SharpCompress.Common;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Processing;
using System.Collections.Concurrent;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq.Dynamic.Core;
using System.Reactive.Subjects;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.InteropServices;
using System.Text;
using static IRaCIS.Core.Domain.Share.StaticData;
@@ -107,6 +85,212 @@ namespace IRaCIS.Core.Application.Service
public DateTime? DateTimeNUllValue { get; set; }
}
/// <summary>
/// 维护中心调研设备默认配置
/// </summary>
/// <param name="modelVerify"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
public async Task<IResponseOutput> SiteSuveryEquipment()
{
//默认配置
var trialExtalConfig = new TrialExtraConfig()
{
EquipmentControlFieldList = new List<SiteSurveyEquipmentField> {
new SiteSurveyEquipmentField() { FiledName = "EquipmentTypeEnum", ShowOrder = 0, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "OtherEquipmentType", ShowOrder = 1, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "Parameters", ShowOrder = 2, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "ManufacturerType", ShowOrder = 3, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "ManufacturerName", ShowOrder = 4, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "ScannerType", ShowOrder = 5, IsView = true },
new SiteSurveyEquipmentField() { FiledName = "Note", ShowOrder = 6, IsView = true },
}
};
var fixedFields = new List<string>() { "IsRoutineMRIPDEE", "MRIPDFFScanTime", "MRIPDFFLeadTime", "MRIPDFFOther", "IsAuthorizeRadiologistsParticipate", "AssignFixedTechnologists", "ISStrictManualBurnFlag", "NotStrictManualBurnFlagReason" };
//已有配置处理
var list = _trialRepository.Where(t => t.TrialExtraConfigJsonStr != "").Select(t => new { t.Id, t.TrialExtraConfigJsonStr }).ToList();
foreach (var item in list)
{
var extralConfig = JsonConvert.DeserializeObject<TrialExtraConfig>(item.TrialExtraConfigJsonStr);
//额外配置的中心调研,
if (extralConfig.ModifyFiledList.Count > 0)
{
extralConfig.EquipmentControlFieldList = trialExtalConfig.EquipmentControlFieldList.Where(t => t.ShowOrder != 2).ToList();
}
else
{
extralConfig.EquipmentControlFieldList = trialExtalConfig.EquipmentControlFieldList;
}
if (extralConfig.NotShowFieldList.Count == 0)
{
extralConfig.NotShowFieldList.AddRange(fixedFields);
extralConfig.NotShowFieldList = extralConfig.NotShowFieldList.Distinct().ToList();
}
else
{
//判断固定数组中是否有任意一个元素存在于 NotShowFieldList 中
if (!fixedFields.Any(t => extralConfig.NotShowFieldList.Any(c => c == t)))
{
extralConfig.NotShowFieldList.AddRange(fixedFields);
}
}
var jsonInfo = extralConfig.ToJsonStr();
await _trialRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new Trial() { TrialExtraConfigJsonStr = jsonInfo });
}
//默认配置更新
var info = trialExtalConfig.ToJsonStr();
var idQuery = _trialRepository.Where(t => t.TrialExtraConfigJsonStr == "").Select(t => t.Id);
await _trialRepository.BatchUpdateNoTrackingAsync(t => idQuery.Contains(t.Id), u => new Trial() { TrialExtraConfigJsonStr = info });
return ResponseOutput.Ok();
}
/// <summary>
/// 访视数据模型
/// </summary>
public class SubjectVisitExcel
{
public string SubjectCode { get; set; }
public Guid? SubjectVisitId { get; set; }
public decimal VisitNum { get; set; }
public string VisitName { get; set; }
public string R1 { get; set; }
public string R1阅片状态 { get; set; }
public string R2 { get; set; }
public string R2阅片状态 { get; set; }
}
[AllowAnonymous]
public async Task<IResponseOutput> ExtralUndownloadImages(Guid trialId)
{
var newVisits = MiniExcel.Query<SubjectVisitExcel>(@"C:\Users\PC\Desktop\New.xlsx").ToList();
var oldVisits = MiniExcel.Query<SubjectVisitExcel>(@"C:\Users\PC\Desktop\Old.xlsx").ToList();
var downloadVisit = new List<SubjectVisitExcel>();
foreach (var item in newVisits)
{
if (oldVisits.Any(t => t.VisitNum == item.VisitNum && t.SubjectCode.Trim() == item.SubjectCode.Trim()))
{
continue;
}
else
{
downloadVisit.Add(item);
}
}
string exportPath = @$"C:\Users\PC\Desktop\newDownload.xlsx";
MiniExcel.SaveAs(exportPath, downloadVisit);
#region
// var downloadInfo = _trialRepository.Where(t => t.Id == trialId).Select(t => new
// {
// t.ResearchProgramNo,
// t.TrialCode,
// VisitList = t.SubjectVisitList.Where(t => t.VisitTaskList.Any(t => t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.SourceSubjectVisitId != null && t.DoctorUserId != null))
// //.Where(t=>subjectCodeList.Contains(t.Subject.Code))
// .Select(sv => new
// {
// SubjectVisitId = sv.Id,
// TrialSiteCode = sv.TrialSite.TrialSiteCode,
// SubjectCode = sv.Subject.Code,
// VisitName = sv.VisitName,
// VisitNum = sv.VisitNum,
// StudyList = sv.StudyList.Select(u => new
// {
// StudyId = u.Id,
// u.PatientId,
// u.StudyTime,
// u.StudyCode,
// u.StudyInstanceUid,
// u.StudyDIRPath,
// SeriesList = u.SeriesList.Where(t => t.IsReading).Select(z => new
// {
// z.Modality,
// InstancePathList = z.DicomInstanceList.Where(t => t.IsReading).Select(k => new
// {
// InstanceId = k.Id,
// k.Path,
// k.IsEncapsulated,
// k.NumberOfFrames,
// }).ToList()
// })
// }).ToList(),
// NoneDicomStudyList = sv.NoneDicomStudyList.Where(t => t.IsReading).Select(nd => new
// {
// nd.Modality,
// nd.StudyCode,
// nd.ImageDate,
// FileList = nd.NoneDicomFileList.Where(t => t.IsReading).Select(file => new
// {
// file.FileName,
// file.Path,
// file.FileType
// }).ToList()
// }).ToList()
// }).OrderBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ToList()
// }).FirstOrDefault();
// var acturalDownList = downloadInfo.VisitList.Where(t => !oldVisits.Any(old => old.VisitNum == t.VisitNum && old.SubjectCode == t.SubjectCode &&
//old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList();
// var diffList = downloadVisit.Where(t => !acturalDownList.Any(old => old.SubjectCode.Trim() == t.SubjectCode.Trim() &&
//old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList();
// string diffPath = @$"C:\Users\PC\Desktop\diff.xlsx";
// MiniExcel.SaveAs(diffPath, diffList);
#endregion
return ResponseOutput.Ok(downloadVisit);
}
//创建一个模型验证的方法
[AllowAnonymous]
+28 -1
View File
@@ -504,6 +504,28 @@ namespace IRaCIS.Core.Domain.Share
}
/// <summary>
/// 问题增删类型
/// </summary>
public enum AddDeleteType
{
/// <summary>
/// 任意
/// </summary>
Arbitrium = 0,
/// <summary>
/// 仅基线
/// </summary>
OnlyBaseLine = 1,
/// <summary>
/// 仅随访
/// </summary>
OnlyVisit = 2,
}
/// <summary>
/// 影像标记类型
/// </summary>
@@ -2514,7 +2536,7 @@ namespace IRaCIS.Core.Domain.Share
/// <summary>
/// 平均值
/// </summary>
AverageValue = 1104,
MRIPDFF = 1104,
/// <summary>
/// 是否可测量
@@ -3237,6 +3259,11 @@ namespace IRaCIS.Core.Domain.Share
/// 保存eCRF
/// </summary>
SaveEICRFQuestions = 12,
/// <summary>
/// 保存Advance肝脏分段
/// </summary>
SaveAdvanceLiverSegments = 13,
}
/// <summary>
+22 -13
View File
@@ -61,7 +61,7 @@ public class Doctor : BaseFullAuditEntity
[MaxLength]
public string? BlindPublications { get; set; }
public string ChineseName { get; set; } = string.Empty;
public int Code { get; set; }
@@ -70,7 +70,7 @@ public class Doctor : BaseFullAuditEntity
public Guid? DepartmentId { get; set; }
public string DepartmentOther { get; set; } = string.Empty;
@@ -110,10 +110,10 @@ public class Doctor : BaseFullAuditEntity
public DateTime? LastLoginTime { get; set; }
public string LastName { get; set; } = string.Empty;
public int Nation { get; set; }
public DoctorNation Nation { get; set; }
public Guid OrganizationId { get; set; }
[MaxLength]
@@ -121,10 +121,10 @@ public class Doctor : BaseFullAuditEntity
[MaxLength]
public string? OtherClinicalExperienceCN { get; set; }
public string Password { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string PhotoPath { get; set; } = string.Empty;
@@ -137,24 +137,24 @@ public class Doctor : BaseFullAuditEntity
public Guid? PositionId { get; set; }
public string PositionOther { get; set; } = string.Empty;
public string PositionOtherCN { get; set; } = string.Empty;
public Guid? RankId { get; set; }
public string RankOther { get; set; } = string.Empty;
public string RankOtherCN { get; set; } = string.Empty;
public string ReadingTypeOther { get; set; } = string.Empty;
public string ReadingTypeOtherCN { get; set; } = string.Empty;
[StringLength(1000)]
@@ -162,7 +162,7 @@ public class Doctor : BaseFullAuditEntity
public ResumeStatusEnum ResumeStatus { get; set; } = ResumeStatusEnum.Failed;
public string ReviewerCode { get; set; } = string.Empty;
public ReviewerInformationConfirmStatus ReviewStatus { get; set; } = ReviewerInformationConfirmStatus.ConfirmRefuse;
@@ -281,3 +281,12 @@ public class Doctor : BaseFullAuditEntity
/// </summary>
public string HospitalNameCN { get; set; } = string.Empty;
}
public enum DoctorNation
{
CN = 0,
US = 1,
Europe = 2,
Other = 3
}
@@ -52,6 +52,9 @@ public class SystemDocument : BaseFullDeleteAuditEntity
public DateTime? PublishDate { get; set; }
public DocLanguageType DocLanguageType { get; set; }
}
@@ -106,4 +109,15 @@ public enum DocUserSignType
OnlyInner=1,
}
public enum DocLanguageType
{
CN = 0,
US = 1,
//共用
CN_US = 2
}
+13 -1
View File
@@ -47,6 +47,7 @@ public class UserRole : BaseFullAuditEntity
[Comment("医生生成账号后,会有值")]
public Guid? DoctorId { get; set; }
@@ -157,6 +158,17 @@ public class IdentityUser : BaseFullAuditEntity
/// 隐私政策Id
/// </summary>
public Guid? PrivacyPolicyId { get; set; }
public UserWorkLanguage UserWorkLanguage { get; set; }
}
public enum UserWorkLanguage
{
CN = 0,
US = 1,
}
public enum UserCeateSource
@@ -169,6 +181,6 @@ public enum UserCeateSource
ReviewerSelect = 3,
External=4
External = 4
}
@@ -311,7 +311,12 @@ public class ReadingQuestionTrial : BaseAddAuditEntity
/// </summary>
public string ImageToolAttribute { get; set; } = string.Empty;
/// <summary>
/// 新增修改类型
/// </summary>
public AddDeleteType AddDeleteTypeEnum { get; set; } = AddDeleteType.Arbitrium;
[NotMapped]
public List<ExportResult> ExportResult
@@ -60,6 +60,11 @@ public class Segmentation : BaseFullDeleteAuditEntity
[MaxLength]
public string SEGUrl { get; set; } = string.Empty;
/// <summary>
/// SEGUpdateTime 更新时间
/// </summary>
public DateTime? SEGUpdateTime { get; set; }
/// <summary>
/// 文件大小,单位字节
/// </summary>
@@ -39,6 +39,11 @@ public class SegmentationVersion : BaseAddAuditEntity
/// </summary>
public long FileSize { get; set; } = 0;
/// <summary>
/// 版本开始时间
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// SgenmentList
/// </summary>
@@ -51,6 +56,11 @@ public class SegmentationVersion : BaseAddAuditEntity
public class SegmentVersionData: ISegment
{
/// <summary>
/// 这个时间很总要要记录
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 分割Id
/// </summary>
@@ -14,12 +14,52 @@ public class TrialSiteEquipmentSurvey : BaseFullAuditEntity
#endregion
public Guid TrialSiteSurveyId { get; set; }
[Comment("扫描设备-废弃")]
public Guid EquipmentTypeId { get; set; }
[Comment("扫描设备参数")]
public string Parameters { get; set; } = string.Empty;
[Comment("扫描设备厂商其他补充")]
public string ManufacturerName { get; set; } = string.Empty;
[Comment("扫描设备型号")]
public string ScannerType { get; set; } = string.Empty;
public string Note { get; set; } = string.Empty;
#region
[Comment("扫描设备-New")]
public int EquipmentTypeEnum { get; set; }
public string OtherEquipmentType { get; set; }
[Comment("扫描设备厂商")]
public int? ManufacturerType { get; set; }
[Comment("磁场强度 (1.5T / 3.0T)")]
public int? MagneticFieldStrengthType { get; set; }
[Comment("体部线圈通道数 (≥16 或 16)")]
public int? BodyCoilChannelCount { get; set; }
[Comment("是否具备专用的PDFF脂肪定量序列(CSE-MRI序列)")]
public bool? HasDedicatedPdfFatQuantificationSequence { get; set; }
[Comment("专用的PDFF脂肪定量序列类型 (当 HasDedicatedPdfFatQuantificationSequence = true 时有效)")]
public int? PdfFatQuantificationSequenceType { get; set; }
[Comment("其他序列详细说明 (当 PdfFatQuantificationSequenceType = Other 时建议填写)")]
public string OtherSequenceSpecification { get; set; }
[Comment("是否包含 T2/R2 校正(用于铁沉积校正)")]
public bool? HasT2R2Correction { get; set; }
[Comment("是否可完整导出 PDFF 参数图及全部原始 DICOM 数据")]
public bool? CanFullyExportPdfParameterMapsAndRawDicom { get; set; }
#endregion
}
@@ -51,5 +51,35 @@ public class TrialSiteSurvey : BaseFullDeleteAuditEntity
public DateTime? PreliminaryTime { get; set; }
public DateTime? ReviewerTime { get; set; }
[Comment("MRI-PDEE 是否为本中心该适应症的常规诊疗检查项目")]
public bool? IsRoutineMRIPDEE { get; set; }
[Comment("MRI-PDFF 单次检查时长")]
public string MRIPDFFScanTime { get; set; }
[Comment("MRI-PDFF 预约等待时长")]
public string MRIPDFFLeadTime { get; set; }
[Comment("MRI-PDEE 其他")]
public string MRIPDFFOther { get; set; }
[Comment("是否授权影像科老师参与")]
public bool? IsAuthorizeRadiologistsParticipate { get; set; }
[Comment("保持 1-2 名固定技师")]
public bool? AssignFixedTechnologists { get; set; }
[Comment("是否严格按照影像手册参数完成刻盘")]
public bool? ISStrictManualBurnFlag { get; set; }
[Comment("不严格按照影像手册参数完成刻盘原因")]
public string NotStrictManualBurnFlagReason { get; set; }
}
+13 -3
View File
@@ -307,14 +307,14 @@ public partial class Trial : BaseFullDeleteAuditEntity
/// <summary>
/// IQC自动下一个任务
/// </summary>
public bool IsIQCAutoNextTask { get; set; }
public bool IsIQCAutoNextTask { get; set; } = true;
public bool IsIQCAutoTaskDistinguishType { get; set; }
public bool IsIQCAutoTaskDistinguishType { get; set; } = true;
/// <summary>
/// 影像质控风险控制
/// </summary>
public bool? IsImageQualityControl { get; set; }
public bool? IsImageQualityControl { get; set; } = true;
public TrialDataStore TrialDataStoreType { get; set; }
@@ -324,6 +324,16 @@ public partial class Trial : BaseFullDeleteAuditEntity
[Comment("最大的NoneDicom检查编号 整型")]
public int MaxNoneDicomCode { get; set; }
/// <summary>
/// QC质控下载
/// </summary>
public bool IsSupportQCDownloadImage { get; set; }
/// <summary>
/// 打开失访可读
/// </summary>
public bool IsOpenLostVistRead { get; set; } = true;
}
public enum TrialDataStore
@@ -1,4 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("项目 - 项目中心表")]
[Table("TrialSite")]
@@ -40,4 +42,9 @@ public class TrialSite : BaseFullDeleteAuditEntity
public string TrialSiteAliasName { get; set; } = String.Empty;
public DateTime? EnabledTime { get; set; }
/// <summary>
/// 使用 StaticData.SiteCountry.CN;
/// </summary>
public string Country { get; set; }
}

Some files were not shown because too many files have changed in this diff Show More