diff --git a/src/api/trials.js b/src/api/trials.js index f1530112..95620e95 100644 --- a/src/api/trials.js +++ b/src/api/trials.js @@ -3712,7 +3712,7 @@ export function addOrUpdateTrialSiteDicomAE(param) { export function deleteTrialSiteDicomAE(id) { return request({ url: `/TrialSiteDicomAE/deleteTrialSiteDicomAE/${id}`, - method: 'delete', + method: 'delete' }) } // 获取项目中dicomAE配置 @@ -3743,7 +3743,7 @@ export function addOrUpdateDicomAE(data) { export function testSCPServerConnect(id) { return request({ url: `/TrialDicomAE/testSCPServerConnect/${id}`, - method: 'get', + method: 'get' }) } // dicomAE配置签名 diff --git a/src/views/dicom-show/dicom-study.vue b/src/views/dicom-show/dicom-study.vue index b51e5315..3043910b 100644 --- a/src/views/dicom-show/dicom-study.vue +++ b/src/views/dicom-show/dicom-study.vue @@ -192,7 +192,8 @@ export default { loading: false, imageList: [], showSeriesList: [], - currentLoadIns: [] + currentLoadIns: [], + isFromCRCUpload: false } }, created: function() { @@ -207,6 +208,7 @@ export default { changeURLStatic('TokenKey', '') } this.studyId = this.$router.currentRoute.query.studyId + this.isFromCRCUpload = !!this.$router.currentRoute.query.isFromCRCUpload if (this.type === 'Series') { // this.initStudy() this.showDelete = parseInt(this.$router.currentRoute.query.showDelete) @@ -231,22 +233,20 @@ export default { }) }, methods: { - loadStudy() { - var scope = this - getStudyInfo(scope.studyId).then(data => { - if (data.IsSuccess) { - scope.studyCode = data.Result.StudyCode - scope.modality = data.Result.Modalities - scope.seriesCount = data.Result.SeriesCount - scope.description = data.Result.Description - var url = `/series/list/${scope.studyId}` - scope.getSeriesList(url) - } - }) + async loadStudy() { + const data = await getStudyInfo(this.studyId) + if (data.IsSuccess) { + this.studyCode = data.Result.StudyCode + this.modality = data.Result.Modalities + this.seriesCount = data.Result.SeriesCount + this.description = data.Result.Description + const url = `/series/list/${this.studyId}` + this.getSeriesList(url) + } }, - getSeriesList(url) { - var scope = this - getSeriesList(url).then(data => { + async getSeriesList(url) { + try { + const data = await getSeriesList(url) if (data.IsSuccess) { const { Result } = data var seriesList = [] @@ -255,15 +255,15 @@ export default { item.InstanceInfoList.forEach(i => { if (i.NumberOfFrames && i.NumberOfFrames > 1) { for (let j = 0; j < i.NumberOfFrames; j++) { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?frame=${j}&instanceId=${i.Id}&seriesIndex=${index}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${i.Path}?frame=${j}&instanceId=${i.Id}&seriesIndex=${index}`) } } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}&seriesIndex=${index}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}&seriesIndex=${index}`) } }) - var subjectVisitId = scope.$router.currentRoute.query.subjectVisitId - var studyId = scope.$router.currentRoute.query.studyId - var trialId = scope.$router.currentRoute.query.trialId + var subjectVisitId = this.$router.currentRoute.query.subjectVisitId + var studyId = this.$router.currentRoute.query.studyId + var trialId = this.$router.currentRoute.query.trialId seriesList.push({ trialId, subjectVisitId, @@ -278,38 +278,40 @@ export default { description: item.Description, isReading: item.IsReading, isDeleted: item.IsDeleted, - previewImageUrl: item.ImageResizePath ? scope.OSSclientConfig.basePath + item.ImageResizePath : `/api/series/preview/${item.Id}`, + previewImageUrl: item.ImageResizePath ? this.OSSclientConfig.basePath + item.ImageResizePath : `/api/series/preview/${item.Id}`, instanceCount: item.InstanceCount, prefetchInstanceCount: 0, hasLabel: item.HasLabel, keySeries: item.KeySeries, - tpCode: scope.tpCode, + tpCode: this.tpCode, loadStatus: false, imageloadedArr: [], isExistMutiFrames: item.IsExistMutiFrames }) }) - scope.seriesList = seriesList - if (scope.seriesList.length > 0) { + this.seriesList = seriesList + if (this.seriesList.length > 0) { this.loadAllImages() - scope.$refs.dicomViewer.loadImageStack(scope.seriesList[0], scope.labels[scope.tpCode]) - scope.firstInstanceId = scope.seriesList[0].imageIds[0] + this.$refs.dicomViewer.loadImageStack(this.seriesList[0], this.labels[this.tpCode]) + this.firstInstanceId = this.seriesList[0].imageIds[0] } } - }) + } catch (e) { + console.log(e) + } }, - initSeries() { - var scope = this - this.studyCode = this.$router.currentRoute.query.studyCode - this.modality = this.$router.currentRoute.query.modality - this.seriesCount = 1 - this.description = this.$router.currentRoute.query.description - var seriesId = this.$router.currentRoute.query.seriesId - var seriesNumber = this.$router.currentRoute.query.seriesNumber - var subjectVisitId = this.$router.currentRoute.query.subjectVisitId - var studyId = this.$router.currentRoute.query.studyId - var trialId = this.$router.currentRoute.query.trialId - getInstanceList(seriesId).then(res => { + async initSeries() { + try { + this.studyCode = this.$router.currentRoute.query.studyCode + this.modality = this.$router.currentRoute.query.modality + this.seriesCount = 1 + this.description = this.$router.currentRoute.query.description + var seriesId = this.$router.currentRoute.query.seriesId + var seriesNumber = this.$router.currentRoute.query.seriesNumber + var subjectVisitId = this.$router.currentRoute.query.subjectVisitId + var studyId = this.$router.currentRoute.query.studyId + var trialId = this.$router.currentRoute.query.trialId + const res = await getInstanceList(seriesId) if (!res.Result || (res.Result && res.Result.length === 0)) return var seriesInstanceUid = res.Result[0].SeriesInstanceUid var sliceThickness = res.Result[0].SliceThickness @@ -344,7 +346,7 @@ export default { description: this.description, isReading, isDeleted, - previewImageUrl: res.OtherInfo.ImageResizePath ? scope.OSSclientConfig.basePath + res.OtherInfo.ImageResizePath : res.OtherInfo.ImageResizePath, + previewImageUrl: res.OtherInfo.ImageResizePath ? this.OSSclientConfig.basePath + res.OtherInfo.ImageResizePath : res.OtherInfo.ImageResizePath, instanceCount: res.Result.length, prefetchInstanceCount: 0, loadStatus: false, @@ -359,7 +361,9 @@ export default { this.firstInstanceId = this.seriesList[0].imageIds[0] }) } - }) + } catch (e) { + console.log(e) + } }, showSeriesImage(e, seriesIndex, series) { // if (seriesIndex === this.currentSeriesIndex) return @@ -372,7 +376,30 @@ export default { this.currentSeriesIndex = seriesIndex this.$refs.dicomViewer.loadImageStack(this.seriesList[seriesIndex]) if (!series.loadStatus) { - requestPoolManager.changePriority(series.seriesId) + series.isLoading = true + var isAddToTakPool = false + if (this.showSeriesList.includes(`0_${seriesIndex}`)) { + isAddToTakPool = true + } else { + this.showSeriesList.push(`0_${seriesIndex}`) + } + if (!isAddToTakPool) { + var priority = parseInt(new Date().getTime()) + if (series.isExistMutiFrames) { + series.instanceInfoList.map(image => { + this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: 0, seriesIndex: seriesIndex, priority }) + }) + } else { + series.imageIds.map(imageId => { + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: 0, seriesIndex: seriesIndex, priority }) + }) + } + if (this.imageList.length > 0) { + this.loopLoad() + } + } else { + requestPoolManager.changePriority(series.seriesId) + } } }, showMultiFrames(series, seriesIndex, instanceInfo) { @@ -403,7 +430,30 @@ export default { } this.$refs.dicomViewer.loadImageStack(seriesInfo) if (!series.loadStatus) { - requestPoolManager.changePriority(series.seriesId) + var isAddToTakPool = false + if (this.showSeriesList.includes(`0_${seriesIndex}`)) { + isAddToTakPool = true + } else { + this.showSeriesList.push(`0_${seriesIndex}`) + } + if (!isAddToTakPool) { + var priority = parseInt(new Date().getTime()) + if (series.isExistMutiFrames) { + series.instanceInfoList.map(image => { + this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: 0, seriesIndex: seriesIndex, priority }) + }) + } else { + series.imageIds.map((imageId) => { + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: 0, seriesIndex: seriesIndex, priority }) + }) + } + + if (this.imageList.length > 0) { + this.loopLoad() + } + } else { + requestPoolManager.changePriority(series.seriesId) + } } }, initStudy() { @@ -415,13 +465,6 @@ export default { const seriesInfo = JSON.parse(this.$router.currentRoute.query.series) var seriesList = [] const imageIds = [] - // const scope = this - // seriesInfo.InstanceList.forEach(function(item) { - // imageIds.push(`wadouri:/api/instance/content/${item}`) - // }) - // seriesInfo.InstanceList.forEach((id) => { - // imageIds.push(`wadouri:http://123.56.94.154:7000/instance/content/${id}`) - // }) seriesInfo.InstancePathList.forEach((path) => { imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${path}`) }) @@ -451,22 +494,25 @@ export default { } } }, - deleteSeries() { + async deleteSeries() { this.loading = true var subjectVisitId = this.$router.currentRoute.query.subjectVisitId var studyId = this.$router.currentRoute.query.studyId var seriesId = this.$router.currentRoute.query.seriesId - // trialId, subjectVisitId, studyId, seriesId, state - setSeriesStatus(this.trialId, subjectVisitId, studyId, seriesId, 5).then(res => { + try { + const res = await setSeriesStatus(this.trialId, subjectVisitId, studyId, seriesId, 5) this.loading = false if (res.IsSuccess) { this.$message.success(this.$t('common:message:savedSuccessfully')) window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) } - }).catch(() => { this.loading = false }) + } catch (e) { + console.log(e) + this.loading = false + } }, - changeReadingStatus(callback, data) { + async changeReadingStatus(callback, data) { let statusStr = '' if (callback) { statusStr = this.$t('trials:audit:label:setSeriesReading') @@ -477,24 +523,30 @@ export default { } var message = this.$t('trials:audit:message:changeSeriesStatus').replace('xxx', statusStr) message = message.replace('yyy', this.$fd('YesOrNo', !data.isReading)) - this.$confirm(message, { - distinguishCancelAndClose: true, - type: 'warning' - }).then(() => { - const state = data.isReading ? 1 : 2 - this.loading = true - - setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state).then(res => { - this.loading = false - if (res.IsSuccess) { - data.isReading = !data.isReading - this.$message.success(this.$t('common:message:savedSuccessfully')) - window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) - } - }).catch(() => { this.loading = false }) - }).catch(() => {}) + const confirm = await this.$confirm( + message, + { + type: 'warning', + distinguishCancelAndClose: true + } + ) + if (confirm !== 'confirm') return + const state = data.isReading ? 1 : 2 + this.loading = true + try { + const res = await setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state) + this.loading = false + if (res.IsSuccess) { + data.isReading = !data.isReading + this.$message.success(this.$t('common:message:savedSuccessfully')) + window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) + } + } catch (e) { + console.log(e) + this.loading = false + } }, - changeDeleteStatus(callback, data) { + async changeDeleteStatus(callback, data) { let statusStr = '' if (callback) { statusStr = this.$t('trials:audit:label:setSeriesDeleted') @@ -505,25 +557,28 @@ export default { } var message = this.$t('trials:audit:message:changeSeriesStatus').replace('xxx', statusStr) message = message.replace('yyy', this.$fd('YesOrNo', !data.isDeleted)) - this.$confirm(message, { - distinguishCancelAndClose: true, - type: 'warning' - }).then(() => { - const state = data.isDeleted ? 5 : 4 - this.loading = true - // var trialId = this.$router.currentRoute.query.trialId - // var subjectVisitId = this.$router.currentRoute.query.subjectVisitId - // var studyId = this.$router.currentRoute.query.studyId - // var seriesId = this.$router.currentRoute.query.seriesId - setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state).then(res => { - this.loading = false - if (res.IsSuccess) { - data.isDeleted = !data.isDeleted - this.$message.success(this.$t('common:message:savedSuccessfully')) - window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) - } - }).catch(() => { this.loading = false }) - }).catch(() => {}) + const confirm = await this.$confirm( + message, + { + type: 'warning', + distinguishCancelAndClose: true + } + ) + if (confirm !== 'confirm') return + const state = data.isDeleted ? 5 : 4 + this.loading = true + try { + const res = await setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state) + this.loading = false + if (res.IsSuccess) { + data.isDeleted = !data.isDeleted + this.$message.success(this.$t('common:message:savedSuccessfully')) + window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) + } + } catch (e) { + console.log(e) + this.loading = false + } }, loadAllImages() { const seriesIndex = this.seriesList.findIndex(i => i.loadStatus === false) @@ -569,60 +624,6 @@ export default { this.imageList = [] } }, - load(imageId, seriesId, priority = 999) { - return new Promise((resolve, reject) => { - requestPoolManager.loadAndCacheImagePlus(imageId, seriesId, priority).then(res => { - if (!res) return - this.imageLoaded(imageId, res.data.string('x0020000e')) - resolve(res) - }).catch(e => { - reject(e) - }) - }) - }, - imageLoaded(image, seriesUid) { - var seriesIndex = image.seriesIndex - if (seriesIndex < 0) return - if (this.seriesList[seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) { - ++this.seriesList[seriesIndex].prefetchInstanceCount - this.seriesList[seriesIndex].imageloadedArr.push(image.imageId) - - if (this.seriesList[seriesIndex].prefetchInstanceCount >= this.seriesList[seriesIndex].instanceCount) { - this.seriesList[seriesIndex].prefetchInstanceCount = this.seriesList[seriesIndex].instanceCount - // 设置当前序列状态为已下载完成 - this.seriesList[seriesIndex].loadStatus = true - // if (!this.isLoadedAll) { - // this.loadAllImages() - // } - } - } - }, - imageLoaded2(imageId, seriesUid) { - var seriesIndex = -1 - for (let i = 0; i < this.seriesList.length; ++i) { - if (this.seriesList[i].seriesUid === seriesUid) { - seriesIndex = i - break - } - } - if (seriesIndex < 0) return - - const imageIdIndex = this.seriesList[seriesIndex].imageIds.indexOf(imageId) - if (imageIdIndex < 0) return - if (this.seriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) { - ++this.seriesList[seriesIndex].prefetchInstanceCount - this.seriesList[seriesIndex].imageloadedArr.push(imageId) - - if (this.seriesList[seriesIndex].prefetchInstanceCount >= this.seriesList[seriesIndex].instanceCount) { - this.seriesList[seriesIndex].prefetchInstanceCount = this.seriesList[seriesIndex].instanceCount - // 设置当前序列状态为已下载完成 - this.seriesList[seriesIndex].loadStatus = true - // if (!this.isLoadedAll) { - // this.loadAllImages() - // } - } - } - }, datasetsCacheChanged(e) { // const uri = e.detail.uri const cacheInfo = e.detail.cacheInfo @@ -681,52 +682,9 @@ export default { this.seriesList[seriesIndex].prefetchInstanceCount = instanceCount * 100 // 设置当前序列状态为已下载完成 this.seriesList[seriesIndex].loadStatus = true - this.loadAllImages() - } - } - }, - cornerstoneImageLoaded(e) { - if (this.firstInstanceId === e.detail.image.imageId && !this.isStartLoad) { - // 初始化图像加载完成时,自动下载 - this.loadAllImages() - this.isStartLoad = true - // requestPoolManager.executeTask() - } - const uri = e.detail.image.sharedCacheKey - const index = this.cachedImages.findIndex(item => item.uri === uri) - if (index === -1) { - this.cachedImages.push({ uri: uri, timestamp: new Date().getTime() }) - } else { - this.cachedImages[index].timestamp = new Date().getTime() - } - // loadedDataSets[uri].dataSet.byteArray.length - // console.log(this.cachedImages.length) - // console.log(cornerstoneWADOImageLoader.wadouri.dataSetCacheManager.getInfo().cacheSizeInBytes) - // const imageId = e.detail.image.imageId - var imageId = e.detail.image.imageId - var seriesUid = e.detail.image.data.string('x0020000e') - var seriesIndex = -1 - for (let i = 0; i < this.seriesList.length; ++i) { - if (this.seriesList[i].seriesUid === seriesUid) { - seriesIndex = i - break - } - } - if (seriesIndex < 0) return - - const imageIdIndex = this.seriesList[seriesIndex].imageIds.indexOf(imageId) - if (imageIdIndex < 0) return - if (this.seriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) { - ++this.seriesList[seriesIndex].prefetchInstanceCount - this.seriesList[seriesIndex].imageloadedArr.push(imageId) - - if (this.seriesList[seriesIndex].prefetchInstanceCount >= this.seriesList[seriesIndex].instanceCount) { - this.seriesList[seriesIndex].prefetchInstanceCount = this.seriesList[seriesIndex].instanceCount - // 设置当前序列状态为已下载完成 - this.seriesList[seriesIndex].loadStatus = true - // if (!this.isLoadedAll) { - // this.loadAllImages() - // } + if (!this.isFromCRCUpload) { + this.loadAllImages() + } } } } diff --git a/src/views/dicom-show/dicom-visit.vue b/src/views/dicom-show/dicom-visit.vue index d0a59869..50c0caf1 100644 --- a/src/views/dicom-show/dicom-visit.vue +++ b/src/views/dicom-show/dicom-visit.vue @@ -296,7 +296,8 @@ export default { activeNames: [], relationActiveName: [], showSeriesList: [], - currentLoadIns: [] + currentLoadIns: [], + isFromCRCUpload: false } }, mounted() { @@ -312,6 +313,7 @@ export default { this.visitInfo = this.$router.currentRoute.query.visitInfo this.isReading = this.$router.currentRoute.query.isReading ? this.$router.currentRoute.query.isReading * 1 : 0 this.showDelete = parseInt(this.$router.currentRoute.query.showDelete) + this.isFromCRCUpload = !!this.$router.currentRoute.query.isFromCRCUpload // cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded) this.getStudiesInfo() cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress) @@ -322,72 +324,99 @@ export default { }, beforeDestroy() { requestPoolManager.stopTaskTimer() - window.removeEventListener('beforeunload', e => { - cornerstone.imageCache.purgeCache() + window.removeEventListener('beforeunload', e => { + cornerstone.imageCache.purgeCache() requestPoolManager.resetRequestPool() }) }, methods: { // 获取某个访视下所有的检查信息 - getStudiesInfo() { + async getStudiesInfo() { this.studyList = [] - getVisitStudyList(this.trialId, this.subjectVisitId, this.isReading).then(res => { - res.Result.forEach((study,studyIndex) => { - const data = {} - data.StudyId = study.StudyId - data.StudyCode = study.StudyCode - data.Modalities = study.Modalities - data.SeriesCount = study.SeriesCount - data.InstanceCount = study.InstanceCount - data.InstanceCount = study.InstanceCount - data.PreviewImageCount = 0 - var seriesList = [] - study.SeriesList.forEach((series,seriesIndex) => { - const imageIds = [] - series.InstanceInfoList.forEach(i => { - if (i.NumberOfFrames && i.NumberOfFrames > 1) { - for (let j = 0; j < i.NumberOfFrames; j++) { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${i.Path}?frame=${j}&instanceId=${i.Id}&idx=${studyIndex}|${seriesIndex}`) + try { + const res = await getVisitStudyList(this.trialId, this.subjectVisitId, this.isReading) + if (res.IsSuccess) { + res.Result.forEach((study, studyIndex) => { + const data = {} + data.StudyId = study.StudyId + data.StudyCode = study.StudyCode + data.Modalities = study.Modalities + data.SeriesCount = study.SeriesCount + data.InstanceCount = study.InstanceCount + data.InstanceCount = study.InstanceCount + data.PreviewImageCount = 0 + var seriesList = [] + study.SeriesList.forEach((series, seriesIndex) => { + const imageIds = [] + series.InstanceInfoList.forEach(i => { + if (i.NumberOfFrames && i.NumberOfFrames > 1) { + for (let j = 0; j < i.NumberOfFrames; j++) { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${i.Path}?frame=${j}&instanceId=${i.Id}&idx=${studyIndex}|${seriesIndex}`) + } + } else { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}&idx=${studyIndex}|${seriesIndex}`) } - } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}&idx=${studyIndex}|${seriesIndex}`) - } - }) - seriesList.push({ - trialId: this.trialId, - subjectVisitId: this.subjectVisitId, - studyId: study.StudyId, - imageIds: imageIds, - instanceInfoList: series.InstanceInfoList, - seriesId: series.Id, - seriesUid: series.SeriesInstanceUid, - seriesNumber: series.SeriesNumber, - sliceThickness: series.SliceThickness, - modality: series.Modality, - description: series.Description, - isReading: series.IsReading, - isDeleted: series.IsDeleted, - previewImageUrl: series.ImageResizePath ? this.OSSclientConfig.basePath + series.ImageResizePath : `/api/series/preview/${series.Id}`, - instanceCount: series.InstanceCount, - prefetchInstanceCount: 0, - loadStatus: false, - imageloadedArr: [], - isExistMutiFrames: series.IsExistMutiFrames + }) + seriesList.push({ + trialId: this.trialId, + subjectVisitId: this.subjectVisitId, + studyId: study.StudyId, + imageIds: imageIds, + instanceInfoList: series.InstanceInfoList, + seriesId: series.Id, + seriesUid: series.SeriesInstanceUid, + seriesNumber: series.SeriesNumber, + sliceThickness: series.SliceThickness, + modality: series.Modality, + description: series.Description, + isReading: series.IsReading, + isDeleted: series.IsDeleted, + previewImageUrl: series.ImageResizePath ? this.OSSclientConfig.basePath + series.ImageResizePath : `/api/series/preview/${series.Id}`, + instanceCount: series.InstanceCount, + prefetchInstanceCount: 0, + loadStatus: false, + imageloadedArr: [], + isExistMutiFrames: series.IsExistMutiFrames + }) }) + data.SeriesList = seriesList + this.studyList.push(data) }) - data.SeriesList = seriesList - this.studyList.push(data) - }) - if (this.studyList.length > 0) { - this.$refs.dicomViewer.loadImageStack(this.studyList[0].SeriesList[0]) - const imageId = this.studyList[0].SeriesList[0].imageIds[0] - let instanceId = imageId.split('/')[imageId.split('/').length - 1] - instanceId = instanceId.split('.')[0] - this.firstInstanceId = instanceId - this.activeNames = [this.studyList[0].StudyId] - this.loadAllImages() + if (this.studyList.length > 0) { + this.$refs.dicomViewer.loadImageStack(this.studyList[0].SeriesList[0]) + const imageId = this.studyList[0].SeriesList[0].imageIds[0] + let instanceId = imageId.split('/')[imageId.split('/').length - 1] + instanceId = instanceId.split('.')[0] + this.firstInstanceId = instanceId + this.activeNames = [this.studyList[0].StudyId] + this.loadImages(this.studyList[0].SeriesList[0], 0) + } } - }) + } catch (e) { + console.log(e) + } + }, + loadImages(series, seriesIndex) { + var priority = parseInt(new Date().getTime()) + for (let i = 0; i < series.imageIds.length; i++) { + const imageId = series.imageIds[i] + if (series.isExistMutiFrames) { + const params = this.getInstanceInfo(imageId) + if (params.frame && params.frame > 0) { + continue + } + } + var p = null + if (this.firstInstanceId === imageId) { + p = priority * 100 + } else { + p = priority - 1 + } + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, seriesIndex: seriesIndex, priority: p }) + } + if (this.imageList.length > 0) { + this.loopLoad() + } }, showSeriesImage(e, studyIndex, seriesIndex, series) { const element = e.currentTarget @@ -398,11 +427,37 @@ export default { element.classList.add('viewerSideActive') this.currentSeriesIndex = seriesIndex this.$refs.dicomViewer.loadImageStack(this.studyList[studyIndex].SeriesList[seriesIndex]) + // if (!series.loadStatus) { + // requestPoolManager.changePriority(series.seriesId) + // } if (!series.loadStatus) { - requestPoolManager.changePriority(series.seriesId) + series.isLoading = true + var isAddToTakPool = false + if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) { + isAddToTakPool = true + } else { + this.showSeriesList.push(`${studyIndex}_${seriesIndex}`) + } + if (!isAddToTakPool) { + var priority = parseInt(new Date().getTime()) + if (series.isExistMutiFrames) { + series.instanceInfoList.map(image => { + this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, priority }) + }) + } else { + series.imageIds.map(imageId => { + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, priority }) + }) + } + if (this.imageList.length > 0) { + this.loopLoad() + } + } else { + requestPoolManager.changePriority(series.seriesId) + } } }, - showMultiFrames(studyIndex,series, seriesIndex, instanceInfo) { + showMultiFrames(studyIndex, series, seriesIndex, instanceInfo) { this.currentSeriesIndex = seriesIndex const imageIds = [] if (instanceInfo.NumberOfFrames && instanceInfo.NumberOfFrames > 1) { @@ -430,10 +485,33 @@ export default { } this.$refs.dicomViewer.loadImageStack(seriesInfo) if (!series.loadStatus) { - requestPoolManager.changePriority(series.seriesId) + var isAddToTakPool = false + if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) { + isAddToTakPool = true + } else { + this.showSeriesList.push(`${studyIndex}_${seriesIndex}`) + } + if (!isAddToTakPool) { + var priority = parseInt(new Date().getTime()) + if (series.isExistMutiFrames) { + series.instanceInfoList.map(image => { + this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, priority }) + }) + } else { + series.imageIds.map((imageId) => { + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, priority }) + }) + } + + if (this.imageList.length > 0) { + this.loopLoad() + } + } else { + requestPoolManager.changePriority(series.seriesId) + } } }, - changeReadingStatus(callback, data) { + async changeReadingStatus(callback, data) { let statusStr = '' if (callback) { statusStr = this.$t('trials:audit:label:setSeriesReading') @@ -444,24 +522,29 @@ export default { } var message = this.$t('trials:audit:message:changeSeriesStatus').replace('xxx', statusStr) message = message.replace('yyy', this.$fd('YesOrNo', !data.isReading)) - this.$confirm(message, { - distinguishCancelAndClose: true, - type: 'warning' - }).then(() => { - const state = data.isReading ? 1 : 2 - this.loading = true - - setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state).then(res => { - this.loading = false - if (res.IsSuccess) { - data.isReading = !data.isReading - this.$message.success(this.$t('common:message:savedSuccessfully')) - window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) - } - }).catch(() => { this.loading = false }) - }).catch(() => {}) + const confirm = await this.$confirm( + message, + { + type: 'warning', + distinguishCancelAndClose: true + } + ) + if (confirm !== 'confirm') return + const state = data.isReading ? 1 : 2 + this.loading = true + try { + const res = await setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state) + this.loading = false + if (res.IsSuccess) { + data.isReading = !data.isReading + this.$message.success(this.$t('common:message:savedSuccessfully')) + window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) + } + } catch (e) { + this.loading = false + } }, - changeDeleteStatus(callback, data) { + async changeDeleteStatus(callback, data) { let statusStr = '' if (callback) { statusStr = this.$t('trials:audit:label:setSeriesDeleted') @@ -472,24 +555,31 @@ export default { } var message = this.$t('trials:audit:message:changeSeriesStatus').replace('xxx', statusStr) message = message.replace('yyy', this.$fd('YesOrNo', !data.isDeleted)) - this.$confirm(message, { - distinguishCancelAndClose: true, - type: 'warning' - }).then(() => { - const state = data.isDeleted ? 5 : 4 - this.loading = true - setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state).then(res => { - this.loading = false - if (res.IsSuccess) { - data.isDeleted = !data.isDeleted - this.$message.success(this.$t('common:message:savedSuccessfully')) - window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) - } - }).catch(() => { this.loading = false }) - }).catch(() => {}) + const confirm = await this.$confirm( + message, + { + type: 'warning', + distinguishCancelAndClose: true + } + ) + if (confirm !== 'confirm') return + + const state = data.isDeleted ? 5 : 4 + this.loading = true + try { + const res = await setSeriesStatus(data.trialId, data.subjectVisitId, data.studyId, data.seriesId, state) + this.loading = false + if (res.IsSuccess) { + data.isDeleted = !data.isDeleted + this.$message.success(this.$t('common:message:savedSuccessfully')) + window.opener.postMessage({ type: 'refreshSeriesList', data: '' }, window.location) + } + } catch (e) { + this.loading = false + } }, // 切换关联检查Tab时获取关联检查信息 - handleTabClick(tab, event) { + async handleTabClick(tab, event) { if (tab.name === 'relation-study' && this.relationStudyList.length <= 0) { const loading = this.$loading({ target: document.querySelector('.pane-relation-wrapper'), @@ -499,11 +589,13 @@ export default { background: 'rgb(49 49 49 / 50%)', spinner: 'el-icon-loading' }) - getAllRelationStudyList(this.subjectVisitId).then(res => { + try { + const res = await getAllRelationStudyList(this.subjectVisitId) loading.close() this.relationStudyList = res.Result - console.log(this.relationStudyList) - }).catch(() => { loading.close() }) + } catch (e) { + loading.close() + } } }, handelRelationActiveChange(v) { @@ -515,7 +607,7 @@ export default { } }, // 根据关联检查获取序列信息 - getRelationSeriesByStudy(studyId, index) { + async getRelationSeriesByStudy(studyId, index) { console.log('getRelationSeriesByStudy') if (this.relationStudyList[index].seriesCount) { this.relationStudyList[index].showSeries = !this.relationStudyList[index].showSeries @@ -530,20 +622,21 @@ export default { background: 'rgb(49 49 49 / 50%)', spinner: 'el-icon-loading' }) - getSeriesList(`/series/list/${studyId}`).then(data => { + try { + const data = await getSeriesList(`/series/list/${studyId}`) loading.close() if (data.Result != null && data.Result.length > 0) { var seriesList = [] const res = data.Result - res.forEach((item,seriesIndex)=> { + res.forEach((item, seriesIndex) => { const imageIds = [] item.InstanceInfoList.forEach(i => { if (i.NumberOfFrames && i.NumberOfFrames > 1) { for (let j = 0; j < i.NumberOfFrames; j++) { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?frame=${j}&instanceId=${i.Id}&idx=${index}|${seriesIndex}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?frame=${j}&instanceId=${i.Id}&idx=${index}|${seriesIndex}&isRelation=1`) } } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}&idx=${index}|${seriesIndex}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}&idx=${index}|${seriesIndex}&isRelation=1`) } }) seriesList.push({ @@ -568,10 +661,11 @@ export default { scope.relationStudyList[index].seriesCount = seriesList.length scope.relationStudyList[index].seriesList = seriesList scope.relationStudyList[index].showSeries = true - console.log(scope.relationStudyList) scope.$forceUpdate() } - }).catch(() => { loading.close() }) + } catch (e) { + loading.close() + } } }, showRelationSeriesImage(e, series, index) { @@ -635,26 +729,6 @@ export default { this.imageList = [] } }, - // load(imageId, priority = 999) { - // return new Promise((resolve, reject) => { - // const imageTask = this.buildImageRequestTask(imageId, { priority }) - // requestPoolManager.addTaskIntoPool(imageTask).then((res) => { - // resolve(res) - // }).catch(e => { - // reject(e) - // console.log(e) - // }) - // }) - // }, - buildImageRequestTask(imageId, config = {}) { - return { - key: imageId, - ...config, - execute: () => { - return cornerstone.loadAndCacheImage(imageId) - } - } - }, datasetsCacheChanged(e) { const cacheInfo = e.detail.cacheInfo const cacheSizeInBytes = cacheInfo.cacheSizeInBytes @@ -662,22 +736,7 @@ export default { // 清理缓存的影像 } }, - imageLoaded(image, seriesUid) { - var studyIndex = image.studyIndex - var seriesIndex = image.seriesIndex - if (seriesIndex < 0 || studyIndex < 0) return - if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) { - ++this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount - this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(image.imageId) - - if (this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount >= this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount) { - this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount - // 设置当前序列状态为已下载完成 - this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true - } - } - }, - cornerstoneimageloadprogress(e){ + cornerstoneimageloadprogress(e) { const imageId = e.detail.imageId const percentComplete = e.detail.percentComplete const params = {} @@ -685,34 +744,36 @@ export default { for (const [key, value] of searchParams.entries()) { params[key] = value } - if (this.visitTaskId === params.visitTaskId) { - const studyIndex = params.idx.split('|')[0] - const seriesIndex = params.idx.split('|')[1] - var prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount - var instanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount - if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) { - const i = this.currentLoadIns.findIndex(i => i.imageId === imageId) - if (i > -1) { - prefetchInstanceCount = prefetchInstanceCount - this.currentLoadIns[i].percentComplete + percentComplete - this.currentLoadIns[i].percentComplete = percentComplete - if (percentComplete === 100) { - this.currentLoadIns.splice(i, 1) - } - } else { - if (percentComplete !== 100) { - this.currentLoadIns.push({ imageId, percentComplete }) - } - prefetchInstanceCount = prefetchInstanceCount + percentComplete + const studyIndex = params.idx.split('|')[0] + const seriesIndex = params.idx.split('|')[1] + var series = !params.isRelation ? this.studyList[studyIndex].SeriesList[seriesIndex] : null + if (!series) return + var prefetchInstanceCount = series.prefetchInstanceCount + var instanceCount = series.instanceCount + if (series.imageloadedArr.indexOf(imageId) < 0) { + const i = this.currentLoadIns.findIndex(i => i.imageId === imageId) + if (i > -1) { + prefetchInstanceCount = prefetchInstanceCount - this.currentLoadIns[i].percentComplete + percentComplete + this.currentLoadIns[i].percentComplete = percentComplete + if (percentComplete === 100) { + this.currentLoadIns.splice(i, 1) } - this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = prefetchInstanceCount - if (percentComplete >= 100) { - this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(imageId) + } else { + if (percentComplete !== 100) { + this.currentLoadIns.push({ imageId, percentComplete }) } + prefetchInstanceCount = prefetchInstanceCount + percentComplete } - if (prefetchInstanceCount >= instanceCount * 100) { - this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = instanceCount * 100 - // 设置当前序列状态为已下载完成 - this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true + series.prefetchInstanceCount = prefetchInstanceCount + if (percentComplete >= 100) { + series.imageloadedArr.push(imageId) + } + } + if (prefetchInstanceCount >= instanceCount * 100) { + series.prefetchInstanceCount = instanceCount * 100 + // 设置当前序列状态为已下载完成 + series.loadStatus = true + if (!this.isFromCRCUpload) { this.loadAllImages() } } @@ -784,7 +845,7 @@ export default { white-space: normal; } .viewerContainer .viewerLeftSidePanel { - width: 215px; + width: 220px; background-color: #323232; box-sizing: border-box; margin: 0; @@ -821,7 +882,7 @@ export default { } .viewerContainer .viewerLeftSidePanel .viewernavigatorwrapper { display: flex; - width: 200px; + width: 220px; /* height: 84px; */ padding: 1px 2px 1px 2px; margin: 2px 0 1px 1px; diff --git a/src/views/trials/trials-panel/reading/ad-review/index.vue b/src/views/trials/trials-panel/reading/ad-review/index.vue index acd730ee..e1431f9d 100644 --- a/src/views/trials/trials-panel/reading/ad-review/index.vue +++ b/src/views/trials/trials-panel/reading/ad-review/index.vue @@ -179,12 +179,19 @@ { max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500`, trigger: ['blur', 'change'] } ]" > - +
+
+ {{ remark }} +
+ +
+ { @@ -459,6 +466,19 @@ export default { this.adForm.judgeResultImagePathList = res.Result.JudgeResultImagePathList } this.visitTaskArmList = res.Result.VisitTaskArmList + var i = this.visitTaskArmList.findIndex(i => i.VisitTaskId === this.adForm.judgeResultTaskId) + if (i > -1) { + // 本人已完整查看两位独立阅片人的全部相关影像和评估数据,经过综合研判,更认同第一阅片人(R1)对该病例的整体评估,原因是: + this.judgeResultArmEnum = this.visitTaskArmList[i].ArmEnum + var msg = '' + if (this.judgeResultArmEnum === 1) { + msg = this.$t('trials:adReview:title:msg1') + } else if (this.judgeResultArmEnum === 2) { + msg = this.$t('trials:adReview:title:msg3') + } + this.remark = msg + this.adForm.judgeResultRemark = res.Result.JudgeResultRemark + } } this.loading = false } catch (e) { @@ -489,9 +509,12 @@ export default { msg = this.$t('trials:adReview:title:msg3') } // this.adForm.judgeResultRemark = `本人已完整查看两位独立阅片人的全部相关影像和评估数据,经过综合研判,更认同${this.$fd('ArmEnum', this.judgeResultArmEnum)}对该病例的整体评估,原因是:` - this.adForm.judgeResultRemark = msg + this.remark = msg + this.adForm.judgeResultRemark = '' } else { this.judgeResultArmEnum = '' + this.remark = '' + this.adForm.judgeResultRemark = '' } }, previewCD() { diff --git a/src/views/trials/trials-panel/reading/dicoms/components/ReportPage.vue b/src/views/trials/trials-panel/reading/dicoms/components/ReportPage.vue index 22ef2210..456c99d7 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/ReportPage.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/ReportPage.vue @@ -102,7 +102,9 @@