修改查询bug

Uat_Study
hang 2022-10-20 17:55:58 +08:00
parent 64291078a0
commit b6a3391678
10 changed files with 111 additions and 25 deletions

View File

@ -30,5 +30,43 @@ public static class SendEmailHelper
}
}
public static async Task SendEmailAsync(MimeMessage messageToSend, SMTPEmailConfig sMTPEmailConfig, EventHandler<MessageSentEventArgs>? messageSentSuccess = null)
{
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
{
if (messageSentSuccess != null)
{
smtp.MessageSent += messageSentSuccess;
}
smtp.ServerCertificateValidationCallback = (s, c, h, e) => true;
await smtp.ConnectAsync(sMTPEmailConfig.Host, sMTPEmailConfig.Port, SecureSocketOptions.SslOnConnect);
await smtp.AuthenticateAsync(sMTPEmailConfig.UserName, sMTPEmailConfig.AuthorizationCode);
await smtp.SendAsync(messageToSend);
await smtp.DisconnectAsync(true);
}
}
}
public class SMTPEmailConfig
{
public int Port { get; set; }
public string Host { get; set; }
public string UserName { get; set; }
public string AuthorizationCode { get; set; }
}

View File

@ -319,7 +319,7 @@
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetOrderReadingIQueryable(System.Guid,System.Nullable{System.Guid})">
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetOrderReadingIQueryable(System.Guid,System.Nullable{System.Guid},System.String)">
<summary>
获取有序阅片IQuery对象
</summary>
@ -393,6 +393,14 @@
TrialEmailNoticeConfigService
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.SyncSystemEmainCofigDocListAsync(System.Guid,System.Nullable{IRaCIS.Core.Domain.Share.CriterionType})">
<summary>
同步系统配置的文档到想项目中
</summary>
<param name="trialId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.Preview(System.Guid)">
<summary> 指定资源Id渲染Dicom检查的Jpeg预览图像 </summary>
<param name="studyId"> Dicom检查的Id </param>

View File

@ -16,6 +16,6 @@ namespace IRaCIS.Core.Application.Service
Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService);
(int, IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId, Guid? trialReadingCriterionId);
(int, IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId, Guid? trialReadingCriterionId,string? subjectCode = null);
}
}

View File

@ -881,10 +881,11 @@ namespace IRaCIS.Core.Application.Service.Allocation
// .Where(t => t.UnReadTaskCount > 0);
var visitTaskQuery = GetOrderReadingIQueryable(trialId, trialReadingCriterionId);
var visitTaskQuery = GetOrderReadingIQueryable(trialId, trialReadingCriterionId, iRUnReadSubjectQuery.SubjectCode);
var totalCount = visitTaskQuery.Item1;
var currentPageData = await visitTaskQuery.Item2.Skip((iRUnReadSubjectQuery.PageIndex - 1) * iRUnReadSubjectQuery.PageSize)
var currentPageData = await visitTaskQuery.Item2
.Skip((iRUnReadSubjectQuery.PageIndex - 1) * iRUnReadSubjectQuery.PageSize)
.Take(iRUnReadSubjectQuery.PageSize).ToListAsync();
var result = new PageOutput<IRUnReadSubjectView>()
@ -941,10 +942,12 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// </summary>
/// <param name="trialId"></param>
/// <returns></returns>
public (int, IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId, Guid? trialReadingCriterionId)
public (int, IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId, Guid? trialReadingCriterionId,string? subjectCode =null)
{
var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id)
.WhereIf(trialReadingCriterionId != null, t => t.TrialReadingCriterionId == trialReadingCriterionId)
.WhereIf(!string.IsNullOrEmpty(subjectCode), t => t.Subject.Code.Contains(subjectCode) || t.BlindSubjectCode.Contains(subjectCode))
.Where(x => !x.Subject.IsDeleted)
.Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned || t.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed || t.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) && t.TaskState == TaskState.Effect)
.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
@ -2292,10 +2295,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
else if (((_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.ProjectManager) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit)
|| (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && applyId == null))
{
//有序
if (criterionConfig.IsReadingTaskViewInOrder)
{
@ -2360,6 +2359,13 @@ namespace IRaCIS.Core.Application.Service.Allocation
// 1.后续访视不处理
//2.当前任务未完成,不会产生全局任务。后续任务均为访视任务,且均为待阅片,取消分配;
filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum);
if (await _visitTaskReReadingRepository.AnyAsync(t => t.RequestReReadingType == RequestReReadingType.DocotorApply && t.RequestReReadingResultEnum == RequestReReadingResult.Default &&
t.OriginalReReadingTask.VisitTaskNum >= filterObj.VisitTaskNum && t.OriginalReReadingTask.SubjectId == filterObj.SubjectId && t.OriginalReReadingTask.TrialReadingCriterionId == filterObj.TrialReadingCriterionId && t.OriginalReReadingTask.IsAnalysisCreate == filterObj.IsAnalysisCreate))
{
isIRAppyTaskInfluenced = true;
}
}
//无序
else

View File

@ -30,8 +30,9 @@ namespace IRaCIS.Core.Application.Service
{
var commonDocumentQueryable = _commonDocumentRepository.AsQueryable(true)
.WhereIf( queryCommonDocument.CriterionTypeEnum!=null ,t=>t.CriterionTypeEnum == queryCommonDocument.CriterionTypeEnum)
.WhereIf(queryCommonDocument.FileTypeEnum != null, t => t.FileTypeEnum == queryCommonDocument.FileTypeEnum)
.WhereIf( queryCommonDocument.CriterionTypeEnum!=null ,t=>t.CriterionTypeEnum == queryCommonDocument.CriterionTypeEnum)
.WhereIf(queryCommonDocument.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryCommonDocument.BusinessScenarioEnum)
.WhereIf( string.IsNullOrEmpty(queryCommonDocument.Code) , t => t.Code.Contains(queryCommonDocument.Code) )
.WhereIf(string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name))

View File

@ -114,6 +114,8 @@ namespace IRaCIS.Application.Services
);
}
messageToSend.Body = builder.ToMessageBody();

View File

@ -6,6 +6,8 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel
{
/// <summary> TrialEmailNoticeConfigView 列表视图模型 </summary>
@ -24,19 +26,12 @@ namespace IRaCIS.Core.Application.ViewModel
///<summary>TrialEmailNoticeConfigQuery 列表查询参数模型</summary>
public class TrialEmailNoticeConfigQuery
{
public string AuthorizationCode { get; set; }
[NotDefault]
public Guid TrialId { get; set; }
public string ReceiveEmail { get; set; }
public CommonDocumentBusinessScenario? BusinessScenarioEnum { get; set; }
public string Code { get; set; }
public string CopyEmail { get; set; }
public string FromEmail { get; set; }
public string FilePath { get; set; }
public string FileName { get; set; }
public CriterionType? CriterionTypeEnum { get; set; }
}
@ -45,7 +40,7 @@ namespace IRaCIS.Core.Application.ViewModel
{
public Guid? Id { get; set; }
public int BusinessScenarioEnum { get; set; }
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
public string Code { get; set; }

View File

@ -8,6 +8,8 @@ using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Service
{
/// <summary>
@ -25,12 +27,44 @@ namespace IRaCIS.Core.Application.Service
}
/// <summary>
/// 同步系统配置的文档到想项目中
/// </summary>
/// <param name="trialId"></param>
/// <returns></returns>
///
private async Task SyncSystemEmainCofigDocListAsync(Guid trialId, CriterionType? criterionTypeEnum)
{
if (criterionTypeEnum != null)
{
var docmentList = _repository.Where<CommonDocument>(t => t.CriterionTypeEnum == criterionTypeEnum).Select(t => new { t.Path, t.Name, t.Code, t.BusinessScenarioEnum }).ToList();
var trialDocCount = _trialEmailNoticeConfigRepository.Where(t => t.CriterionTypeEnum == criterionTypeEnum).Count();
if (trialDocCount == 0)
{
foreach (var item in docmentList)
{
await _trialEmailNoticeConfigRepository.AddAsync(new TrialEmailNoticeConfig() { FileName = item.Name, FilePath = item.Path, BusinessScenarioEnum = item.BusinessScenarioEnum, Code = item.Code });
}
}
}
await _trialEmailNoticeConfigRepository.SaveChangesAsync();
}
public async Task<List<TrialEmailNoticeConfigView>> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery)
{
await SyncSystemEmainCofigDocListAsync(inQuery.TrialId, inQuery.CriterionTypeEnum);
var trialEmailNoticeConfigQueryable = _trialEmailNoticeConfigRepository
.ProjectTo<TrialEmailNoticeConfigView>(_mapper.ConfigurationProvider);
.WhereIf(inQuery.CriterionTypeEnum != null, t => t.CriterionTypeEnum == inQuery.CriterionTypeEnum)
.WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum)
.ProjectTo<TrialEmailNoticeConfigView>(_mapper.ConfigurationProvider);
return await trialEmailNoticeConfigQueryable.ToListAsync();
}

View File

@ -71,6 +71,8 @@ namespace IRaCIS.Core.Application.Service
CreateMap<TrialEmailNoticeConfig, TrialEmailNoticeConfigView>();
CreateMap<TrialEmailNoticeConfigAddOrEdit, TrialEmailNoticeConfig>();
}
}

View File

@ -58,8 +58,8 @@ namespace IRaCIS.Core.Domain.Models
[Required]
public bool IsDistinguishCriteria { get; set; }
[Required]
public int BusinessScenarioEnum { get; set; }
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
public CriterionType CriterionTypeEnum { get; set; }