非dicom阅片更改

uat_us
caiyiling 2024-11-12 13:19:12 +08:00
parent 041c23daf6
commit d866153ccc
3 changed files with 285 additions and 64 deletions

View File

@ -158,6 +158,7 @@
<el-input <el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 1" v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType"
/> />
<el-select <el-select
v-if="question.Type === 'class' && question.ClassifyShowType === 2" v-if="question.Type === 'class' && question.ClassifyShowType === 2"
@ -191,6 +192,7 @@
type="number" type="number"
:disabled="!question.ClassifyEditType" :disabled="!question.ClassifyEditType"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }"
/> />
<!-- 自动计算 --> <!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
@ -225,7 +227,7 @@
type="number" type="number"
v-if="question.Type === 'number' && question.DataSource !== 1" v-if="question.Type === 'number' && question.DataSource !== 1"
@change="(val) => { formItemNumberChange(val, question) }" @change="(val) => { formItemNumberChange(val, question) }"
onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));console.log(localStorage.getItem('digitPlaces'))" onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));"
@input="limitInput($event, questionForm, question.Id)" @input="limitInput($event, questionForm, question.Id)"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
> >
@ -235,7 +237,7 @@
<el-input <el-input
type="number" type="number"
v-if="question.Type === 'number' && question.DataSource === 1" v-if="question.Type === 'number' && question.DataSource === 1"
onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));console.log(localStorage.getItem('digitPlaces'))" onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));"
@input="limitInput($event, questionForm, question.Id)" @input="limitInput($event, questionForm, question.Id)"
:disabled="question.DataSource === 1" :disabled="question.DataSource === 1"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
@ -467,11 +469,9 @@ export default {
if (value.split('.')[1].length >= this.digitPlaces) { if (value.split('.')[1].length >= this.digitPlaces) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
} }
} else {
} }
}, },
deleteTableCol(row, index) { deleteTableCol(row, index) {
console.log(row)
this.$confirm(this.$t('trials:uploadNonDicoms:message:msg1')).then(() => { this.$confirm(this.$t('trials:uploadNonDicoms:message:msg1')).then(() => {
const loading = this.$loading({ fullscreen: true }) const loading = this.$loading({ fullscreen: true })
var param = { var param = {
@ -551,7 +551,6 @@ export default {
for (const k in this.QuestionsForm) { for (const k in this.QuestionsForm) {
if (reg.test(k)) { if (reg.test(k)) {
if (answers.findIndex(i => i.tableQuestionId === k) === -1) { if (answers.findIndex(i => i.tableQuestionId === k) === -1) {
console.log(this.QuestionsForm)
answers.push({ tableQuestionId: k, answer: this.QuestionsForm[k] }) answers.push({ tableQuestionId: k, answer: this.QuestionsForm[k] })
} }
} }
@ -864,7 +863,6 @@ export default {
this.QuestionsForm = {} this.QuestionsForm = {}
} else { } else {
this.addOrEdit.type = 'edit' this.addOrEdit.type = 'edit'
console.log(this.questionForm)
this.QuestionsForm = Object.assign({}, this.questionForm[row.Id][index]) this.QuestionsForm = Object.assign({}, this.questionForm[row.Id][index])
} }
}, },
@ -917,7 +915,6 @@ export default {
}, },
async uploadScreenshot(param) { async uploadScreenshot(param) {
console.log('uploadScreenshot')
if (!this.visitTaskId) return if (!this.visitTaskId) return
const loading = this.$loading({ const loading = this.$loading({
target: document.querySelector('.ecrf-wrapper'), target: document.querySelector('.ecrf-wrapper'),
@ -930,7 +927,6 @@ export default {
let file = await this.fileToBlob(param.file) let file = await this.fileToBlob(param.file)
let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Customize/${this.visitTaskId}/${fileName}`, file) let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Customize/${this.visitTaskId}/${fileName}`, file)
this.fileList.push({ name: `${this.$t('trials:emailManageCfg:title:fileName')}${this.fileList.length + 1}`, url: this.$getObjectName(res.url) }) this.fileList.push({ name: `${this.$t('trials:emailManageCfg:title:fileName')}${this.fileList.length + 1}`, url: this.$getObjectName(res.url) })
console.log('fileList', this.fileList)
this.urls.push(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 }) this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
loading.close() loading.close()
@ -947,7 +943,6 @@ export default {
}, },
handleBeforeUpload(file, accept) { handleBeforeUpload(file, accept) {
// //
console.log('handleBeforeUpload', file)
if (this.checkFileSuffix(file.name, accept) || accept === '-1') { if (this.checkFileSuffix(file.name, accept) || accept === '-1') {
return true return true
} else { } else {
@ -955,7 +950,6 @@ export default {
this.$alert(msg) this.$alert(msg)
return false return false
} }
console.log(file)
}, },
checkFileSuffix(fileName, accept) { checkFileSuffix(fileName, accept) {
var index = fileName.lastIndexOf('.') var index = fileName.lastIndexOf('.')
@ -982,7 +976,6 @@ export default {
}, },
// //
handleRemove(file, fileList) { handleRemove(file, fileList) {
console.log('handleRemove')
if (file && file.status === "success") { if (file && file.status === "success") {
this.imageUrl = '' this.imageUrl = ''
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1) this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)

View File

@ -55,6 +55,7 @@
:question-form="questionForm" :question-form="questionForm"
:reading-task-state="readingTaskState" :reading-task-state="readingTaskState"
:visit-task-id="visitTaskId" :visit-task-id="visitTaskId"
:calculation-list="calculationList"
@setFormItemData="setFormItemData" @setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData" @resetFormItemData="resetFormItemData"
/> />
@ -110,7 +111,7 @@
<script> <script>
import { getTrialReadingQuestion, saveVisitTaskQuestions, submitVisitTaskQuestionsInDto } from '@/api/trials' import { getTrialReadingQuestion, saveVisitTaskQuestions, submitVisitTaskQuestionsInDto, getQuestionCalculateRelation } from '@/api/trials'
import { setSkipReadingCache } from '@/api/reading' import { setSkipReadingCache } from '@/api/reading'
import const_ from '@/const/sign-code' import const_ from '@/const/sign-code'
import FormItem from './FormItem' import FormItem from './FormItem'
@ -158,10 +159,12 @@ export default {
readingTaskState: 0, readingTaskState: 0,
activeName: 0, activeName: 0,
formType: null, formType: null,
classArr: [] classArr: [],
calculationList: []
} }
}, },
mounted() { mounted() {
this.getQuestionCalculateRelation()
this.getQuestions() this.getQuestions()
DicomEvent.$on('refreshQuestionAnswer', _ => { DicomEvent.$on('refreshQuestionAnswer', _ => {
this.getQuestions() this.getQuestions()
@ -212,7 +215,6 @@ export default {
this.publicQuestions = res.Result.PublicPage this.publicQuestions = res.Result.PublicPage
} }
} else { } else {
console.log(1111)
res.Result.SinglePage.map((v) => { res.Result.SinglePage.map((v) => {
if (v.Type === 'group' && v.Childrens.length === 0) return if (v.Type === 'group' && v.Childrens.length === 0) return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary') { if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary') {
@ -226,7 +228,6 @@ export default {
} }
}) })
this.questions = res.Result.SinglePage this.questions = res.Result.SinglePage
console.log(this.questions)
} }
this.isRender = true this.isRender = true
} }
@ -248,6 +249,14 @@ export default {
} }
}) })
}, },
async getQuestionCalculateRelation() {
try {
let res = await getQuestionCalculateRelation({TrialReadingCriterionId: this.criterionId})
this.calculationList = res.Result
} catch(e) {
console.log(e)
}
},
async handleSave() { async handleSave() {
const valid = await this.$refs['questions'].validate() const valid = await this.$refs['questions'].validate()
if (!valid) return if (!valid) return
@ -356,13 +365,12 @@ export default {
this.questionForm[v] = null this.questionForm[v] = null
}, },
setFormItemData(obj) { setFormItemData(obj) {
this.$set(this.questionForm, obj.key, obj.val) this.$set(this.questionForm, obj.key, JSON.parse(JSON.stringify(obj.val)))
if (this.classArr.length > 0) { this.classArr.map(i=>{
let qs = this.classArr.find(i=>i.triggerId === obj.key) if (i.triggerId === obj.key) {
if (!qs) return
let answer = null let answer = null
let list = JSON.parse(qs.classifyAlgorithms) let list = JSON.parse(i.classifyAlgorithms)
if (qs.classifyType === 0) { if (i.classifyType === 0) {
let o = list.find(v => { let o = list.find(v => {
return ( return (
parseFloat(obj.val) >= parseFloat(v.gt) && parseFloat(obj.val) >= parseFloat(v.gt) &&
@ -370,14 +378,15 @@ export default {
) )
}) })
answer = o ? o.label : null answer = o ? o.label : null
} else if (qs.classifyType === 1) { } else if (i.classifyType === 1) {
let o = list.find(v => { let o = list.find(v => {
return v.val.includes(obj.val) return v.val.includes(obj.val)
}) })
answer = o ? o.label : null answer = o ? o.label : null
} }
this.$set(this.questionForm, qs.classId, answer) this.$set(this.questionForm, i.classId, answer)
} }
})
} }
} }
} }

View File

@ -18,7 +18,7 @@
:label="`${question.QuestionName}`" :label="`${question.QuestionName}`"
:prop="question.Id" :prop="question.Id"
:rules="[ :rules="[
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (questionForm[question.RelevanceId] === question.RelevanceValue))) && question.Type!=='group' && question.Type!=='summary', { required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (question.RelevanceValueList.includes(isNaN(parseFloat(questionForm[question.RelevanceId])) ? questionForm[question.RelevanceId] : questionForm[question.RelevanceId].toString())))) && question.Type!=='group' && question.Type!=='summary',
message: $t('common:ruleMessage:specify'), trigger: ['blur', 'change']}, message: $t('common:ruleMessage:specify'), trigger: ['blur', 'change']},
]" ]"
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']" :class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
@ -121,34 +121,67 @@
<!-- 数值 --> <!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
<template v-if="question.Type==='number'"> <template v-if="question.Type==='number'">
<el-input-number <!-- 数值 -->
v-if="question.ValueType === 0" <el-select
v-if="question.TypeValue"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:precision="0" clearable
:disabled="readingTaskState >= 2" @change="(val) => { formItemNumberChange(val, question) }"
>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
:value="val.trim()"
/> />
<el-input-number </el-select>
v-else-if="question.ValueType === 3" <el-input
type="number"
v-if="question.DataSource !== 1"
@change="(val) => { formItemNumberChange(val, question) }"
onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));"
@input="limitInput($event, questionForm, question.Id)"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="readingTaskState >= 2" >
/> <template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
<el-input-number <template slot="append" v-else-if="question.ValueType === 2">%</template>
v-else-if="question.ValueType === 1 || question.ValueType === 2" </el-input>
<el-input
type="number"
v-if="question.DataSource === 1"
onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));"
@input="limitInput($event, questionForm, question.Id)"
:disabled="question.DataSource === 1"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:precision="digitPlaces" >
:disabled="readingTaskState >= 2" <template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
/> <template slot="append" v-else-if="question.ValueType === 2">%</template>
</el-input>
</template> </template>
<!-- 自动分类 --> <!-- 自动分类 -->
<el-input <el-input
v-if="question.Type === 'class' && !question.TypeValue" v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
disabled :disabled="!question.ClassifyEditType"
/> />
<el-radio-group <el-select
v-if="question.Type === 'class' && question.TypeValue" v-if="question.Type === 'class' && question.ClassifyShowType === 2"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
disabled :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 <el-radio
v-for="item of question.TypeValue.split('|')" v-for="item of question.TypeValue.split('|')"
@ -158,6 +191,13 @@
{{ item.trim() }} {{ item.trim() }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
<el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 4"
type="number"
:disabled="!question.ClassifyEditType"
v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }"
/>
<!-- 上传图像 --> <!-- 上传图像 -->
<el-upload <el-upload
v-if="question.Type==='upload'" v-if="question.Type==='upload'"
@ -219,8 +259,10 @@
:reading-task-state="readingTaskState" :reading-task-state="readingTaskState"
:question-form="questionForm" :question-form="questionForm"
:visit-task-id="visitTaskId" :visit-task-id="visitTaskId"
:calculationList="calculationList"
@setFormItemData="setFormItemData" @setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData" @resetFormItemData="resetFormItemData"
@formItemNumberChange="formItemNumberChange"
/> />
</div> </div>
</template> </template>
@ -248,6 +290,12 @@ export default {
visitTaskId: { visitTaskId: {
type: String, type: String,
default: '' default: ''
},
calculationList: {
type: Array,
default() {
return []
}
} }
}, },
data() { data() {
@ -257,15 +305,24 @@ export default {
imgVisible: false, imgVisible: false,
imageUrl: '', imageUrl: '',
urls: [], urls: [],
digitPlaces: null digitPlaces: null,
} }
}, },
watch: { watch: {
questionForm: { questionForm: {
deep: true, deep: true,
immediate: true, immediate: true,
handler(v) { handler(v, oldv) {
// console.log(v) try {
if (!v || !v[this.question.Id] || !oldv || !oldv[this.question.Id])
return
} catch (e) {
console.log(e, v)
}
if (this.question.Type === 'class') {
this.$emit("setFormItemData", { key: this.question.Id, val: v[this.question.Id], question: v })
}
this.formItemNumberChange(this.question.Id, false)
} }
} }
}, },
@ -276,18 +333,180 @@ export default {
this.fileList = [] this.fileList = []
this.urls.map(url => { this.urls.map(url => {
this.fileList.push({ name: '', url: `/api/${url}` }) this.fileList.push({ name: '', url: `${url}` })
}) })
} }
} }
this.digitPlaces = parseInt(localStorage.getItem('digitPlaces')) this.digitPlaces = localStorage.getItem('digitPlaces') ? parseInt(localStorage.getItem('digitPlaces')) : 0
}, },
methods: { methods: {
limitInput(value, a, b) {
if (value.indexOf('.') > -1) {
if (value.split('.')[1].length >= this.digitPlaces) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
}
}
},
logic(rules, num = 0) {
try {
if (rules.CalculateQuestionList.length === 0) {
return false
}
let dataArr = []
rules.CalculateQuestionList.forEach((o, i) => {
if (i === 0) {
if (rules.CustomCalculateMark > 4 && rules.CustomCalculateMark < 10) {
switch (rules.CustomCalculateMark) {
case 5:
this.questionForm[o.QuestionId].forEach((q, qi) => {
if (qi === 0) {
num = parseFloat(q[o.TableQuestionId])
} else {
num *= parseFloat(q[o.TableQuestionId])
}
})
break;
case 6:
this.questionForm[o.QuestionId].forEach((q, qi) => {
if (qi === 0) {
num = parseFloat(q[o.TableQuestionId])
} else {
num += parseFloat(q[o.TableQuestionId])
}
})
break;
case 7:
this.questionForm[o.QuestionId].forEach((q, qi) => {
if (qi === 0) {
num = parseFloat(q[o.TableQuestionId])
} else {
num += parseFloat(q[o.TableQuestionId])
}
})
num = this.questionForm[o.QuestionId].length === 0 ? 0 : num / this.questionForm[o.QuestionId].length
break;
case 8:
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
})
num = arr.length === 0 ? 0 : Math.max(...arr)
break;
case 9:
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
})
num = arr.length === 0 ? 0 : Math.min(...arr)
break;
}
} else {
num = parseFloat(this.questionForm[o.TableQuestionId])
if (!isNaN(num)) {
dataArr.push(num)
}
}
} else {
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;
case 13:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc && curr) ? 1 : 0
break;
case 14:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc || curr, 0) ? 1 : 0;
break;
}
}
})
} catch (e) {
console.log(e)
}
var digitPlaces = parseInt(localStorage.getItem('digitPlaces'))
if (rules.ValueType === 2) {
num = num * 100
}
if (rules.CustomCalculateMark === 13 || rules.CustomCalculateMark === 14) {
return num
} else {
return num.toFixed(digitPlaces)
}
},
formItemNumberChange(questionId, isTable) {
if (isTable) {
this.calculationList.forEach((v, i) => {
var find = v.CalculateQuestionList.filter(o => {
return o.QuestionId === questionId
})
// findnumber
if (find) {
var num = this.logic(v)
if (num !== false) {
this.$emit('setFormItemData', { key: v.QuestionId, val: num, question: v })
}
}
})
} else {
this.calculationList.forEach(v => {
var find = v.CalculateQuestionList.filter(o => {
return o.TableQuestionId === questionId
})
// findnumber
if (find) {
var num = this.logic(v)
if (num !== false) {
this.$emit('setFormItemData', { key: v.QuestionId, val: num, question: v })
}
}
})
}
},
formItemChange(v, question) { formItemChange(v, question) {
if (question.Childrens.length > 0) { if (question.Childrens.length > 0) {
this.resetChild(question.Childrens) this.resetChild(question.Childrens)
} else { } else {
this.$emit('setFormItemData', { key: question.Id, val: v}) this.$emit('setFormItemData', { key: question.Id, val: v, question: question})
} }
}, },
resetChild(obj) { resetChild(obj) {