修改一致性分析规则和稽查
parent
e9e0e37694
commit
caba07deb3
|
@ -610,7 +610,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var taskConsistentRuleQueryable = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId)
|
var taskConsistentRuleQueryable = from enroll in _repository.Where<Enroll>(t => t.TrialId == trialId)
|
||||||
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
join user in _repository.Where<User>() on enroll.DoctorId equals user.DoctorId
|
||||||
join taskConsistentRule in _repository.Where<TaskConsistentRule>(t => t.TrialId == trialId && t.IsSelfAnalysis) on enroll.TrialId equals taskConsistentRule.TrialId
|
join taskConsistentRule in _repository.Where<TaskConsistentRule>(t => t.TrialId == trialId &&t.TrialReadingCriterionId==inQuery.TrialReadingCriterionId && t.IsSelfAnalysis) on enroll.TrialId equals taskConsistentRule.TrialId
|
||||||
select new TaskConsistentRuleView()
|
select new TaskConsistentRuleView()
|
||||||
{
|
{
|
||||||
Id = taskConsistentRule.Id,
|
Id = taskConsistentRule.Id,
|
||||||
|
@ -629,7 +629,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
IsHaveReadingPeriod = taskConsistentRule.IsHaveReadingPeriod,
|
IsHaveReadingPeriod = taskConsistentRule.IsHaveReadingPeriod,
|
||||||
PlanVisitCount = taskConsistentRule.PlanVisitCount,
|
PlanVisitCount = taskConsistentRule.PlanVisitCount,
|
||||||
|
|
||||||
GeneratedSubjectCount = taskConsistentRule.Trial.VisitTaskList.Where(t => t.IsAnalysisCreate && t.IsSelfAnalysis == true && t.DoctorUserId == user.Id).Select(t => t.SubjectId).Distinct().Count(),
|
GeneratedSubjectCount = taskConsistentRule.Trial.VisitTaskList.Where(t => t.IsAnalysisCreate && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.IsSelfAnalysis == true && t.DoctorUserId == user.Id).Select(t => t.SubjectId).Distinct().Count(),
|
||||||
|
|
||||||
AnalysisDoctorUser = new UserSimpleInfo()
|
AnalysisDoctorUser = new UserSimpleInfo()
|
||||||
{
|
{
|
||||||
|
|
|
@ -225,6 +225,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
Identification = x.Identification,
|
Identification = x.Identification,
|
||||||
ObjectRelationParentId = x.ObjectRelationParentId,
|
ObjectRelationParentId = x.ObjectRelationParentId,
|
||||||
ObjectRelationParentId2 = x.ObjectRelationParentId2,
|
ObjectRelationParentId2 = x.ObjectRelationParentId2,
|
||||||
|
ObjectRelationParentId3 = x.ObjectRelationParentId3,
|
||||||
CreateTime = x.CreateTime,
|
CreateTime = x.CreateTime,
|
||||||
BatchId = x.BatchId,
|
BatchId = x.BatchId,
|
||||||
|
|
||||||
|
@ -250,7 +251,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var objectLsit = new List<object>();
|
var objectLsit = new List<object>();
|
||||||
|
|
||||||
var relationParentDataObjList = await GetRelationParentData(item.Id, item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId, objectLsit);
|
var relationParentDataObjList = await GetRelationParentData(item.Id, item.ObjectRelationParentId, item.ObjectRelationParentId2, item.ObjectRelationParentId3 ,item.CreateTime, item.BatchId, objectLsit);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,9 +350,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
item.JsonStr = JsonConvert.SerializeObject(jsonDict);
|
item.JsonStr = JsonConvert.SerializeObject(jsonDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +376,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
if (objectRelationParentId != null)
|
if (objectRelationParentId != null)
|
||||||
{
|
{
|
||||||
//父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
//父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
||||||
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && (t.CreateTime <= createTime || t.BatchId == batchId) && t.Id != id).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName, t.Id }).FirstOrDefaultAsync();
|
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && (t.CreateTime <= createTime || t.BatchId == batchId) && t.Id != id).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.ObjectRelationParentId3, t.EntityName, t.Id }).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
if (relationParentInspection != null)
|
if (relationParentInspection != null)
|
||||||
|
@ -420,6 +418,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||||
|
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId3, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -441,11 +440,13 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async Task<List<object>> GetRelationParentData(Guid id, Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId, List<object> objectLsit)
|
private async Task<List<object>> GetRelationParentData(Guid id, Guid? objectRelationParentId, Guid? objectRelationParentId2, Guid? objectRelationParentId3, DateTime createTime, Guid batchId, List<object> objectLsit)
|
||||||
{
|
{
|
||||||
await AddJsonObjectToDic(id, objectRelationParentId, createTime, batchId, objectLsit);
|
await AddJsonObjectToDic(id, objectRelationParentId, createTime, batchId, objectLsit);
|
||||||
await AddJsonObjectToDic(id, objectRelationParentId2, createTime, batchId, objectLsit);
|
await AddJsonObjectToDic(id, objectRelationParentId2, createTime, batchId, objectLsit);
|
||||||
|
|
||||||
|
await AddJsonObjectToDic(id, objectRelationParentId3, createTime, batchId, objectLsit);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 废弃
|
#region 废弃
|
||||||
|
|
|
@ -92,3 +92,11 @@ update ReadingQuestionCriterionTrial set DigitPlaces=DigitPlaces-1 where DigitPl
|
||||||
|
|
||||||
|
|
||||||
update ReadingQuestionCriterionTrial set DigitPlaces=-1 where DigitPlaces=3
|
update ReadingQuestionCriterionTrial set DigitPlaces=-1 where DigitPlaces=3
|
||||||
|
|
||||||
|
|
||||||
|
--ÔÄÆ¬±ê׼ά»¤
|
||||||
|
update DataInspection set ObjectRelationParentId3 = (select top 1 TrialReadingCriterionId from SubjectUser where Id =DataInspection.GeneralId) where EntityName='SubjectUser'
|
||||||
|
update DataInspection set ObjectRelationParentId2 = (select top 1 TrialReadingCriterionId from ReadingPeriodSet where Id =DataInspection.GeneralId) where EntityName='ReadingPeriodSet'
|
||||||
|
update DataInspection set ObjectRelationParentId2 = (select top 1 TrialReadingCriterionId from ReadModule where Id =DataInspection.GeneralId) where EntityName='ReadModule'
|
||||||
|
update DataInspection set ObjectRelationParentId2 = (select top 1 TrialReadingCriterionId from TaskConsistentRule where Id =DataInspection.GeneralId) where EntityName='TaskConsistentRule'
|
||||||
|
update DataInspection set ObjectRelationParentId3 = (select top 1 TrialReadingCriterionId from VisitTask where Id =DataInspection.GeneralId) where EntityName='VisitTask'
|
||||||
|
|
|
@ -121,10 +121,6 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Identification { get; set; } = string.Empty;
|
public string Identification { get; set; } = string.Empty;
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// 访视计划ID
|
|
||||||
///// </summary>
|
|
||||||
//public Guid? VisitStageId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 稽查的对象Id
|
/// 稽查的对象Id
|
||||||
|
@ -146,10 +142,17 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public Guid? ObjectRelationParentId2 { get; set; }
|
public Guid? ObjectRelationParentId2 { get; set; }
|
||||||
|
|
||||||
|
public Guid? ObjectRelationParentId3 { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string EntityName { get; set; }
|
public string EntityName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Guid? TrialReadingCriterionId { get; set; }
|
||||||
|
|
||||||
|
public Guid? DoctorUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -464,106 +464,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 肿瘤学阅片结果 记录表格
|
|
||||||
|
|
||||||
//if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingOncologyTaskInfo)))
|
|
||||||
//{
|
|
||||||
// var type = AuditOpt.Add;
|
|
||||||
|
|
||||||
// var oncologyAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingOncologyTaskInfo)).Select(t => t.Entity as ReadingOncologyTaskInfo);
|
|
||||||
|
|
||||||
// var visitTaskIdList = oncologyAnswerList.Select(t => t.VisitTaskId).ToList();
|
|
||||||
|
|
||||||
// var visitTaskList = await _dbContext.VisitTask.Where(t => visitTaskIdList.Contains(t.Id)).Select(t => new { VisitTaskId = t.Id, t.TaskName, t.TaskBlindName, t.VisitTaskNum, t.SubjectId }).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var modifyVisitList = await _dbContext.ReadingGlobalTaskInfo.Where(t => visitTaskIdList.Contains(t.TaskId) && t.VisitTask.TaskState == TaskState.Effect).GroupBy(t => t.TaskId).Select(g => new
|
|
||||||
// {
|
|
||||||
// VisitTaskId = g.Key,
|
|
||||||
// GlobalResult = g.Select(c => new { c.Answer, c.QuestionId })
|
|
||||||
// }).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
// //var oncologyAnswerVisitList = visitTaskList.Join(oncologyAnswerList, t => t.VisitTaskId, u => u.VisitTaskId, (t, u) => new { t.VisitTaskId, t.TaskBlindName, t.TaskName, u.EvaluationReason, u.EvaluationResult }).ToList();
|
|
||||||
|
|
||||||
// var query = from answer in oncologyAnswerList
|
|
||||||
// join visitTask in visitTaskList on answer.VisitTaskId equals visitTask.VisitTaskId
|
|
||||||
// join modifyVisit in modifyVisitList on answer.VisitTaskId equals modifyVisit.VisitTaskId into cc
|
|
||||||
// from modifyVisit in cc.DefaultIfEmpty()
|
|
||||||
// select new
|
|
||||||
// {
|
|
||||||
// visitTask.TaskBlindName,
|
|
||||||
// visitTask.TaskName,
|
|
||||||
// answer.EvaluationReason,
|
|
||||||
// answer.EvaluationResult,
|
|
||||||
// IsGlobalModify = modifyVisit != null,
|
|
||||||
// Reason = modifyVisit != null ? modifyVisit.GlobalResult.Where(t => t.QuestionId == null).FirstOrDefault()?.Answer : String.Empty
|
|
||||||
// };
|
|
||||||
// var result = query.ToList();
|
|
||||||
|
|
||||||
|
|
||||||
// var oncologyAnswer = oncologyAnswerList.First();
|
|
||||||
|
|
||||||
// var cloneEntity = oncologyAnswer.Clone();
|
|
||||||
|
|
||||||
// cloneEntity.Id = NewId.NextGuid();
|
|
||||||
|
|
||||||
// await InsertInspection<ReadingOncologyTaskInfo>(oncologyAnswer, type, x => new InspectionConvertDTO()
|
|
||||||
// {
|
|
||||||
// VisitTaskId = oncologyAnswer.VisitTaskId,
|
|
||||||
|
|
||||||
// ObjectRelationParentId = oncologyAnswer.VisitTaskId,
|
|
||||||
|
|
||||||
// }, new { OncologyAnswerList = result });
|
|
||||||
//}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
// 全局 阅片结果
|
|
||||||
if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingGlobalTaskInfo)))
|
|
||||||
{
|
|
||||||
//var type = AuditOpt.Add;
|
|
||||||
|
|
||||||
//var list = entitys.Where(x => x.Entity.GetType() == typeof(ReadingGlobalTaskInfo)).Select(t => t.Entity as ReadingGlobalTaskInfo);
|
|
||||||
|
|
||||||
|
|
||||||
//foreach (var group in list.GroupBy(t => t.TaskId))
|
|
||||||
//{
|
|
||||||
// var questionAnswerList = group.Where(t => t.QuestionId != null).ToList();
|
|
||||||
|
|
||||||
// var reasonStr = group.Where(t => t.QuestionId == null).FirstOrDefault().Answer;
|
|
||||||
|
|
||||||
// var questionIdList = questionAnswerList.Select(t => t.QuestionId).ToList();
|
|
||||||
|
|
||||||
// var quesionList = await _dbContext.ReadingQuestionTrial.Where(t => questionIdList.Contains(t.Id)).Select(t => new { t.QuestionName, QuestionId = t.Id, t.ShowOrder }).OrderBy(t => t.ShowOrder).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
// var firstEntity = questionAnswerList.First();
|
|
||||||
|
|
||||||
// var cloneEntity = firstEntity.Clone();
|
|
||||||
|
|
||||||
// //保证Id 唯一
|
|
||||||
// cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.GlobalTaskId.ToString(), firstEntity.TaskId.ToString(), firstEntity.Id.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// await InsertInspection<ReadingGlobalTaskInfo>(cloneEntity, type, x => new InspectionConvertDTO()
|
|
||||||
// {
|
|
||||||
// VisitTaskId = x.TaskId,
|
|
||||||
|
|
||||||
// ObjectRelationParentId = x.TaskId,
|
|
||||||
|
|
||||||
// }, new { Reason = reasonStr, QuestionAnswerList = questionAnswerList.Join(quesionList, t => t.QuestionId, u => u.QuestionId, (t, u) => new { t.Answer, u.QuestionName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList() });
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -576,16 +476,19 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
var obj = new object() { };
|
var obj = new object() { };
|
||||||
|
|
||||||
//访视任务
|
//访视任务-- 非Dicom 阅片
|
||||||
|
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitVisitTaskQuestions" && entity.ReadingTaskState != ReadingTaskState.HaveSigned && type == AuditOpt.Update)
|
||||||
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitVisitTaskQuestions" && entity.ReadingTaskState != ReadingTaskState.HaveSigned && type==AuditOpt.Update)
|
|
||||||
{
|
{
|
||||||
//提交访视任务的时候 会多次更新同一个记录 只记录最后一次
|
//提交访视任务的时候 会多次更新同一个记录 只记录最后一次
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 裁判、肿瘤学、全局 都是通用的
|
||||||
|
|
||||||
//裁判任务
|
//裁判任务
|
||||||
if (entity.JudgeResultTaskId != null && (_userInfo.RequestUrl == "ReadingImageTask/saveJudgeVisitTaskResult" || _userInfo.RequestUrl == "ReadingImageTask/saveJudgeVisitTaskResult"))
|
if (entity.JudgeResultTaskId != null && (_userInfo.RequestUrl == "ReadingImageTask/SaveJudgeVisitTaskResult" || _userInfo.RequestUrl == "ReadingImageTask/saveJudgeVisitTaskResult"))
|
||||||
{
|
{
|
||||||
var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == entity.VisitTaskNum).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync();
|
var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == entity.VisitTaskNum).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync();
|
||||||
|
|
||||||
|
@ -651,7 +554,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
TaskName = g.Key.TaskName,
|
TaskName = g.Key.TaskName,
|
||||||
TaskBlindName = g.Key.TaskBlindName,
|
TaskBlindName = g.Key.TaskBlindName,
|
||||||
|
|
||||||
VisitQuestionAnswerList = g.OrderBy(t=>t.ShowOrder).Select(u => new { u.QuestionName, u.Answer }).ToList(),
|
VisitQuestionAnswerList = g.OrderBy(t => t.ShowOrder).Select(u => new { u.QuestionName, u.Answer }).ToList(),
|
||||||
|
|
||||||
GlobalQuestionAnswerList = g.OrderBy(t => t.ShowOrder).Select(u => new { u.QuestionName, Answer = globalResultList.Where(t => t.VisitTaskId == g.Key.VisitTaskId && t.QuestionId == u.ReadingQuestionTrialId).FirstOrDefault()?.Answer ?? String.Empty }).ToList(),
|
GlobalQuestionAnswerList = g.OrderBy(t => t.ShowOrder).Select(u => new { u.QuestionName, Answer = globalResultList.Where(t => t.VisitTaskId == g.Key.VisitTaskId && t.QuestionId == u.ReadingQuestionTrialId).FirstOrDefault()?.Answer ?? String.Empty }).ToList(),
|
||||||
|
|
||||||
|
@ -664,6 +567,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
obj = new { GlobalAnswerList = result };
|
obj = new { GlobalAnswerList = result };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await InsertInspection<VisitTask>(entity, type, x => new InspectionConvertDTO()
|
await InsertInspection<VisitTask>(entity, type, x => new InspectionConvertDTO()
|
||||||
{
|
{
|
||||||
|
@ -673,13 +579,166 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
ObjectRelationParentId = entity.SourceSubjectVisitId != null ? entity.SourceSubjectVisitId : entity.SouceReadModuleId,
|
ObjectRelationParentId = entity.SourceSubjectVisitId != null ? entity.SourceSubjectVisitId : entity.SouceReadModuleId,
|
||||||
|
|
||||||
ObjectRelationParentId2 = entity.DoctorUserId
|
ObjectRelationParentId2 = entity.DoctorUserId,
|
||||||
|
|
||||||
|
ObjectRelationParentId3 = entity.TrialReadingCriterionId,
|
||||||
|
|
||||||
}, obj);
|
}, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 阅片结果
|
||||||
|
|
||||||
|
|
||||||
|
#region Resisit1.1
|
||||||
|
|
||||||
|
//保存影像质量 多条记录,只记录一条稽查
|
||||||
|
if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingTaskQuestionAnswer)))
|
||||||
|
{
|
||||||
|
//保存影像质量
|
||||||
|
if (_userInfo.RequestUrl == "ReadingImageTask/changeDicomReadingQuestionAnswer")
|
||||||
|
{
|
||||||
|
var type = AuditOpt.Add;
|
||||||
|
|
||||||
|
//具体的答案
|
||||||
|
var taskQuestionAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTaskQuestionAnswer)).Select(t => t.Entity as ReadingTaskQuestionAnswer).ToList();
|
||||||
|
|
||||||
|
//获取问题名称 组合成数组
|
||||||
|
var quesionList = await _dbContext.ReadingQuestionTrial.Where(t => taskQuestionAnswerList.Select(k => k.ReadingQuestionTrialId).Contains(t.Id)).Select(t => new { t.QuestionName, QuestionId = t.Id, t.ShowOrder }).OrderBy(t => t.ShowOrder).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var firstEntity = taskQuestionAnswerList.First();
|
||||||
|
|
||||||
|
var cloneEntity = firstEntity.Clone();
|
||||||
|
|
||||||
|
//保证Id 唯一
|
||||||
|
cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.ReadingQuestionCriterionTrialId.ToString(), firstEntity.ReadingQuestionTrialId.ToString(), firstEntity.VisitTaskId.ToString());
|
||||||
|
|
||||||
|
await InsertInspection<ReadingTaskQuestionAnswer>(cloneEntity, type, x => new InspectionConvertDTO()
|
||||||
|
{
|
||||||
|
VisitTaskId = x.VisitTaskId,
|
||||||
|
|
||||||
|
ObjectRelationParentId=x.VisitTaskId,
|
||||||
|
|
||||||
|
TrialReadingCriterionId = x.ReadingQuestionCriterionTrialId,
|
||||||
|
|
||||||
|
}, new { QuestionAnswerList = taskQuestionAnswerList.Join(quesionList, t => t.ReadingQuestionTrialId, u => u.QuestionId, (t, u) => new { t.Answer, u.QuestionName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList() });
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 肿瘤学阅片结果 记录表格
|
||||||
|
|
||||||
|
//if (entitys.Any(x => x.entity.gettype() == typeof(readingoncologytaskinfo)))
|
||||||
|
//{
|
||||||
|
// var type = auditopt.add;
|
||||||
|
|
||||||
|
// var oncologyanswerlist = entitys.where(x => x.entity.gettype() == typeof(readingoncologytaskinfo)).select(t => t.entity as readingoncologytaskinfo);
|
||||||
|
|
||||||
|
// var visittaskidlist = oncologyanswerlist.select(t => t.visittaskid).tolist();
|
||||||
|
|
||||||
|
// var visittasklist = await _dbcontext.visittask.where(t => visittaskidlist.contains(t.id)).select(t => new { visittaskid = t.id, t.taskname, t.taskblindname, t.visittasknum, t.subjectid }).tolistasync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// var modifyvisitlist = await _dbcontext.readingglobaltaskinfo.where(t => visittaskidlist.contains(t.taskid) && t.visittask.taskstate == taskstate.effect).groupby(t => t.taskid).select(g => new
|
||||||
|
// {
|
||||||
|
// visittaskid = g.key,
|
||||||
|
// globalresult = g.select(c => new { c.answer, c.questionid })
|
||||||
|
// }).tolistasync();
|
||||||
|
|
||||||
|
|
||||||
|
// //var oncologyanswervisitlist = visittasklist.join(oncologyanswerlist, t => t.visittaskid, u => u.visittaskid, (t, u) => new { t.visittaskid, t.taskblindname, t.taskname, u.evaluationreason, u.evaluationresult }).tolist();
|
||||||
|
|
||||||
|
// var query = from answer in oncologyanswerlist
|
||||||
|
// join visittask in visittasklist on answer.visittaskid equals visittask.visittaskid
|
||||||
|
// join modifyvisit in modifyvisitlist on answer.visittaskid equals modifyvisit.visittaskid into cc
|
||||||
|
// from modifyvisit in cc.defaultifempty()
|
||||||
|
// select new
|
||||||
|
// {
|
||||||
|
// visittask.taskblindname,
|
||||||
|
// visittask.taskname,
|
||||||
|
// answer.evaluationreason,
|
||||||
|
// answer.evaluationresult,
|
||||||
|
// isglobalmodify = modifyvisit != null,
|
||||||
|
// reason = modifyvisit != null ? modifyvisit.globalresult.where(t => t.questionid == null).firstordefault()?.answer : string.empty
|
||||||
|
// };
|
||||||
|
// var result = query.tolist();
|
||||||
|
|
||||||
|
|
||||||
|
// var oncologyanswer = oncologyanswerlist.first();
|
||||||
|
|
||||||
|
// var cloneentity = oncologyanswer.clone();
|
||||||
|
|
||||||
|
// cloneentity.id = newid.nextguid();
|
||||||
|
|
||||||
|
// await insertinspection<readingoncologytaskinfo>(oncologyanswer, type, x => new inspectionconvertdto()
|
||||||
|
// {
|
||||||
|
// visittaskid = oncologyanswer.visittaskid,
|
||||||
|
|
||||||
|
// objectrelationparentid = oncologyanswer.visittaskid,
|
||||||
|
|
||||||
|
// }, new { oncologyanswerlist = result });
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
// 全局 阅片结果
|
||||||
|
if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingGlobalTaskInfo)))
|
||||||
|
{
|
||||||
|
//var type = AuditOpt.Add;
|
||||||
|
|
||||||
|
//var list = entitys.Where(x => x.Entity.GetType() == typeof(ReadingGlobalTaskInfo)).Select(t => t.Entity as ReadingGlobalTaskInfo);
|
||||||
|
|
||||||
|
|
||||||
|
//foreach (var group in list.GroupBy(t => t.TaskId))
|
||||||
|
//{
|
||||||
|
// var questionAnswerList = group.Where(t => t.QuestionId != null).ToList();
|
||||||
|
|
||||||
|
// var reasonStr = group.Where(t => t.QuestionId == null).FirstOrDefault().Answer;
|
||||||
|
|
||||||
|
// var questionIdList = questionAnswerList.Select(t => t.QuestionId).ToList();
|
||||||
|
|
||||||
|
// var quesionList = await _dbContext.ReadingQuestionTrial.Where(t => questionIdList.Contains(t.Id)).Select(t => new { t.QuestionName, QuestionId = t.Id, t.ShowOrder }).OrderBy(t => t.ShowOrder).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
// var firstEntity = questionAnswerList.First();
|
||||||
|
|
||||||
|
// var cloneEntity = firstEntity.Clone();
|
||||||
|
|
||||||
|
// //保证Id 唯一
|
||||||
|
// cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.GlobalTaskId.ToString(), firstEntity.TaskId.ToString(), firstEntity.Id.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// await InsertInspection<ReadingGlobalTaskInfo>(cloneEntity, type, x => new InspectionConvertDTO()
|
||||||
|
// {
|
||||||
|
// VisitTaskId = x.TaskId,
|
||||||
|
|
||||||
|
// ObjectRelationParentId = x.TaskId,
|
||||||
|
|
||||||
|
// }, new { Reason = reasonStr, QuestionAnswerList = questionAnswerList.Join(quesionList, t => t.QuestionId, u => u.QuestionId, (t, u) => new { t.Answer, u.QuestionName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList() });
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Qc 问题答案
|
// Qc 问题答案
|
||||||
if (entitys.Any(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer)))
|
if (entitys.Any(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer)))
|
||||||
{
|
{
|
||||||
|
@ -715,7 +774,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
ObjectRelationParentId = x.SubjectVisitId,
|
ObjectRelationParentId = x.SubjectVisitId,
|
||||||
}, new
|
}, new
|
||||||
{
|
{
|
||||||
QcQuestionAnswerList = answerList.Join(trialQuestionNameList, t => t.TrialQCQuestionConfigureId, u => u.TrialQCQuestionConfigureId, (t, u) => new { t.Answer, u.QuestionName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList(),
|
QcQuestionAnswerList = answerList.Join(trialQuestionNameList, t => t.TrialQCQuestionConfigureId, u => u.TrialQCQuestionConfigureId, (t, u) => new
|
||||||
|
{
|
||||||
|
t.Answer,
|
||||||
|
u.QuestionName,
|
||||||
|
u.ShowOrder
|
||||||
|
}).OrderBy(t => t.ShowOrder).ToList(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -795,8 +859,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//QC 质疑
|
//QC 质疑
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge)))
|
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge)))
|
||||||
{
|
{
|
||||||
|
@ -842,16 +904,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
var type = GetEntityAuditOpt(item);
|
var type = GetEntityAuditOpt(item);
|
||||||
|
|
||||||
var entity = item.Entity as CheckChallengeDialog;
|
var entity = item.Entity as CheckChallengeDialog;
|
||||||
//var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync();
|
|
||||||
//subjectvisit = subjectvisit ?? new SubjectVisit();
|
|
||||||
//var reason = string.Empty;
|
|
||||||
|
|
||||||
//switch (_userInfo.RequestUrl.ToLower())
|
|
||||||
//{
|
|
||||||
// case "qcoperation/closecheckchallenge":
|
|
||||||
// reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1);
|
|
||||||
// break;
|
|
||||||
//}
|
|
||||||
await InsertInspection<CheckChallengeDialog>(entity, type, x => new InspectionConvertDTO()
|
await InsertInspection<CheckChallengeDialog>(entity, type, x => new InspectionConvertDTO()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -862,12 +915,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
ObjectRelationParentId = entity.SubjectVisitId,
|
ObjectRelationParentId = entity.SubjectVisitId,
|
||||||
}
|
}
|
||||||
//, new
|
|
||||||
//{
|
|
||||||
// CheckState = subjectvisit.CheckState,
|
|
||||||
// RequestBackState = subjectvisit.RequestBackState,
|
|
||||||
// CheckChallengeState = subjectvisit.CheckChallengeState,
|
|
||||||
//}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1221,7 +1269,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
//var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
|
//var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
|
||||||
await InsertInspection<TrialUser>(entity, type, x => new InspectionConvertDTO
|
await InsertInspection<TrialUser>(entity, type, x => new InspectionConvertDTO
|
||||||
{
|
{
|
||||||
IsDistinctionInterface= type == AuditOpt.Update ? true : false,
|
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
||||||
TrialId = x.TrialId,
|
TrialId = x.TrialId,
|
||||||
ObjectRelationParentId = x.TrialId,
|
ObjectRelationParentId = x.TrialId,
|
||||||
ObjectRelationParentId2 = x.UserId,
|
ObjectRelationParentId2 = x.UserId,
|
||||||
|
@ -1520,10 +1568,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
||||||
|
|
||||||
SubjectVisitId = x.IsVisit ? x.ReadingId : null,
|
//SubjectVisitId = x.IsVisit ? x.ReadingId : null,
|
||||||
|
|
||||||
ObjectRelationParentId = entity.ClinicalDataTrialSetId,
|
ObjectRelationParentId = entity.ClinicalDataTrialSetId,
|
||||||
});
|
|
||||||
|
//ObjectRelationParentId2 = x.IsVisit == false?x.ReadingId:null
|
||||||
|
}); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//阅片期计划
|
//阅片期计划
|
||||||
|
@ -1544,7 +1594,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
await InsertInspection<ReadingPeriodSet>(item.Entity as ReadingPeriodSet, type, x => new InspectionConvertDTO()
|
await InsertInspection<ReadingPeriodSet>(item.Entity as ReadingPeriodSet, type, x => new InspectionConvertDTO()
|
||||||
{
|
{
|
||||||
ObjectRelationParentId = x.VisitStageId
|
ObjectRelationParentId = x.VisitStageId,
|
||||||
|
ObjectRelationParentId2 = entity.TrialReadingCriterionId,
|
||||||
|
|
||||||
|
|
||||||
}, new
|
}, new
|
||||||
{
|
{
|
||||||
|
@ -1588,6 +1640,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
{
|
{
|
||||||
ObjectRelationParentId = entity.SubjectVisitId,
|
ObjectRelationParentId = entity.SubjectVisitId,
|
||||||
|
|
||||||
|
ObjectRelationParentId2 = entity.TrialReadingCriterionId,
|
||||||
|
|
||||||
SubjectVisitId = x.SubjectVisitId,
|
SubjectVisitId = x.SubjectVisitId,
|
||||||
IsDistinctionInterface = false,
|
IsDistinctionInterface = false,
|
||||||
});
|
});
|
||||||
|
@ -1649,7 +1703,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
ObjectRelationParentId = entity.SubjectId,
|
ObjectRelationParentId = entity.SubjectId,
|
||||||
|
|
||||||
ObjectRelationParentId2 = entity.DoctorUserId
|
ObjectRelationParentId2 = entity.DoctorUserId,
|
||||||
|
|
||||||
|
ObjectRelationParentId3 = entity.TrialReadingCriterionId,
|
||||||
|
|
||||||
}, new { ArmToTask = entity.ArmEnum });
|
}, new { ArmToTask = entity.ArmEnum });
|
||||||
}
|
}
|
||||||
|
@ -1685,7 +1741,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
await InsertInspection<TaskConsistentRule>(entity, type, x => new InspectionConvertDTO()
|
await InsertInspection<TaskConsistentRule>(entity, type, x => new InspectionConvertDTO()
|
||||||
{
|
{
|
||||||
ObjectRelationParentId = entity.TrialId
|
ObjectRelationParentId = entity.TrialId,
|
||||||
|
|
||||||
|
ObjectRelationParentId2 = entity.TrialReadingCriterionId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
||||||
|
|
||||||
public Guid? ObjectRelationParentId2 { get; set; }
|
public Guid? ObjectRelationParentId2 { get; set; }
|
||||||
|
|
||||||
|
public Guid? ObjectRelationParentId3 { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批次Id
|
/// 批次Id
|
||||||
|
|
Loading…
Reference in New Issue