非dicom阅片问题绑定标记
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
5565b1389d
commit
7426be2e50
|
|
@ -294,3 +294,12 @@ export function readingImport(param) {
|
|||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
// 非dicom阅片保存标记
|
||||
export function saveAnswerAndBindingNoneDicomMark(param) {
|
||||
return request({
|
||||
url: `/ReadingImageTask/saveAnswerAndBindingNoneDicomMark`,
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
<script>
|
||||
|
||||
import { getCustomTableQuestionAnswer, changeDicomReadingQuestionAnswer, submitVisitTaskQuestionsInDto, verifyVisitTaskQuestions, getQuestionCalculateRelation, saveTaskQuestion } from '@/api/trials'
|
||||
import { setSkipReadingCache, resetReadingTask, saveTableQuestionMark } from '@/api/reading'
|
||||
import { setSkipReadingCache, resetReadingTask, saveTableQuestionMark, saveAnswerAndBindingNoneDicomMark } from '@/api/reading'
|
||||
import const_ from '@/const/sign-code'
|
||||
import QuestionFormItem from './QuestionFormItem'
|
||||
import SignForm from '@/views/trials/components/newSignForm'
|
||||
|
|
@ -76,6 +76,10 @@ export default {
|
|||
readingTaskState: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
isNoneDicom: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
|
@ -127,7 +131,8 @@ export default {
|
|||
this.loading = true
|
||||
try {
|
||||
const param = {
|
||||
visitTaskId: this.visitTaskId
|
||||
visitTaskId: this.visitTaskId,
|
||||
IsDicomReading: !this.isNoneDicom
|
||||
}
|
||||
const res = await getCustomTableQuestionAnswer(param)
|
||||
if (res.IsSuccess) {
|
||||
|
|
@ -154,7 +159,11 @@ export default {
|
|||
}
|
||||
})
|
||||
this.questions = res.Result.SinglePage
|
||||
if (this.isNoneDicom) {
|
||||
this.$emit("setIsHaveBindingQuestion", res.OtherInfo.IsHaveBindingQuestion)
|
||||
}
|
||||
this.questionsMarkStatus = {}
|
||||
this.questionMarkInfoList = []
|
||||
this.questionMarkInfoList = res.OtherInfo.QuestionMarkInfoList.map(i => {
|
||||
if (i.RowId) {
|
||||
this.$set(this.questionsMarkStatus, `${i.RowId}_${i.TableQuestionId}`, { isMarked: i.MeasureData !== '', isSaved: true, OrderMarkName: i.OrderMarkName })
|
||||
|
|
@ -353,162 +362,6 @@ export default {
|
|||
const i = this.questionMarkInfoList.findIndex(i => i.MeasureData && i.MeasureData.annotationUID === annotation.annotationUID)
|
||||
return i > -1
|
||||
},
|
||||
// async operateImageMarker(obj) {
|
||||
// this.operateStateEnum = obj.operateStateEnum
|
||||
// this.isTableQuestion = obj.question.IsTableQuestion ? true : false
|
||||
// this.imageTool = obj.question.ImageTool
|
||||
// this.imageToolAttribute = obj.question.ImageToolAttribute
|
||||
// this.operateQuestionId = obj.question.Id
|
||||
// this.operateRowId = obj.question.RowId
|
||||
// this.operateParentQsId = obj.question.ParentQsId
|
||||
// if (obj.operateStateEnum === 0) {
|
||||
// // 绑定标记
|
||||
// this.$emit('setReadingToolPassive')
|
||||
// } else if (obj.operateStateEnum === 1) {
|
||||
// // 添加标记
|
||||
// this.$emit('setReadingToolActive', obj.question.ImageTool)
|
||||
// } else if (obj.operateStateEnum === 2) {
|
||||
// // 查看标记
|
||||
// let i = -1
|
||||
// if (this.isTableQuestion) {
|
||||
// if (this.operateRowId) {
|
||||
// i = this.questionMarkInfoList.findIndex(i => i.TableQuestionId === obj.question.Id && i.RowId === this.operateRowId)
|
||||
// } else {
|
||||
// i = this.questionMarkInfoList.findIndex(i => i.TableQuestionId === obj.question.Id && !i.RowId)
|
||||
// }
|
||||
// } else {
|
||||
// i = this.questionMarkInfoList.findIndex(i => i.QuestionId === obj.question.Id)
|
||||
// }
|
||||
// if (i > -1) {
|
||||
// const annotation = this.questionMarkInfoList[i].MeasureData
|
||||
// this.$emit('viewCustomAnnotationSeries', { visitTaskId: this.visitTaskId, annotation })
|
||||
// }
|
||||
// } else if (obj.operateStateEnum === 3) {
|
||||
// // 更改标记
|
||||
// this.$emit('setReadingToolPassive')
|
||||
// } else if (obj.operateStateEnum === 4) {
|
||||
// this.$emit('setReadingToolPassive')
|
||||
// // 移除标记
|
||||
// let i = -1
|
||||
// let questionMarkInfo = {}
|
||||
// if (this.isTableQuestion) {
|
||||
// if (this.operateRowId) {
|
||||
// i = this.questionMarkInfoList.findIndex(i => i.TableQuestionId === obj.question.Id && i.RowId === this.operateRowId)
|
||||
// } else {
|
||||
// i = this.questionMarkInfoList.findIndex(i => i.TableQuestionId === obj.question.Id && !i.RowId)
|
||||
// }
|
||||
// } else {
|
||||
// this.$set(this.questionForm, obj.question.Id, '')
|
||||
// i = this.questionMarkInfoList.findIndex(i => i.QuestionId === obj.question.Id)
|
||||
// }
|
||||
// if (i === -1) return
|
||||
// this.questionMarkInfoList[i].MeasureData = ''
|
||||
// this.questionMarkInfoList[i].StudyId = ''
|
||||
// this.questionMarkInfoList[i].SeriesId = ''
|
||||
// this.questionMarkInfoList[i].InstanceId = ''
|
||||
// questionMarkInfo = this.questionMarkInfoList[i]
|
||||
// questionMarkInfo.isMarked = false
|
||||
// questionMarkInfo.isSaved = false
|
||||
// this.$set(this.questionsMarkStatus, this.operateRowId ? `${this.operateRowId}_${obj.question.Id}` : obj.question.Id, questionMarkInfo)
|
||||
// } else if (obj.operateStateEnum === 5) {
|
||||
// // 保存外层标记
|
||||
// this.loading = true
|
||||
// try {
|
||||
// const answers = []
|
||||
// answers.push({ id: obj.question.Id, answer: this.questionForm[obj.question.Id] })
|
||||
// const markInfo = []
|
||||
// const i = this.questionMarkInfoList.findIndex(i => i.QuestionId === this.operateQuestionId)
|
||||
// if (i > -1) {
|
||||
// const obj = Object.assign({}, this.questionMarkInfoList[i])
|
||||
// obj.MeasureData = obj.MeasureData ? JSON.stringify(obj.MeasureData) : ''
|
||||
// markInfo.push(obj)
|
||||
// }
|
||||
// // 上传截图
|
||||
// const params = {
|
||||
// visitTaskId: this.visitTaskId,
|
||||
// answers: answers,
|
||||
// questionMarkInfoList: markInfo
|
||||
// }
|
||||
// await saveTaskQuestion(-10, params)
|
||||
|
||||
// this.$set(this.questionsMarkStatus, obj.question.Id, {isMarked: this.questionMarkInfoList[i].MeasureData ? true : false, isSaved: true})
|
||||
// this.loading = false
|
||||
// } catch (e) {
|
||||
// console.log(e)
|
||||
// this.loading = false
|
||||
// }
|
||||
// } else if (obj.operateStateEnum === 6) {
|
||||
// // 更改数值内容
|
||||
// let questionMarkInfo = {}
|
||||
// if (this.isTableQuestion) {
|
||||
// questionMarkInfo.isMarked = false
|
||||
// questionMarkInfo.isSaved = false
|
||||
// } else {
|
||||
// questionMarkInfo.isMarked = false
|
||||
// questionMarkInfo.isSaved = false
|
||||
// }
|
||||
// this.$set(this.questionsMarkStatus, this.operateRowId ? `${this.operateRowId}_obj.question.Id` : obj.question.Id, questionMarkInfo)
|
||||
// } else if (obj.operateStateEnum === 7) {
|
||||
// // 保存表格问题标记
|
||||
// const loading = this.$loading({ fullscreen: true })
|
||||
// try {
|
||||
// let annotation = null
|
||||
// if (!this.operateRowId && obj.rowId && obj.question.ParentQsId) {
|
||||
// this.operateRowId = obj.rowId
|
||||
// this.questionMarkInfoList.forEach(item => {
|
||||
// if (item.QuestionId === obj.question.ParentQsId && !item.RowId) {
|
||||
// item.RowId = obj.rowId
|
||||
// let questionMarkStatus = Object.assign({}, this.questionsMarkStatus[item.TableQuestionId])
|
||||
// delete this.questionsMarkStatus[item.TableQuestionId]
|
||||
// if (item.TableQuestionId === this.operateQuestionId) {
|
||||
// annotation = item.MeasureData
|
||||
// this.$set(this.questionsMarkStatus, `${obj.rowId}_${item.TableQuestionId}`, questionMarkStatus)
|
||||
// } else {
|
||||
// this.$set(this.questionsMarkStatus, `${obj.rowId}_${item.TableQuestionId}`, {isMarked: item.MeasureData ? true : false, isSaved: false})
|
||||
// }
|
||||
|
||||
// }
|
||||
// })
|
||||
// } else if (this.operateRowId && this.operateQuestionId) {
|
||||
// const i = this.questionMarkInfoList.findIndex(i => i.RowId === this.operateRowId && i.TableQuestionId === this.operateQuestionId)
|
||||
// if (i === -1) return
|
||||
// annotation = this.questionMarkInfoList[i].MeasureData
|
||||
// }
|
||||
// let picturePath = ''
|
||||
// if (annotation) {
|
||||
// // 上传截图
|
||||
// const base64Str = await this.getScreenshots({ visitTaskId: this.visitTaskId, annotation })
|
||||
// const pictureObj = await this.uploadScreenshots(`${new Date().getTime()}`, base64Str)
|
||||
// picturePath = pictureObj.isSuccess ? this.$getObjectName(pictureObj.result.url) : ''
|
||||
// }
|
||||
// let params = {
|
||||
// Answer: obj.answer,
|
||||
// VisitTaskId: this.visitTaskId,
|
||||
// QuestionId: obj.question.ParentQsId,
|
||||
// InstanceId: annotation ? annotation.instanceId : '',
|
||||
// SeriesId: annotation ? annotation.seriesId : '',
|
||||
// StudyId: annotation ? annotation.studyId : '',
|
||||
// MarkTool: annotation ? annotation.markTool : '',
|
||||
// PicturePath: picturePath,
|
||||
// NumberOfFrames: annotation ? annotation.numberOfFrames : null,
|
||||
// MeasureData: annotation ? JSON.stringify(annotation) : '',
|
||||
// QuestionType: 0,
|
||||
// OrderMarkName: annotation ? annotation.data.label : '',
|
||||
// RowId: this.operateRowId,
|
||||
// TableQuestionId: this.operateQuestionId,
|
||||
// RowIndex: obj.rowIndex
|
||||
// }
|
||||
// // 保存标记
|
||||
// await saveTableQuestionMark(params, -10)
|
||||
// this.$set(this.questionsMarkStatus, `${this.operateRowId}_${this.operateQuestionId}`, {isMarked: annotation ? true : false, isSaved: true})
|
||||
// this.resetOperateState()
|
||||
// loading.close()
|
||||
// } catch(e) {
|
||||
// console.log(e)
|
||||
// loading.close()
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
async operateImageMarker(obj) {
|
||||
const STATE = {
|
||||
BIND: 0, // 绑定标记
|
||||
|
|
@ -538,9 +391,9 @@ export default {
|
|||
[STATE.VIEW]: this.handleViewAnnotation,
|
||||
[STATE.CHANGE]: () => this.$emit('setReadingToolPassive'),
|
||||
[STATE.REMOVE]: this.handleRemoveAnnotation,
|
||||
[STATE.SAVE_OUTER]: this.handleSaveOuterQuestions,
|
||||
[STATE.SAVE_OUTER]: this.isNoneDicom ? this.handleSaveNoneDicomOuterQuestions : this.handleSaveOuterQuestions,
|
||||
[STATE.UPDATE]: this.handleUpdateValue,
|
||||
[STATE.SAVE_TABLE]: this.handleSaveTableQuestions
|
||||
[STATE.SAVE_TABLE]: this.isNoneDicom ? this.handleSaveNoneDicomTableQuestions : this.handleSaveTableQuestions
|
||||
}
|
||||
|
||||
const handler = stateHandlers[operateStateEnum]
|
||||
|
|
@ -574,6 +427,73 @@ export default {
|
|||
isSaved: false,
|
||||
})
|
||||
},
|
||||
async handleSaveNoneDicomOuterQuestions(obj) {
|
||||
this.loading = true;
|
||||
try {
|
||||
const answers = [{ QuestionId: obj.question.Id, answer: this.questionForm[obj.question.Id] }]
|
||||
const markInfo = []
|
||||
const index = this.questionMarkInfoList.findIndex(
|
||||
item => item.QuestionId === this.operateQuestionId
|
||||
)
|
||||
|
||||
if (index > -1) {
|
||||
const item = { ...this.questionMarkInfoList[index] }
|
||||
item.MeasureData = item.MeasureData ? JSON.stringify(item.MeasureData) : ''
|
||||
markInfo.push(item)
|
||||
markInfo[0].PicturePath = ''
|
||||
}
|
||||
let annotation = null
|
||||
if (!this.operateRowId && obj.rowId) {
|
||||
this.operateRowId = obj.rowId
|
||||
// this.updateQuestionsMarkStatus(obj)
|
||||
}
|
||||
annotation = this.getAnnotationByRow(obj.question.Id, false)
|
||||
// 截图上传
|
||||
let picturePath = obj.picturePath
|
||||
if (annotation) {
|
||||
const base64Str = await this.getScreenshots({
|
||||
visitTaskId: this.visitTaskId,
|
||||
annotation
|
||||
})
|
||||
if (!picturePath) {
|
||||
const pictureObj = await this.uploadScreenshots(`${Date.now()}`, base64Str)
|
||||
picturePath = pictureObj.isSuccess ? this.$getObjectName(pictureObj.result.url) : ''
|
||||
}
|
||||
markInfo[0].PicturePath = picturePath
|
||||
}
|
||||
if (markInfo && markInfo.length > 0) {
|
||||
markInfo[0].MarkId = annotation ? annotation.annotationUID : null
|
||||
}
|
||||
await saveAnswerAndBindingNoneDicomMark({
|
||||
visitTaskId: this.visitTaskId,
|
||||
StudyId: annotation.studyId,
|
||||
NoneDicomFileId: annotation.noneDicomFileId,
|
||||
...answers[0],
|
||||
...markInfo[0]
|
||||
})
|
||||
this.loading = false
|
||||
this.$set(this.questionsMarkStatus, obj.question.Id, {
|
||||
isMarked: !!this.questionMarkInfoList[index]?.MeasureData,
|
||||
isSaved: true,
|
||||
OrderMarkName: index > -1 ? this.questionMarkInfoList[index].OrderMarkName : ''
|
||||
})
|
||||
this.resetOperateState()
|
||||
if (annotation) {
|
||||
for (let i = 0; i < this.questionMarkInfoList.length; i++) {
|
||||
const item = this.questionMarkInfoList[i]
|
||||
if (!item.MeasureData || item.MeasureData.annotationUID !== annotation.annotationUID) continue
|
||||
const isTableMode = item.TableQuestionId
|
||||
if (!isTableMode && this.questionsMarkStatus[item.QuestionId] && !this.questionsMarkStatus[item.QuestionId].isSaved && this.questionsMarkStatus[item.QuestionId].isMarked) {
|
||||
DicomEvent.$emit('operateImageMarker', { QuestionId: item.QuestionId, operateStateEnum: 5, picturePath })
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
async handleSaveOuterQuestions(obj) {
|
||||
this.loading = true;
|
||||
try {
|
||||
|
|
@ -647,6 +567,65 @@ export default {
|
|||
isSaved: false,
|
||||
})
|
||||
},
|
||||
async handleSaveNoneDicomTableQuestions(obj) {
|
||||
const loading = this.$loading({ fullscreen: true })
|
||||
try {
|
||||
let annotation = null
|
||||
if (!this.operateRowId && obj.rowId && obj.question.ParentQsId) {
|
||||
this.operateRowId = obj.rowId
|
||||
this.updateQuestionsMarkStatus(obj)
|
||||
}
|
||||
annotation = this.getAnnotationByRow(this.operateRowId)
|
||||
// 截图上传
|
||||
let picturePath = obj.picturePath
|
||||
if (annotation && !picturePath) {
|
||||
const base64Str = await this.getScreenshots({
|
||||
visitTaskId: this.visitTaskId,
|
||||
annotation
|
||||
})
|
||||
const pictureObj = await this.uploadScreenshots(`${Date.now()}`, base64Str)
|
||||
picturePath = pictureObj.isSuccess ? this.$getObjectName(pictureObj.result.url) : ''
|
||||
}
|
||||
await saveAnswerAndBindingNoneDicomMark({
|
||||
Answer: obj.answer,
|
||||
VisitTaskId: this.visitTaskId,
|
||||
QuestionId: obj.question.ParentQsId,
|
||||
...(annotation ? {
|
||||
StudyId: annotation.studyId,
|
||||
MarkTool: annotation.markTool,
|
||||
MeasureData: JSON.stringify(annotation),
|
||||
OrderMarkName: annotation.data.label,
|
||||
NoneDicomFileId: annotation.noneDicomFileId,
|
||||
} : {}),
|
||||
Path: picturePath ? picturePath : '',
|
||||
QuestionType: 0,
|
||||
RowId: this.operateRowId,
|
||||
TableQuestionId: this.operateQuestionId,
|
||||
RowIndex: obj.rowIndex,
|
||||
MarkId: annotation ? annotation.annotationUID : null
|
||||
})
|
||||
this.$set(this.questionsMarkStatus,
|
||||
`${this.operateRowId}_${this.operateQuestionId}`,
|
||||
{ isMarked: !!annotation, isSaved: true, OrderMarkName: annotation ? annotation.data.label : '' }
|
||||
)
|
||||
this.resetOperateState()
|
||||
if (annotation) {
|
||||
for (let i = 0; i < this.questionMarkInfoList.length; i++) {
|
||||
const item = this.questionMarkInfoList[i]
|
||||
if (!item.MeasureData || item.MeasureData.annotationUID !== annotation.annotationUID) continue
|
||||
const isTableMode = item.TableQuestionId
|
||||
if (isTableMode && ((this.questionsMarkStatus[`${item.RowId}_${item.TableQuestionId}`] && !this.questionsMarkStatus[`${item.RowId}_${item.TableQuestionId}`].isSaved && this.questionsMarkStatus[`${item.RowId}_${item.TableQuestionId}`].isMarked) || (this.questionsMarkStatus[`${item.TableQuestionId}`] && !this.questionsMarkStatus[`${item.TableQuestionId}`].isSaved && this.questionsMarkStatus[`${item.TableQuestionId}`].isMarked))) {
|
||||
DicomEvent.$emit('operateImageMarkerTable', { QuestionId: item.TableQuestionId, operateStateEnum: 7, picturePath })
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('表格保存失败:', e)
|
||||
} finally {
|
||||
loading.close()
|
||||
}
|
||||
},
|
||||
async handleSaveTableQuestions(obj) {
|
||||
const loading = this.$loading({ fullscreen: true })
|
||||
try {
|
||||
|
|
@ -772,7 +751,6 @@ export default {
|
|||
&& item.RowId !== this.operateRowId && item.RowId
|
||||
)
|
||||
// && this.operateRowId
|
||||
console.log(conflictIndex)
|
||||
if (conflictIndex > -1) {
|
||||
//该标记已绑定到其他行,不能更改绑定!
|
||||
this.$alert(this.$t("dicom3D:CustomizeQuestionList:alert:markIsbind"))
|
||||
|
|
@ -808,6 +786,7 @@ export default {
|
|||
StudyId: annotation.studyId,
|
||||
MarkTool: annotation.metadata.toolName,
|
||||
PicturePath: '',
|
||||
Path: annotation.path,
|
||||
NumberOfFrames: annotation.numberOfFrames,
|
||||
MeasureData: annotation,
|
||||
RowId: this.operateRowId || '',
|
||||
|
|
@ -956,11 +935,33 @@ export default {
|
|||
const hasProp = cachedStats
|
||||
&& Object.prototype.hasOwnProperty.call(cachedStats, prop)
|
||||
if (!hasProp) return null
|
||||
const value = cachedStats[prop]
|
||||
let value = cachedStats[prop]
|
||||
if (this.isNoneDicom && annotation.ps) {
|
||||
let ps = annotation.ps
|
||||
if (prop === 'area') value = this.reRound(value * ps * ps, this.digitPlaces)
|
||||
if (prop === 'length' || prop === 'perimeter') value = this.reRound(value * ps, this.digitPlaces)
|
||||
}
|
||||
return value !== null
|
||||
? parseFloat(value).toFixed(this.digitPlaces)
|
||||
: value
|
||||
},
|
||||
reRound(result, finalPrecision) {
|
||||
if (typeof result === 'string' && result.includes(', ')) {
|
||||
const numStrs = result.split(', ')
|
||||
const processed = numStrs.map(str => this.processSingle(str, finalPrecision))
|
||||
return processed.join(', ')
|
||||
}
|
||||
return this.processSingle(result, finalPrecision)
|
||||
},
|
||||
processSingle(str, precision) {
|
||||
const num = parseFloat(str)
|
||||
if (isNaN(num)) return 'NaN'
|
||||
|
||||
// 保留原极小值处理逻辑
|
||||
if (Math.abs(num) < 0.0001) return str
|
||||
const factor = 10 ** precision
|
||||
return (Math.round(num * factor + 0.0000001) / factor).toFixed(precision)
|
||||
},
|
||||
unBindAnnotationToQuestion(obj) {
|
||||
const { markTableQuestions = [], questionId } = obj || {}
|
||||
const { questionMarkInfoList, questionsMarkStatus } = this
|
||||
|
|
@ -1123,6 +1124,26 @@ export default {
|
|||
// this.setMeasuredData(event.data.data)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
questionsMarkStatus: {
|
||||
handler() {
|
||||
let saved = true
|
||||
Object.keys(this.questionsMarkStatus).forEach(key => {
|
||||
if (!this.questionsMarkStatus[key].isSaved) saved = false
|
||||
})
|
||||
this.$emit('setSaved', saved)
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
},
|
||||
// questionMarkInfoList: {
|
||||
// handler() {
|
||||
// console.log(this.questionMarkInfoList, 'questionMarkInfoList')
|
||||
// },
|
||||
// deep: true,
|
||||
// immediate: true
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
</div>
|
||||
<div class="dropdown-content">
|
||||
<!--v-if="readingTaskState < 2"-->
|
||||
<ul style="width:100px;">
|
||||
<ul style="width:100px;">
|
||||
<li v-for="i in customizeStandardsNoneDicom" :key="i.toolName" style="text-align:left;">
|
||||
<a href="#" @click.prevent="setAnnotateToolActive(i.toolName)">
|
||||
<svg-icon :icon-class="i.icon" class="svg-icon" style="margin-right: 5px;" />
|
||||
|
|
@ -234,6 +234,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import { addNoneDicomMark, deleteTrialFileType, getCriterionReadingInfo } from '@/api/trials'
|
||||
import html2canvas from 'html2canvas'
|
||||
import {
|
||||
RenderingEngine,
|
||||
Enums,
|
||||
|
|
@ -296,6 +297,12 @@ export default {
|
|||
default() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
ecrf: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
|
@ -342,7 +349,8 @@ export default {
|
|||
uploadStatus: 'upload',
|
||||
taskId: '',
|
||||
isReadingTaskViewInOrder: null,
|
||||
trialCriterion: {}
|
||||
trialCriterion: {},
|
||||
saveCustomAnnotationTimer: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -607,7 +615,17 @@ export default {
|
|||
toolGroup.setToolPassive(EraserTool.toolName)
|
||||
})
|
||||
},
|
||||
|
||||
lengthscaleToolDisabled(saved) {
|
||||
const viewportIds = ['canvas-0', 'canvas-1', 'canvas-2', 'canvas-3']
|
||||
viewportIds.forEach(toolGroupId => {
|
||||
const toolGroup = ToolGroupManager.getToolGroup(toolGroupId)
|
||||
if (saved) {
|
||||
toolGroup.setToolPassive(LengthscaleTool.toolName)
|
||||
} else {
|
||||
toolGroup.setToolEnabled(LengthscaleTool.toolName)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 加载图片回调
|
||||
stackNewImage(e) {
|
||||
const { detail } = e
|
||||
|
|
@ -919,96 +937,201 @@ export default {
|
|||
toolsEvents.ANNOTATION_REMOVED,
|
||||
this.annotationRemovedListener
|
||||
)
|
||||
eventTarget.addEventListener(
|
||||
toolsEvents.ANNOTATION_SELECTION_CHANGE,
|
||||
this.annotationSelectionChangeListener
|
||||
)
|
||||
},
|
||||
async annotationRemovedListener(e) {
|
||||
const { annotation } = e.detail
|
||||
try {
|
||||
if (!annotation) return
|
||||
if (this.readingTaskState === 2 && !annotation.annotationId) {
|
||||
cornerstoneTools.annotation.state.removeAnnotation(annotation.annotationUID)
|
||||
return false
|
||||
// if ( this.resetAnnotation && this.isFusion ) return false
|
||||
if (!annotation) return false
|
||||
if (annotation.metadata.toolName === 'Lengthscale') {
|
||||
await this.$confirm(
|
||||
this.$t('trials:trials-list:table:LengthscaleIsDeleted')
|
||||
)
|
||||
const errorMsg = { message: 'Lengthscale Not delete' }
|
||||
throw errorMsg
|
||||
}
|
||||
if (this.readingTaskState === 2 && !annotation.data.label && annotation.metadata.toolName !== 'Lengthscale') return false
|
||||
if (this.readingTaskState === 2) {
|
||||
const errorMsg = { message: 'annotation Not allowed to operate' }
|
||||
throw errorMsg
|
||||
}
|
||||
if (annotation.annotationId) {
|
||||
await deleteTrialFileType(annotation.annotationId)
|
||||
} else {
|
||||
cornerstoneTools.annotation.state.removeAnnotation(annotation.annotationUID)
|
||||
const i = this.tools.findIndex(i => i.toolName === annotation.metadata.toolName)
|
||||
if (i === -1 && annotation.metadata.toolName !== 'Lengthscale') {
|
||||
// 临时标记
|
||||
return
|
||||
}
|
||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||
const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`)
|
||||
viewport.render()
|
||||
const i = this.viewportInfos.findIndex(i => i.index === this.activeCanvasIndex)
|
||||
const imageId = annotation.metadata.referencedImageId
|
||||
const path = imageId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const fileList = this.viewportInfos[i].fileList
|
||||
const fileIndex = fileList.findIndex(f => f.Path === path)
|
||||
if (annotation.metadata.toolName === 'Lengthscale') {
|
||||
this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: null })
|
||||
if (annotation.visitTaskId === this.taskInfo.VisitTaskId) {
|
||||
this.$emit('getEcrf', { type: "verifyAnnotationIsBound", VisitTaskId: annotation.visitTaskId, annotation })
|
||||
this.$nextTick(async () => {
|
||||
try {
|
||||
const isBound = this.ecrf.isBound
|
||||
if (isBound && this.activeTool === 'Eraser') {
|
||||
// '该标记已与问题进行绑定,不允许删除!'
|
||||
this.$alert(this.$t('dicom3D:ReadPage:alert:MarkToQuestionNoDel'))
|
||||
const errorMsg = { message: 'annotation Not allowed to operate' }
|
||||
throw errorMsg
|
||||
} else if (this.activeTool === 'Eraser') {
|
||||
await this.$confirm(
|
||||
this.$t('trials:trials-list:table:isDeleted') +
|
||||
annotation.data.label +
|
||||
'?'
|
||||
)
|
||||
if (annotation.id) {
|
||||
let res = await deleteTrialFileType(annotation.id)
|
||||
if (!res.IsSuccess) throw ''
|
||||
}
|
||||
|
||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||
for (let i = 0; i < this.cells.length; i++) {
|
||||
const viewportId = `canvas-${i}`
|
||||
const viewport = renderingEngine.getViewport(viewportId)
|
||||
viewport.render()
|
||||
}
|
||||
} else {
|
||||
const errorMsg = { message: 'annotation Not allowed to operate' }
|
||||
throw errorMsg
|
||||
}
|
||||
} catch (err) {
|
||||
cornerstoneTools.annotation.state.addAnnotation(annotation)
|
||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||
for (let i = 0; i < this.cells.length; i++) {
|
||||
const viewportId = `canvas-${i}`
|
||||
const viewport = renderingEngine.getViewport(viewportId)
|
||||
viewport.render()
|
||||
}
|
||||
console.log(e)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
cornerstoneTools.annotation.state.addAnnotation(annotation)
|
||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||
const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`)
|
||||
viewport.render()
|
||||
for (let i = 0; i < this.cells.length; i++) {
|
||||
const viewportId = `canvas-${i}`
|
||||
const viewport = renderingEngine.getViewport(viewportId)
|
||||
viewport.render()
|
||||
}
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
},
|
||||
async annotationModifiedListener(e) {
|
||||
console.log('Modified')
|
||||
if (this.readingTaskState === 2) return
|
||||
const { annotation } = e.detail
|
||||
if (!annotation.highlighted) return
|
||||
if (!annotation) return
|
||||
if (!annotation.annotationId) return
|
||||
if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return
|
||||
const i = this.viewportInfos.findIndex(i => i.index === this.activeCanvasIndex)
|
||||
if (i === -1) return
|
||||
if (this.viewportInfos[i].taskInfo.VisitTaskId !== this.taskInfo.VisitTaskId) return
|
||||
// if (!annotation.annotationId) return
|
||||
let i = this.tools.findIndex(i => i.toolName === annotation.metadata.toolName)
|
||||
if (i === -1 && annotation.metadata.toolName !== 'Lengthscale') {
|
||||
this.setToolsPassive()
|
||||
return
|
||||
}
|
||||
i = this.viewportInfos.findIndex(i => i.index === this.activeCanvasIndex)
|
||||
const imageId = annotation.metadata.referencedImageId
|
||||
const path = imageId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const fileList = this.viewportInfos[i].fileList
|
||||
const fileIndex = fileList.findIndex(f => f.Path === path)
|
||||
if (fileIndex === -1) return
|
||||
annotation.path = path
|
||||
let ps = null
|
||||
let psIndex = this.psArr.findIndex(i => i.Path === path)
|
||||
if (psIndex > -1 && this.psArr[i].PS) {
|
||||
ps = parseFloat(this.psArr[i].PS).toFixed(3)
|
||||
}
|
||||
annotation.ps = ps
|
||||
if (!annotation.data.label && annotation.metadata.toolName !== 'Lengthscale') return
|
||||
if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return
|
||||
if (annotation.metadata.toolName === 'Lengthscale') {
|
||||
const value = annotation.data.l
|
||||
let ps = 1
|
||||
if (value) {
|
||||
const cachedStats = Object.keys(annotation.data.cachedStats)
|
||||
const ps = value / annotation.data.cachedStats[cachedStats[0]].length
|
||||
ps = value / annotation.data.cachedStats[cachedStats[0]].length
|
||||
annotation.data.ps = ps
|
||||
this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps })
|
||||
this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps, OldPS: 1 })
|
||||
}
|
||||
this.setToolsPassive()
|
||||
if (this.customizeStandardsNoneDicom.find(item => item.toolName === annotation.metadata?.toolName)) return false
|
||||
if (this.saveCustomAnnotationTimer) {
|
||||
clearTimeout(this.saveCustomAnnotationTimer)
|
||||
this.saveCustomAnnotationTimer = null
|
||||
}
|
||||
let psIndex = this.psArr.findIndex(p => p.NoneDicomFileId === fileList[fileIndex].Id)
|
||||
let OldPS = 1
|
||||
if (psIndex > -1) {
|
||||
OldPS = this.psArr[i].OldPS
|
||||
}
|
||||
console.log(OldPS, ps)
|
||||
let Proportion = ps / OldPS
|
||||
return this.saveCustomAnnotationTimer = setTimeout(async () => {
|
||||
console.log(this.ecrf.IsHaveBindingQuestion, 'this.ecrf.IsHaveBindingQuestion')
|
||||
if (OldPS === ps || !this.ecrf.IsHaveBindingQuestion) {
|
||||
this.saveCustomAnnotation(annotation)
|
||||
} else {
|
||||
await this.$confirm(
|
||||
this.$t('trials:trials-list:table:allQuestionChange')
|
||||
).then(() => {
|
||||
this.saveCustomAnnotation(annotation, Proportion)
|
||||
})
|
||||
.catch(action => {
|
||||
this.saveCustomAnnotation(annotation, -1)
|
||||
});
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
if (this.customizeStandardsNoneDicom.find(item => item.toolName === annotation.metadata?.toolName)) return false
|
||||
const params = {
|
||||
id: annotation.annotationId,
|
||||
visitTaskId: this.viewportInfos[i].taskInfo.VisitTaskId,
|
||||
studyId: this.viewportInfos[i].studyId,
|
||||
noneDicomFileId: fileList[fileIndex].Id,
|
||||
path: fileList[fileIndex].Path,
|
||||
measureData: JSON.stringify(annotation)
|
||||
}
|
||||
await addNoneDicomMark(params)
|
||||
// 保存成功
|
||||
// this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
this.$emit("getEcrf", { type: "getOperateStateEnum", VisitTaskId: this.taskInfo.VisitTaskId })
|
||||
this.$emit('getEcrf', { type: "verifyAnnotationIsBound", VisitTaskId: this.taskInfo.VisitTaskId, annotation })
|
||||
this.$nextTick(() => {
|
||||
const operateStateEnum = this.ecrf.operateStateEnum
|
||||
const isBound = this.ecrf.isBound
|
||||
if (isBound || this.isNumber(operateStateEnum)) {
|
||||
console.log(isBound, this.isNumber(operateStateEnum))
|
||||
this.$emit('getEcrf', { type: "updateAnnotationToQuestion", VisitTaskId: this.taskInfo.VisitTaskId, annotation })
|
||||
} else {
|
||||
if (this.saveCustomAnnotationTimer) {
|
||||
clearTimeout(this.saveCustomAnnotationTimer)
|
||||
this.saveCustomAnnotationTimer = null
|
||||
}
|
||||
this.saveCustomAnnotationTimer = setTimeout(() => { this.saveCustomAnnotation(annotation) }, 1000)
|
||||
}
|
||||
this.setToolsPassive()
|
||||
})
|
||||
},
|
||||
async annotationCompletedListener(e) {
|
||||
console.log('Completed')
|
||||
if (this.readingTaskState === 2) return
|
||||
const { annotation } = e.detail
|
||||
if (!annotation) return
|
||||
if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return
|
||||
const i = this.viewportInfos.findIndex(i => i.index === this.activeCanvasIndex)
|
||||
if (i === -1) return
|
||||
let INDEX = this.tools.findIndex(i => i.toolName === annotation.metadata.toolName)
|
||||
if ((INDEX === -1 && annotation.metadata.toolName !== 'Lengthscale') || i === -1) {
|
||||
this.setToolsPassive()
|
||||
return
|
||||
}
|
||||
|
||||
if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return
|
||||
if (this.viewportInfos[i].taskInfo.VisitTaskId !== this.taskInfo.VisitTaskId) return
|
||||
const imageId = annotation.metadata.referencedImageId
|
||||
const path = imageId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const fileList = this.viewportInfos[i].fileList
|
||||
const fileIndex = fileList.findIndex(f => f.Path === path)
|
||||
if (fileIndex === -1) return
|
||||
annotation.path = path
|
||||
let ps = null
|
||||
let psIndex = this.psArr.findIndex(i => i.Path === path)
|
||||
if (psIndex > -1 && this.psArr[i].PS) {
|
||||
ps = parseFloat(this.psArr[i].PS).toFixed(3)
|
||||
}
|
||||
annotation.ps = ps
|
||||
annotation.markTool = annotation.metadata.toolName
|
||||
annotation.visitTaskId = this.viewportInfos[i].taskInfo.VisitTaskId
|
||||
annotation.studyId = this.viewportInfos[i].studyId
|
||||
annotation.noneDicomFileId = this.viewportInfos[i].fileList[this.viewportInfos[i].currentImageIdIndex].Id
|
||||
if (annotation.metadata.toolName === 'Lengthscale') {
|
||||
this.form.annotationObj = {
|
||||
id: '',
|
||||
|
|
@ -1025,23 +1148,139 @@ export default {
|
|||
this.setToolsPassive()
|
||||
return
|
||||
}
|
||||
if (this.customizeStandardsNoneDicom.find(item => item.toolName === annotation.metadata?.toolName)) return false
|
||||
const params = {
|
||||
id: '',
|
||||
visitTaskId: this.viewportInfos[i].taskInfo.VisitTaskId,
|
||||
studyId: this.viewportInfos[i].studyId,
|
||||
noneDicomFileId: fileList[fileIndex].Id,
|
||||
path: fileList[fileIndex].Path,
|
||||
measureData: JSON.stringify(annotation)
|
||||
}
|
||||
const res = await addNoneDicomMark(params)
|
||||
annotation.annotationId = res.Result
|
||||
// this.markedSeriesIds.push(series.Id)
|
||||
this.$emit('getEcrf', { type: "getOperateStateEnum", VisitTaskId: this.taskInfo.VisitTaskId })
|
||||
|
||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||
const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`)
|
||||
viewport.render()
|
||||
// 保存成功
|
||||
// this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
this.$nextTick(async () => {
|
||||
const operateStateEnum = this.ecrf.operateStateEnum
|
||||
const markName = await this.customPrompt(!this.isNumber(operateStateEnum))
|
||||
|
||||
if (markName) {
|
||||
annotation.data.label = markName
|
||||
if (annotation.metadata.toolName === 'ArrowAnnotate') {
|
||||
annotation.data.text = markName
|
||||
}
|
||||
if (this.isNumber(operateStateEnum)) {
|
||||
this.$emit('getEcrf', { type: "bindAnnotationToQuestion", VisitTaskId: this.taskInfo.VisitTaskId, annotation })
|
||||
} else {
|
||||
if (this.saveCustomAnnotationTimer) {
|
||||
clearTimeout(this.saveCustomAnnotationTimer)
|
||||
this.saveCustomAnnotationTimer = null
|
||||
}
|
||||
this.saveCustomAnnotationTimer = setTimeout(() => { this.saveCustomAnnotation(annotation) }, 500)
|
||||
}
|
||||
} else {
|
||||
// if (this.isNumber(operateStateEnum)) {
|
||||
// this.removeAnnotation(annotation)
|
||||
// }
|
||||
}
|
||||
})
|
||||
},
|
||||
annotationSelectionChangeListener(e) {
|
||||
console.log('selection')
|
||||
if (this.readingTaskState === 2) return
|
||||
const { detail } = e
|
||||
const annotations = cornerstoneTools.annotation.state.getAllAnnotations()
|
||||
const i = annotations.findIndex(i => i.annotationUID === detail.selection[0])
|
||||
if (i > -1) {
|
||||
if (annotations[i].visitTaskId !== this.taskInfo.VisitTaskId) {
|
||||
return
|
||||
} else {
|
||||
this.$emit('getEcrf', { type: "bindAnnotationToQuestion", VisitTaskId: this.taskInfo.VisitTaskId, annotation: annotations[i] })
|
||||
}
|
||||
}
|
||||
},
|
||||
async saveCustomAnnotation(annotation, ps = null) {
|
||||
try {
|
||||
const measureData = Object.assign({}, annotation)
|
||||
const params = {}
|
||||
const i = this.viewportInfos.findIndex(i => i.index === this.activeCanvasIndex)
|
||||
await this.getScreenshots({
|
||||
visitTaskId: this.taskInfo.VisitTaskId,
|
||||
annotation
|
||||
}, async (base64Str) => {
|
||||
const pictureObj = await this.uploadScreenshots(`${Date.now()}`, base64Str)
|
||||
let picturePath = pictureObj.isSuccess ? this.$getObjectName(pictureObj.result.url) : ''
|
||||
if (annotation.id) params.Id = annotation.id
|
||||
if (!isNaN(parseFloat(ps))) params.Proportion = ps
|
||||
params.PicturePath = picturePath
|
||||
params.Path = annotation.path || ''
|
||||
params.MarkTool = measureData.markTool
|
||||
params.OrderMarkName = measureData.data.label
|
||||
params.VisitTaskId = this.taskInfo.VisitTaskId
|
||||
params.StudyId = annotation.studyId
|
||||
params.NoneDicomFileId = annotation.noneDicomFileId
|
||||
params.MeasureData = JSON.stringify(measureData)
|
||||
params.MarkId = annotation.annotationUID
|
||||
const res = await addNoneDicomMark(params)
|
||||
annotation.markId = params.MarkId
|
||||
annotation.id = res.Result
|
||||
if (!isNaN(parseFloat(ps))) this.$emit('getEcrf', { type: "getQuestions", VisitTaskId: this.taskInfo.VisitTaskId })
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
this.loading = false
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getScreenshots(measureData, callback) {
|
||||
if (measureData) {
|
||||
console.log(measureData, 'measureData')
|
||||
// await this.imageLocation(measureData)
|
||||
this.viewCustomAnnotation(measureData)
|
||||
const divForDownloadViewport = document.querySelector(
|
||||
`div[data-viewport-uid="canvas-${this.activeCanvasIndex}"]`
|
||||
)
|
||||
const canvas = await html2canvas(divForDownloadViewport)
|
||||
const base64Str = canvas.toDataURL('image/png', 1)
|
||||
callback(base64Str)
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
viewCustomAnnotation(obj) {
|
||||
const i = this.viewportInfos.findIndex(i => i.taskInfo.VisitTaskId === obj.visitTaskId)
|
||||
const imageId = obj.annotation.metadata.referencedImageId
|
||||
const path = imageId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const fileList = this.viewportInfos[i].fileList
|
||||
const fileIndex = fileList.findIndex(f => f.Path === path)
|
||||
let o = { fileInfo: fileList[fileIndex], fileList, visitTaskInfo: this.viewportInfos[i].taskInfo, studyId: this.viewportInfos[i].studyId }
|
||||
this.setActiveCanvasImages(o)
|
||||
},
|
||||
async uploadScreenshots(fileName, file) {
|
||||
try {
|
||||
file = this.convertBase64ToBlob(file)
|
||||
const trialId = this.$route.query.trialId
|
||||
const taskInfo = JSON.parse(localStorage.getItem('taskInfo'))
|
||||
const subjectId = taskInfo.SubjectId
|
||||
const result = await this.OSSclient.put(`/${trialId}/Read/${subjectId}/${this.visitTaskId}/${fileName}.png`, file)
|
||||
return { isSuccess: true, result: result }
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return { isSuccess: false, result: e }
|
||||
}
|
||||
},
|
||||
convertBase64ToBlob(imageEditorBase64) {
|
||||
const base64Arr = imageEditorBase64.split(',')
|
||||
let imgtype = ''
|
||||
let base64String = ''
|
||||
if (base64Arr.length > 1) {
|
||||
base64String = base64Arr[1]
|
||||
imgtype = base64Arr[0].substring(
|
||||
base64Arr[0].indexOf(':') + 1,
|
||||
base64Arr[0].indexOf(';')
|
||||
)
|
||||
}
|
||||
const bytes = atob(base64String)
|
||||
const bytesCode = new ArrayBuffer(bytes.length)
|
||||
const byteArray = new Uint8Array(bytesCode)
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
byteArray[i] = bytes.charCodeAt(i)
|
||||
}
|
||||
return new Blob([bytesCode], { type: imgtype })
|
||||
},
|
||||
isNumber(value) {
|
||||
return typeof value === 'number' && value !== null && !isNaN(value)
|
||||
},
|
||||
async saveForm() {
|
||||
const validate = await this.$refs.lengthForm.validate()
|
||||
|
|
@ -1050,32 +1289,45 @@ export default {
|
|||
const annotation = this.form.annotationObj.annotation
|
||||
const fileList = this.form.annotationObj.fileList
|
||||
const fileIndex = this.form.annotationObj.fileIndex
|
||||
let ps = 1
|
||||
if (value) {
|
||||
annotation.data.l = parseFloat(value)
|
||||
const cachedStats = Object.keys(annotation.data.cachedStats)
|
||||
const ps = parseFloat(value) / annotation.data.cachedStats[cachedStats[0]].length
|
||||
ps = parseFloat(value) / annotation.data.cachedStats[cachedStats[0]].length
|
||||
annotation.data.ps = ps
|
||||
this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps })
|
||||
this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps, OldPS: 1 })
|
||||
} else {
|
||||
cornerstoneTools.annotation.state.removeAnnotation(annotation.annotationUID)
|
||||
return
|
||||
}
|
||||
if (this.customizeStandardsNoneDicom.find(item => item.toolName === annotation.metadata?.toolName)) return false
|
||||
const params = {
|
||||
id: '',
|
||||
visitTaskId: this.form.annotationObj.visitTaskId,
|
||||
studyId: this.form.annotationObj.studyId,
|
||||
noneDicomFileId: this.form.annotationObj.noneDicomFileId,
|
||||
path: this.form.annotationObj.path,
|
||||
measureData: JSON.stringify(annotation)
|
||||
}
|
||||
const res = await addNoneDicomMark(params)
|
||||
annotation.annotationId = res.Result
|
||||
|
||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||
const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`)
|
||||
viewport.render()
|
||||
this.dialogVisible = false
|
||||
if (this.saveCustomAnnotationTimer) {
|
||||
clearTimeout(this.saveCustomAnnotationTimer)
|
||||
this.saveCustomAnnotationTimer = null
|
||||
}
|
||||
let psIndex = this.psArr.findIndex(p => p.NoneDicomFileId === fileList[fileIndex].Id)
|
||||
let OldPS = 1
|
||||
if (psIndex > -1) {
|
||||
OldPS = this.psArr[psIndex].OldPS
|
||||
}
|
||||
console.log(OldPS, 'OldPS')
|
||||
let Proportion = ps / OldPS
|
||||
return this.saveCustomAnnotationTimer = setTimeout(async () => {
|
||||
if (!this.ecrf.IsHaveBindingQuestion) {
|
||||
this.saveCustomAnnotation(annotation)
|
||||
} else {
|
||||
await this.$confirm(
|
||||
this.$t('trials:trials-list:table:allQuestionChange')
|
||||
).then(() => {
|
||||
this.saveCustomAnnotation(annotation, Proportion)
|
||||
})
|
||||
.catch(action => {
|
||||
this.saveCustomAnnotation(annotation, -1)
|
||||
});
|
||||
}
|
||||
}, 500)
|
||||
this.saveCustomAnnotationTimer = setTimeout(() => { this.saveCustomAnnotation(annotation) }, 500)
|
||||
},
|
||||
getLengthscaleToolTextLines(data, targetId) {
|
||||
const cachedVolumeStats = data.cachedStats[targetId]
|
||||
|
|
@ -1087,6 +1339,9 @@ export default {
|
|||
return
|
||||
}
|
||||
const textLines = []
|
||||
if (data.label) {
|
||||
textLines.push(data.label)
|
||||
}
|
||||
textLines.push(`P: ${parseFloat(length).toFixed(this.digitPlaces)} ${unit}`)
|
||||
if (data.l) {
|
||||
textLines.push(`L: ${parseFloat(data.l).toFixed(this.digitPlaces)} mm`)
|
||||
|
|
@ -1097,7 +1352,7 @@ export default {
|
|||
// 直线工具注释
|
||||
getLengthToolTextLines(data, targetId) {
|
||||
const cachedVolumeStats = data.cachedStats[targetId]
|
||||
const { length, unit } = cachedVolumeStats
|
||||
let { length, unit } = cachedVolumeStats
|
||||
if (length === undefined || length === null || isNaN(length)) {
|
||||
return
|
||||
}
|
||||
|
|
@ -1108,6 +1363,9 @@ export default {
|
|||
ps = parseFloat(this.psArr[i].PS).toFixed(3)
|
||||
}
|
||||
const textLines = []
|
||||
if (data.label) {
|
||||
textLines.push(data.label)
|
||||
}
|
||||
if (ps) {
|
||||
textLines.push(`${this.reRound(csUtils.roundNumber(length * ps), this.digitPlaces)} mm`)
|
||||
} else {
|
||||
|
|
@ -1131,6 +1389,9 @@ export default {
|
|||
} = cachedVolumeStats || {}
|
||||
|
||||
const textLines = []
|
||||
if (data.label) {
|
||||
textLines.push(data.label)
|
||||
}
|
||||
let ps = null
|
||||
const path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const i = this.psArr.findIndex(i => i.Path === path)
|
||||
|
|
@ -1180,6 +1441,9 @@ export default {
|
|||
}
|
||||
|
||||
const textLines = []
|
||||
if (data.label) {
|
||||
textLines.push(data.label)
|
||||
}
|
||||
let ps = null
|
||||
const path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const i = this.psArr.findIndex(i => i.Path === path)
|
||||
|
|
@ -1216,6 +1480,9 @@ export default {
|
|||
}
|
||||
|
||||
const textLines = []
|
||||
if (data.label) {
|
||||
textLines.push(data.label)
|
||||
}
|
||||
let ps = null
|
||||
const path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const i = this.psArr.findIndex(i => i.Path === path)
|
||||
|
|
@ -1242,6 +1509,9 @@ export default {
|
|||
}
|
||||
|
||||
const textLines = []
|
||||
if (data.label) {
|
||||
textLines.push(data.label)
|
||||
}
|
||||
let ps = null
|
||||
const path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1]
|
||||
const i = this.psArr.findIndex(i => i.Path === path)
|
||||
|
|
@ -1300,16 +1570,77 @@ export default {
|
|||
viewport.resetCamera({ resetPan: true, resetZoom: true, resetToCenter: true })
|
||||
renderingEngine.render()
|
||||
},
|
||||
// 箭头工具输入标记名称自定义弹窗
|
||||
async customPrompt() {
|
||||
resetAnnotations({ annotations, visitTaskId }) {
|
||||
// 移除病灶
|
||||
const arr = cornerstoneTools.annotation.state.getAllAnnotations()
|
||||
arr.map(i => {
|
||||
if (i.visitTaskId === visitTaskId) {
|
||||
cornerstoneTools.annotation.state.removeAnnotation(i.annotationUID)
|
||||
}
|
||||
})
|
||||
annotations.map(i => {
|
||||
if (i.MeasureData) {
|
||||
const annotation = i.MeasureData
|
||||
cornerstoneTools.annotation.state.addAnnotation(annotation)
|
||||
}
|
||||
})
|
||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||
for (let i = 0; i < this.cells.length; i++) {
|
||||
const viewportId = `canvas-${i}`
|
||||
const viewport = renderingEngine.getViewport(viewportId)
|
||||
viewport.render()
|
||||
}
|
||||
},
|
||||
// 输入标记名称自定义弹窗
|
||||
async customPrompt(isShowCancelButton = true) {
|
||||
try {
|
||||
const that = this
|
||||
// 请输入标记名称
|
||||
const { value } = await this.$prompt(this.$t('trials:noneDicom:message:msg1'))
|
||||
let message = this.$t('trials:noneDicom:message:msg1')
|
||||
// if (isShowCancelButton) {
|
||||
// message = `<div><p>${this.$t('trials:noneDicom:message:msg1')}</p><p style='font-size:12px' class='customPromptTip'>${this.$t('trials:noneDicom:message:saveTip')}</p></div>`
|
||||
// }
|
||||
const { value } = await this.$prompt(message, '', {
|
||||
showClose: false,
|
||||
cancelButtonText: isShowCancelButton ? this.$t('trials:reading:button:temporarySave') : this.$t('common:button:cancel'),
|
||||
confirmButtonText: isShowCancelButton ? this.$t('trials:reading:button:enduringSave') : this.$t('trials:reading:button:relevancy'),
|
||||
// showCancelButton: isShowCancelButton,
|
||||
// dangerouslyUseHTMLString: isShowCancelButton,
|
||||
inputValidator: (res) => {
|
||||
if (!res) {
|
||||
return isShowCancelButton ? this.$t('trials:noneDicom:message:saveTip') : this.$t('trials:noneDicom:message:saveTipByRelevancy')
|
||||
}
|
||||
},
|
||||
inputErrorMessage: this.$t('trials:noneDicom:message:saveTip'),
|
||||
showCancelButton: true,
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false,
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
const value = instance.inputValue
|
||||
if (!value) {
|
||||
that.$message.error(this.$t('trials:customReading:error:validMarkName1'))
|
||||
} else if (this.validMarkName(value)) {
|
||||
that.$message.error(this.$t('trials:customReading:error:validMarkName'))
|
||||
} else {
|
||||
done()
|
||||
}
|
||||
} else {
|
||||
done()
|
||||
}
|
||||
}
|
||||
})
|
||||
return value
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return null
|
||||
}
|
||||
},
|
||||
validMarkName(markName) {
|
||||
const annotations = cornerstoneTools.annotation.state.getAllAnnotations()
|
||||
const i = annotations.findIndex(i => i.visitTaskId === this.taskInfo.VisitTaskId && i.data.label === markName)
|
||||
return i > -1
|
||||
},
|
||||
// 滚动条
|
||||
clickSlider(e, index) {
|
||||
const height = e.offsetY * 100 / this.$refs[`sliderBox-${index}`][0].clientHeight
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@
|
|||
@toggleTask="toggleTask"
|
||||
@toggleImage="toggleImage"
|
||||
/> -->
|
||||
<file-viewer ref="fileViewer" :related-study-info="relatedStudyInfo" :ps-arr="psArr"
|
||||
<file-viewer ref="fileViewer" :related-study-info="relatedStudyInfo" :ps-arr="psArr" :ecrf="ecrf"
|
||||
@toggleTaskByViewer="toggleTaskByViewer" @toggleTask="toggleTask" @toggleImage="toggleImage"
|
||||
@previewCD="previewCD" @setPS="setPS" />
|
||||
@previewCD="previewCD" @setPS="setPS" @getEcrf="getEcrf" />
|
||||
</div>
|
||||
<!-- 表单 -->
|
||||
<div class="right-panel">
|
||||
<div v-if="taskInfo && taskInfo.IsReadingShowSubjectInfo" class="text-info">
|
||||
<!-- <div v-if="taskInfo && taskInfo.IsReadingShowSubjectInfo" class="text-info">
|
||||
<h3>
|
||||
<span v-if="currentVisitInfo && currentVisitInfo.SubjectCode">
|
||||
{{ currentVisitInfo.SubjectCode }}
|
||||
|
|
@ -50,15 +50,20 @@
|
|||
{{ currentVisitInfo.TaskBlindName }}
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <ecrf-list
|
||||
v-if="currentVisitInfo"
|
||||
:visit-task-info="currentVisitInfo"
|
||||
/> -->
|
||||
<customize-question-list v-if="currentVisitInfo.VisitTaskId" :ref="`ecrf_1`" :reading-task-state="1"
|
||||
:visit-info="currentVisitInfo" @resetAnnotations="resetAnnotations" @setReadingTaskState="setReadingTaskState"
|
||||
@viewCustomAnnotationSeries="viewCustomAnnotationSeries" @getCustomScreenshots="getCustomScreenshots"
|
||||
@setReadingToolActive="setReadingToolActive" @setReadingToolPassive="setReadingToolPassive" />
|
||||
<div v-for="s in visitTaskList" v-show="lastViewportTaskId === s.VisitTaskId" :key="s.VisitTaskId"
|
||||
style="height: 100%;">
|
||||
<customize-question-list v-if="lastViewportTaskId" :ref="`ecrf_${s.VisitTaskId}`" :isNoneDicom="true"
|
||||
:reading-task-state="readingTaskState" :visit-info="currentVisitInfo" @resetAnnotations="resetAnnotations"
|
||||
@setReadingTaskState="setReadingTaskState" @viewCustomAnnotationSeries="viewCustomAnnotationSeries"
|
||||
@getCustomScreenshots="getCustomScreenshots" @setReadingToolActive="setReadingToolActive"
|
||||
@setReadingToolPassive="setReadingToolPassive" @setSaved="setSaved"
|
||||
@setIsHaveBindingQuestion="setIsHaveBindingQuestion" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog :visible.sync="clinicalDataVisible"
|
||||
|
|
@ -125,7 +130,11 @@ export default {
|
|||
isClinicalDataFullscreen: false,
|
||||
trialId: '',
|
||||
cdVisitTaskId: '',
|
||||
psArr: []
|
||||
psArr: [],
|
||||
readingTaskState: 0,
|
||||
ecrf: {
|
||||
IsHaveBindingQuestion: false
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -147,29 +156,73 @@ export default {
|
|||
mounted() {
|
||||
this.taskInfo = JSON.parse(localStorage.getItem('taskInfo'))
|
||||
this.trialId = this.$route.query.trialId
|
||||
this.readingTaskState = this.taskInfo.ReadingTaskState
|
||||
this.getRelatedTask()
|
||||
},
|
||||
methods: {
|
||||
resetAnnotations() { },
|
||||
setReadingTaskState() { },
|
||||
viewCustomAnnotationSeries() { },
|
||||
getCustomScreenshots() { },
|
||||
setReadingToolPassive() { },
|
||||
getEcrf(data) {
|
||||
let { type } = data
|
||||
if (type === 'getOperateStateEnum') {
|
||||
this.ecrf.operateStateEnum = this.$refs[`ecrf_${data.VisitTaskId}`][0].operateStateEnum
|
||||
}
|
||||
if (type === 'bindAnnotationToQuestion') {
|
||||
this.$refs[`ecrf_${data.VisitTaskId}`][0].bindAnnotationToQuestion(data.annotation)
|
||||
}
|
||||
if (type === 'updateAnnotationToQuestion') {
|
||||
this.$refs[`ecrf_${data.VisitTaskId}`][0].updateAnnotationToQuestion(data.annotation)
|
||||
}
|
||||
if (type === 'verifyAnnotationIsBound') {
|
||||
this.ecrf.isBound = this.$refs[`ecrf_${data.VisitTaskId}`][0].verifyAnnotationIsBound(data.annotation)
|
||||
}
|
||||
if (type === 'getQuestions') {
|
||||
this.ecrf.isBound = this.$refs[`ecrf_${data.VisitTaskId}`][0].getQuestions()
|
||||
}
|
||||
},
|
||||
setSaved(saved) {
|
||||
this.$refs.fileViewer.lengthscaleToolDisabled(saved)
|
||||
},
|
||||
setIsHaveBindingQuestion(flag) {
|
||||
this.ecrf.IsHaveBindingQuestion = flag
|
||||
},
|
||||
async resetAnnotations(visitTaskId) {
|
||||
if (this.readingTaskState === 2) return
|
||||
const taskIdx = this.visitTaskList.findIndex(i => i.VisitTaskId === visitTaskId)
|
||||
if (taskIdx === -1) return
|
||||
if (!this.visitTaskList[taskIdx].IsCurrentTask) return
|
||||
// 获取标注信息
|
||||
let res = await getNoneDicomMarkListOutDto({ visitTaskId: visitTaskId })
|
||||
|
||||
const annotations = res.Result.NoneDicomMarkList.map(i => {
|
||||
if (typeof i.MeasureData === 'string' && i.MeasureData) {
|
||||
i.MeasureData = JSON.parse(i.MeasureData)
|
||||
i.MeasureData.markId = i.MarkId
|
||||
i.MeasureData.id = i.Id
|
||||
}
|
||||
this.psArr = []
|
||||
if (i.MeasureData.metadata.toolName === 'Lengthscale' && this.psArr.findIndex(p => p.NoneDicomFileId === i.NoneDicomFileId) === -1) {
|
||||
this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps, OldPS: i.MeasureData.data.ps })
|
||||
}
|
||||
return i
|
||||
})
|
||||
this.$set(this.visitTaskList[taskIdx], 'Annotations', annotations)
|
||||
// this.$refs.fileViewer.resetAnnotations({ annotations, visitTaskId })
|
||||
},
|
||||
setReadingTaskState(state) {
|
||||
this.readingTaskState = state
|
||||
},
|
||||
viewCustomAnnotationSeries(obj) {
|
||||
this.$refs.fileViewer.viewCustomAnnotation(obj)
|
||||
},
|
||||
getCustomScreenshots(obj, callback) {
|
||||
this.$refs.fileViewer.getScreenshots(obj, callback)
|
||||
},
|
||||
setReadingToolPassive() {
|
||||
this.$refs.fileViewer.setToolsPassive()
|
||||
},
|
||||
setReadingToolActive(toolName) {
|
||||
if (this.readingTaskState === 2) return
|
||||
if (this.activeTool === toolName) return
|
||||
const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series
|
||||
if (series && series.TaskInfo.VisitTaskId && series.TaskInfo.VisitTaskId === this.taskInfo.VisitTaskId) {
|
||||
const toolGroupId = `${this.viewportKey}-${this.activeViewportIndex}`
|
||||
const toolGroup = ToolGroupManager.getToolGroup(toolGroupId)
|
||||
if (this.activeTool) {
|
||||
toolGroup.setToolPassive(this.activeTool)
|
||||
}
|
||||
toolGroup.setToolActive(toolName, {
|
||||
bindings: [{ mouseButton: MouseBindings.Primary }]
|
||||
})
|
||||
this.activeTool = toolName
|
||||
}
|
||||
this.$refs.fileViewer.setToolActive(toolName)
|
||||
},
|
||||
// 获取关联任务信息
|
||||
async getRelatedTask() {
|
||||
|
|
@ -254,9 +307,11 @@ export default {
|
|||
const arr = res.Result.NoneDicomMarkList.map(i => {
|
||||
if (typeof i.MeasureData === 'string') {
|
||||
i.MeasureData = JSON.parse(i.MeasureData)
|
||||
i.MeasureData.markId = i.MarkId
|
||||
i.MeasureData.id = i.Id
|
||||
}
|
||||
if (i.MeasureData.metadata.toolName === 'Lengthscale' && this.psArr.findIndex(p => p.NoneDicomFileId === i.NoneDicomFileId) === -1) {
|
||||
this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps })
|
||||
this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps, OldPS: i.MeasureData.data.ps })
|
||||
}
|
||||
return i
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue