diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 85052efc6..8691aebc4 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -417,7 +417,7 @@
选择人员下拉
-
+
@@ -5338,11 +5338,6 @@
任务类型
-
-
- 任务类型
-
-
任务类型
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 61b2af255..633fc4e8c 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -12,6 +12,7 @@ using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Application.Contracts;
+using IRaCIS.Core.Infra.EFCore.Common;
namespace IRaCIS.Core.Application.Service
{
@@ -27,7 +28,7 @@ namespace IRaCIS.Core.Application.Service
public IRepository _visitTaskRepository { get; }
public IRepository _trialUserRepository { get; }
- public TrialEmailNoticeConfigService(IRepository trialEmailNoticeConfigRepository, IRepository visitTaskRepository,IRepository trialUserRepository)
+ public TrialEmailNoticeConfigService(IRepository trialEmailNoticeConfigRepository, IRepository visitTaskRepository, IRepository trialUserRepository)
{
_trialEmailNoticeConfigRepository = trialEmailNoticeConfigRepository;
_visitTaskRepository = visitTaskRepository;
@@ -48,7 +49,7 @@ namespace IRaCIS.Core.Application.Service
{
var docmentList = _repository.Where(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();
+ var trialDocCount = _trialEmailNoticeConfigRepository.Where(t => t.CriterionTypeEnum == criterionTypeEnum && t.TrialId == trialId).Count();
if (trialDocCount == 0)
{
@@ -81,7 +82,8 @@ namespace IRaCIS.Core.Application.Service
var criterionTypeEnum = await _repository.Where(t => t.TrialId == trialId && t.Id == trialReadingCriterionId).Select(t => t.CriterionType).FirstOrDefaultAsync();
- var emailConfig = await _trialEmailNoticeConfigRepository.Where(t => t.TrialId == trialId && t.CriterionTypeEnum == criterionTypeEnum && t.BusinessScenarioEnum == businessScenarioEnum).FirstOrDefaultAsync();
+ var emailConfig = await _trialEmailNoticeConfigRepository.Where(t => t.TrialId == trialId && t.CriterionTypeEnum == criterionTypeEnum && t.BusinessScenarioEnum == businessScenarioEnum)
+ .Include(t => t.TrialEmailNoticeUserList).ThenInclude(t => t.User).FirstOrDefaultAsync();
if (emailConfig == null)
{
@@ -92,22 +94,35 @@ namespace IRaCIS.Core.Application.Service
var sendEmailConfig = new SMTPEmailConfig();
- //foreach (var item in emailConfig.ReceiveEmailList)
- //{
- // sendEmailConfig.ToMailAddressList.Add(new MimeKit.MailboxAddress(item, item));
- //}
+ foreach (var item in emailConfig.TrialEmailNoticeUserList)
+ {
- //foreach (var item in emailConfig.CopyEmailList)
- //{
- // if (item.Contains("@") && !string.IsNullOrEmpty(item))
- // {
- // sendEmailConfig.CopyToMailAddressList.Add(new MimeKit.MailboxAddress(item.Trim(), item.Trim()));
- // }
- //}
+ if (item.User.EMail.Contains("@") && !string.IsNullOrEmpty(item.User.EMail))
+ {
+ switch (item.EmailUserType)
+ {
+ case EmailUserType.From:
+ sendEmailConfig.FromEmailAddress = new MimeKit.MailboxAddress(item.User.FullName, item.User.EMail);
+
+ break;
+ case EmailUserType.To:
+ sendEmailConfig.ToMailAddressList.Add(new MimeKit.MailboxAddress(item.User.FullName, item.User.EMail));
+
+ break;
+ case EmailUserType.Copy:
+ sendEmailConfig.CopyToMailAddressList.Add(new MimeKit.MailboxAddress(item.User.FullName, item.User.EMail));
+
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
//邮件内容html
- await FillWordTemplateAndSetEmailAsync(visitTaskId, sendEmailConfig, businessScenarioEnum, criterionTypeEnum!);
+ var isNeedSend = await FillWordTemplateAndSetEmailAsync(visitTaskId, sendEmailConfig, businessScenarioEnum, criterionTypeEnum!);
//邮件附件
var path = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, emailConfig.FilePath);
@@ -132,8 +147,11 @@ namespace IRaCIS.Core.Application.Service
- private async Task FillWordTemplateAndSetEmailAsync(Guid visitTaskId, SMTPEmailConfig sendEmailConfig, CommonDocumentBusinessScenario businessScenarioEnum, CriterionType criterionType)
+ private async Task FillWordTemplateAndSetEmailAsync(Guid visitTaskId, SMTPEmailConfig sendEmailConfig, CommonDocumentBusinessScenario businessScenarioEnum, CriterionType criterionType)
{
+
+ var isNeedSend = true;
+
var pathToFile = _hostEnvironment.WebRootPath
+ Path.DirectorySeparatorChar.ToString()
+ "EmailTemplate"
@@ -141,8 +159,60 @@ namespace IRaCIS.Core.Application.Service
+ "SubjectEnrollConfirmOrPDProgress.html";
- if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
+ var documentNeedBasicInfo = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => new
{
+ t.Trial.ResearchProgramNo,
+ t.Subject.TrialSite.TrialSiteCode,
+ SubjectCode = t.Subject.Code,
+ t.Trial.Sponsor.SponsorName,
+ t.Trial.IsEnrollementQualificationConfirm,
+ t.Trial.IsPDProgressView,
+
+ IsBaseline = t.SourceSubjectVisit.IsBaseLine,
+ VisitEarliestScanDate = t.SourceSubjectVisit.EarliestScanDate,
+ VisitName = t.SourceSubjectVisit.VisitName,
+ t.SourceSubjectVisit.IsFinalVisit,
+ t.SourceSubjectVisit.PDState,
+
+ ModuleEarliestScanDate = t.ReadModule.SubjectVisit.EarliestScanDate,
+ ModuleVisitName = t.ReadModule.SubjectVisit.VisitName,
+ t.SourceSubjectVisitId,
+ t.SouceReadModuleId,
+ t.SubjectId,
+
+ t.ReadingTaskState,
+ t.ReadingCategory,
+ t.SignTime,
+
+ t.TrialReadingCriterionId,
+ t.TrialReadingCriterion.ArbitrationRule,
+ t.TrialReadingCriterion.ReadingType,
+ t.TrialReadingCriterion.IsReadingTaskViewInOrder,
+ }).FirstNotNullAsync();
+
+
+ if (documentNeedBasicInfo.ReadingCategory == ReadingCategory.Visit || documentNeedBasicInfo.ReadingCategory == ReadingCategory.Judge || documentNeedBasicInfo.ReadingCategory == ReadingCategory.Global)
+ {
+
+ }
+ else
+ {
+ isNeedSend = false;
+
+ return isNeedSend;
+ }
+
+ //入组确认仅在基线
+ if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed && documentNeedBasicInfo.IsEnrollementQualificationConfirm && documentNeedBasicInfo.IsBaseline)
+ {
+
+ //如果其他阅片人已经做了,说明发送了入组确认报告,第二个人做完就不发送了
+
+ if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == documentNeedBasicInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
+ t.Id != visitTaskId && t.ReadingTaskState == ReadingTaskState.HaveSigned))
+ {
+ isNeedSend = false;
+ }
sendEmailConfig.TopicDescription = "入组确认";
@@ -156,60 +226,22 @@ namespace IRaCIS.Core.Application.Service
);
}
- switch (criterionType)
+
+ var answer = "否";
+
+ if (await _repository.Where().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
+ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
{
- case CriterionType.SelfDefine:
- break;
+ answer = "是";
- case CriterionType.RECIST1Pointt1:
+ //修改Subject 状态 need to do
-
- //_visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => new { t.Trial.ResearchProgramNo, t.Subject.TrialSite.TrialSiteCode, SubjectCode = t.Subject.Code, VisitEarliestScanDate = t.SourceSubjectVisit.EarliestScanDate, t.sou })
-
- break;
-
- case CriterionType.PCWG3:
- break;
-
- case CriterionType.mRECISTMesothelioma:
- break;
- case CriterionType.RECIL:
- break;
- case CriterionType.RECIST1Point0:
- break;
- case CriterionType.WHO:
- break;
- case CriterionType.PERCIST:
- break;
- case CriterionType.Forrest:
- break;
- case CriterionType.Lugano2014:
- break;
- case CriterionType.iRECIST:
- break;
- case CriterionType.RANO_BM:
- break;
- case CriterionType.RANO:
- break;
- case CriterionType.IWCLL2018:
- break;
- case CriterionType.mRECISTHCC:
- break;
- case CriterionType.Cheson2007:
- break;
- case CriterionType.IMWG2016:
- break;
- default:
- break;
}
-
-
-
}
- else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
+ else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed && documentNeedBasicInfo.IsPDProgressView)
{
sendEmailConfig.TopicDescription = "疾病进展";
@@ -224,62 +256,274 @@ namespace IRaCIS.Core.Application.Service
);
}
- switch (criterionType)
+ //有序
+
+ if (documentNeedBasicInfo.IsReadingTaskViewInOrder)
{
- case CriterionType.SelfDefine:
- break;
- case CriterionType.RECIST1Pointt1:
+ var answer = "否";
+
+ //单重
+
+ if (documentNeedBasicInfo.ReadingType == ReadingMethod.Single)
+ {
+ //仲裁在访视上 或者在阅片期
+ if (documentNeedBasicInfo.ArbitrationRule != ArbitrationRule.None)
+ {
+
+ throw new BusinessValidationFailedException("单重有序阅片配置有误(不应该有仲裁对象配置),请核查!");
+ }
+
+
+ //要求PD 确认的访视 是截止访视 还是非截止访视(根据该访视有没有配置阅片期来判断)
+
+ if (documentNeedBasicInfo.ReadingCategory == ReadingCategory.Visit)
+ {
+ //存在阅片期 那么就是截止访视
+ if (await _repository.Where(t => t.TrialReadingCriterionId == documentNeedBasicInfo.TrialReadingCriterionId && t.SubjectVisitId == documentNeedBasicInfo.SourceSubjectVisitId && t.ReadingSetType == ReadingSetType.ImageReading).AnyAsync())
+ {
+ isNeedSend = false;
+ }
+ else//非截止访视
+ {
+ answer = await TranslatePdStateAsync(visitTaskId, ReadingCategory.Visit);
+ }
+ }
+ else if (documentNeedBasicInfo.ReadingCategory == ReadingCategory.Global)
+ {
+ answer = await TranslatePdStateAsync(visitTaskId, ReadingCategory.Global);
+ }
+ else
+ {
+ throw new BusinessValidationFailedException("单重有序阅片 该类型的任务不应进入此处逻辑,请联系后台开发核查!");
+ }
+
+
+ }
+ //双重
+ else if (documentNeedBasicInfo.ReadingType == ReadingMethod.Double)
+ {
+
+
+ //仲裁在访视上 就没有全局阅片 没有阅片期
+ if (documentNeedBasicInfo.ArbitrationRule == ArbitrationRule.Visit)
+ {
+ //找到 访视,裁判 所有有效任务(不可能有全局的) 访视和裁判任务的SourceSubjectVisitId 一样
+ var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == documentNeedBasicInfo.SourceSubjectVisitId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect &&
+ (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge )).ToListAsync();
+
+
+ //这里要求 到这里已经如果有裁判 已经生成裁判了保存数据库
+ //双人阅片,没有产生裁判 第二个人读完发
+ if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) == 2)
+ {
+
+ answer = await TranslatePdStateAsync(visitTaskId, documentNeedBasicInfo.ReadingCategory);
+ }
+ //双人 产生裁判,并且裁判完成 发
+ else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
+ {
+
+ answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge);
+
+ }
+ else
+ {
+ isNeedSend = false;
+ }
+
+
+ }
+ //在阅片期 仲裁在全局阅片,不会在访视上
+ else if (documentNeedBasicInfo.ArbitrationRule == ArbitrationRule.Reading)
+ {
+ //是访视任务 不可能是裁判任务(访视上不会生成裁判),也不会是全局任务(全局任务 SourceSubjectVisitId=null )
+ if (documentNeedBasicInfo.SourceSubjectVisitId != null)
+ {
+
+ #region MyRegion
+
+ ////看该访视是否是截止访视
+ //var moduleIdList = await _repository.Where(t => t.TrialReadingCriterionId == documentNeedBasicInfo.TrialReadingCriterionId && t.SubjectVisitId == documentNeedBasicInfo.SourceSubjectVisitId && t.ReadingSetType == ReadingSetType.ImageReading)
+ // .Select(t => (Guid?) t.Id).ToListAsync();
+
+ ////截止访视
+ //if (moduleIdList.Count > 0)
+ //{
+ // //截止访视,需要等待生成全局,完成全局再发
+
+ // isNeedSend = false;
+
+ //}
+ ////非截止访视 CRC在该访视设置PD后,在提交的时候,生成了阅片期,一定会生成全局任务
+ //else
+ //{
+
+ // isNeedSend = false;
+ //}
+
+ #endregion
+
+
+ //访视类型的任务 根本就不需要发送邮件
+
+ isNeedSend = false;
+
+ }
+ //是全局任务 或者全局的裁判任务 (如果是全局任务,那么此时裁判任务已经生成,如果是全局裁判)
+ else if (documentNeedBasicInfo.SouceReadModuleId != null)
+ {
+ var taskList = await _visitTaskRepository.Where(t => t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.SouceReadModuleId== documentNeedBasicInfo.SouceReadModuleId
+ && (t.ReadingCategory == ReadingCategory.Global || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync();
+
+ //两个全局没有裁判
+ if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Global) == 2)
+ {
+
+ answer = await TranslatePdStateAsync(visitTaskId, documentNeedBasicInfo.ReadingCategory);
+ }
+ //双人全局产生裁判
+ else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Global).Count() == 2)
+ {
+
+ answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge);
+
+ }
+ else
+ {
+ isNeedSend = false;
+ }
+ }
+
+
+
+ }
+ else
+ {
+ throw new BusinessValidationFailedException("双重有序阅片 没有定义该仲裁规则处理逻辑,请联系业务和后台开发核查!");
+ }
+
+
+ }
+ else
+ {
+ throw new BusinessValidationFailedException("有序阅片配置有误(应为单重或者双重阅片),请核查!");
+ }
+
- break;
- case CriterionType.PCWG3:
- break;
- case CriterionType.mRECISTMesothelioma:
- break;
- case CriterionType.RECIL:
- break;
- case CriterionType.RECIST1Point0:
- break;
- case CriterionType.WHO:
- break;
- case CriterionType.PERCIST:
- break;
- case CriterionType.Forrest:
- break;
- case CriterionType.Lugano2014:
- break;
- case CriterionType.iRECIST:
- break;
- case CriterionType.RANO_BM:
- break;
- case CriterionType.RANO:
- break;
- case CriterionType.IWCLL2018:
- break;
- case CriterionType.mRECISTHCC:
- break;
- case CriterionType.Cheson2007:
- break;
- case CriterionType.IMWG2016:
- break;
- default:
- break;
}
+ //无序
+ else
+ {
+ //单重
+
+ var answer = "否";
+
+ if (documentNeedBasicInfo.ReadingType == ReadingMethod.Single && documentNeedBasicInfo.ArbitrationRule == ArbitrationRule.None)
+ {
+ answer = await TranslatePdStateAsync(visitTaskId, documentNeedBasicInfo.ReadingCategory);
+ }
+ //双重 截止访视只在阅片期的时候存在 要求PD确认的访视 肯定是非截止访视
+ else if (documentNeedBasicInfo.ReadingType == ReadingMethod.Double && documentNeedBasicInfo.ArbitrationRule == ArbitrationRule.Visit)
+ {
+ //在两位阅片人读完访视后,如果有裁判者等裁判读完,如果无裁判则等第二个人的读完
+
+ var taskList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == documentNeedBasicInfo.SourceSubjectVisitId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Judge)).ToListAsync();
+
+ //这里要求 到这里已经如果有裁判 已经生成裁判了保存数据库
+ if (taskList.Count == 2 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) == 2)
+ {
+
+ answer = await TranslatePdStateAsync(visitTaskId, documentNeedBasicInfo.ReadingCategory);
+ }
+ else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
+ {
+
+ answer = await TranslatePdStateAsync(taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).First().Id, ReadingCategory.Judge);
+
+ }
+ else
+ {
+ isNeedSend = false;
+ }
+
+ }
+ else
+ {
+ throw new BusinessValidationFailedException("无序阅片配置有误(应为单重无仲裁对象,双重针对访视仲裁),请核查!");
+
+ }
+
+ }
+
+
+
+
+
+
}
+
+ return isNeedSend;
}
+ private async Task TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory)
+ {
+
+ var answer = string.Empty;
+
+ if (readingCategory == ReadingCategory.Visit)
+ {
+ var questionAnsewer = await _repository.Where(t => t.VisitTaskId == visitTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync();
+
+ answer = questionAnsewer.Answer;
+ }
+ else if (readingCategory == ReadingCategory.Global)
+ {
+ var questionAnsewer = await _repository.Where(t => t.TaskId == visitTaskId && t.TrialReadingQuestion.QuestionType == QuestionType.Tumor).FirstNotNullAsync();
+
+ answer = questionAnsewer.Answer;
+ }
+ else if (readingCategory == ReadingCategory.Judge)
+ {
+ var judgeResultTaskId = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.JudgeResultTaskId).FirstNotNullAsync();
+
+ var questionAnsewer = await _repository.Where(t => t.VisitTaskId == judgeResultTaskId && t.ReadingQuestionTrial.QuestionType == QuestionType.Tumor).FirstNotNullAsync();
+
+ answer = questionAnsewer.Answer;
+ }
+ else
+ {
+ throw new BusinessValidationFailedException("不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑");
+ }
+
+
+
+ if (answer == OverallAssessment.PD.GetEnumInt())
+ {
+ return "是";
+ }
+ if (answer == OverallAssessment.NA.GetEnumInt())
+ {
+ return "NA";
+ }
+ else
+ {
+ return "否";
+ }
+ }
+
///
/// 选择人员下拉
///
- ///
+ ///
///
public async Task> GetTrialUserSelectList(Guid trialId)
{
- var query = _trialUserRepository.Where(t => t.TrialId == trialId && t.IsDeleted==false,false,true ).IgnoreQueryFilters()
-
+ var query = _trialUserRepository.Where(t => t.TrialId == trialId && t.IsDeleted == false, false, true).IgnoreQueryFilters()
+
.ProjectTo(_mapper.ConfigurationProvider);
return await query.ToListAsync();
@@ -292,7 +536,7 @@ namespace IRaCIS.Core.Application.Service
await SyncSystemEmainCofigDocListAsync(inQuery.TrialId, inQuery.CriterionTypeEnum);
- var trialEmailNoticeConfigQueryable = _trialEmailNoticeConfigRepository.Where(t=>t.TrialId== inQuery.TrialId)
+ var trialEmailNoticeConfigQueryable = _trialEmailNoticeConfigRepository.Where(t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.CriterionTypeEnum != null, t => t.CriterionTypeEnum == inQuery.CriterionTypeEnum)
.WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum)
.ProjectTo(_mapper.ConfigurationProvider);
@@ -304,7 +548,7 @@ namespace IRaCIS.Core.Application.Service
public async Task AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig)
{
-
+
//var entity = await _trialEmailNoticeConfigRepository.InsertOrUpdateAsync(addOrEditTrialEmailNoticeConfig);
@@ -314,7 +558,7 @@ namespace IRaCIS.Core.Application.Service
var entity = _mapper.Map(addOrEditTrialEmailNoticeConfig);
-
+
entity.TrialEmailNoticeUserList.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.From, UserId = addOrEditTrialEmailNoticeConfig.FromUserId });
@@ -327,7 +571,7 @@ namespace IRaCIS.Core.Application.Service
foreach (var item in addOrEditTrialEmailNoticeConfig.CopyUserIdList)
{
- entity.TrialEmailNoticeUserList.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserId = item});
+ entity.TrialEmailNoticeUserList.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserId = item });
}
@@ -351,7 +595,7 @@ namespace IRaCIS.Core.Application.Service
- trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.From, UserId = addOrEditTrialEmailNoticeConfig.FromUserId,TrialEmailNoticeConfigId=entity.Id });
+ trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.From, UserId = addOrEditTrialEmailNoticeConfig.FromUserId, TrialEmailNoticeConfigId = entity.Id });
foreach (var item in addOrEditTrialEmailNoticeConfig.ToUserIdList)
diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
index bf81cfe4d..29513a1f5 100644
--- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
+++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
@@ -33,7 +33,7 @@ namespace IRaCIS.Core.Application.Image.QA
private readonly AsyncLock _mutex = new AsyncLock();
- public QCOperationService( IRepository subjectVisitRepository,
+ public QCOperationService(IRepository subjectVisitRepository,
IRepository qcChallengeRepository,
IRepository trialRepository,
IRepository dicomStudyRepository,
@@ -112,7 +112,7 @@ namespace IRaCIS.Core.Application.Image.QA
qcChallenge.Code = code + 1;
qcChallenge.UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt;
- qcChallenge.ChallengeCode = AppSettings.GetCodeStr(qcChallenge.Code, nameof(QCChallenge));
+ qcChallenge.ChallengeCode = AppSettings.GetCodeStr(qcChallenge.Code, nameof(QCChallenge));
qcChallenge = await _qcChallengeRepository.AddAsync(qcChallenge, true);
@@ -353,7 +353,7 @@ namespace IRaCIS.Core.Application.Image.QA
sv.CheckUserId = _userInfo.Id;
sv.CheckState = CheckStateEnum.CVPassed;
- sv.ReadingStatus = ReadingStatusEnum.TaskAllocate;
+ sv.ReadingStatus = ReadingStatusEnum.TaskAllocate;
sv.ForwardState = ForwardStateEnum.ToForward;
sv.ManualPassReason = data.ManualPassReason;
@@ -1069,6 +1069,9 @@ namespace IRaCIS.Core.Application.Image.QA
.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification, t.IsUrgent, t.IsHaveFirstGiveMedicineDate, t.ClinicalInformationTransmissionEnum })
.FirstOrDefaultAsync(t => t.TrialId == cRCRequestToQCCommand.TrialId)).IfNullThrowException();
+ //找到符合配置的标准 确认的、双重,有序,阅片期仲裁
+ var trialReadingCriterionIdList = _repository.Where(t => t.TrialId == cRCRequestToQCCommand.TrialId && t.IsConfirm && t.ReadingType == ReadingMethod.Double && t.ArbitrationRule == ArbitrationRule.Reading && t.IsReadingTaskViewInOrder).Select(t => t.Id).ToList();
+
var dbSubjectVisitList = await _subjectVisitRepository.Where(t => cRCRequestToQCCommand.SubjectVisitIds.Contains(t.Id), true).Include(t => t.Subject).ToListAsync();
@@ -1083,7 +1086,7 @@ namespace IRaCIS.Core.Application.Image.QA
{
return ResponseOutput.NotOk("当前访视的影像数据,已经由其他CRC提交。", 3, ApiResponseCodeEnum.NeedTips);
}
- else if(dbSubjectVisitList.Any(t => t.SubmitState == SubmitStateEnum.Submitted))
+ else if (dbSubjectVisitList.Any(t => t.SubmitState == SubmitStateEnum.Submitted))
{
return ResponseOutput.NotOk("当前批量提交访视的影像数据,其中部分已由其他CRC提交。", 3, ApiResponseCodeEnum.NeedTips);
}
@@ -1106,6 +1109,14 @@ namespace IRaCIS.Core.Application.Image.QA
//已确认临床数据完整性
dbSubjectVisit.IsConfirmedClinicalData = true;
+
+ // CRC 上传的基线数据签名
+
+ await _readingClinicalDataRepository.BatchUpdateNoTrackingAsync(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == dbSubjectVisit.Id, x => new ReadingClinicalData()
+ {
+ IsSign = true
+ });
+
//var signSuccess = await _repository.UpdateFromQueryAsync(t => t.Id == cRCRequestToQCCommand.SignId, u => new TrialSign() { IsCompleted = true });
@@ -1123,6 +1134,9 @@ namespace IRaCIS.Core.Application.Image.QA
}
+
+
+
var maxVisit = await _subjectVisitRepository.Where(t => t.SubjectId == dbSubjectVisit.SubjectId && t.SubmitState == SubmitStateEnum.Submitted)
.OrderByDescending(t => t.VisitNum).Select(t => new { t.Id, t.VisitNum }).FirstOrDefaultAsync();
@@ -1175,11 +1189,11 @@ namespace IRaCIS.Core.Application.Image.QA
dbSubjectVisit.CheckState = trialConfig.IsImageConsistencyVerification ? CheckStateEnum.ToCheck : CheckStateEnum.CVPassed;
//维护统一状态
- dbSubjectVisit.ReadingStatus = trialConfig.IsImageConsistencyVerification ? ReadingStatusEnum.ConsistencyCheck: ReadingStatusEnum.TaskAllocate;
+ dbSubjectVisit.ReadingStatus = trialConfig.IsImageConsistencyVerification ? ReadingStatusEnum.ConsistencyCheck : ReadingStatusEnum.TaskAllocate;
- if (dbSubjectVisit.CheckState== CheckStateEnum.CVPassed)
+ if (dbSubjectVisit.CheckState == CheckStateEnum.CVPassed)
{
dbSubjectVisit.CheckPassedTime = DateTime.Now;
}
@@ -1197,22 +1211,50 @@ namespace IRaCIS.Core.Application.Image.QA
dbSubjectVisit.AuditState = AuditStateEnum.ToAudit;
}
+ //非基线设置为PD的话 根据配置自动生成阅片期
+ if (!dbSubjectVisit.IsBaseLine && dbSubjectVisit.PDState == PDStateEnum.PDProgress)
+ {
+ //该标准需要添加阅片期
+ foreach (var trialReadingCriterionId in trialReadingCriterionIdList)
+ {
+ //不存在该阅片期 (重传、回退都会重新提交)
+ if (!await _repository.Where(t => t.SubjectVisitId == dbSubjectVisit.Id && t.ReadingSetType == ReadingSetType.ImageReading && t.TrialReadingCriterionId == trialReadingCriterionId).AnyAsync())
+ {
+
+ await _repository.AddAsync(new ReadModule()
+ {
+ TrialReadingCriterionId = trialReadingCriterionId,
+ ReadingSetType = ReadingSetType.ImageReading,
+ SubjectVisitId = dbSubjectVisit.Id,
+ ModuleName = "",
+ IsUrgent = dbSubjectVisit.IsUrgent,
+ TrialId = dbSubjectVisit.TrialId,
+ SubjectId = dbSubjectVisit.SubjectId
+ });
+
+ }
+
+ }
+
+
+
+ }
+
}
- // CRC 上传的基线数据签名
- #region CRC 上传的基线数据签名
- var subjectVisit =await _subjectVisitRepository.Where(x => cRCRequestToQCCommand.SubjectVisitIds.Contains(x.Id) && x.IsBaseLine).Select(x => new
- {
- x.Id,
- x.IsBaseLine
- }).FirstOrDefaultAsync();
- if (subjectVisit != null)
- {
- await _readingClinicalDataRepository.BatchUpdateNoTrackingAsync(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == subjectVisit.Id, x => new ReadingClinicalData()
- {
- IsSign = true
- });
- }
+ #region CRC 上传的基线数据签名 已移动
+ //var subjectVisit =await _subjectVisitRepository.Where(x => cRCRequestToQCCommand.SubjectVisitIds.Contains(x.Id) && x.IsBaseLine).Select(x => new
+ //{
+ // x.Id,
+ // x.IsBaseLine
+ //}).FirstOrDefaultAsync();
+ //if (subjectVisit != null)
+ //{
+ // await _readingClinicalDataRepository.BatchUpdateNoTrackingAsync(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == subjectVisit.Id, x => new ReadingClinicalData()
+ // {
+ // IsSign = true
+ // });
+ //}
@@ -1380,12 +1422,12 @@ namespace IRaCIS.Core.Application.Image.QA
else if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit)
{
// 双审
- if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC )
+ if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC)
{
dbSubjectVisit.AuditState = AuditStateEnum.QCFailed;
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id;
}
- else if( dbSubjectVisit.AuditState == AuditStateEnum.InSecondaryQC)
+ else if (dbSubjectVisit.AuditState == AuditStateEnum.InSecondaryQC)
{
dbSubjectVisit.AuditState = AuditStateEnum.QCFailed;
dbSubjectVisit.ReviewAuditUserId = _userInfo.Id;
diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs
index 93819b912..08cd280fb 100644
--- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs
@@ -121,7 +121,9 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.CurrentActionUserName, u => u.MapFrom(s => s.CurrentActionUser.UserName))
.ForMember(d => d.PreliminaryAuditUserName, u => u.MapFrom(s => s.PreliminaryAuditUser.UserName))
.ForMember(d => d.ReviewAuditUserName, u => u.MapFrom(s => s.ReviewAuditUser.UserName))
- .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.ReadingClinicalDataList.Any(x=>x.ClinicalDataTrialSet.UploadRole==Domain.Share.UploadRole.CRC&&x.ReadingClinicalDataPDFList.Count()>0) || t.PreviousSurgeryList.Any() : false))
+ .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any()
+ || t.ReadingClinicalDataList.Any(x => x.ClinicalDataTrialSet.UploadRole == Domain.Share.UploadRole.CRC && x.ReadingClinicalDataPDFList.Count() > 0)
+ || t.PreviousSurgeryList.Any() : false))
.ForMember(d => d.DicomStudyCount, u => u.MapFrom(t => t.StudyList.Count()))
.ForMember(d => d.NoneDicomStudyCount, u => u.MapFrom(t => t.NoneDicomStudyList.Count(t => t.NoneDicomFileList.Any())));
@@ -137,7 +139,9 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.MedicalNo, u => u.MapFrom(s => s.Subject.MedicalNo))
.ForMember(d => d.Sex, u => u.MapFrom(s => s.Subject.Sex))
.ForMember(d => d.Age, u => u.MapFrom(t => t.Subject.Age))
- .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.ReadingClinicalDataList.Any(x => x.ClinicalDataTrialSet.UploadRole == Domain.Share.UploadRole.CRC && x.ReadingClinicalDataPDFList.Count() > 0) || t.PreviousSurgeryList.Any() : false))
+ .ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any()
+ || t.ReadingClinicalDataList.Any(x => x.ClinicalDataTrialSet.UploadRole == Domain.Share.UploadRole.CRC && x.ReadingClinicalDataPDFList.Count() > 0)
+ || t.PreviousSurgeryList.Any() : false))
//.ForMember(d => d.VisitName, u => u.MapFrom(t =>t.InPlan? t.VisitStage.VisitName : t.VisitName))
//.ForMember(d => d.VisitNum, u => u.MapFrom(t => t.InPlan ? t.VisitStage.VisitNum : t.VisitNum))
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs
index 245a544dc..67662304e 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingMedicineQuestionViewModel.cs
@@ -6,385 +6,381 @@ using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel
{
- public class ReadingMedicineSystemQuestionView
- {
- public Guid Id { get; set; }
-
- ///
- /// 类型
- ///
- public string Type { get; set; }
-
- ///
- /// 父问题触发
- ///
- public string ParentTriggerValue { get; set; } = string.Empty;
-
- ///
- /// 问题名称
- ///
- public string QuestionName { get; set; }
-
- ///
- /// 是否是必须
- ///
- public bool IsRequired { get; set; }
-
- ///
- /// 排序
- ///
- public int ShowOrder { get; set; }
-
- ///
- /// 父问题ID
- ///
- public Guid? ParentId { get; set; }
-
- ///
- /// 类型值
- ///
- public string TypeValue { get; set; }
-
- ///
- /// 是否启用
- ///
- public bool IsEnable { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory ReadingCategory { get; set; }
-
-
- ///
- /// 排序
- ///
- public int? ParentShowOrder { get; set; }
- }
-
- ///ReadingMedicineSystemQuestionQuery 列表查询参数模型
- public class ReadingMedicineSystemQuestionQuery
- {
- public string Type { get; set; }=string.Empty;
- public string ParentTriggerValue { get; set; } = string.Empty;
- public string QuestionName { get; set; } = string.Empty;
- public string TypeValue { get; set; } = string.Empty;
-
- ///
- /// 任务类型
- ///
- public ReadingCategory? ReadingCategory { get; set; }
-
- }
-
-
- public class GetReadingMedicineTrialOtherQuestionOutDto
- {
- public Guid Id { get; set; }
-
- public string QuestionName { get; set; }
-
- ///
- /// 类型值
- ///
- public string TypeValue { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory ReadingCategory { get; set; }
- }
-
- public class DeleteReadingMedicineTrialQuestion
- {
- public Guid TrialId { get; set; }
-
- public Guid Id { get; set; }
- }
-
- public class TrialDataFromSystem : ReadingMedicineTrialQuestion
- {
- public Guid SystemQuestionId { get; set; }
- }
- public class AddTrialDataFromSystemInDto
- {
- public Guid TrialId { get; set; }
-
- [NotDefault]
- public Guid TrialReadingCriterionId { get; set; }
-
- public List SystemQuestionIds { get; set; }
- }
-
- public class ConfirmReadingMedicineQuestionInDto
+ public class ReadingMedicineSystemQuestionView
{
- [NotDefault]
- public Guid TrialId { get; set; }
+ public Guid Id { get; set; }
- [NotDefault]
- public Guid TrialReadingCriterionId { get; set; }
- }
+ ///
+ /// 类型
+ ///
+ public string Type { get; set; }
- public class TrialQuestion
+ ///
+ /// 父问题触发
+ ///
+ public string ParentTriggerValue { get; set; } = string.Empty;
+
+ ///
+ /// 问题名称
+ ///
+ public string QuestionName { get; set; }
+
+ ///
+ /// 是否是必须
+ ///
+ public bool IsRequired { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int ShowOrder { get; set; }
+
+ ///
+ /// 父问题ID
+ ///
+ public Guid? ParentId { get; set; }
+
+ ///
+ /// 类型值
+ ///
+ public string TypeValue { get; set; }
+
+ ///
+ /// 是否启用
+ ///
+ public bool IsEnable { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory ReadingCategory { get; set; }
+
+
+ ///
+ /// 排序
+ ///
+ public int? ParentShowOrder { get; set; }
+ }
+
+ ///ReadingMedicineSystemQuestionQuery 列表查询参数模型
+ public class ReadingMedicineSystemQuestionQuery
{
- public Guid Id { get; set; }
+ public string Type { get; set; } = string.Empty;
+ public string ParentTriggerValue { get; set; } = string.Empty;
+ public string QuestionName { get; set; } = string.Empty;
+ public string TypeValue { get; set; } = string.Empty;
- public int ShowOrder { get; set; }
+ public int? CriterionEnum { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory? ReadingCategory { get; set; }
+
+ }
- public int? ParentShowOrder { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory ReadingCategory { get; set; }
- }
-
- public class GetReadingMedicineSystemOtherQuestionInDto
- {
- public Guid? Id { get; set; }
-
-
-
- public int? ShowOrder { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory? ReadingCategory { get; set; }
-
- }
-
- ///
- /// 获取项目的其他问题
- ///
- public class GetReadingMedicineTrialOtherQuestionInDto
- {
- public Guid TrialId { get; set; }
-
- public Guid? Id { get; set; }
-
- public int? ShowOrder { get; set; }
-
-
- [NotDefault]
- public Guid TrialReadingCriterionId { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory? ReadingCategory { get; set; }
- }
-
-
- /// ReadingMedicineSystemQuestionAddOrEdit 列表查询参数模型
- public class ReadingMedicineSystemQuestionAddOrEdit
- {
- public Guid? Id { get; set; }
-
- ///
- /// 类型
- ///
- public string Type { get; set; }
-
- ///
- /// 父问题触发
- ///
- public string ParentTriggerValue { get; set; } = string.Empty;
-
- ///
- /// 问题名称
- ///
- public string QuestionName { get; set; }
-
- ///
- /// 是否是必须
- ///
- public bool IsRequired { get; set; }
-
- ///
- /// 排序
- ///
- public int ShowOrder { get; set; }
-
- ///
- /// 父问题ID
- ///
- public Guid? ParentId { get; set; }
-
- ///
- /// 类型值
- ///
- public string TypeValue { get; set; }
-
- ///
- /// 是否启用
- ///
- public bool IsEnable { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory ReadingCategory { get; set; }
- }
-
- public class ReadingMedicineTrialQuestionView
- {
- public Guid Id { get; set; }
- public DateTime CreateTime { get; set; }
- public string Type { get; set; }
- public string ParentTriggerValue { get; set; }
- public string QuestionName { get; set; }
- public Guid UpdateUserId { get; set; }
- public string TypeValue { get; set; }
- public Guid CreateUserId { get; set; }
- public Guid TrialId { get; set; }
- public DateTime UpdateTime { get; set; }
- public bool IsEnable { get; set; }
- public bool IsRequired { get; set; }
- public int ShowOrder { get; set; }
- public Guid? ParentId { get; set; }
- public bool? IsConfirm { get; set; }
-
- public int? ParentShowOrder { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory ReadingCategory { get; set; }
- }
-
-
- public class GetMedicineQuestionPreviewInDto
- {
- public Guid TrialId { get; set; }
-
- [NotDefault]
- public Guid TrialReadingCriterionId { get; set; }
-
- ///
- /// 任务类型
- ///
- public ReadingCategory? ReadingCategory { get; set; }
- }
-
-
- public class GetMedicineQuestionPreviewOutDto
- {
- public Guid Id { get; set; }
-
- ///
- /// 类型
- ///
- public string Type { get; set; }
-
- ///
- /// 父问题触发值
- ///
- public string ParentTriggerValue { get; set; } = string.Empty;
-
- ///
- /// 问题名称
- ///
- public string QuestionName { get; set; }
-
-
-
- ///
- /// 类型值
- ///
- public string TypeValue { get; set; }
-
-
-
- ///
- /// 项目ID
- ///
- public Guid TrialId { get; set; }
-
-
-
- ///
- /// 是否启用
- ///
- public bool IsEnable { get; set; }
-
- ///
- /// 是否必须
- ///
- public bool IsRequired { get; set; }
-
- ///
- /// 排序
- ///
- public int ShowOrder { get; set; }
-
- ///
- /// 父问题
- ///
- public Guid? ParentId { get; set; }
-
- ///
- /// 是否确认
- ///
- public bool? IsConfirm { get; set; }
-
- public List Childrens { get; set; }
- }
-
- ///ReadingMedicineTrialQuestionQuery 列表查询参数模型
- public class ReadingMedicineTrialQuestionQuery
+ public class GetReadingMedicineTrialOtherQuestionOutDto
{
- ///
- /// 项目Id
- ///
- public Guid TrialId { get; set; }
+ public Guid Id { get; set; }
-
- public Guid TrialReadingCriterionId { get; set; }
+ public string QuestionName { get; set; }
- public string Type { get; set; } = string.Empty;
+ ///
+ /// 类型值
+ ///
+ public string TypeValue { get; set; }
- public string ParentTriggerValue { get; set; } = string.Empty;
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory ReadingCategory { get; set; }
+ }
- public string QuestionName { get; set; } = string.Empty;
+ public class DeleteReadingMedicineTrialQuestion
+ {
+ public Guid TrialId { get; set; }
- public string TypeValue { get; set; } = string.Empty;
+ public Guid Id { get; set; }
+ }
- ///
- /// 任务类型
- ///
- public ReadingCategory? ReadingCategory { get; set; }
+ public class TrialDataFromSystem : ReadingMedicineTrialQuestion
+ {
+ public Guid SystemQuestionId { get; set; }
+ }
+ public class AddTrialDataFromSystemInDto
+ {
+ public Guid TrialId { get; set; }
- }
+ [NotDefault]
+ public Guid TrialReadingCriterionId { get; set; }
+
+ public List SystemQuestionIds { get; set; }
+ }
+
+ public class ConfirmReadingMedicineQuestionInDto
+ {
+ [NotDefault]
+ public Guid TrialId { get; set; }
+
+ [NotDefault]
+ public Guid TrialReadingCriterionId { get; set; }
+ }
+
+ public class TrialQuestion
+ {
+ public Guid Id { get; set; }
+
+ public int ShowOrder { get; set; }
+
+
+ public int? ParentShowOrder { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory ReadingCategory { get; set; }
+ }
+
+ public class GetReadingMedicineSystemOtherQuestionInDto
+ {
+ public Guid? Id { get; set; }
+
+
+
+ public int? ShowOrder { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory? ReadingCategory { get; set; }
+
+ }
+
+ ///
+ /// 获取项目的其他问题
+ ///
+ public class GetReadingMedicineTrialOtherQuestionInDto
+ {
+ public Guid TrialId { get; set; }
+
+ public Guid? Id { get; set; }
+
+ public int? ShowOrder { get; set; }
+
+
+ [NotDefault]
+ public Guid TrialReadingCriterionId { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory? ReadingCategory { get; set; }
+ }
+
+
+ /// ReadingMedicineSystemQuestionAddOrEdit 列表查询参数模型
+ public class ReadingMedicineSystemQuestionAddOrEdit
+ {
+ public Guid? Id { get; set; }
+
+ ///
+ /// 类型
+ ///
+ public string Type { get; set; }
+
+ ///
+ /// 父问题触发
+ ///
+ public string ParentTriggerValue { get; set; } = string.Empty;
+
+ ///
+ /// 问题名称
+ ///
+ public string QuestionName { get; set; }
+
+ ///
+ /// 是否是必须
+ ///
+ public bool IsRequired { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int ShowOrder { get; set; }
+
+ ///
+ /// 父问题ID
+ ///
+ public Guid? ParentId { get; set; }
+
+ ///
+ /// 类型值
+ ///
+ public string TypeValue { get; set; }
+
+ ///
+ /// 是否启用
+ ///
+ public bool IsEnable { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory ReadingCategory { get; set; }
+
+
+ public string CriterionEnumStr { get; set; } = string.Empty;
+
+ public List CriterionEnumList { get; set; }
+ }
+
+ public class ReadingMedicineTrialQuestionView : ReadingMedicineSystemQuestionAddOrEdit
+ {
+ public DateTime CreateTime { get; set; }
+
+ public Guid UpdateUserId { get; set; }
+ public Guid CreateUserId { get; set; }
+ public Guid TrialId { get; set; }
+ public DateTime UpdateTime { get; set; }
+
+ public bool? IsConfirm { get; set; }
+
+ public int? ParentShowOrder { get; set; }
+
+ }
+
+
+ public class GetMedicineQuestionPreviewInDto
+ {
+ public Guid TrialId { get; set; }
+
+ [NotDefault]
+ public Guid TrialReadingCriterionId { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory? ReadingCategory { get; set; }
+ }
+
+
+ public class GetMedicineQuestionPreviewOutDto
+ {
+ public Guid Id { get; set; }
+
+ ///
+ /// 类型
+ ///
+ public string Type { get; set; }
+
+ ///
+ /// 父问题触发值
+ ///
+ public string ParentTriggerValue { get; set; } = string.Empty;
+
+ ///
+ /// 问题名称
+ ///
+ public string QuestionName { get; set; }
+
+
+
+ ///
+ /// 类型值
+ ///
+ public string TypeValue { get; set; }
+
+
+
+ ///
+ /// 项目ID
+ ///
+ public Guid TrialId { get; set; }
+
+
+
+ ///
+ /// 是否启用
+ ///
+ public bool IsEnable { get; set; }
+
+ ///
+ /// 是否必须
+ ///
+ public bool IsRequired { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int ShowOrder { get; set; }
+
+ ///
+ /// 父问题
+ ///
+ public Guid? ParentId { get; set; }
+
+ ///
+ /// 是否确认
+ ///
+ public bool? IsConfirm { get; set; }
+
+ public List Childrens { get; set; }
+ }
+
+ ///ReadingMedicineTrialQuestionQuery 列表查询参数模型
+ public class ReadingMedicineTrialQuestionQuery
+ {
+ ///
+ /// 项目Id
+ ///
+ public Guid TrialId { get; set; }
+
+
+ public Guid TrialReadingCriterionId { get; set; }
+
+ public string Type { get; set; } = string.Empty;
+
+ public string ParentTriggerValue { get; set; } = string.Empty;
+
+ public string QuestionName { get; set; } = string.Empty;
+
+ public string TypeValue { get; set; } = string.Empty;
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory? ReadingCategory { get; set; }
+
+ }
/// ReadingMedicineTrialQuestionAddOrEdit 列表查询参数模型
- public class ReadingMedicineTrialQuestionAddOrEdit
- {
- public Guid? Id { get; set; }
+ public class ReadingMedicineTrialQuestionAddOrEdit
+ {
+ public Guid? Id { get; set; }
- [NotDefault]
- public Guid TrialReadingCriterionId { get; set; }
+ [NotDefault]
+ public Guid TrialReadingCriterionId { get; set; }
- public string Type { get; set; }
- public string? ParentTriggerValue { get; set; }=string.Empty;
- public string QuestionName { get; set; }
- public string TypeValue { get; set; }
- public Guid TrialId { get; set; }
-
- public bool IsEnable { get; set; }
- public bool IsRequired { get; set; }
- public int ShowOrder { get; set; }
- public Guid? ParentId { get; set; }
- public bool? IsConfirm { get; set; }
+ public string Type { get; set; }
+ public string? ParentTriggerValue { get; set; } = string.Empty;
+ public string QuestionName { get; set; }
+ public string TypeValue { get; set; }
+ public Guid TrialId { get; set; }
+
+ public bool IsEnable { get; set; }
+ public bool IsRequired { get; set; }
+ public int ShowOrder { get; set; }
+ public Guid? ParentId { get; set; }
+ public bool? IsConfirm { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public ReadingCategory ReadingCategory { get; set; }
+ }
- ///
- /// 任务类型
- ///
- public ReadingCategory ReadingCategory { get; set; }
- }
-
}
diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs
index 710fa27ee..eb3ecdac9 100644
--- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs
@@ -50,7 +50,8 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(!inDto.ParentTriggerValue.IsNullOrEmpty(), x => x.ParentTriggerValue.Contains(inDto.ParentTriggerValue))
.WhereIf(!inDto.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inDto.QuestionName))
.WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type.Contains(inDto.Type))
- .WhereIf(inDto.ReadingCategory != null, x => x.ReadingCategory == inDto.ReadingCategory)
+ .WhereIf(inDto.ReadingCategory != null, x => x.ReadingCategory == inDto.ReadingCategory)
+ .WhereIf(inDto.CriterionEnum != null, x => x.CriterionEnumStr.Contains($"|{inDto.CriterionEnum}|") )
.ProjectTo(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder);
return await query.ToListAsync();
}
@@ -100,6 +101,9 @@ namespace IRaCIS.Core.Application.Service
{
return ResponseOutput.NotOk("当前问题序号存在重复");
}
+
+ inDto.CriterionEnumStr = $"|{String.Join('|', inDto.CriterionEnumList)}|";
+
var entity = await _readingMedicineSystemQuestionRepository.InsertOrUpdateAsync(inDto);
await _readingMedicineSystemQuestionRepository.SaveChangesAsync();
return ResponseOutput.Ok(entity.Id.ToString());
@@ -121,6 +125,7 @@ namespace IRaCIS.Core.Application.Service
var result = await _readingMedicineSystemQuestionRepository.SaveChangesAsync();
return ResponseOutput.Result(result);
}
+
#endregion
diff --git a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs
index 49b4348d9..c9411b234 100644
--- a/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs
+++ b/IRaCIS.Core.Domain/Reading/MedicalAudit/ReadingMedicineSystemQuestion.cs
@@ -7,6 +7,9 @@ using System;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using System.Collections.Generic;
+using System.Linq;
+
namespace IRaCIS.Core.Domain.Models
{
///
@@ -86,5 +89,12 @@ namespace IRaCIS.Core.Domain.Models
[ForeignKey("ParentId")]
public ReadingMedicineSystemQuestion ParentQuestion { get; set; }
- }
+
+ // |1|2| 这种保存
+ public string CriterionEnumStr { get; set; } = string.Empty;
+
+ [NotMapped]
+ public List CriterionEnumList => CriterionEnumStr.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t)).Select(t=> Convert.ToInt32(t.Trim()) ).ToList();
+
+ }
}