修改site关联
This commit is contained in:
@@ -1316,73 +1316,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
|
||||
|
||||
#region OLd
|
||||
//var entitylist = entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer)).Select(x => x.Entity as TrialQCQuestionAnswer).ToList();
|
||||
//var firstEntity = entitylist.FirstOrDefault();
|
||||
//var subjectVisit = await _dbContext.SubjectVisit.Where(x => x.Id == firstEntity.SubjectVisitId).FirstOrDefaultAsync();
|
||||
//subjectVisit = subjectVisit ?? new SubjectVisit();
|
||||
//if (type == "Add")
|
||||
//{
|
||||
|
||||
|
||||
// await InsertInspection(firstEntity, type, answer => new InspectionConvertDTO()
|
||||
// {
|
||||
// SiteId = subjectVisit.SiteId,
|
||||
// SubjectId = subjectVisit.SubjectId,
|
||||
// SubjectVisitName = subjectVisit.VisitName,
|
||||
// TrialId = subjectVisit.TrialId,
|
||||
// SubjectVisitId = subjectVisit.Id,
|
||||
|
||||
// //GeneralId = subjectVisit.Id,
|
||||
// //byzhouhang
|
||||
// ObjectRelationParentId = subjectVisit.Id,
|
||||
// }, new
|
||||
// {
|
||||
// QcQuestionAnswerCommands = await Getdata(entitylist),
|
||||
// });
|
||||
//}
|
||||
//else if (type == "Update")
|
||||
//{
|
||||
|
||||
// var questionIds = entitylist.Where(x => x.SubjectVisitId == subjectVisit.Id).Select(x => x.Id).ToList();
|
||||
// var createUserId = entitylist.Select(x => x.CreateUserId).FirstOrDefault();
|
||||
// var noUpdateData = _dbContext.TrialQCQuestionAnswer.Where(x => x.CreateUserId == createUserId && x.SubjectVisitId == subjectVisit.Id && !questionIds.Contains(x.Id)).ToList();
|
||||
// entitylist.AddRange(noUpdateData);
|
||||
|
||||
// await InsertInspection(firstEntity, type, answer => new InspectionConvertDTO()
|
||||
// {
|
||||
// SiteId = subjectVisit.SiteId,
|
||||
// SubjectId = subjectVisit.SubjectId,
|
||||
// SubjectVisitName = subjectVisit.VisitName,
|
||||
// TrialId = subjectVisit.TrialId,
|
||||
// SubjectVisitId = subjectVisit.Id,
|
||||
|
||||
// //GeneralId = subjectVisit.Id,
|
||||
// //byzhouhang
|
||||
// ObjectRelationParentId = subjectVisit.Id,
|
||||
// }, new
|
||||
// {
|
||||
// QcQuestionAnswerCommands = await Getdata(entitylist),
|
||||
// });
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//async Task<List<AnswerDto>> Getdata(List<TrialQCQuestionAnswer> questionAnswers)
|
||||
//{
|
||||
// var ids = questionAnswers.Select(x => x.TrialQCQuestionConfigureId).ToList();
|
||||
// var trialQCQuestionConfigureDatas = await _dbContext.TrialQCQuestionConfigure.Where(x => ids.Contains(x.Id)).ToListAsync();
|
||||
// var collect = questionAnswers.GroupJoin(trialQCQuestionConfigureDatas, one => one.TrialQCQuestionConfigureId, two => two.Id, (x, y) => new { one = x, two = y })
|
||||
// .SelectMany(a => a.two.DefaultIfEmpty(), (c, d) => new { c = c.one, d })
|
||||
// .OrderBy(x => x.d.ShowOrder)
|
||||
// .Select(o => new AnswerDto()
|
||||
// {
|
||||
// QuestionName = o.d.QuestionName,
|
||||
// Answer = o.c.Answer,
|
||||
// }).ToList();
|
||||
// return collect;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -1504,7 +1437,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
var entity = item.Entity as TrialSiteSurvey;
|
||||
if (entity.TrialSite == null)
|
||||
{
|
||||
entity.TrialSite = await _dbContext.TrialSite.IgnoreQueryFilters().Where(x => x.SiteId == entity.SiteId && x.TrialId == entity.TrialId).FirstOrDefaultAsync();
|
||||
entity.TrialSite = await _dbContext.TrialSite.IgnoreQueryFilters().Where(x => x.Id == entity.TrialSiteId && x.TrialId == entity.TrialId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
if (entity.PreliminaryUser == null)
|
||||
@@ -1714,7 +1647,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
if (entity.TrialSite == null)
|
||||
{
|
||||
entity.TrialSite = await _dbContext.TrialSite.Where(x => x.TrialId == entity.TrialId && x.SiteId == entity.SiteId).IgnoreQueryFilters().FirstOrDefaultAsync();
|
||||
entity.TrialSite = await _dbContext.TrialSite.Where(x => x.Id == entity.TrialSiteId).IgnoreQueryFilters().FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
await InsertInspection<TrialSiteUser>(item.Entity as TrialSiteUser, type, x => new InspectionConvertDTO
|
||||
@@ -1736,17 +1669,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
var entity = item.Entity as Subject;
|
||||
var finalSubjectVisitName = await _dbContext.SubjectVisit.AsNoTracking().Where(x => x.Id == entity.FinalSubjectVisitId && entity.FinalSubjectVisitId != null).Select(x => x.VisitName).FirstOrDefaultAsync();
|
||||
|
||||
//var trialSiteCode = await _dbContext.TrialSite.Where(t => t.TrialId == entity.TrialId && t.SiteId == entity.SiteId).Select(t => t.TrialSiteCode).FirstOrDefaultAsync();
|
||||
|
||||
var trialSiteId = await _dbContext.TrialSite.Where(t => t.TrialId == entity.TrialId && t.SiteId == entity.SiteId).Select(t => t.Id).FirstOrDefaultAsync();
|
||||
|
||||
await InsertInspection<Subject>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
SubjectId = x.Id,
|
||||
SiteId = x.SiteId,
|
||||
|
||||
TrialSiteId = x.TrialSiteId,
|
||||
|
||||
//项目的信息 找离的最近的项目稽查信息
|
||||
ObjectRelationParentId = trialSiteId,
|
||||
ObjectRelationParentId = entity.TrialSiteId,
|
||||
}, new
|
||||
{
|
||||
FinalSubjectVisitName = finalSubjectVisitName,
|
||||
@@ -1861,7 +1792,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectVisitId = x.Id,
|
||||
SiteId = x.SiteId,
|
||||
|
||||
TrialSiteId = x.TrialSiteId,
|
||||
|
||||
ExtraIndentification = extraIdentification,
|
||||
|
||||
@@ -2090,7 +2022,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
var clinicalDataTrialSet = await _dbContext.ClinicalDataTrialSet.Where(t => t.Id == clinicalData.ClinicalDataTrialSetId).FirstOrDefaultAsync();
|
||||
|
||||
SubjectVisit? visit = await _dbContext.SubjectVisit.Where(x => x.Id == clinicalData.ReadingId).FirstOrDefaultAsync();
|
||||
Site? siteInfo = null;
|
||||
TrialSite? siteInfo = null;
|
||||
Subject? subject = null;
|
||||
|
||||
//阅片标准
|
||||
@@ -2105,7 +2037,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
if (visit != null)
|
||||
{
|
||||
siteInfo = await _dbContext.Site.Where(x => x.Id == visit.SiteId).FirstOrDefaultAsync();
|
||||
siteInfo = await _dbContext.TrialSite.Where(x => x.Id == visit.TrialSiteId).FirstOrDefaultAsync();
|
||||
subject = await _dbContext.Subject.Where(x => x.Id == clinicalData.SubjectId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
@@ -2117,7 +2049,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
SubjectVisitId = subjectVisitId,
|
||||
}, new
|
||||
{
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.SiteCode,
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.TrialSiteCode,
|
||||
SubjectCode = subject == null ? "" : subject.Code,
|
||||
VisitName = visit == null ? "" : visit.VisitName,
|
||||
clinicalDataTrialSet.ClinicalDataSetName,
|
||||
@@ -2140,7 +2072,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
var clinicalDataTrialSet = await _dbContext.ClinicalDataTrialSet.Where(t => t.Id == entity.ClinicalDataTrialSetId).FirstOrDefaultAsync();
|
||||
|
||||
SubjectVisit? visit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.ReadingId).FirstOrDefaultAsync();
|
||||
Site? siteInfo = null;
|
||||
TrialSite? siteInfo = null;
|
||||
Subject? subject = null;
|
||||
|
||||
//阅片标准
|
||||
@@ -2155,7 +2087,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
if (visit != null)
|
||||
{
|
||||
siteInfo = await _dbContext.Site.Where(x => x.Id == visit.SiteId).FirstOrDefaultAsync();
|
||||
siteInfo = await _dbContext.TrialSite.Where(x => x.Id == visit.TrialSiteId).FirstOrDefaultAsync();
|
||||
subject = await _dbContext.Subject.Where(x => x.Id == entity.SubjectId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
@@ -2167,7 +2099,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
SubjectVisitId = subjectVisitId,
|
||||
}, new
|
||||
{
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.SiteCode,
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.TrialSiteCode,
|
||||
SubjectCode = subject == null ? "" : subject.Code,
|
||||
VisitName = visit == null ? "" : visit.VisitName,
|
||||
clinicalDataTrialSet.ClinicalDataSetName,
|
||||
@@ -2328,8 +2260,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
var siteCodes = string.Empty;
|
||||
if (entity.ReadingScope == ReadingScopeEnum.Site)
|
||||
{
|
||||
var siteIds = entity.ReadingPeriodSites.Select(t => t.SiteId).ToList();
|
||||
var nameList = _dbContext.TrialSite.Where(c => c.TrialId == entity.TrialId && siteIds.Contains(c.SiteId)).Select(t => t.TrialSiteCode).ToList();
|
||||
var siteIds = entity.ReadingPeriodSites.Select(t => t.TrialSiteId).ToList();
|
||||
var nameList = _dbContext.TrialSite.Where(c => c.TrialId == entity.TrialId && siteIds.Contains(c.Id)).Select(t => t.TrialSiteCode).ToList();
|
||||
|
||||
siteCodes = String.Join(',', nameList);
|
||||
}
|
||||
@@ -2421,12 +2353,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
|
||||
Subject subject = await _dbContext.Subject.Where(x => x.Id == readModule.SubjectId).FirstOrDefaultAsync();
|
||||
Site siteInfo = await _dbContext.Site.Where(x => x.Id == subject.SiteId).FirstOrDefaultAsync();
|
||||
TrialSite siteInfo = await _dbContext.TrialSite.Where(x => x.Id == subject.TrialSiteId).FirstOrDefaultAsync();
|
||||
|
||||
var clinicalDataSetNameList = clinicalDataTrialSetList.Select(x => x.ClinicalDataSetName).ToList();
|
||||
objData= new
|
||||
{
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.SiteCode,
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.TrialSiteCode,
|
||||
SubjectCode = subject == null ? "" : subject.Code,
|
||||
LatestScanDate = latestScanDate,
|
||||
ClinicalDataSetName = string.Join(",", clinicalDataSetNameList),
|
||||
@@ -2464,7 +2396,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
var readModuleCriterionFrom = await _dbContext.ReadModuleCriterionFrom.Where(t => t.ReadModuleId == entity.Id).FirstOrDefaultAsync();
|
||||
var latestScanDate = await _dbContext.ReadModule.Where(t => t.Id == entity.Id).Select(x => x.SubjectVisit.LatestScanDate).FirstOrDefaultAsync();
|
||||
Site? siteInfo = null;
|
||||
TrialSite? siteInfo = null;
|
||||
Subject? subject = null;
|
||||
//阅片标准
|
||||
|
||||
@@ -2486,7 +2418,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
|
||||
subject = await _dbContext.Subject.Where(x => x.Id == entity.SubjectId).FirstOrDefaultAsync();
|
||||
siteInfo = await _dbContext.Site.Where(x => x.Id == subject.SiteId).FirstOrDefaultAsync();
|
||||
siteInfo = await _dbContext.TrialSite.Where(x => x.Id == subject.TrialSiteId).FirstOrDefaultAsync();
|
||||
|
||||
var clinicalDataSetNameList = clinicalDataTrialSetList.Select(x => x.ClinicalDataSetName).ToList().Distinct();
|
||||
|
||||
@@ -2496,7 +2428,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
objData=new
|
||||
{
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.SiteCode,
|
||||
SiteCode = siteInfo == null ? "" : siteInfo.TrialSiteCode,
|
||||
SubjectCode = subject == null ? "" : subject.Code,
|
||||
LatestScanDate = latestScanDate,
|
||||
ClinicalDataSetName = string.Join(",", clinicalDataSetNameList),
|
||||
@@ -3473,7 +3405,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
InspectionGeneralData generalData = new InspectionGeneralData()
|
||||
{
|
||||
SiteId = inspection.SiteId,
|
||||
TrialSiteId=inspection.TrialSiteId,
|
||||
SubjectId = inspection.SubjectId,
|
||||
SubjectVisitId = inspection.SubjectVisitId,
|
||||
TrialId = inspection.TrialId,
|
||||
@@ -3486,14 +3418,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
if (inspection.VisitTaskId != null)
|
||||
{
|
||||
|
||||
if (generalData.TrialId == null || generalData.SiteId == null || generalData.SubjectId == null || generalData.TrialReadingCriterionId == null)
|
||||
if (generalData.TrialId == null || generalData.TrialSiteId == null || generalData.SubjectId == null || generalData.TrialReadingCriterionId == null)
|
||||
{
|
||||
var info = await _dbContext.VisitTask.Where(x => x.Id == inspection.VisitTaskId).Select(x => new { SubjectCode = x.Subject.Code, TrialSiteCode = x.Subject.TrialSite.TrialSiteCode, SubjectId = x.SubjectId, x.Subject.SiteId, x.TrialId, x.SourceSubjectVisitId, ReadModuleSubjectVisitId = (Guid?)x.ReadModule.SubjectVisitId, x.TrialReadingCriterionId }).FirstOrDefaultAsync();
|
||||
var info = await _dbContext.VisitTask.Where(x => x.Id == inspection.VisitTaskId).Select(x => new { SubjectCode = x.Subject.Code, TrialSiteCode = x.Subject.TrialSite.TrialSiteCode, SubjectId = x.SubjectId, x.Subject.TrialSiteId, x.TrialId, x.SourceSubjectVisitId, ReadModuleSubjectVisitId = (Guid?)x.ReadModule.SubjectVisitId, x.TrialReadingCriterionId }).FirstOrDefaultAsync();
|
||||
|
||||
generalData.TrialReadingCriterionId = info?.TrialReadingCriterionId ?? generalData.TrialReadingCriterionId;
|
||||
generalData.TrialId = info?.TrialId ?? generalData.TrialId;
|
||||
generalData.SubjectId = info?.SubjectId ?? generalData.SubjectId;
|
||||
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||
generalData.TrialSiteId = info?.TrialSiteId ?? generalData.TrialSiteId;
|
||||
generalData.SubjectVisitId = info?.SourceSubjectVisitId != null ? info?.SourceSubjectVisitId : (info?.ReadModuleSubjectVisitId != null ? info?.ReadModuleSubjectVisitId : null);
|
||||
|
||||
//以后移除
|
||||
@@ -3517,14 +3449,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
if (inspection.SubjectVisitId != null)
|
||||
{
|
||||
if (generalData.TrialId == null || generalData.SiteId == null || generalData.SubjectId == null)
|
||||
if (generalData.TrialId == null || generalData.TrialSiteId == null || generalData.SubjectId == null)
|
||||
{
|
||||
var info = await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x =>
|
||||
new { x.SubjectId, x.SiteId, x.TrialId, SubjectCode = x.Subject.Code, TrialSiteCode = x.Subject.TrialSite.TrialSiteCode }).FirstOrDefaultAsync();
|
||||
new { x.SubjectId, x.TrialSiteId, x.TrialId, SubjectCode = x.Subject.Code, TrialSiteCode = x.Subject.TrialSite.TrialSiteCode }).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
generalData.TrialId = info?.TrialId ?? generalData.TrialId;
|
||||
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||
generalData.TrialSiteId = info?.TrialSiteId ?? generalData.TrialSiteId;
|
||||
generalData.SubjectId = info?.SubjectId ?? generalData.SubjectId;
|
||||
|
||||
//以后移除
|
||||
@@ -3538,21 +3470,22 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
if (generalData.SubjectId != null)
|
||||
{
|
||||
if (generalData.TrialId == null || generalData.SiteId == null)
|
||||
if (generalData.TrialId == null || generalData.TrialSiteId == null)
|
||||
{
|
||||
var info = await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => new { SubjectId = x.Id, x.SiteId, x.TrialId, SubjectCode = x.Code, TrialSiteCode = x.TrialSite.TrialSiteCode }).FirstOrDefaultAsync();
|
||||
var info = await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => new { SubjectId = x.Id, x.TrialSiteId, x.TrialId, SubjectCode = x.Code, TrialSiteCode = x.TrialSite.TrialSiteCode }).FirstOrDefaultAsync();
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
var subject = _dbContext.Subject.Find(generalData.SubjectId);
|
||||
|
||||
generalData.TrialId = subject?.TrialId;
|
||||
generalData.SiteId = subject?.SiteId;
|
||||
generalData.TrialSiteId = subject?.TrialSiteId ;
|
||||
}
|
||||
else
|
||||
{
|
||||
generalData.TrialId = info?.TrialId ?? generalData.TrialId;
|
||||
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||
|
||||
generalData.TrialSiteId = info?.TrialSiteId ?? generalData.TrialSiteId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -180,10 +180,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
||||
/// </summary>
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 中心
|
||||
/// </summary>
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get;set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 受试者
|
||||
|
||||
@@ -11,19 +11,8 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
|
||||
public void Configure(EntityTypeBuilder<NoneDicomStudy> builder)
|
||||
{
|
||||
// builder
|
||||
// .HasMany(s => s.TrialSiteUserList)
|
||||
//.WithOne(c => c.DicomStudy)
|
||||
//.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
//.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
builder
|
||||
.HasOne(s => s.TrialSite)
|
||||
.WithMany(c => c.NoneDicomStudyList)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
public void Configure(EntityTypeBuilder<ReadingPeriodSite> builder)
|
||||
{
|
||||
|
||||
builder
|
||||
.HasOne(s => s.TrialSite)
|
||||
.WithMany(c => c.ReadingPeriodSites)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,19 +11,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
|
||||
public void Configure(EntityTypeBuilder<DicomStudy> builder)
|
||||
{
|
||||
// builder
|
||||
// .HasMany(s => s.TrialSiteUserList)
|
||||
// .WithOne(c => c.DicomStudy)
|
||||
//.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
//.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
builder
|
||||
.HasOne(s => s.TrialSite)
|
||||
.WithMany(c => c.StudyList)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
|
||||
builder
|
||||
.HasMany(s => s.ReadingClinicalDataList)
|
||||
|
||||
@@ -12,20 +12,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
|
||||
public void Configure(EntityTypeBuilder<StudyMonitor> builder)
|
||||
{
|
||||
// builder
|
||||
// .HasMany(s => s.TrialSiteUserList)
|
||||
//.WithOne(c => c.DicomStudy)
|
||||
//.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
//.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
//builder.Property(e => e.TotalMillisecondsInterval).HasValueGenerator<UploadTotalMillisecondsInterval>().ValueGeneratedOnAdd();
|
||||
|
||||
|
||||
builder
|
||||
.HasOne(s => s.TrialSite)
|
||||
.WithMany(c => c.StudyMonitorList)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,19 +11,6 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
|
||||
public void Configure(EntityTypeBuilder<Subject> builder)
|
||||
{
|
||||
// 从 Subject 到 TrialSiteUserList 会用两个建
|
||||
//builder
|
||||
//.HasMany(s => s.TrialSiteUserList)
|
||||
//.WithOne(c => c.Subject)
|
||||
//.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
//.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
// 受试者 在项目中只有一个site 获取 TrialSiteCode 用两个键
|
||||
builder
|
||||
.HasOne(s => s.TrialSite)
|
||||
.WithMany(c => c.SubjectList)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
//不能同时配置一对多 和一对一 但是有时表要存储多的最新的 比如受试者 最新的访视 在这里要显示配置
|
||||
builder.HasOne(s => s.LatestSubjectVisit);
|
||||
|
||||
@@ -11,20 +11,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
|
||||
public void Configure(EntityTypeBuilder<SubjectVisit> builder)
|
||||
{
|
||||
// SubjectVisit 从TrialSite 导航获取 TrialSiteCode 用两个键连接
|
||||
builder
|
||||
.HasOne(s => s.TrialSite)
|
||||
.WithMany(c => c.SubjectVisitList)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
// 从 SubjectVisit 到 TrialSiteUserList 会用两个建 这里不行,添加受试者的时候,批量添加访视的时候,siteId trialId 会重复 所以不能这样搞
|
||||
// modelBuilder.Entity<SubjectVisit>()
|
||||
//.HasMany(s => s.TrialSiteUserList)
|
||||
//.WithOne(c => c.SubjectVisit)
|
||||
//.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
//.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
|
||||
builder.HasOne(s => s.Subject).WithMany(sv => sv.SubjectVisitList);
|
||||
|
||||
@@ -11,12 +11,7 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
|
||||
public void Configure(EntityTypeBuilder<TrialSite> builder)
|
||||
{
|
||||
//从 TrialSite 导航到TrialUserSite (Site下负责的CRC用户 )会用两个建 trial Site列表会用到
|
||||
builder
|
||||
.HasMany(s => s.CRCUserList)
|
||||
.WithOne(c => c.TrialSite)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -36,18 +31,5 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
}
|
||||
}
|
||||
|
||||
//public class SubjectCriteriaEvaluationVisitFilterConfigration : IEntityTypeConfiguration<SubjectCriteriaEvaluationVisitFilter>
|
||||
//{
|
||||
|
||||
|
||||
// public void Configure(EntityTypeBuilder<SubjectCriteriaEvaluationVisitFilter> builder)
|
||||
// {
|
||||
// builder
|
||||
// .HasMany(s => s.SubjectCriterionTaskList)
|
||||
// .WithOne(c => c.SubjectCriteriaEvaluationVisitFilter)
|
||||
// .HasForeignKey(s => new { s.SubjectId, s.TrialReadingCriterionId })
|
||||
// .HasPrincipalKey(c => new { c.SubjectId, c.TrialReadingCriterionId });
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -11,21 +11,8 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
|
||||
public void Configure(EntityTypeBuilder<TrialSiteSurvey> builder)
|
||||
{
|
||||
// SubjectVisit 从TrialSite 导航获取 TrialSiteCode 用两个键连接
|
||||
builder
|
||||
.HasOne(s => s.TrialSite)
|
||||
.WithMany(c => c.TrialSiteSurveyList)
|
||||
.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
|
||||
// 从 SubjectVisit 到 TrialSiteUserList 会用两个建 这里不行,添加受试者的时候,批量添加访视的时候,siteId trialId 会重复 所以不能这样搞
|
||||
// modelBuilder.Entity<SubjectVisit>()
|
||||
//.HasMany(s => s.TrialSiteUserList)
|
||||
//.WithOne(c => c.SubjectVisit)
|
||||
//.HasForeignKey(s => new { s.TrialId, s.SiteId })
|
||||
//.HasPrincipalKey(c => new { c.TrialId, c.SiteId });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user