From 298074da1f5b3fac9ed9a232aa3bb28e0b46ab5c Mon Sep 17 00:00:00 2001 From: zhaoyz <11@22.com> Date: Tue, 23 Apr 2024 09:42:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/patient.ts | 17 + src/router/index.ts | 40 +- src/router/routes.ts | 4 +- src/stores/remote-ws-store.ts | 214 +++ src/stores/user-info-store.ts | 2 - src/views/index.vue | 57 +- src/views/login/login.vue | 851 +++++----- src/views/remote-manage/chart/chart-ecg.vue | 344 ++-- src/views/remote-manage/chart/chart-line.vue | 185 +-- .../remote-manage/part/message-item-part.vue | 64 +- src/views/remote-manage/part/message-part.vue | 58 +- .../remote-manage/part/remote-dialog.vue | 130 +- .../remote-manage/part/remote-item-part.vue | 202 ++- src/views/remote-manage/part/remote-part.vue | 341 ++-- src/views/remote-manage/remote-control.vue | 1443 ++++++++--------- src/views/remote-manage/remote-manage.vue | 253 +-- src/views/remote-manage/remote-thumbnail.vue | 82 +- 17 files changed, 2093 insertions(+), 2194 deletions(-) create mode 100644 src/api/patient.ts create mode 100644 src/stores/remote-ws-store.ts diff --git a/src/api/patient.ts b/src/api/patient.ts new file mode 100644 index 0000000..1adaa35 --- /dev/null +++ b/src/api/patient.ts @@ -0,0 +1,17 @@ +import request from "@/utils/request"; + +const patientInfoUrl = "/admin/medicine/getPatientInfo"; + +export function getPatientInfo(name: string, id: string, date: string) { + return new Promise((resolve, reject) => { + request.postForm(patientInfoUrl, { + patientName: name, + idNum: id, + date: date + }) + }).then((res: any) => { + console.log(res.data) + }).catch(error => { + reject(error) + }) +} \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 7230c80..2ae2c50 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -10,7 +10,7 @@ const router = createRouter({ router.beforeEach((to, from, next) => { const loginInfo = useLoginStore().getlogin() - const isLogin = loginInfo.isLogin +// const isLogin = loginInfo.isLogin // 普通用户 const commonUser = [ '/login', @@ -49,31 +49,31 @@ router.beforeEach((to, from, next) => { '/logs-manage/logs-manage' ] const isViewRoute = () => { - let release = false - switch (loginInfo.permissions) { - case '超级管理员': - release = true - break; - case '高级管理员': - release = SeniorAdmin.some((p: string) => p === to.path) - break; - case '中级管理员': - release = IntermediateAdmin.some((p: string) => p === to.path) - break; - case '普通用户': - release = commonUser.some((p: string) => p === to.path) - break; - default: - break; - } + let release = true + /*switch (loginInfo.permissions) { + case '超级管理员': + release = true + break; + case '高级管理员': + release = SeniorAdmin.some((p: string) => p === to.path) + break; + case '中级管理员': + release = IntermediateAdmin.some((p: string) => p === to.path) + break; + case '普通用户': + release = commonUser.some((p: string) => p === to.path) + break; + default: + break; + }*/ return release } if(to.fullPath ==='/login') { next() return } - if (!isLogin) next('/login') // 重定向登录页 - else if(!isViewRoute()) { + /*if (!isLogin) next('/login') // 重定向登录页 + else */if(!isViewRoute()) { ElMessage.error('无权访问!') next(from.fullPath) }else next() diff --git a/src/router/routes.ts b/src/router/routes.ts index 047133e..4624a73 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -1,6 +1,6 @@ export const constantRoute=[ - { path: '/:pathMatch(.*)*', name: 'not-found', redirect: '/home' }, + { path: '/:pathMatch(.*)*', name: 'not-found', redirect: '/login' }, { path: '/login', name: '登录', @@ -8,7 +8,7 @@ export const constantRoute=[ }, { path: '/', - redirect: '/home', + redirect: '/login', component: () => import('@/views/index.vue'), children: [ { diff --git a/src/stores/remote-ws-store.ts b/src/stores/remote-ws-store.ts new file mode 100644 index 0000000..0e586ab --- /dev/null +++ b/src/stores/remote-ws-store.ts @@ -0,0 +1,214 @@ +import {defineStore} from "pinia"; +import {Session} from "@/utils/storage"; + +const vitalUrl = "ws://localhost:5173/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken() +const medicineUrl = "ws://localhost:5173/socket.io/admin/rax/addMedicine?token=" + Session.getToken() +const chatUrl = "ws://localhost:5173/socket.io/admin/rax/chatRoom?token=" + Session.getToken() + +export const useRemoteWsStore = defineStore("remoteWs", { + state: () => { + return { + patient: {} as any, + remoteTasks: [] as any, + remoteTasksCap: 10, + currentTaskIndex: 0, + varMedicine: ["丙泊酚", "舒芬太尼", "瑞芬太尼", "顺阿曲库胺"], + fixedMedicine: ["尼卡地平", "艾司洛尔", "麻黄素", "阿托品"], + exceptionType: ["BIS_except", "DBP_except", "EtCO2_except", "HR_except", "SBP_except", "ST_except"], + exceptionMsg: { + "BIS_except": "脑电双频指数异常", "DBP_except": "舒张压异常", "EtCO2_except": "呼气末二氧化碳异常", + "HR_except": "心率异常", "SBP_except": "收缩压异常", "ST_except": "ST异常" + }, + } + }, + actions: { + initRemoteTask() { + if (this.remoteTasks.length <= 0) { + for (let i = 0; i < 10; i++) { + this.remoteTasks.push({ + isRemote: false, + isException: false, + taskName: "", + server: "", + serverun: "", + serverps: "", + patient: "", + patientId: "", + date: "", + log: [], + index: i + }) + } + } + return this.remoteTasks + }, + resetRemoteTask(i: number) { + this.remoteTasks[i] = Object.assign(this.remoteTasks[i], { + isRemote: false, + isException: false, + taskName: "", + server: "", + serverun: "", + serverps: "", + patient: "", + patientId: "", + date: "", + log: [], + index: i, + message: [] + }) + }, + getActiveRemoteTask() { + for (let i = 0; i < this.remoteTasks.length; i++) { + if (this.remoteTasks[i].isRemote) return i + } + }, + setRemoteLog(log: any, i: number) { + this.remoteTasks[i].log.push(log) + }, + createConnect(name: string, id: string, date: string) { + if (!this.patient[name + id + date]) { + const vitalWS = new WebSocket(vitalUrl) + const medicineWS = new WebSocket(medicineUrl) + const chatWS = new WebSocket(chatUrl) + vitalWS.onopen = function () { + vitalWS.send(JSON.stringify({ + patientName: name, + idNum: id, + date: date + })) + } + medicineWS.onopen = function () { + medicineWS.send(JSON.stringify({ + patientName: name, + idNum: id, + date: date + })) + } + chatWS.onopen = function () { + chatWS.send(JSON.stringify({ + patientName: name, + idNum: id, + date: date + })) + } + this.patient[name + id + date] = { + vitalWS, + medicineWS, + chatWS + } + } + }, + disconnect(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + if (patient) { + patient.vitalWS.close() + patient.medicineWS.close() + patient.chatWS.close() + delete this.patient[name + id + date] + } + }, + subscribeVital(name: string, id: string, date: string, cb: any) { + const patient: any = this.patient[name + id + date] + if (patient) { + patient.vitalWS.onmessage = cb + patient.vitalCB = cb + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + unsubscribeVital(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + if (patient && patient.vitalWS) { + patient.vitalWS.onmessage = undefined; + patient.vitalCB = undefined; + } + }, + sendMsg(name: string, id: string, date: string, msg: string, cb: any) { + const patient: any = this.patient[name + id + date] + if (patient) { + const params = { + patientName: name, + idNum: id, + date: date, + msg + } + patient.chatWS.send(JSON.stringify(params)) + cb({ + status: 0 + }) + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + subscribeChat(name: string, id: string, date: string, cb: any) { + const patient: any = this.patient[name + id + date] + if (patient) { + patient.chatCB = cb + patient.chatWS.onmessage = cb + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + unsubscribeChat(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + patient.chatCB = undefined; + patient.chatWS.onmessage = undefined; + }, + sendMedicine(args: { + name: string, + id: string, + date: string, + flag: string, + medicine: string, + value: string + }, cb: any) { + const patient: any = this.patient[args.name + args.id + args.date] + if (patient) { + const params = { + patientName: args.name, + idNum: args.id, + date: args.date, + flag: args.flag, + medicine: args.medicine, + value: args.value + } + patient.medicineWS.send(JSON.stringify(params)) + cb({ + status: 0 + }) + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + subscribeMedicine(name: string, id: string, date: string, cb: any) { + const patient = this.patient[name + id + date] + if (patient) { + patient.medicineCB = cb + patient.medicineWS.onmessage = cb + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + unsubscribeMedicine(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + patient.medicineCB = undefined; + patient.medicineWS.onmessage = undefined; + } + } +}) \ No newline at end of file diff --git a/src/stores/user-info-store.ts b/src/stores/user-info-store.ts index e0d25c8..0f99bff 100644 --- a/src/stores/user-info-store.ts +++ b/src/stores/user-info-store.ts @@ -4,7 +4,6 @@ export const useLoginStore = defineStore('login', { state: () => { return { login: { - isLogin: false, account: '', name: '', /** @@ -13,7 +12,6 @@ export const useLoginStore = defineStore('login', { * 医院中级管理员: 首页、患者管理、远程管理 * 医院普通用户: 首页、患者管理 */ - permissions: '', hospital: '' } as any } diff --git a/src/views/index.vue b/src/views/index.vue index 4233d57..464c5f1 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -82,32 +82,37 @@ getHospitalsData().then((res: any) => { const menus = [] as any switch (userInfo.permissions) { - case '超级管理员': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) - menus.push({label: '后台管理', path: '/system-manage', icon: 'icon-houtaiguanli'}) - menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) - break; - case '高级管理员': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) - menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) - break; - case '中级管理员': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) - break; - case '普通用户': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - break; - default: - break; + case '超级管理员': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + menus.push({label: '后台管理', path: '/system-manage', icon: 'icon-houtaiguanli'}) + menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) + break; + case '高级管理员': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) + break; + case '中级管理员': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + break; + case '普通用户': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + break; + default: + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + menus.push({label: '后台管理', path: '/system-manage', icon: 'icon-houtaiguanli'}) + menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) } const isShowUserInfoDrawer = ref(false) diff --git a/src/views/login/login.vue b/src/views/login/login.vue index a176562..0d292c4 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -1,127 +1,127 @@ - - - - - - - - + + + + - - - - 密码登录 - 验证码登录 - - - - - - - - - - - - - - - - - - - - - - 登录 - 注册账号 - - - - - - - + + + + 密码登录 + 验证码登录 + + + + + + + + + + + + + + + + + + + + + + 登录 + 注册账号 + + + + + + + {{ loginParams.phoneArea }} - - - {{ - item - }} - - - - - - - - - - - - {{ loginParams.sendText }} - - - - 登录 - - - - - - 新用户申请 - - - - + + + {{ + item + }} + + + + + + + + + + + + {{ loginParams.sendText }} + + + + 登录 + + + + + + 新用户申请 + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - 看不清? - + + + + + + + + + + + + + + + + + + + + + + + + + + + + 看不清? + - - - + + + - - - + + + diff --git a/src/views/remote-manage/chart/chart-ecg.vue b/src/views/remote-manage/chart/chart-ecg.vue index 8e223d1..9484df1 100644 --- a/src/views/remote-manage/chart/chart-ecg.vue +++ b/src/views/remote-manage/chart/chart-ecg.vue @@ -1,197 +1,181 @@ - - - + + + diff --git a/src/views/remote-manage/chart/chart-line.vue b/src/views/remote-manage/chart/chart-line.vue index 5b829bf..a875cda 100644 --- a/src/views/remote-manage/chart/chart-line.vue +++ b/src/views/remote-manage/chart/chart-line.vue @@ -5,102 +5,73 @@