From a7ce5526fdfee292a7b44d5e02da2f2001b3fc22 Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Tue, 30 Jul 2024 13:56:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E7=89=87=E5=A4=9A=E5=B8=A7=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/getters.js | 1 + src/store/modules/reading.js | 182 +++++++++++++----- .../reading/dicoms/components/ReadPage.vue | 27 ++- .../reading/dicoms/components/StudyList.vue | 159 ++------------- .../dicoms/customize/CustomizeReadPage.vue | 22 +++ .../dicoms/customize/CustomizeStudyList.vue | 147 -------------- 6 files changed, 197 insertions(+), 341 deletions(-) diff --git a/src/store/getters.js b/src/store/getters.js index e79727d6..9f5c1c33 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -41,6 +41,7 @@ const getters = { lastCanvasTaskId: state => state.reading.lastCanvasTaskId, imageQuality: state => state.reading.imageQuality, imageQualityIssues: state => state.reading.imageQualityIssues, + currentLoadIns: state => state.reading.currentLoadIns, language: state => state.lang.language, TotalNeedSignSystemDocCount: state => state.user.TotalNeedSignSystemDocCount, TotalNeedSignTrialDocCount: state => state.user.TotalNeedSignTrialDocCount, diff --git a/src/store/modules/reading.js b/src/store/modules/reading.js index 086d77d0..efe3cbc4 100644 --- a/src/store/modules/reading.js +++ b/src/store/modules/reading.js @@ -30,7 +30,8 @@ const getDefaultState = () => { activeSeries: {}, lastCanvasTaskId: '', imageQuality: null, - imageQualityIssues: null + imageQualityIssues: null, + currentLoadIns: [] } } function getQuestions(questions) { @@ -139,22 +140,22 @@ function getQuestionAnswer(questions, questionMark, answers) { return '' } } -function getKeySeriesInfo(keyInstance, series) { - const obj = {} - const set = new Set() - var instances = series.instanceList.concat(keyInstance).filter((item) => { - if (set.has(item)) { - return true - } else { - set.add(item) - return false - } - }) - instances.map(item => { - obj[item] = { seriesId: series.seriesId, studyIndex: series.studyIndex, seriesIndex: series.seriesIndex } - }) - return obj -} +// function getKeySeriesInfo(keyInstance, series) { +// const obj = {} +// const set = new Set() +// var instances = series.instanceList.concat(keyInstance).filter((item) => { +// if (set.has(item)) { +// return true +// } else { +// set.add(item) +// return false +// } +// }) +// instances.map(item => { +// obj[item] = { seriesId: series.seriesId, studyIndex: series.studyIndex, seriesIndex: series.seriesIndex } +// }) +// return obj +// } const state = getDefaultState @@ -775,7 +776,17 @@ const actions = { resolve() } else { var studyList = [] + var keyImages = [] getReadingVisitStudyList(obj.trialId, obj.subjectVisitId, obj.visitTaskId).then(res => { + const i = res.Result.findIndex(i => i.IsCriticalSequence) + if (i > -1) { + const seriesList = res.Result[i].SeriesList && res.Result[i].SeriesList + seriesList.map(i => { + i.InstanceInfoList.map(k => { + keyImages.push({ instanceId: k.Id }) + }) + }) + } res.Result.forEach((study, studyIndex) => { const data = {} data.StudyId = study.StudyId @@ -801,16 +812,22 @@ const actions = { series.InstanceInfoList.forEach(instance => { if (instance.NumberOfFrames && instance.NumberOfFrames > 1) { for (let i = 0; i < instance.NumberOfFrames; i++) { - const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${i}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}` + const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${i}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${index}` imageIds.push(imageId) } - instance.ImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${0}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}` + instance.ImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${0}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${index}` } else { - const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}` + const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${index}` imageIds.push(imageId) instance.ImageId = imageId } - + if (!study.IsCriticalSequence && series.IsBeMark) { + const i = keyImages.findIndex(i => i.instanceId === instance.Id) + if (i > -1) { + keyImages[i].studyIndex = studyIndex + keyImages[i].seriesIndex = seriesIndex + } + } instanceList.push(instance.Id) }) seriesList.push({ @@ -853,6 +870,7 @@ const actions = { }) state.visitTaskList[index].StudyList = studyList state.visitTaskList[index].studyListInit = true + state.visitTaskList[index].KeyImages = keyImages // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) @@ -911,33 +929,107 @@ const actions = { resolve() }) }, - setImageloadedInfo({ state }, obj) { - console.log('setImageloadedInfo', obj) - var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) - // const prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount - const instanceList = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].instanceList - const idx = state.visitTaskList[index].StudyList.findIndex(i => i.IsCriticalSequence) - - if (!state.visitTaskList[index].StudyList[obj.studyIndex].IsCriticalSequence) { - // 当前下载的非关键序列 - console.log('当前下载的非关键序列') - if (idx > -1) { - const keyInstance = state.visitTaskList[index].StudyList[idx].SeriesList[0].instanceList - obj.markedImages = getKeySeriesInfo(keyInstance, state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex]) - instanceList.map(i => { - if (obj.markedImages.hasOwnProperty(i) && state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr.indexOf(i) < 0) { - state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr.push(i) - state.visitTaskList[index].StudyList[idx].SeriesList[0].prefetchInstanceCount = state.visitTaskList[index].StudyList[idx].SeriesList[0].prefetchInstanceCount + 100 - } - }) - if (state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr >= state.visitTaskList[index].StudyList[idx].SeriesList[0].instanceCount) { - state.visitTaskList[index].StudyList[idx].SeriesList[0].loadStatus = true + setImageLoadedProgress({ state }, obj) { + const studyIndex = parseInt(obj.idx.split('|')[0]) + const seriesIndex = parseInt(obj.idx.split('|')[1]) + const visitTaskIndex = parseInt(obj.idx.split('|')[2]) + let pStudyIndex = null + let pSeriesIndex = null + let pSeries = null + try { + const study = state.visitTaskList[visitTaskIndex].StudyList[studyIndex] + const series = state.visitTaskList[visitTaskIndex].StudyList[studyIndex].SeriesList[seriesIndex] + const keyImages = state.visitTaskList[visitTaskIndex].KeyImages + if (study.IsCriticalSequence) { + const i = keyImages.findIndex(i => i.instanceId === obj.instanceId) + if (i > -1) { + pStudyIndex = keyImages[i].studyIndex + pSeriesIndex = keyImages[i].seriesIndex + } + } else if (series.isBeMark) { + if (keyImages.length > 0) { + pStudyIndex = 0 + pSeriesIndex = 0 } } + if (pStudyIndex !== null && pSeriesIndex !== null) { + pSeries = state.visitTaskList[visitTaskIndex].StudyList[pStudyIndex].SeriesList[pSeriesIndex] + } + + var prefetchInstanceCount = series.prefetchInstanceCount + var instanceCount = series.instanceCount + var prefetchInstanceCount2 = pSeries ? pSeries.prefetchInstanceCount : null + var instanceCount2 = pSeries ? pSeries.instanceCount : null + if (series.imageloadedArr.indexOf(obj.instanceId) < 0) { + const i = state.currentLoadIns.findIndex(i => i.instanceId === obj.instanceId) + if (i > -1) { + prefetchInstanceCount = prefetchInstanceCount + obj.percentComplete - state.currentLoadIns[i].percentComplete + prefetchInstanceCount2 = prefetchInstanceCount2 !== null ? prefetchInstanceCount2 + obj.percentComplete - state.currentLoadIns[i].percentComplete : null + state.currentLoadIns[i].percentComplete = obj.percentComplete + if (obj.percentComplete >= 100) { + state.currentLoadIns.splice(i, 1) + } + } else { + if (obj.percentComplete !== 100) { + state.currentLoadIns.push({ instanceId: obj.instanceId, percentComplete: obj.percentComplete }) + } + prefetchInstanceCount = prefetchInstanceCount + obj.percentComplete + prefetchInstanceCount2 = prefetchInstanceCount2 !== null ? prefetchInstanceCount2 + obj.percentComplete : null + } + series.prefetchInstanceCount = prefetchInstanceCount + if (pSeries) { + pSeries.prefetchInstanceCount = prefetchInstanceCount2 + } + if (obj.percentComplete >= 100) { + series.imageloadedArr.push(obj.instanceId) + if (pSeries) { + pSeries.imageloadedArr.push(obj.instanceId) + } + } + } + + if (prefetchInstanceCount >= instanceCount * 100) { + series.prefetchInstanceCount = instanceCount * 100 + // 设置当前序列状态为已下载完成 + series.loadStatus = true + } + if (prefetchInstanceCount2 !== null && instanceCount2 !== null && prefetchInstanceCount2 >= instanceCount2 * 100) { + pSeries.prefetchInstanceCount = instanceCount2 * 100 + // 设置当前序列状态为已下载完成 + pSeries.loadStatus = true + } + } catch (e) { + console.log('error') } - state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].instanceCount * 100 - state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].imageloadedArr = instanceList - state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].loadStatus = true + }, + setImageloadedInfo({ state }, obj) { + console.log('setImageloadedInfo', obj) + // if(obj.instance === '20dd8fc9-51b0-ec63-942b-cb3006c72650') + // var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) + // // const prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount + // const instanceList = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].instanceList + // const idx = state.visitTaskList[index].StudyList.findIndex(i => i.IsCriticalSequence) + + // if (!state.visitTaskList[index].StudyList[obj.studyIndex].IsCriticalSequence) { + // // 当前下载的非关键序列 + // console.log('当前下载的非关键序列') + // if (idx > -1) { + // const keyInstance = state.visitTaskList[index].StudyList[idx].SeriesList[0].instanceList + // obj.markedImages = getKeySeriesInfo(keyInstance, state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex]) + // instanceList.map(i => { + // if (obj.markedImages.hasOwnProperty(i) && state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr.indexOf(i) < 0) { + // state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr.push(i) + // state.visitTaskList[index].StudyList[idx].SeriesList[0].prefetchInstanceCount = state.visitTaskList[index].StudyList[idx].SeriesList[0].prefetchInstanceCount + 100 + // } + // }) + // if (state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr >= state.visitTaskList[index].StudyList[idx].SeriesList[0].instanceCount) { + // state.visitTaskList[index].StudyList[idx].SeriesList[0].loadStatus = true + // } + // } + // } + // state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].instanceCount * 100 + // state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].imageloadedArr = instanceList + // state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].loadStatus = true // const imageloadedArr = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].imageloadedArr // if (imageloadedArr.indexOf()) diff --git a/src/views/trials/trials-panel/reading/dicoms/components/ReadPage.vue b/src/views/trials/trials-panel/reading/dicoms/components/ReadPage.vue index feec99a0..df5a6b05 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/ReadPage.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/ReadPage.vue @@ -8,12 +8,12 @@