|
|
|
@ -51,6 +51,37 @@ |
|
|
|
:class="{'radio-check': typeRadio === 'Check'}" |
|
|
|
>检查</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div v-if="typeRadio === 'Disease'"> |
|
|
|
<el-radio-group v-model="DiseaseRadio" @change="changeTree"> |
|
|
|
<el-radio |
|
|
|
value="ICD10" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>ICD10</el-radio> |
|
|
|
<el-radio |
|
|
|
value="Department" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>科室</el-radio> |
|
|
|
<el-radio |
|
|
|
value="SZM" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>首字母</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div v-if="typeRadio === 'Drug'"> |
|
|
|
<el-radio-group v-model="DrugRadio" @change="changeTree"> |
|
|
|
<el-radio |
|
|
|
value="Subject" |
|
|
|
:class="{'radio-drug': typeRadio === 'Drug'}" |
|
|
|
>药物分类</el-radio> |
|
|
|
<el-radio |
|
|
|
value="SZM" |
|
|
|
:class="{'radio-drug': typeRadio === 'Drug'}" |
|
|
|
>首字母</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div class="disease-body"> |
|
|
|
|
|
|
|
@ -85,7 +116,15 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import {getCheckTree, getCount, getDrugTree, getGraph, getTestGraphData} from "@/api/graph" |
|
|
|
import { |
|
|
|
getCheckTree, |
|
|
|
getCount, |
|
|
|
getDiseaseDepartTree, |
|
|
|
getDiseaseTree, getDrugSubjectTree, |
|
|
|
getDrugTree, |
|
|
|
getGraph, |
|
|
|
getTestGraphData |
|
|
|
} from "@/api/graph" |
|
|
|
import {Graph, Tooltip} from '@antv/g6'; |
|
|
|
import Menu from "@/components/Menu.vue"; |
|
|
|
import {a} from "vue-router/dist/devtools-EWN81iOl.mjs"; |
|
|
|
@ -135,8 +174,11 @@ export default { |
|
|
|
label: 'title' // 虽然用插槽,但 el-tree 内部仍会读取,可留空或任意 |
|
|
|
}, |
|
|
|
typeRadio:"Disease", |
|
|
|
DiseaseRadio:"ICD10", |
|
|
|
drugTree:[], |
|
|
|
diseaseTree:[], |
|
|
|
diseaseDepartTree:[], |
|
|
|
diseaseICD10Tree:[], |
|
|
|
diseaseSZMTree:[], |
|
|
|
checkTree:[], |
|
|
|
legendItems: [ |
|
|
|
{ key: 'Disease', label: '疾病', color: '#EF4444' }, |
|
|
|
@ -155,7 +197,9 @@ export default { |
|
|
|
nodes: [], |
|
|
|
edges: [] |
|
|
|
}, |
|
|
|
searchKeyword:"" |
|
|
|
searchKeyword:"", |
|
|
|
drugSubjectTree:[], |
|
|
|
DrugRadio:"Subject" |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -214,12 +258,16 @@ export default { |
|
|
|
// #790800 |
|
|
|
}, |
|
|
|
async mounted() { |
|
|
|
|
|
|
|
this.visibleCategories = new Set(this.legendItems.map(i => i.key)); |
|
|
|
await this.loadDiseaseTreeData() |
|
|
|
await this.loadDiseaseICD10TreeData() |
|
|
|
this.loadDiseaseDepartTreeData() |
|
|
|
this.loadDiseaseSZMTreeData() |
|
|
|
this.getCount() |
|
|
|
this.loadDrugTreeData() |
|
|
|
this.loadCheckTreeData() |
|
|
|
this.treeData=this.diseaseTree |
|
|
|
this.loadDrugSubjectTreeData() |
|
|
|
this.treeData=this.diseaseICD10Tree |
|
|
|
await this.$nextTick(); |
|
|
|
try { |
|
|
|
const response = await getTestGraphData(); // 等待 Promise 解析 |
|
|
|
@ -532,53 +580,59 @@ export default { |
|
|
|
|
|
|
|
changeTree(){ |
|
|
|
if(this.typeRadio=="Disease"){ |
|
|
|
this.treeData=this.diseaseTree |
|
|
|
if(this.DiseaseRadio=="ICD10") { |
|
|
|
this.treeData=this.diseaseICD10Tree |
|
|
|
} |
|
|
|
if(this.DiseaseRadio=="Department") { |
|
|
|
this.treeData=this.diseaseDepartTree |
|
|
|
} |
|
|
|
if(this.DiseaseRadio=="SZM") { |
|
|
|
this.treeData=this.diseaseSZMTree |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.typeRadio=="Drug") { |
|
|
|
if(this.DrugRadio=="Subject") { |
|
|
|
this.treeData=this.drugSubjectTree |
|
|
|
} |
|
|
|
if(this.DrugRadio=="SZM") { |
|
|
|
this.treeData=this.drugTree |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.typeRadio=="Check") { |
|
|
|
this.treeData=this.checkTree |
|
|
|
} |
|
|
|
}, |
|
|
|
loadTreeNode(node, resolve, data) { |
|
|
|
// 根据当前选中的类型决定调用哪个接口 |
|
|
|
let apiCall; |
|
|
|
if (this.typeRadio === 'Disease') { |
|
|
|
// 假设你的 ICD-10 节点有 level 字段(如 chapter, section 等) |
|
|
|
// 并且子节点需要根据 code 或 id 请求 |
|
|
|
apiCall = () => this.loadDiseaseTreeData(); |
|
|
|
} else if (this.typeRadio === 'Drug') { |
|
|
|
apiCall = () => this.loadDrugTreeData(); // 你需要实现这个 API |
|
|
|
} else if (this.typeRadio === 'Check') { |
|
|
|
apiCall = () => this.loadCheckTreeData(); |
|
|
|
} |
|
|
|
if (apiCall) { |
|
|
|
apiCall() |
|
|
|
.then(children => { |
|
|
|
// children 必须是数组,每个元素要有 label、code/id 等字段 |
|
|
|
// 如果没有子节点,返回空数组 [] |
|
|
|
resolve(children || []); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.error('加载子节点失败:', err); |
|
|
|
resolve([]); // 防止卡住 |
|
|
|
}); |
|
|
|
} else { |
|
|
|
resolve([]); |
|
|
|
} |
|
|
|
}, |
|
|
|
async loadDiseaseTreeData() { |
|
|
|
async loadDiseaseICD10TreeData() { |
|
|
|
try { |
|
|
|
const res = await fetch('/icd10.json') |
|
|
|
if (!res.ok) throw new Error('Failed to load JSON') |
|
|
|
this.diseaseTree = await res.json() |
|
|
|
console.log(this.treeData) |
|
|
|
this.diseaseICD10Tree = await res.json() |
|
|
|
} catch (error) { |
|
|
|
console.error('加载 ICD-10 数据失败:', error) |
|
|
|
this.$message.error('加载编码数据失败,请检查文件路径') |
|
|
|
} |
|
|
|
}, |
|
|
|
async loadDiseaseDepartTreeData() { |
|
|
|
try { |
|
|
|
const res = await getDiseaseDepartTree() |
|
|
|
this.diseaseDepartTree = res |
|
|
|
} catch (error) { |
|
|
|
} |
|
|
|
}, |
|
|
|
async loadDiseaseSZMTreeData() { |
|
|
|
try { |
|
|
|
const res = await getDiseaseTree() |
|
|
|
this.diseaseSZMTree = res |
|
|
|
} catch (error) { |
|
|
|
} |
|
|
|
}, |
|
|
|
async loadDrugSubjectTreeData() { |
|
|
|
try { |
|
|
|
const res = await getDrugSubjectTree() |
|
|
|
this.drugSubjectTree = res |
|
|
|
} catch (error) { |
|
|
|
} |
|
|
|
}, |
|
|
|
async loadDrugTreeData() { |
|
|
|
try { |
|
|
|
const res = await getDrugTree() |
|
|
|
@ -612,6 +666,11 @@ export default { |
|
|
|
const response = await getGraph(data); // 等待 Promise 解析 |
|
|
|
this.formatData(response) |
|
|
|
} |
|
|
|
if(data.type === "Disease"){ |
|
|
|
data.type="Disease" |
|
|
|
const response = await getGraph(data); // 等待 Promise 解析 |
|
|
|
this.formatData(response) |
|
|
|
} |
|
|
|
}, |
|
|
|
buildNodeLabelMap(nodes) { |
|
|
|
this._nodeLabelMap = new Map(); |
|
|
|
@ -1263,7 +1322,7 @@ button:hover { |
|
|
|
border: 1px solid #f0f0f0; |
|
|
|
border-radius: 12px; |
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
max-height: 85vh; |
|
|
|
} |
|
|
|
|
|
|
|
.disease-header { |
|
|
|
|