diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
index 98a5a0432..8ead2d8c0 100644
--- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
+++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
@@ -142,19 +142,26 @@ namespace IRaCIS.Core.Application.Service.Inspection
query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
//.WhereIf(dto.RelationDeadlineTime != null, x => x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1))
.Where(x => (x.TrialId == dto.TrialId) || (x.TrialId == null && x.CreateTime >= trialData.CreateTime && x.CreateTime <= trialData.TrialFinishTime))
- .WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null && dto.GeneralId == null, x => x.BatchId == dto.BatchId)
- .WhereIf(dto.BatchId != null && dto.GeneralId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId ||
- ((x.GeneralId == dto.GeneralId || x.ObjectRelationParentId == dto.GeneralId) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
- .WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null,
- x =>
- x.BatchId == dto.BatchId || //同一事务批次
- //x.ObjectRelationParentId == dto.ObjectRelationParentId || //不同对象 但是同一层级 适用于子对象
+
+ #region 废弃
+ // .WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null && dto.GeneralId == null, x => x.BatchId == dto.BatchId)
+ // .WhereIf(dto.BatchId != null && dto.GeneralId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId ||
+ // ((x.GeneralId == dto.GeneralId || x.ObjectRelationParentId == dto.GeneralId) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
+ // .WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null,
+ // x =>
+ // x.BatchId == dto.BatchId || //同一事务批次
+ // //x.ObjectRelationParentId == dto.ObjectRelationParentId || //不同对象 但是同一层级 适用于子对象
+
+
+ //((x.GeneralId == dto.ObjectRelationParentId || //子稽查 查询父记录
+ // x.GeneralId == dto.GeneralId || //同一对象
+ // x.ObjectRelationParentId == dto.GeneralId //父稽查 查询子记录
+ // ) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
+ #endregion
+ .WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId)
+ .WhereIf(dto.BatchId == null && dto.GeneralId != null, x => x.GeneralId == dto.GeneralId)
- ( ( x.GeneralId == dto.ObjectRelationParentId || //子稽查 查询父记录
- x.GeneralId == dto.GeneralId || //同一对象
- x.ObjectRelationParentId == dto.GeneralId //父稽查 查询子记录
- )&& x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo))
//.WhereIf(dto.VisitPlanInfo != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo)
//.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false)
diff --git a/IRaCIS.Core.Domain/Reading/ReadModule.cs b/IRaCIS.Core.Domain/Reading/ReadModule.cs
index 7d5466c64..c8b878c76 100644
--- a/IRaCIS.Core.Domain/Reading/ReadModule.cs
+++ b/IRaCIS.Core.Domain/Reading/ReadModule.cs
@@ -74,13 +74,14 @@ namespace IRaCIS.Core.Domain.Models
///
public decimal VisitNum { get; set; }
+ [JsonIgnore]
///
/// 对应
///
[ForeignKey("ReadModuleId")]
public ReadModule ReadModuleModel { get; set; }
-
+ [JsonIgnore]
///
/// 受试者
///
@@ -88,13 +89,14 @@ namespace IRaCIS.Core.Domain.Models
public Subject Subject { get; set; }
+ [JsonIgnore]
///
/// 阅片期配置
///
[ForeignKey("ReadingPeriodSetId")]
- public ReadingPeriodSet ReadingPeriodSet { get; set; }
-
+ public ReadingPeriodSet ReadingPeriodSet { get; set; }
+ [JsonIgnore]
///
/// 访视
///
diff --git a/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs b/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs
index b1c033ef8..a609b0620 100644
--- a/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs
+++ b/IRaCIS.Core.Domain/Reading/ReadingPeriodSet.cs
@@ -45,6 +45,7 @@ namespace IRaCIS.Core.Domain.Models
///
public Guid? VisitStageId { get; set; }
+ [JsonIgnore]
///
/// 访视模板
///
@@ -81,13 +82,14 @@ namespace IRaCIS.Core.Domain.Models
///
public ReadingSetType ReadingSetType { get; set; }
-
+ [JsonIgnore]
public List ReadingPeriodSites { get; set; } = new List();
///
/// 阅片期计划
///
+ [JsonIgnore]
public List ReadingPeriodPlanList { get; set; } = new List();
}
diff --git a/IRaCIS.Core.Domain/Visit/VisitStage.cs b/IRaCIS.Core.Domain/Visit/VisitStage.cs
index 4337f5da9..51941a78c 100644
--- a/IRaCIS.Core.Domain/Visit/VisitStage.cs
+++ b/IRaCIS.Core.Domain/Visit/VisitStage.cs
@@ -6,6 +6,7 @@ namespace IRaCIS.Core.Domain.Models
[Table("VisitStage")]
public class VisitStage : Entity, IAuditUpdate, IAuditAdd,ISoftDelete
{
+ [JsonIgnore]
public Trial Trial { get; set; }
public Guid TrialId { get; set; }
diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
index 7862195ad..fa40d6db5 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
@@ -123,23 +123,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
- // 访视计划
- foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
- {
- var entity = item.Entity as VisitStage;
- var visitPlanStatus = await this._dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.VisitPlanConfirmed).FirstOrDefaultAsync();
- if (type == "Add")
- {
- visitPlanStatus = false;
- }
- await InsertInspection(item.Entity as VisitStage, type, null, new
- {
- VisitPlanStatus = visitPlanStatus,
- });
- }
-
// 项目文档
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument)))
{
@@ -690,6 +675,35 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
+ // 访视计划
+ foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
+ {
+ var entity = item.Entity as VisitStage;
+
+ await InsertInspection(item.Entity as VisitStage, type, x => new InspectionConvertDTO()
+ {
+ ObjectRelationParentId = x.TrialId
+
+ });
+
+ #region Old
+ //var visitPlanStatus = await this._dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.VisitPlanConfirmed).FirstOrDefaultAsync();
+ //if (type == "Add")
+ //{
+ // visitPlanStatus = false;
+ //}
+ //await InsertInspection(item.Entity as VisitStage, type, x => new InspectionConvertDTO()
+ //{
+ // ObjectRelationParentId = x.TrialId
+
+ //}, new
+ //{
+ // VisitPlanStatus = visitPlanStatus,
+ //});
+ #endregion
+
+ }
+
// 访视
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
{
@@ -809,40 +823,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
- //foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingClinicalDataPDF)))
- //{
- // var entity = item.Entity as ReadingClinicalDataPDF;
-
-
- // await InsertInspection(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 阅片期和 临床数据
-
//阅片期计划
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodSet)))
{
var entity = item.Entity as ReadingPeriodSet;
- var visitName = _dbContext.VisitPlans.Where(t => t.Id == entity.VisitStageId).Select(t => t.VisitName).FirstOrDefault();
-
var siteCodes = string.Empty;
if (entity.ReadingScope == ReadingScopeEnum.Site)
{
@@ -852,10 +837,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
siteCodes = String.Join(',', nameList);
}
-
- await InsertInspection(item.Entity as ReadingPeriodSet, type, null, new
+ await InsertInspection(item.Entity as ReadingPeriodSet, type, x => new InspectionConvertDTO()
+ {
+ ObjectRelationParentId = x.VisitStageId
+
+ }, new
{
- VisitName = visitName,
SiteCodes = siteCodes
});
}
@@ -884,29 +871,30 @@ namespace IRaCIS.Core.Infra.EFCore.Common
#endregion
+
//阅片期
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadModule)))
{
var entity = item.Entity as ReadModule;
- var visitName = _dbContext.SubjectVisit.Where(t => t.Id == entity.SubjectVisitId).Select(t => t.VisitName).FirstOrDefault();
await InsertInspection(item.Entity as ReadModule, type, x => new InspectionConvertDTO()
{
- ObjectRelationParentId = entity.ReadingPeriodSetId,
+ ObjectRelationParentId = entity.SubjectVisitId,
+
SubjectVisitId = x.SubjectVisitId,
IsDistinctionInterface = false,
- }, new
- {
-
- VisitName = visitName,
});
}
+ #endregion
+
+
#endregion
+
#region 阅片
//用户添加