|
@@ -1,6 +1,10 @@
|
|
|
const echarts = require("echarts");
|
|
|
const { post, api } = require('./api.js');
|
|
|
+const iconUp = require('./../resources/images/iconUp.png');
|
|
|
+const iconDown = require('./../resources/images/iconDown.png');
|
|
|
|
|
|
+const clientHei = $(window).height()
|
|
|
+const contentHei = clientHei - 80
|
|
|
|
|
|
//关系图
|
|
|
function getGraph(val, type){
|
|
@@ -134,6 +138,7 @@ function drawGraph(data,resultShowId) {
|
|
|
|
|
|
function dataClick(param){
|
|
|
var data = param.data;
|
|
|
+ console.log('data',data)
|
|
|
const clientHei = $(window).height()
|
|
|
const contentHei = clientHei - 80
|
|
|
// console.log('data', data,select_type)
|
|
@@ -150,31 +155,44 @@ function dataClick(param){
|
|
|
getGraph(data.label,select_type);
|
|
|
|
|
|
}else {
|
|
|
-
|
|
|
+ let renderTabInfo = getTab(data.type)
|
|
|
+ renderTab(renderTabInfo)
|
|
|
+ if(data.type == "药品通用名"){
|
|
|
+ $('.selectedName').html("药品")
|
|
|
+ }else{
|
|
|
+ $('.selectedName').html(select_type)
|
|
|
+ }
|
|
|
if(data.type == "疾病"){
|
|
|
$(".radioList").show()
|
|
|
- select_type_noSearch = data.type
|
|
|
- select_type = data.type
|
|
|
- $('.selectedName').html(select_type)
|
|
|
- $(".activeTab").removeClass("activeTab")
|
|
|
- $(".diagnose").addClass("activeTab")
|
|
|
$(".ztree").css("height",contentHei-80-43-60-20+'px')
|
|
|
- $('#searchInp').val(data.label)
|
|
|
$('.iconRadio').attr('src','/images/radioUnSelect.png')
|
|
|
$('.ICD10 img').attr('src','/images/radioSelect.png')
|
|
|
+ }else{
|
|
|
+ $(".radioList").hide()
|
|
|
+ $(".ztree").css("height",contentHei-80-43-20+'px')
|
|
|
+ }
|
|
|
+ select_type_noSearch = data.type
|
|
|
+ select_type = data.type
|
|
|
+ $('#searchInp').val(data.label)
|
|
|
+ if(data.type == "疾病"){
|
|
|
getTree(1,1,data.label);
|
|
|
getGraph(data.label,select_type);
|
|
|
}else if(data.type == "药品通用名"){
|
|
|
- $(".radioList").hide()
|
|
|
- select_type_noSearch = data.type
|
|
|
- select_type = data.type
|
|
|
- $('.selectedName').html("药品")
|
|
|
- $(".activeTab").removeClass("activeTab")
|
|
|
- $(".drug").addClass("activeTab")
|
|
|
- $(".ztree").css("height",contentHei-80-43-20+'px')
|
|
|
- $('#searchInp').val(data.label)
|
|
|
getTree(0,2,data.label);
|
|
|
getGraph(data.label,select_type);
|
|
|
+ }else if(data.type == "症状"){
|
|
|
+
|
|
|
+ getTree(0,3,data.label);
|
|
|
+ getGraph(data.label,select_type);
|
|
|
+ }else if(data.type == "手术和操作"){
|
|
|
+ getTree(0,4,data.label);
|
|
|
+ getGraph(data.label,select_type);
|
|
|
+ }else if(data.type == "实验室检查"){
|
|
|
+ getTree(0,5,data.label);
|
|
|
+ getGraph(data.label,select_type);
|
|
|
+ }else if(data.type == "辅助检查"){
|
|
|
+ getTree(0,6,data.label);
|
|
|
+ getGraph(data.label,select_type);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -253,12 +271,13 @@ function drawTree(data, showNodeName){
|
|
|
const name = treeNodeName.substring(index+1)
|
|
|
if(select_type != select_type_noSearch){
|
|
|
select_type_noSearch = select_type
|
|
|
- if(select_type == "疾病"){
|
|
|
- $(".selectedName").html("疾病")
|
|
|
- } else if(select_type == "药品通用名"){
|
|
|
+ if(select_type == "药品通用名"){
|
|
|
$(".selectedName").html("药品")
|
|
|
+ }else{
|
|
|
+ $(".selectedName").html(select_type)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
getGraph(name,select_type)
|
|
|
const selectPId = $('.curSelectedNode').attr('id')
|
|
|
if(selectPId){
|
|
@@ -307,22 +326,32 @@ function getNode(val, type){
|
|
|
$(".tabNameList").hide()
|
|
|
if(select_type_noSearch != select_type){
|
|
|
select_type = select_type_noSearch
|
|
|
-
|
|
|
+ let renderInfo = getTab(select_type)
|
|
|
+ renderTab(renderInfo)
|
|
|
+ if(select_type == '疾病'){
|
|
|
+
|
|
|
+ // $('#searchInp').val("高血压3级")
|
|
|
+ getTree(1,1,txt);
|
|
|
+ }else if(select_type == '药品通用名'){
|
|
|
+
|
|
|
+ getTree(0,2,txt);
|
|
|
+ }else if(select_type == '症状'){
|
|
|
+ getTree(0,3,txt);
|
|
|
+ }else if(select_type == '手术和操作'){
|
|
|
+ getTree(0,4,txt);
|
|
|
+ }else if(select_type == '实验室检查'){
|
|
|
+ getTree(0,5,txt);
|
|
|
+ }else if(select_type == '辅助检查'){
|
|
|
+ getTree(0,6,txt);
|
|
|
+ }
|
|
|
if(select_type == '疾病'){
|
|
|
$(".radioList").show()
|
|
|
- $(".activeTab").removeClass("activeTab")
|
|
|
- $(".diagnose").addClass("activeTab")
|
|
|
$(".ztree").css("height",contentHei-80-43-60-20+'px')
|
|
|
- // $('#searchInp').val("高血压3级")
|
|
|
$('.iconRadio').attr('src','/images/radioUnSelect.png')
|
|
|
$('.ICD10 img').attr('src','/images/radioSelect.png')
|
|
|
- getTree(1,1,txt);
|
|
|
- }else if(select_type == '药品通用名'){
|
|
|
+ }else{
|
|
|
$(".radioList").hide()
|
|
|
$(".ztree").css("height",contentHei-80-43-20+'px')
|
|
|
- $(".activeTab").removeClass("activeTab")
|
|
|
- $(".drug").addClass("activeTab")
|
|
|
- getTree(0,2,txt);
|
|
|
}
|
|
|
}else{
|
|
|
updateTree(txt)
|
|
@@ -393,11 +422,153 @@ function getKeyEvent(evt) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function getTab(tabName){
|
|
|
+ console.log('tabName', tabName)
|
|
|
+ let tabList = ["疾病","药品通用名","症状","手术和操作","实验室检查","辅助检查","辅助检查1","辅助检查2","辅助检查3","辅助检查4"]
|
|
|
+ let tabListCopy = tabList.slice()
|
|
|
+ const index = tabList.findIndex(item => item == tabName)
|
|
|
+
|
|
|
+ if(index <= 3){
|
|
|
+ return {
|
|
|
+ activeIndex: index,
|
|
|
+ showTabList:tabListCopy.slice(0,4),
|
|
|
+ hideTabList:tabListCopy.slice(4)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ tabListCopy.splice(index,1)
|
|
|
+ let hideTabList = tabListCopy.slice(3)
|
|
|
+
|
|
|
+ return {
|
|
|
+ activeIndex: 3,
|
|
|
+ showTabList:tabListCopy.slice(0,3).concat(tabName),
|
|
|
+ hideTabList:hideTabList
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function renderTab(data){
|
|
|
+ const showList = data.showTabList
|
|
|
+ const hideList = data.hideTabList
|
|
|
+ const activeIndex = data.activeIndex
|
|
|
+ let showtabStr = ``
|
|
|
+ let hidetabStr = ``
|
|
|
+ for(let i = 0; i < showList.length; i++){
|
|
|
+ showtabStr +=` <span class="tab ${i === activeIndex ? 'activeTab':''}" data-id="${showList[i]}">${showList[i] =="药品通用名" ?"药品":showList[i]}</span>`
|
|
|
+ if(i === activeIndex){
|
|
|
+ if(showList[i] =="药品通用名"){
|
|
|
+ $("#searchInp").attr("placeholder",`请输入药品名称`)
|
|
|
+ }else{
|
|
|
+ $("#searchInp").attr("placeholder",`请输入${showList[i]}名称`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ for(let i = 0; i < hideList.length; i++){
|
|
|
+ hidetabStr +=`<span class="tab " data-id="${hideList[i]}">${hideList[i]}</span>`
|
|
|
+ }
|
|
|
+ // console.log('showtabStr',showtabStr)
|
|
|
+
|
|
|
+ $('.showTabList').html(showtabStr)
|
|
|
+ $('.hideTabList').html(hidetabStr)
|
|
|
+ bindTabClick()
|
|
|
+}
|
|
|
+ToggleTab()
|
|
|
+function ToggleTab(){
|
|
|
+ $(".toggleTab").click(function(){
|
|
|
+ const hideTabDis = $(".hideTabList").css("display")
|
|
|
+ if(hideTabDis == "none"){
|
|
|
+ showHideTab()
|
|
|
+ }else{
|
|
|
+ hideHideTab()
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+function showHideTab(){
|
|
|
+ $(".hideTabList").slideDown()
|
|
|
+
|
|
|
+ $(".toggleTabTxt").html("收起")
|
|
|
+ $(".toggleArrow").attr("src",iconUp)
|
|
|
+}
|
|
|
+function hideHideTab(){
|
|
|
+ $(".hideTabList").slideUp()
|
|
|
+ $(".toggleTabTxt").html("展开")
|
|
|
+ $(".toggleArrow").attr("src",iconDown)
|
|
|
+}
|
|
|
+bindTabClick()
|
|
|
+//切换tab
|
|
|
+function bindTabClick(){
|
|
|
+ $('.tabList .tab').click(function(){
|
|
|
+ const id = $(this).attr('data-id')
|
|
|
+ $(this).addClass("activeTab").siblings().removeClass('activeTab')
|
|
|
+ let renderInfo = getTab(id)
|
|
|
+ renderTab(renderInfo)
|
|
|
+ if(id != select_type){
|
|
|
+ if(id != "疾病"){
|
|
|
+ $(".radioList").hide()
|
|
|
+ $(".ztree").css("height",contentHei-80-43-20+'px')
|
|
|
+ }else{
|
|
|
+ $(".ztree").css("height",contentHei-80-43-60-20+'px')
|
|
|
+ $(".radioList").show()
|
|
|
+ }
|
|
|
+ select_type_noSearch = id
|
|
|
+ select_type = id
|
|
|
+ if(id=="药品通用名"){
|
|
|
+ $('.selectedName').html("药品")
|
|
|
+ }else{
|
|
|
+ $('.selectedName').attr('title', select_type)
|
|
|
+ if(select_type.length > 3){
|
|
|
+ $('.selectedName').html(select_type.slice(0,2)+'...')
|
|
|
+ }else{
|
|
|
+ $('.selectedName').html(select_type)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(id == "疾病"){
|
|
|
+
|
|
|
+ $('#searchInp').val("高血压3级")
|
|
|
+ $('.iconRadio').attr('src','/images/radioUnSelect.png')
|
|
|
+ $('.ICD10 img').attr('src','/images/radioSelect.png')
|
|
|
+ getTree(1,1,"高血压3级");
|
|
|
+ getGraph("高血压3级",select_type);
|
|
|
+
|
|
|
+ }else if(id=="药品通用名"){
|
|
|
+ $('#searchInp').val("氟康唑注射液")
|
|
|
+ getTree(0,2,"氟康唑注射液");
|
|
|
+ getGraph("氟康唑注射液",select_type);
|
|
|
+
|
|
|
+ }else if(id == "症状"){
|
|
|
+ $('#searchInp').val("")
|
|
|
+ getTree(0,3,"");
|
|
|
+ getGraph("",select_type);
|
|
|
+ }else if(id == "手术和操作"){
|
|
|
+ $('#searchInp').val("")
|
|
|
+ getTree(0,4,"");
|
|
|
+ getGraph("",select_type);
|
|
|
+ }else if(id == "实验室检查"){
|
|
|
+ $('#searchInp').val("")
|
|
|
+ getTree(0,5,"");
|
|
|
+ getGraph("",select_type);
|
|
|
+ }else if(id == "辅助检查"){
|
|
|
+ $('#searchInp').val("")
|
|
|
+ getTree(0,6,"");
|
|
|
+ getGraph("",select_type);
|
|
|
+ }
|
|
|
+
|
|
|
+ // getTree(1,1,""); //切换tab重新画菜单树
|
|
|
+ }
|
|
|
+
|
|
|
+ hideHideTab()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
module.exports ={
|
|
|
drawGraph,
|
|
|
updateTree,
|
|
|
getGraph,
|
|
|
getTree,
|
|
|
- getNode
|
|
|
+ getNode,
|
|
|
+ getTab,
|
|
|
+ renderTab
|
|
|
}
|