diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 9bf8f0b10..da640b355 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -181,55 +181,55 @@ namespace IRaCIS.Core.Application.Service.Inspection public async Task Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response=null) { - return ResponseOutput.Ok(); + - //if (response!=null&&response.IsSuccess == false) - //{ - // return response; - //} - //Guid? signId = null; - //MapData(OptCommand, AuditInfo); - //if (AuditInfo.IsSign) - //{ - // // 验证用户签名信息 - // var verifyResult = await VerifySignatureAsync(SignInfo); - // signId = await AddSignRecordAsync(SignInfo); - // if (verifyResult.IsSuccess == false) - // { - // return verifyResult; - // } - // //await AddSignRecordAsync(SignInfo); - //} + if (response != null && response.IsSuccess == false) + { + return response; + } + Guid? signId = null; + MapData(OptCommand, AuditInfo); + if (AuditInfo.IsSign) + { + // 验证用户签名信息 + var verifyResult = await VerifySignatureAsync(SignInfo); + signId = await AddSignRecordAsync(SignInfo); + if (verifyResult.IsSuccess == false) + { + return verifyResult; + } + //await AddSignRecordAsync(SignInfo); + } - //IResponseOutput bResult; + IResponseOutput bResult; - //if (response != null) - //{ - // bResult = response; - //} - //else - //{ - // bResult = await fun(OptCommand); - //} + if (response != null) + { + bResult = response; + } + else + { + bResult = await fun(OptCommand); + } - //// 用户 签名某个文档 - //if (bResult.IsSuccess == false) - //{ - // return bResult; - //} + // 用户 签名某个文档 + if (bResult.IsSuccess == false) + { + return bResult; + } - //if (AuditInfo.IsSign) - //{ - // var signSuccess = await _repository.BatchUpdateAsync(t => t.Id == signId, u => new TrialSign() { IsCompleted = true }); - //} + if (AuditInfo.IsSign) + { + var signSuccess = await _repository.BatchUpdateAsync(t => t.Id == signId, u => new TrialSign() { IsCompleted = true }); + } //// 判断是否需要前面 //if (AuditInfo.NeedSava) //{ // await AddInspectionRecordAsync(AuditInfo, signId); //} - - //return bResult; + + return bResult; } diff --git a/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs index 80cb3b595..73e6d34c3 100644 --- a/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs @@ -32,6 +32,6 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface /// /// /// - Task AddListInspectionRecordAsync(List datas); + //Task AddListInspectionRecordAsync(List datas); } } diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 6a0cca547..788f1560b 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -965,38 +965,13 @@ namespace IRaCIS.Core.Application.Image.QA } var waitDeleteStudyList = await _dicomStudyRepository.Where(x => ids.Contains(x.Id)).ToListAsync(); - List datas = new List(); + - waitDeleteStudyList.ForEach(x => - { - - - datas.Add(new DataInspection() - { - - SiteId = x.SiteId, - SubjectId = x.SubjectId, - TrialId = x.TrialId, - SubjectVisitId = x.SubjectVisitId, - GeneralId = x.Id, - CreateTime = DateTime.Now, - Identification = "Delete|DICOM Study|Data|Visit-Image Upload", - JsonDetail = JsonConvert.SerializeObject(new - { - studyUid = x.StudyCode, - modality = x.Modalities, - bodyPart = x.BodyPartForEdit, - seriesNum = x.SeriesCount, - fileNum = x.InstanceCount, - studyTime = x.StudyTime?.ToString("yyyy-MM-dd") - - }) - }); - }); + - var createtime = DateTime.Now.AddMilliseconds(200); + foreach (var study in waitDeleteStudyList) { @@ -1022,30 +997,7 @@ namespace IRaCIS.Core.Application.Image.QA }).ToListAsync(); - DicomSeriess.ForEach(x => - { - datas.Add(new DataInspection() - { - - SiteId = x.SiteId, - SubjectId = x.SubjectId, - TrialId = x.TrialId, - GeneralId = x.Id, - SubjectVisitId = x.SubjectVisitId, - CreateTime = createtime, - Identification = "Delete|DICOM Series|Data|Visit-Image Upload", - JsonDetail = JsonConvert.SerializeObject(new - { - StudyCode = x.StudyCode, - Modalities = x.Modalities, - SeriesNumber = x.SeriesNumber, - InstanceCount = x.InstanceCount, - SeriesTime = x.SeriesTime, - IsReading = x.IsReading, - - }) - }); - }); + var success3 = await _repository.BatchDeleteAsync(t => t.StudyId == id); var success4 = await _repository.BatchDeleteAsync(t => t.StudyId == id); @@ -1071,7 +1023,6 @@ namespace IRaCIS.Core.Application.Image.QA var subvisit = await _repository.GetQueryable().FirstOrDefaultAsync(x => x.Id == subjectVisitId); - await _inspectionService.AddListInspectionRecordAsync(datas); return ResponseOutput.Ok(); } @@ -1416,41 +1367,6 @@ namespace IRaCIS.Core.Application.Image.QA var success = await _repository.SaveChangesAsync(); - List datas = new List(); - //dbSubjectVisitList.ForEach(x => - //{ - // datas.Add(new DataInspection() - // { - - // SiteId = x.SiteId, - // SubjectId = x.SubjectId, - // TrialId = x.TrialId, - // SubjectVisitId = x.Id, - // Identification= "Edit|Visit|Status|Visit-Image Upload", - // JsonDetail = JsonConvert.SerializeObject(new - // { - // SubmitState = "已提交", - - - // }) - // }); - //}); - - dbSubjectVisitList.ForEach(x => - { - datas.Add(new DataInspection() - { - - SiteId = x.SiteId, - SubjectId = x.SubjectId, - TrialId = x.TrialId, - SubjectVisitId = x.Id, - Identification = "Edit|Visit|Status|Visit-Image Upload-1", - JsonDetail = x.ToJcJson(), - }); - }); - - await _inspectionService.AddListInspectionRecordAsync(datas); return ResponseOutput.Result(success); @@ -1618,54 +1534,7 @@ namespace IRaCIS.Core.Application.Image.QA var instanceIdList = await _repository.Where(t => t.DicomSerie.IsDeleted && t.SubjectVisitId == subjectVisitId) .Select(t => new { InstanceId = t.Id, t.SeriesId, t.StudyId, t.SubjectId, t.SiteId }).ToListAsync(); - // 删除序列 - List datas = new List(); - var DicomSeriesdata = await _repository.GetQueryable().Where(x => x.SubjectVisitId == subjectVisitId && x.IsDeleted).Select(x => new - { - StudyCode = x.DicomStudy.StudyCode, - Modalities = x.DicomStudy.Modalities, - SeriesNumber = x.SeriesNumber, - InstanceCount = x.InstanceCount, - SeriesTime = x.SeriesTime, - TrialId = x.TrialId, - SiteId = x.SiteId, - x.SubjectId, - x.SubjectVisitId, - x.IsDeleted, - x.IsReading, - x.Id, - - }).ToListAsync(); - DateTime time = DateTime.Now.AddMilliseconds(500); - 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 = "Delete|DICOM Series|Data|Visit-Image Quanlity Control", - JsonDetail = JsonConvert.SerializeObject(new - { - StudyCode = x.StudyCode, - Modalities = x.Modalities, - SeriesNumber = x.SeriesNumber, - InstanceCount = x.InstanceCount, - SeriesTime = x.SeriesTime, - IsReading = x.IsReading, - IsDeleted = x.IsDeleted, - - }) - - }); - - }); - - - await _inspectionService.AddListInspectionRecordAsync(datas); + instanceIdList.ForEach(t => { var path = _dicomFileStoreHelper.GetInstanceFilePath(new DicomStudy() { Id = t.StudyId, SubjectId = t.SubjectId, TrialId = trialId, SiteId = t.SiteId, SubjectVisitId = subjectVisitId }, t.SeriesId, t.InstanceId.ToString()); @@ -1981,29 +1850,7 @@ namespace IRaCIS.Core.Application.Image.QA if (command.SubjectFirstGiveMedicineTime != null) { - await _subjectRepository.UpdatePartialFromQueryAsync(command.SubjectId, u => new Subject() { FirstGiveMedicineTime = command.SubjectFirstGiveMedicineTime, }); - - - List datas = new List(); - - if (dbSubjectVisit.IsBaseLine) - { - datas.Add(new DataInspection() - { - - SubjectId = command.SubjectId, - SiteId = dbSubjectVisit.SiteId, - TrialId = dbSubjectVisit.TrialId, - IsSign = false, - Identification = "Edit|Subject|Info|Subject", - CreateTime = DateTime.Now.AddSeconds(1), - JsonDetail = command.ToJcJson() - }); - } - - - await _inspectionService.AddListInspectionRecordAsync(datas); } await _subjectVisitRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index 6bd8cd934..9573d434b 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -118,31 +118,14 @@ namespace IRaCIS.Application.Services return ResponseOutput.NotOk("This subject has executed a visit with uploading study images,and couldn't be deleted."); } - var isSuccess = await _subjectRepository.BatchDeleteNoTrackingAsync(u => u.Id == id); + var isSuccess = await _subjectRepository.DeleteFromQueryAsync(u => u.Id == id); await _subjectVisitRepository.DeleteFromQueryAsync(u => u.SubjectId == id); var subvisit = await _subjectVisitRepository.Where(x => x.SubjectId == id).ToListAsync(); - List datas = new List(); - - foreach (var item in subvisit) - { - datas.Add(new DataInspection() - { - SiteId = item.SiteId, - SubjectId = item.SubjectId, - TrialId = item.TrialId, - SubjectVisitId = item.Id, - Identification = "Delete|Visit|Data|Visit-Image Upload", - JsonDetail = JsonConvert.SerializeObject(item) - }); - }; - - - - await _inspectionService.AddListInspectionRecordAsync(datas); - return ResponseOutput.Result(isSuccess); + + return ResponseOutput.Result(true); } /// 分页获取受试者列表[New]