移除QA消息通知代码
This commit is contained in:
@@ -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);
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user