diff --git a/src/views/dicom-show/dicom-visit.vue b/src/views/dicom-show/dicom-visit.vue index eb883b5..91f2541 100644 --- a/src/views/dicom-show/dicom-visit.vue +++ b/src/views/dicom-show/dicom-visit.vue @@ -225,62 +225,60 @@ export default { }, methods: { // 获取某个访视下所有的检查信息 - getStudiesInfo() { - this.studyList = [] - getVisitStudyList(this.trialId, this.subjectVisitId, this.isReading).then(res => { - res.Result.forEach((study) => { - 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) => { - const imageIds = [] - - // series.InstanceList.forEach((id) => { - // imageIds.push(`wadouri:/api/instance/content/${id}`) - // }) - // series.InstanceList.forEach((id) => { - // imageIds.push(`wadouri:http://123.56.94.154:7000/instance/content/${id}`) - // }) - series.InstancePathList.forEach((path) => { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${path}`) - }) - seriesList.push({ - trialId: this.trialId, - subjectVisitId: this.subjectVisitId, - studyId: study.StudyId, - imageIds: imageIds, - 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: [] + async getStudiesInfo() { + try { + this.studyList = [] + const res = await getVisitStudyList(this.trialId, this.subjectVisitId, this.isReading) + if (res.IsSuccess) { + res.Result.forEach((study) => { + 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) => { + const imageIds = [] + series.InstancePathList.forEach((path) => { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${path}`) + }) + seriesList.push({ + trialId: this.trialId, + subjectVisitId: this.subjectVisitId, + studyId: study.StudyId, + imageIds: imageIds, + 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: [] + }) }) + 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 + 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 + } } - }) + } catch (e) { + console.log(e) + } }, showSeriesImage(e, studyIndex, seriesIndex, series) { const element = e.currentTarget @@ -377,12 +375,11 @@ export default { } }, // 根据关联检查获取序列信息 - getRelationSeriesByStudy(studyId, index) { + async getRelationSeriesByStudy(studyId, index) { if (this.relationStudyList[index].seriesCount) { this.relationStudyList[index].showSeries = !this.relationStudyList[index].showSeries this.$forceUpdate() } else { - const scope = this const loading = this.$loading({ target: document.querySelector(`.relation-study-wrapper-${index}`), fullscreen: false, @@ -391,50 +388,48 @@ export default { background: 'rgb(49 49 49 / 50%)', spinner: 'el-icon-loading' }) - getStudyInfo(studyId).then(data => { - scope.relationStudyList[index].studyCode = data.Result.StudyCode - scope.relationStudyList[index].modality = data.Result.Modalities - scope.relationStudyList[index].seriesCount = data.Result.SeriesCount - getSeriesList(`/series/list/${studyId}`).then(data => { + try { + const basePath = this.OSSclientConfig.basePath + const data = await getStudyInfo(studyId) + if (!data.IsSuccess) { loading.close() - if (data.Result != null && data.Result.length > 0) { - var seriesList = [] - const res = data.Result - res.forEach(function(item) { - const imageIds = [] - // item.InstanceList.forEach(function(id) { - // imageIds.push(`wadouri:/api/instance/content/${id}`) - // }) - // item.InstanceList.forEach((id) => { - // imageIds.push(`wadouri:http://123.56.94.154:7000/instance/content/${id}`) - // }) - item.InstancePathList.forEach((path) => { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${path}`) - }) - seriesList.push({ - imageIds: imageIds, - seriesId: item.Id, - seriesUid: item.SeriesInstanceUid, - seriesNumber: item.SeriesNumber, - sliceThickness: item.SliceThickness, - modality: item.Modality, - description: item.Description, - previewImageUrl: item.ImageResizePath ? this.OSSclientConfig.basePath + item.ImageResizePath : `/api/series/preview/${item.Id}`, - instanceCount: item.InstanceCount, - prefetchInstanceCount: 0, - hasLabel: item.HasLabel, - keySeries: item.KeySeries, - loadStatus: false, - imageloadedArr: [] - }) + return + } + this.relationStudyList[index].studyCode = data.Result.StudyCode + this.relationStudyList[index].modality = data.Result.Modalities + this.relationStudyList[index].seriesCount = data.Result.SeriesCount + getSeriesList(`/series/list/${studyId}`).then(res => { + var seriesList = [] + res.Result.forEach(function(item) { + const imageIds = [] + item.InstancePathList.forEach((path) => { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? basePath : basePath}${path}`) }) - scope.relationStudyList[index].seriesCount = seriesList.length - scope.relationStudyList[index].seriesList = seriesList - scope.relationStudyList[index].showSeries = true - scope.$forceUpdate() - } - }).catch(() => { loading.close() }) - }).catch(() => { loading.close() }) + seriesList.push({ + imageIds: imageIds, + seriesId: item.Id, + seriesUid: item.SeriesInstanceUid, + seriesNumber: item.SeriesNumber, + sliceThickness: item.SliceThickness, + modality: item.Modality, + description: item.Description, + previewImageUrl: item.ImageResizePath ? basePath + item.ImageResizePath : `/api/series/preview/${item.Id}`, + instanceCount: item.InstanceCount, + prefetchInstanceCount: 0, + loadStatus: false, + imageloadedArr: [] + }) + }) + this.relationStudyList[index].seriesCount = seriesList.length + this.relationStudyList[index].seriesList = seriesList + this.relationStudyList[index].showSeries = true + this.$forceUpdate() + loading.close() + }) + } catch (e) { + console.log(e) + loading.close() + } } }, showRelationSeriesImage(e, series, index) { @@ -552,7 +547,7 @@ export default { cornerstoneImageLoaded(e) { if (e.detail.image.imageId.includes(this.firstInstanceId) && !this.isStartLoad) { // 初始化图像加载完成时,自动下载 - this.loadAllImages() + // this.loadAllImages() this.isStartLoad = true // requestPoolManager.executeTask() }