稽查修改

Uat_Study
hang 2022-08-25 17:05:57 +08:00
parent cc60c4f9f0
commit fbabbfc807
5 changed files with 68 additions and 68 deletions

View File

@ -142,19 +142,26 @@ namespace IRaCIS.Core.Application.Service.Inspection
query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId) query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
//.WhereIf(dto.RelationDeadlineTime != null, x => x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)) //.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)) .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 || #region 废弃
((x.GeneralId == dto.GeneralId || x.ObjectRelationParentId == dto.GeneralId) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1))) // .WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null && dto.GeneralId == null, x => x.BatchId == dto.BatchId)
.WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null, // .WhereIf(dto.BatchId != null && dto.GeneralId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId ||
x => // ((x.GeneralId == dto.GeneralId || x.ObjectRelationParentId == dto.GeneralId) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
x.BatchId == dto.BatchId || //同一事务批次 // .WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null,
//x.ObjectRelationParentId == dto.ObjectRelationParentId || //不同对象 但是同一层级 适用于子对象 // 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.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 != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo)
//.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false) //.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false)

View File

@ -74,13 +74,14 @@ namespace IRaCIS.Core.Domain.Models
/// </summary> /// </summary>
public decimal VisitNum { get; set; } public decimal VisitNum { get; set; }
[JsonIgnore]
/// <summary> /// <summary>
/// 对应 /// 对应
/// </summary> /// </summary>
[ForeignKey("ReadModuleId")] [ForeignKey("ReadModuleId")]
public ReadModule ReadModuleModel { get; set; } public ReadModule ReadModuleModel { get; set; }
[JsonIgnore]
/// <summary> /// <summary>
/// 受试者 /// 受试者
/// </summary> /// </summary>
@ -88,13 +89,14 @@ namespace IRaCIS.Core.Domain.Models
public Subject Subject { get; set; } public Subject Subject { get; set; }
[JsonIgnore]
/// <summary> /// <summary>
/// 阅片期配置 /// 阅片期配置
/// </summary> /// </summary>
[ForeignKey("ReadingPeriodSetId")] [ForeignKey("ReadingPeriodSetId")]
public ReadingPeriodSet ReadingPeriodSet { get; set; } public ReadingPeriodSet ReadingPeriodSet { get; set; }
[JsonIgnore]
/// <summary> /// <summary>
/// 访视 /// 访视
/// </summary> /// </summary>

View File

@ -45,6 +45,7 @@ namespace IRaCIS.Core.Domain.Models
/// </summary> /// </summary>
public Guid? VisitStageId { get; set; } public Guid? VisitStageId { get; set; }
[JsonIgnore]
/// <summary> /// <summary>
/// 访视模板 /// 访视模板
/// </summary> /// </summary>
@ -81,13 +82,14 @@ namespace IRaCIS.Core.Domain.Models
/// </summary> /// </summary>
public ReadingSetType ReadingSetType { get; set; } public ReadingSetType ReadingSetType { get; set; }
[JsonIgnore]
public List<ReadingPeriodSite> ReadingPeriodSites { get; set; } = new List<ReadingPeriodSite>(); public List<ReadingPeriodSite> ReadingPeriodSites { get; set; } = new List<ReadingPeriodSite>();
/// <summary> /// <summary>
/// 阅片期计划 /// 阅片期计划
/// </summary> /// </summary>
[JsonIgnore]
public List<ReadingPeriodPlan> ReadingPeriodPlanList { get; set; } = new List<ReadingPeriodPlan>(); public List<ReadingPeriodPlan> ReadingPeriodPlanList { get; set; } = new List<ReadingPeriodPlan>();
} }

View File

@ -6,6 +6,7 @@ namespace IRaCIS.Core.Domain.Models
[Table("VisitStage")] [Table("VisitStage")]
public class VisitStage : Entity, IAuditUpdate, IAuditAdd,ISoftDelete public class VisitStage : Entity, IAuditUpdate, IAuditAdd,ISoftDelete
{ {
[JsonIgnore]
public Trial Trial { get; set; } public Trial Trial { get; set; }
public Guid TrialId { get; set; } public Guid TrialId { get; set; }

View File

@ -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<VisitStage>(item.Entity as VisitStage, type, null, new
{
VisitPlanStatus = visitPlanStatus,
});
}
// 项目文档 // 项目文档
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument))) 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<VisitStage>(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<VisitStage>(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))) 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<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 阅片期和 临床数据
//阅片期计划 //阅片期计划
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodSet))) foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodSet)))
{ {
var entity = item.Entity as 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; var siteCodes = string.Empty;
if (entity.ReadingScope == ReadingScopeEnum.Site) if (entity.ReadingScope == ReadingScopeEnum.Site)
{ {
@ -852,10 +837,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
siteCodes = String.Join(',', nameList); siteCodes = String.Join(',', nameList);
} }
await InsertInspection<ReadingPeriodSet>(item.Entity as ReadingPeriodSet, type, x => new InspectionConvertDTO()
await InsertInspection<ReadingPeriodSet>(item.Entity as ReadingPeriodSet, type, null, new {
ObjectRelationParentId = x.VisitStageId
}, new
{ {
VisitName = visitName,
SiteCodes = siteCodes SiteCodes = siteCodes
}); });
} }
@ -884,29 +871,30 @@ namespace IRaCIS.Core.Infra.EFCore.Common
#endregion #endregion
//阅片期 //阅片期
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadModule))) foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadModule)))
{ {
var entity = item.Entity as ReadModule; var entity = item.Entity as ReadModule;
var visitName = _dbContext.SubjectVisit.Where(t => t.Id == entity.SubjectVisitId).Select(t => t.VisitName).FirstOrDefault();
await InsertInspection<ReadModule>(item.Entity as ReadModule, type, x => new InspectionConvertDTO() await InsertInspection<ReadModule>(item.Entity as ReadModule, type, x => new InspectionConvertDTO()
{ {
ObjectRelationParentId = entity.ReadingPeriodSetId, ObjectRelationParentId = entity.SubjectVisitId,
SubjectVisitId = x.SubjectVisitId, SubjectVisitId = x.SubjectVisitId,
IsDistinctionInterface = false, IsDistinctionInterface = false,
}, new
{
VisitName = visitName,
}); });
} }
#endregion
#endregion #endregion
#region 阅片 #region 阅片
//用户添加 //用户添加