修改标识
parent
15dda3678b
commit
5a7ad0a4b4
|
@ -243,7 +243,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
//把父层级的数据的 CommonData 数据合并(每一个层级把下面层级需要的数据放在CommonData 里面) 麻烦点是每个层级都需要记录一些信息,而且名称不能重复
|
||||
|
||||
var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId);
|
||||
var objectLsit = new List<object>();
|
||||
|
||||
var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId, objectLsit);
|
||||
|
||||
var currentDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonDict[nameof(InspectionJsonDetail.CommonData)].ToJsonStr());
|
||||
|
||||
|
@ -345,12 +347,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
private async Task<List<object>> GetRelationParentData(Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId)
|
||||
private async Task AddJsonObjectToDic(Guid? objectRelationParentId, DateTime createTime, Guid batchId, List<object> objectLsit)
|
||||
{
|
||||
|
||||
var objectLsit = new List<object>();
|
||||
|
||||
|
||||
if (objectRelationParentId != null)
|
||||
{
|
||||
//父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
||||
|
@ -388,65 +386,133 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId);
|
||||
await AddJsonObjectToDic(relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
await AddJsonObjectToDic( relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (objectRelationParentId2 != null)
|
||||
{
|
||||
//父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
||||
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId2 && (t.CreateTime <= createTime || t.BatchId == batchId)).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName }).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
if (relationParentInspection != null)
|
||||
{
|
||||
Dictionary<string, object> jsonDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(relationParentInspection.JsonDetail);
|
||||
|
||||
|
||||
var commonDataDicObj = jsonDic[nameof(InspectionJsonDetail.CommonData)];
|
||||
|
||||
objectLsit.Add(commonDataDicObj);
|
||||
|
||||
|
||||
//避免对象信息记录 把 Data里面的信息也取过去 但是加上稽查对象的前缀
|
||||
var dataDicObj = jsonDic[nameof(InspectionJsonDetail.Data)];
|
||||
|
||||
if (dataDicObj != null)
|
||||
{
|
||||
var entityName = relationParentInspection.EntityName;
|
||||
|
||||
IDictionary<string, object> newNamepDic = new Dictionary<string, object>();
|
||||
|
||||
var tempDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(dataDicObj.ToJsonStr());
|
||||
|
||||
foreach (var valuePair in tempDic)
|
||||
{
|
||||
newNamepDic.Add(entityName + "_" + valuePair.Key, valuePair.Value);
|
||||
}
|
||||
|
||||
|
||||
objectLsit.Add(newNamepDic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//用户的数据稽查没有 临时处理
|
||||
|
||||
var userObj = await _repository.Where<User>(t => t.Id == objectRelationParentId2).Select(t => new { UserFullName = t.FullName, t.UserName }).FirstOrDefaultAsync();
|
||||
|
||||
var userObj = await _repository.Where<User>(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.FullName, t.Phone, t.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.EMail, t.OrganizationName }).FirstOrDefaultAsync();
|
||||
|
||||
objectLsit.Add(userObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<List<object>> GetRelationParentData(Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId, List<object> objectLsit)
|
||||
{
|
||||
await AddJsonObjectToDic(objectRelationParentId, createTime, batchId, objectLsit);
|
||||
await AddJsonObjectToDic(objectRelationParentId2, createTime, batchId, objectLsit);
|
||||
|
||||
#region 废弃
|
||||
//if (objectRelationParentId != null)
|
||||
//{
|
||||
// //父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
||||
// var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && (t.CreateTime <= createTime || t.BatchId == batchId)).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName }).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
// if (relationParentInspection != null)
|
||||
// {
|
||||
// Dictionary<string, object> jsonDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(relationParentInspection.JsonDetail);
|
||||
|
||||
|
||||
// var commonDataDicObj = jsonDic[nameof(InspectionJsonDetail.CommonData)];
|
||||
|
||||
// objectLsit.Add(commonDataDicObj);
|
||||
|
||||
// //避免对象信息记录 把 Data里面的信息也取过去 但是加上稽查对象的前缀
|
||||
// var dataDicObj = jsonDic[nameof(InspectionJsonDetail.Data)];
|
||||
|
||||
// if (dataDicObj != null)
|
||||
// {
|
||||
// var entityName = relationParentInspection.EntityName;
|
||||
|
||||
// IDictionary<string, object> newNamepDic = new Dictionary<string, object>();
|
||||
|
||||
// var tempDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(dataDicObj.ToJsonStr());
|
||||
|
||||
// foreach (var valuePair in tempDic)
|
||||
// {
|
||||
// newNamepDic.Add(entityName + "_" + valuePair.Key, valuePair.Value);
|
||||
// }
|
||||
|
||||
|
||||
// objectLsit.Add(newNamepDic);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//if (objectRelationParentId2 != null)
|
||||
//{
|
||||
// //父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
||||
// var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId2 && (t.CreateTime <= createTime || t.BatchId == batchId)).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName }).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
// if (relationParentInspection != null)
|
||||
// {
|
||||
// Dictionary<string, object> jsonDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(relationParentInspection.JsonDetail);
|
||||
|
||||
|
||||
// var commonDataDicObj = jsonDic[nameof(InspectionJsonDetail.CommonData)];
|
||||
|
||||
// objectLsit.Add(commonDataDicObj);
|
||||
|
||||
|
||||
// //避免对象信息记录 把 Data里面的信息也取过去 但是加上稽查对象的前缀
|
||||
// var dataDicObj = jsonDic[nameof(InspectionJsonDetail.Data)];
|
||||
|
||||
// if (dataDicObj != null)
|
||||
// {
|
||||
// var entityName = relationParentInspection.EntityName;
|
||||
|
||||
// IDictionary<string, object> newNamepDic = new Dictionary<string, object>();
|
||||
|
||||
// var tempDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(dataDicObj.ToJsonStr());
|
||||
|
||||
// foreach (var valuePair in tempDic)
|
||||
// {
|
||||
// newNamepDic.Add(entityName + "_" + valuePair.Key, valuePair.Value);
|
||||
// }
|
||||
|
||||
|
||||
// objectLsit.Add(newNamepDic);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //用户的数据稽查没有 临时处理
|
||||
|
||||
|
||||
|
||||
// var userObj = await _repository.Where<User>(t => t.Id == objectRelationParentId2).Select(t => new { UserRealName = t.FullName, t.Phone, t.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.EMail, t.OrganizationName }).FirstOrDefaultAsync();
|
||||
|
||||
// objectLsit.Add(userObj);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
return objectLsit;
|
||||
}
|
||||
|
@ -455,6 +521,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 格式化日期和时间
|
||||
/// </summary>
|
||||
|
|
|
@ -25,11 +25,11 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
//导航属性
|
||||
[ForeignKey("SiteId")]
|
||||
public Site Site { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("TrialId")]
|
||||
public Trial Trial { get; set; }
|
||||
|
||||
|
@ -38,25 +38,27 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// <summary>
|
||||
/// Site 下面有多个访视记录
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public List<SubjectVisit> SubjectVisitList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TrialSiteSurvey> TrialSiteSurveyList { get; set; }
|
||||
|
||||
|
||||
//Site 由多个人负责
|
||||
[JsonIgnore]
|
||||
public List<TrialSiteUser> CRCUserList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<Subject> SubjectList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<DicomStudy> StudyList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<NoneDicomStudy> NoneDicomStudyList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<StudyMonitor> StudyMonitorList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<ReadingPeriodSite> ReadingPeriodSites { get; set; }
|
||||
}
|
||||
}
|
|
@ -44,21 +44,21 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("UserId")]
|
||||
public User User { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("TrialId")]
|
||||
public Trial Trial { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("SiteId")]
|
||||
public Site Site { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public TrialSite TrialSite { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public TrialUser TrialUser { get; set; }
|
||||
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ namespace IRaCIS.Core.Domain.Models
|
|||
{
|
||||
public Guid UserId { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public Trial Trial { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("UserId")]
|
||||
public User User { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TrialSiteUser> SiteList { get; set; }
|
||||
|
||||
|
||||
|
|
|
@ -24,21 +24,24 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public List<SubjectCanceDoctor> SubjectCanceDoctorList { get; set; }
|
||||
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("FinalSubjectVisitId")]
|
||||
public SubjectVisit FinalSubjectVisit { get; set; }
|
||||
public Guid? FinalSubjectVisitId { get; set; }
|
||||
|
||||
|
||||
//需要配置是两个键连接
|
||||
[JsonIgnore]
|
||||
public TrialSite TrialSite { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("TrialId")]
|
||||
public Trial Trial { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("SiteId")]
|
||||
public Site Site { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<DicomStudy> StudyList { get; set; } = new List<DicomStudy>();
|
||||
|
||||
public string Code { get; set; }
|
||||
|
@ -48,6 +51,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public string Sex { get; set; } = string.Empty;
|
||||
public Guid SiteId { get; set; } = Guid.Empty;
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("LatestSubjectVisitId")]
|
||||
public SubjectVisit LatestSubjectVisit { get; set; }
|
||||
public Guid? LatestSubjectVisitId { get; set; }
|
||||
|
|
|
@ -119,46 +119,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
});
|
||||
}
|
||||
|
||||
// 签名模板
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemBasicData)))
|
||||
{
|
||||
await InsertInspection<SystemBasicData>(item.Entity as SystemBasicData, type);
|
||||
}
|
||||
|
||||
// 项目
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Trial)))
|
||||
{
|
||||
|
||||
var entity = item.Entity as Trial;
|
||||
List<string> trialDics = new List<string>();
|
||||
var dictionaryIds = new List<Guid>();
|
||||
if (entity.TrialDicList == null || entity.TrialDicList.Count == 0)
|
||||
{
|
||||
dictionaryIds = await this._dbContext.TrialDictionary.Where(x => x.TrialId == entity.Id && x.KeyName == "Criterion").Select(x => x.DictionaryId).ToListAsync();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionaryIds = entity.TrialDicList.Select(x => x.DictionaryId).ToList();
|
||||
|
||||
}
|
||||
|
||||
trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync();
|
||||
|
||||
await InsertInspection<Trial>(item.Entity as Trial, type, x => new InspectionConvertDTO()
|
||||
|
||||
{
|
||||
TrialId = x.Id,
|
||||
TrialName = x.ExperimentName,
|
||||
ResearchProgramNo = x.ResearchProgramNo,
|
||||
}, new
|
||||
{
|
||||
ExperimentName = entity.ExperimentName,
|
||||
ResearchProgramNo = entity.ResearchProgramNo,
|
||||
|
||||
TrialDicList = string.Join(",", trialDics)
|
||||
});
|
||||
}
|
||||
|
||||
// 访视计划
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
|
||||
|
@ -237,95 +200,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
|
||||
|
||||
// 项目中心
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSite)))
|
||||
{
|
||||
var entity = item.Entity as TrialSite;
|
||||
if (entity.Site == null)
|
||||
{
|
||||
entity.Site = await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
||||
}
|
||||
await InsertInspection<TrialSite>(entity, type, null, new
|
||||
{
|
||||
TrialSiteCode = entity.TrialSiteCode,
|
||||
SiteName = entity.Site.SiteName,
|
||||
SiteAliasName = entity.TrialSiteAliasName,
|
||||
City = entity.Site.City,
|
||||
Country = entity.Site.Country,
|
||||
});
|
||||
}
|
||||
|
||||
// 项目人员
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser)))
|
||||
{
|
||||
|
||||
var entity = item.Entity as TrialUser;
|
||||
var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
|
||||
await InsertInspection<TrialUser>(entity, type, x => new InspectionConvertDTO
|
||||
{
|
||||
TrialId = x.TrialId,
|
||||
}, new
|
||||
{
|
||||
UserRealName = user.FullName,
|
||||
UserName = user.UserName,
|
||||
UserType = user.UserTypeRole.UserTypeShortName,
|
||||
EMail = user.EMail,
|
||||
Phone = user.Phone,
|
||||
OrganizationName = user.OrganizationName,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 项目中心人员
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteUser)))
|
||||
{
|
||||
var entity = item.Entity as TrialSiteUser;
|
||||
if (entity.TrialSite == null)
|
||||
{
|
||||
entity.TrialSite = await _dbContext.TrialSite.Where(x => x.TrialId == entity.TrialId && x.SiteId == entity.SiteId).IgnoreQueryFilters().FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
if (entity.Site == null)
|
||||
{
|
||||
entity.Site = await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
var user = new User();
|
||||
|
||||
|
||||
|
||||
if (entity.User == null)
|
||||
{
|
||||
user = await _dbContext.User.Where(x => x.Id == entity.UserId).FirstOrDefaultAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
user = entity.User;
|
||||
}
|
||||
|
||||
// 这里有问题
|
||||
|
||||
UserType userType = new UserType();
|
||||
userType = await _dbContext.UserType.Where(x => x.Id == user.UserTypeId).FirstOrDefaultAsync();
|
||||
|
||||
await InsertInspection<TrialSiteUser>(item.Entity as TrialSiteUser, type, null, new
|
||||
{
|
||||
TrialSiteCode = entity.TrialSite.TrialSiteCode,
|
||||
SiteName = entity.Site.SiteName,
|
||||
SiteAliasName = entity.TrialSite.TrialSiteAliasName,
|
||||
City = entity.Site.City,
|
||||
Country = entity.Site.Country,
|
||||
|
||||
UserName = user.UserName,
|
||||
UserRealName = user.FullName,
|
||||
UserType = userType.UserTypeShortName,
|
||||
Phone = user.Phone,
|
||||
Email = user.EMail,
|
||||
Organization = entity.User.OrganizationName,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 中心调研表
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteSurvey)))
|
||||
{
|
||||
|
@ -689,6 +563,163 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
|
||||
|
||||
|
||||
#region 已修改
|
||||
|
||||
// 签名模板
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemBasicData)))
|
||||
{
|
||||
await InsertInspection<SystemBasicData>(item.Entity as SystemBasicData, type);
|
||||
}
|
||||
|
||||
// 项目
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Trial)))
|
||||
{
|
||||
|
||||
var entity = item.Entity as Trial;
|
||||
List<string> trialDics = new List<string>();
|
||||
var dictionaryIds = new List<Guid>();
|
||||
if (entity.TrialDicList == null || entity.TrialDicList.Count == 0)
|
||||
{
|
||||
dictionaryIds = await this._dbContext.TrialDictionary.Where(x => x.TrialId == entity.Id && x.KeyName == "Criterion").Select(x => x.DictionaryId).ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionaryIds = entity.TrialDicList.Select(x => x.DictionaryId).ToList();
|
||||
}
|
||||
|
||||
trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync();
|
||||
|
||||
await InsertInspection<Trial>(item.Entity as Trial, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
TrialId = x.Id,
|
||||
}, new
|
||||
{
|
||||
TrialDicList = string.Join(",", trialDics)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 项目中心
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSite)))
|
||||
{
|
||||
var entity = item.Entity as TrialSite;
|
||||
if (entity.Site == null)
|
||||
{
|
||||
entity.Site = await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
||||
}
|
||||
await InsertInspection<TrialSite>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
TrialId = x.TrialId,
|
||||
|
||||
ObjectRelationParentId=x.TrialId
|
||||
}, new
|
||||
{
|
||||
//兼容之前的配置 冗余该字段
|
||||
SiteCode=entity.TrialSiteCode,
|
||||
|
||||
//Site 没记录稽查 必须查询存
|
||||
SiteName = entity.Site.SiteName,
|
||||
City = entity.Site.City,
|
||||
Country = entity.Site.Country,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 项目人员
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser)))
|
||||
{
|
||||
|
||||
var entity = item.Entity as TrialUser;
|
||||
//var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
|
||||
await InsertInspection<TrialUser>(entity, type, x => new InspectionConvertDTO
|
||||
{
|
||||
TrialId = x.TrialId,
|
||||
ObjectRelationParentId = x.TrialId,
|
||||
ObjectRelationParentId2=x.UserId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 项目中心人员
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteUser)))
|
||||
{
|
||||
var entity = item.Entity as TrialSiteUser;
|
||||
|
||||
|
||||
if (entity.TrialSite == null)
|
||||
{
|
||||
entity.TrialSite = await _dbContext.TrialSite.Where(x => x.TrialId == entity.TrialId && x.SiteId == entity.SiteId).IgnoreQueryFilters().FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
await InsertInspection<TrialSiteUser>(item.Entity as TrialSiteUser, type, x => new InspectionConvertDTO
|
||||
{
|
||||
TrialId = x.TrialId,
|
||||
ObjectRelationParentId = entity.TrialSite.Id,
|
||||
ObjectRelationParentId2 = x.UserId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 受试者
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject)))
|
||||
{
|
||||
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,
|
||||
|
||||
//项目的信息 找离的最近的项目稽查信息
|
||||
ObjectRelationParentId = trialSiteId,
|
||||
}, new
|
||||
{
|
||||
FinalSubjectVisitName = finalSubjectVisitName,
|
||||
|
||||
//变换名称 兼容之前做的稽查 冗余
|
||||
SubjectCode = entity.Code,
|
||||
});
|
||||
}
|
||||
|
||||
// 访视
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
|
||||
{
|
||||
var entity = item.Entity as SubjectVisit;
|
||||
string reason = string.Empty;
|
||||
|
||||
if (_userInfo.RequestUrl.ToLower() == "qcoperation/setcheckpass")
|
||||
{
|
||||
reason = entity.ManualPassReason;
|
||||
}
|
||||
|
||||
var subjectCode = entity.Subject?.Code;
|
||||
|
||||
await InsertInspection<SubjectVisit>(item.Entity as SubjectVisit, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
//Subject的信息 找离的最近的Subject稽查信息
|
||||
ObjectRelationParentId = x.SubjectId,
|
||||
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectVisitId = x.Id,
|
||||
SiteId = x.SiteId,
|
||||
Reason = reason,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 阅片人入组
|
||||
|
||||
//阅片人入组
|
||||
|
@ -742,53 +773,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
#region Subject 阅片期和 临床数据
|
||||
|
||||
// 受试者
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject)))
|
||||
{
|
||||
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();
|
||||
|
||||
await InsertInspection<Subject>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
SubjectId = x.Id,
|
||||
SubjectCode = x.Code,
|
||||
}, new
|
||||
{
|
||||
FinalSubjectVisitName = finalSubjectVisitName,
|
||||
SujectCode = entity.Code
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 访视
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
|
||||
{
|
||||
var entity = item.Entity as SubjectVisit;
|
||||
string reason = string.Empty;
|
||||
|
||||
if (_userInfo.RequestUrl.ToLower() == "qcoperation/setcheckpass")
|
||||
{
|
||||
reason = entity.ManualPassReason;
|
||||
}
|
||||
|
||||
var subjectCode = entity.Subject?.Code;
|
||||
|
||||
await InsertInspection<SubjectVisit>(item.Entity as SubjectVisit, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
ObjectRelationParentId = x.SubjectId,
|
||||
SubjectCode = subjectCode,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectVisitId = x.Id,
|
||||
//SubjectVisitName = x.VisitName,
|
||||
//BlindName = x.BlindName,
|
||||
Reason = reason,
|
||||
}, new
|
||||
{
|
||||
SubjectVisitName = entity.VisitName,
|
||||
BlindName = entity.BlindName,
|
||||
});
|
||||
}
|
||||
|
||||
//阅片期计划
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodSet)))
|
||||
{
|
||||
|
@ -887,6 +871,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
SubjectId = x.SubjectId,
|
||||
IsDistinctionInterface = false,
|
||||
|
||||
ObjectRelationParentId = entity.ReadingClinicalDataId
|
||||
}, new
|
||||
{
|
||||
|
@ -957,7 +942,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
await InsertInspection<VisitTask>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
VisitTaskId=x.Id,
|
||||
|
||||
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
||||
|
||||
ObjectRelationParentId = entity.SourceSubjectVisitId != null ? entity.SourceSubjectVisitId : entity.SouceReadModuleId,
|
||||
|
||||
ObjectRelationParentId2 = entity.DoctorUserId
|
||||
|
@ -972,6 +960,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
await InsertInspection<VisitTaskReReading>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
VisitTaskId=entity.OriginalReReadingTaskId,
|
||||
|
||||
Reason=entity.RequestReReadingReason,
|
||||
|
||||
ObjectRelationParentId = entity.OriginalReReadingTaskId,
|
||||
|
||||
|
@ -987,6 +978,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
await InsertInspection<TaskMedicalReview>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
VisitTaskId = entity.VisitTaskId,
|
||||
|
||||
ObjectRelationParentId = entity.VisitTaskId,
|
||||
|
||||
|
@ -1034,7 +1026,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
InspectionConvertDTO inspection = new InspectionConvertDTO();
|
||||
|
||||
|
||||
|
||||
if (expression != null)
|
||||
{
|
||||
var f = expression.Compile();
|
||||
|
@ -1051,7 +1042,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
//将实体对象属性 映射到稽查实体
|
||||
MapEntityPropertyToAuditEntity(entityObj, inspection);
|
||||
|
||||
var generalData = await GetInspectionGeneralDataAsync(inspection);
|
||||
//var generalData = await GetInspectionGeneralDataAsync(inspection);
|
||||
|
||||
var generalData = await GetInspectionGeneralGuidAsync(inspection);
|
||||
|
||||
//不可少 因为稽查实体可能某些Id没有
|
||||
MapEntityPropertyToAuditEntity(generalData, inspection);
|
||||
|
@ -1065,13 +1058,17 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
inspection.ModuleTypeId = from?.ModuleTypeId;
|
||||
|
||||
#endregion
|
||||
if (inspection.ParentId == null)
|
||||
{
|
||||
//inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == inspection.TrialId && x.SubjectVisitId == inspection.SubjectVisitId && x.SubjectId == inspection.SubjectId && x.SiteId == inspection.SiteId && x.GeneralId == inspection.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
|
||||
|
||||
inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId == inspection.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
}
|
||||
|
||||
//if (inspection.ParentId == null)
|
||||
//{
|
||||
// //inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == inspection.TrialId && x.SubjectVisitId == inspection.SubjectVisitId && x.SubjectId == inspection.SubjectId && x.SiteId == inspection.SiteId && x.GeneralId == inspection.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
|
||||
|
||||
// inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId == inspection.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
//}
|
||||
|
||||
inspection.CreateUserId = _userInfo.Id;
|
||||
inspection.IP = _userInfo.IP;
|
||||
inspection.CreateTime = inspection.CreateTime == default(DateTime) ? DateTime.Now : inspection.CreateTime;
|
||||
|
@ -1140,124 +1137,73 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取稽查通用数据 (每条稽查记录必须查询的)
|
||||
/// 获取稽查通用Guid数据 (每条稽查记录必须查询的)
|
||||
/// </summary>
|
||||
/// <param name="inspection"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<InspectionGeneralData> GetInspectionGeneralDataAsync(InspectionConvertDTO inspection)
|
||||
public async Task<InspectionGeneralData> GetInspectionGeneralGuidAsync(InspectionConvertDTO inspection)
|
||||
{
|
||||
|
||||
InspectionGeneralData generalData = new InspectionGeneralData()
|
||||
{
|
||||
SiteCode = inspection.SiteCode,
|
||||
SiteId = inspection.SiteId,
|
||||
//SiteName = inspection.SiteName,
|
||||
SubjectCode = inspection.SubjectCode,
|
||||
SubjectId = inspection.SubjectId,
|
||||
SubjectVisitId = inspection.SubjectVisitId,
|
||||
SubjectVisitName = inspection.SubjectVisitName,
|
||||
ResearchProgramNo = inspection.ResearchProgramNo,
|
||||
TrialId = inspection.TrialId,
|
||||
TrialName = inspection.TrialName
|
||||
TrialId = inspection.TrialId
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#region 访视 阅片期那里关联了访视
|
||||
|
||||
//if (generalData.SubjectVisitId != null)
|
||||
//if (inspection.TrialId == null && inspection.SubjectId == null && inspection.SubjectVisitId == null && inspection.SiteId == null && inspection.VisitTaskId == null)
|
||||
//{
|
||||
// //添加访视的时候,会带信息过来
|
||||
// if (string.IsNullOrEmpty(generalData.SubjectVisitName))
|
||||
// {
|
||||
// var info = (await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x =>
|
||||
// new { x.VisitName, x.SubjectId, x.SiteId, SubjectCode = x.Subject.Code, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
// generalData.SubjectVisitName = info.VisitName;
|
||||
|
||||
// generalData.TrialId = info.TrialId;
|
||||
// generalData.TrialName = info.ExperimentName;
|
||||
// generalData.ResearchProgramNo = info.ResearchProgramNo;
|
||||
// generalData.SiteId = info.SiteId;
|
||||
// generalData.SubjectCode = info.SubjectCode;
|
||||
// generalData.SubjectId = info.SubjectId;
|
||||
// generalData.SiteCode = info.TrialSiteCode;
|
||||
// }
|
||||
// throw new BusinessValidationFailedException("稽查记录 关联TrialId、SubjectId、SubjectVisitId、SiteId 都忘记进行了设置");
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 受试者
|
||||
|
||||
if (generalData.SubjectId != null)
|
||||
if (inspection.VisitTaskId != null)
|
||||
{
|
||||
|
||||
// 添加Subject 哪里会带信息过来
|
||||
if (string.IsNullOrEmpty(generalData.SubjectCode))
|
||||
{
|
||||
var info = (await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => new { SubjectId = x.Id, SubjectCode = x.Code, x.SiteId, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
var info = (await _dbContext.VisitTask.Where(x => x.Id == inspection.VisitTaskId).Select(x => new { SubjectId = x.SubjectId, x.Subject.SiteId, x.TrialId,x.SourceSubjectVisitId, ReadModuleSubjectVisitId= (Guid?)x.ReadModule.SubjectVisitId }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
generalData.TrialId = info.TrialId;
|
||||
generalData.TrialName = info.ExperimentName;
|
||||
generalData.ResearchProgramNo = info.ResearchProgramNo;
|
||||
generalData.SiteId = info.SiteId;
|
||||
generalData.SubjectCode = info.SubjectCode;
|
||||
generalData.SubjectId = info.SubjectId;
|
||||
generalData.SiteCode = info.TrialSiteCode;
|
||||
|
||||
}
|
||||
generalData.SiteId = info.SiteId;
|
||||
generalData.SubjectVisitId = info.SourceSubjectVisitId!=null ?info.SourceSubjectVisitId: (info.ReadModuleSubjectVisitId != null ? info.ReadModuleSubjectVisitId : null ) ;
|
||||
}
|
||||
|
||||
#endregion
|
||||
// Suject visit 都进行了设置 不用处理
|
||||
|
||||
|
||||
|
||||
#region 中心Code
|
||||
|
||||
if (generalData.TrialId != null && generalData.SiteId != null)
|
||||
if (inspection.SubjectVisitId != null)
|
||||
{
|
||||
|
||||
generalData.SiteCode = (await _dbContext.TrialSite.IgnoreQueryFilters().Where(x => x.TrialId == generalData.TrialId && x.SiteId == generalData.SiteId).Select(t => t.TrialSiteCode).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
var info = await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x =>
|
||||
new { x.SubjectId, x.SiteId, x.TrialId }).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
generalData.TrialId = info?.TrialId ?? generalData.TrialId;
|
||||
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||
|
||||
generalData.SubjectId = info?.SubjectId?? generalData.SubjectId;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 项目名称
|
||||
|
||||
|
||||
if (generalData.TrialId != null)
|
||||
if (generalData.SubjectId != null)
|
||||
{
|
||||
var info = await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => new { SubjectId = x.Id, x.SiteId ,x.TrialId }).FirstOrDefaultAsync();
|
||||
|
||||
//项目添加哪里 直接会带信息过来,不用查询数据库 其他的地方需要查询数据库
|
||||
if (string.IsNullOrEmpty(generalData.ResearchProgramNo) || string.IsNullOrEmpty(generalData.TrialName))
|
||||
{
|
||||
var trialdata = (await _dbContext.Trial.Select(x => new { x.Id, x.ResearchProgramNo, x.ExperimentName, }).FirstOrDefaultAsync(x => x.Id == generalData.TrialId)).IfNullThrowException();
|
||||
|
||||
generalData.ResearchProgramNo = trialdata.ResearchProgramNo;
|
||||
|
||||
generalData.TrialName = trialdata.ExperimentName;
|
||||
generalData.TrialId = info?.TrialId?? generalData.TrialId;
|
||||
generalData.SiteId = info?.SiteId?? generalData.SiteId;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
return generalData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取稽查记录的标识符 部分业务会进行特殊处理
|
||||
/// </summary>
|
||||
|
@ -1426,6 +1372,16 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
type = type + "/" + 2;
|
||||
}
|
||||
|
||||
if (visitTaskReReading.RequestReReadingResultEnum == RequestReReadingResult.Agree)
|
||||
{
|
||||
type = type + "/" + 1;
|
||||
|
||||
}
|
||||
else if (visitTaskReReading.RequestReReadingResultEnum == RequestReReadingResult.Reject)
|
||||
{
|
||||
type = type + "/" + 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1502,6 +1458,125 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
#region 待废弃 -by zhouhang 调整
|
||||
|
||||
/// <summary>
|
||||
/// 获取稽查通用数据 (每条稽查记录必须查询的)
|
||||
/// </summary>
|
||||
/// <param name="inspection"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<InspectionGeneralData> GetInspectionGeneralDataAsync(InspectionConvertDTO inspection)
|
||||
{
|
||||
|
||||
InspectionGeneralData generalData = new InspectionGeneralData()
|
||||
{
|
||||
SiteCode = inspection.SiteCode,
|
||||
SiteId = inspection.SiteId,
|
||||
//SiteName = inspection.SiteName,
|
||||
SubjectCode = inspection.SubjectCode,
|
||||
SubjectId = inspection.SubjectId,
|
||||
SubjectVisitId = inspection.SubjectVisitId,
|
||||
SubjectVisitName = inspection.SubjectVisitName,
|
||||
ResearchProgramNo = inspection.ResearchProgramNo,
|
||||
TrialId = inspection.TrialId,
|
||||
TrialName = inspection.TrialName
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#region 访视 阅片期那里关联了访视
|
||||
|
||||
//if (generalData.SubjectVisitId != null)
|
||||
//{
|
||||
// //添加访视的时候,会带信息过来
|
||||
// if (string.IsNullOrEmpty(generalData.SubjectVisitName))
|
||||
// {
|
||||
// var info = (await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x =>
|
||||
// new { x.VisitName, x.SubjectId, x.SiteId, SubjectCode = x.Subject.Code, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
// generalData.SubjectVisitName = info.VisitName;
|
||||
|
||||
// generalData.TrialId = info.TrialId;
|
||||
// generalData.TrialName = info.ExperimentName;
|
||||
// generalData.ResearchProgramNo = info.ResearchProgramNo;
|
||||
// generalData.SiteId = info.SiteId;
|
||||
// generalData.SubjectCode = info.SubjectCode;
|
||||
// generalData.SubjectId = info.SubjectId;
|
||||
// generalData.SiteCode = info.TrialSiteCode;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 受试者
|
||||
|
||||
if (generalData.SubjectId != null)
|
||||
{
|
||||
|
||||
// 添加Subject 哪里会带信息过来
|
||||
if (string.IsNullOrEmpty(generalData.SubjectCode))
|
||||
{
|
||||
var info = (await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => new { SubjectId = x.Id, SubjectCode = x.Code, x.SiteId, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
generalData.TrialId = info.TrialId;
|
||||
generalData.TrialName = info.ExperimentName;
|
||||
generalData.ResearchProgramNo = info.ResearchProgramNo;
|
||||
generalData.SiteId = info.SiteId;
|
||||
generalData.SubjectCode = info.SubjectCode;
|
||||
generalData.SubjectId = info.SubjectId;
|
||||
generalData.SiteCode = info.TrialSiteCode;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 中心Code
|
||||
|
||||
if (generalData.TrialId != null && generalData.SiteId != null)
|
||||
{
|
||||
|
||||
generalData.SiteCode = (await _dbContext.TrialSite.IgnoreQueryFilters().Where(x => x.TrialId == generalData.TrialId && x.SiteId == generalData.SiteId).Select(t => t.TrialSiteCode).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 项目名称
|
||||
|
||||
|
||||
if (generalData.TrialId != null)
|
||||
{
|
||||
|
||||
//项目添加哪里 直接会带信息过来,不用查询数据库 其他的地方需要查询数据库
|
||||
if (string.IsNullOrEmpty(generalData.ResearchProgramNo) || string.IsNullOrEmpty(generalData.TrialName))
|
||||
{
|
||||
var trialdata = (await _dbContext.Trial.Select(x => new { x.Id, x.ResearchProgramNo, x.ExperimentName, }).FirstOrDefaultAsync(x => x.Id == generalData.TrialId)).IfNullThrowException();
|
||||
|
||||
generalData.ResearchProgramNo = trialdata.ResearchProgramNo;
|
||||
|
||||
generalData.TrialName = trialdata.ExperimentName;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
return generalData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 映射数据
|
||||
///// </summary>
|
||||
|
|
|
@ -148,6 +148,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
|||
//标识操作 是否区分接口
|
||||
public bool IsDistinctionInterface=true;
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue