Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web
continuous-integration/drone/push Build is passing Details

uat_us
熊飞 2024-01-26 11:04:08 +08:00
commit 6ca9ed8a9b
6 changed files with 178 additions and 77 deletions

View File

@ -1,7 +1,7 @@
import * as cornerstone from 'cornerstone-core' import * as cornerstone from 'cornerstone-core'
var taskPool = [] // 请求池 var taskPool = [] // 请求池
let numRequest = 0 // 正在执行数量 let numRequest = 0 // 正在执行数量
const maxRequest = 6 // 可配置 const maxRequest = 5 // 可配置
let taskTimer // 轮询的定时器 let taskTimer // 轮询的定时器
var cachedTask = {} // 存放的任务数据 var cachedTask = {} // 存放的任务数据
let sortType = 1 let sortType = 1
@ -10,15 +10,16 @@ let startExecuteTask = null
let endExecuteTask = performance.now() let endExecuteTask = performance.now()
// 执行下载 // 执行下载
async function executeTask() { async function executeTask() {
console.log(taskPool)
endExecuteTask = performance.now() endExecuteTask = performance.now()
i++ i++
// stopTaskTimer() stopTaskTimer()
if (taskPool.length > 0) { if (taskPool.length > 0) {
let startSortTime = performance.now() // let startSortTime = performance.now()
if( sortType ){ if( sortType ){
sortTaskPool() sortTaskPool()
} }
let endSortTime = performance.now() // let endSortTime = performance.now()
var requestNum = Math.min(taskPool.length, maxRequest) var requestNum = Math.min(taskPool.length, maxRequest)
const tasks = taskPool.splice(0, requestNum); const tasks = taskPool.splice(0, requestNum);
@ -30,17 +31,16 @@ async function executeTask() {
task.callback({ success: true, err: error }) task.callback({ success: true, err: error })
}) })
}) })
let starLoadTime = performance.now() // let starLoadTime = performance.now()
await Promise.all(taskPromises) await Promise.all(taskPromises)
let endLoadTime = performance.now() // let endLoadTime = performance.now()
let isTest = process.env.VUE_APP_OSS_PATH === '/test/dist' // let isTest = process.env.VUE_APP_OSS_PATH === '/test/dist'
if(i > 1 && isTest){ // if(i > 1 && isTest){
// if (eval(process.env.NODE_ENV) === 'development')
console.log(`${i}次:${startExecuteTask?endExecuteTask - startExecuteTask:0}:${endSortTime - startSortTime}:${endLoadTime - starLoadTime}`) // console.log(`第${i}次:${startExecuteTask?endExecuteTask - startExecuteTask:0}:${endSortTime - startSortTime}:${endLoadTime - starLoadTime}`)
} // }
startExecuteTask = performance.now() // startExecuteTask = performance.now()
executeTask() executeTask()
}else{ }else{
startTaskTimer() startTaskTimer()
@ -119,6 +119,14 @@ function removeTask(seriesId){
} }
startTaskTimer() startTaskTimer()
} }
function changePriority(seriesId){
taskPool.map(task=>{
if(task.seriesId === seriesId){
task.priority = parseInt(new Date().getTime()) * 10
}
})
sortTaskPool()
}
function setSortType(type){ function setSortType(type){
sortType = type sortType = type
} }
@ -147,6 +155,7 @@ export default {
executeTask, executeTask,
setSortType, setSortType,
sortTaskPool, sortTaskPool,
changePriority,
startTaskTimer, startTaskTimer,
stopTaskTimer, stopTaskTimer,
loadAndCacheImagePlus, loadAndCacheImagePlus,

View File

@ -152,7 +152,8 @@ export default {
firstInstanceId: '', firstInstanceId: '',
showDelete: false, showDelete: false,
loading: false, loading: false,
imageList: [] imageList: [],
showSeriesList: []
} }
}, },
created: function() { created: function() {
@ -307,17 +308,22 @@ export default {
this.currentSeriesIndex = seriesIndex this.currentSeriesIndex = seriesIndex
this.$refs.dicomViewer.loadImageStack(this.seriesList[seriesIndex]) this.$refs.dicomViewer.loadImageStack(this.seriesList[seriesIndex])
if (!series.loadStatus) { if (!series.loadStatus) {
series.isLoading = true requestPoolManager.changePriority(series.seriesId)
var p = new Date().getTime() // var isAddToTakPool = false
series.imageIds.map((imageId, i) => { // if (this.showSeriesList.includes(`${seriesIndex}`)) {
var priority = '' // isAddToTakPool = true
if (i === 0) { // } else {
priority = new Date(new Date().setHours(23, 59, 59, 999)).getTime() // this.showSeriesList.push(`${seriesIndex}`)
} else { // }
priority = p - 1 // if (!isAddToTakPool) {
} // var priority = parseInt(new Date().getTime())
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority }) // series.isLoading = true
}) // series.imageIds.map((imageId) => {
// this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority })
// })
// } else {
// requestPoolManager.changePriority(series.seriesId)
// }
} }
}, },
initStudy() { initStudy() {

View File

@ -233,7 +233,8 @@ export default {
showDelete: 0, showDelete: 0,
imageList: [], imageList: [],
activeNames: [], activeNames: [],
relationActiveName: [] relationActiveName: [],
showSeriesList: []
} }
}, },
mounted() { mounted() {
@ -323,18 +324,22 @@ export default {
this.currentSeriesIndex = seriesIndex this.currentSeriesIndex = seriesIndex
this.$refs.dicomViewer.loadImageStack(this.studyList[studyIndex].SeriesList[seriesIndex]) this.$refs.dicomViewer.loadImageStack(this.studyList[studyIndex].SeriesList[seriesIndex])
if (!series.loadStatus) { if (!series.loadStatus) {
series.isLoading = true requestPoolManager.changePriority(series.seriesId)
var p = parseInt(new Date().getTime()) // var isAddToTakPool = false
series.imageIds.map((imageId, i) => { // if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) {
var priority = '' // isAddToTakPool = true
if (i === 0) { // } else {
priority = parseInt(new Date().getTime()) * 10 // this.showSeriesList.push(`${studyIndex}_${seriesIndex}`)
} else { // }
priority = p - 1 // if (!isAddToTakPool) {
} // var priority = parseInt(new Date().getTime())
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority }) // series.isLoading = true
// this.load(imageId, series.seriesId, priority) // series.imageIds.map((imageId, i) => {
}) // this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority })
// })
// } else {
// requestPoolManager.changePriority(series.seriesId)
// }
} }
}, },
changeReadingStatus(callback, data) { changeReadingStatus(callback, data) {
@ -515,7 +520,7 @@ export default {
this.imageLoaded(image, res.data.string('x0020000e')) this.imageLoaded(image, res.data.string('x0020000e'))
}) })
}) })
requestPoolManager.sortTaskPool()
this.imageList = [] this.imageList = []
} }
}, },

View File

@ -822,9 +822,9 @@ export default {
this.getWwcTpl() this.getWwcTpl()
// cornerstone.imageCache.setMaximumSizeBytes(0) // cornerstone.imageCache.setMaximumSizeBytes(0)
const maximumSizeInBytes = 1024 * 1024 * 1024 // 1 GB // const maximumSizeInBytes = 1024 * 1024 * 1024 // 1 GB
// const maximumSizeInBytes = 1024 * 1024 * 500 // // const maximumSizeInBytes = 1024 * 1024 * 500
cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes) // cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
this.customWwc = { visible: false, title: this.$t('trials:reading:dagTitle:wwwcCustom') } this.customWwc = { visible: false, title: this.$t('trials:reading:dagTitle:wwwcCustom') }
this.CriterionType = parseInt(localStorage.getItem('CriterionType')) this.CriterionType = parseInt(localStorage.getItem('CriterionType'))
if (this.CriterionType === 10) { if (this.CriterionType === 10) {

View File

@ -690,7 +690,8 @@ export default {
await store.dispatch('reading/setCurrentReadingTaskState', 2) await store.dispatch('reading/setCurrentReadingTaskState', 2)
var isAutoTask = await this.getAutoTaskVal() var isAutoTask = await this.getAutoTaskVal()
if (isAutoTask) { if (isAutoTask) {
DicomEvent.$emit('getNextTask') // DicomEvent.$emit('getNextTask')
window.location.reload()
} else { } else {
// '' // ''
this.$confirm(this.$t('trials:readingReport:message:msg4'), { this.$confirm(this.$t('trials:readingReport:message:msg4'), {
@ -698,7 +699,8 @@ export default {
distinguishCancelAndClose: true distinguishCancelAndClose: true
}) })
.then(() => { .then(() => {
DicomEvent.$emit('getNextTask') window.location.reload()
// DicomEvent.$emit('getNextTask')
}) })
.catch(action => { .catch(action => {
changeURLStatic('visitTaskId', this.visitTaskId) changeURLStatic('visitTaskId', this.visitTaskId)

View File

@ -56,9 +56,9 @@
<i class="el-icon-video-play" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="loadSeries(series,index,i)" /> <i class="el-icon-video-play" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="loadSeries(series,index,i)" />
</el-tooltip> </el-tooltip>
<!-- 暂停 --> <!-- 暂停 -->
<el-tooltip v-else class="item" effect="dark" :content="$t('trials:reading:button:pause')" placement="bottom"> <!-- <el-tooltip v-else class="item" effect="dark" :content="$t('trials:reading:button:pause')" placement="bottom">
<i class="el-icon-video-pause" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="stopLoadSeries(series,index,i)" /> <i class="el-icon-video-pause" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="stopLoadSeries(series,index,i)" />
</el-tooltip> </el-tooltip> -->
</div> </div>
<el-tooltip v-else-if="series.isDicom && series.prefetchInstanceCount === 0 &&series.modality!== 'SR'" class="item" effect="dark" :content="$t('trials:reading:button:download')" placement="bottom"> <el-tooltip v-else-if="series.isDicom && series.prefetchInstanceCount === 0 &&series.modality!== 'SR'" class="item" effect="dark" :content="$t('trials:reading:button:download')" placement="bottom">
<i class="el-icon-video-play" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="loadSeries(series,index,i)" /> <i class="el-icon-video-play" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="loadSeries(series,index,i)" />
@ -170,6 +170,7 @@ export default {
return { return {
studyList: [], studyList: [],
cachedImages: [], cachedImages: [],
showSeriesList: [],
studyIndex: null, studyIndex: null,
seriesIndex: null, seriesIndex: null,
loading: false, loading: false,
@ -224,13 +225,62 @@ export default {
// } // }
// }) // })
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded) cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimagecachefull', this.cornerstoneimagecachefull)
// cornerstone.events.addEventListener('cornerstoneimagecachechanged', this.cornerstoneimagecachechanged)
}, },
beforeDestroy() { beforeDestroy() {
console.log('study---beforeDestroy')
cornerstone.imageCache.purgeCache() cornerstone.imageCache.purgeCache()
DicomEvent.$off('refreshStudyListMeasureData') DicomEvent.$off('refreshStudyListMeasureData')
}, },
methods: { methods: {
initStudyInfo() { initStudyInfo() {
const loading = this.$loading({ fullscreen: true })
//
this.getInitSeries().then((res) => {
requestPoolManager.startTaskTimer()
res.map((item) => {
this.loadInitialImage(item)
})
console.log(res)
var i = res.findIndex(s => s.isCurrentTask)
if (i > -1) {
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
if (idx > -1) {
this.measureData = this.visitTaskList[idx].MeasureData
this.studyList = this.visitTaskList[idx].StudyList
var priority = parseInt(new Date().getTime())
res[i].imageIds.map(image => {
priority--
this.imageList.push({ imageId: image, seriesId: res[i].seriesId, studyIndex: res[i].studyIndex, seriesIndex: res[i].seriesIndex, visitTaskId: res[i].visitTaskId, priority })
})
// this.studyList.map((study, studyIndex) => {
// study.SeriesList.map((series, seriesIndex) => {
// if (series.modality !== 'SR') {
// series.imageIds.map(image => {
// let priority = 0
// if (series.seriesId === res[i].seriesId) {
// priority = parseInt(new Date().getTime()) * 10
// } else {
// priority = --p
// }
// this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
// })
// }
// })
// })
this.loopLoad()
}
}
DicomEvent.$emit('loadImageStacks', res)
loading.close()
this.isRender = true
}).catch(() => {
loading.close()
})
},
initStudyInfo2() {
console.log('initStudyInfo') console.log('initStudyInfo')
const loading = this.$loading({ fullscreen: true }) const loading = this.$loading({ fullscreen: true })
// //
@ -555,19 +605,23 @@ export default {
if (!series.loadStatus && series.modality !== 'SR') { if (!series.loadStatus && series.modality !== 'SR') {
this.loopLoadStatus = -1 this.loopLoadStatus = -1
series.isLoading = true series.isLoading = true
var p = parseInt(new Date().getTime()) var isAddToTakPool = false
series.imageIds.map((imageId, i) => { if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) {
var priority = '' isAddToTakPool = true
if (i === 0) { } else {
priority = parseInt(new Date().getTime()) * 10 this.showSeriesList.push(`${studyIndex}_${seriesIndex}`)
} else { }
priority = --p if (!isAddToTakPool) {
var priority = parseInt(new Date().getTime())
series.imageIds.map((imageId) => {
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
} }
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) } else {
}) requestPoolManager.changePriority(series.seriesId)
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
} }
} }
@ -618,21 +672,28 @@ export default {
store.dispatch('reading/setActiveSeries', series) store.dispatch('reading/setActiveSeries', series)
}, },
loadImages(taskInfo) { loadImages(taskInfo) {
const isBaseLineTask = taskInfo.IsBaseLineTask // const isBaseLineTask = taskInfo.IsBaseLineTask
const isCurrentTask = taskInfo.IsCurrentTask const isCurrentTask = taskInfo.IsCurrentTask
// var priority = isCurrentTask ? parseInt(new Date().getTime()) : 999 // var priority = isCurrentTask ? parseInt(new Date().getTime()) : 999
var priority = parseInt(new Date().getTime()) var priority = parseInt(new Date().getTime())
this.studyList.map((study, studyIndex) => { this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => { study.SeriesList.map((series, seriesIndex) => {
if (!series.loadStatus && series.isDicom && series.modality !== 'SR') { if (!series.loadStatus && series.isDicom && series.modality !== 'SR') {
if (isCurrentTask || isBaseLineTask) { // if (isCurrentTask || isBaseLineTask) {
// /线 // // /线
series.imageIds.map(image => { // series.imageIds.map(image => {
priority = priority - 1 // priority = priority - 1
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) // this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
}) // })
} else if (!isBaseLineTask && !isCurrentTask && study.IsCriticalSequence) { // } else if (!isBaseLineTask && !isCurrentTask && study.IsCriticalSequence) {
// 访 // // 访
// series.imageIds.map(image => {
// priority = priority - 1
// this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
// })
// }
//
if (!isCurrentTask && study.IsCriticalSequence) {
series.imageIds.map(image => { series.imageIds.map(image => {
priority = priority - 1 priority = priority - 1
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
@ -646,8 +707,7 @@ export default {
loopLoad() { loopLoad() {
if (this.imageList.length > 0) { if (this.imageList.length > 0) {
// requestPoolManager.startTaskTimer()
requestPoolManager.startTaskTimer()
this.imageList.map(image => { this.imageList.map(image => {
requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => { requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => {
this.imageLoaded({ visitTaskId: this.visitTaskId, imageId: image.imageId }, res.data.string('x0020000e')) this.imageLoaded({ visitTaskId: this.visitTaskId, imageId: image.imageId }, res.data.string('x0020000e'))
@ -663,15 +723,26 @@ export default {
console.log('loadSeries') console.log('loadSeries')
this.loopLoadStatus = -1 this.loopLoadStatus = -1
this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', true) this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', true)
const priority = parseInt(new Date().getTime()) var isAddToTakPool = false
series.imageIds.map(image => { if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) {
if (series.imageloadedArr.indexOf(image) === -1) { isAddToTakPool = true
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) } else {
this.showSeriesList.push(`${studyIndex}_${seriesIndex}`)
}
if (!isAddToTakPool) {
const priority = parseInt(new Date().getTime())
series.imageIds.map(image => {
const index = this.cachedImages.findIndex(item => item.uri === image)
if (index === -1) {
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
}
})
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
} }
}) } else {
if (this.imageList.length > 0) { requestPoolManager.changePriority(series.seriesId)
this.loopLoadStatus = 0
this.loopLoad()
} }
}, },
// //
@ -732,6 +803,13 @@ export default {
this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true
} }
} }
},
cornerstoneimagecachechanged(e) {
const cacheInfo = cornerstone.imageCache.getCacheInfo()
console.log(cacheInfo)
},
cornerstoneimagecachefull(e) {
console.log('超过内存了')
} }
} }
} }
@ -744,6 +822,7 @@ export default {
width:100%; width:100%;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden;
.dicom-desc{ .dicom-desc{
font-weight: bold; font-weight: bold;
font-size: 13px; font-size: 13px;