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 Details

Test_IRC_Net8
hang 2025-11-06 15:05:10 +08:00
commit 668af5ee0b
39 changed files with 148882 additions and 365 deletions

View File

@ -1316,7 +1316,7 @@
<param name="_userInfo"></param>
<param name="_localizer"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.EmailLogService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailLog},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<member name="M:IRaCIS.Core.Application.Service.EmailLogService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailAttachmentLog},IRaCIS.Core.Application.Helper.IOSSService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailRecipientLog},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
邮件日志
</summary>
@ -1326,6 +1326,33 @@
<param name="_userInfo"></param>
<param name="_localizer"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.EmailLogService.GetEmailLogList(IRaCIS.Core.Application.ViewModel.EmailLogQuery)">
<summary>
获取邮件日志列表
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EmailLogService.GetEmailInfo(IRaCIS.Core.Application.ViewModel.GetEmailInfoInDto)">
<summary>
获取单条邮件日志详情
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EmailLogService.ResendEmail(IRaCIS.Core.Application.ViewModel.ResendEmailInDto)">
<summary>
重发邮件
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EmailLogService.SynchronizationEmail">
<summary>
同步邮件
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.EmailLogService.BuildSearchQuery(IRaCIS.Core.Application.ViewModel.EmailLogQuery)">
<summary>
邮件筛选条件构建
@ -8069,6 +8096,61 @@
任务名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListInDto.ModuleName">
<summary>
阅片期名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListInDto.ReadingSetType">
<summary>
阅片配置的类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.ReadingSetType">
<summary>
阅片期类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.ModuleName">
<summary>
阅片期名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.SiteCode">
<summary>
中心编号
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.SubjectCode">
<summary>
受试者编号
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.VisitName">
<summary>
访视名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.LatestScanDate">
<summary>
最晚拍片日期
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.ReadModuleAddTypeEnum">
<summary>
来源
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.IsGenerateTask">
<summary>
是否生成任务
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListOutDto.GenerateTaskTime">
<summary>
生成任务时间
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetCanChangeReadVisitListInDto.SubjectId">
<summary>
受试者ID
@ -10759,6 +10841,46 @@
阅片期ID
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.ReadingScope">
<summary>
阅片范围
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.SiteIds">
<summary>
中心ID
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.TrialId">
<summary>
项目ID
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.ExpirationDate">
<summary>
截止日期
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.ExpirationVisitNum">
<summary>
截止访视
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.VisitStageId">
<summary>
访视计划ID
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.ReadingPeriodName">
<summary>
阅片期名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto.ReadingSetType">
<summary>
类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.ReadingScope">
<summary>
阅片范围
@ -10799,6 +10921,26 @@
类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.SiteId">
<summary>
中心Id
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.SubjectCode">
<summary>
受试者Code
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.IsJoin">
<summary>
是否加入阅片计划
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.IsGenerate">
<summary>
是否生成阅片计划
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto">
<summary>
获取影像阅片预览的Dto
@ -10849,6 +10991,26 @@
阅片期名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.IsJoin">
<summary>
是否加入阅片计划
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.IsGenerate">
<summary>
是否生成阅片计划
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.IsGenerateTask">
<summary>
是否生成任务
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto.GeneratedTime">
<summary>
生成时间
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingPeriodSetView.Id">
<summary>
id
@ -14251,6 +14413,13 @@
<param name="indto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingPeriodSetService.AddReadModule(IRaCIS.Core.Application.Service.Reading.Dto.AddReadModuleInDto)">
<summary>
生效或者新增访视的时候添加阅片期
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingPeriodSetService.GetPreviewTheReadingPlanList(IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListDto)">
<summary>
获取选中的计划 (增加标准不影响 因为阅片期设置关联了标准)
@ -14286,6 +14455,26 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingPeriodSetService.IsChangeReadingPlan(IRaCIS.Core.Application.Service.Reading.Dto.IsChangeReadingPlanInDto)">
<summary>
判断是否修改了阅片期计划的参数
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingPeriodSetService.AddReadingPlanAndGenerateReadModule(IRaCIS.Core.Application.Service.Reading.Dto.AddReadingPlanAndGenerateReadModuleInDto)">
<summary>
添加阅片计划并生成阅片期(在阅片期已经生效的情况下添加)
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingPeriodSetService.SetBatchRemoveReadingPlan(IRaCIS.Core.Application.Service.Reading.Dto.SetBatchAddOrRemoveReadingPlanInDto)">
<summary>
移除阅片计划
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingPeriodSetService.GetPreviewTheReadingList(IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto)">
<summary>
获取影像阅片的预览 // 需要清除之前已经选中的 (增加标准搜索,已修改)
@ -14323,6 +14512,13 @@
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadModuleService.GetReadModulePageList(IRaCIS.Core.Application.Service.Reading.Dto.GetReadModulePageListInDto)">
<summary>
获取读片模块分页列表 //加了标准参数
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadModuleService.GetReadModule(IRaCIS.Core.Application.Service.Reading.Dto.GetReadModuleSingleIndto)">
<summary>
获取单条详情信息
@ -15651,6 +15847,41 @@
<member name="T:IRaCIS.Core.Application.ViewModel.CommonDocumentAddOrEdit">
<summary> CommonDocumentAddOrEdit 列表查询参数模型</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmaliAttachmentInfo.AttachmentName">
<summary>
附件名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmaliAttachmentInfo.AttachmentPath">
<summary>
附件路径
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailRecipientLogView.EmailLogId">
<summary>
邮件Id
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailRecipientLogView.RecipientName">
<summary>
收件人姓名
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailRecipientLogView.RecipientAddress">
<summary>
收件人地址
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailRecipientLogView.RecipientTypeEnum">
<summary>
收件人类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailRecipientLogView.Sort">
<summary>
排序
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailLogAddOrEdit.MessageId">
<summary>
邮件Id
@ -15666,21 +15897,6 @@
邮件主题
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailLogAddOrEdit.ToRecipients">
<summary>
收件人
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailLogAddOrEdit.CcRecipients">
<summary>
抄送人
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailLogAddOrEdit.Attachments">
<summary>
附件
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.EmailLogAddOrEdit.EmailDate">
<summary>
日期
@ -16812,6 +17028,11 @@
<member name="T:IRaCIS.Core.Application.ViewModel.UserWLTemplateQuery">
<summary>UserWLTemplateQuery 列表查询参数模型</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SetAutoCutNextTaskInDto.IsDoubleScreen">
<summary>
是否双屏
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.UserWLTemplateAddOrEdit">
<summary> UserWLTemplateAddOrEdit 列表查询参数模型</summary>
</member>

View File

@ -17,6 +17,53 @@ public class EmailLogView : EmailLogAddOrEdit
public DateTime UpdateTime { get; set; }
public List<EmailRecipientLogView> RecipientList { get; set; }
public List<EmaliAttachmentInfo> AttachmentList { get; set; }
}
public class EmaliAttachmentInfo
{
/// <summary>
/// 附件名称
/// </summary>
public string AttachmentName { get; set; }
/// <summary>
/// 附件路径
/// </summary>
public string AttachmentPath { get; set; }
}
public class EmailRecipientLogView
{
public Guid Id { get; set; }
/// <summary>
/// 邮件Id
/// </summary>
public Guid EmailLogId { get; set; }
/// <summary>
/// 收件人姓名
/// </summary>
public string RecipientName { get; set; }
/// <summary>
/// 收件人地址
/// </summary>
public string RecipientAddress { get; set; }
/// <summary>
/// 收件人类型
/// </summary>
public RecipientType RecipientTypeEnum { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
}
@ -39,21 +86,6 @@ public class EmailLogAddOrEdit
/// </summary>
public string EmailSubject { get; set; } = string.Empty;
/// <summary>
/// 收件人
/// </summary>
public List<EmaliSendInfo> ToRecipients { get; set; }
/// <summary>
/// 抄送人
/// </summary>
public List<EmaliSendInfo> CcRecipients { get; set; }
/// <summary>
/// 附件
/// </summary>
public List<string> Attachments { get; set; }
/// <summary>
/// 日期
/// </summary>
@ -85,19 +117,37 @@ public class EmailLogAddOrEdit
public EmailState EmailStateEnum { get; set; }
}
public class GetEmailInfoOutDto:EmailLogView
{
}
public class GetEmailInfoInDto
{
public Guid Id { get; set; }
}
public class ResendEmailInDto
{
public Guid Id { get; set; }
}
public class EmailLogQuery:PageInput
{
public Guid? TrialId { get; set; }
public DateTime? EmailStartDate { get; set; }
public DateTime? EmailEndDate { get; set; }
public EmailState EmailStateEnum { get; set; }
public EmailState? EmailStateEnum { get; set; }
public string? ToRecipientName { get; set; }
public string ToRecipientName { get; set; } = string.Empty;
public string CcRecipientName { get; set; } = string.Empty;
public string? CcRecipientName { get; set; }
}

View File

@ -4,6 +4,7 @@
// 生成时间 2025-10-28 06:22:42Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
@ -13,9 +14,12 @@ using MailKit;
using MailKit.Net.Imap;
using MailKit.Search;
using MailKit.Security;
using MassTransit;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using MimeKit;
using System.IO;
using System.Linq;
using System.Net.Mail;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service;
@ -30,21 +34,62 @@ namespace IRaCIS.Core.Application.Service;
/// <param name="_localizer"></param>
[ApiExplorerSettings(GroupName = "Common")]
public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
IRepository<Trial> _trialRepository,
IRepository<EmailAttachmentLog> _emailAttachmentLogRepository,
IOSSService oSSService,
IRepository<EmailRecipientLog> _emailRecipientLogRepository,
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, IEmailLogService
{
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
/// <summary>
/// 获取邮件日志列表
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<EmailLogView>> GetEmailLogList(EmailLogQuery inQuery)
public async Task<PageOutput<EmailLogView>> GetEmailLogList(EmailLogQuery inDto)
{
var emailFromEmail = await _trialRepository.Where(x=>x.Id==inDto.TrialId).Select(x=>x.EmailFromEmail).FirstOrDefaultAsync();
if (emailFromEmail.IsNullOrEmpty())
{
emailFromEmail = _systemEmailConfig.FromEmail;
}
var emailLogQueryable = _emailLogRepository
.Where(x=>x.SenderAddress== emailFromEmail)
.WhereIf(inDto.EmailStartDate.HasValue, x => x.EmailDate >= inDto.EmailStartDate.Value)
.WhereIf(inDto.EmailEndDate.HasValue, x => x.EmailDate <= inDto.EmailEndDate.Value)
.WhereIf(inDto.EmailStateEnum.HasValue, x => x.EmailStateEnum == inDto.EmailStateEnum.Value)
.WhereIf(inDto.CcRecipientName.IsNotNullOrEmpty(),x=>x.EmailRecipientLogList.Any(x=>x.RecipientTypeEnum==RecipientType.Cc&&x.RecipientName.Contains(inDto.CcRecipientName)))
.WhereIf(inDto.ToRecipientName.IsNotNullOrEmpty(), x => x.EmailRecipientLogList.Any(x => x.RecipientTypeEnum == RecipientType.To && x.RecipientName.Contains(inDto.ToRecipientName)))
.ProjectTo<EmailLogView>(_mapper.ConfigurationProvider);
var defalutSortArray = new string[] { nameof(EmailLogView.EmailDate) + " desc" };
var pageList = await emailLogQueryable.ToPagedListAsync(inDto, defalutSortArray);
return pageList;
}
/// <summary>
/// 获取单条邮件日志详情
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<GetEmailInfoOutDto> GetEmailInfo(GetEmailInfoInDto inDto)
{
PageOutput<EmailLogView> pageOutput = new PageOutput<EmailLogView>();
var emailInfo=await _emailLogRepository
.Where(x => x.Id == inDto.Id).Include(x=>x.EmailRecipientLogList)
.ProjectTo<GetEmailInfoOutDto>(_mapper.ConfigurationProvider).AsNoTracking()
.FirstNotNullAsync();
switch (inQuery.EmailStateEnum)
if (emailInfo.UniqueId.IsNotNullOrEmpty())
{
case EmailState.Success:
using (var client = new ImapClient())
{
try
@ -53,41 +98,52 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
var sentFolder = client.GetFolder("已发送");
sentFolder.Open(FolderAccess.ReadOnly);
// 构建搜索查询条件
var searchQuery = BuildSearchQuery(inQuery);
var orderBy = new[] { OrderBy.ReverseDate };
// 搜索符合条件的邮件UID
var uid = new UniqueId(uint.Parse(emailInfo.UniqueId));
var message = sentFolder.GetMessage(uid);
emailInfo.Content = message.HtmlBody ?? string.Empty;
if (client.Capabilities.HasFlag(ImapCapabilities.Sort))
if (emailInfo.AttachmentList.Count == 0)
{
Console.WriteLine("服务器支持 SORT 扩展");
}
else
List< EmaliAttachmentInfo > attachmentInfos = new List<EmaliAttachmentInfo>();
foreach (var att in message.Attachments)
{
Console.WriteLine("服务器不支持 SORT需本地排序");
EmaliAttachmentInfo emaliAttachmentInfo = new EmaliAttachmentInfo();
emaliAttachmentInfo.AttachmentName = att.ContentDisposition?.FileName ?? att.ContentType.Name ?? "unknown";
// 2. 解码后的流直接上传,不落盘
if (att is MimePart part)
{
// 重要:每次上传新建一个独立流,否则迭代过程中流位置会乱
await using var decodeStream = new MemoryStream();
await part.Content.DecodeToAsync(decodeStream);
decodeStream.Position = 0;
emaliAttachmentInfo.AttachmentPath = await oSSService.UploadToOSSAsync(
fileStream: decodeStream,
oosFolderPath: $"EmailAttachment/{emailInfo.Id}", // OSS 虚拟目录
fileRealName: emaliAttachmentInfo.AttachmentName,
isFileNameAddGuid: true); // 让方法自己在文件名前加 Guid
attachmentInfos.Add(emaliAttachmentInfo);
}
}
//var uids = sentFolder.Sort(searchQuery, orderBy).Skip((inQuery.PageIndex - 1) * inQuery.PageSize).Take(inQuery.PageSize).ToList();
List<EmailAttachmentLog> emailAttachmentLog = attachmentInfos.Select(x => new EmailAttachmentLog()
{
EmailLogId = emailInfo.Id.Value,
AttachmentName = x.AttachmentName,
AttachmentPath = x.AttachmentPath,
}).ToList();
var uids = sentFolder.Search(searchQuery).Skip((inQuery.PageIndex - 1) * inQuery.PageSize).Take(inQuery.PageSize).ToList();
await _emailAttachmentLogRepository.AddRangeAsync(emailAttachmentLog);
await _emailAttachmentLogRepository.SaveChangesAsync();
// 获取邮件并排序(按时间倒序)
var emailList = GetEmailsWithSorting(sentFolder, uids);
emailInfo.AttachmentList = attachmentInfos;
}
// 应用内存中的过滤条件对于无法通过IMAP搜索的条件
//var filteredEmails = ApplyMemoryFilters(emailList, inQuery);
pageOutput.TotalCount = sentFolder.Search(searchQuery).Count();
pageOutput.PageIndex = inQuery.PageIndex;
pageOutput.PageSize = inQuery.PageSize;
pageOutput.CurrentPageData = emailList;
sentFolder.Close();
}
@ -99,26 +155,192 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
client.Disconnect(true);
}
}
return pageOutput;
case EmailState.Error:
var emailLogQueryable = _emailLogRepository
.ProjectTo<EmailLogView>(_mapper.ConfigurationProvider);
var pageList = await emailLogQueryable.ToPagedListAsync(inQuery);
return pageList;
}
return pageOutput;
//var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", realFileName);
return emailInfo;
}
/// <summary>
/// 重发邮件
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> ResendEmail(ResendEmailInDto inDto)
{
var emailInfo = await _emailLogRepository
.Where(x => x.Id == inDto.Id)
.ProjectTo<GetEmailInfoOutDto>(_mapper.ConfigurationProvider)
.FirstNotNullAsync();
if (emailInfo.UniqueId.IsNotNullOrEmpty())
{
using (var client = new ImapClient())
{
try
{
client.Connect(_systemEmailConfig.Imap, 993, SecureSocketOptions.SslOnConnect);
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
var sentFolder = client.GetFolder("已发送");
sentFolder.Open(FolderAccess.ReadOnly);
var uid = new UniqueId(uint.Parse(emailInfo.UniqueId));
var message = sentFolder.GetMessage(uid);
emailInfo.Content = message.HtmlBody ?? string.Empty;
sentFolder.Close();
}
catch (Exception ex)
{
}
finally
{
client.Disconnect(true);
}
}
}
var messageToSend = new MimeMessage();
// 发件地址
messageToSend.From.Add(new MailboxAddress(emailInfo.SenderName, emailInfo.SenderAddress));
foreach (var item in emailInfo.RecipientList.Where(x => x.RecipientTypeEnum == RecipientType.To))
{
messageToSend.To.Add(new MailboxAddress(item.RecipientName, item.RecipientAddress));
}
foreach (var item in emailInfo.RecipientList.Where(x => x.RecipientTypeEnum == RecipientType.Cc))
{
messageToSend.Cc.Add(new MailboxAddress(item.RecipientName, item.RecipientAddress));
}
messageToSend.Subject = emailInfo.EmailSubject;
var builder = new BodyBuilder();
builder.HtmlBody = emailInfo.Content;
messageToSend.Body = builder.ToMessageBody();
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
return ResponseOutput.Ok();
}
/// <summary>
/// 同步邮件
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> SynchronizationEmail()
{
var maxTime=await _emailLogRepository.MaxAsync(t => t.EmailDate);
List<EmailLog> emailList = new List<EmailLog>();
List<EmailRecipientLog> EmailRecipientLogList = new List<EmailRecipientLog>();
using (var client = new ImapClient())
{
try
{
client.Connect(_systemEmailConfig.Imap, 993, SecureSocketOptions.SslOnConnect);
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
var sentFolder = client.GetFolder("已发送");
sentFolder.Open(FolderAccess.ReadOnly);
var startDate = maxTime ?? DateTime.MinValue;
var searchQuery = SearchQuery.All.And(SearchQuery.DeliveredAfter(startDate));
var uids = sentFolder.Search(searchQuery).ToList();
foreach (var uid in uids)
{
try
{
//var message = sentFolder.GetMessage(uid);
// var emailView = ConvertToEmailLogView(uid, message);
var message = sentFolder.GetMessage(uid);
var emaillog = new EmailLog
{
Id=NewId.NextGuid(),
UniqueId = uid.ToString(),
MessageId = message.MessageId ?? string.Empty,
EmailSubject = message.Subject ?? string.Empty,
EmailDate = message.Date.UtcDateTime,
EmailStateEnum = EmailState.Success,
};
var fromMailbox = message.From.Mailboxes.FirstOrDefault();
if (fromMailbox != null)
{
emaillog.SenderAddress = fromMailbox.Address;
emaillog.SenderName = fromMailbox.Name ?? string.Empty;
}
List<EmailRecipientLog> recipientLogs= new List<EmailRecipientLog>();
int sort = 0;
message.To.Mailboxes.ForEach(x =>
{
recipientLogs.Add(new EmailRecipientLog()
{
RecipientName = x.Name ?? string.Empty,
RecipientAddress = x.Address,
EmailLogId= emaillog.Id,
RecipientTypeEnum = RecipientType.To,
Sort= sort++,
});
});
sort = 0;
message.Cc.Mailboxes.ForEach(x =>
{
recipientLogs.Add(new EmailRecipientLog()
{
RecipientName = x.Name ?? string.Empty,
RecipientAddress = x.Address,
EmailLogId = emaillog.Id,
RecipientTypeEnum = RecipientType.Cc,
Sort = sort++,
});
});
emailList.Add(emaillog);
EmailRecipientLogList.AddRange(recipientLogs);
}
catch (Exception ex)
{
Console.WriteLine($"处理邮件 {uid} 失败: {ex.Message}");
}
}
sentFolder.Close();
}
catch (Exception ex)
{
}
finally
{
client.Disconnect(true);
}
await _emailLogRepository.AddRangeAsync(emailList);
await _emailRecipientLogRepository.AddRangeAsync(EmailRecipientLogList);
await _emailLogRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
}
// 取skip的值
public int CalcReverseSkip(int pageIndex, int pageSize, int totalCount)
{
int lastPageFullSkip = totalCount / pageSize * pageSize; // 最后一页“整页”起点
int skip = lastPageFullSkip - pageIndex * pageSize; // 倒着减
return Math.Max(skip, 0); // 防止负值
}
/// <summary>
@ -229,19 +451,19 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
emailView.SenderName = fromMailbox.Name ?? string.Empty;
}
// 处理收件人
emailView.ToRecipients = message.To.Mailboxes.Select(address => new EmaliSendInfo
{
Name = address.Name ?? string.Empty,
Address = address.Address
}).ToList();
//// 处理收件人
//emailView.ToRecipients = message.To.Mailboxes.Select(address => new EmaliSendInfo
//{
// Name = address.Name ?? string.Empty,
// Address = address.Address
//}).ToList();
// 处理抄送人
emailView.CcRecipients = message.Cc.Mailboxes.Select(address => new EmaliSendInfo
{
Name = address.Name ?? string.Empty,
Address = address.Address
}).ToList();
//// 处理抄送人
//emailView.CcRecipients = message.Cc.Mailboxes.Select(address => new EmaliSendInfo
//{
// Name = address.Name ?? string.Empty,
// Address = address.Address
//}).ToList();
//// 处理密送人
//emailView.BccRecipients = message.Bcc.Mailboxes.Select(address => new EmaliSendInfo

View File

@ -12,8 +12,16 @@ namespace IRaCIS.Core.Application.Service
public CommonConfig()
{
// 在此处拷贝automapper 映射
CreateMap<EmailAttachmentLog, EmaliAttachmentInfo>();
CreateMap<EmailRecipientLog, EmailRecipientLogView>();
CreateMap<EmailLog, EmailLogView>()
.ForMember(t => t.RecipientList, u => u.MapFrom(c => c.EmailRecipientLogList))
.ForMember(t => t.AttachmentList, u => u.MapFrom(c => c.AttachmentList));
CreateMap<EmailLog, GetEmailInfoOutDto>()
.ForMember(t => t.RecipientList, u => u.MapFrom(c => c.EmailRecipientLogList))
.ForMember(t => t.AttachmentList, u => u.MapFrom(c => c.AttachmentList));
CreateMap<EmailLog, EmailLogView>();
CreateMap<EmailLog, EmailLogAddOrEdit>().ReverseMap();
CreateMap<FrontAuditConfig, FrontAuditConfigAddOrEdit>().ReverseMap();

View File

@ -1965,6 +1965,7 @@ namespace IRaCIS.Core.Application.Image.QA
SubjectVisitId = dbSubjectVisit.Id,
ModuleName = $"G-{dbSubjectVisit.VisitName}",
ModuleType = ModuleTypeEnum.Global,
ReadModuleAddTypeEnum= dbSubjectVisit.PDState == PDStateEnum.PDProgress? ReadModuleAddType.PDConfirmation : ReadModuleAddType.FinalVisit,
IsUrgent = dbSubjectVisit.IsUrgent,
TrialId = dbSubjectVisit.TrialId,
SubjectId = dbSubjectVisit.SubjectId

View File

@ -43,6 +43,87 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
}
public class GetReadModulePageListInDto : PageInput
{
public Guid TrialId { get; set; }
public Guid TrialReadingCriterionId { get; set; }
/// <summary>
/// 阅片期名称
/// </summary>
public string ModuleName { get; set; } = string.Empty;
public string SubjectCode { get; set; }
public string VisitName { get; set; }
public Guid? TrialSiteId { get; set; }
/// <summary>
/// 阅片配置的类型
/// </summary>
public ReadingSetType? ReadingSetType { get; set; }
public ReadModuleAddType? ReadModuleAddTypeEnum { get; set; }
}
public class GetReadModulePageListOutDto
{
public Guid Id { get; set; }
/// <summary>
/// 阅片期类型
/// </summary>
public ReadingSetType ReadingSetType { get; set; }
/// <summary>
/// 阅片期名称
/// </summary>
public string ModuleName { get; set; } = string.Empty;
/// <summary>
/// 中心编号
/// </summary>
public string SiteCode { get; set; }
/// <summary>
/// 受试者编号
/// </summary>
public string SubjectCode { get; set; }
/// <summary>
/// 访视名称
/// </summary>
public string VisitName { get; set; } = string.Empty;
/// <summary>
/// 最晚拍片日期
/// </summary>
public DateTime? LatestScanDate { get; set; }
/// <summary>
/// 来源
/// </summary>
public ReadModuleAddType ReadModuleAddTypeEnum { get; set; } = ReadModuleAddType.Normal;
/// <summary>
/// 是否生成任务
/// </summary>
public bool IsGenerateTask { get; set; }
/// <summary>
/// 生成任务时间
/// </summary>
public DateTime? GenerateTaskTime { get; set; }
}
public class GetSubjectReadVisitsOutDto
{
public Guid SubjectVisitId { get; set; }

View File

@ -79,8 +79,73 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid ReadingPeriodSetId { get; set; }
}
public class IsChangeReadingPlanInDto
{
public Guid? Id { get; set; }
/// <summary>
/// 阅片范围
/// </summary>
public ReadingScopeEnum ReadingScope { get; set; }
/// <summary>
/// 中心ID
/// </summary>
public List<Guid> SiteIds { get; set; } = new List<Guid>();
/// <summary>
/// 项目ID
/// </summary>
public Guid TrialId { get; set; }
/// <summary>
/// 截止日期
/// </summary>
public DateTime? ExpirationDate { get; set; }
/// <summary>
/// 截止访视
/// </summary>
public decimal? ExpirationVisitNum { get; set; }
/// <summary>
/// 访视计划ID
/// </summary>
public Guid? VisitStageId { get; set; }
/// <summary>
/// 阅片期名称
/// </summary>
public string ReadingPeriodName { get; set; }
/// <summary>
/// 类型
/// </summary>
public ReadingSetType ReadingSetType { get; set; }
public Guid? TrialReadingCriterionId { get; set; }
}
public class AddReadingPlanAndGenerateReadModuleInDto
{
public Guid ReadingPeriodSetId { get; set; }
public List<Guid> SubjectVisitIdList { get; set; } = new List<Guid>();
}
public class SetBatchAddOrRemoveReadingPlanInDto
{
public List<Guid> SubjectVisitIdList { get; set; } = new List<Guid>();
public Guid Id { get; set; }
}
public class PreviewTheReadingListInDto : PageInput
{
public Guid? ReadingPeriodSetId { get; set; }
/// <summary>
/// 阅片范围
/// </summary>
@ -123,7 +188,25 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid? TrialReadingCriterionId { get; set; }
/// <summary>
/// 中心Id
/// </summary>
public Guid? SiteId { get; set; }
/// <summary>
/// 受试者Code
/// </summary>
public string SubjectCode { get; set; }=string.Empty;
/// <summary>
/// 是否加入阅片计划
/// </summary>
public bool? IsJoin { get; set; }
/// <summary>
/// 是否生成阅片计划
/// </summary>
public bool? IsGenerate { get; set; }
}
@ -185,6 +268,26 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public DateTime? EffectOfTime { get; set; }
/// <summary>
/// 是否加入阅片计划
/// </summary>
public bool? IsJoin { get; set; }
/// <summary>
/// 是否生成阅片计划
/// </summary>
public bool? IsGenerate { get; set; }
/// <summary>
/// 是否生成任务
/// </summary>
public bool? IsGenerateTask { get; set; }
/// <summary>
/// 生成时间
/// </summary>
public DateTime? GeneratedTime { get; set; }
}
public class ReadingPeriodSetView
@ -313,6 +416,33 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public ReadingPeriodStatus IsTakeEffect { get; set; }
}
public class AddReadModuleInDto
{
public Guid TrialReadingCriterionId { get; set; }
public Guid ReadingPeriodSetId { get; set; }
public Guid TrialId { get; set; }
public string ReadingPeriodName { get; set; }
public ReadingSetType ReadingSetType { get; set; }
public List<AddReadModuleVisitInfo> VisitInfoList { get; set; } = new List<AddReadModuleVisitInfo>();
}
public class AddReadModuleVisitInfo
{
public Guid SubjectId { get; set; }
public Guid? ReadingPeriodPlanId { get; set; }
public bool IsUrgent { get; set; }
public Guid SubjectVisitId { get; set; }
}
public class ReadingPeriodSetQuery : PageInput
{

View File

@ -30,6 +30,11 @@ namespace IRaCIS.Core.Application.ViewModel
public class SetAutoCutNextTaskInDto
{
public bool AutoCutNextTask { get; set; }
/// <summary>
/// 是否双屏
/// </summary>
public bool IsDoubleScreen { get; set; } = false;
}
///<summary> UserWLTemplateAddOrEdit 列表查询参数模型</summary>

View File

@ -3736,7 +3736,7 @@ namespace IRaCIS.Core.Application.Service
task.ReadingVersionEnum = criterionInfo.ReadingVersionEnum;
task.ReadingToolList = criterionInfo.ReadingToolList;
task.IsExistUnprocessedFeedback = await _userFeedBackRepository.AnyAsync(x => x.VisitTaskId == task.VisitTaskId && x.State == 0);
task.IsViewStudyPart= visitTaskInfo.IsViewStudyPart;
task.IsViewStudyPart= visitTaskInfo.ReadingCategory==ReadingCategory.Judge|| visitTaskInfo.IsViewStudyPart;
// 添加默认答案
if (inDto.VisitTaskId == null && visitTaskInfo.ReadingTaskState != ReadingTaskState.HaveSigned)
{

View File

@ -826,6 +826,42 @@ namespace IRaCIS.Core.Application.Service
//}
/// <summary>
/// 获取读片模块分页列表 //加了标准参数
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<GetReadModulePageListOutDto>> GetReadModulePageList(GetReadModulePageListInDto inDto)
{
var readModuleQueryable = _readModuleRepository
.Where(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId)
.WhereIf(inDto.ReadModuleAddTypeEnum != null, x => x.ReadModuleAddTypeEnum == inDto.ReadModuleAddTypeEnum)
.WhereIf(inDto.ReadingSetType != null, x => x.ReadingSetType == inDto.ReadingSetType)
.WhereIf(inDto.SubjectCode.IsNotNullOrEmpty(), x => x.Subject.Code.Contains(inDto.SubjectCode))
.WhereIf(inDto.VisitName.IsNotNullOrEmpty(), x => x.SubjectVisit.VisitName.Contains(inDto.VisitName))
.WhereIf(inDto.ModuleName.IsNotNullOrEmpty(), x => x.ModuleName.Contains(inDto.ModuleName))
.WhereIf(inDto.TrialSiteId != null, x => x.Subject.TrialSiteId == inDto.TrialSiteId)
.ProjectTo<GetReadModulePageListOutDto>(_mapper.ConfigurationProvider);
var pageList = await readModuleQueryable.ToPagedListAsync(inDto);
var ids = pageList.CurrentPageData.Select(x => x.Id as Guid?).ToList();
var taskList=await _visitTaskRepository.Where(x => ids.Contains(x.SouceReadModuleId)).ToListAsync();
pageList.CurrentPageData.ForEach(x =>
{
x.IsGenerateTask= taskList.Any(t => t.SouceReadModuleId == x.Id);
x.GenerateTaskTime= taskList.Any(t => t.SouceReadModuleId == x.Id)? taskList.Where(t => t.SouceReadModuleId == x.Id).OrderByDescending(t => t.CreateTime).Select(t => t.CreateTime).FirstOrDefault():null;
});
return pageList;
}
/// <summary>
/// 获取单条详情信息
@ -962,6 +998,7 @@ namespace IRaCIS.Core.Application.Service
SubjectId = dto.SubjectId,
ModuleType = moduleType,
IsUrgent = visit.IsUrgent,
ReadModuleAddTypeEnum=ReadModuleAddType.Normal,
ModuleName = dto.Name,
SubjectVisitId = visit.Id,
ReadingSetType = dto.ReadingSetType,

View File

@ -1,11 +1,14 @@
using IRaCIS.Core.Application.Contracts;
using DocumentFormat.OpenXml.Drawing;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using Microsoft.AspNetCore.Mvc;
using NPOI.Util;
namespace IRaCIS.Core.Application.Service
{
@ -74,6 +77,18 @@ namespace IRaCIS.Core.Application.Service
else
{
var entity = (await _readingPeriodSetRepository.Where(t => t.Id == addOrEditReadingPeriodSet.Id, true).Include(t => t.ReadingPeriodSites).Include(x => x.ReadingPeriodPlanList).FirstOrDefaultAsync()).IfNullThrowException();
// 已生效的时候就不可能修改 只能是添加计划和生成模块
if (entity.IsTakeEffect == ReadingPeriodStatus.TakeEffect)
{
await AddReadingPlanAndGenerateReadModule(new AddReadingPlanAndGenerateReadModuleInDto()
{
ReadingPeriodSetId = addOrEditReadingPeriodSet.Id.Value,
SubjectVisitIdList = addOrEditReadingPeriodSet.SubjectVisitIds
});
}
else
{
_mapper.Map(addOrEditReadingPeriodSet, entity);
entity.ReadingPeriodSites = addOrEditReadingPeriodSet.SiteIds.Select(x => new ReadingPeriodSite()
@ -83,13 +98,46 @@ namespace IRaCIS.Core.Application.Service
TrialSiteId = x,
}).ToList();
// 修改了就是重新生成计划
if (await IsChangeReadingPlan(new IsChangeReadingPlanInDto()
{
Id = addOrEditReadingPeriodSet.Id,
ExpirationDate = addOrEditReadingPeriodSet.ExpirationDate,
ReadingScope = addOrEditReadingPeriodSet.ReadingScope.Value,
TrialId = addOrEditReadingPeriodSet.TrialId,
ExpirationVisitNum = addOrEditReadingPeriodSet.ExpirationVisitNum,
VisitStageId = addOrEditReadingPeriodSet.VisitStageId,
ReadingSetType = addOrEditReadingPeriodSet.ReadingSetType,
TrialReadingCriterionId = addOrEditReadingPeriodSet.TrialReadingCriterionId,
SiteIds = addOrEditReadingPeriodSet.SiteIds,
}))
{
entity.ReadingPeriodPlanList = addOrEditReadingPeriodSet.SubjectVisitIds.Select(x => new ReadingPeriodPlan
{
ReadingPeriodSetId = entity.Id,
SubjectVisitId = x,
}).ToList();
}
else
{
var existsVisitIds = await _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == addOrEditReadingPeriodSet.Id).Select(x => x.SubjectVisitId).ToListAsync();
var needaddIds = addOrEditReadingPeriodSet.SubjectVisitIds.Where(x => !existsVisitIds.Contains(x)).ToList();
entity.ReadingPeriodPlanList.AddRange(needaddIds.Select(x => new ReadingPeriodPlan()
{
ReadingPeriodSetId = entity.Id,
SubjectVisitId = x,
}));
}
var success = await _readingPeriodSetRepository.SaveChangesAsync();
}
return ResponseOutput.Ok(entity.Id);
}
@ -97,6 +145,8 @@ namespace IRaCIS.Core.Application.Service
/// <summary>
/// 删除
/// </summary>
@ -145,27 +195,112 @@ namespace IRaCIS.Core.Application.Service
await AddReadModule(new AddReadModuleInDto()
{
ReadingPeriodName = readingPeriodSet.ReadingPeriodName,
ReadingSetType = readingPeriodSet.ReadingSetType,
TrialId = readingPeriodSet.TrialId,
ReadingPeriodSetId= readingPeriodSet.Id,
TrialReadingCriterionId = readingPeriodSet.TrialReadingCriterionId,
VisitInfoList = plans.Select(x => new AddReadModuleVisitInfo()
{
SubjectId = x.SubjectVisit.SubjectId,
SubjectVisitId = x.SubjectVisitId,
ReadingPeriodPlanId=x.Id,
IsUrgent = false
}).ToList()
});
}
else
{
List<Guid> readModuleIds = await _readModuleRepository.Where(x => x.ReadingPeriodSetId == indto.Id).Select(x => x.Id).ToListAsync();
if (await _visitTaskRepository.AnyAsync(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && readModuleIds.Contains(x.SouceReadModuleId ?? default(Guid))
&& x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId
&& x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect))
{
//---当前标准阅片已生成任务并且阅片完成,撤销失败。
throw new BusinessValidationFailedException(_localizer["ReadingPeriodSet_TaskCompletedCannotRevoke"]);
}
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && readModuleIds.Contains(x.SouceReadModuleId ?? default(Guid)), x => new VisitTask()
{
TaskState = TaskState.Adbandon
});
await _readModuleRepository.UpdatePartialFromQueryAsync(x => x.ReadingPeriodSetId == indto.Id, x => new ReadModule()
{
IsDeleted = true
});
await _readingPeriodPlanRepository.UpdatePartialFromQueryAsync(x => x.ReadingPeriodSetId == indto.Id, x => new ReadingPeriodPlan()
{
IsGenerate = false
});
}
var readQuery = await _readingPeriodSetRepository.UpdatePartialFromQueryAsync(indto.Id, x => new ReadingPeriodSet()
{
IsTakeEffect = indto.IsTakeEffect,
EffectOfTime = indto.IsTakeEffect == ReadingPeriodStatus.TakeEffect ? DateTime.Now : null,
});
if (indto.IsTakeEffect == ReadingPeriodStatus.TakeEffect)
{
await _readingPeriodPlanRepository.UpdatePartialFromQueryAsync(x => x.ReadingPeriodSetId == indto.Id, x => new ReadingPeriodPlan()
{
IsGenerate = true,
GeneratedTime = DateTime.Now
});
}
var result = await _readingPeriodSetRepository.SaveChangesAsync();
return ResponseOutput.Result(result);
}
/// <summary>
/// 生效或者新增访视的时候添加阅片期
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task AddReadModule(AddReadModuleInDto inDto)
{
List<ReadModule> readModules = new List<ReadModule>();
foreach (var item in plans)
foreach (var item in inDto.VisitInfoList)
{
readModules.Add(new ReadModule()
{
Id = NewId.NextGuid(),
SubjectId = item.SubjectVisit.SubjectId,
ModuleType = item.ReadingPeriodSet.ReadingSetType == ReadingSetType.ImageReading ? ModuleTypeEnum.Global : ModuleTypeEnum.Oncology,
IsUrgent = item.SubjectVisit.IsUrgent,
ModuleName = item.ReadingPeriodSet.ReadingPeriodName,
SubjectId = item.SubjectId,
ModuleType = inDto.ReadingSetType == ReadingSetType.ImageReading ? ModuleTypeEnum.Global : ModuleTypeEnum.Oncology,
IsUrgent = item.IsUrgent,
ReadModuleAddTypeEnum = ReadModuleAddType.ReadingPlan,
ModuleName = inDto.ReadingPeriodName,
SubjectVisitId = item.SubjectVisitId,
ReadingSetType = item.ReadingPeriodSet.ReadingSetType,
ReadingPeriodSetId = item.ReadingPeriodSet.Id,
ReadingSetType = inDto.ReadingSetType,
ReadingPeriodSetId = inDto.ReadingPeriodSetId,
ReadingPeriodPlanId= item.ReadingPeriodPlanId,
ReadingStatus = ReadingStatusEnum.TaskAllocate,
TrialId = readingPeriodSet.TrialId,
TrialId = inDto.TrialId,
//VisitNum = item.SubjectVisit.VisitNum,
//增加标准
TrialReadingCriterionId = readingPeriodSet.TrialReadingCriterionId
TrialReadingCriterionId = inDto.TrialReadingCriterionId
});
};
}
;
await _readModuleRepository.AddRangeAsync(readModules);
@ -173,13 +308,13 @@ namespace IRaCIS.Core.Application.Service
// 判断是否要添加肿瘤学或者全局阅片任务
var subjectVisitIds = readModules.Select(x => x.SubjectVisitId).ToList();
switch (readingPeriodSet.ReadingSetType)
switch (inDto.ReadingSetType)
{
case ReadingSetType.ImageReading:
//增加标准
var taskInfoList = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && subjectVisitIds.Contains(x.SourceSubjectVisitId ?? default(Guid)) &&
var taskInfoList = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId && subjectVisitIds.Contains(x.SourceSubjectVisitId ?? default(Guid)) &&
x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId &&
x.TrialReadingCriterionId == inDto.TrialReadingCriterionId &&
x.TaskState == TaskState.Effect && x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate).ToListAsync();
foreach (var item in taskInfoList)
@ -221,17 +356,17 @@ namespace IRaCIS.Core.Application.Service
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == readingPeriodSet.TrialReadingCriterionId).Select(x => new
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Select(x => new
{
x.ReadingType,
}).FirstNotNullAsync();
//增加标准
var globalModuleIds = await _readModuleRepository.Where(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && subjectVisitIds.Contains(x.SubjectVisitId) && x.ModuleType == ModuleTypeEnum.Global).Select(x => x.Id).ToListAsync();
var globalModuleIds = await _readModuleRepository.Where(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId && subjectVisitIds.Contains(x.SubjectVisitId) && x.ModuleType == ModuleTypeEnum.Global).Select(x => x.Id).ToListAsync();
//增加标准
var globalTaskInfo = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && globalModuleIds.Contains(x.SouceReadModuleId ?? default(Guid))
var globalTaskInfo = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId && globalModuleIds.Contains(x.SouceReadModuleId ?? default(Guid))
&& x.TaskState == TaskState.Effect && x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate).GroupBy(x => new { x.SouceReadModuleId }).Select(x =>
new
@ -258,7 +393,7 @@ namespace IRaCIS.Core.Application.Service
{
OriginalVisitId = item.TaskId,
ReadingCategory = GenerateTaskCategory.Oncology,
TrialId = readingPeriodSet.TrialId,
TrialId = inDto.TrialId,
ReadingGenerataTaskList = new List<ReadingGenerataTaskDTO>() {
new ReadingGenerataTaskDTO()
{
@ -281,50 +416,7 @@ namespace IRaCIS.Core.Application.Service
break;
}
}
else
{
List<Guid> readModuleIds = await _readModuleRepository.Where(x => x.ReadingPeriodSetId == indto.Id).Select(x => x.Id).ToListAsync();
if (await _visitTaskRepository.AnyAsync(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && readModuleIds.Contains(x.SouceReadModuleId ?? default(Guid))
&& x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId
&& x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect))
{
//---当前标准阅片已生成任务并且阅片完成,撤销失败。
throw new BusinessValidationFailedException(_localizer["ReadingPeriodSet_TaskCompletedCannotRevoke"]);
}
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && readModuleIds.Contains(x.SouceReadModuleId ?? default(Guid)), x => new VisitTask()
{
TaskState = TaskState.Adbandon
});
await _readModuleRepository.UpdatePartialFromQueryAsync(x => x.ReadingPeriodSetId == indto.Id, x => new ReadModule()
{
IsDeleted = true
});
}
var readQuery = await _readingPeriodSetRepository.UpdatePartialFromQueryAsync(indto.Id, x => new ReadingPeriodSet()
{
IsTakeEffect = indto.IsTakeEffect,
EffectOfTime = indto.IsTakeEffect == ReadingPeriodStatus.TakeEffect ? DateTime.Now : null,
});
var result = await _readingPeriodSetRepository.SaveChangesAsync();
return ResponseOutput.Result(result);
}
#endregion
@ -466,29 +558,198 @@ namespace IRaCIS.Core.Application.Service
return result;
}
/// <summary>
/// 判断是否修改了阅片期计划的参数
/// </summary>
/// <returns></returns>
public async Task<bool> IsChangeReadingPlan(IsChangeReadingPlanInDto inDto)
{
if (inDto.Id == null)
{
return false;
}
else
{
var periodSet = await _readingPeriodSetRepository.Where(x => x.Id == inDto.Id).Include(x => x.ReadingPeriodSites).FirstNotNullAsync();
var notChange = inDto.ExpirationDate == periodSet.ExpirationDate &&
inDto.ReadingScope == periodSet.ReadingScope &&
inDto.TrialId == periodSet.TrialId &&
inDto.ExpirationDate == periodSet.ExpirationDate &&
inDto.ExpirationVisitNum == periodSet.ExpirationVisitNum &&
inDto.VisitStageId == inDto.VisitStageId &&
inDto.ReadingSetType == inDto.ReadingSetType &&
inDto.TrialReadingCriterionId == inDto.TrialReadingCriterionId &&
inDto.SiteIds.Count == periodSet.ReadingPeriodSites.Count(x => inDto.SiteIds.Contains(x.TrialSiteId));
return !notChange;
}
}
/// <summary>
/// 添加阅片计划并生成阅片期(在阅片期已经生效的情况下添加)
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<IResponseOutput> AddReadingPlanAndGenerateReadModule(AddReadingPlanAndGenerateReadModuleInDto inDto)
{
var readingPeriodSet = await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).FirstNotNullAsync();
List<ReadingPeriodPlan> plans = inDto.SubjectVisitIdList.Select(x => new ReadingPeriodPlan()
{
Id = NewId.NextGuid(),
SubjectVisitId = x,
ReadingPeriodSetId = inDto.ReadingPeriodSetId,
IsGenerate=true,
GeneratedTime=DateTime.Now
}).ToList();
await _readingPeriodPlanRepository.AddRangeAsync(plans);
await _readingPeriodPlanRepository.SaveChangesAsync();
var subejctVisits = await _subjectVisitRepository.Where(x => inDto.SubjectVisitIdList.Contains(x.Id)).ToListAsync();
await AddReadModule(new AddReadModuleInDto()
{
ReadingPeriodName = readingPeriodSet.ReadingPeriodName,
ReadingSetType = readingPeriodSet.ReadingSetType,
TrialId = readingPeriodSet.TrialId,
ReadingPeriodSetId = readingPeriodSet.Id,
TrialReadingCriterionId = readingPeriodSet.TrialReadingCriterionId,
VisitInfoList = plans.Select(x => new AddReadModuleVisitInfo()
{
SubjectId = subejctVisits.Where(y=>y.Id==x.SubjectVisitId).Select(x=>x.SubjectId).FirstOrDefault(),
SubjectVisitId = x.Id,
ReadingPeriodPlanId= x.Id,
IsUrgent = subejctVisits.Where(y => y.Id == x.SubjectVisitId).Select(x => x.IsUrgent).FirstOrDefault(),
}).ToList()
});
return ResponseOutput.Ok();
}
/// <summary>
/// 移除阅片计划
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> SetBatchRemoveReadingPlan(SetBatchAddOrRemoveReadingPlanInDto inDto)
{
var planSet = await _readingPeriodSetRepository.Where(x => x.Id == inDto.Id).FirstNotNullAsync();
List<Guid> isGenerateTaskVisitIds = new List<Guid>();
List<ReadModule> readModules = new List<ReadModule>();
readModules = await _readModuleRepository.Where(x => x.ReadingPeriodSetId == inDto.Id).ToListAsync();
var readModuleIds = readModules.Select(x => x.Id).ToList();
var souceReadModuleIds = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == planSet.TrialReadingCriterionId && readModuleIds.Contains(x.SouceReadModuleId ?? default(Guid))).Select(x => x.SouceReadModuleId).ToListAsync();
isGenerateTaskVisitIds = await _readModuleRepository.Where(x => souceReadModuleIds.Contains(x.Id) && x.ReadingPeriodPlanId != null).Select(x => x.SubjectVisitId).ToListAsync();
inDto.SubjectVisitIdList= inDto.SubjectVisitIdList.Where(x => !isGenerateTaskVisitIds.Contains(x)).ToList();
var planIds= await _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == inDto.Id && inDto.SubjectVisitIdList.Contains(x.SubjectVisitId)).Select(x=>x.Id).ToListAsync();
var deletePlasIds= planIds.Select(x=>(Guid?)x).ToList();
await _readModuleRepository.DeleteFromQueryAsync(x => deletePlasIds.Contains(x.ReadingPeriodPlanId));
await _readingPeriodPlanRepository.DeleteFromQueryAsync(x => x.ReadingPeriodSetId == inDto.Id && inDto.SubjectVisitIdList.Contains(x.SubjectVisitId));
await _readingPeriodPlanRepository.SaveChangesAsync();
return ResponseOutput.Ok(true);
}
/// <summary>
/// 获取影像阅片的预览 // 需要清除之前已经选中的 (增加标准搜索,已修改)
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<PreviewTheReadingListOutDto>> GetPreviewTheReadingList(PreviewTheReadingListInDto inDto)
public async Task<(PageOutput<PreviewTheReadingListOutDto>,object)> GetPreviewTheReadingList(PreviewTheReadingListInDto inDto)
{
// 这里还需要获取到之前已经添加的
var isChangeReadingPlan = await IsChangeReadingPlan(new IsChangeReadingPlanInDto()
{
Id = inDto.ReadingPeriodSetId,
ExpirationDate = inDto.ExpirationDate,
ReadingScope = inDto.ReadingScope,
TrialId = inDto.TrialId,
ExpirationVisitNum = inDto.ExpirationVisitNum,
VisitStageId = inDto.VisitStageId,
ReadingSetType = inDto.ReadingSetType,
TrialReadingCriterionId = inDto.TrialReadingCriterionId,
SiteIds = inDto.SiteIds,
});
List<Guid> isChooseVisitIds = new List<Guid>();
List<Guid> IsGenerateVisitIds = new List<Guid>();
List<ReadingPeriodPlan> chooseVisitVisitList = new List<ReadingPeriodPlan>();
List<Guid> isGenerateTaskVisitIds = new List<Guid>();
List<ReadModule> readModules = new List<ReadModule>();
if (!isChangeReadingPlan)
{
if (inDto.ReadingPeriodSetId != null)
{
readModules = await _readModuleRepository.Where(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId).ToListAsync();
var readModuleIds= readModules.Select(x => x.Id).ToList();
var souceReadModuleIds = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId && readModuleIds.Contains(x.SouceReadModuleId ?? default(Guid))).Select(x=>x.SouceReadModuleId).ToListAsync();
isGenerateTaskVisitIds = await _readModuleRepository.Where(x => souceReadModuleIds.Contains(x.Id)&&x.ReadingPeriodPlanId!=null).Select(x=>x.SubjectVisitId).ToListAsync();
}
chooseVisitVisitList = await _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId).ToListAsync();
isChooseVisitIds= chooseVisitVisitList.Select(x => x.SubjectVisitId).ToList();
IsGenerateVisitIds= chooseVisitVisitList.Where(x => x.IsGenerate).Select(x => x.SubjectVisitId).ToList();
}
var isTakeEffect = await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Select(x => x.IsTakeEffect).FirstOrDefaultAsync();
var readModulequery = _readModuleRepository.AsQueryable();
// 当前项目 最晚拍片日期不为null 中心筛选
var visitQuery = _subjectVisitRepository.Where(x => x.TrialId == inDto.TrialId && x.LatestScanDate != null && !x.IsLostVisit)
.WhereIf(inDto.ReadingScope == ReadingScopeEnum.Site, x => inDto.SiteIds.Contains(x.TrialSiteId))
.Where(x => !x.IsBaseLine);// 排除基线
.WhereIf(inDto.ReadingScope == ReadingScopeEnum.Site, x => inDto.SiteIds.Contains(x.TrialSiteId));
//.Where(x => !x.IsBaseLine);// 排除基线
var chooseVisitQuery = _subjectVisitRepository.Where(x => isChooseVisitIds.Contains(x.Id));
visitQuery= visitQuery.Union(chooseVisitQuery);
// 已经存在的访视 需要排除
var existsBubjectVisitsQuery = _readModuleRepository.Where(y => y.ReadingSetType == inDto.ReadingSetType && y.TrialId == inDto.TrialId && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId).Select(x => x.SubjectVisitId);
visitQuery = visitQuery.Where(x => !existsBubjectVisitsQuery.Contains(x.Id))
visitQuery = visitQuery
.Where(x => !existsBubjectVisitsQuery.Contains(x.Id))
.WhereIf(inDto.ExpirationDate != null, x => x.LatestScanDate < inDto.ExpirationDate.Value.AddDays(1))
.WhereIf(inDto.ExpirationVisitNum != null, x => x.VisitNum == inDto.ExpirationVisitNum)
.WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0);
.WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0)
.WhereIf(inDto.SiteId != null,x=> x.Subject.TrialSiteId==inDto.SiteId)
.WhereIf(inDto.SubjectCode.IsNotNullOrEmpty(), x =>x.Subject.Code.Contains(inDto.SubjectCode))
.WhereIf(inDto.IsJoin != null && inDto.IsJoin.Value, x => isChooseVisitIds.Contains(x.Id))
.WhereIf(inDto.IsGenerate != null && inDto.IsGenerate.Value, x => IsGenerateVisitIds.Contains(x.Id))
.WhereIf(inDto.IsJoin != null && !inDto.IsJoin.Value, x => !isChooseVisitIds.Contains(x.Id))
.WhereIf(inDto.IsGenerate != null && !inDto.IsGenerate.Value, x => !IsGenerateVisitIds.Contains(x.Id));
//.Where(x => isChooseVisitIds.Contains(x.Id));
var subjectIdlist = await visitQuery.OrderBy(x => x.SubjectId).Select(x => x.SubjectId).Distinct().Skip((inDto.PageIndex - 1) * inDto.PageSize).Take(inDto.PageSize).ToListAsync();
@ -526,12 +787,18 @@ namespace IRaCIS.Core.Application.Service
SubjectCode = x.Subject.Code,
SubjectId = x.SubjectId,
SubjectVisitName = x.VisitName,
IsJoin= isChooseVisitIds.Contains(x.Id),
IsGenerate = IsGenerateVisitIds.Contains(x.Id),
IsGenerateTask = isGenerateTaskVisitIds.Contains(x.Id),
GeneratedTime = chooseVisitVisitList.Where(y=>y.SubjectVisitId==x.Id).Select(y=>y.GeneratedTime).FirstOrDefault(),
}).ToList(),
PageSize = inDto.PageSize,
PageIndex = inDto.PageIndex,
TotalCount = totalCount,
};
return result;
return (result,new {
NeedReminder=inDto.ReadingPeriodSetId == null,
});
}
#endregion

View File

@ -85,10 +85,22 @@ namespace IRaCIS.Core.Application.Service
public async Task<object> GetAutoCutNextTask()
{
return await _userRoleRepository.Where(x => x.Id == _userInfo.UserRoleId).Select(x => new
var result = await _userRoleRepository.Where(x => x.Id == _userInfo.UserRoleId).Select(x => new
{
AutoCutNextTask = x.AutoCutNextTask
}).FirstNotNullAsync();
AutoCutNextTask = x.AutoCutNextTask,
IsDoubleScreen = x.IsDoubleScreen,
}).FirstOrDefaultAsync();
if (result == null)
{
return new
{
AutoCutNextTask = false,
IsDoubleScreen = false,
};
}
return result;
}
@ -103,7 +115,8 @@ namespace IRaCIS.Core.Application.Service
await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.UserRoleId, x => new UserRole()
{
AutoCutNextTask = inDto.AutoCutNextTask
AutoCutNextTask = inDto.AutoCutNextTask,
IsDoubleScreen = inDto.IsDoubleScreen
});
await _userRoleRepository.SaveChangesAsync();

View File

@ -18,6 +18,12 @@ namespace IRaCIS.Core.Application.Service
//标准Id
List<Guid> CriterionIds = new List<Guid>();
CreateMap<ReadModule, GetReadModulePageListOutDto>()
.ForMember(d => d.SiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode))
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code))
.ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName))
.ForMember(d => d.LatestScanDate, u => u.MapFrom(s => s.SubjectVisit.LatestScanDate));
#region 临床问题
CreateMap<TrialClinicalQuestion, TrialClinicalQuestionDto>()
.ForMember(d => d.GroupName, opt => opt.MapFrom(src => src.GroupQuestin.QuestionName))

View File

@ -166,6 +166,7 @@ namespace IRaCIS.Core.Application.Triggers
//ReadingPeriodSetId = readingPeriodSet.Id,
Id = NewId.NextGuid(),
IsUrgent = subjectVisit.IsUrgent,
ReadModuleAddTypeEnum=ReadModuleAddType.FinalVisit,
SubjectVisitId = subjectVisitId,
ReadingStatus = ReadingStatusEnum.TaskAllocate,
SubjectId = subjectVisit.SubjectId,

View File

@ -44,6 +44,24 @@ namespace IRaCIS.Core.Domain.Share
}
/// <summary>
/// 收件人类型
/// </summary>
public enum RecipientType
{
/// <summary>
/// 收件人
/// </summary>
To = 0,
/// <summary>
/// 抄送人
/// </summary>
Cc = 1,
}
public enum GenerateTaskCategory
{
//访视

View File

@ -1711,6 +1711,33 @@ public enum SUVChangeVSBaseline
DiseaseProgression = 4
}
/// <summary>
/// 阅片期添加方式
/// </summary>
public enum ReadModuleAddType
{
/// <summary>
/// 普通添加
/// </summary>
Normal = 0,
/// <summary>
/// 阅片期计划
/// </summary>
ReadingPlan = 1,
/// <summary>
/// PD确认
/// </summary>
PDConfirmation = 2,
/// <summary>
/// 末次访视
/// </summary>
FinalVisit = 3,
}
/// <summary>
/// 模块枚举
/// </summary>

View File

@ -0,0 +1,30 @@
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("邮件附件日志")]
[Table("EmailAttachmentLog")]
public class EmailAttachmentLog : BaseFullAuditEntity
{
[JsonIgnore]
[ForeignKey("EmailLogId")]
public EmailLog EmailLog { get; set; }
/// <summary>
/// 邮件Id
/// </summary>
public Guid EmailLogId { get; set; }
/// <summary>
/// 附件名称
/// </summary>
public string AttachmentName { get; set; }
/// <summary>
/// 附件路径
/// </summary>
public string AttachmentPath { get; set; }
}

View File

@ -6,6 +6,18 @@ namespace IRaCIS.Core.Domain.Models;
[Table("EmailLog")]
public class EmailLog : BaseFullAuditEntity
{
/// <summary>
/// 收件人
/// </summary>
[JsonIgnore]
public List<EmailRecipientLog> EmailRecipientLogList { get; set; } = new List<EmailRecipientLog>();
/// <summary>
/// 附件
/// </summary>
[JsonIgnore]
public List<EmailAttachmentLog> AttachmentList { get; set; } = new List<EmailAttachmentLog>();
/// <summary>
/// 邮件Id
/// </summary>
@ -21,21 +33,6 @@ public class EmailLog : BaseFullAuditEntity
/// </summary>
public string EmailSubject { get; set; } = string.Empty;
/// <summary>
/// 收件人
/// </summary>
public List<EmaliSendInfo> ToRecipients { get; set; }
/// <summary>
/// 抄送人
/// </summary>
public List<EmaliSendInfo> CcRecipients { get; set; }
/// <summary>
/// 附件
/// </summary>
public List<string> Attachments { get; set; }
/// <summary>
/// 日期
/// </summary>
@ -69,10 +66,7 @@ public class EmailLog : BaseFullAuditEntity
}
public class EmaliSendInfo
{
public string Name { get; set; }
public string Address { get; set; }
}

View File

@ -0,0 +1,40 @@
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("邮件收件人")]
[Table("EmailRecipientLog")]
public class EmailRecipientLog : BaseFullAuditEntity
{
[JsonIgnore]
[ForeignKey("EmailLogId")]
public EmailLog EmailLog { get; set; }
/// <summary>
/// 邮件Id
/// </summary>
public Guid EmailLogId { get; set; }
/// <summary>
/// 收件人姓名
/// </summary>
public string RecipientName { get; set; }
/// <summary>
/// 收件人地址
/// </summary>
public string RecipientAddress { get; set; }
/// <summary>
/// 收件人类型
/// </summary>
public RecipientType RecipientTypeEnum { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
}

View File

@ -40,6 +40,11 @@ public class UserRole : BaseFullAuditEntity
[Comment("自动切换下一个任务")]
public bool AutoCutNextTask { get; set; }
/// <summary>
/// 是否双屏
/// </summary>
public bool IsDoubleScreen { get; set; } = false;
[Comment("医生生成账号后,会有值")]

View File

@ -54,6 +54,11 @@ public class ReadModule : BaseFullDeleteAuditEntity
[Comment("阅片计划ID")]
public Guid? ReadingPeriodSetId { get; set; }
/// <summary>
/// 阅片计划
/// </summary>
public Guid? ReadingPeriodPlanId { get; set; }
public Guid TrialId { get; set; }
public bool IsCRCConfirm { get; set; } = false;
@ -72,5 +77,11 @@ public class ReadModule : BaseFullDeleteAuditEntity
[Comment("阅片配置的类型")]
public ReadingSetType ReadingSetType { get; set; }
/// <summary>
/// 添加方式
/// </summary>
public ReadModuleAddType ReadModuleAddTypeEnum { get; set; } = ReadModuleAddType.Normal;
public ReadingStatusEnum ReadingStatus { get; set; } = ReadingStatusEnum.TaskAllocate;
}

View File

@ -19,4 +19,14 @@ public class ReadingPeriodPlan : BaseFullDeleteAuditEntity
[Comment("访视")]
public Guid SubjectVisitId { get; set; }
/// <summary>
/// 是否生成
/// </summary>
public bool IsGenerate { get; set; } = false;
/// <summary>
/// 生效时间
/// </summary>
public DateTime? GeneratedTime { get; set; }
}

View File

@ -95,20 +95,6 @@ public class IRaCISDBContext : DbContext
});
});
modelBuilder.Entity<EmailLog>(entity =>
{
entity.OwnsMany(x => x.ToRecipients, ownedNavigationBuilder =>
{
ownedNavigationBuilder.ToJson();
});
entity.OwnsMany(x => x.CcRecipients, ownedNavigationBuilder =>
{
ownedNavigationBuilder.ToJson();
});
});
#region pgsql codefirst 配置 暂时屏蔽
//if (base.Database.IsNpgsql())
//{
@ -570,6 +556,7 @@ public class IRaCISDBContext : DbContext
#region 未分类
public virtual DbSet<EmailLog> EmailLog { get; set; }
public virtual DbSet<EmailRecipientLog> EmailRecipientLog { get; set; }
public virtual DbSet<ShortcutKey> ShortcutKey { get; set; }

View File

@ -88,7 +88,7 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
//}
// 检查属性是否为string类型并且值为null
foreach (var property in entry.Properties.Where(t => t.Metadata.ClrType == typeof(string) && t.CurrentValue == null))
foreach (var property in entry.Properties.Where(t => t.Metadata.ClrType == typeof(string) && !t.Metadata.IsNullable && t.CurrentValue == null))
{
property.CurrentValue = string.Empty;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class ReadModuleAddTypeEnum : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ReadModuleAddTypeEnum",
table: "ReadModule",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ReadModuleAddTypeEnum",
table: "ReadModule");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class ReadingPeriodPlan : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "GeneratedTime",
table: "ReadingPeriodPlan",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsGenerate",
table: "ReadingPeriodPlan",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "GeneratedTime",
table: "ReadingPeriodPlan");
migrationBuilder.DropColumn(
name: "IsGenerate",
table: "ReadingPeriodPlan");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class ReadingPeriodPlanId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "ReadingPeriodPlanId",
table: "ReadModule",
type: "uniqueidentifier",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ReadingPeriodPlanId",
table: "ReadModule");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class IsDoubleScreen : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsDoubleScreen",
table: "User",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDoubleScreen",
table: "User");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class EmailRecipientLog : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CcRecipients",
table: "EmailLog");
migrationBuilder.DropColumn(
name: "ToRecipients",
table: "EmailLog");
migrationBuilder.CreateTable(
name: "EmailRecipientLog",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EmailLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RecipientName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
RecipientAddress = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
RecipientTypeEnum = table.Column<int>(type: "int", nullable: false),
Sort = table.Column<int>(type: "int", nullable: false),
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EmailRecipientLog", x => x.Id);
table.ForeignKey(
name: "FK_EmailRecipientLog_EmailLog_EmailLogId",
column: x => x.EmailLogId,
principalTable: "EmailLog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EmailRecipientLog_User_CreateUserId",
column: x => x.CreateUserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "邮件收件人");
migrationBuilder.CreateIndex(
name: "IX_EmailRecipientLog_CreateUserId",
table: "EmailRecipientLog",
column: "CreateUserId");
migrationBuilder.CreateIndex(
name: "IX_EmailRecipientLog_EmailLogId",
table: "EmailRecipientLog",
column: "EmailLogId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EmailRecipientLog");
migrationBuilder.AddColumn<string>(
name: "CcRecipients",
table: "EmailLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ToRecipients",
table: "EmailLog",
type: "nvarchar(max)",
nullable: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class AttachmentInfo : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Attachments",
table: "EmailLog",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Attachments",
table: "EmailLog",
type: "nvarchar(max)",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class EmailAttachmentLog : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Attachments",
table: "EmailLog");
migrationBuilder.CreateTable(
name: "EmailAttachmentLog",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EmailLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AttachmentName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
AttachmentPath = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EmailAttachmentLog", x => x.Id);
table.ForeignKey(
name: "FK_EmailAttachmentLog_EmailLog_EmailLogId",
column: x => x.EmailLogId,
principalTable: "EmailLog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EmailAttachmentLog_User_CreateUserId",
column: x => x.CreateUserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "邮件附件日志");
migrationBuilder.CreateIndex(
name: "IX_EmailAttachmentLog_CreateUserId",
table: "EmailAttachmentLog",
column: "CreateUserId");
migrationBuilder.CreateIndex(
name: "IX_EmailAttachmentLog_EmailLogId",
table: "EmailAttachmentLog",
column: "EmailLogId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EmailAttachmentLog");
migrationBuilder.AddColumn<string>(
name: "Attachments",
table: "EmailLog",
type: "nvarchar(max)",
nullable: true);
}
}
}

View File

@ -2300,14 +2300,52 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
});
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailAttachmentLog", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Attachments")
b.Property<string>("AttachmentName")
.IsRequired()
.HasColumnType("nvarchar(max)");
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<string>("AttachmentPath")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("EmailLogId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("CreateUserId");
b.HasIndex("EmailLogId");
b.ToTable("EmailAttachmentLog", t =>
{
t.HasComment("邮件附件日志");
});
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Content")
.IsRequired()
@ -2527,6 +2565,54 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
});
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailRecipientLog", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("EmailLogId")
.HasColumnType("uniqueidentifier");
b.Property<string>("RecipientAddress")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<string>("RecipientName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<int>("RecipientTypeEnum")
.HasColumnType("int");
b.Property<int>("Sort")
.HasColumnType("int");
b.Property<DateTime>("UpdateTime")
.HasColumnType("datetime2");
b.Property<Guid>("UpdateUserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("CreateUserId");
b.HasIndex("EmailLogId");
b.ToTable("EmailRecipientLog", t =>
{
t.HasComment("邮件收件人");
});
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Enroll", b =>
{
b.Property<Guid>("Id")
@ -4915,6 +5001,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("int")
.HasComment("模块类型");
b.Property<int>("ReadModuleAddTypeEnum")
.HasColumnType("int");
b.Property<Guid?>("ReadingPeriodPlanId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("ReadingPeriodSetId")
.HasColumnType("uniqueidentifier")
.HasComment("阅片计划ID");
@ -5945,9 +6037,15 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<DateTime?>("DeletedTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("GeneratedTime")
.HasColumnType("datetime2");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<bool>("IsGenerate")
.HasColumnType("bit");
b.Property<Guid>("ReadingPeriodSetId")
.HasColumnType("uniqueidentifier")
.HasComment("阅片期配置ID");
@ -14952,6 +15050,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("IdentityUserId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDoubleScreen")
.HasColumnType("bit");
b.Property<bool>("IsUserRoleDisabled")
.HasColumnType("bit");
@ -16444,6 +16545,25 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Navigation("CreateUserRole");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailAttachmentLog", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
.WithMany()
.HasForeignKey("CreateUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.EmailLog", "EmailLog")
.WithMany("AttachmentList")
.HasForeignKey("EmailLogId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreateUserRole");
b.Navigation("EmailLog");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
@ -16452,69 +16572,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsMany("IRaCIS.Core.Domain.Models.EmaliSendInfo", "CcRecipients", b1 =>
{
b1.Property<Guid>("EmailLogId")
.HasColumnType("uniqueidentifier");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b1.Property<string>("Address")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("Name")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.HasKey("EmailLogId", "Id");
b1.ToTable("EmailLog");
b1.ToJson("CcRecipients");
b1.WithOwner()
.HasForeignKey("EmailLogId");
});
b.OwnsMany("IRaCIS.Core.Domain.Models.EmaliSendInfo", "ToRecipients", b1 =>
{
b1.Property<Guid>("EmailLogId")
.HasColumnType("uniqueidentifier");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b1.Property<string>("Address")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("Name")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.HasKey("EmailLogId", "Id");
b1.ToTable("EmailLog");
b1.ToJson("ToRecipients");
b1.WithOwner()
.HasForeignKey("EmailLogId");
});
b.Navigation("CcRecipients");
b.Navigation("CreateUserRole");
b.Navigation("ToRecipients");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
@ -16539,6 +16597,25 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Navigation("EmailNoticeConfig");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailRecipientLog", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
.WithMany()
.HasForeignKey("CreateUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.EmailLog", "EmailLog")
.WithMany("EmailRecipientLogList")
.HasForeignKey("EmailLogId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreateUserRole");
b.Navigation("EmailLog");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Enroll", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
@ -20553,6 +20630,13 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.IsRequired();
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
{
b.Navigation("AttachmentList");
b.Navigation("EmailRecipientLogList");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
{
b.Navigation("EmailNoticeUserTypeList");