From 81a0a7d02d64c7ebc54bc9153aa929a94e5dfc73 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Thu, 18 Aug 2022 14:08:13 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A8=BD=E6=9F=A5=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 17 +--
.../Service/Inspection/DTO/InspectionModel.cs | 4 +
.../Service/Inspection/InspectionService.cs | 3 +-
.../Reading/Dto/ReadingClinicalDataDto.cs | 4 +
.../Reading/ReadingClinicalDataService.cs | 15 ++-
IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs | 13 ++
.../Reading/ReadingClinicalData.cs | 4 +
IRaCIS.Core.Domain/Trial/DataInspection.cs | 3 +
.../Common/AuditingData.cs | 114 +++++++++++++-----
.../Common/Dto/SetDictionaryValueDto.cs | 4 +
10 files changed, 137 insertions(+), 44 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index c04707038..8bdff8f28 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -3110,13 +3110,6 @@
-
-
- 设置项目器官是否生效
-
-
-
-
阅片医学审核
@@ -3660,6 +3653,16 @@
是否关联
+
+
+ 病灶类型
+
+
+
+
+ 病灶类型
+
+
备注
diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs
index ae01d7e77..4d8bc5118 100644
--- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs
+++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs
@@ -494,6 +494,10 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
///
public Guid? BatchId { get; set; }
+ public DateTime? RelationDeadlineTime { get; set; }
+
+ public Guid? ObjectRelationParentId { get; set; }
+
}
diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
index 28689d15f..5ca96c5c9 100644
--- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
+++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
@@ -136,7 +136,8 @@ namespace IRaCIS.Core.Application.Service.Inspection
};
query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
- .WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId)
+ //.WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId)
+ .WhereIf(dto.ObjectRelationParentId != null && dto.BatchId!=null && dto.RelationDeadlineTime!=null, x => (x.ObjectRelationParentId == dto.ObjectRelationParentId && x.CreateTime<= dto.RelationDeadlineTime) ||x.BatchId==dto.BatchId )
.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.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs
index fd65f0962..b14823c93 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingClinicalDataDto.cs
@@ -382,6 +382,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
///
public bool? IsComplete { get; set; }
+
+ //临床数据状态
+ public ReadingClinicalDataStatus ReadingClinicalDataState { get; set; }
+
///
/// 文件数量
///
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs
index d4bf72505..7cefc7cf3 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs
@@ -96,6 +96,8 @@ namespace IRaCIS.Application.Services
ClinicalDataLevel = clinicalDataTrialSet.ClinicalDataLevel,
ReadingId = indto.ReadingId
}).ToList();
+
+ entity.ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded;
await _readingClinicalDataRepository.AddAsync(entity, true);
var success = await _readingClinicalDataRepository.SaveChangesAsync();
return ResponseOutput.Ok(entity.Id);
@@ -118,6 +120,7 @@ namespace IRaCIS.Application.Services
ReadingId = indto.ReadingId,
ReadingClinicalDataId = entity.Id,
}).ToList();
+ entity.ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded;
await _readingClinicalDataPDFRepository.AddRangeAsync(addFileList);
var success = await _readingClinicalDataRepository.SaveChangesAsync();
return ResponseOutput.Ok(entity.Id);
@@ -229,6 +232,7 @@ namespace IRaCIS.Application.Services
{
await _readingClinicalDataRepository.DeleteFromQueryAsync(x => x.Id == id, true);
+ await _readingClinicalDataPDFRepository.DeleteFromQueryAsync(x => x.ReadingClinicalDataId == id, true);
return ResponseOutput.Result(true);
}
@@ -295,7 +299,8 @@ namespace IRaCIS.Application.Services
{
await _readingClinicalDataRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.ReadingClinicalDataId, x => new ReadingClinicalData()
{
- IsSign = true
+ IsSign = true,
+ ReadingClinicalDataState=ReadingClinicalDataStatus.HaveSigned
});
var result = await _readingClinicalDataRepository.SaveChangesAsync();
@@ -448,10 +453,11 @@ namespace IRaCIS.Application.Services
[HttpPut]
public async Task PMClinicalDataConfirm(PMClinicalDataConfirmCommand command)
{
- await _readingClinicalDataRepository.BatchUpdateNoTrackingAsync(t => t.Id == command.Id, u => new ReadingClinicalData()
+ await _readingClinicalDataRepository.UpdatePartialFromQueryAsync(t => t.Id == command.Id, u => new ReadingClinicalData()
{
IsBlind=command.IsBlind,
- IsComplete=command.IsComplete
+ IsComplete=command.IsComplete,
+ ReadingClinicalDataState=ReadingClinicalDataStatus.HaveChecked
});
await _readingClinicalDataRepository.SaveChangesAsync();
@@ -480,6 +486,9 @@ namespace IRaCIS.Application.Services
IsCRCUpload = x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC,
IsBlind=x.IsBlind,
IsComplete=x.IsComplete,
+
+ ReadingClinicalDataState=x.ReadingClinicalDataState,
+
FileList = x.ReadingClinicalDataPDFList.Select(y => new GetFileDto()
{
Id = y.Id,
diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
index 47742ced1..f9b5041cd 100644
--- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
+++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
@@ -351,4 +351,17 @@ namespace IRaCIS.Core.Domain.Share
///
ReadCompleted = 5,
}
+
+
+ public enum ReadingClinicalDataStatus
+ {
+ WaitUpload=0,
+
+ HaveUploaded=1,
+
+ HaveChecked=2,
+
+ HaveSigned=3
+
+ }
}
diff --git a/IRaCIS.Core.Domain/Reading/ReadingClinicalData.cs b/IRaCIS.Core.Domain/Reading/ReadingClinicalData.cs
index a8216bfb2..56d420619 100644
--- a/IRaCIS.Core.Domain/Reading/ReadingClinicalData.cs
+++ b/IRaCIS.Core.Domain/Reading/ReadingClinicalData.cs
@@ -64,6 +64,10 @@ namespace IRaCIS.Core.Domain.Models
///
public Guid CreateUserId { get; set; }
+
+ //临床数据状态
+ public ReadingClinicalDataStatus ReadingClinicalDataState { get; set; }
+
[ForeignKey("ClinicalDataTrialSetId")]
public ClinicalDataTrialSet ClinicalDataTrialSet { get; set; }
diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs
index bcee02c2c..8370f875d 100644
--- a/IRaCIS.Core.Domain/Trial/DataInspection.cs
+++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs
@@ -137,6 +137,9 @@ namespace IRaCIS.Core.Domain.Models
/// 批次Id
///
public Guid BatchId { get; set; }
+
+
+ public Guid? ObjectRelationParentId { get; set; }
}
diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
index 1b2db412c..e7c70d83d 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
@@ -847,7 +847,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}
- //阅片期
+ //阅片期计划
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodSet)))
{
var entity = item.Entity as ReadingPeriodSet;
@@ -858,7 +858,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
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 nameList = _dbContext.TrialSite.Where(c => c.TrialId == entity.TrialId && siteIds.Contains(c.SiteId)).Select(t => t.TrialSiteCode).ToList();
siteCodes = String.Join(',', nameList);
}
@@ -874,48 +874,88 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
- foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodPlan)))
- {
- var entity = item.Entity as ReadingPeriodPlan;
+ #region 阅片期临时数据不记录
+ //foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodPlan)))
+ //{
+ // var entity = item.Entity as ReadingPeriodPlan;
- if (entity.ReadingPeriodSet == null)
- {
- entity.ReadingPeriodSet = _dbContext.ReadingPeriodSet.Find(entity.ReadingPeriodSetId);
- }
+ // if (entity.ReadingPeriodSet == null)
+ // {
+ // entity.ReadingPeriodSet = _dbContext.ReadingPeriodSet.Find(entity.ReadingPeriodSetId);
+ // }
- await InsertInspection(item.Entity as ReadingPeriodPlan, type, x => new InspectionConvertDTO()
- {
- GeneralId = x.Id,
- SubjectVisitId = x.SubjectVisitId,
- }, new
- {
- entity.ReadingPeriodSet.ReadingPeriodName,
- entity.ReadingPeriodSet.EffectOfTime,
- entity.ReadingPeriodSet.ExpirationDate
- });
- }
+ // await InsertInspection(item.Entity as ReadingPeriodPlan, type, x => new InspectionConvertDTO()
+ // {
+ // GeneralId = x.Id,
+ // SubjectVisitId = x.SubjectVisitId,
+ // }, new
+ // {
+ // entity.ReadingPeriodSet.ReadingPeriodName,
+ // entity.ReadingPeriodSet.EffectOfTime,
+ // entity.ReadingPeriodSet.ExpirationDate
+ // });
+ //}
+ #endregion
+
+ //阅片期
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadModule)))
{
var entity = item.Entity as ReadModule;
- //if (entity.ReadingPeriodSet == null && entity.ReadingPeriodSetId !=null)
- //{
- // entity.ReadingPeriodSet = _dbContext.ReadingPeriodSet.Find(entity.ReadingPeriodSetId);
- //}
-
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()
{
GeneralId = x.Id,
SubjectVisitId = x.SubjectVisitId,
+ IsDistinctionInterface = false,
}, new
{
-
+
VisitName = visitName,
});
}
+ //阅片期临床数据
+
+ 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(item.Entity as ReadingClinicalData, type, x => new InspectionConvertDTO()
+ {
+ GeneralId = x.Id,
+ SubjectVisitId = x.IsVisit ? x.ReadingId : null,
+ }, 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(item.Entity as ReadingClinicalDataPDF, type, x => new InspectionConvertDTO()
+ {
+ GeneralId = x.Id,
+ SubjectId = x.SubjectId,
+ IsDistinctionInterface=false,
+ ObjectRelationParentId=entity.ReadingClinicalDataId
+ }, new
+ {
+ IsCRCUpload = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator
+ });
+ }
+
+
#endregion
}
@@ -942,12 +982,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}
- inspection.Identification = await GetInspectionRecordIdentificationAsync(entityObj, type);
+ inspection.Identification = await GetInspectionRecordIdentificationAsync(entityObj, type, inspection.IsDistinctionInterface);
//将实体对象属性 映射到稽查实体
MapEntityPropertyToAuditEntity(entityObj, inspection);
- var generalData = await GetInspectionGeneralDataAsync( inspection);
+ var generalData = await GetInspectionGeneralDataAsync(inspection);
//不可少 因为稽查实体可能某些Id没有
MapEntityPropertyToAuditEntity(generalData, inspection);
@@ -1027,7 +1067,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
///
///
///
- public async Task GetInspectionGeneralDataAsync( InspectionConvertDTO inspection)
+ public async Task GetInspectionGeneralDataAsync(InspectionConvertDTO inspection)
{
InspectionGeneralData generalData = new InspectionGeneralData()
@@ -1054,8 +1094,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
//添加访视的时候,会带信息过来
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();
+ 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;
@@ -1143,7 +1183,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
/// 获取稽查记录的标识符 部分业务会进行特殊处理
///
///
- public async Task GetInspectionRecordIdentificationAsync(T entityObj, string type)
+ public async Task GetInspectionRecordIdentificationAsync(T entityObj, string type, bool IsDistinctionInterface = true)
{
var entityTypeName = entityObj.GetType().Name;
@@ -1215,7 +1255,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common
#endregion
- return $"{_userInfo.RequestUrl}/{entityTypeName}/{type}";
+ if (IsDistinctionInterface)
+ {
+ return $"{_userInfo.RequestUrl}/{entityTypeName}/{type}";
+
+ }
+ else
+ {
+ return $"{entityTypeName}/{type}";
+ }
}
diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs
index 254bba41a..0c44dce90 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs
@@ -132,6 +132,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
public string BlindName { get; set; } = string.Empty;
+ //标识操作 是否区分接口
+ public bool IsDistinctionInterface=true;
+
+
}
///