自定义标准更改

main
caiyiling 2025-05-29 09:57:02 +08:00
parent d77c79acbd
commit d73970117d
4 changed files with 1786 additions and 4 deletions

View File

@ -1427,8 +1427,9 @@ export default {
} }
this.saveCustomAnnotation(annotation) this.saveCustomAnnotation(annotation)
} }
this.$refs[`ecrf_${series.TaskInfo.VisitTaskId}`][0].bindAnnotationToQuestion(annotation)
} }
this.setToolsPassive() this.setToolsPassive()
}, },
validMarkName(markName) { validMarkName(markName) {
@ -1468,6 +1469,7 @@ export default {
const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series
if (series && series.TaskInfo.VisitTaskId && series.TaskInfo.VisitTaskId === this.taskInfo.VisitTaskId) { if (series && series.TaskInfo.VisitTaskId && series.TaskInfo.VisitTaskId === this.taskInfo.VisitTaskId) {
this.saveCustomAnnotation(annotation) this.saveCustomAnnotation(annotation)
this.$refs[`ecrf_${series.TaskInfo.VisitTaskId}`][0].updateAnnotationToQuestion(annotation)
} }
this.setToolsPassive() this.setToolsPassive()
}, },
@ -1501,7 +1503,7 @@ export default {
} else { } else {
throw 'annotation Not allowed to operate' throw 'annotation Not allowed to operate'
} }
}catch(e){ } catch (e) {
cornerstoneTools.annotation.state.addAnnotation(annotation) cornerstoneTools.annotation.state.addAnnotation(annotation)
const renderingEngine = getRenderingEngine(renderingEngineId) const renderingEngine = getRenderingEngine(renderingEngineId)
for (let i = 0; i < this.cells.length; i++) { for (let i = 0; i < this.cells.length; i++) {

View File

@ -32,9 +32,12 @@
:reading-task-state="readingTaskState" :reading-task-state="readingTaskState"
:criterion-id="criterionId" :criterion-id="criterionId"
:calculation-list="calculationList" :calculation-list="calculationList"
:questionMarkInfoList="questionMarkInfoList"
:is-baseline="isBaseLineTask" :is-baseline="isBaseLineTask"
@resetFormItemData="resetFormItemData" @resetFormItemData="resetFormItemData"
@setFormItemData="setFormItemData" @setFormItemData="setFormItemData"
@getQuestions="getQuestions"
@operateImageMarker="operateImageMarker"
/> />
</template> </template>
@ -77,7 +80,7 @@
import { getCustomTableQuestionAnswer, changeDicomReadingQuestionAnswer, submitVisitTaskQuestionsInDto, getQuestionCalculateRelation } from '@/api/trials' import { getCustomTableQuestionAnswer, changeDicomReadingQuestionAnswer, submitVisitTaskQuestionsInDto, getQuestionCalculateRelation } from '@/api/trials'
import { setSkipReadingCache, resetReadingTask } from '@/api/reading' import { setSkipReadingCache, resetReadingTask } from '@/api/reading'
import const_ from '@/const/sign-code' import const_ from '@/const/sign-code'
import QuestionFormItem from '@/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem' import QuestionFormItem from './QuestionFormItem'
import SignForm from '@/views/trials/components/newSignForm' import SignForm from '@/views/trials/components/newSignForm'
export default { export default {
name: 'EcrfList', name: 'EcrfList',
@ -112,7 +115,11 @@ export default {
calculationList: [], calculationList: [],
taskInfo: null, taskInfo: null,
isBaseLineTask: false, isBaseLineTask: false,
rerender: true rerender: true,
questionMarkInfoList: [],
operateStateEnum: null, // 12345
operateQuestionId: '',
operateRowId: ''
} }
}, },
mounted() { mounted() {
@ -153,6 +160,7 @@ export default {
} }
}) })
this.questions = res.Result.SinglePage this.questions = res.Result.SinglePage
this.questionMarkInfoList = res.OtherInfo.QuestionMarkInfoList
this.loading = false this.loading = false
} }
} catch (e) { } catch (e) {
@ -325,6 +333,56 @@ export default {
} }
}) })
}, },
operateImageMarker(obj) {
if (obj.operateStateEnum === 1) {
//
} else if (obj.operateStateEnum === 2) {
//
this.$emit('')
} else if (obj.operateStateEnum === 3) {
//
} else if (obj.operateStateEnum === 4) {
//
} else if (obj.operateStateEnum === 5) {
//
}
this.operateStateEnum = obj.operateStateEnum
this.operateQuestionId = obj.question.Id
},
bindAnnotationToQuestion(annotation) {
console.log('bindAnnotationToQuestion', annotation)
if (this.operateStateEnum === 1 && this.operateQuestionId) {
let i = this.questionMarkInfoList.findIndex(i=>i.questionId === this.operateQuestionId)
if (i === -1) {
let markInfo = {
id: '',
questionId: this.operateQuestionId,
instanceId: annotation.instanceId,
seriesId: annotation.seriesId,
studyId: annotation.studyId,
markTool: '',
picturePath: '',
numberOfFrames: '',
measureData: annotation
}
this.questionMarkInfoList.push(markInfo)
} else {
this.questionMarkInfoList[i].instanceId = annotation.instanceId
this.questionMarkInfoList[i].seriesId = annotation.seriesId
this.questionMarkInfoList[i].studyId = annotation.studyId
this.questionMarkInfoList[i].markTool = ''
this.questionMarkInfoList[i].picturePath = ''
this.questionMarkInfoList[i].numberOfFrames = ''
this.questionMarkInfoList[i].measureData = annotation
}
}
},
updateAnnotationToQuestion(annotation) {
let i = this.questionMarkInfoList.findIndex(i=>i.measureData && i.measureData.annotationUID === annotation.annotationUID)
if (i === -1) return
this.questionMarkInfoList[i].measureData = annotation
},
async resetForm() { async resetForm() {
const confirm = await this.$confirm( const confirm = await this.$confirm(
this.$t('trials:dicomReading:message:confirmReset1'), this.$t('trials:dicomReading:message:confirmReset1'),

View File

@ -0,0 +1,576 @@
<template>
<div class="criterion-form-item">
<el-form-item
v-if="(question.ShowQuestion===1 && !!~question.ParentTriggerValueList.indexOf(questionForm[question.ParentId])) || question.ShowQuestion===0"
:label="`${question.QuestionName}`"
:prop="question.Id"
:rules="[
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && !!~question.RelevanceValueList.indexOf(questionForm[question.RelevanceId]))) && question.Type!=='group' && question.Type!=='summary',
message: $t('common:ruleMessage:select'), trigger: ['blur', 'change']},
]"
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
>
<!-- 输入框 -->
<el-input
v-if="question.Type==='input'"
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
/>
<!-- 多行文本输入框 -->
<el-input
v-if="question.Type==='textarea'"
v-model="questionForm[question.Id]"
type="textarea"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
:autosize="{ minRows: 2, maxRows: 4}"
/>
<!-- 下拉框 -->
<el-select
v-if="question.Type==='select'"
v-model="questionForm[question.Id]"
clearable
:disabled="(question.TableQuestionType === 2 || question.QuestionGenre === 2) || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemChange(val, question)})"
>
<template v-if="question.TableQuestionType === 1">
<el-option
v-for="item in organList"
:key="item.Id"
:label="item[question.DataTableColumn]"
:value="item[question.DataTableColumn]"
/>
</template>
<template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3">
<el-option
v-for="item of $d[question.DictionaryCode]"
:key="item.id"
:value="item.value"
:label="item.label"
/>
</template>
<template v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
<el-option
v-for="item of $d[question.DictionaryCode]"
:key="item.id"
:value="item.value"
:label="item.label"
/>
</template>
<template v-else>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
:value="val"
/>
</template>
</el-select>
<!-- 单选 -->
<el-radio-group
v-if="question.Type==='radio'"
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemChange(val, question)})"
>
<el-radio
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
>
{{ val }}
</el-radio>
</el-radio-group>
<!-- 复选框 -->
<el-checkbox-group
v-if="question.Type==='checkbox'"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
v-model="questionForm[question.Id]"
>
<el-checkbox
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
>
{{ val }}
</el-checkbox>
</el-checkbox-group>
<!-- 自动分类 -->
<el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]"
/>
<el-select
v-if="question.Type === 'class' && question.ClassifyShowType === 2"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType"
@change="(val) => { formItemChange(val, question) }"
>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
:value="val.trim()"
/>
</el-select>
<el-radio-group
v-if="question.Type === 'class' && question.ClassifyShowType === 3"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType"
@change="(val) => { formItemChange(val, question) }"
>
<el-radio
v-for="item of question.TypeValue.split('|')"
:key="item.trim()"
:label="item.trim()"
>
{{ item.trim() }}
</el-radio>
</el-radio-group>
<!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-input
v-if="question.Type==='calculation'"
v-model="questionForm[question.Id]"
oninput="value=value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')"
disabled
/>
<!-- 自增 -->
<el-input
v-if="question.Type==='increment'"
v-model="questionForm[question.Id]"
disabled
/>
<!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-input
type="number"
v-if="question.Type === 'number' && question.DataSource !== 1"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemNumberChange(val, question)})"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
v-model="questionForm[question.Id]"
>
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
</el-input>
<el-input
type="number"
v-if="question.Type === 'number' && question.DataSource === 1"
:disabled="question.DataSource === 1"
@blur="handleCalculationBlur(calculationValue)"
v-model="calculationValue"
>
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
</el-input>
<!-- 上传图像 -->
<el-upload
v-if="question.Type==='upload'"
action
:accept="question.FileType"
:limit="question.ImageCount === 0 ? 100 : question.ImageCount"
:on-preview="handlePictureCardPreview"
:before-upload="handleBeforeUpload"
:http-request="uploadScreenshot"
list-type="picture-card"
:on-remove="handleRemove"
:file-list="fileList"
:class="{disabled: question.ImageCount === 0 ? false : fileList.length >= question.ImageCount}"
>
<i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}">
<viewer
:ref="file.url"
:images="[imageUrl]"
style="
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
"
>
<img
class="el-upload-list__item-thumbnail"
:src="OSSclientConfig.basePath + file.url"
crossOrigin="anonymous"
alt=""
style="max-width: 100%; max-height: 100%"
/>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in" />
</span>
<span
v-if="readingTaskState < 2"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete" />
</span>
</span>
</viewer>
</div>
</el-upload>
<el-dialog
v-if="question.Type==='upload'"
append-to-body
:visible.sync="imgVisible"
width="600px"
>
<el-image :src="imageUrl" width="100%">
<div slot="placeholder" class="image-slot">
{{$t('trials:readingUnit:qsList:message:loading')}}<span class="dot">...</span>
</div>
</el-image>
</el-dialog>
</el-form-item>
</div>
</template>
<script>
export default {
name: 'QuestionTableFormItem',
props: {
isBaseline: {
type: Boolean,
required: true
},
questionForm: {
type: Object,
default() {
return {}
}
},
question: {
type: Object,
default() {
return []
}
},
criterionId: {
type: String,
required: true
},
calculationList: {
type: Array,
default() {
return []
}
},
readingTaskState: {
type: Number,
required: true
},
visitTaskId: {
type: String,
default: ''
},
type: {
type: String,
default: 'add'
}
},
computed: {
calculationValue: {
get() {
return this.questionForm[this.question.Id]
},
set() {
}
}
},
data() {
return {
addOrEdit: { visible: false, title: '' },
fileList: [],
accept: '.png,.jpg,.jpeg',
imgVisible: false,
imageUrl: '',
urls: [],
organList: [],
QuestionsList: [],
QuestionsForm: {},
digitPlaces: 2
}
},
watch: {
questionForm: {
deep: true,
immediate: true,
handler(v, oldv) {
// try {
// if (!v[this.question.Id] || !oldv[this.question.Id]) return
// } catch (e) {
// }
// this.formItemNumberChange(this.question.Id, false)
}
},
},
mounted() {
var digitPlaces = Number(localStorage.getItem('digitPlaces'))
this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces
if (this.question.Type === 'upload') {
if (this.questionForm[this.question.Id]) {
this.urls = this.questionForm[this.question.Id].split('|')
this.fileList = []
this.urls.map(url => {
this.fileList.push({ name: '', url: `${url}` })
})
}
}
if (this.type === 'edit') return
},
methods: {
save() {
},
openAddTableCol(row) {
this.addOrEdit.visible = true
this.addOrEdit.title = row.QuestionName + this.$t('trials:readingUnit:qsList:title:tableQs')
this.QuestionsList = row.TableQuestions.Questions
this.AnswersList = row.TableQuestions.Answers
this.QuestionsForm = {}
},
formItemChange(v, question) {
if (question.Childrens && question.Childrens.length > 0) {
this.resetChild(question.Childrens)
}
if (question.TableQuestionType === 1 && question.RelationQuestions.length > 0) {
var index = this.organList.findIndex(item => item[question.DataTableColumn] === v)
if (index < 0) return
var selected = this.organList[index]
this.question.RelationQuestions.map(qs => {
var val = selected[qs.DataTableColumn]
// if (typeof val === 'boolean') {
// // val = String(val)
// }
this.$emit('setFormItemData', { key: qs.Id, val: val, question: qs })
})
} else {
this.$emit('setFormItemData', { key: question.Id, val: v, question: question })
}
},
handleBlur(value, a, b) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
},
handleCalculationBlur(v) {
this.calculationValue = parseFloat(v).toFixed(this.digitPlaces)
},
limitInput(value, q) {
if (value.indexOf('.') > -1) {
if (value.split('.')[1].length >= this.digitPlaces) {
this.$set(this.questionForm, q.Id, parseFloat(value).toFixed(this.digitPlaces))
}
} else {
}
},
logic(rules, num = 0) {
try {
if (rules.CalculateQuestionList.length === 0) {
return false
}
let dataArr = []
var count = 0
var maxList = [], minList = []
rules.CalculateQuestionList.forEach((o, i) => {
if (rules.CustomCalculateMark > 4 && rules.CustomCalculateMark < 10) {
if (i !== 0) {
switch (rules.CustomCalculateMark) {
case 7:
count += parseFloat(this.questionForm[o.TableQuestionId])
if (i === rules.CalculateQuestionList.length - 1) {
num = count / rules.CalculateQuestionList.length
}
break;
case 8:
maxList.push(this.questionForm[o.TableQuestionId])
if (i === rules.CalculateQuestionList.length - 1) {
num = Math.max(...maxList)
}
break;
case 9:
minList.push(this.questionForm[o.TableQuestionId])
if (i === rules.CalculateQuestionList.length - 1) {
num = Math.min(...minList)
}
break;
}
} else {
maxList.push(this.questionForm[o.TableQuestionId])
minList.push(this.questionForm[o.TableQuestionId])
count = parseFloat(this.questionForm[o.TableQuestionId])
num = parseFloat(this.questionForm[o.TableQuestionId])
dataArr.push(num)
}
} else {
if (i !== 0) {
switch (rules.CustomCalculateMark) {
case 1:
num += parseFloat(this.questionForm[o.TableQuestionId])
break;
case 2:
num -= parseFloat(this.questionForm[o.TableQuestionId])
break;
case 3:
num *= parseFloat(this.questionForm[o.TableQuestionId])
break;
case 4:
if (parseFloat(this.questionForm[o.TableQuestionId]) === 0) {
num = 0
} else {
num /= parseFloat(this.questionForm[o.TableQuestionId])
}
break;
case 10:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0);
}, 0) / dataArr.length;
break;
case 11:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.max(...dataArr);
break;
case 12:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.min(...dataArr);
break;
}
} else {
num = parseFloat(this.questionForm[o.TableQuestionId])
}
}
})
} catch (e) {
console.log(e)
}
if (rules.ValueType === 2) {
num = num * 100
}
return num.toFixed(this.digitPlaces)
},
formItemNumberChange(v, question) {
this.$emit('formItemTableNumberChange', v, question)
// this.$emit('formItemTableNumberChange', v, question)
},
resetChild(obj) {
obj.forEach(i => {
this.$emit('resetFormItemData', i.Id)
if (i.Childrens && i.Childrens.length > 0) {
this.resetChild(i.Childrens)
}
})
},
resetFormItemData(v) {
this.$emit('resetFormItemData', v)
},
setFormItemData(obj) {
this.$emit('setFormItemData', obj)
},
async uploadScreenshot(param) {
if (!this.visitTaskId) return
const loading = this.$loading({
target: document.querySelector('.el-dialog'),
fullscreen: false,
lock: true,
text: 'Loading',
spinner: 'el-icon-loading'
})
var trialId = this.$route.query.trialId
var subjectId = this.$route.query.trialId
var file = await this.fileToBlob(param.file)
const res = await this.OSSclient.put(`/${trialId}/Read/${subjectId}/Visit/${param.file.name}`, file)
this.fileList.push({ name: param.file.name, path: this.$getObjectName(res.url), url: this.$getObjectName(res.url)})
this.urls.push(this.$getObjectName(res.url))
this.$emit('setFormItemData', { key:this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
loading.close()
},
handleBeforeUpload(file) {
//
if (this.checkFileSuffix(file.name)) {
// this.fileList = []
return true
} else {
let msg = this.$t(
"trials:readingUnit:qsList:message:imageFormat"
).replace("xxx", this.question.FileType)
this.$alert(msg)
return false
}
},
checkFileSuffix(fileName) {
var index = fileName.lastIndexOf('.')
var suffix = fileName.substring(index + 1, fileName.length)
if (this.question.FileType.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1) {
return false
} else {
return true
}
},
//
handlePictureCardPreview(file) {
var suffix = file.url.substring(file.url.lastIndexOf(".")+1)
suffix = suffix ? suffix.toLowerCase() : ''
if (suffix === 'doc' || suffix === 'docx' || suffix === 'pdf'){
window.open(this.OSSclientConfig.basePath + file.url,'_blank')
}else{
this.imageUrl = this.OSSclientConfig.basePath + file.url
// this.imgVisible = true
this.$refs[file.url].$viewer.show()
}
},
//
handleRemove(file, fileList) {
this.imageUrl = ''
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
this.urls.splice(this.fileList.findIndex(f => f === file.url), 1)
this.$emit('setFormItemData', { key:this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
}
}
}
</script>
<style lang="scss" scoped>
.my_dialog{
.criterion-form-item{
::v-deep .el-form-item__content{
width: auto;
}
}
}
.criterion-form-item{
.el-form-item{
display: flex;
flex-direction: row;
align-items: flex-start;
}
::v-deep .el-form-item__content{
width: 500px;
}
.el-input{
width:100%;
}
.mb{
margin-bottom: 0px;
}
.disabled{
::v-deep .el-upload--picture-card {
display: none;
}
}
.uploadWrapper{
display: flex;
flex-direction: column;
align-items: flex-start;
}
}
</style>