From 5b29674a3979c1144a3251758a1e72184f76b08b Mon Sep 17 00:00:00 2001 From: yy <11@11.com> Date: Thu, 30 May 2024 20:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E7=AE=A1=E7=90=86=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- src/router/routes.ts | 2 +- src/static-data/menu.ts | 2 +- src/stores/remote-ws-store.ts | 84 ++- src/stores/user-info-store.ts | 2 +- .../patients-manage/form/patients-form.vue | 10 +- src/views/patients-manage/patients-manage.vue | 2 +- src/views/patients-manage/surgery-info.vue | 4 +- .../remote-manage/part/remote-dialog.vue | 4 +- .../remote-manage/part/remote-item-part.vue | 605 +++++++++--------- src/views/remote-manage/part/remote-part.vue | 6 +- src/views/remote-manage/remote-control.vue | 24 +- src/views/remote-manage/remote-manage.vue | 2 +- 13 files changed, 405 insertions(+), 344 deletions(-) diff --git a/index.html b/index.html index cb1d262..ff63a43 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - 瑞鞍星医疗科技 + 瑞懿为医疗科技
diff --git a/src/router/routes.ts b/src/router/routes.ts index c8fcfe6..388e27f 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -77,7 +77,7 @@ export const constantRoute = [ }, { path: '/remote-manage/remote-control', - name: '远程控制', + name: '远程查看', component: () => import('@/views/remote-manage/remote-control.vue'), } ] diff --git a/src/static-data/menu.ts b/src/static-data/menu.ts index ccb503c..a1ccfa5 100644 --- a/src/static-data/menu.ts +++ b/src/static-data/menu.ts @@ -101,7 +101,7 @@ export const getMenuData = () => { type: '菜单', },{ id: '4-2', - menuName: '远程控制', + menuName: '远程查看', order: 1, icon: '', route: '/patients-manage/surgery-info', diff --git a/src/stores/remote-ws-store.ts b/src/stores/remote-ws-store.ts index 43540b6..669c47b 100644 --- a/src/stores/remote-ws-store.ts +++ b/src/stores/remote-ws-store.ts @@ -95,13 +95,14 @@ export const useRemoteWsStore = defineStore("remoteWs", { createConnect(name: string, id: string, date: string, index: number) { if (!this.patient[name + id + date + index]) { const vitalWS = new WebSocket(vitalUrl) - const medicineWS = new WebSocket(medicineUrl) + // const medicineWS = new WebSocket(medicineUrl) const chatWS = new WebSocket(chatUrl) vitalWS.onopen = function () { vitalWS.send(JSON.stringify({ patientName: name, idNum: id, - date: date + date: date, + msgType: "msg" })) } @@ -113,7 +114,16 @@ export const useRemoteWsStore = defineStore("remoteWs", { ElMessage.error("远程管理" + (index + 1) + "出错") } - medicineWS.onopen = function () { + vitalWS.onmessage = (e: any) => { + if (e && e.data) { + const data = JSON.parse(e.data); + if (data.msgType == "heartbeat") { + vitalWS.send(JSON.stringify({msgType: "heartbeat"})) + } + } + } + +/* medicineWS.onopen = function () { medicineWS.send(JSON.stringify({ patientName: name, idNum: id, @@ -127,13 +137,14 @@ export const useRemoteWsStore = defineStore("remoteWs", { medicineWS.onerror = () => { ElMessage.error("远程管理" + (index + 1) + "给药出错") - } + }*/ chatWS.onopen = function () { chatWS.send(JSON.stringify({ patientName: name, idNum: id, - date: date + date: date, + msgType: "msg" })) } @@ -145,9 +156,18 @@ export const useRemoteWsStore = defineStore("remoteWs", { ElMessage.error("远程管理" + (index + 1) + "通讯出错") } + chatWS.onmessage = (e: any) => { + if (e && e.data) { + const data = JSON.parse(e.data); + if (data.msgType == "heartbeat") { + chatWS.send(JSON.stringify({msgType: "heartbeat"})) + } + } + } + this.patient[name + id + date + index] = { vitalWS, - medicineWS, + // medicineWS, chatWS } } @@ -156,7 +176,7 @@ export const useRemoteWsStore = defineStore("remoteWs", { const patient: any = this.patient[name + id + date + index] if (patient) { patient.vitalWS.close() - patient.medicineWS.close() + // patient.medicineWS.close() patient.chatWS.close() delete this.patient[name + id + date + index] } @@ -164,11 +184,29 @@ export const useRemoteWsStore = defineStore("remoteWs", { subscribeVital(name: string, id: string, date: string, index: number, cb: any) { const patient: any = this.patient[name + id + date + index] if (patient) { - patient.vitalWS.onmessage = cb + patient.vitalWS.onmessage = (e: any) => { + if (e && e.data) { + const data = JSON.parse(e.data); + if (data.msgType == "msg") { + cb(e) + } else { + patient.vitalWS.send(JSON.stringify({msgType: "heartbeat"})) + } + } + } patient.vitalCB = cb } else { this.createConnect(name, id, date, index) - this.patient[name + id + date + index].vitalWS.onmessage = cb + this.patient[name + id + date + index].vitalWS.onmessage = (e: any) => { + if (e && e.data) { + const data = JSON.parse(e.data); + if (data.msgType == "msg") { + cb(e) + } else { + this.patient[name + id + date + index].vitalWS.send(JSON.stringify({msgType: "heartbeat"})) + } + } + } this.patient[name + id + date + index].vitalCB = cb } }, @@ -190,7 +228,8 @@ export const useRemoteWsStore = defineStore("remoteWs", { patientName: name, idNum: id, date: date, - msg + msg, + msgType: "msg" } patient.chatWS.send(JSON.stringify(params)) cb({ @@ -207,7 +246,16 @@ export const useRemoteWsStore = defineStore("remoteWs", { const patient: any = this.patient[name + id + date + index] if (patient) { patient.chatCB = cb - patient.chatWS.onmessage = cb + patient.chatWS.onmessage = (e: any) => { + if (e && e.data) { + const data = JSON.parse(e.data); + if (data.msgType == "msg") { + cb(e) + } else { + patient.chatWS.send(JSON.stringify({msgType: "heartbeat"})) + } + } + } } else { cb({ status: 1, @@ -240,7 +288,8 @@ export const useRemoteWsStore = defineStore("remoteWs", { date: args.date, flag: args.flag, medicine: args.medicine, - value: args.value + value: args.value, + msgType: "msg" } patient.medicineWS.send(JSON.stringify(params)) cb({ @@ -257,7 +306,16 @@ export const useRemoteWsStore = defineStore("remoteWs", { const patient = this.patient[name + id + date + index] if (patient) { patient.medicineCB = cb - patient.medicineWS.onmessage = cb + patient.medicineWS.onmessage = (e: any) => { + if (e && e.data) { + const data = JSON.parse(e.data); + if (data.msgType == "msg") { + cb(e) + } else { + patient.medicineWS.send(JSON.stringify({msgType: "heartbeat"})) + } + } + } } else { cb({ status: 1, diff --git a/src/stores/user-info-store.ts b/src/stores/user-info-store.ts index 3ee9e5d..cb1d107 100644 --- a/src/stores/user-info-store.ts +++ b/src/stores/user-info-store.ts @@ -29,7 +29,7 @@ export const useUserStore = defineStore('login', { actions: { getlogin() { const onlineUser = Session.get("onlineUser"); - return this.userInfo.account ? this.userInfo : onlineUser + return this.userInfo.account && this.userInfo.account != null ? this.userInfo : onlineUser }, setlogin(key: string, e: any) { this.userInfo[key] = e diff --git a/src/views/patients-manage/form/patients-form.vue b/src/views/patients-manage/form/patients-form.vue index 4b838b2..bae6eb2 100644 --- a/src/views/patients-manage/form/patients-form.vue +++ b/src/views/patients-manage/form/patients-form.vue @@ -7,20 +7,20 @@ - - + + - + - + @@ -103,7 +103,7 @@ const rules = reactive({ {required: true, message: '请输入姓名', trigger: ['blur', 'change']}, ], code: [ - {required: true, message: '请输入住院号', trigger: ['blur', 'change']}, + {required: true, message: '请输入证件号', trigger: ['blur', 'change']}, ], dept: [ {required: true, message: '请选择科室', trigger: ['blur', 'change']}, diff --git a/src/views/patients-manage/patients-manage.vue b/src/views/patients-manage/patients-manage.vue index 77255e2..543bddf 100644 --- a/src/views/patients-manage/patients-manage.vue +++ b/src/views/patients-manage/patients-manage.vue @@ -28,7 +28,7 @@ @row-click="tableRowClick"> - +