移除QA消息通知代码
parent
86889c1e3a
commit
a79c8a8242
|
@ -6,37 +6,12 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
|||
{
|
||||
|
||||
|
||||
public class VisitQACommand
|
||||
{
|
||||
public QCChallengeCommand QARecord { get; set; } = new QCChallengeCommand();
|
||||
|
||||
public List<QARecordTrialTemplateItemCommand> QATrialTemplateItemList { get; set; } = new List<QARecordTrialTemplateItemCommand>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class QARecordTrialTemplateItemCommand
|
||||
{
|
||||
public int ShowOrder { get; set; }
|
||||
public string TemplateItemName { get; set; } = String.Empty;
|
||||
public Guid QATrialTemplateItemId { get; set; }
|
||||
public string Note { get; set; } = String.Empty;
|
||||
public QAItemStatus Status { get; set; } = QAItemStatus.Undefined;
|
||||
|
||||
}
|
||||
|
||||
public class QARecordTrialTemplateItemDTO : QARecordTrialTemplateItemCommand
|
||||
{
|
||||
public Guid QARecordId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class UpdateModalityCommand
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
@ -269,40 +244,7 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
|||
}
|
||||
|
||||
|
||||
public class HistoryGroupDTO
|
||||
{
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
public string IQA { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? IQADeadline { get; set; }
|
||||
|
||||
public string IQANote { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? IQACreateTime { get; set; }
|
||||
|
||||
|
||||
public List<TemplateItemProblem> TemplateItems { get; set; } = new List<TemplateItemProblem>();
|
||||
}
|
||||
|
||||
public class TemplateItemProblem
|
||||
{
|
||||
[JsonIgnore]
|
||||
public string IQA { get; set; } = string.Empty;
|
||||
[JsonIgnore]
|
||||
public DateTime? IQADeadline { get; set; }
|
||||
[JsonIgnore]
|
||||
public string IQANote { get; set; } = string.Empty;
|
||||
[JsonIgnore]
|
||||
public DateTime? IQACreateTime { get; set; }
|
||||
|
||||
public Guid QARecordId { get; set; }
|
||||
public int ShowOrder { get; set; }
|
||||
public string TemplateItemName { get; set; } = String.Empty;
|
||||
public string Note { get; set; } = String.Empty;
|
||||
public QAItemStatus Status { get; set; } = QAItemStatus.Undefined;
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
public class TrialVisitQADTO
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
using IRaCIS.Core.Domain.Share;
|
||||
using MediatR;
|
||||
using System;
|
||||
|
||||
namespace IRaCIS.Core.Application.MediatR.CommandAndQueries
|
||||
{
|
||||
|
||||
public class QAMessageRequest:IRequest<bool>
|
||||
{
|
||||
//有一部分QA 消息 在 AutoFac AOP中,但是由于直接服务生成API 上面切入的AOP会失效,
|
||||
//因为采用进程内消息通信,可以解耦代码,避免写在一起,影响阅读,专注于业务逻辑
|
||||
public NoticeType MessageType { get; set; }
|
||||
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
//用于关联关系记录 删除的时候,处理消息
|
||||
public Guid QCChallengeId { get; set; }
|
||||
|
||||
//用于关联关系记录 删除的时候,处理消息
|
||||
public Guid QCChallengeReplyId { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -1,234 +0,0 @@
|
|||
//using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
//using MediatR;
|
||||
//using System.Threading;
|
||||
//using System.Threading.Tasks;
|
||||
//using IRaCIS.Core.Domain.Share;
|
||||
//using IRaCIS.Core.Infra.EFCore;
|
||||
//using IRaCIS.Core.Domain.Models;
|
||||
//using System.Linq;
|
||||
//using System;
|
||||
|
||||
|
||||
//namespace IRaCIS.Core.Application.MediatR.Handlers
|
||||
//{
|
||||
|
||||
// public class QAMessageHandler : IRequestHandler<QAMessageRequest, bool>
|
||||
// {
|
||||
// private readonly IRepository<TrialUser> _userTrialRepository;
|
||||
// private readonly IRepository<TrialSiteUser> _userTrialSiteRepository;
|
||||
// private readonly IRepository<DicomStudy> _studyRepository;
|
||||
// private readonly IRepository<QANotice> _qaNoticeRepository;
|
||||
// private readonly IUserInfo _userInfo;
|
||||
// private readonly IRepository<QCChallenge> _qaRecordRepository;
|
||||
// private readonly IRepository<Subject> _subjectRepository;
|
||||
// private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
|
||||
// /// <summary>
|
||||
// /// 构造函数注入
|
||||
// /// </summary>
|
||||
|
||||
// public QAMessageHandler(IRepository<DicomStudy> studyRepository, IRepository<TrialUser> userTrialRepository, IRepository<TrialSiteUser> userTrialSiteRepository, IRepository<QANotice> qaNoticeRepository, IUserInfo userInfo,
|
||||
// IRepository<QCChallenge> qaRecordRepository, IRepository<Subject> subjectRepository, IRepository<SubjectVisit> subjectVisitRepository)
|
||||
// {
|
||||
// _userTrialSiteRepository = userTrialSiteRepository;
|
||||
// _userTrialRepository = userTrialRepository;
|
||||
// _studyRepository = studyRepository;
|
||||
// _qaNoticeRepository = qaNoticeRepository;
|
||||
// _userInfo = userInfo;
|
||||
// _qaRecordRepository = qaRecordRepository;
|
||||
// _subjectRepository = subjectRepository;
|
||||
// _subjectVisitRepository = subjectVisitRepository;
|
||||
// }
|
||||
|
||||
// public Task<bool> Handle(QAMessageRequest request, CancellationToken cancellationToken)
|
||||
// {
|
||||
// var qaRecord = _qaRecordRepository.FirstOrDefault(t => t.Id == request.QCChallengeId);
|
||||
|
||||
// var subjectQuery =
|
||||
// from sv in _subjectVisitRepository.Where(t => t.Id == qaRecord.SubjectVisitId)
|
||||
// join sub in _subjectRepository.AsQueryable() on sv.SubjectId equals sub.Id
|
||||
// select new
|
||||
// {
|
||||
// sv.VisitName,
|
||||
// sv.VisitNum,
|
||||
// SubjectName = sub.LastName + " / " + sub.FirstName,
|
||||
// sub.SiteId
|
||||
// };
|
||||
|
||||
// var subject = subjectQuery.First();
|
||||
|
||||
|
||||
|
||||
// //查询项目的参与者 和 负责site下CRC用户
|
||||
// var trialUserList = _userTrialRepository.Where(t => t.TrialId == qaRecord.TrialId).ToList();
|
||||
|
||||
|
||||
// var qaList = trialUserList.Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).ToList();
|
||||
|
||||
|
||||
// if (request.MessageType == NoticeType.QA_AddQARecord_NoticeCRC)
|
||||
// {
|
||||
|
||||
|
||||
// //找出当前操作的QA 如果是pm 或者admin 代替操作 此时会有问题 所以 谁代替,就以谁的名义执行
|
||||
// //var currentQA = qaList.First(t => t.UserId == _userInfo.Id);
|
||||
// //var currentQA = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// //在项目CRC列表中筛选出 负责该study关联 site的CRC
|
||||
|
||||
// var siteCRCList = _userTrialSiteRepository.Where(t =>
|
||||
// t.SiteId == subject.SiteId && t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && t.TrialId == qaRecord.TrialId).ToList();
|
||||
|
||||
// //var siteCRCList = userList.Where(t => t.SiteId == subject.SiteId && t.UserTypeEnum == UserType.ClinicalResearchCoordinator).ToList();
|
||||
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = qaRecord.TrialId,
|
||||
// SubjectVisitId = qaRecord.SubjectVisitId,
|
||||
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.QA_AddQARecord_NoticeCRC,
|
||||
// NeedDeal = true,
|
||||
// Message = $"QA -> CRC : {_userInfo.RealName} add QA Record",
|
||||
// SendTime = DateTime.Now,
|
||||
|
||||
// RelationId = request.QCChallengeId
|
||||
// };
|
||||
|
||||
// siteCRCList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = qaRecord.SubjectVisitId,
|
||||
// ToUser = t.User.LastName + " / " + t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// //添加 发送给CRC的消息 消息和CRC是 一对多
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
// }
|
||||
|
||||
// else if (request.MessageType == NoticeType.QARecordDialogPost)
|
||||
// {
|
||||
// #region QA通知处理 新建一条QA通知消息 需要分用户类型 记录关联Id 为了删除操作
|
||||
|
||||
// //CRC =>QA
|
||||
// if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator)
|
||||
// {
|
||||
// //PM 或者admin可以代替CRC角色 不能从CRC列表中查询用户
|
||||
// //var currentCRC = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = qaRecord.TrialId,
|
||||
// SubjectVisitId = qaRecord.SubjectVisitId,
|
||||
// //FromUser = currentCRC.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentCRC.UserType,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.CRC_QARecordDialogPost_NoticeQA,
|
||||
// NeedDeal = true,
|
||||
// Message = $"CRC -> QA : {_userInfo.RealName} post or reply message for QA record about SubjectName:{subject.SubjectName } VisitName: {subject.VisitName} VisitNum:{subject.VisitName} !",
|
||||
// SendTime = DateTime.Now,
|
||||
// RelationId = request.QCChallengeReplyId
|
||||
// };
|
||||
|
||||
// qaList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = qaRecord.SubjectVisitId,
|
||||
// ToUser = t.User.LastName + " / " + t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.User.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
// //这里作为 设置QA 设置 Inqa 状态的回复 或者QA和CRC对话的
|
||||
// var needDealNoticeList = _qaNoticeRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectVisitId == qaRecord.SubjectVisitId && t.NeedDeal && (t.NoticeTypeEnum == NoticeType.QA_InQA_NoticeCRC
|
||||
// || t.NoticeTypeEnum == NoticeType.QA_QARecordDialogPost_NoticeCRC || t.NoticeTypeEnum == NoticeType.QA_AddQARecord_NoticeCRC)).ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
// if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC)
|
||||
// {
|
||||
|
||||
// //找出当前操作的QA 如果是pm 或者admin 代替操作 此时会有问题 所以 谁代替,就以谁的名义执行
|
||||
// //var currentQA = qaList.First(t => t.UserId == _userInfo.Id);
|
||||
// //var currentQA = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// //在项目CRC列表中筛选出 负责该study关联 site的CRC
|
||||
// //var siteCRCList = userList.Where(t => t.SiteId == subject.SiteId && t.UserTypeEnum == UserType.ClinicalResearchCoordinator).ToList();
|
||||
|
||||
// var siteCRCList = _userTrialSiteRepository.Where(t =>
|
||||
// t.SiteId == subject.SiteId && t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && t.TrialId == qaRecord.TrialId).ToList();
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = qaRecord.TrialId,
|
||||
// SubjectVisitId = qaRecord.SubjectVisitId,
|
||||
// //FromUser = currentQA.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentQA.UserType,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.QA_QARecordDialogPost_NoticeCRC,
|
||||
// NeedDeal = true,
|
||||
// Message = $"QA -> CRC : {_userInfo.RealName} post or reply message for QA record about SubjectName:{subject.SubjectName } VisitName: {subject.VisitName} VisitNum:{subject.VisitName} !",
|
||||
// SendTime = DateTime.Now,
|
||||
// RelationId = request.QCChallengeReplyId
|
||||
// };
|
||||
|
||||
// siteCRCList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = qaRecord.SubjectVisitId,
|
||||
// ToUser = t.User.LastName + " / " + t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// //添加 发送给CRC的消息 消息和CRC是 一对多
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
// //这里作为 CRC post的对话的回复
|
||||
// var needDealNoticeList = _qaNoticeRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectVisitId == qaRecord.SubjectVisitId && t.NeedDeal && t.NoticeTypeEnum == NoticeType.CRC_QARecordDialogPost_NoticeQA).ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
// #endregion
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// return Task.FromResult(true);
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace IRaCIS.Core.Domain.Share
|
||||
{
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
namespace IRaCIS.Core.Domain.Share
|
||||
{
|
||||
public enum NoticeType
|
||||
{
|
||||
NotNeedNotice=0,
|
||||
|
||||
CRC_RequestToQA_NoticeQA=1,
|
||||
|
||||
QA_AddQARecord_NoticeCRC=2,
|
||||
|
||||
QARecordDialogPost = 3,
|
||||
|
||||
CRC_QARecordDialogPost_NoticeQA =4,
|
||||
|
||||
QA_QARecordDialogPost_NoticeCRC = 5,
|
||||
|
||||
|
||||
|
||||
QA_InQA_NoticeCRC = 7,
|
||||
|
||||
CRC_ReUpload_NoticeQA=8,
|
||||
|
||||
QA_QAPass_NoticeQA=9,
|
||||
|
||||
QA_Anonymized_NoticeQA = 11,//匿名化完成
|
||||
|
||||
//QA_Anonymized_NoticePM = 11,//匿名化完成
|
||||
|
||||
// PM 不会转发消息 只作为匿名化消息的边界
|
||||
|
||||
//PM_Forwarded = 12,//已经转发
|
||||
|
||||
//删除操作 只是将以前的发送的消息删除
|
||||
//QA_DeleteQARecord_RemoveNotice=3,
|
||||
//QA_QARecordDialogDelete_RemoveNotice =6,
|
||||
|
||||
// QA不通过 QA和CRC 对话的消息置为已处理
|
||||
//QA_QANotPass_NoticeCRC = 10,
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
namespace IRaCIS.Core.Domain.Share
|
||||
{
|
||||
public enum QAItemStatus
|
||||
{
|
||||
Yes=1,
|
||||
|
||||
No=2,
|
||||
|
||||
Uncertain=3,
|
||||
|
||||
Undefined=4
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
namespace IRaCIS.Core.Domain.Share
|
||||
{
|
||||
public enum QATrialTemplateStatus
|
||||
{
|
||||
HasQuote=1,
|
||||
|
||||
CanEditOrUpdate=0
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
public class QANotice : Entity
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
public Guid RelationId { get; set; }=Guid.Empty;
|
||||
|
||||
public string Message { get; set; }
|
||||
|
||||
public string StudyStatusStr { get; set; } = string.Empty;
|
||||
|
||||
public DateTime SendTime { get; set; }
|
||||
|
||||
public DateTime? DealTime { get; set; }
|
||||
|
||||
public Guid FromUserId { get; set; }
|
||||
|
||||
public string FromUser { get; set; }
|
||||
|
||||
public string FromUserType { get; set; }
|
||||
|
||||
public NoticeType NoticeTypeEnum { get; set; }
|
||||
|
||||
public bool NeedDeal { get; set; }
|
||||
|
||||
public virtual ICollection<QANoticeUser> QANoticeUserList { get; set; }
|
||||
|
||||
public QANotice()
|
||||
{
|
||||
QANoticeUserList=new HashSet<QANoticeUser>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
public class QANoticeUser:Entity
|
||||
{
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
public Guid QANoticeId { get; set; } = Guid.Empty;
|
||||
|
||||
public Guid ToUserId { get; set; } = Guid.Empty;
|
||||
|
||||
public string ToUser { get; set; }
|
||||
|
||||
public string ToUserType { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -289,7 +289,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
#region QA
|
||||
|
||||
public virtual DbSet<QCChallengeDialog> QCChallengeDialog { get; set; }
|
||||
public virtual DbSet<QANotice> QATemplateDictionary { get; set; }
|
||||
//public virtual DbSet<QANotice> QATemplateDictionary { get; set; }
|
||||
public virtual DbSet<QCChallenge> QCChallenge { get; set; }
|
||||
public virtual DbSet<SubjectVisit> SubjectVisit { get; set; }
|
||||
#endregion
|
||||
|
@ -336,8 +336,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
//public virtual DbSet<QAAboutTrialTemplateItem> QARecordTrialTemplateItem { get; set; }
|
||||
//public virtual DbSet<QARecordTemplateItemDetail> QARecordTemplateItemDetail { get; set; }
|
||||
//public virtual DbSet<QATemplate> QATemplate { get; set; }
|
||||
public virtual DbSet<QANoticeUser> QANoticeUser { get; set; }
|
||||
public virtual DbSet<QANotice> QANotice { get; set; }
|
||||
//public virtual DbSet<QANoticeUser> QANoticeUser { get; set; }
|
||||
//public virtual DbSet<QANotice> QANotice { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Linq.Expressions;
|
|||
|
||||
namespace IRaCIS.Core.Infrastructure.Extention
|
||||
{
|
||||
public static class ListExtensions
|
||||
public static class ListTreeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 将列表转换为树形结构
|
Loading…
Reference in New Issue