修改一版
parent
a7048ef08c
commit
7103b62786
|
@ -181,37 +181,9 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
if (isSeriesNeedAdd)
|
||||
{
|
||||
dicomSeries.DicomStudy = dicomStudy;
|
||||
// 添加序列
|
||||
await _seriesRepository.AddAsync(dicomSeries);
|
||||
#region 稽查
|
||||
List<DataInspection> datas = new List<DataInspection>();
|
||||
|
||||
|
||||
// 这里移动不进去
|
||||
datas.Add(new DataInspection()
|
||||
{
|
||||
|
||||
SiteId = dicomStudy.SiteId,
|
||||
SubjectId = dicomStudy.SubjectId,
|
||||
TrialId = dicomStudy.TrialId,
|
||||
GeneralId = dicomSeries.Id,
|
||||
SubjectVisitId = dicomStudy.SubjectVisitId,
|
||||
CreateTime = createtime.AddMilliseconds(10),
|
||||
Identification = "Init|DICOM Series|Status|Visit-Image Upload",
|
||||
JsonDetail = JsonConvert.SerializeObject(new
|
||||
{
|
||||
StudyCode = dicomStudy.StudyCode,
|
||||
Modalities = dicomStudy.Modalities,
|
||||
SeriesNumber = dicomSeries.SeriesNumber,
|
||||
InstanceCount = dicomSeries.InstanceCount,
|
||||
SeriesTime = dicomSeries.SeriesTime,
|
||||
IsReading = dicomSeries.IsReading,
|
||||
IsDeleted = dicomSeries.IsReading,
|
||||
|
||||
})
|
||||
});
|
||||
await _inspectionService.AddListInspectionRecordAsync(datas);
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -842,7 +842,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
var DicomSeriesdata = await _repository.GetQueryable<DicomSeries>().Where(x => x.StudyId == id).ToListAsync();
|
||||
var study = await _repository.FirstOrDefaultAsync<DicomStudy>(t => t.Id == id);
|
||||
List<DataInspection> datas = new List<DataInspection>();
|
||||
|
||||
DateTime time = DateTime.Now.AddMilliseconds(500);
|
||||
if (type == 1)
|
||||
{
|
||||
|
@ -852,33 +852,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
study.BodyPartForEdit = bodyPart;
|
||||
study.Modalities = modality;
|
||||
await _repository.BatchUpdateAsync<DicomSeries>(t => t.StudyId == id, r => new DicomSeries() { BodyPartForEdit = bodyPart, Modality = modality });
|
||||
|
||||
DicomSeriesdata.ForEach(x =>
|
||||
{
|
||||
//datas.Add(new DataInspection()
|
||||
//{
|
||||
// TrialId = x.TrialId,
|
||||
// SiteId = x.SiteId,
|
||||
// SubjectId = x.SubjectId,
|
||||
// SubjectVisitId = x.SubjectVisitId,
|
||||
// GeneralId = x.Id,
|
||||
// CreateTime = time,
|
||||
// Identification = "Edit|DICOM Series|Info|Visit-Image Quanlity Control",
|
||||
// JsonDetail = JsonConvert.SerializeObject(new
|
||||
// {
|
||||
// StudyCode = study.StudyCode,
|
||||
// Modalities = study.Modalities,
|
||||
// SeriesNumber = x.SeriesNumber,
|
||||
// InstanceCount = x.InstanceCount,
|
||||
// SeriesTime = x.SeriesTime,
|
||||
// BodyPartForEdit = bodyPart,
|
||||
// Modality = modality
|
||||
// })
|
||||
|
||||
//});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
|
@ -886,30 +859,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
if (series == null) return Null404NotFound(series);
|
||||
series.BodyPartForEdit = bodyPart;
|
||||
|
||||
//DicomSeriesdata.ForEach(x =>
|
||||
//{
|
||||
// datas.Add(new DataInspection()
|
||||
// {
|
||||
// TrialId = x.TrialId,
|
||||
// SiteId = x.SiteId,
|
||||
// SubjectId = x.SubjectId,
|
||||
// SubjectVisitId = x.SubjectVisitId,
|
||||
// GeneralId = x.Id,
|
||||
// CreateTime = time,
|
||||
// Identification = "Edit|DICOM Series|Info|Visit-Image Quanlity Control",
|
||||
// JsonDetail = JsonConvert.SerializeObject(new
|
||||
// {
|
||||
// StudyCode = study.StudyCode,
|
||||
// Modalities = study.Modalities,
|
||||
// SeriesNumber = x.SeriesNumber,
|
||||
// InstanceCount = x.InstanceCount,
|
||||
// SeriesTime = x.SeriesTime,
|
||||
// BodyPartForEdit = bodyPart,
|
||||
// })
|
||||
|
||||
// });
|
||||
|
||||
//});
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
|
@ -1869,28 +1818,15 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
{
|
||||
|
||||
bool isSuccess = false;
|
||||
List<DataInspection> datas = new List<DataInspection>();
|
||||
|
||||
|
||||
foreach (var subjectVisitId in subjectVisitIdList)
|
||||
{
|
||||
|
||||
|
||||
var info = await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).ProjectTo<DicomTrialSiteSubjectInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
Dictionary<string, object> keyValuePairs = new Dictionary<string, object>() {
|
||||
{"SubmitState",info.SubmitState },
|
||||
{ "AuditState",info.AuditState},
|
||||
{ "CheckState",info.CheckState},
|
||||
{ "ForwardState",info.ForwardState}
|
||||
|
||||
};
|
||||
DataInspection data = new DataInspection()
|
||||
{
|
||||
TrialId = info.TrialId,
|
||||
SiteId = info.SiteId,
|
||||
SubjectId = info.SubjectId,
|
||||
SubjectVisitId = subjectVisitId,
|
||||
Identification = "Edit|Visit|Status|Visit-Image Forward"
|
||||
};
|
||||
|
||||
|
||||
var targetPath = "/IMPORT-IMAGES/" + info.TrialCode + "_" + info.SubjectCode + "_" + info.VisitName;
|
||||
|
||||
var path = _dicomFileStoreHelper.GetSubjectVisitPath(info.TrialId, info.SiteId, info.SubjectId, info.SubjectVisitId);
|
||||
|
@ -1953,26 +1889,22 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.Forwarded, ForwardUserId = _userInfo.Id, ForwardTime = DateTime.Now });
|
||||
|
||||
isSuccess = true;
|
||||
keyValuePairs["ForwardState"] = ForwardStateEnum.Forwarded;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId,
|
||||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
||||
keyValuePairs["ForwardState"] = ForwardStateEnum.ForwardFailed;
|
||||
|
||||
|
||||
return ResponseOutput.NotOk("转发失败 " + e.Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
data.JsonDetail = JsonConvert.SerializeObject(keyValuePairs);
|
||||
datas.Add(data);
|
||||
}
|
||||
|
||||
// 这里使用的是批量更新
|
||||
await _subjectVisitRepository.AddListInspectionRecordAsync(datas);
|
||||
|
||||
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
JsonDetail = subjectvisit.ToJcJson(),
|
||||
});
|
||||
|
||||
// 这里是触发器的位置
|
||||
await _subjectVisitRepository.AddListInspectionRecordAsync(datas);
|
||||
//// 这里是触发器的位置
|
||||
//await _subjectVisitRepository.AddListInspectionRecordAsync(datas);
|
||||
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit,
|
||||
u => new SubjectVisit() { VisitExecuted = 0, SVENDTC = null, SVSTDTC = null, SubmitState = SubmitStateEnum.None });
|
||||
|
|
|
@ -93,8 +93,7 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
var svGroup = dbList.GroupBy(t => new { t.SubjectVisitId, t.SiteCode, t.SubjectCode, t.VisitName })
|
||||
.Select(g => new { g.Key.SubjectCode, g.Key.VisitName, g.Key.SiteCode, g.Key.SubjectVisitId, StudyList = g.ToList() }).ToList();
|
||||
|
||||
List<DataInspection> datas = new List<DataInspection>();
|
||||
var createtime = DateTime.Now;
|
||||
|
||||
foreach (var sv in svGroup)
|
||||
{
|
||||
|
||||
|
@ -134,51 +133,10 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
dbSV.CheckResult = "根据导入的一致性核查数据,请确认本访视以下不一致检查项信息:" + String.Join(" | ", dbExceptExcel.Select(t => $"EDC 缺少:{t.StudyDate} {t.Modality} ")) + " | "
|
||||
+ String.Join(" | ", excelExceptDB.Select(t => $"IRC 缺少:{t.StudyDate} {t.Modality}"));
|
||||
//新增一致性核查质疑记录
|
||||
datas.Add(new DataInspection()
|
||||
{
|
||||
|
||||
SiteId = dbSV.SiteId,
|
||||
SubjectId = dbSV.SubjectId,
|
||||
TrialId = dbSV.TrialId,
|
||||
SubjectVisitId = dbSV.Id,
|
||||
CreateTime = createtime.AddMilliseconds(200),
|
||||
Identification = "Add|Consistency Check Query|Data|Visit-Consistency Check",
|
||||
JsonDetail = JsonConvert.SerializeObject(new
|
||||
{
|
||||
SubmitState = dbSV.SubmitState,
|
||||
AuditState = dbSV.AuditState,
|
||||
CheckState = dbSV.CheckState,
|
||||
CheckResult= dbSV.CheckResult,
|
||||
TalkContent= dbSV.CheckResult,
|
||||
RequestBackState= dbSV.RequestBackState,
|
||||
CheckChallengeState = dbSV.CheckChallengeState,
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
datas.Add(new DataInspection()
|
||||
{
|
||||
|
||||
SiteId = dbSV.SiteId,
|
||||
SubjectId = dbSV.SubjectId,
|
||||
TrialId = dbSV.TrialId,
|
||||
SubjectVisitId = dbSV.Id,
|
||||
CreateTime = createtime.AddMilliseconds(500),
|
||||
Identification = "Edit|Consistency Check Query|Data|Visit-Consistency Check|Send",
|
||||
JsonDetail = JsonConvert.SerializeObject(new
|
||||
{
|
||||
SubmitState = dbSV.SubmitState,
|
||||
AuditState = dbSV.AuditState,
|
||||
CheckState = dbSV.CheckState,
|
||||
CheckResult = dbSV.CheckResult,
|
||||
TalkContent = dbSV.CheckResult,
|
||||
RequestBackState = dbSV.RequestBackState,
|
||||
CheckChallengeState = dbSV.CheckChallengeState,
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
dbSV.CheckState = CheckStateEnum.CVIng;
|
||||
|
@ -191,25 +149,6 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
}
|
||||
dbSV.CheckTime = DateTime.Now;
|
||||
|
||||
// 在线一致性核查
|
||||
datas.Add(new DataInspection()
|
||||
{
|
||||
|
||||
SiteId = dbSV.SiteId,
|
||||
SubjectId = dbSV.SubjectId,
|
||||
TrialId = dbSV.TrialId,
|
||||
SubjectVisitId = dbSV.Id,
|
||||
CreateTime= createtime,
|
||||
Reason= dbSV.ManualPassReason,
|
||||
Identification = "Add|Visit|Status|Visit-Consistency Check",
|
||||
JsonDetail = JsonConvert.SerializeObject(new
|
||||
{
|
||||
SubmitState = dbSV.SubmitState,
|
||||
AuditState= dbSV.AuditState,
|
||||
CheckState = dbSV.CheckState,
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
|
||||
|
|
|
@ -73,7 +73,22 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
#endregion
|
||||
|
||||
#region 区分
|
||||
|
||||
|
||||
// 项目
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Trial)))
|
||||
{
|
||||
await InsertInspection<Trial>(item, type, x => new DataInspection()
|
||||
{
|
||||
TrialId = x.Id,
|
||||
TrialName = x.ExperimentName,
|
||||
});
|
||||
}
|
||||
|
||||
// TrialDocument
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument)))
|
||||
{
|
||||
await InsertInspection<TrialDocument>(item, type);
|
||||
}
|
||||
|
||||
// 项目人员
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser)))
|
||||
|
@ -87,10 +102,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
SubjectId = x.Id,
|
||||
SubjectCode=x.Code,
|
||||
},new
|
||||
{
|
||||
test="受试者"
|
||||
|
||||
});
|
||||
}
|
||||
// 访视
|
||||
|
@ -109,30 +120,100 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
// 访视计划
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
|
||||
{
|
||||
await InsertInspection<Subject>(item, type, x => new DataInspection()
|
||||
await InsertInspection<VisitStage>(item, type, x => new DataInspection()
|
||||
{
|
||||
VisitStageId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
// 检查
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy)))
|
||||
|
||||
// 既往手术史
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousSurgery)))
|
||||
{
|
||||
await InsertInspection<Subject>(item, type, x => new DataInspection()
|
||||
await InsertInspection<PreviousSurgery>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 既往放疗史
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousHistory)))
|
||||
{
|
||||
await InsertInspection<PreviousHistory>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
//foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy)))
|
||||
//{
|
||||
// await InsertInspection<Subject>(item, type, x => new DataInspection()
|
||||
// {
|
||||
// GeneralId = x.Id,
|
||||
// });
|
||||
//}
|
||||
// 其他治疗史
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousOther)))
|
||||
{
|
||||
await InsertInspection<PreviousOther>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
// 检查
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy)))
|
||||
{
|
||||
await InsertInspection<DicomStudy>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
// 序列
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomSeries)))
|
||||
{
|
||||
var entity = item.Entity as DicomSeries;
|
||||
|
||||
await InsertInspection<DicomSeries>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
},new {
|
||||
StudyCode = entity.DicomStudy.StudyCode,
|
||||
Modalities = entity.DicomStudy.Modalities,
|
||||
});
|
||||
}
|
||||
|
||||
//质疑
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge)))
|
||||
{
|
||||
await InsertInspection<QCChallenge>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
//一致性核查
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(CheckChallengeDialog)))
|
||||
{
|
||||
await InsertInspection<CheckChallengeDialog>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
//Qc 问题
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCQuestion)))
|
||||
{
|
||||
await InsertInspection<QCQuestion>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Qc 问题答案
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer)))
|
||||
{
|
||||
await InsertInspection<TrialQCQuestionAnswer>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue