Browse Source

all

yangrongze
hanyuqing 3 months ago
parent
commit
04bc718b73
  1. 4
      controller/LoginController.py
  2. 0
      python/app.py
  3. 0
      python/config.py
  4. 0
      python/icd10_skipped_records.xlsx
  5. 0
      python/icd10_tree_preserve_order.json
  6. 0
      python/icd10_tree_with_level.json
  7. 0
      python/icd_parse.py
  8. 0
      python/icd_parse_name.py
  9. 0
      python/import.py
  10. 0
      python/parse_data.py
  11. 0
      python/test.py
  12. 8
      python/test1.py
  13. 0
      python/test1222.py
  14. 1
      python/web_main.py
  15. 2
      util/mysql_utils.py
  16. 7
      vue/src/api/graph.js
  17. 6
      vue/src/api/login.js
  18. 6
      vue/src/api/profile.js
  19. 33
      vue/src/system/GraphDemo.vue
  20. 2
      vue/src/system/Login.vue
  21. 40
      vue/vue.config.js

4
controller/LoginController.py

@ -1,10 +1,8 @@
from robyn import jsonify, Response from robyn import jsonify, Response
from app import app from python.app import app
from datetime import datetime, timedelta from datetime import datetime, timedelta
import uuid import uuid
import json import json
import os
import base64
from service.UserService import user_service from service.UserService import user_service
# 临时存储token,用于会话管理 # 临时存储token,用于会话管理

0
app.py → python/app.py

0
config.py → python/config.py

0
icd10_skipped_records.xlsx → python/icd10_skipped_records.xlsx

0
icd10_tree_preserve_order.json → python/icd10_tree_preserve_order.json

0
icd10_tree_with_level.json → python/icd10_tree_with_level.json

0
icd_parse.py → python/icd_parse.py

0
icd_parse_name.py → python/icd_parse_name.py

0
import.py → python/import.py

0
parse_data.py → python/parse_data.py

0
test.py → python/test.py

8
test1.py → python/test1.py

@ -1,6 +1,6 @@
from datetime import datetime from datetime import datetime
from app import app from app import app
import robyn
from robyn import Robyn, jsonify, Response from robyn import Robyn, jsonify, Response
from typing import Optional, List, Any, Dict from typing import Optional, List, Any, Dict
from util.neo4j_utils import Neo4jUtil from util.neo4j_utils import Neo4jUtil
@ -127,8 +127,8 @@ def build_g6_subgraph_by_props(
relationships = neighbor_list # 结构已兼容 relationships = neighbor_list # 结构已兼容
return build_g6_graph_data_from_results(nodes, relationships) return build_g6_graph_data_from_results(nodes, relationships)
print("✅ test1 已导入,路由应已注册")
@app.get("/getData") @app.get("/api/getData")
def get_data(): def get_data():
try: try:
graph_data = build_g6_subgraph_by_props( graph_data = build_g6_subgraph_by_props(
@ -148,7 +148,7 @@ def get_data():
return jsonify({"error": str(e)}), 500 return jsonify({"error": str(e)}), 500
@app.post("/getGraph") @app.post("/api/getGraph")
def get_graph(req): def get_graph(req):
try: try:

0
test1222.py → python/test1222.py

1
web_main.py → python/web_main.py

@ -1,5 +1,6 @@
from app import app from app import app
import controller.LoginController import controller.LoginController
import test1 # 👈 关键:导入 test1,触发 @app.get("/getData") 执行
from service.UserService import init_mysql_connection from service.UserService import init_mysql_connection
import os import os

2
util/mysql_utils.py

@ -1,6 +1,6 @@
import pymysql import pymysql
from typing import List, Dict, Any from typing import List, Dict, Any
from config import MYSQL_CONFIG from python.config import MYSQL_CONFIG
class MySQLClient: class MySQLClient:
"""MySQL客户端类""" """MySQL客户端类"""

7
vue/src/api/graph.js

@ -8,17 +8,16 @@ import request from '@/utils/request';
*/ */
export function getTestGraphData() { export function getTestGraphData() {
return request({ return request({
url: '/getData', url: '/api/getData',
method: 'get' method: 'get'
// 注意:不传 params!因为后端不接收也不需要
}); });
} }
export function getGraph(data) { export function getGraph(data) {
return request({ return request({
url: '/getGraph', url: '/api/getGraph',
method: 'post', method: 'post',
data data
// 注意:不传 params!因为后端不接收也不需要
}); });
} }

6
vue/src/api/login.js

@ -11,7 +11,7 @@ import request from '@/utils/request';
*/ */
export function login(data) { export function login(data) {
return request({ return request({
url: '/login', url: '/api/login',
method: 'post', method: 'post',
data data
}); });
@ -23,7 +23,7 @@ export function login(data) {
*/ */
export function logout() { export function logout() {
return request({ return request({
url: '/logout', url: '/api/logout',
method: 'post' method: 'post'
}); });
} }
@ -34,7 +34,7 @@ export function logout() {
*/ */
export function getUserInfo() { export function getUserInfo() {
return request({ return request({
url: '/userInfo', url: '/api/userInfo',
method: 'get' method: 'get'
}); });
} }

6
vue/src/api/profile.js

@ -8,7 +8,7 @@ import request from '@/utils/request';
*/ */
export function getUserProfile(token) { export function getUserProfile(token) {
return request({ return request({
url: '/userInfo', url: '/api/userInfo',
method: 'get', method: 'get',
params: { params: {
token token
@ -23,7 +23,7 @@ export function getUserProfile(token) {
*/ */
export function updateAvatar(formData) { export function updateAvatar(formData) {
return request({ return request({
url: '/updateAvatar', url: '/api/updateAvatar',
method: 'post', method: 'post',
data: formData, data: formData,
headers: { headers: {
@ -39,7 +39,7 @@ export function updateAvatar(formData) {
*/ */
export function updatePassword(data) { export function updatePassword(data) {
return request({ return request({
url: '/updatePassword', url: '/api/updatePassword',
method: 'post', method: 'post',
data data
}); });

33
vue/src/system/GraphDemo.vue

@ -152,7 +152,7 @@
<el-radio value="Check">检查</el-radio> <el-radio value="Check">检查</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div v-if="typeRadio='Disease'"> <div v-if="typeRadio === 'Disease'">
<el-tree <el-tree
:data="treeData" :data="treeData"
:props="treeProps" :props="treeProps"
@ -170,7 +170,6 @@
</template> </template>
</el-tree> </el-tree>
</div> </div>
</div> </div>
<!-- 图谱容器 --> <!-- 图谱容器 -->
<div ref="graphContainer" class="graph-container" id="container"></div> <div ref="graphContainer" class="graph-container" id="container"></div>
@ -504,26 +503,26 @@ export default {
}, },
edge: { edge: {
style: { style: {
labelText: (d) => d.data.relationship.type, labelText: (d) => d.data.relationship.properties.label,
stroke: (d) => { stroke: (d) => {
// target label // target label
const targetLabel = this._nodeLabelMap.get(d.target); // d.target ID const targetLabel = this._nodeLabelMap.get(d.target); // d.target ID
// target // target
if (targetLabel === 'Disease') return '#f8d2d2'; if (targetLabel === 'Disease') return 'rgba(239,68,68,0.5)';
if (targetLabel === 'Drug') return '#c0efe2'; if (targetLabel === 'Drug') return 'rgba(145,204,117,0.5)';
if (targetLabel === 'Symptom') return '#f5cebf'; if (targetLabel === 'Symptom') return 'rgba(250,200,88,0.5)';
return '#c9d3ee'; // default return 'rgba(51,110,238,0.5)'; // default
}, },
labelFill: (d) => { // labelFill: (d) => {
// target label // // target label
const targetLabel = this._nodeLabelMap.get(d.target); // d.target ID // const targetLabel = this._nodeLabelMap.get(d.target); // d.target ID
// target // // target
//
if (targetLabel === 'Disease') return '#ff4444'; // if (targetLabel === 'Disease') return '#ff4444';
if (targetLabel === 'Drug') return '#2f9b70'; // if (targetLabel === 'Drug') return '#2f9b70';
if (targetLabel === 'Symptom') return '#f89775'; // if (targetLabel === 'Symptom') return '#f89775';
return '#6b91ff'; // default // return '#6b91ff'; // default
} // }
}, },
state: { state: {

2
vue/src/system/Login.vue

@ -141,7 +141,7 @@ const handleLogin = async () => {
} }
// index // index
router.push('/index'); router.push('/kg-display');
} catch (error) { } catch (error) {
// //

40
vue/vue.config.js

@ -11,44 +11,10 @@ module.exports = defineConfig({
port: 81, port: 81,
open: true, open: true,
proxy: { proxy: {
'/login': { '/api': {
target: 'http://localhost:8088', // 更新为8088端口 target: 'http://localhost:8088',
changeOrigin: true, changeOrigin: true,
pathRewrite: { // 不需要 pathRewrite,因为前后都是 /api/xxx
'^/login': '/api/login'
}
},
'/logout': {
target: 'http://localhost:8088', // 更新为8088端口
changeOrigin: true,
pathRewrite: {
'^/logout': '/api/logout'
}
},
'/userInfo': {
target: 'http://localhost:8088', // 更新为8088端口
changeOrigin: true,
pathRewrite: {
'^/userInfo': '/api/userInfo'
}
},
'/updateAvatar': {
target: 'http://localhost:8088', // 更新为8088端口
changeOrigin: true,
pathRewrite: {
'^/updateAvatar': '/api/updateAvatar'
}
},
'/updatePassword': {
target: 'http://localhost:8088', // 更新为8088端口
changeOrigin: true,
pathRewrite: {
'^/updatePassword': '/api/updatePassword'
}
},
'/resource': {
target: 'http://localhost:8088', // 更新为8088端口
changeOrigin: true
} }
}, },
historyApiFallback: { historyApiFallback: {

Loading…
Cancel
Save