Uat_Study
hang 2023-04-03 09:37:35 +08:00
commit 6d7b09d73f
26 changed files with 534 additions and 287 deletions

View File

@ -1108,6 +1108,14 @@
<param name="visitTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.AddConvertedTaskFocus(System.Guid,System.Guid)">
<summary>
添加转化任务病灶信息
</summary>
<param name="visitTaskId"></param>
<param name="beforeConvertedTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.GetReadingReportTaskList(System.Guid)">
<summary>
获取阅片报告任务List
@ -2157,6 +2165,14 @@
<param name="visitTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.IGeneralCalculateService.AddConvertedTaskFocus(System.Guid,System.Guid)">
<summary>
添加转化任务病灶信息
</summary>
<param name="visitTaskId"></param>
<param name="beforeConvertedTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.IReadingCalculateService.CalculateTask(IRaCIS.Core.Application.Service.Reading.Dto.CalculateTaskInDto)">
<summary>
自动计算 并修改值

View File

@ -140,10 +140,14 @@
// ------------------------------------------------------------Doctor--------------------------------------------------------------------
//DoctorService
"Doctor_DupPhoneOrEmail": "current phone or email number already existed",
"Doctor_DupPhone": "The current phone number already existed!",
"Doctor_DupEmail": "The current email already existed!",
"Doctor_StandardDuplicateFileTypeError": "This type of file has already been added to the current criterion.",
"Doctor_RequiredDocumentsError": "Resume & Consultant Agreement must be upload ",
// ------------------------------------------------------------Document--------------------------------------------------------------------
//SystemDocumentService
"SystemD_DuplicateFile": "A file of the same type and name already exists in the system.",
@ -432,9 +436,11 @@
"TrialSite_ParticipantJoined": "The subjects has been added to this site, and couldn't be disable.",
"TrialSite_CodeDuplicate": "Code is not allowed to be repeated",
"TrialSite_CannotDeleteAssociatedCRC": "The site has been associated with CRC, and couldn't be deleted.",
"TrialSite_CannotDeleteAssociatedSubject": "The subjects has been added to this site, and couldn't be deleted.",
"TrialSite_CannotDeleteUploadedData": "The site has been uploaded study, and couldn't be deleted.",
// ------------------------------------------------------------Visit--------------------------------------------------------------------
//SubjectService
"Subject_NoConfirmedPlan": "The visit plan of the project is not confirmed. Please contact the program Manager to confirm the visit plan before adding subjects.",

View File

@ -131,9 +131,13 @@
"Mail_AccountPasswordResetReminder": "[来自展影IRC] 关于重置账户密码的提醒",
"Mail_InvitationEmail": "[来自展影IRC] [{0}]邀请信",
// ------------------------------------------------------------Doctor--------------------------------------------------------------------
"Doctor_DupPhoneOrEmail": "当前的电话或电子邮件号码已经存在",
"Doctor_DupPhone": "当前的电话号码已经存在!",
"Doctor_DupEmail": "当前的邮箱已经存在!",
"Doctor_StandardDuplicateFileTypeError": "当前标准已添加过此类型文件",
"Doctor_RequiredDocumentsError": "简历及顾问协议必须上传",
// ------------------------------------------------------------Document--------------------------------------------------------------------
//SystemDocumentService
"SystemD_DuplicateFile": "系统中已存在同类型的同名文件。",
@ -410,8 +414,10 @@
"TrialSite_ParticipantJoined": "已有受试者加入中心,无法禁用",
"TrialSite_CodeDuplicate": "代码不能重复",
"TrialSite_CannotDeleteAssociatedCRC": "中心已经和CRC关联不能删除",
"TrialSite_CannotDeleteAssociatedSubject": "受试者已经添加,不能删除",
"TrialSite_CannotDeleteUploadedData": "中心已经上传调研,无法删除",
// ------------------------------------------------------------Visit--------------------------------------------------------------------
//SubjectService
"Subject_NoConfirmedPlan": "项目访视计划没有确认。请联系项目经理确认项目访视计划后,再添加受试者。",

View File

@ -115,7 +115,7 @@ namespace IRaCIS.Core.Application.Service
public async Task AddConvertedTask(Guid taskId)
{
var originalTask = await _visitTaskRepository.Where(x => x.Id == taskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == taskId).IgnoreAutoIncludes().AsNoTracking().FirstNotNullAsync();
taskInfo.ReadingTaskState = ReadingTaskState.Reading;
@ -144,126 +144,7 @@ namespace IRaCIS.Core.Application.Service
});
var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().AsNoTracking().ToListAsync();
taskAnswer.ForEach(x => {
x.VisitTaskId = taskInfo.Id;
x.Id = NewId.NextGuid();
});
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == taskId).AsNoTracking().ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).IgnoreAutoIncludes().ToListAsync();
tableRowAnswers.ForEach(x =>
{
x.VisitTaskId = taskInfo.Id;
x.IsCurrentTaskAdd = false;
x.FristAddTaskId = taskInfo.Id;
x.Id = NewId.NextGuid();
});
tableRowAnswers.ForEach(x =>
{
x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault();
x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault();
});
var tableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().AsNoTracking().ToListAsync();
tableAnswer.ForEach(x =>
{
x.Id = NewId.NextGuid();
x.VisitTaskId = taskInfo.Id;
x.RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault();
});
var addrowInfo = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
switch (originalTask.TrialReadingCriterion.CriterionType)
{
case CriterionType.IRECIST1Point1:
//非靶病灶全部数据复制,不可更改。支持如果状态为:显著增大需要自动改为: 显著增大(iUPD)
var stateQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == originalTask.TrialReadingCriterionId
&& x.ReadingQuestionTrial.LesionType == LesionType.NonTargetLesions && x.QuestionMark == QuestionMark.State).Select(x => x.Id).FirstOrDefaultAsync();
tableAnswer.ForEach(x =>
{
if (x.TableQuestionId == stateQuestionId && x.Answer.EqEnum(NoTargetState.Increase))
{
x.Answer = NoTargetState.IUPD.GetEnumInt();
}
});
// 新转换为其它既往新病灶: 状态为消失、疑似、无法评估的新病灶自动转换为:其它既往新病灶,且不可以编辑
// 找到新病灶问题
var newLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == originalTask.TrialReadingCriterionId && x.LesionType == LesionType.NewLesions).FirstOrDefaultAsync();
// 找到其他既往新病灶
var otherLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == originalTask.TrialReadingCriterionId && x.LesionType == LesionType.OtherPreviousNewLesion).FirstOrDefaultAsync();
if (newLesionQuestion != null && otherLesionQuestion != null)
{
// 找到表格问题
var newLesionTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == newLesionQuestion.Id).ToListAsync();
// 找到表格问题
var otherLesionTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == otherLesionQuestion.Id).ToListAsync();
// 找到病灶状态
var newstateQuestionId = newLesionTableQuestionList.Where(x => x.QuestionMark == QuestionMark.State).Select(x => x.Id).FirstOrDefault();
var stateAnswers = new List<string>() {
NewLesionState.Loss.GetEnumInt(),
NewLesionState.Suspected.GetEnumInt(),
NewLesionState.UnableEvaluate.GetEnumInt()
};
var needRowIds = tableAnswer.Where(x => x.TableQuestionId == newstateQuestionId && stateAnswers.Contains(x.Answer)).Select(x => x.RowId).Distinct().ToList();
addrowInfo.ForEach(x =>
{
if (needRowIds.Contains(x.Id))
{
x.QuestionId = otherLesionQuestion.Id;
x.OrderMark = otherLesionQuestion.OrderMark;
x.RowMark = otherLesionQuestion.OrderMark + x.RowIndex.GetLesionMark();
}
});
tableAnswer.ForEach(x =>
{
if (needRowIds.Contains(x.RowId))
{
x.QuestionId = otherLesionQuestion.Id;
var newLesionTableQuestion = newLesionTableQuestionList.Where(y => y.Id == x.TableQuestionId).FirstOrDefault();
if (newLesionTableQuestion != null)
{
x.TableQuestionId = otherLesionTableQuestionList.Where(y => y.QuestionMark == newLesionTableQuestion.QuestionMark).Select(x => x.Id).FirstOrDefault();
}
}
});
}
break;
}
await _readingTaskQuestionAnswerRepository.AddRangeAsync(taskAnswer);
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addrowInfo);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswer);
await _visitTaskRepository.SaveChangesAsync();
}

View File

@ -60,7 +60,8 @@ namespace IRaCIS.Application.Services
{
Expression<Func<Doctor, bool>> verifyExp = t => t.Phone == basicInfoModel.Phone || t.EMail == basicInfoModel.EMail;
var verifyPair = new KeyValuePair<Expression<Func<Doctor, bool>>, string>(verifyExp, "current phone or email number already existed");
//---current phone or email number already existed
var verifyPair = new KeyValuePair<Expression<Func<Doctor, bool>>, string>(verifyExp, _localizer["Doctor_DupPhoneOrEmail"]);
if (basicInfoModel.Id == Guid.Empty || basicInfoModel.Id == null)
{
@ -70,12 +71,14 @@ namespace IRaCIS.Application.Services
//验证用户手机号
if (await _doctorRepository.AnyAsync(t => t.Phone == doctor.Phone))
{
return ResponseOutput.NotOk("The current phone number already existed!", new DoctorBasicInfoCommand());
//---The current phone number already existed!
return ResponseOutput.NotOk(_localizer["Doctor_DupPhone"], new DoctorBasicInfoCommand());
}
if (await _doctorRepository.AnyAsync(t => t.EMail == doctor.EMail))
{
return ResponseOutput.NotOk("The current email already existed!", new DoctorBasicInfoCommand());
//---The current email already existed!
return ResponseOutput.NotOk(_localizer["Doctor_DupEmail"], new DoctorBasicInfoCommand());
}
doctor.Code = (await _doctorRepository.MaxAsync(t => t.Code)) + 1;
@ -105,12 +108,14 @@ namespace IRaCIS.Application.Services
var phone = updateModel.Phone.Trim();
if ((await _doctorRepository.FirstOrDefaultAsync(t => t.Phone == phone && t.Id != updateModel.Id)) != null)
{
return ResponseOutput.NotOk("The current phone number already existed!", new DoctorBasicInfoCommand());
//---The current phone number already existed!
return ResponseOutput.NotOk(_localizer["Doctor_DupPhone"], new DoctorBasicInfoCommand());
}
var email = updateModel.EMail.Trim();
if (await _doctorRepository.AnyAsync(t => t.EMail == email && t.Id != updateModel.Id))
{
return ResponseOutput.NotOk("The current email already existed!", new DoctorBasicInfoCommand());
//---The current email already existed!
return ResponseOutput.NotOk(_localizer["Doctor_DupEmail"], new DoctorBasicInfoCommand());
}
var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == updateModel.Id).IfNullThrowException();

View File

@ -2436,24 +2436,43 @@ namespace IRaCIS.Application.Services
// 既往任务Id
List<Guid> pastResultTaskIdList = new List<Guid>();
// 冻结任务Id
List<Guid> reportRelatedTaskIdList = new List<Guid>();
if (isReadingTaskViewInOrder)
{
pastResultTaskIdList = await _visitTaskRepository.Where(x =>
x.TrialId == taskInfo.TrialId &&
x.SubjectId == taskInfo.SubjectId &&
x.VisitTaskNum <= taskInfo.VisitTaskNum &&
x.VisitTaskNum < taskInfo.VisitTaskNum &&
x.ArmEnum == taskInfo.ArmEnum &&
x.DoctorUserId == taskInfo.DoctorUserId &&
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
(x.TaskState == TaskState.Effect||x.TaskState== TaskState.Freeze) &&
x.TaskState == TaskState.Effect &&
x.IsSelfAnalysis == taskInfo.IsSelfAnalysis &&
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
x.ReadingCategory == taskInfo.ReadingCategory &&
x.Id != taskInfo.Id
).OrderBy(x=>x.VisitTaskNum).ThenBy(x=>x.TaskState).Select(x => x.Id).ToListAsync();
reportRelatedTaskIdList = await _visitTaskRepository.Where(x =>
x.TrialId == taskInfo.TrialId &&
x.SubjectId == taskInfo.SubjectId &&
x.VisitTaskNum <= taskInfo.VisitTaskNum &&
x.ArmEnum == taskInfo.ArmEnum &&
x.DoctorUserId == taskInfo.DoctorUserId &&
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
(x.TaskState == TaskState.Effect||x.TaskState==TaskState.Freeze) &&
x.IsSelfAnalysis == taskInfo.IsSelfAnalysis &&
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
x.ReadingCategory == taskInfo.ReadingCategory &&
x.Id != taskInfo.Id
).OrderBy(x => x.VisitTaskNum).ThenBy(x => x.TaskState).Select(x => x.Id).ToListAsync();
switch (taskInfo.ReadingCategory)
{
case ReadingCategory.Visit:
@ -2485,7 +2504,7 @@ namespace IRaCIS.Application.Services
{
ReportRelatedTaskIds = JsonConvert.SerializeObject(reportRelatedTaskIdList),
PastResultTaskIds = JsonConvert.SerializeObject(pastResultTaskIdList),
RelatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList),
});
@ -2504,6 +2523,13 @@ namespace IRaCIS.Application.Services
RelevanceType = RelevanceType.Related,
}));
await _readingTaskRelationRepository.AddRangeAsync(reportRelatedTaskIdList.Select(x => new ReadingTaskRelation()
{
RelevanceTaskId = x,
TaskId = visitTaskId,
RelevanceType = RelevanceType.ReportResult,
}));
await _visitTaskRepository.SaveChangesAsync();
}

View File

@ -1,6 +1,7 @@
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using MassTransit;
using System;
using System.Collections.Generic;
using System.Linq;
@ -141,6 +142,140 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
return readingData;
}
/// <summary>
/// 添加转化任务病灶信息
/// </summary>
/// <param name="visitTaskId"></param>
/// <param name="beforeConvertedTaskId"></param>
/// <returns></returns>
public async Task AddConvertedTaskFocus(Guid visitTaskId, Guid beforeConvertedTaskId)
{
var originalTask = await _visitTaskRepository.Where(x => x.Id == beforeConvertedTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().AsNoTracking().ToListAsync();
taskAnswer.ForEach(x => {
x.VisitTaskId = beforeConvertedTaskId;
x.Id = NewId.NextGuid();
});
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).AsNoTracking().ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).IgnoreAutoIncludes().ToListAsync();
tableRowAnswers.ForEach(x =>
{
x.VisitTaskId = beforeConvertedTaskId;
x.IsCurrentTaskAdd = false;
x.FristAddTaskId = beforeConvertedTaskId;
x.Id = NewId.NextGuid();
});
tableRowAnswers.ForEach(x =>
{
x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault();
x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault();
});
var tableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).IgnoreAutoIncludes().AsNoTracking().ToListAsync();
tableAnswer.ForEach(x =>
{
x.Id = NewId.NextGuid();
x.VisitTaskId = beforeConvertedTaskId;
x.RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault();
});
var addrowInfo = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
switch (originalTask.TrialReadingCriterion.CriterionType)
{
case CriterionType.IRECIST1Point1:
//非靶病灶全部数据复制,不可更改。支持如果状态为:显著增大需要自动改为: 显著增大(iUPD)
var stateQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == originalTask.TrialReadingCriterionId
&& x.ReadingQuestionTrial.LesionType == LesionType.NonTargetLesions && x.QuestionMark == QuestionMark.State).Select(x => x.Id).FirstOrDefaultAsync();
tableAnswer.ForEach(x =>
{
if (x.TableQuestionId == stateQuestionId && x.Answer.EqEnum(NoTargetState.Increase))
{
x.Answer = NoTargetState.IUPD.GetEnumInt();
}
});
// 新转换为其它既往新病灶: 状态为消失、疑似、无法评估的新病灶自动转换为:其它既往新病灶,且不可以编辑
// 找到新病灶问题
var newLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == originalTask.TrialReadingCriterionId && x.LesionType == LesionType.NewLesions).FirstOrDefaultAsync();
// 找到其他既往新病灶
var otherLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == originalTask.TrialReadingCriterionId && x.LesionType == LesionType.OtherPreviousNewLesion).FirstOrDefaultAsync();
if (newLesionQuestion != null && otherLesionQuestion != null)
{
// 找到表格问题
var newLesionTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == newLesionQuestion.Id).ToListAsync();
// 找到表格问题
var otherLesionTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == otherLesionQuestion.Id).ToListAsync();
// 找到病灶状态
var newstateQuestionId = newLesionTableQuestionList.Where(x => x.QuestionMark == QuestionMark.State).Select(x => x.Id).FirstOrDefault();
var stateAnswers = new List<string>() {
NewLesionState.Loss.GetEnumInt(),
NewLesionState.Suspected.GetEnumInt(),
NewLesionState.UnableEvaluate.GetEnumInt()
};
var needRowIds = tableAnswer.Where(x => x.TableQuestionId == newstateQuestionId && stateAnswers.Contains(x.Answer)).Select(x => x.RowId).Distinct().ToList();
addrowInfo.ForEach(x =>
{
if (needRowIds.Contains(x.Id))
{
x.QuestionId = otherLesionQuestion.Id;
x.OrderMark = otherLesionQuestion.OrderMark;
x.RowMark = otherLesionQuestion.OrderMark + x.RowIndex.GetLesionMark();
}
});
tableAnswer.ForEach(x =>
{
if (needRowIds.Contains(x.RowId))
{
x.QuestionId = otherLesionQuestion.Id;
var newLesionTableQuestion = newLesionTableQuestionList.Where(y => y.Id == x.TableQuestionId).FirstOrDefault();
if (newLesionTableQuestion != null)
{
x.TableQuestionId = otherLesionTableQuestionList.Where(y => y.QuestionMark == newLesionTableQuestion.QuestionMark).Select(x => x.Id).FirstOrDefault();
}
}
});
}
break;
}
await _readingTaskQuestionAnswerRepository.AddRangeAsync(taskAnswer);
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addrowInfo);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswer);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
}
/// <summary>
/// 获取阅片报告任务List
/// </summary>
@ -165,7 +300,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
);
if(visitTaskInfo.ReadingTaskState==ReadingTaskState.HaveSigned)
{
taskquery = _visitTaskRepository.Where(x => visitTaskInfo.RelatedVisitTaskIdList.Contains(x.Id)||x.Id==visitTaskInfo.Id);
taskquery = _visitTaskRepository.Where(x => visitTaskInfo.ReportRelatedTaskIdList.Contains(x.Id)||x.Id==visitTaskInfo.Id);
}

View File

@ -444,8 +444,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
//非靶病灶评估
new ReadingCalculateData (){QuestionType=QuestionType.NoTargetLesion,GetStringFun=GetNoTargetLesionEvaluate},
//是否存在新病灶
new ReadingCalculateData (){QuestionType=QuestionType.NewLesions,GetStringFun=GetNewLesionEvaluate},
//新病灶评估
new ReadingCalculateData (){QuestionType=QuestionType.NewLesionEvaluation,GetStringFun=GetNewLesionEvaluate},
//整体肿瘤评估
new ReadingCalculateData (){QuestionType=QuestionType.Tumor,GetStringFun=GetTumor},
@ -730,89 +730,98 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 判断当前任务是否是基线
if (taskinfo.SourceSubjectVisitId != baseLineVisitId)
{
// 判断当前任务是是否有表格问题答案
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
{
var LastVisitTaskId = await _visitTaskRepository.Where(x =>( x.ReadingCategory == ReadingCategory.Visit &&
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
x.IsAnalysisCreate== taskinfo.IsAnalysisCreate&&
x.DoctorUserId == taskinfo.DoctorUserId &&
x.IsSelfAnalysis== taskinfo.IsSelfAnalysis &&
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
&& x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect)||(x.Id==taskinfo.BeforeConvertedTaskId)
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new CopyTableAnswerDto()
if (taskinfo.BeforeConvertedTaskId != null)
{
Answer = x.Answer,
QuestionId = x.QuestionId,
RowId = x.RowId,
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
TableQuestionId = x.TableQuestionId,
RowIndex = x.RowIndex,
TrialId = x.TrialId
}).ToListAsync();
await _generalCalculateService.AddConvertedTaskFocus(taskinfo.Id, taskinfo.BeforeConvertedTaskId.Value);
}
else
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
tableRowAnswers.ForEach(x =>
{
x.VisitTaskId = visitTaskId;
x.IsCurrentTaskAdd = false;
x.Id = NewId.NextGuid();
x.SeriesId = null;
x.InstanceId = null;
x.MeasureData = string.Empty;
x.PicturePath= string.Empty;
});
var LastVisitTaskId = await _visitTaskRepository.Where(x => (x.ReadingCategory == ReadingCategory.Visit &&
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
x.DoctorUserId == taskinfo.DoctorUserId &&
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
&& x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect) || (x.Id == taskinfo.BeforeConvertedTaskId)
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
tableRowAnswers.ForEach(x =>
{
x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault();
x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault();
});
List<QuestionMark?> notNeedCopyMarks = new List<QuestionMark?>()
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new CopyTableAnswerDto()
{
Answer = x.Answer,
QuestionId = x.QuestionId,
RowId = x.RowId,
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
TableQuestionId = x.TableQuestionId,
RowIndex = x.RowIndex,
TrialId = x.TrialId
}).ToListAsync();
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
tableRowAnswers.ForEach(x =>
{
x.VisitTaskId = visitTaskId;
x.IsCurrentTaskAdd = false;
x.Id = NewId.NextGuid();
x.SeriesId = null;
x.InstanceId = null;
x.MeasureData = string.Empty;
x.PicturePath = string.Empty;
});
tableRowAnswers.ForEach(x =>
{
x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault();
x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault();
});
List<QuestionMark?> notNeedCopyMarks = new List<QuestionMark?>()
{
QuestionMark.MajorAxis,
QuestionMark.ShortAxis,
QuestionMark.State,
};
if (taskinfo.IsConvertedTask)
{
notNeedCopyMarks = new List<QuestionMark?>()
if (taskinfo.IsConvertedTask)
{
notNeedCopyMarks = new List<QuestionMark?>()
{
QuestionMark.MajorAxis,
QuestionMark.ShortAxis,
};
}
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
{
Id = NewId.NextGuid(),
Answer = notNeedCopyMarks.Contains(x.QuestionMark) ? string.Empty : x.Answer,
QuestionId = x.QuestionId,
RowIndex = x.RowIndex,
RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(),
TableQuestionId = x.TableQuestionId,
TrialId = x.TrialId,
VisitTaskId = visitTaskId,
});
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
}
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
{
Id = NewId.NextGuid(),
Answer = notNeedCopyMarks.Contains(x.QuestionMark) ? string.Empty : x.Answer,
QuestionId = x.QuestionId,
RowIndex = x.RowIndex,
RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(),
TableQuestionId = x.TableQuestionId,
TrialId = x.TrialId,
VisitTaskId = visitTaskId,
});
var addList= _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
}
}

View File

@ -23,5 +23,13 @@ namespace IRaCIS.Core.Application.Service
/// <param name="visitTaskId"></param>
/// <returns></returns>
Task<List<VisitTaskInfo>> GetReadingReportTaskList(Guid visitTaskId);
/// <summary>
/// 添加转化任务病灶信息
/// </summary>
/// <param name="visitTaskId"></param>
/// <param name="beforeConvertedTaskId"></param>
/// <returns></returns>
Task AddConvertedTaskFocus(Guid visitTaskId, Guid beforeConvertedTaskId);
}
}

View File

@ -1,4 +1,4 @@
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 2022-03-04 13:33:56
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
@ -81,7 +81,8 @@ namespace IRaCIS.Core.Application.Service
{
if (existSysUser.LastName != addOrEditTrialExternalUser.LastName || existSysUser.FirstName != addOrEditTrialExternalUser.FirstName)
{
return ResponseOutput.NotOk($"该用户在系统中的用户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} 电话:{existSysUser.Phone},与填写信息存在不一致项, 请将界面信息修改为与系统一致,再进行保存", new { existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone, existSysUser.IsZhiZhun, existSysUser.IsTestUser }, ApiResponseCodeEnum.NeedTips);
//$"该用户在系统中的用户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} 电话:{existSysUser.Phone},与填写信息存在不一致项, 请将界面信息修改为与系统一致,再进行保存",
return ResponseOutput.NotOk(_localizer["TrialExternalUser_Inconsistency", existSysUser.LastName + " / " + existSysUser.FirstName, existSysUser.Phone], new { existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone, existSysUser.IsZhiZhun, existSysUser.IsTestUser }, ApiResponseCodeEnum.NeedTips);
}
}
@ -92,7 +93,8 @@ namespace IRaCIS.Core.Application.Service
t.Email == addOrEditTrialExternalUser.Email &&
t.UserTypeId == addOrEditTrialExternalUser.UserTypeId && t.TrialId == addOrEditTrialExternalUser.TrialId))
{
return ResponseOutput.NotOk("系统已经存在与列表中填写的邮箱和用户类型相同的账户,请确认。");
//---系统已经存在与列表中填写的邮箱和用户类型相同的账户,请确认。
return ResponseOutput.NotOk(_localizer["TrialExternalUser_EmailTypeDuplicate"]);
}
@ -157,7 +159,8 @@ namespace IRaCIS.Core.Application.Service
if (existUser.IsTestUser)
{
throw new BusinessValidationFailedException("正式类型 、培训类型的项目 不允许加入测试用户 ");
//---正式类型 、培训类型的项目 不允许加入测试用户
throw new BusinessValidationFailedException(_localizer["TrialExternalUser_TestUserNotAllowed"]);
}
}
@ -167,7 +170,8 @@ namespace IRaCIS.Core.Application.Service
if (existUser.IsTestUser == false )
{
throw new BusinessValidationFailedException("测试项目 不允许加入正式用户 ");
//---测试项目 不允许加入正式用户
throw new BusinessValidationFailedException(_localizer["TrialExternalUser_FormalUserNotAllowed"]);
}
}
@ -204,7 +208,8 @@ namespace IRaCIS.Core.Application.Service
}
else
{
return ResponseOutput.NotOk("人员信息不支持编辑,请删除后重新添加。");
//---人员信息不支持编辑,请删除后重新添加。
return ResponseOutput.NotOk(_localizer["TrialExternalUser_NotEditable"]);
}
}
@ -220,7 +225,8 @@ namespace IRaCIS.Core.Application.Service
if (await _trialUserRepository.AnyAsync(t => t.TrialId == trialExternalUser.TrialId && t.UserId == trialExternalUser.SystemUserId))
{
return ResponseOutput.NotOk("当前用户已参与到项目,不允许删除");
//---当前用户已参与到项目,不允许删除
return ResponseOutput.NotOk(_localizer["TrialExternalUser_CannotDelete"]);
}
@ -314,7 +320,11 @@ namespace IRaCIS.Core.Application.Service
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
</div>
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
{trialInfo.ResearchProgramNo} IRCIRC
{
//您好,展影医疗作为 实验方案号:{trialInfo.ResearchProgramNo} 项目的IRC供应商诚邀您参加该项目IRC相关工作欢迎您提供指导和建议非常感谢
_localizer["TrialExternalUser_IRCInvitation", trialInfo.ResearchProgramNo]
}
</div>
@ -377,7 +387,8 @@ namespace IRaCIS.Core.Application.Service
if (DateTime.Now > needUpdate.ExpireTime)
{
return ResponseOutput.NotOk("邀请加入时间已过期,重新被邀请后才可以进行确认操作");
//---邀请加入时间已过期,重新被邀请后才可以进行确认操作
return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]);
}
_mapper.Map(editTrialUserPreparation, needUpdate);
@ -409,7 +420,8 @@ namespace IRaCIS.Core.Application.Service
//收件地址
messageToSend.To.Add(new MailboxAddress(String.Empty, needUpdate.Email));
//主题
messageToSend.Subject = $"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息";
//$"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息";
messageToSend.Subject = _localizer["TrialExternalUser_AccountInfo", trialInfo.ResearchProgramNo];
var builder = new BodyBuilder();
@ -430,30 +442,63 @@ namespace IRaCIS.Core.Application.Service
<div style='line-height: 40px;font-size: 18px'>
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
</div>
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
{trialInfo.ResearchProgramNo}IRC
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
{
// 您好,欢迎您参加项目 实验方案号:{trialInfo.ResearchProgramNo}IRC相关工作。该项目采用电子化工作流系统及您的账号信息如下
_localizer["TrialExternalUser_Welcome", trialInfo.ResearchProgramNo]
}
</div>
<div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
<div>
: {trialInfo.TrialCode}
{
// 项目编号: {trialInfo.TrialCode}
_localizer["TrialExternalUser_ProjectNumber", trialInfo.TrialCode]
}
</div>
<div>
: {trialInfo.ResearchProgramNo}
{
// 试验方案号: {trialInfo.ResearchProgramNo}
_localizer["TrialExternalUser_ExperimentPlanNumber", trialInfo.ResearchProgramNo]
}
</div>
<div>
: {trialInfo.ExperimentName}
{
// 试验名称: {trialInfo.ExperimentName}
_localizer["TrialExternalUser_ExperimentName", trialInfo.ExperimentName]
}
</div>
<div>
: {sysUserInfo.UserName}
{
// 用户名: {sysUserInfo.UserName}
_localizer["TrialExternalUser_Username", sysUserInfo.UserName]
}
</div>
<div>
: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")}
</div>
{
// 密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")}
_localizer["TrialExternalUser_Password", verificationCode.ToString()]
}
</div>
<div>
: {sysUserInfo.UserTypeRole.UserTypeShortName}
{
// 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
_localizer["TrialExternalUser_Role", sysUserInfo.UserTypeRole.UserTypeShortName]
}
</div>
<div>
: {editTrialUserPreparation.BaseUrl}
{
// 系统登录地址: {editTrialUserPreparation.BaseUrl}
_localizer["TrialExternalUser_LoginUrl", editTrialUserPreparation.BaseUrl]
}
</div>
</div>
@ -539,7 +584,8 @@ namespace IRaCIS.Core.Application.Service
if (DateTime.Now > needUpdate.ExpireTime)
{
return ResponseOutput.NotOk("邀请加入时间已过期,重新被邀请后才可以进行确认操作");
//---邀请加入时间已过期,重新被邀请后才可以进行确认操作
return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]);
}
_mapper.Map(editInfo, needUpdate);
@ -549,7 +595,8 @@ namespace IRaCIS.Core.Application.Service
if (needUpdate.SystemUserId == null)
{
return ResponseOutput.NotOk("调研表系统用户Id 存储有问题");
//---调研表系统用户Id 存储有问题
return ResponseOutput.NotOk(_localizer["TrialExternalUser_UserIdStorageProblem"]);
}
var trialId = needUpdate.TrialSiteSurvey.TrialId;
@ -579,7 +626,8 @@ namespace IRaCIS.Core.Application.Service
//收件地址
messageToSend.To.Add(new MailboxAddress(String.Empty, editInfo.IsJoin == true ? needUpdate.Email : revieweUser.EMail));
//主题
messageToSend.Subject = $"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息";
// $"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息";
messageToSend.Subject = _localizer["TrialExternalUser_IRCAccountInfo", trialInfo.ResearchProgramNo];
var builder = new BodyBuilder();

View File

@ -219,7 +219,8 @@ namespace IRaCIS.Application.Services
if (await _repository.AnyAsync<TrialSiteUser>(t => t.UserId == trialUser.UserId && t.TrialId == trialUser.TrialId))
{
return ResponseOutput.NotOk("Participant has participated in site maintenance");
//---人员已加入现场维护
return ResponseOutput.NotOk(_localizer["TrialMaint_PersonnelJoined"]);
}
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC && isDelete)

View File

@ -137,20 +137,23 @@ namespace IRaCIS.Application.Services
// 到时候 策略授权 统一改 归类
if (!(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin))
{
throw new BusinessValidationFailedException("只有PM/APM拥有操作权限!");
//---只有PM/APM拥有操作权限!
throw new BusinessValidationFailedException(_localizer["Trial_PMApmPermission"]);
}
//测试用户 只能创建非正式项目
if (_userInfo.IsTestUser && trialAddModel.TrialType != TrialType.NoneOfficial)
{
throw new BusinessValidationFailedException("测试用户 只能创建非正式项目");
//---测试用户 只能创建非正式项目
throw new BusinessValidationFailedException(_localizer["Trial_TestUserCreateOnlyNonFormal"]);
}
if (trialAddModel.Id == Guid.Empty || trialAddModel.Id == null)
{
if (await _trialRepository.AnyAsync(u => u.TrialCode == trialAddModel.TrialCode))
{
throw new BusinessValidationFailedException("已经存在相同的项目编号。");
//---已经存在相同的项目编号。
throw new BusinessValidationFailedException(_localizer["Trial_DuplicateProjectNumber"]);
}
var dbMaxCode = await _trialRepository.Where(t => t.CreateTime.Year == DateTime.Now.Year && t.TrialType == trialAddModel.TrialType).Select(t => t.Code).DefaultIfEmpty().MaxAsync();
@ -205,13 +208,15 @@ namespace IRaCIS.Application.Services
if (!await _repository.AnyAsync<Trial>(u => u.Id == trialAddModel.Id && (u.TrialStatusStr == StaticData.TrialState.TrialInitializing || u.TrialStatusStr == StaticData.TrialState.TrialOngoing)))
{
throw new BusinessValidationFailedException("项目状态只有处于:初始化或者进行中时,才允许操作。");
//---项目状态只有处于:初始化或者进行中时,才允许操作。
throw new BusinessValidationFailedException(_localizer["Trial_InvalidProjectStatus"]);
}
// 判断项目Id 是否已经存在
if (await _repository.AnyAsync<Trial>(u => u.TrialCode == updateModel.TrialCode && u.Id != updateModel.Id))
{
throw new BusinessValidationFailedException("已经存在相同的项目编号。");
//---已经存在相同的项目编号。
throw new BusinessValidationFailedException(_localizer["Trial_DuplicateProjectNumber"]);
}
@ -539,7 +544,8 @@ namespace IRaCIS.Application.Services
else
{
return ResponseOutput.NotOk("当前运行环境下,不允许删除项目数据。");
//---当前运行环境下,不允许删除项目数据。
return ResponseOutput.NotOk(_localizer["Trial_CannotDeleteProject"]);
}
@ -668,4 +674,4 @@ namespace IRaCIS.Application.Services
}
}
}

View File

@ -250,17 +250,20 @@ namespace IRaCIS.Core.Application.Services
//if (await _repository.AnyAsync<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId))
//{
// return ResponseOutput.NotOk("The site has been associated with CRC, and couldn't be deleted.");
//---The site has been associated with CRC, and couldn't be deleted.
// return ResponseOutput.NotOk(_localizer["TrialSite_CannotDeleteAssociatedCRC"]);
//}
if (await _repository.AnyAsync<Subject>(t => t.SiteId == siteId && t.TrialId == trialId))
{
return ResponseOutput.NotOk("The subjects has been added to this site, and couldn't be disable.");
//---The subjects has been added to this site, and couldn't be disable.
return ResponseOutput.NotOk(_localizer["TrialSite_ParticipantJoined"]);
}
//if (await _repository.AnyAsync<DicomStudy>(t => t.SiteId == siteId && t.TrialId == trialId))
//{
// return ResponseOutput.NotOk("The site has been uploaded study, and couldn't be deleted.");
//---The site has been uploaded study, and couldn't be deleted.
// return ResponseOutput.NotOk(_localizer["TrialSite_CannotDeleteUploadedData"]);
//}
@ -269,7 +272,8 @@ namespace IRaCIS.Core.Application.Services
{
if (await _trialSiteRepository.AnyAsync(t => t.Id != editTrialSiteCommand.Id && t.TrialSiteCode == editTrialSiteCommand.TrialSiteCode && t.TrialId == editTrialSiteCommand.TrialId))
{
return ResponseOutput.NotOk("Code is not allowed to be repeated");
//---Code is not allowed to be repeated
return ResponseOutput.NotOk(_localizer["TrialSite_CodeDuplicate"]);
}
}
@ -360,16 +364,19 @@ namespace IRaCIS.Core.Application.Services
if (await _repository.AnyAsync<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId))
{
return ResponseOutput.NotOk("The site has been associated with CRC, and couldn't be deleted.");
//---The site has been associated with CRC, and couldn't be deleted.
return ResponseOutput.NotOk(_localizer["TrialSite_CannotDeleteAssociatedCRC"]);
}
if (await _repository.AnyAsync<Subject>(t => t.SiteId == siteId && t.TrialId == trialId))
{
return ResponseOutput.NotOk("The subjects has been added to this site, and couldn't be deleted.");
//---The subjects has been added to this site, and couldn't be deleted.
return ResponseOutput.NotOk(_localizer["TrialSite_CannotDeleteAssociatedSubject"]);
}
if (await _repository.AnyAsync<DicomStudy>(t => t.SiteId == siteId && t.TrialId == trialId))
{
return ResponseOutput.NotOk("The site has been uploaded study, and couldn't be deleted.");
//---The site has been uploaded study, and couldn't be deleted.
return ResponseOutput.NotOk(_localizer["TrialSite_CannotDeleteUploadedData"]);
}
await _repository.DeleteAsync(relation);
@ -379,4 +386,4 @@ namespace IRaCIS.Core.Application.Services
}
}
}

View File

@ -34,13 +34,15 @@ namespace IRaCIS.Application.Services
var svlist = new List<SubjectVisit>();
if (await _repository.AnyAsync<Trial>(t => t.Id == subjectCommand.TrialId && !t.VisitPlanConfirmed))
{
return ResponseOutput.NotOk("项目访视计划没有确认。请联系项目经理确认项目访视计划后,再添加受试者。");
//---项目访视计划没有确认。请联系项目经理确认项目访视计划后,再添加受试者。
return ResponseOutput.NotOk(_localizer["Subject_NoConfirmedPlan"]);
}
var verifyExp1 = new EntityVerifyExp<Subject>()
{
VerifyExp = u => u.Code == subjectCommand.Code && u.TrialId == subjectCommand.TrialId,
VerifyMsg = "已存在具有相关受试者编号的受试者。"
//---已存在具有相关受试者编号的受试者。
VerifyMsg = _localizer["Subject_DuplicateSubjectNum"]
};
@ -91,7 +93,8 @@ namespace IRaCIS.Application.Services
if (await _subjectVisitRepository.AnyAsync(u => u.SubjectId == id && u.VisitExecuted == VisitExecutedEnum.Executed))
{
return ResponseOutput.NotOk("该受试者已经有访视已经上传影像,不允许删除。");
//---该受试者已经有访视已经上传影像,不允许删除。
return ResponseOutput.NotOk(_localizer["Subject_UploadedVisitNoDelete"]);
}
await _subjectRepository.UpdatePartialFromQueryAsync(id, x => new Subject

View File

@ -80,20 +80,23 @@ namespace IRaCIS.Core.Application.Services
var verifyExp1 = new EntityVerifyExp<SubjectVisit>()
{
VerifyExp = t => t.VisitNum == svCommand.VisitNum && t.SubjectId == svCommand.SubjectId,
VerifyMsg = "该受试者的访视计划中已经包含一个具有相同访视号的访视。"
//---该受试者的访视计划中已经包含一个具有相同访视号的访视。
VerifyMsg = _localizer["Visit_DuplicateVisitNo"]
};
var verifyExp2 = new EntityVerifyExp<SubjectVisit>()
{
VerifyExp = t => t.SubjectId == svCommand.SubjectId && t.IsFinalVisit,
VerifyMsg = "该受试者已经有访视设置为末次访视,不允许将当前访视设置为末次访视。",
//---该受试者已经有访视设置为末次访视,不允许将当前访视设置为末次访视。
VerifyMsg = _localizer["Visit_LastVisitNoChange"],
IsVerify = svCommand.IsFinalVisit
};
var verifyExp3 = new EntityVerifyExp<SubjectVisit>()
{
VerifyExp = t => t.SubjectId == svCommand.SubjectId && t.VisitName == svCommand.VisitName,
VerifyMsg = "该受试者的访视计划中已经包含一个具有相同访视名称的访视。"
//---该受试者的访视计划中已经包含一个具有相同访视名称的访视。
VerifyMsg = _localizer["Visit_DuplicateVisitName"]
};
@ -113,12 +116,14 @@ namespace IRaCIS.Core.Application.Services
{
if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == svCommand.SubjectId && t.IsFinalVisit))
{
throw new BusinessValidationFailedException("设置末次评估后,不允许添加计划外访视。");
//---设置末次评估后,不允许添加计划外访视。
throw new BusinessValidationFailedException(_localizer["Visit_NoExtraVisitAfterLast"]);
}
if (await _repository.AnyAsync<VisitTask>(t => t.SubjectId == svCommand.SubjectId && t.TaskState == TaskState.Effect && t.VisitTaskNum > svCommand.VisitNum && t.SignTime != null && t.TrialReadingCriterion.IsReadingTaskViewInOrder))
{
throw new BusinessValidationFailedException("该受试者后续访视已有任务完成阅片(有序阅片标准),不允许在此添加,如果确实需要,请回退");
//---该受试者后续访视已有任务完成阅片(有序阅片标准),不允许在此添加,如果确实需要,请回退
throw new BusinessValidationFailedException(_localizer["Visit_FinishedTasksNoAdd"]);
}
}
@ -150,19 +155,22 @@ namespace IRaCIS.Core.Application.Services
if (svCommand.PDState != dbBeforeEntity.PDState && dbBeforeEntity.SubmitState == SubmitStateEnum.Submitted)
{
throw new BusinessValidationFailedException("当前访视影像提交后不允许修改PD确认状态。");
//---当前访视影像提交后不允许修改PD确认状态。
throw new BusinessValidationFailedException(_localizer["Visit_NoPDStatusChangeAfterSubmission"]);
}
if (svCommand.PDState != dbBeforeEntity.PDState && dbBeforeEntity.RequestBackState == RequestBackStateEnum.PM_AgressBack)
{
throw new BusinessValidationFailedException("当前访视为回退的访视不允许修改PD确认状态。");
//---当前访视影像提交后不允许修改PD确认状态。
throw new BusinessValidationFailedException(_localizer["Visit_NoPDStatusChangeAfterSubmission"]);
}
if (svCommand.IsLostVisit)
{
if (await _subjectVisitRepository.AnyAsync(t => t.Id == svCommand.Id && t.SubmitState == SubmitStateEnum.ToSubmit))
{
throw new BusinessValidationFailedException("当前访视已经有有影像上传,不允许设置为失访。");
//---当前访视已经有影像上传,不允许设置为失访。
throw new BusinessValidationFailedException(_localizer["Visit_UploadedNoLost"]);
}
}
@ -211,15 +219,18 @@ namespace IRaCIS.Core.Application.Services
{
if (await _repository.AnyAsync<DicomStudy>(t => t.SubjectVisitId == id))
{
return ResponseOutput.NotOk("当前访视已经有影像上传,不允许删除。");
//---当前访视已经有影像上传,不允许删除。
return ResponseOutput.NotOk(_localizer["Visit_UploadedNoDelete"]);
}
if (await _subjectVisitRepository.AnyAsync(t => t.Id == id && t.InPlan))
{
return ResponseOutput.NotOk("计划内的访视不允许删除。");
//---计划内的访视不允许删除。
return ResponseOutput.NotOk(_localizer["Visit_PlanVisitNoDelete"]);
}
if (await _subjectVisitRepository.AnyAsync(t => t.OutPlanPreviousVisitId == id))
{
return ResponseOutput.NotOk("当前访视已经被设置为另一访视的上一访视,不允许删除。");
//---当前访视已经被设置为另一访视的上一访视,不允许删除。
return ResponseOutput.NotOk(_localizer["Visit_PreviousVisitNoDelete"]);
}
await _subjectVisitRepository.DeleteFromQueryAsync(s => s.Id == id, true);

View File

@ -128,7 +128,8 @@ namespace IRaCIS.Application.Services
//比当前 visitNum小的 visitDay的最大值 还小 不允许添加
if (visitPlan.VisitDay <= visitPlanList.Where(t => t.VisitNum < visitPlan.VisitNum).Select(t => t.VisitDay).Max())
{
throw new BusinessValidationFailedException("访视计划中,访视号大的访视,其访视间隔也应该比访视号小的访视大。");
//---访视计划中,访视号大的访视,其访视间隔也应该比访视号小的访视大。
throw new BusinessValidationFailedException(_localizer["VisitPlan_LargerVisitNumLargerInterval"]);
}
}
@ -137,7 +138,8 @@ namespace IRaCIS.Application.Services
{
if (visitPlan.VisitDay >= visitPlanList.Where(t => t.VisitNum > visitPlan.VisitNum).Select(t => t.VisitDay).Min())
{
throw new BusinessValidationFailedException("访视计划中,访视号大的计划访视,其访视间隔也应该比访视号小的计划访视大。");
//---访视计划中,访视号大的计划访视,其访视间隔也应该比访视号小的计划访视大。
throw new BusinessValidationFailedException(_localizer["VisitPlan_LargerPlanNumLargerInterval"]);
}
}
@ -148,12 +150,14 @@ namespace IRaCIS.Application.Services
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && (t.VisitName == visitPlan.VisitName || t.VisitNum == visitPlan.VisitNum), true))
{
throw new BusinessValidationFailedException("访视计划中已经存在具有项目访视名称或者访视号的计划访视模板。");
//---访视计划中已经存在具有项目访视名称或者访视号的计划访视模板。
throw new BusinessValidationFailedException(_localizer["VisitPlan_ExistNameOrNumTemplate"]);
}
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && t.IsBaseLine, true) && visitPlan.IsBaseLine)
{
throw new BusinessValidationFailedException("访视计划中已经存在基线。");
//---访视计划中已经存在基线。
throw new BusinessValidationFailedException(_localizer["VisitPlan_ExistBaseline"]);
}
//不用前端传递的值
@ -171,12 +175,14 @@ namespace IRaCIS.Application.Services
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && (t.VisitName == visitPlan.VisitName || t.VisitNum == visitPlan.VisitNum) && t.Id != visitPlan.Id, true))
{
throw new BusinessValidationFailedException("访视计划中已经存在具有项目访视名称或者访视号的计划访视模板。");
//---访视计划中已经存在具有项目访视名称或者访视号的计划访视模板。
throw new BusinessValidationFailedException(_localizer["VisitPlan_ExistNameOrNumTemplate"]);
}
if (await _visitStageRepository.AnyAsync(t => t.TrialId == visitPlan.TrialId && t.IsBaseLine && t.Id != visitPlan.Id, true) && visitPlan.IsBaseLine)
{
throw new BusinessValidationFailedException("访视计划中已经存在基线。");
//---访视计划中已经存在基线。
throw new BusinessValidationFailedException(_localizer["VisitPlan_ExistBaseline"]);
}
visitPlan.IsConfirmed = false;
@ -189,7 +195,8 @@ namespace IRaCIS.Application.Services
{
if (await _repository.Where<SubjectVisit>(t => t.TrialId == visitPlan.TrialId).AnyAsync(v => v.IsBaseLine && v.SubmitState >= SubmitStateEnum.ToSubmit))
{
throw new BusinessValidationFailedException("有受试者的基线已经上传了影像数据,不允许修改基线访视。");
//---有受试者的基线已经上传了影像数据,不允许修改基线访视。
throw new BusinessValidationFailedException(_localizer["VisitPlan_ExistBaselineImgNoModify"]);
}
}
@ -213,24 +220,28 @@ namespace IRaCIS.Application.Services
{
if (!await _trialRepository.AnyAsync(t => t.Id == trialId && (t.TrialStatusStr == StaticData.TrialState.TrialInitializing || t.TrialStatusStr == StaticData.TrialState.TrialOngoing)))
{
return ResponseOutput.NotOk("仅仅在项目初始化或者进行中时,才允许修改确认");
//---仅仅在项目初始化或者进行中时,才允许修改确认
return ResponseOutput.NotOk(_localizer["VisitPlan_OnlyInitOrOngoingModifyConfirm"]);
}
if (!await _visitStageRepository.AnyAsync(t => t.TrialId == trialId && t.IsBaseLine))
{
return ResponseOutput.NotOk("没有基线,不允许确认");
//---没有基线,不允许确认
return ResponseOutput.NotOk(_localizer["VisitPlan_NoBaselineNotConfirm"]);
}
if (!await _trialRepository.AnyAsync(t => t.Id == trialId && t.IsTrialBasicLogicConfirmed && t.IsTrialProcessConfirmed && t.IsTrialUrgentConfirmed))
{
return ResponseOutput.NotOk("项目配置未确认,不允许确认访视计划");
//---项目配置未确认,不允许确认访视计划
return ResponseOutput.NotOk(_localizer["VisitPlan_ConfigNotConfirmNotConfirm"]);
}
var svList = await _visitStageRepository.Where(t => t.TrialId == trialId).Select(u => new { u.VisitDay, u.IsBaseLine }).ToListAsync();
if (svList.Min(t => t.VisitDay) != svList.Where(t => t.IsBaseLine).FirstOrDefault()?.VisitDay)
{
return ResponseOutput.NotOk("基线VisitDay 不是最小的, 不允许确认");
//---基线VisitDay 不是最小的, 不允许确认
return ResponseOutput.NotOk(_localizer["VisitPlan_BaselineNotMinDayNotConfirm"]);
}
@ -480,7 +491,8 @@ namespace IRaCIS.Application.Services
var result = await exporter.ExportAsByteArray(list);
return new XlsxFileResult(bytes: result, fileDownloadName: $"检查导出_{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx");
//$"检查导出_{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx"
return new XlsxFileResult(bytes: result, fileDownloadName: _localizer["VisitPlan_CheckExport", DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")]);
}
@ -498,7 +510,8 @@ namespace IRaCIS.Application.Services
if (visitPlan == null) return Null404NotFound(visitPlan);
if (await _repository.AnyAsync<SubjectVisit>(t => t.VisitName == visitPlan.VisitName && t.TrialId == visitPlan.TrialId && t.VisitExecuted == VisitExecutedEnum.Executed))
{
return ResponseOutput.NotOk("The visit plan has been assigned to the subjects and executed.");
//---The visit plan has been assigned to the subjects and executed.
return ResponseOutput.NotOk(_localizer["VisitPlan_Assigned"]);
}
await _repository.BatchDeleteAsync<SubjectVisit>(t => t.TrialId == visitPlan.TrialId && t.VisitName == visitPlan.VisitName);
@ -510,4 +523,4 @@ namespace IRaCIS.Application.Services
}
}
}

View File

@ -128,7 +128,8 @@ namespace IRaCIS.Application.Services
if (readingCategoryList.Except(inDto.ReadingCategorys).Count() > 0)
{
return ResponseOutput.NotOk("已分配任务,不允许减少阅片类型");
//---已分配任务,不允许减少阅片类型
return ResponseOutput.NotOk(_localizer["DoctorWorkload_AssignType"]);
}
@ -658,7 +659,8 @@ namespace IRaCIS.Application.Services
if (await _doctorWorkloadRepository.AnyAsync(workloadLambda))
{
return ResponseOutput.NotOk("This type of data can only have one");
//---This type of data can only have one
return ResponseOutput.NotOk(_localizer["DoctorWorkload_Unique"]);
}
}
@ -669,7 +671,8 @@ namespace IRaCIS.Application.Services
doctorworkloadLambda = doctorworkloadLambda.And(t => t.DataFrom == (int)WorkLoadFromStatus.Doctor);
if (await _doctorWorkloadRepository.AnyAsync(doctorworkloadLambda))
{
return ResponseOutput.NotOk("This type of data can only have one");
//---This type of data can only have one
return ResponseOutput.NotOk(_localizer["DoctorWorkload_Unique"]);
}
}
@ -698,7 +701,8 @@ namespace IRaCIS.Application.Services
if (isLocked)
{
return ResponseOutput.NotOk("Expenses have been settled and workload cannot be modified.");
//---Expenses have been settled and workload cannot be modified.
return ResponseOutput.NotOk(_localizer["DoctorWorkload_FeeSettled"]);
}

View File

@ -259,7 +259,8 @@ namespace IRaCIS.Application.Services
}
return ResponseOutput.Result(await _enrollRepository.SaveChangesAsync());
}
return ResponseOutput.NotOk($"Cannot find trial {trialId}");
//$"Cannot find trial {trialId}"
return ResponseOutput.NotOk(_localizer["Enroll_NotFound", trialId]);
}
/// <summary>
@ -387,7 +388,8 @@ namespace IRaCIS.Application.Services
if (errorList.Count() > 0)
{
return ResponseOutput.NotOk(string.Join(',', errorList.Select(c => c.LastName+" / "+c.FirstName)) +"邮箱格式存在问题") ;
// errorList.Select(c => c.LastName+" / "+c.FirstName)) +"邮箱格式存在问题"
return ResponseOutput.NotOk(string.Join(',', _localizer["Enroll_EmailFormat"], errorList.Select(c => c.LastName + " / " + c.FirstName))) ;
}
if (confirmReviewerCommand.ConfirmState == 1) //确认入组
@ -489,7 +491,8 @@ namespace IRaCIS.Application.Services
u.Downtime);
if (sum != 0)
{
return ResponseOutput.NotOk("Reviewers with workload cannot go back");
//---Reviewers with workload cannot go back
return ResponseOutput.NotOk(_localizer["Enroll_CannotRollback"]);
}
intoGroupItem.EnrollStatus = EnrollStatus.InviteIntoGroup;

View File

@ -11,7 +11,7 @@ namespace IRaCIS.Core.Application.Triggers
{
// 统一处理 外部用户、中心调研(先添加 再发送邮件)、参与医生加入到项目 ----废弃
public class AddlTrialUserTrigger : IBeforeSaveTrigger<TrialUser>
public class AddlTrialUserTrigger :BaseService, IBeforeSaveTrigger<TrialUser>
{
private readonly IRepository<Trial> _trialRepository;
@ -41,7 +41,8 @@ namespace IRaCIS.Core.Application.Triggers
if (user.IsTestUser)
{
throw new BusinessValidationFailedException("正式类型 、培训类型的项目 不允许加入测试用户 ");
//---正式类型 、培训类型的项目 不允许加入测试用户
throw new BusinessValidationFailedException(_localizer["AddlTrialUser_NoTestUser"]);
}
}
@ -51,7 +52,8 @@ namespace IRaCIS.Core.Application.Triggers
if (user.IsTestUser == false )
{
throw new BusinessValidationFailedException("测试项目 不允许加入正式用户 ");
//---测试项目 不允许加入正式用户
throw new BusinessValidationFailedException(_localizer["AddlTrialUser_NoFormalUser"]);
}
}
@ -60,4 +62,4 @@ namespace IRaCIS.Core.Application.Triggers
}
}
}

View File

@ -9,7 +9,7 @@ namespace IRaCIS.Core.Application.Triggers
/// <summary>
///
/// </summary>
public class SubjectStateTrigger : IAfterSaveTrigger<Subject>
public class SubjectStateTrigger :BaseService, IAfterSaveTrigger<Subject>
{
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository _repository;
@ -67,7 +67,8 @@ namespace IRaCIS.Core.Application.Triggers
{
throw new BusinessValidationFailedException(
"该受试者已经有访视被设置为末次访视,不允许将当前访视设置为末次访视。");
//---该受试者已经有访视被设置为末次访视,不允许将当前访视设置为末次访视。
_localizer["SubjectState_CannotSetCurrentAsLastVisit"]);
}
var sv = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == dbSubject.FinalSubjectVisitId).IfNullThrowException();
@ -76,7 +77,8 @@ namespace IRaCIS.Core.Application.Triggers
{
throw new BusinessValidationFailedException(
"该受试者当前访视后有访视的影像已上传,当前访视不允许设置为末次访视。");
//---该受试者当前访视后有访视的影像已上传,当前访视不允许设置为末次访视。
_localizer["SubjectState_CannotSetAsLastVisitWithImage"]);
}
@ -95,4 +97,4 @@ namespace IRaCIS.Core.Application.Triggers
}
}
}
}

View File

@ -10,7 +10,7 @@ namespace IRaCIS.Core.Application.Triggers
/// <summary>
/// 处理 访视 末次评估 会影响Subject 状态
/// </summary>
public class SubjectVisitFinalVisitTrigger : IAfterSaveTrigger<SubjectVisit>
public class SubjectVisitFinalVisitTrigger :BaseService, IAfterSaveTrigger<SubjectVisit>
{
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository<ReadingPeriodSet> _readingPeriodSetRepository;
@ -180,7 +180,8 @@ namespace IRaCIS.Core.Application.Triggers
if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == subjectVisit.SubjectId && t.VisitNum > subjectVisit.VisitNum &&
(t.SubmitState == SubmitStateEnum.ToSubmit || t.SubmitState == SubmitStateEnum.Submitted)))
{
throw new BusinessValidationFailedException("该受试者已有后续访视已上传影像或已提交,当前访视不允许设置为末次访视。");
//---该受试者已有后续访视已上传影像或已提交,当前访视不允许设置为末次访视。
throw new BusinessValidationFailedException(_localizer["SubjectVisit_CannotSetAsLastVisit"]);
}
}

View File

@ -49,6 +49,11 @@ namespace IRaCIS.Core.Domain.Share
/// 既往任务Id 不包括自己
/// </summary>
PastResult = 1,
/// <summary>
/// 报告 包括自己
/// </summary>
ReportResult = 2,
}
/// <summary>
@ -1194,10 +1199,15 @@ namespace IRaCIS.Core.Domain.Share
/// </summary>
DaysBetween = 22,
/// <summary>
/// 新病灶评估
/// </summary>
NewLesionEvaluation = 30,
/// <summary>
/// 是否脑转移
/// </summary>
IsBrainMetastasis=43,
IsBrainMetastasis =43,
/// <summary>
/// 是否转变之后表格问题

View File

@ -200,7 +200,7 @@ namespace IRaCIS.Core.Domain.Models
public string RelatedVisitTaskIds { get; set; } = "[]";
/// <summary>
/// 关联的访视任务ID (当前任务是访视任务的话会有自己)集合 不包括冻结
/// 关联的访视任务ID (当前任务是访视任务的话会有自己)集合
/// </summary>
[NotMapped]
public List<Guid> RelatedVisitTaskIdList
@ -223,7 +223,35 @@ namespace IRaCIS.Core.Domain.Models
}
/// <summary>
/// 既往任务Id 不包括自己 包括冻结
/// 报告任务关系 包含冻结
/// </summary>
public string ReportRelatedTaskIds { get; set; } = "[]";
/// <summary>
/// 报告任务关系 包含冻结
/// </summary>
[NotMapped]
public List<Guid> ReportRelatedTaskIdList
{
get
{
try
{
return JsonConvert.DeserializeObject<List<Guid>>(this.ReportRelatedTaskIds);
}
catch (Exception)
{
return new List<Guid>();
}
}
}
/// <summary>
/// 既往任务Id 不包括自己
/// </summary>
public string PastResultTaskIds { get; set; } = "[]";
@ -231,7 +259,7 @@ namespace IRaCIS.Core.Domain.Models
/// <summary>
/// 既往任务Id 不包括自己集合 包括冻结
/// 既往任务Id 不包括自己集合
/// </summary>
[NotMapped]
public List<Guid> PastResultTaskIdList

View File

@ -1001,4 +1001,20 @@ update ReadingQuestionSystem set GroupId= (select top 1 id from ReadingQuestio
-----------------
update ShortcutKey set Text='Page Up' where Text='PageUp'
update ShortcutKey set Text='Page Down' where Text='PageDown'
update ShortcutKey set Text='Page Down' where Text='PageDown'
---------------------Groupid
update ReadingQuestionTrial set GroupId= (select top 1 id from ReadingQuestionTrial a where a.Type='group' and a.GroupName=ReadingQuestionTrial.GroupName and a.ReadingQuestionCriterionTrialId=ReadingQuestionTrial.ReadingQuestionCriterionTrialId) where ReadingQuestionTrial.Type!='group' and GroupId is null
update ReadingQuestionSystem set GroupId= (select top 1 id from ReadingQuestionSystem a where a.Type='group' and a.GroupName=ReadingQuestionSystem.GroupName and a.ReadingQuestionCriterionSystemId=ReadingQuestionSystem.ReadingQuestionCriterionSystemId) where ReadingQuestionSystem.Type!='group' and GroupId is null
------------------------------------------------------------------------------------------------------------------------------
update VisitTask set ReportRelatedTaskIds=RelatedVisitTaskIds where ReadingCategory=1 and RelatedVisitTaskIds!='[]'
delete ReadingTaskRelation where RelevanceType=2
INSERT INTO ReadingTaskRelation(Id, TaskId, RelevanceTaskId, RelevanceType, CreateTime,CreateUserId)
SELECT NEWID(), TaskId, RelevanceTaskId, 2,ReadingTaskRelation.CreateTime ,ReadingTaskRelation.CreateUserId FROM ReadingTaskRelation inner join VisitTask on VisitTask.Id=ReadingTaskRelation.TaskId WHERE RelevanceType = 1 and ReadingCategory=1

View File

@ -152,10 +152,10 @@ namespace IRaCIS.Core.Infrastructure.Extention
return new ResponseOutput<T>().NotOk(msg, data, code);
}
public static IResponseOutput<T> NotOk<T>( T data = default, ApiResponseCodeEnum code = ApiResponseCodeEnum.BusinessValidationFailed)
{
return new ResponseOutput<T>().NotOk("", data, code);
}
//public static IResponseOutput<T> NotOk<T>( T data = default, ApiResponseCodeEnum code = ApiResponseCodeEnum.BusinessValidationFailed)
//{
// return new ResponseOutput<T>().NotOk("", data, code);
//}
/// <summary>
/// 失败

Binary file not shown.