修改稽查
parent
5a046da4d0
commit
7c08e7606c
|
@ -195,7 +195,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var currentInspection = await _dataInspectionRepository.Where(t => t.Id == id).Select(t => new { t.GeneralId, t.ObjectRelationParentId, t.CreateTime }).FirstOrDefaultAsync();
|
var currentInspection = await _dataInspectionRepository.Where(t => t.Id == id).Select(t => new { t.GeneralId, t.ObjectRelationParentId, t.CreateTime }).FirstOrDefaultAsync();
|
||||||
|
|
||||||
var beforeId = await _dataInspectionRepository.Where(x => x.GeneralId == currentInspection.GeneralId && x.ObjectRelationParentId == currentInspection.ObjectRelationParentId && x.CreateTime <= currentInspection.CreateTime && x.Id != id).OrderByDescending(x => x.CreateTime).Select(t => t.Id)
|
var beforeId = await _dataInspectionRepository.Where(x => x.GeneralId == currentInspection.GeneralId /*&& x.ObjectRelationParentId == currentInspection.ObjectRelationParentId*/ && x.CreateTime <= currentInspection.CreateTime && x.Id != id).OrderByDescending(x => x.CreateTime).Select(t => t.Id)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
List<Guid> searchGuidList = new List<Guid>() { id };
|
List<Guid> searchGuidList = new List<Guid>() { id };
|
||||||
|
@ -245,7 +245,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var objectLsit = new List<object>();
|
var objectLsit = new List<object>();
|
||||||
|
|
||||||
var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId, objectLsit);
|
var commonDataObjList = await GetRelationParentData( item.Id,item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId, objectLsit);
|
||||||
|
|
||||||
var currentDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonDict[nameof(InspectionJsonDetail.CommonData)].ToJsonStr());
|
var currentDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonDict[nameof(InspectionJsonDetail.CommonData)].ToJsonStr());
|
||||||
|
|
||||||
|
@ -347,12 +347,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async Task AddJsonObjectToDic(Guid? objectRelationParentId, DateTime createTime, Guid batchId, List<object> objectLsit)
|
private async Task AddJsonObjectToDic(Guid id, Guid? objectRelationParentId, DateTime createTime, Guid batchId, List<object> objectLsit)
|
||||||
{
|
{
|
||||||
if (objectRelationParentId != null)
|
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();
|
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();
|
||||||
|
|
||||||
|
|
||||||
if (relationParentInspection != null)
|
if (relationParentInspection != null)
|
||||||
|
@ -386,8 +386,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await AddJsonObjectToDic(relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||||
await AddJsonObjectToDic( relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -405,10 +405,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async Task<List<object>> GetRelationParentData(Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId, List<object> objectLsit)
|
private async Task<List<object>> GetRelationParentData(Guid id,Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId, List<object> objectLsit)
|
||||||
{
|
{
|
||||||
await AddJsonObjectToDic(objectRelationParentId, createTime, batchId, objectLsit);
|
await AddJsonObjectToDic(id,objectRelationParentId, createTime, batchId, objectLsit);
|
||||||
await AddJsonObjectToDic(objectRelationParentId2, createTime, batchId, objectLsit);
|
await AddJsonObjectToDic(id,objectRelationParentId2, createTime, batchId, objectLsit);
|
||||||
|
|
||||||
#region 废弃
|
#region 废弃
|
||||||
//if (objectRelationParentId != null)
|
//if (objectRelationParentId != null)
|
||||||
|
|
|
@ -121,7 +121,16 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _enrollReadingCategoryRepository.BatchDeleteNoTrackingAsync(x => x.EnrollId == inDto.EnrollId);
|
if (inDto.ReadingCategorys.Count > 0)
|
||||||
|
{
|
||||||
|
await _enrollReadingCategoryRepository.BatchDeleteNoTrackingAsync(x => x.EnrollId == inDto.EnrollId);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _enrollReadingCategoryRepository.DeleteFromQueryAsync(x => x.EnrollId == inDto.EnrollId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<EnrollReadingCategory> enrollReadings = inDto.ReadingCategorys.Select(x => new EnrollReadingCategory()
|
List<EnrollReadingCategory> enrollReadings = inDto.ReadingCategorys.Select(x => new EnrollReadingCategory()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,10 +9,10 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public partial class Enroll : Entity,IAuditUpdate,IAuditAdd
|
public partial class Enroll : Entity,IAuditUpdate,IAuditAdd
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
[ForeignKey("TrialId")]
|
[ForeignKey("TrialId")]
|
||||||
public virtual Trial Trial { get; set; }
|
public virtual Trial Trial { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
public virtual Doctor Doctor { get; set; }
|
public virtual Doctor Doctor { get; set; }
|
||||||
|
|
||||||
//public TrialPaymentPrice TrialPaymentPrice { get; set; }
|
//public TrialPaymentPrice TrialPaymentPrice { get; set; }
|
||||||
|
@ -71,7 +71,7 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public List<EnrollReadingCategory> EnrollReadingCategoryList { get; set; }
|
public List<EnrollReadingCategory> EnrollReadingCategoryList { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
[ForeignKey("EnrollId")]
|
[ForeignKey("EnrollId")]
|
||||||
public Enroll Enroll { get; set; }
|
public Enroll Enroll { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,15 +608,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
{
|
{
|
||||||
entity.Site = await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
entity.Site = await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
await InsertInspection<TrialSite>(entity, type, x => new InspectionConvertDTO()
|
await InsertInspection<TrialSite>(entity, type, x => new InspectionConvertDTO()
|
||||||
{
|
{
|
||||||
TrialId = x.TrialId,
|
TrialId = x.TrialId,
|
||||||
|
|
||||||
ObjectRelationParentId=x.TrialId
|
ObjectRelationParentId = x.TrialId
|
||||||
}, new
|
}, new
|
||||||
{
|
{
|
||||||
//兼容之前的配置 冗余该字段
|
//兼容之前的配置 冗余该字段
|
||||||
SiteCode=entity.TrialSiteCode,
|
SiteCode = entity.TrialSiteCode,
|
||||||
|
|
||||||
//Site 没记录稽查 必须查询存
|
//Site 没记录稽查 必须查询存
|
||||||
SiteName = entity.Site.SiteName,
|
SiteName = entity.Site.SiteName,
|
||||||
|
@ -637,7 +637,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
{
|
{
|
||||||
TrialId = x.TrialId,
|
TrialId = x.TrialId,
|
||||||
ObjectRelationParentId = x.TrialId,
|
ObjectRelationParentId = x.TrialId,
|
||||||
ObjectRelationParentId2=x.UserId,
|
ObjectRelationParentId2 = x.UserId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,14 +715,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 阅片人入组
|
#region 阅片人入组
|
||||||
|
|
||||||
//阅片人入组
|
|
||||||
|
//阅片人入组 父层级未记录稽查(医生)
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Enroll)))
|
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Enroll)))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -738,39 +734,109 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
Name = doctor.FullName,
|
Name = doctor.FullName,
|
||||||
ChineseName = doctor.ChineseName,
|
ChineseName = doctor.ChineseName,
|
||||||
Email = doctor.EMail,
|
Email = doctor.EMail,
|
||||||
|
|
||||||
|
|
||||||
IsUploadedACKSOW = entity.AttachmentId != Guid.Empty,
|
IsUploadedACKSOW = entity.AttachmentId != Guid.Empty,
|
||||||
|
|
||||||
|
//子层级的数据 记录到父层级 必须查询 不然找上一条时数据不准
|
||||||
ReadingCategoryList = readingCategoryList
|
ReadingCategoryList = readingCategoryList
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//独立阅片人 状态修改 上传SoW 子对象稽查记录到父对象 要求 记录的数据一致
|
//独立阅片人 设置阅片类型 这里对于操作人 不区分 添加 编辑 删除 只有设置(相当于更新)
|
||||||
|
|
||||||
if (entitys.Any(x => x.Entity.GetType() == typeof(EnrollReadingCategory)))
|
if (entitys.Any(x => x.Entity.GetType() == typeof(EnrollReadingCategory)))
|
||||||
{
|
{
|
||||||
var list = entitys.Where(x => x.Entity.GetType() == typeof(EnrollReadingCategory)).Select(t => t.Entity as EnrollReadingCategory).ToList();
|
var list = entitys.Where(x => x.Entity.GetType() == typeof(EnrollReadingCategory)).Select(t => t.Entity as EnrollReadingCategory).ToList();
|
||||||
var enrollId = list.Select(t => t.EnrollId).FirstOrDefault();
|
|
||||||
var enroll = await _dbContext.Enroll.Include(t => t.Doctor).FirstAsync(t => t.Id == enrollId);
|
|
||||||
|
|
||||||
await InsertInspection<Enroll>(enroll, type, x => new InspectionConvertDTO()
|
var first = list.FirstOrDefault();
|
||||||
|
|
||||||
|
var enrollId = first.EnrollId;
|
||||||
|
|
||||||
|
Guid? trialId = Guid.Empty;
|
||||||
|
|
||||||
|
if (first.Enroll != null)
|
||||||
{
|
{
|
||||||
GeneralId = enroll.Id,
|
trialId = first.Enroll.TrialId;
|
||||||
ObjectRelationParentId = x.TrialId
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trialId = await _dbContext.Enroll.Where(x => x.Id == enrollId).Select(t => t.TrialId).FirstOrDefaultAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await InsertInspection<EnrollReadingCategory>(first, type, x => new InspectionConvertDTO()
|
||||||
|
{
|
||||||
|
//GeneralId 和ObjectRelationParentId 一样 会成环 所以查询的时候 需要排除自身
|
||||||
|
GeneralId = enrollId,
|
||||||
|
|
||||||
|
TrialId = trialId,
|
||||||
|
|
||||||
|
ObjectRelationParentId = enrollId
|
||||||
}, new
|
}, new
|
||||||
{
|
{
|
||||||
//父层级的数据 暂时没有记录稽查 所以这里必须查
|
|
||||||
Name = enroll.Doctor.FullName,
|
|
||||||
ChineseName = enroll.Doctor.ChineseName,
|
|
||||||
Email = enroll.Doctor.EMail,
|
|
||||||
|
|
||||||
IsUploadedACKSOW = enroll.AttachmentId != Guid.Empty,
|
//子层级只需要记录自己这边的信息就好了
|
||||||
ReadingCategoryList = list.Select(t => t.ReadingCategory).ToList()
|
ReadingCategoryList = type == AuditOpt.Deleted ? null : list.Select(t => t.ReadingCategory).ToList(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 阅片期临床数据
|
||||||
|
|
||||||
|
//阅片期临床数据 父层级未记录稽查(项目临床数据设置)
|
||||||
|
|
||||||
|
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingClinicalData)))
|
||||||
|
{
|
||||||
|
var entity = item.Entity as ReadingClinicalData;
|
||||||
|
|
||||||
|
if (entity.ClinicalDataTrialSet == null && entity.ClinicalDataTrialSetId != Guid.Empty)
|
||||||
|
{
|
||||||
|
entity.ClinicalDataTrialSet = await _dbContext.ClinicalDataTrialSet.FindAsync(entity.ClinicalDataTrialSetId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileCount = await _dbContext.ReadingClinicalDataPDF.Where(x => x.ReadingClinicalDataId == entity.Id).CountAsync();
|
||||||
|
|
||||||
|
await InsertInspection<ReadingClinicalData>(item.Entity as ReadingClinicalData, type, x => new InspectionConvertDTO()
|
||||||
|
{
|
||||||
|
SubjectVisitId = x.IsVisit ? x.ReadingId : null,
|
||||||
|
|
||||||
|
ObjectRelationParentId = entity.ClinicalDataTrialSetId,
|
||||||
|
}, new
|
||||||
|
{
|
||||||
|
entity.ClinicalDataTrialSet.ClinicalUploadType,
|
||||||
|
entity.ClinicalDataTrialSet.ClinicalDataSetName,
|
||||||
|
entity.ClinicalDataTrialSet.ClinicalDataLevel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingClinicalDataPDF)))
|
||||||
|
{
|
||||||
|
var entity = item.Entity as ReadingClinicalDataPDF;
|
||||||
|
|
||||||
|
var fileCount = await _dbContext.ReadingClinicalDataPDF.Where(x => x.ReadingClinicalDataId == entity.Id).CountAsync();
|
||||||
|
|
||||||
|
await InsertInspection<ReadingClinicalDataPDF>(item.Entity as ReadingClinicalDataPDF, type, x => new InspectionConvertDTO()
|
||||||
|
{
|
||||||
|
SubjectId = x.SubjectId,
|
||||||
|
IsDistinctionInterface = false,
|
||||||
|
|
||||||
|
ObjectRelationParentId = entity.ReadingClinicalDataId
|
||||||
|
}, new
|
||||||
|
{
|
||||||
|
IsCRCUpload = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Subject 阅片期和 临床数据
|
#region Subject 阅片期和 临床数据
|
||||||
|
|
||||||
//阅片期计划
|
//阅片期计划
|
||||||
|
@ -839,45 +905,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//阅片期临床数据
|
|
||||||
|
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingClinicalData)))
|
|
||||||
{
|
|
||||||
var entity = item.Entity as ReadingClinicalData;
|
|
||||||
|
|
||||||
if (entity.ClinicalDataTrialSet == null && entity.ClinicalDataTrialSetId != Guid.Empty)
|
|
||||||
{
|
|
||||||
entity.ClinicalDataTrialSet = await _dbContext.ClinicalDataTrialSet.FindAsync(entity.ClinicalDataTrialSetId);
|
|
||||||
}
|
|
||||||
|
|
||||||
await InsertInspection<ReadingClinicalData>(item.Entity as ReadingClinicalData, type, x => new InspectionConvertDTO()
|
|
||||||
{
|
|
||||||
SubjectVisitId = x.IsVisit ? x.ReadingId : null,
|
|
||||||
|
|
||||||
ObjectRelationParentId = entity.ClinicalDataTrialSetId,
|
|
||||||
}, new
|
|
||||||
{
|
|
||||||
entity.ClinicalDataTrialSet.ClinicalUploadType,
|
|
||||||
entity.ClinicalDataTrialSet.ClinicalDataSetName,
|
|
||||||
entity.ClinicalDataTrialSet.ClinicalDataLevel,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingClinicalDataPDF)))
|
|
||||||
{
|
|
||||||
var entity = item.Entity as ReadingClinicalDataPDF;
|
|
||||||
|
|
||||||
await InsertInspection<ReadingClinicalDataPDF>(item.Entity as ReadingClinicalDataPDF, type, x => new InspectionConvertDTO()
|
|
||||||
{
|
|
||||||
SubjectId = x.SubjectId,
|
|
||||||
IsDistinctionInterface = false,
|
|
||||||
|
|
||||||
ObjectRelationParentId = entity.ReadingClinicalDataId
|
|
||||||
}, new
|
|
||||||
{
|
|
||||||
IsCRCUpload = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -894,9 +922,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
IsDistinctionInterface = false
|
IsDistinctionInterface = false
|
||||||
}, new
|
}, new
|
||||||
{
|
{
|
||||||
UserFullName = entity.FullName,
|
UserRealName = entity.FullName,
|
||||||
entity.UserCode,
|
|
||||||
entity.UserName
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -942,7 +968,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
await InsertInspection<VisitTask>(entity, type, x => new InspectionConvertDTO()
|
await InsertInspection<VisitTask>(entity, type, x => new InspectionConvertDTO()
|
||||||
{
|
{
|
||||||
VisitTaskId=x.Id,
|
VisitTaskId = x.Id,
|
||||||
|
|
||||||
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
||||||
|
|
||||||
|
@ -960,9 +986,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
await InsertInspection<VisitTaskReReading>(entity, type, x => new InspectionConvertDTO()
|
await InsertInspection<VisitTaskReReading>(entity, type, x => new InspectionConvertDTO()
|
||||||
{
|
{
|
||||||
VisitTaskId=entity.OriginalReReadingTaskId,
|
VisitTaskId = entity.OriginalReReadingTaskId,
|
||||||
|
|
||||||
Reason=entity.RequestReReadingReason,
|
Reason = entity.RequestReReadingReason,
|
||||||
|
|
||||||
ObjectRelationParentId = entity.OriginalReReadingTaskId,
|
ObjectRelationParentId = entity.OriginalReReadingTaskId,
|
||||||
|
|
||||||
|
@ -983,8 +1009,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
ObjectRelationParentId = entity.VisitTaskId,
|
ObjectRelationParentId = entity.VisitTaskId,
|
||||||
|
|
||||||
ObjectRelationParentId2 = entity.MedicalManagerUserId
|
ObjectRelationParentId2 = entity.MedicalManagerUserId
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,9 +1020,7 @@ 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
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1162,13 +1184,13 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
if (inspection.VisitTaskId != null)
|
if (inspection.VisitTaskId != null)
|
||||||
{
|
{
|
||||||
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();
|
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.TrialId = info?.TrialId ?? generalData.TrialId;
|
||||||
generalData.SubjectId = info.SubjectId;
|
generalData.SubjectId = info?.SubjectId ?? generalData.SubjectId;
|
||||||
generalData.SiteId = info.SiteId;
|
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||||
generalData.SubjectVisitId = info.SourceSubjectVisitId!=null ?info.SourceSubjectVisitId: (info.ReadModuleSubjectVisitId != null ? info.ReadModuleSubjectVisitId : null ) ;
|
generalData.SubjectVisitId = info?.SourceSubjectVisitId != null ? info?.SourceSubjectVisitId : (info?.ReadModuleSubjectVisitId != null ? info?.ReadModuleSubjectVisitId : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suject visit 都进行了设置 不用处理
|
// Suject visit 都进行了设置 不用处理
|
||||||
|
@ -1182,22 +1204,22 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
generalData.TrialId = info?.TrialId ?? generalData.TrialId;
|
generalData.TrialId = info?.TrialId ?? generalData.TrialId;
|
||||||
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||||
|
|
||||||
generalData.SubjectId = info?.SubjectId?? generalData.SubjectId;
|
generalData.SubjectId = info?.SubjectId ?? generalData.SubjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (generalData.SubjectId != 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();
|
var info = await _dbContext.Subject.Where(x => x.Id == generalData.SubjectId).Select(x => new { SubjectId = x.Id, x.SiteId, x.TrialId }).FirstOrDefaultAsync();
|
||||||
|
|
||||||
generalData.TrialId = info?.TrialId?? generalData.TrialId;
|
generalData.TrialId = info?.TrialId ?? generalData.TrialId;
|
||||||
generalData.SiteId = info?.SiteId?? generalData.SiteId;
|
generalData.SiteId = info?.SiteId ?? generalData.SiteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return generalData;
|
return generalData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1349,7 +1371,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
//区分任务类型
|
//区分任务类型
|
||||||
type = type + "/" + (int)visitTask.ReadingCategory;
|
type = type + "/" + (int)visitTask.ReadingCategory;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue