调整 CriterionNidus ReadingCriterionDictionary 维护sql 修改稽查表配置提交
parent
19ebce1c98
commit
6a7971f314
|
@ -0,0 +1,80 @@
|
|||
--- 1、变更的表名
|
||||
|
||||
--EXEC sp_rename 'old_table_name', 'new_table_name';
|
||||
EXEC sp_rename 'CriterionNidus', 'CriterionNidusSystem';
|
||||
EXEC sp_rename 'ReadingCriterionDictionary', 'ReadingSystemCriterionDictionary';
|
||||
|
||||
|
||||
---- 2、处理发布环境的表数据拆分
|
||||
|
||||
--会直接创建表 CriterionNidusSystem_copy
|
||||
--SELECT *
|
||||
--INTO CriterionNidusSystem_copy
|
||||
--FROM CriterionNidusSystem
|
||||
--WHERE IsSystemCriterion = 0;
|
||||
|
||||
--创建CriterionNidusTrial 将数据迁移过来
|
||||
SELECT *
|
||||
INTO CriterionNidusTrial
|
||||
FROM CriterionNidusSystem
|
||||
WHERE IsSystemCriterion = 0;
|
||||
|
||||
|
||||
SELECT *
|
||||
INTO ReadingTrialCriterionDictionary
|
||||
FROM ReadingSystemCriterionDictionary
|
||||
WHERE IsSystemCriterion = 0;
|
||||
|
||||
|
||||
----- 三、维护稽查数据
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus'
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus' and Identification='CriterionNidus/Add'
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus' and Identification='CriterionNidus/Update'
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus' and Identification='CriterionNidus/Deleted'
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus' and Identification='CriterionNidus/Add/IsTrial'
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus' and Identification='CriterionNidus/Add/IsTrial/Auto'
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus' and Identification='CriterionNidus/Update/IsTrial'
|
||||
select Count(*) from DataInspection where EntityName='CriterionNidus' and Identification='CriterionNidus/Deleted/IsTrial'
|
||||
|
||||
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/QuestionType'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/LesionType'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/OncologyAssessType'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/GlobalAssessType'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/QuestionType/IsTrial'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/LesionType/IsTrial'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/OncologyAssessType/IsTrial'
|
||||
select Count(*) from DataInspection where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/GlobalAssessType/IsTrial'
|
||||
|
||||
|
||||
--系统 CriterionNidusSystem
|
||||
update DataInspection SET Identification='CriterionNidusSystem/Add', EntityName='CriterionNidusSystem' where EntityName='CriterionNidus' and Identification='CriterionNidus/Add'
|
||||
update DataInspection SET Identification='CriterionNidusSystem/Update' , EntityName='CriterionNidusSystem' where EntityName='CriterionNidus' and Identification='CriterionNidus/Update'
|
||||
update DataInspection SET Identification='CriterionNidusSystem/Deleted', EntityName='CriterionNidusSystem' where EntityName='CriterionNidus' and Identification='CriterionNidus/Deleted'
|
||||
|
||||
--项目 CriterionNidusTrial
|
||||
update DataInspection SET Identification='CriterionNidusTrial/Add' , EntityName='CriterionNidusTrial' where EntityName='CriterionNidus' and Identification='CriterionNidus/Add/IsTrial'
|
||||
update DataInspection SET Identification='CriterionNidusTrial/Add/Auto' , EntityName='CriterionNidusTrial' where EntityName='CriterionNidus' and Identification='CriterionNidus/Add/IsTrial/Auto'
|
||||
update DataInspection SET Identification='CriterionNidusTrial/Update' , EntityName='CriterionNidusTrial' where EntityName='CriterionNidus' and Identification='CriterionNidus/Update/IsTrial'
|
||||
update DataInspection SET Identification='CriterionNidusTrial/Deleted' , EntityName='CriterionNidusTrial' where EntityName='CriterionNidus' and Identification='CriterionNidus/Deleted/IsTrial'
|
||||
|
||||
--系统ReadingSystemCriterionDictionary
|
||||
update DataInspection SET Identification='ReadingSystemCriterionDictionary/Add/QuestionType', EntityName='ReadingSystemCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/QuestionType'
|
||||
update DataInspection SET Identification='ReadingSystemCriterionDictionary/Add/LesionType' , EntityName='ReadingSystemCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/LesionType'
|
||||
update DataInspection SET Identification='ReadingSystemCriterionDictionary/Add/OncologyAssessType', EntityName='ReadingSystemCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/OncologyAssessType'
|
||||
update DataInspection SET Identification='ReadingSystemCriterionDictionary/Add/GlobalAssessType', EntityName='ReadingSystemCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/GlobalAssessType'
|
||||
|
||||
--项目ReadingTrialCriterionDictionary
|
||||
update DataInspection SET Identification='ReadingTrialCriterionDictionary/Add/QuestionType', EntityName='ReadingTrialCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/QuestionType/IsTrial'
|
||||
update DataInspection SET Identification='ReadingTrialCriterionDictionary/Add/LesionType' , EntityName='ReadingTrialCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/LesionType/IsTrial'
|
||||
update DataInspection SET Identification='ReadingTrialCriterionDictionary/Add/OncologyAssessType', EntityName='ReadingTrialCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/OncologyAssessType/IsTrial'
|
||||
update DataInspection SET Identification='ReadingTrialCriterionDictionary/Add/GlobalAssessType', EntityName='ReadingTrialCriterionDictionary' where EntityName='ReadingCriterionDictionary' and Identification='ReadingCriterionDictionary/Add/GlobalAssessType/IsTrial'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -569,27 +569,39 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
var entity = item.Entity as CriterionNidusSystem;
|
||||
|
||||
|
||||
var extraIdentification = string.Empty;
|
||||
if (entity.IsSystemCriterion == false)
|
||||
{
|
||||
extraIdentification = "/IsTrial";
|
||||
|
||||
if (_userInfo.RequestUrl != "OrganInfo/addOrUpdateCriterionNidus" && type == AuditOpt.Add)
|
||||
{
|
||||
extraIdentification = "/IsTrial/Auto";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
await InsertInspection<CriterionNidusSystem>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
IsDistinctionInterface = false,
|
||||
|
||||
ObjectRelationParentId = entity.CriterionId,
|
||||
|
||||
TrialReadingCriterionId = entity.IsSystemCriterion == false ? entity.CriterionId : null,
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(CriterionNidusTrial)))
|
||||
{
|
||||
var type = GetEntityAuditOpt(item);
|
||||
|
||||
var entity = item.Entity as CriterionNidusTrial;
|
||||
|
||||
var extraIdentification = string.Empty;
|
||||
|
||||
if (_userInfo.RequestUrl != "OrganInfo/addOrUpdateCriterionNidus" && type == AuditOpt.Add)
|
||||
{
|
||||
extraIdentification = "/Auto";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
await InsertInspection<CriterionNidusTrial>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
IsDistinctionInterface = false,
|
||||
|
||||
ObjectRelationParentId = entity.CriterionId,
|
||||
|
||||
TrialReadingCriterionId = entity.CriterionId,
|
||||
|
||||
ExtraIndentification = extraIdentification
|
||||
|
||||
|
@ -597,6 +609,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
//疗效评估
|
||||
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TumorAssessment_RECIST1Point1)))
|
||||
|
@ -621,8 +634,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingSystemCriterionDictionary)))
|
||||
{
|
||||
|
||||
|
||||
|
||||
var type = AuditOpt.Add;
|
||||
|
||||
var allList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingSystemCriterionDictionary)).Select(t => t.Entity as ReadingSystemCriterionDictionary).ToList();
|
||||
|
@ -646,15 +657,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
var extraIdentification = string.Empty;
|
||||
|
||||
//系统标准
|
||||
if (cloneEntity.IsSystemCriterion)
|
||||
{
|
||||
extraIdentification = $"/{cloneEntity.ParentCode}";
|
||||
}
|
||||
else
|
||||
{
|
||||
extraIdentification = $"/{cloneEntity.ParentCode}/IsTrial";
|
||||
}
|
||||
|
||||
extraIdentification = $"/{cloneEntity.ParentCode}";
|
||||
|
||||
|
||||
|
||||
await InsertInspection<ReadingSystemCriterionDictionary>(cloneEntity, type, x => new InspectionConvertDTO()
|
||||
|
@ -687,9 +692,70 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingTrialCriterionDictionary)))
|
||||
{
|
||||
|
||||
var type = AuditOpt.Add;
|
||||
|
||||
var allList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTrialCriterionDictionary)).Select(t => t.Entity as ReadingTrialCriterionDictionary).ToList();
|
||||
|
||||
//查询出字典的Value ValueCN Des 保存
|
||||
var dicIdList = allList.Select(t => t.DictionaryId).ToList();
|
||||
|
||||
var selectList = await _dbContext.Dictionary.Where(x => dicIdList.Contains(x.Id)).Select(t => new { t.Id, t.Value, t.ValueCN, t.Description, t.ShowOrder }).ToListAsync();
|
||||
|
||||
|
||||
foreach (var list in allList.GroupBy(t => t.ParentCode))
|
||||
{
|
||||
|
||||
var firstEntity = list.First();
|
||||
var cloneEntity = list.First().Clone();
|
||||
|
||||
|
||||
//保证Id 唯一
|
||||
cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.CriterionId.ToString(), firstEntity.ParentCode.ToString());
|
||||
|
||||
|
||||
var extraIdentification = string.Empty;
|
||||
|
||||
|
||||
extraIdentification = $"/{cloneEntity.ParentCode}/IsTrial";
|
||||
|
||||
|
||||
|
||||
await InsertInspection<ReadingTrialCriterionDictionary>(cloneEntity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
|
||||
ObjectRelationParentId = x.CriterionId,
|
||||
|
||||
TrialReadingCriterionId = x.CriterionId,
|
||||
|
||||
//不显示区分接口 通过是否是系统字典 以及字典Code 区分
|
||||
IsDistinctionInterface = false,
|
||||
ExtraIndentification = extraIdentification
|
||||
|
||||
},
|
||||
new
|
||||
{
|
||||
SelectList = selectList.Join(list, t => t.Id, u => u.DictionaryId, (t, u) =>
|
||||
new
|
||||
{
|
||||
t.Value,
|
||||
t.ValueCN,
|
||||
t.Description,
|
||||
t.ShowOrder,
|
||||
u.IsBaseLineUse,
|
||||
u.IsFollowVisitUse
|
||||
}
|
||||
).OrderBy(t => t.ShowOrder).ToList()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1693,7 +1759,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
var entity = item.Entity as ReadingClinicalData;
|
||||
|
||||
var config= await _dbContext.ClinicalDataTrialSet.FindAsync(entity.ClinicalDataTrialSetId);
|
||||
var config = await _dbContext.ClinicalDataTrialSet.FindAsync(entity.ClinicalDataTrialSetId);
|
||||
|
||||
await InsertInspection<ReadingClinicalData>(item.Entity as ReadingClinicalData, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
|
@ -1705,7 +1771,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
ObjectRelationParentId = entity.ClinicalDataTrialSetId,
|
||||
|
||||
//ObjectRelationParentId2 = x.IsVisit == false?x.ReadingId:null
|
||||
},new {FileCountViewStr= config?.ClinicalDataLevel==ClinicalLevel.Subject && config?.ClinicalUploadType==ClinicalUploadType.Table?"NA": entity.FileCount.ToString() });
|
||||
}, new { FileCountViewStr = config?.ClinicalDataLevel == ClinicalLevel.Subject && config?.ClinicalUploadType == ClinicalUploadType.Table ? "NA" : entity.FileCount.ToString() });
|
||||
}
|
||||
|
||||
//阅片期计划
|
||||
|
@ -1921,7 +1987,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
var cloneEntity = firstEntity.Clone();
|
||||
|
||||
|
||||
|
||||
|
||||
//保证Id 唯一
|
||||
cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.ReadingQuestionCriterionTrialId.ToString(), firstEntity.ReadingQuestionTrialId.ToString(), firstEntity.VisitTaskId.ToString());
|
||||
|
@ -1950,7 +2016,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
t.QuestionName,
|
||||
QuestionId = t.Id,
|
||||
t.ShowOrder,
|
||||
AnswerType= t.Type,
|
||||
AnswerType = t.Type,
|
||||
})
|
||||
.OrderBy(t => t.ShowOrder).ToListAsync();
|
||||
|
||||
|
@ -1958,13 +2024,13 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
new
|
||||
{
|
||||
//如果问题类型是附件 特殊处理 方便前端解析
|
||||
Answer= u.AnswerType== "upload"? "❄❅❆❇❈❉❊" +t.Answer:t.Answer,
|
||||
Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer,
|
||||
u.QuestionName,
|
||||
u.DictionaryCode,
|
||||
u.ShowOrder,
|
||||
t.RowId
|
||||
}
|
||||
).OrderBy(t => t.RowId).ThenBy(t=>t.ShowOrder).ToList();
|
||||
).OrderBy(t => t.RowId).ThenBy(t => t.ShowOrder).ToList();
|
||||
|
||||
|
||||
|
||||
|
@ -1980,14 +2046,16 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
ExtraIndentification = extraIdentification,
|
||||
|
||||
}, new { QuestionAnswerList = taskQuestionAnswerList.Join(quesionList, t => t.ReadingQuestionTrialId, u => u.QuestionId, (t, u) =>
|
||||
}, new
|
||||
{
|
||||
QuestionAnswerList = taskQuestionAnswerList.Join(quesionList, t => t.ReadingQuestionTrialId, u => u.QuestionId, (t, u) =>
|
||||
new { Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer, u.DictionaryCode, u.QuestionName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList()
|
||||
,
|
||||
TableQuestionAndAnswerList = tableQuesionAndAnswerList
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2167,7 +2235,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
var cloneEntity = firstEntity.Clone();
|
||||
|
||||
var criterion = await _dbContext.VisitTask.Where(t => t.Id == cloneEntity.GlobalTaskId).Select(t => new { t.TrialReadingCriterionId,t.TrialReadingCriterion.CriterionType } ).FirstOrDefaultAsync();
|
||||
var criterion = await _dbContext.VisitTask.Where(t => t.Id == cloneEntity.GlobalTaskId).Select(t => new { t.TrialReadingCriterionId, t.TrialReadingCriterion.CriterionType }).FirstOrDefaultAsync();
|
||||
|
||||
//保证Id 唯一
|
||||
cloneEntity.Id = IdentifierHelper.CreateGuid(firstEntity.GlobalTaskId.ToString(), criterion.TrialReadingCriterionId.ToString());
|
||||
|
@ -2199,7 +2267,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
extraIdentification = "/PCWG3";
|
||||
//获取访视的评估结果 也要记录稽查
|
||||
var visitAnswerList = await _dbContext.ReadingTaskQuestionAnswer.Where(t => t.VisitTaskId == group.Key &&t.ReadingQuestionTrial.GlobalReadingShowType != GlobalReadingShowType.NotShow).Select(u => new
|
||||
var visitAnswerList = await _dbContext.ReadingTaskQuestionAnswer.Where(t => t.VisitTaskId == group.Key && t.ReadingQuestionTrial.GlobalReadingShowType != GlobalReadingShowType.NotShow).Select(u => new
|
||||
{
|
||||
TaskBlindName = u.VisitTask.TaskBlindName,
|
||||
QuestionId = u.ReadingQuestionTrialId,
|
||||
|
@ -2207,7 +2275,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
u.ReadingQuestionTrial.DictionaryCode,
|
||||
u.ReadingQuestionTrial.ShowOrder,
|
||||
u.Answer
|
||||
}).OrderBy(t=>t.ShowOrder).ToListAsync();
|
||||
}).OrderBy(t => t.ShowOrder).ToListAsync();
|
||||
|
||||
|
||||
var obj = new
|
||||
|
@ -2217,7 +2285,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
|
||||
Reason = group.Where(t => t.QuestionId == null && t.GlobalAnswerType == GlobalAnswerType.Reason).FirstOrDefault()?.Answer,
|
||||
|
||||
|
||||
QuestionAnswerList = questionAnswerList.Join(quesionList, t => t.QuestionId, u => u.QuestionId, (t, u) => new { t.Answer, u.QuestionName, u.DictionaryCode, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList()
|
||||
};
|
||||
|
||||
|
@ -2259,7 +2327,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
VisitTaskId = x.GlobalTaskId,
|
||||
TrialReadingCriterionId = criterion.TrialReadingCriterionId,
|
||||
ObjectRelationParentId = x.TaskId,
|
||||
ExtraIndentification=extraIdentification
|
||||
ExtraIndentification = extraIdentification
|
||||
}, new { GlobalAnswerList = objList });
|
||||
|
||||
}
|
||||
|
@ -2628,7 +2696,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
if (info == null)
|
||||
{
|
||||
var subject= _dbContext.Subject.Find(generalData.SubjectId);
|
||||
var subject = _dbContext.Subject.Find(generalData.SubjectId);
|
||||
|
||||
generalData.TrialId = subject?.TrialId;
|
||||
generalData.SiteId = subject?.SiteId;
|
||||
|
@ -2639,10 +2707,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//以后移除
|
||||
generalData.SiteCode = info?.TrialSiteCode ?? generalData.SiteCode;
|
||||
|
|
Loading…
Reference in New Issue