You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

670 lines
19 KiB

3 years ago
<template>
<div class="foreBox">
2 years ago
<!-- <div class="btnBox">-->
<!-- <el-button v-print="'#foreCheck'" size="small">打印</el-button>-->
<!-- <el-button type="primary" size="small" @click="saveFore('2', '前段检查')">保存</el-button>-->
<!-- <el-button type="primary" size="small" @click="handleTemplate">保存为模板</el-button>-->
<!-- <div size="small" style="display:inline-block;margin-left:10px;text-align:center;width: 32px;height: 32px;background-color: #1e79ff;border-radius: 4px;vertical-align: bottom" @click="addForeData">-->
<!-- <img :src="require('@/assets/img/data.png')" alt="" style="width: 17px;height: 16px;margin-top: 5px">-->
<!-- </div>-->
<!-- </div>-->
3 years ago
<div class="moveIcon">
<p @click="moveAll(1)"><i class="el-icon-back" /></p>
<p style="margin-top: 5px" @click="moveAll(2)"><i class="el-icon-back" style="transform: rotateY(180deg)" /></p>
</div>
<div style="display: flex;margin-top: 32px">
2 years ago
<div style="width: 200px;padding-right: 8px;text-align: left">
3 years ago
<p style="font-weight: bold;margin-bottom: 12px;text-align: left">描述项模板</p>
3 years ago
<el-button v-if="!treeCaseList.length" type="primary" size="small" @click="append(1)">+新增</el-button>
3 years ago
<el-tree
ref="tree"
3 years ago
:data="treeCaseList"
3 years ago
:props="treeProps"
2 years ago
:render-content="renderContent"
3 years ago
:default-expand-all="true"
:expand-on-click-node="false"
3 years ago
@node-click="templateData"
3 years ago
/>
</div>
2 years ago
<fore-form
:table-data="tableData"
@handleSelectionChange="handleSelectionChange"
@addTree="addTree"
/>
3 years ago
</div>
2 years ago
<el-dialog :title="title" :visible.sync="dialogFormVisible">
3 years ago
<el-form :model="form" style="margin-top: 16px">
<el-form-item label="名称:" label-width="120px">
<el-input v-model="form.name" auto-complete="off" style="width: 300px" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
3 years ago
<el-button type="primary" @click="handSaveBtn"> </el-button>
</div>
</el-dialog>
2 years ago
<el-dialog title="保存模板" :visible.sync="templateFlag">
3 years ago
<el-form :model="form" style="margin-top: 16px">
<el-form-item label="名称:" label-width="120px">
<el-input v-model="form.name" auto-complete="off" style="width: 300px" />
</el-form-item>
2 years ago
<el-form-item label="选择节点:" label-width="120px">
3 years ago
<el-tree
ref="tree"
:data="treeTemplate"
:props="treeProps"
:default-expand-all="true"
:expand-on-click-node="false"
@node-click="templateNodeClick"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="templateFlag = false"> </el-button>
<el-button type="primary" @click="saveTreeTemplete"> </el-button>
3 years ago
</div>
</el-dialog>
</div>
</template>
<script>
3 years ago
import _ from 'lodash'
3 years ago
import eventBus from '@/page-subspecialty/utils/eventBus'
2 years ago
// import treeSelect from '@/components/360View/itemSelect'
3 years ago
import axios from 'axios'
import Cookies from 'js-cookie'
import ForeForm from '@/components/360View/medicalRecord/outPatientRecord/foreForm.vue'
3 years ago
const Base64 = require('js-base64').Base64
export default {
components: {
2 years ago
ForeForm
// treeSelect
3 years ago
},
mixins: [],
props: {
patientIdNumber: {
type: String,
default: ''
},
patientId: {
type: String,
default: ''
}
},
inject: ['refresh'],
data() {
return {
userData: {},
3 years ago
title: '',
sourceData: [],
treeCaseList: [],
3 years ago
treeTemplate: [],
3 years ago
addType: '',
3 years ago
treeProps: {
value: 'id',
label: 'name',
children: 'child'
},
type: '',
doctorId: '',
deleteId: '',
3 years ago
treeId: '',
2 years ago
treeFlag: '',
3 years ago
treeName: '',
weight: '',
3 years ago
parentId: 0,
collectId: '',
form: {
name: ''
},
multipleSelection: [],
3 years ago
templateFlag: false,
3 years ago
dialogFormVisible: false,
tableData: [
{
name: '眼睑'
}, {
name: '眼睑',
2 years ago
sort: 99,
3 years ago
id: 1,
3 years ago
type: 'anion',
od: '',
os: ''
}, {
name: '结膜'
}, {
name: '结膜',
3 years ago
id: 2,
sort: 1,
3 years ago
type: 'jimmy',
od: '',
os: ''
}, {
name: '结膜',
3 years ago
id: 3,
sort: 2,
3 years ago
type: 'jimmy',
od: '',
os: ''
}, {
name: '泪器'
}, {
name: '泪器',
2 years ago
sort: 99,
3 years ago
id: 4,
3 years ago
type: 'liq',
od: '',
os: ''
}, {
name: '角膜'
}, {
name: '角膜',
2 years ago
sort: 99,
3 years ago
id: 5,
3 years ago
type: 'Giacomo',
od: '',
os: ''
}, {
name: '前房'
}, {
name: '前房',
2 years ago
sort: 99,
3 years ago
id: 6,
3 years ago
type: 'Jianfeng',
od: '',
os: ''
}, {
name: '虹膜'
}, {
name: '虹膜',
2 years ago
sort: 99,
3 years ago
id: 7,
3 years ago
type: 'mongo',
od: '',
os: ''
}, {
name: '瞳孔'
}, {
name: '瞳孔',
2 years ago
sort: 99,
3 years ago
id: 8,
3 years ago
type: 'tonguing',
od: '',
os: ''
}, {
name: '晶状体'
}, {
name: '晶状体',
2 years ago
sort: 99,
3 years ago
id: 9,
3 years ago
type: 'jingling',
od: '',
os: ''
}, {
name: '睫状体'
}, {
name: '睫状体',
2 years ago
sort: 99,
3 years ago
id: 10,
3 years ago
type: 'jingles',
od: '',
os: ''
}, {
name: '眼位'
}, {
name: '眼位',
2 years ago
sort: 99,
3 years ago
id: 11,
3 years ago
type: 'yawn',
od: '',
os: ''
}, {
name: '眼眶'
}, {
name: '眼眶',
2 years ago
sort: 99,
3 years ago
id: 12,
3 years ago
type: 'yanking',
od: '',
os: ''
}, {
name: '眼球运动'
}, {
name: '眼球运动',
2 years ago
sort: 99,
3 years ago
id: 13,
3 years ago
type: 'yang',
od: '',
os: ''
3 years ago
}]
3 years ago
}
},
watch: {
tableData: {
deep: true,
handler: (value) => {
if (value) {
eventBus.$emit('getForeData', value)
}
}
}
},
3 years ago
created() {
},
mounted() {
this.userData = JSON.parse(window.localStorage.getItem('qg-userData'))
this.doctorId = this.userData.id
this.getforeList('2').then(() => {
3 years ago
this.queryOptions()
3 years ago
})
2 years ago
// 查询左侧病历树
3 years ago
this.queryTreeCase()
3 years ago
},
methods: {
async getforeList(flag) {
const { data: res } = await this.$http.get('/case/getCase', {
params: {
patientId: this.patientId,
2 years ago
platform: 1,
3 years ago
flag: flag // 1病史采集2前段检查3后段检查4专科检查
3 years ago
}
})
if (res.code === 0) {
2 years ago
this.tableData = res.data ? JSON.parse(res.data.jsonText) : []
3 years ago
this.collectId = res.data ? res.data.id : ''
} else {
this.$message.error(res.msg)
}
},
3 years ago
// 表格复选框
2 years ago
handleSelectionChange(val) {
this.multipleSelection = val
3 years ago
},
3 years ago
// 添加数据集
addForeData() {
2 years ago
if (!this.multipleSelection.length) return this.$message.warning('请勾选数据!')
const data = this.multipleSelection.filter(item => {
3 years ago
return item.type !== undefined
})
eventBus.$emit('sendForData', data)
3 years ago
},
3 years ago
// 获取下拉选择项,把数据封装进表格中
3 years ago
queryOptions() {
3 years ago
const treeList = []
3 years ago
this.tableData.forEach(item => {
if (item.type) {
const p = this.queryTree(item.type)
3 years ago
treeList.push(p)
3 years ago
}
})
3 years ago
Promise.all(treeList).then((result) => {
2 years ago
console.log(result)
3 years ago
if (result.length) {
result.forEach(item => {
item.forEach(row => {
this.tableData.forEach(e => {
if (e.type === row.type) {
2 years ago
e.data = item
const sort = item.sort
item.sort = ''
this.$nextTick(() => {
item.sort = sort
})
3 years ago
}
})
})
})
}
3 years ago
this.sourceData = _.cloneDeep(this.tableData) || []
eventBus.$emit('getForeData', this.tableData)
3 years ago
}).catch((error) => {
})
},
// 全部移动
moveAll(type) {
if (type === 1) {
this.tableData.forEach(item => {
if (item.sort) {
item.od = item.os
2 years ago
item.odValue = item.osValue
const sort = item.sort
item.sort = ''
this.$nextTick(() => {
item.sort = sort
})
3 years ago
}
})
} else {
this.tableData.forEach(item => {
if (item.sort) {
item.os = item.od
2 years ago
item.osValue = item.odValue
const sort = item.sort
item.sort = ''
this.$nextTick(() => {
item.sort = sort
})
3 years ago
}
})
}
},
// 保存前段检查
3 years ago
async saveFore() {
3 years ago
const params = {
2 years ago
flag: '2', // 1病史采集2前段检查3后段检查4专科检查
3 years ago
jsonText: JSON.stringify(this.tableData),
3 years ago
name: '前段检查',
3 years ago
patientId: this.patientId,
2 years ago
platform: '1'
3 years ago
}
let url = ''
if (this.collectId) {
url = '/case/update'
params.id = this.collectId
} else {
url = '/case/save'
}
const { data: res } = await this.$http.post(url, params)
if (res.code === 0) {
this.$message.success('保存成功')
await this.getforeList('2')
} else {
this.$message.error(res.msg)
}
},
3 years ago
handSaveBtn() {
if (this.addType === 1) {
this.handleSaveTree()
} else {
this.handleSaveCase()
}
},
// 新增选择下拉树
2 years ago
addTree() {
3 years ago
this.title = '新增子级'
this.addType = 1
this.form.name = ''
3 years ago
this.dialogFormVisible = true
},
3 years ago
// 新增保存树-眼睛部位下拉选择
async handleSaveTree() {
const params = {
doctorId: this.doctorId,
name: this.form.name,
2 years ago
flag: this.treeFlag, // // 1公共树,2个人树
3 years ago
type: this.type,
parentId: this.parentId,
2 years ago
platform: 1
3 years ago
}
const { data: res } = await this.$http.post('/treetag/addTree', params)
if (res.code === 0) {
this.dialogFormVisible = false
this.updataList()
this.$message.success('保存成功')
} else {
this.$message.error(res.msg)
}
},
// 删除选择下拉树
3 years ago
removeTree(item) {
2 years ago
console.log(123, item)
3 years ago
this.type = item.type
this.deleteId = item.id
3 years ago
this.$confirm('确定删除该节点?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.handleRemove()
}).catch(() => {
})
},
// 删除选择下拉树
async handleRemove() {
const params = {
id: this.deleteId
}
const { data: res } = await this.$http.post('/treetag/deleteTree', params)
if (res.code === 0) {
this.$message.success('删除成功')
this.updataList()
} else {
this.$message.error(res.msg)
}
3 years ago
},
3 years ago
// 刷新单个选择下拉树
updataList() {
this.queryTree(this.type).then((res) => {
this.tableData.forEach(item => {
if (item.type === this.type) {
const sort = item.sort
item.sort = ''
this.$nextTick(() => {
item.sort = sort
})
item.data = res
}
})
})
},
// 封装查询单个下拉选择树
3 years ago
queryTree(type) {
2 years ago
// http://47.110.224.240:8036/xiangan-crf/treetag/findTree
3 years ago
// 47.110.224.240:8036
2 years ago
// 192.168.4.83:8036
3 years ago
return new Promise((resolve, reject) => {
axios.defaults.headers.common['token'] = Cookies.get('xa-token') || ''
2 years ago
axios.get('http://192.168.4.83:8036/xiangan-crf/treetag/findTree', {
3 years ago
params: {
doctorId: this.doctorId,
type: type,
2 years ago
platform: 1
3 years ago
}
}).then(res => {
if (res.data.code === 0) {
const data = res.data
resolve(data.data)
}
})
.catch(error => {
reject(error)
})
})
},
3 years ago
// 点击左侧模板数据覆盖表格内容
templateData(data, node) {
if (data && data.caseJson) {
this.tableData = JSON.parse(data.caseJson)
// 回显表格复选框
this.$nextTick(() => {
this.tableData.forEach(item => {
3 years ago
this.$refs.multipleTable.toggleRowSelection(item, true)
})
})
} else {
this.tableData = _.cloneDeep(this.sourceData)
}
},
// 点击保存模板后弹框
handleTemplate() {
2 years ago
// if (!this.multipleSelection.length) return this.$message.warning('请勾选模板内容!')
3 years ago
this.form.name = ''
this.queryTemplate()
this.templateFlag = true
},
// 保存模板时选择树节点
templateNodeClick(node) {
this.treeId = node.id
},
// 保存模板树
async saveTreeTemplete() {
2 years ago
if (!this.treeId) return this.$message.warning('请选择节点!')
3 years ago
const params = {
2 years ago
caseJson: JSON.stringify(this.tableData),
3 years ago
doctorId: this.doctorId,
name: this.form.name,
2 years ago
type: 2, // 2前段检查 3后段检查
3 years ago
treeId: this.treeId
}
const { data: res } = await this.$http.post('/treetemplate/addTreeCase', params)
if (res.code === 0) {
this.templateFlag = false
this.queryTreeCase()
this.$message.success('保存成功')
} else {
this.$message.error(res.msg)
}
},
// 新增左侧描述项树弹框
append(type, data) {
this.addType = 2
this.form.name = ''
type === 1 ? this.title = '新增父级' : this.title = '新增子级'
type === 1 ? this.parentId = 0 : this.parentId = data.id
this.dialogFormVisible = true
},
// 新增左侧描述项树
async handleSaveCase() {
const params = {
doctorId: this.doctorId,
name: this.form.name,
weight: this.weight,
3 years ago
parentId: this.parentId,
2 years ago
platform: 1
3 years ago
}
3 years ago
const { data: res } = await this.$http.post('/treetemplate/addTree', params)
3 years ago
if (res.code === 0) {
this.dialogFormVisible = false
3 years ago
this.queryTreeCase()
3 years ago
this.$message.success('保存成功')
} else {
this.$message.error(res.msg)
}
},
3 years ago
// 删除左侧树/模板节点弹框
3 years ago
remove(node, data) {
3 years ago
this.deleteId = data.id
let url = ''
if (data.type) {
// 模板节点
url = '/treetemplate/deleteTreeCase'
} else {
// 树节点
url = '/treetemplate/deleteTree'
}
3 years ago
this.$confirm('确定删除该节点?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
3 years ago
this.removeTemplate(url)
3 years ago
}).catch(() => {
3 years ago
3 years ago
})
},
3 years ago
// 删除左侧树/模板节点
async removeTemplate(url) {
3 years ago
const params = {
id: this.deleteId
}
3 years ago
const { data: res } = await this.$http.post(url, params)
3 years ago
if (res.code === 0) {
this.$message.success('删除成功')
3 years ago
this.queryTreeCase()
this.getforeList('2')
3 years ago
} else {
this.$message.error(res.msg)
}
},
2 years ago
// 描述项模板
renderContent(h, { node, data, store }) {
return (
<span style='flex: 1; display: flex; align-items: center; justify-content: space-between; font-size: 14px; padding-right: 8px;'>
<span>
<span>{node.label}</span>
</span>
<span>
<el-button icon='el-icon-plus' style='font-size: 12px;color: black' type='text' on-click={ () => this.append(2, data) }>
</el-button>
<el-button icon='el-icon-delete' style='font-size: 12px;color: black' type='text' on-click={ () => this.remove(node, data) }>
</el-button>
</span>
</span>)
},
3 years ago
// 查询弹框模板树
3 years ago
async queryTemplate() {
const { data: res } = await this.$http.get('/treetemplate/findTree', {
params: {
2 years ago
platform: 1,
3 years ago
doctorId: this.doctorId
}
})
if (res.code === 0) {
this.treeTemplate = res.data
} else {
this.$message.error(res.msg)
}
},
3 years ago
// 使用递归遍历树,合并模板节点和child节点
fn(data) {
data.forEach((item, i) => {
if (item.list && item.list.length) {
item.child = item.child.concat(item.list)
// 调用递归函数
}
if (item.child) {
this.fn(item.child)
}
})
return data
},
// 查询左侧病历树
async queryTreeCase() {
3 years ago
const { data: res } = await this.$http.get('/treetemplate/findTreeCase', {
params: {
3 years ago
type: 2,
2 years ago
platform: 1,
3 years ago
doctorId: this.doctorId
}
})
if (res.code === 0) {
3 years ago
this.treeCaseList = this.fn(res.data)
3 years ago
} else {
this.$message.error(res.msg)
}
}
}
}
</script>
<style lang="scss" scoped>
.foreBox{
width: 100%;
height: 100%;
2 years ago
//padding: 16px;
box-sizing: border-box;
3 years ago
overflow-y: auto;
position: relative;
.btnBox{
position: fixed;
right: 84px;
text-align: right;
margin-right: 16px;
background-color: white;
z-index: 999;
}
.moveIcon{
position: absolute;
left: calc(50% + 120px);
top: 40px;
z-index: 9;
}
}
</style>
<style lang="scss">
.foreBox{
.el-form-item__content{
text-align: left;
}
}
</style>