以前代码同步到二期

二期远程控制修改
This commit is contained in:
yy 2024-06-05 09:17:57 +08:00
parent 54054c4bcc
commit ca4faa9b61
17 changed files with 2418 additions and 2283 deletions

View File

@ -22,7 +22,7 @@ export function getMonthlyLogCount(startTime: string, endTime: string) {
}) })
} }
export function getPage(current: number, size: number, condition: {timeInterval: string, logType: string}) { export function getPage(current: number, size: number, condition?: {timeInterval: string, logType: string}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request.get(getPageUrl, { request.get(getPageUrl, {
params: { params: {

View File

@ -1,159 +0,0 @@
<template>
<div></div>
</template>
<script setup lang="ts" name="global-websocket">
import { ElNotification } from 'element-plus';
import { Session } from '/@/utils/storage';
const emit = defineEmits(['rollback']);
const props = defineProps({
uri: {
type: String,
},
});
const state = reactive({
webSocket: ref(), // webSocket
lockReconnect: false, //
maxReconnect: 6, // -1
reconnectTime: 0, //
heartbeat: {
interval: 30 * 1000, //
timeout: 10 * 1000, //
pingTimeoutObj: ref(), //
pongTimeoutObj: ref(), //
pingMessage: JSON.stringify({ type: 'ping' }), //
},
});
const token = computed(() => {
return Session.getToken();
});
const tenant = computed(() => {
return Session.getTenant();
});
onMounted(() => {
initWebSocket();
});
onUnmounted(() => {
state.webSocket.close();
clearTimeoutObj(state.heartbeat);
});
const initWebSocket = () => {
// ws
let host = window.location.host;
// baseURL
let baseURL = import.meta.env.VITE_API_URL;
let wsUri = `ws://${host}${baseURL}${props.uri}?access_token=${token.value}&TENANT-ID=${tenant.value}`;
//
state.webSocket = new WebSocket(wsUri);
//
state.webSocket.onopen = onOpen;
//
state.webSocket.onerror = onError;
//
state.webSocket.onmessage = onMessage;
//
state.webSocket.onclose = onClose;
};
const reconnect = () => {
if (!token) {
return;
}
if (state.lockReconnect || (state.maxReconnect !== -1 && state.reconnectTime > state.maxReconnect)) {
return;
}
state.lockReconnect = true;
setTimeout(() => {
state.reconnectTime++;
//
initWebSocket();
state.lockReconnect = false;
}, 5000);
};
/**
* 清空定时器
*/
const clearTimeoutObj = (heartbeat: any) => {
heartbeat.pingTimeoutObj && clearTimeout(heartbeat.pingTimeoutObj);
heartbeat.pongTimeoutObj && clearTimeout(heartbeat.pongTimeoutObj);
};
/**
* 开启心跳
*/
const startHeartbeat = () => {
const webSocket = state.webSocket;
const heartbeat = state.heartbeat;
//
clearTimeoutObj(heartbeat);
//
heartbeat.pingTimeoutObj = setTimeout(() => {
//
if (webSocket.readyState === 1) {
//
webSocket.send(heartbeat.pingMessage);
//
heartbeat.pongTimeoutObj = setTimeout(() => {
webSocket.close();
}, heartbeat.timeout);
} else {
//
reconnect();
}
}, heartbeat.interval);
};
/**
* 连接成功事件
*/
const onOpen = () => {
//
startHeartbeat();
state.reconnectTime = 0;
};
/**
* 连接失败事件
* @param e
*/
const onError = () => {
//
reconnect();
};
/**
* 连接关闭事件
* @param e
*/
const onClose = () => {
//
reconnect();
};
/**
* 接收服务器推送的信息
* @param msgEvent
*/
const onMessage = (msgEvent: any) => {
//
startHeartbeat();
const text = msgEvent.data;
if (text.indexOf('pong') > 0) {
return;
}
ElNotification.warning({
title: '消息提醒',
dangerouslyUseHTMLString: true,
message: text + '请及时处理',
offset: 60,
});
emit('rollback', text);
};
</script>

View File

@ -1,9 +1,10 @@
import {defineStore} from "pinia"; import {defineStore} from "pinia";
import {Session} from "@/utils/storage"; import {Session} from "@/utils/storage";
import {ElMessage} from "element-plus";
const vitalUrl = "ws://localhost:5173/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken() const vitalUrl = "ws://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
const medicineUrl = "ws://localhost:5173/socket.io/admin/rax/addMedicine?token=" + Session.getToken() const medicineUrl = "ws://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
const chatUrl = "ws://localhost:5173/socket.io/admin/rax/chatRoom?token=" + Session.getToken() const chatUrl = "ws://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
export const useRemoteWsStore = defineStore("remoteWs", { export const useRemoteWsStore = defineStore("remoteWs", {
state: () => { state: () => {
@ -19,10 +20,43 @@ export const useRemoteWsStore = defineStore("remoteWs", {
"BIS_except": "脑电双频指数异常", "DBP_except": "舒张压异常", "EtCO2_except": "呼气末二氧化碳异常", "BIS_except": "脑电双频指数异常", "DBP_except": "舒张压异常", "EtCO2_except": "呼气末二氧化碳异常",
"HR_except": "心率异常", "SBP_except": "收缩压异常", "ST_except": "ST异常" "HR_except": "心率异常", "SBP_except": "收缩压异常", "ST_except": "ST异常"
} as any, } as any,
exceptions: {} as any,
closeStatus: {} as any
} }
}, },
actions: { actions: {
setCurrentTaskIndex(i: number) {
this.currentTaskIndex = i
Session.set("currentTaskIndex", i)
},
getCurrentTaskIndex() {
if (Session.get("currentTaskIndex") && Session.get("currentTaskIndex") > -1) {
this.currentTaskIndex = Session.get("currentTaskIndex")
}
return this.currentTaskIndex
},
setExceptions(i: number, e: any) {
this.exceptions[i] = e
},
getExceptions() {
return this.exceptions
},
getCloseStatus() {
return this.closeStatus
},
setRemoteTask() {
Session.set("remoteTasks", this.remoteTasks)
},
getRemoteTask() {
if (Session.get("remoteTasks") && !this.remoteTasks) {
this.remoteTasks = Session.get("remoteTasks")
}
return this.remoteTasks
},
initRemoteTask() { initRemoteTask() {
if (Session.get("remoteTasks") && !this.remoteTasks) {
this.remoteTasks = Session.get("remoteTasks")
}
if (this.remoteTasks.length <= 0) { if (this.remoteTasks.length <= 0) {
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
this.remoteTasks.push({ this.remoteTasks.push({
@ -57,62 +91,74 @@ export const useRemoteWsStore = defineStore("remoteWs", {
index: i, index: i,
message: [] message: []
}) })
Session.set("remoteTasks", this.remoteTasks)
}, },
getActiveRemoteTask() { getActiveRemoteTask() {
let index = 0
for (let i = 0; i < this.remoteTasks.length; i++) { for (let i = 0; i < this.remoteTasks.length; i++) {
if (this.remoteTasks[i].isRemote) return i if (this.remoteTasks[i].isRemote) index = i
} }
return index
}, },
setRemoteLog(log: any, i: number) { setRemoteLog(log: any, i: number) {
this.remoteTasks[i].log.push(log) 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) { disconnect(name: string, id: string, date: string) {
const patient: any = this.patient[name + id + date] this.disconnectVital(name, id, date)
if (patient) { this.disconnectChat(name, id, date)
patient.vitalWS.close() this.disconnectMedicine(name, id, date)
patient.medicineWS.close()
patient.chatWS.close()
delete this.patient[name + id + date] delete this.patient[name + id + date]
},
createVitalConnect(name: string, id: string, date: string) {
if (!this.patient[name + id + date]) this.patient[name + id + date] = {}
const patient = this.patient[name + id + date]
if (!patient['vitalWS']) {
patient['vitalWS'] = new WebSocket(vitalUrl)
patient.vitalWS.onopen = () => {
patient.vitalWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date,
msgType: "msg"
}))
}
} }
}, },
subscribeVital(name: string, id: string, date: string, cb: any) { subscribeVital(name: string, id: string, date: string, cb: any) {
const patient: any = this.patient[name + id + date] const patient = this.patient[name + id + date]
if (patient) { if (patient.vitalWS) {
patient.vitalWS.onmessage = cb patient.vitalWS.onmessage = (e: any) => {
patient.vitalCB = cb if (e && e.data) {
const data = JSON.parse(e.data);
if (data.msgType == "msg") {
cb(e)
} else {
patient.vitalWS.send(JSON.stringify({msgType: "heartbeat"}))
}
}
}
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
vitalOnclose(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient.vitalWS) {
patient.vitalWS.onclose = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
vitalOnerror(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient.vitalWS) {
patient.vitalWS.onerror = cb
} else { } else {
cb({ cb({
status: 1, status: 1,
@ -121,10 +167,85 @@ export const useRemoteWsStore = defineStore("remoteWs", {
} }
}, },
unsubscribeVital(name: string, id: string, date: string) { unsubscribeVital(name: string, id: string, date: string) {
const patient: any = this.patient[name + id + date]
if (patient) {
patient.vitalWS.onmessage = undefined
patient.vitalWS.onclose = undefined
patient.vitalWS.onerror = undefined
}
},
disconnectVital(name: string, id: string, date: string) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date]
if (patient && patient.vitalWS) { if (patient && patient.vitalWS) {
patient.vitalWS.onmessage = undefined; this.closeStatus[name + id + date + 'vitalWS'] = true
patient.vitalCB = undefined; patient.vitalWS.close()
delete patient['vitalWS']
delete this.closeStatus[name + id + date + 'vitalWS']
}
},
createChatConnect(name: string, id: string, date: string) {
if (!this.patient[name + id + date]) this.patient[name + id + date] = {}
const patient = this.patient[name + id + date]
if (!patient['chatWS']) {
patient['chatWS'] = new WebSocket(chatUrl)
patient.chatWS.onopen = function () {
patient.chatWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date,
msgType: "msg"
}))
}
}
},
subscribeChat(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient.chatWS) {
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,
msg: "已断开连接"
})
}
},
chatOnclose(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient.chatWS) {
patient.chatWS.onclose = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
chatOnerror(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient.chatWS) {
patient.chatWS.onerror = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
unsubscribeChat(name: string, id: string, date: string) {
const patient: any = this.patient[name + id + date]
if (patient) {
patient.chatWS.onmessage = undefined
patient.chatWS.onclose = undefined
patient.chatWS.onerror = undefined
} }
}, },
sendMsg(name: string, id: string, date: string, msg: string, cb: any) { sendMsg(name: string, id: string, date: string, msg: string, cb: any) {
@ -147,11 +268,43 @@ export const useRemoteWsStore = defineStore("remoteWs", {
}) })
} }
}, },
subscribeChat(name: string, id: string, date: string, cb: any) { disconnectChat(name: string, id: string, date: string) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date]
if (patient && patient.chatWS) {
this.closeStatus[name + id + date + 'chatWS'] = true
patient.chatWS.close()
delete patient['chatWS']
delete this.closeStatus[name + id + date + 'chatWS']
}
},
createMedicineConnect(name: string, id: string, date: string) {
if (!this.patient[name + id + date]) this.patient[name + id + date] = {}
const patient = this.patient[name + id + date]
if (!patient['medicineWS']) {
patient['medicineWS'] = new WebSocket(medicineUrl)
patient.medicineWS.onopen = function () {
patient.medicineWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date,
msgType: "msg"
}))
}
}
},
subscribeMedicine(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient) { if (patient) {
patient.chatCB = cb patient.medicineWS.onmessage = (e: any) => {
patient.chatWS.onmessage = cb 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 { } else {
cb({ cb({
status: 1, status: 1,
@ -159,10 +312,35 @@ export const useRemoteWsStore = defineStore("remoteWs", {
}) })
} }
}, },
unsubscribeChat(name: string, id: string, date: string) { medicineOnclose(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient.medicineWS) {
patient.medicineWS.onclose = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
medicineOnerror(name: string, id: string, date: string, cb: any) {
const patient = this.patient[name + id + date]
if (patient.medicineWS) {
patient.medicineWS.onerror = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
unsubscribeMedicine(name: string, id: string, date: string) {
const patient: any = this.patient[name + id + date] const patient: any = this.patient[name + id + date]
patient.chatCB = undefined; if (patient) {
patient.chatWS.onmessage = undefined; patient.medicineWS.onmessage = undefined
patient.medicineWS.onclose = undefined
patient.medicineWS.onerror = undefined
}
}, },
sendMedicine(args: { sendMedicine(args: {
name: string, name: string,
@ -193,22 +371,14 @@ export const useRemoteWsStore = defineStore("remoteWs", {
}) })
} }
}, },
subscribeMedicine(name: string, id: string, date: string, cb: any) { disconnectMedicine(name: string, id: string, date: string) {
const patient = this.patient[name + id + date] const patient: any = this.patient[name + id + date]
if (patient) { if (patient && patient.medicineWS) {
patient.medicineCB = cb this.closeStatus[name + id + date + 'medicineWS'] = true
patient.medicineWS.onmessage = cb patient.medicineWS.close()
} else { delete patient['medicineWS']
cb({ delete this.closeStatus[name + id + date + 'medicineWS']
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;
}
} }
}) })

View File

@ -79,7 +79,7 @@ function handleResponse(response: any) {
axiosInstance.interceptors.response.use(handleResponse, error => { axiosInstance.interceptors.response.use(handleResponse, error => {
const code = error.response.status || 200 const code = error.response.status || 200
if (code == 424 || code == 401) { if (code == 424) {
ElMessageBox.confirm('令牌状态已过期,请点击重新登录', "系统提示", { ElMessageBox.confirm('令牌状态已过期,请点击重新登录', "系统提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",

View File

@ -12,8 +12,8 @@
</div> </div>
<div class="header-box"> <div class="header-box">
<div class="header-item"> <div class="header-item">
<span class="main-color f20" style="font-weight: 600;">{{ userInfo.name }}</span> <span class="main-color f20" style="font-weight: 600;">{{ userInfo?.name }}</span>
<span class="text2-color f14">{{ userInfo.roleName }}</span> <span class="text2-color f14">{{ userInfo?.roleName }}</span>
</div> </div>
<div class="header-item"> <div class="header-item">
<el-icon class="text1-color" style="font-size: 26px;margin-right: 20px;"> <el-icon class="text1-color" style="font-size: 26px;margin-right: 20px;">
@ -55,39 +55,6 @@
</div> </div>
</div> </div>
</div> </div>
<el-drawer
class="message-drawer-box"
v-model="userStore.showHomeMsg"
title="通知消息"
>
<div class="body">
<el-card style="margin-top: 10px;" v-for="(item, index) in messageTable">
<template #header>
<div class="card-header">
<span>{{ item.category }}</span>
</div>
</template>
<p class="text item">{{ item.message }}</p>
<template #footer>
<span>{{ item.creatorName }}</span>
<span style="float: inline-end;">{{ item.createTime }}</span>
</template>
</el-card>
</div>
<div class="footer">
<el-pagination
v-model:page-size="size"
v-model:current-page="current"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
layout="prev, pager, next, jumper, sizes"
:page-sizes="[10, 20, 30, 50]"
:total="total"
/>
</div>
</el-drawer>
</div> </div>
</template> </template>
@ -110,10 +77,6 @@ const userStore = useUserStore();
const userInfo = userStore.getlogin() const userInfo = userStore.getlogin()
const showLogMod = ref(false) const showLogMod = ref(false)
const messages = ref([] as any) const messages = ref([] as any)
const messageTable = ref([] as any)
const current = ref(1);
const size = ref(10);
const total = ref(0);
const todoTotal = ref(0) // const todoTotal = ref(0) //
onMounted(() => { onMounted(() => {
@ -131,9 +94,6 @@ function init() {
}); });
getTodoCount(); getTodoCount();
messages.value = []; messages.value = [];
messageTable.value = [];
current.value = 1
total.value = 0
loadMsg(); loadMsg();
} }
@ -145,25 +105,11 @@ function getTodoCount() {
}); });
} }
function handleSizeChange() {
messageTable.value = [];
loadMsg()
}
function handleCurrentChange() {
messageTable.value = [];
loadMsg()
}
async function loadMsg() { async function loadMsg() {
const res = await msgApi.page(current.value, size.value) const res = await msgApi.page(0, 10)
if (res.code == 0) { if (res.code == 0) {
total.value = res.data.total
res.data.records.forEach((row: any) => { res.data.records.forEach((row: any) => {
if (current.value == 1) {
messages.value.push(row) messages.value.push(row)
}
messageTable.value.push(row)
}) })
} }
} }

View File

@ -15,7 +15,8 @@
<!-- 超级管理员可切换医院 --> <!-- 超级管理员可切换医院 -->
<el-select class="select-hospital" style="width: 150px;" <el-select class="select-hospital" style="width: 150px;"
v-model="hospital" size="small" @change="selectHospital"> v-model="hospital" size="small" @change="selectHospital">
<el-option v-for="item in hospitals" :key="item.id" :label="item.name" :value="item.id"/> <el-option v-for="(item, index) in hospitals" :key="index" :label="item.name"
:value="item.id ? item.id : ''"/>
</el-select> </el-select>
<!-- <el-button text> <!-- <el-button text>
<el-icon> <el-icon>
@ -36,7 +37,7 @@
</el-button> </el-button>
<el-dropdown trigger="click" @command="userCommand"> <el-dropdown trigger="click" @command="userCommand">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{ userInfo.name }} {{ userInfo?.name }}
<el-icon class="el-icon--right"> <el-icon class="el-icon--right">
<arrow-down/> <arrow-down/>
</el-icon> </el-icon>
@ -56,6 +57,39 @@
<el-drawer v-model="isShowUserInfoDrawer" size="35%" :with-header="false"> <el-drawer v-model="isShowUserInfoDrawer" size="35%" :with-header="false">
<userInfoForm @close="isShowUserInfoDrawer = false"/> <userInfoForm @close="isShowUserInfoDrawer = false"/>
</el-drawer> </el-drawer>
<el-drawer
class="message-drawer-box"
v-model="userStore.showHomeMsg"
title="通知消息"
>
<div class="body">
<el-card style="margin-top: 10px;" v-for="(item, index) in messageTable">
<template #header>
<div class="card-header">
<span>{{ item.category }}</span>
</div>
</template>
<p class="text item">{{ item.message }}</p>
<template #footer>
<span>{{ item.creatorName }}</span>
<span style="float: inline-end;">{{ item.createTime }}</span>
</template>
</el-card>
</div>
<div class="footer">
<el-pagination
v-model:page-size="size"
v-model:current-page="current"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
layout="prev, pager, next, jumper, sizes"
:page-sizes="[10, 20, 30, 50]"
:total="total"
/>
</div>
</el-drawer>
</div> </div>
</template> </template>
@ -67,6 +101,7 @@ import {useUserStore} from '@/stores/user-info-store'
import userInfoForm from '@/components/user-info.vue' import userInfoForm from '@/components/user-info.vue'
import {logout} from "@/api/login"; import {logout} from "@/api/login";
import * as hospitalApi from "@/api/hospital"; import * as hospitalApi from "@/api/hospital";
import * as msgApi from "@/api/sys-message";
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@ -78,6 +113,10 @@ const hospitals = ref([] as any)
const menus = ref([] as any) const menus = ref([] as any)
const isShowUserInfoDrawer = ref(false) const isShowUserInfoDrawer = ref(false)
const menuActive = ref('/') const menuActive = ref('/')
const messageTable = ref([] as any)
const current = ref(1);
const size = ref(10);
const total = ref(0);
router.isReady().then(() => { router.isReady().then(() => {
menuActive.value = route.path menuActive.value = route.path
@ -94,6 +133,9 @@ onMounted(() => {
function init() { function init() {
getHospitalList(); getHospitalList();
handleMenu(); handleMenu();
messageTable.value = [];
current.value = 1
total.value = 0
} }
function handleMenu() { function handleMenu() {
@ -102,9 +144,29 @@ function handleMenu() {
}); });
} }
function handleSizeChange() {
messageTable.value = [];
loadMsg()
}
function handleCurrentChange() {
messageTable.value = [];
loadMsg()
}
async function loadMsg() {
const res = await msgApi.page(current.value, size.value)
if (res.code == 0) {
total.value = res.data.total
res.data.records.forEach((row: any) => {
messageTable.value.push(row)
})
}
}
const menuToPath = (e: any) => { const menuToPath = (e: any) => {
menuActive.value = e.path menuActive.value = e.path
router.push(e.path) router.push(e.children.length > 0 ? (e.children[0].path ? e.children[0].path : e.path) : e.path)
} }
async function getHospitalList() { async function getHospitalList() {
@ -113,7 +175,7 @@ async function getHospitalList() {
hospitals.value = []; hospitals.value = [];
if (res.code == 0 && res.data.length > 0) { if (res.code == 0 && res.data.length > 0) {
hospitals.value = res.data; hospitals.value = res.data;
if (data.data) { if (data.data && data.data != 'null') {
hospital.value = data.data; hospital.value = data.data;
} }
preHospital.value = hospital.value preHospital.value = hospital.value

View File

@ -11,7 +11,7 @@ import {dateFormater} from '@/utils/date-util';
import {useRemoteWsStore} from "@/stores/remote-ws-store"; import {useRemoteWsStore} from "@/stores/remote-ws-store";
const chartDom = ref(); const chartDom = ref();
const props = withDefaults(defineProps<{ names?: string[] }>(), { const props = withDefaults(defineProps<{ names?: any }>(), {
names: ['CH1', 'CH2'] names: ['CH1', 'CH2']
}); });
defineExpose({ defineExpose({
@ -67,7 +67,7 @@ function chartInit() {
formatter: (params: any) => { formatter: (params: any) => {
let str = params[0].axisValue; let str = params[0].axisValue;
str += `<br>`; str += `<br>`;
props.names.forEach((item, index) => { props.names.forEach((item: any, index: any) => {
str += params[index].marker; str += params[index].marker;
str += params[index].seriesName + ' '; str += params[index].seriesName + ' ';
str += `${params[index].value} HZ`; str += `${params[index].value} HZ`;
@ -124,8 +124,8 @@ function getXData() {
} }
function getSeries() { function getSeries() {
props.names.forEach((name, index) => { props.names.forEach((name: any, index: any) => {
const serie = { const serie: any = {
name, name,
type: 'line', type: 'line',
symbol: 'none', symbol: 'none',

View File

@ -12,7 +12,7 @@ import {useRemoteWsStore} from "@/stores/remote-ws-store";
const chartDom = ref(); const chartDom = ref();
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
names: string[] names: any
}>(), { }>(), {
names: ['BIS', 'HR'] names: ['BIS', 'HR']
}); });
@ -41,7 +41,7 @@ function updateChartData(data: any) {
} }
xData.shift(); xData.shift();
xData.push(dateFormater("HH:mm:ss", data.Time ? data.Time - 8 * 60 * 60 * 1000 : '')); xData.push(dateFormater("HH:mm:ss", data.Time ? data.Time - 8 * 60 * 60 * 1000 : ''));
series.forEach(serie => { series.forEach((serie: any) => {
serie.data.shift(); serie.data.shift();
serie.data.push(data[serie.name]); serie.data.push(data[serie.name]);
if (data[serie.name + '_except']) { if (data[serie.name + '_except']) {
@ -71,7 +71,7 @@ function chartInit() {
let str = ''; let str = '';
str += params[0].axisValue; str += params[0].axisValue;
str += '<br>'; str += '<br>';
props.names.forEach((item, index) => { props.names.forEach((item: any, index: any) => {
str += params[index].marker; str += params[index].marker;
str += params[index].seriesName + ' '; str += params[index].seriesName + ' ';
switch (item) { switch (item) {
@ -116,7 +116,7 @@ function chartInit() {
lineHeight: 30, lineHeight: 30,
}, },
formatter: (params: string) => { formatter: (params: string) => {
const index = props.names.findIndex((item) => item === params); const index = props.names.findIndex((item: any) => item === params);
let str = params + ' '; let str = params + ' ';
switch (params) { switch (params) {
case 'BIS': case 'BIS':
@ -181,7 +181,7 @@ function chartInit() {
} }
function getSeries() { function getSeries() {
props.names.forEach(name => { props.names.forEach((name: any) => {
const serie = { const serie = {
name, name,
type: 'line', type: 'line',
@ -203,7 +203,7 @@ function getXData() {
} }
function getLegendData() { function getLegendData() {
props.names.forEach((name, index) => { props.names.forEach((name: any, index: any) => {
legendData.push({ legendData.push({
name, name,
textStyle: {color: colors[index]}, textStyle: {color: colors[index]},

View File

@ -3,7 +3,7 @@
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import { onMounted, reactive, ref, toRefs, watch } from 'vue' import {onMounted} from 'vue'
import {useRoute, useRouter} from "vue-router"; import {useRoute, useRouter} from "vue-router";
import {useUserStore} from "@/stores/user-info-store"; import {useUserStore} from "@/stores/user-info-store";

View File

@ -2,7 +2,7 @@
<div class="message-item-part"> <div class="message-item-part">
<div class="tag-index">{{ index + 1 }}</div> <div class="tag-index">{{ index + 1 }}</div>
<ul ref="listRef"> <ul ref="listRef">
<li v-for="(item, i) in remoteWsStore.remoteTasks[index]?.log || []" :key="i"> <li v-for="(item, i) in remoteWsStore.getRemoteTask()[index]?.log || []" :key="i">
<span>{{ dateFormater('yyyy-MM-dd HH:mm:ss', item.time) }}</span> <span>{{ dateFormater('yyyy-MM-dd HH:mm:ss', item.time) }}</span>
<span>{{ item.taskName }}</span> <span>{{ item.taskName }}</span>
<span>{{ item.state }}</span> <span>{{ item.state }}</span>

View File

@ -5,7 +5,7 @@
</div> </div>
<div ref="listRef" class="content"> <div ref="listRef" class="content">
<el-timeline> <el-timeline>
<el-timeline-item v-for="(item, index) in remoteWsStore.remoteTasks[remoteWsStore.currentTaskIndex]?.log || []" :key="index" <el-timeline-item v-for="(item, index) in remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()]?.log || []" :key="index"
:timestamp="dateFormater('yyyy-MM-dd HH:mm:ss', item.time)" :timestamp="dateFormater('yyyy-MM-dd HH:mm:ss', item.time)"
:class="{ 'alarm': item.state === '连接失败' || item.state === '异常' }"> :class="{ 'alarm': item.state === '连接失败' || item.state === '异常' }">
{{ item.taskName + ' ' + item.state }} {{ item.taskName + ' ' + item.state }}
@ -20,7 +20,6 @@ import {ref} from 'vue'
import {dateFormater} from '@/utils/date-util' import {dateFormater} from '@/utils/date-util'
import {useRemoteWsStore} from "@/stores/remote-ws-store"; import {useRemoteWsStore} from "@/stores/remote-ws-store";
defineExpose({ defineExpose({
setData, setData,
scrollToBottom scrollToBottom

View File

@ -50,7 +50,7 @@ defineExpose({
}) })
function open(i: number) { function open(i: number) {
patientInfo.value = remoteWsStore.remoteTasks[i]; patientInfo.value = remoteWsStore.getRemoteTask()[i]
patientInfo.value.date = new Date(); patientInfo.value.date = new Date();
dialogVisible.value = true; dialogVisible.value = true;
} }
@ -65,14 +65,14 @@ const confirmRemote = () => {
patientInfo.value.isRemote = true patientInfo.value.isRemote = true
patientInfo.value.taskName = '远程控制' + (patientInfo.value.index + 1) patientInfo.value.taskName = '远程控制' + (patientInfo.value.index + 1)
patientInfo.value.date = dateFormater("yyyyMMdd", patientInfo.value.date) patientInfo.value.date = dateFormater("yyyyMMdd", patientInfo.value.date)
unsubscribeLastTask(); unsubscribeLastTask()
remoteWsStore.$patch({currentTaskIndex: patientInfo.value.index}) remoteWsStore.setCurrentTaskIndex(patientInfo.value.index)
remoteWsStore.setRemoteLog({ remoteWsStore.setRemoteLog({
time: new Date(), time: new Date(),
taskName: patientInfo.value.taskName, taskName: patientInfo.value.taskName,
state: '连接成功', state: '连接成功',
type: "normal" type: "normal"
}, remoteWsStore.currentTaskIndex) }, remoteWsStore.getCurrentTaskIndex())
emit('confirmRemote', patientInfo.value) emit('confirmRemote', patientInfo.value)
close() close()
} else { } else {
@ -92,8 +92,8 @@ const breakRemote = () => {
} }
const unsubscribeLastTask = () => { const unsubscribeLastTask = () => {
const lastTaskIndex = remoteWsStore.currentTaskIndex; const lastTaskIndex = remoteWsStore.getCurrentTaskIndex();
const lastTask: any = remoteWsStore.remoteTasks[lastTaskIndex]; const lastTask: any = remoteWsStore.getRemoteTask()[lastTaskIndex];
if (lastTask) { if (lastTask) {
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date); remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date);
} }
@ -107,34 +107,42 @@ const unsubscribeLastTask = () => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
&>img {
& > img {
width: 260px; width: 260px;
border: 1px solid #C77000; border: 1px solid #C77000;
border-radius: 20px; border-radius: 20px;
} }
.info { .info {
width: calc(100% - 290px); width: calc(100% - 290px);
color: $main-color; color: $main-color;
line-height: 2; line-height: 2;
font-weight: 600; font-weight: 600;
h3 { h3 {
font-size: 28px; font-size: 28px;
} }
p { p {
font-size: 15px; font-size: 15px;
} }
.input-box { .input-box {
display: flex; display: flex;
align-items: center; align-items: center;
&>span { & > span {
flex-shrink: 0; flex-shrink: 0;
} }
:deep(.el-input) { :deep(.el-input) {
border-bottom: 1px solid $text3-color; border-bottom: 1px solid $text3-color;
.el-input__wrapper { .el-input__wrapper {
box-shadow: none; box-shadow: none;
padding: 0; padding: 0;
input { input {
height: 20px; height: 20px;
font-size: 15px; font-size: 15px;
@ -151,6 +159,7 @@ const unsubscribeLastTask = () => {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 50px; margin-top: 50px;
.el-button { .el-button {
font-weight: 600; font-weight: 600;
padding: 15px 50px; padding: 15px 50px;

View File

@ -61,13 +61,14 @@
<script lang='ts' setup> <script lang='ts' setup>
import {onMounted, onUnmounted, ref} from 'vue' import {onMounted, onUnmounted, ref} from 'vue'
import {useRemoteWsStore} from "@/stores/remote-ws-store"; import {useRemoteWsStore} from "@/stores/remote-ws-store";
import {ElMessage} from "element-plus";
const props = withDefaults(defineProps<{ index: number }>(), { const props = withDefaults(defineProps<{ index: number }>(), {
index: () => 0 index: () => 0
}) })
const emit = defineEmits(['addLogAfter']) const emit = defineEmits(['addLogAfter'])
const remoteWsStore = useRemoteWsStore(); const remoteWsStore = useRemoteWsStore();
const remoteTask = ref(remoteWsStore.remoteTasks[props.index]); const remoteTask = ref(remoteWsStore.getRemoteTask()[props.index]);
const patientInfo = ref({} as any) const patientInfo = ref({} as any)
onMounted(() => { onMounted(() => {
@ -81,7 +82,8 @@ onUnmounted(() => {
}) })
function initData() { function initData() {
subscribeVital(); onClose()
subscribeVital()
} }
function subscribeVital() { function subscribeVital() {
@ -97,18 +99,33 @@ function subscribeVital() {
}) })
} }
const onClose = () => {
remoteWsStore.vitalOnclose(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, () => {
ElMessage.info('远程' + props.index + '已断开!')
const status = remoteWsStore.getCloseStatus()
if (!status[remoteTask.value.patient + remoteTask.value.patientId + remoteTask.value.date + 'vitalWS']) {
setTimeout(() => {
initData()
}, 3000)
}
})
}
function setLog(data: any, index: number) { function setLog(data: any, index: number) {
if (remoteWsStore.getExceptions()[index]?.Time != data.Time) {
remoteWsStore.setExceptions(index, data)
remoteWsStore.exceptionType.forEach((item: any) => { remoteWsStore.exceptionType.forEach((item: any) => {
if (data[item]) { if (data[item]) {
const msg: any = remoteWsStore.exceptionMsg[item]; const msg: any = remoteWsStore.exceptionMsg[item];
remoteWsStore.setRemoteLog({ remoteWsStore.setRemoteLog({
state: msg, state: msg,
taskName: remoteTask.value.taskName, taskName: remoteTask.value.taskName,
time: new Date(), time: item.Time,
type: "exception" type: "exception"
}, index); }, index);
} }
}) })
}
} }
</script> </script>
@ -122,6 +139,7 @@ $size: 20px;
width: 100%; width: 100%;
height: 100%; height: 100%;
border: 1px solid $border-color; border: 1px solid $border-color;
&::after { &::after {
content: ''; content: '';
position: absolute; position: absolute;
@ -133,6 +151,7 @@ $size: 20px;
transition: all .6s; transition: all .6s;
z-index: 1; z-index: 1;
} }
&:hover { &:hover {
&::after { &::after {
background-color: rgba(black, .1); background-color: rgba(black, .1);
@ -223,7 +242,7 @@ $size: 20px;
} }
.label { .label {
width: calc(50% - $size*0.5); width: calc(50% - $size * 0.5);
} }
.value { .value {

View File

@ -119,6 +119,7 @@
<script lang='ts' setup> <script lang='ts' setup>
import {onUnmounted, ref} from 'vue' import {onUnmounted, ref} from 'vue'
import {useRemoteWsStore} from "@/stores/remote-ws-store"; import {useRemoteWsStore} from "@/stores/remote-ws-store";
import {ElMessage} from "element-plus";
const emit = defineEmits(['addLogAfter', 'breakRemote']) const emit = defineEmits(['addLogAfter', 'breakRemote'])
const mediaMini800 = ref(false) const mediaMini800 = ref(false)
@ -135,59 +136,80 @@ window.addEventListener('resize', () => {
}); });
onUnmounted(() => { onUnmounted(() => {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date); remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
}) })
function showData(i: any) { function showData(i: any) {
const lastTaskIndex = remoteWsStore.currentTaskIndex; const lastTaskIndex = remoteWsStore.getCurrentTaskIndex();
const lastTask: any = remoteWsStore.remoteTasks[lastTaskIndex]; const lastTask: any = remoteWsStore.getRemoteTask()[lastTaskIndex];
if (lastTask) { if (lastTask) {
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date); remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date)
} }
remoteWsStore.currentTaskIndex = i remoteWsStore.setCurrentTaskIndex(i)
remoteItem.value = remoteWsStore.remoteTasks[remoteWsStore.currentTaskIndex] remoteItem.value = remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()]
onClose()
getData() getData()
} }
function initData() { function initData() {
remoteItem.value = remoteWsStore.remoteTasks[remoteWsStore.currentTaskIndex] remoteItem.value = remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()]
remoteWsStore.createConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date) if (remoteItem.value.patient && remoteItem.value.patientId && remoteItem.value.date) {
remoteWsStore.createVitalConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
onClose()
getData() getData()
}
}
const onClose = () => {
remoteWsStore.vitalOnclose(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, () => {
ElMessage.info('远程' + remoteWsStore.getCurrentTaskIndex() + '已断开!')
const status = remoteWsStore.getCloseStatus()
if (!status[remoteItem.value.patient + remoteItem.value.patientId + remoteItem.value.date + 'vitalWS']) {
setTimeout(() => {
initData()
}, 3000)
}
})
} }
function getData() { function getData() {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date); remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, (res: any) => { remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, (res: any) => {
if (res && res.data) { if (res && res.data) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data)
if (data.vitalSignsList && data.vitalSignsList.length > 0) { if (data.vitalSignsList && data.vitalSignsList.length > 0) {
Object.assign(patientInfo.value, data.vitalSignsList[0]); Object.assign(patientInfo.value, data.vitalSignsList[0]);
patientInfo.value.state = (patientInfo.value.BIS_except || patientInfo.value.SBP_except || patientInfo.value.state = (patientInfo.value.BIS_except || patientInfo.value.SBP_except ||
patientInfo.value.DBP_except || patientInfo.value.HR_except); patientInfo.value.DBP_except || patientInfo.value.HR_except)
setLog(patientInfo.value) setLog(patientInfo.value)
emit('addLogAfter') emit('addLogAfter')
} else if (data.code == 1) {
ElMessage.error(data.msg)
} }
} }
}) })
} }
function setLog(data: any) { function setLog(data: any) {
if (remoteWsStore.getExceptions()[remoteWsStore.getCurrentTaskIndex()]?.Time != data.Time) {
remoteWsStore.setExceptions(remoteWsStore.getCurrentTaskIndex(), data)
remoteWsStore.exceptionType.forEach((item: any) => { remoteWsStore.exceptionType.forEach((item: any) => {
if (data[item]) { if (data[item]) {
const msg: any = remoteWsStore.exceptionMsg[item]; const msg: any = remoteWsStore.exceptionMsg[item]
remoteWsStore.setRemoteLog({ remoteWsStore.setRemoteLog({
state: msg, state: msg,
taskName: remoteItem.value.taskName, taskName: remoteItem.value.taskName,
time: new Date(), time: item.Time,
type: "exception" type: "exception"
}, remoteWsStore.currentTaskIndex); }, remoteWsStore.getCurrentTaskIndex())
} }
}) })
}
} }
const breakRemote = () => { const breakRemote = () => {
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date) remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
remoteWsStore.resetRemoteTask(remoteWsStore.currentTaskIndex) remoteWsStore.resetRemoteTask(remoteWsStore.getCurrentTaskIndex())
if (remoteWsStore.getActiveRemoteTask()) { if (remoteWsStore.getActiveRemoteTask()) {
showData(remoteWsStore.getActiveRemoteTask()) showData(remoteWsStore.getActiveRemoteTask())
} }

View File

@ -17,7 +17,8 @@
<div class="body-box"> <div class="body-box">
<div class="body-img"> <div class="body-img">
<img src="@/assets/imgs/main_body.png" style="width: 100%;height: 100%;"/> <img src="@/assets/imgs/main_body.png" style="width: 100%;height: 100%;"/>
<img class="lung-img" :class="{ 'shake_1': lungAlarm }" :src="lungAlarm ? imgLungAlarm : imgLung"> <img class="lung-img" :class="{ 'shake_1': lungAlarm }"
:src="lungAlarm ? imgLungAlarm : imgLung">
<img class="heart-img" :class="{ 'shake_1': heartAlarm }" <img class="heart-img" :class="{ 'shake_1': heartAlarm }"
:src="heartAlarm ? imgHeartAlarm : imgHeart"> :src="heartAlarm ? imgHeartAlarm : imgHeart">
</div> </div>
@ -101,7 +102,8 @@
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item command="速度(ug/kg/min)">速度(ug/kg/min)</el-dropdown-item> <el-dropdown-item command="速度(ug/kg/min)">速度(ug/kg/min)
</el-dropdown-item>
<el-dropdown-item command="速度(ml/h)">速度(ml/h)</el-dropdown-item> <el-dropdown-item command="速度(ml/h)">速度(ml/h)</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
@ -128,7 +130,8 @@
</el-button> </el-button>
<!-- <el-button size="small" color="#006080" @click="tableItemConfirm(scope)" <!-- <el-button size="small" color="#006080" @click="tableItemConfirm(scope)"
:disabled="tableDataStore[scope.$index].speed === scope.row.speed">确定--> :disabled="tableDataStore[scope.$index].speed === scope.row.speed">确定-->
<el-button size="small" color="#006080" @click="tableItemConfirm(scope, varTableData)">确定 <el-button size="small" color="#006080"
@click="tableItemConfirm(scope, varTableData)">确定
</el-button> </el-button>
<el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消 <el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消
</el-button> </el-button>
@ -161,7 +164,8 @@
<Minus/> <Minus/>
</el-icon> </el-icon>
</el-button> </el-button>
<el-button size="small" color="#006080" @click="tableItemConfirm(scope, fixedTableData)">确定 <el-button size="small" color="#006080"
@click="tableItemConfirm(scope, fixedTableData)">确定
</el-button> </el-button>
<el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消 <el-button size="small" color="#006080" @click="tableItemCancel(scope)">取消
</el-button> </el-button>
@ -221,7 +225,7 @@ const medicineCustom: any[] = [
{name: '罗库溴铵', plus: 0.1, total: 10} {name: '罗库溴铵', plus: 0.1, total: 10}
] ]
const remoteWsStore = useRemoteWsStore() const remoteWsStore = useRemoteWsStore()
const currentRemote = ref(remoteWsStore.remoteTasks[remoteWsStore.currentTaskIndex]) const currentRemote = ref(remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()])
const userInfo = useUserStore() const userInfo = useUserStore()
const chartDom1 = ref(), const chartDom1 = ref(),
@ -261,21 +265,41 @@ onMounted(() => {
router.replace('/remote-manage/remote-manage'); router.replace('/remote-manage/remote-manage');
return; return;
} }
msgLogScrollBottom(); msgLogScrollBottom()
initScale(); initScale()
subscribeWS(); createConnect()
// setTableData(); onVitalClose()
onChatClose()
onMedicineClose()
subscribeWS()
}); });
onUnmounted(() => { onUnmounted(() => {
remoteWsStore.unsubscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date); remoteWsStore.unsubscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date);
remoteWsStore.unsubscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date); remoteWsStore.unsubscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date);
remoteWsStore.unsubscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date); remoteWsStore.unsubscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date);
disconnect()
}) })
function createConnect() {
remoteWsStore.createChatConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
}
function disconnect() {
remoteWsStore.disconnectMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
remoteWsStore.disconnectChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
}
function subscribeWS() { function subscribeWS() {
subscribeVital()
subscribeChat()
subscribeMedicine()
}
const subscribeVital = () => {
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date,
function (res: any) { (res: any) => {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
chartDom1.value.updateChartData(data.vitalSignsList[0]); chartDom1.value.updateChartData(data.vitalSignsList[0]);
chartDom2.value.updateChartData(data.vitalSignsList[0]); chartDom2.value.updateChartData(data.vitalSignsList[0]);
@ -283,14 +307,18 @@ function subscribeWS() {
chartDom4.value.updateChartData(data.vitalSignsList[0]); chartDom4.value.updateChartData(data.vitalSignsList[0]);
updateMedicineTable(data.aiMedicineList[0], data.docMedicineList[0]); updateMedicineTable(data.aiMedicineList[0], data.docMedicineList[0]);
}) })
}
const subscribeChat = () => {
remoteWsStore.subscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, remoteWsStore.subscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date,
function (res: any) { (res: any) => {
mssageList.value.push(JSON.parse(res.data)); mssageList.value.push(JSON.parse(res.data));
}) })
}
const subscribeMedicine = () => {
remoteWsStore.subscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, remoteWsStore.subscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date,
function (res: any) { (res: any) => {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
if (data.status != 1) { if (data.status != 1) {
if (data.medicine) { if (data.medicine) {
@ -303,6 +331,45 @@ function subscribeWS() {
}) })
} }
const onVitalClose = () => {
remoteWsStore.vitalOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, () => {
ElMessage.info('远程已断开!')
const status = remoteWsStore.getCloseStatus()
if (!status[currentRemote.value.patient + currentRemote.value.patientId + currentRemote.value.date + 'vitalWS']) {
setTimeout(() => {
remoteWsStore.createVitalConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
subscribeVital()
}, 3000)
}
})
}
const onChatClose = () => {
remoteWsStore.chatOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, () => {
ElMessage.info('通讯已断开!')
const status = remoteWsStore.getCloseStatus()
if (!status[currentRemote.value.patient + currentRemote.value.patientId + currentRemote.value.date + 'chatWS']) {
setTimeout(() => {
remoteWsStore.createChatConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
subscribeChat()
}, 3000)
}
})
}
const onMedicineClose = () => {
remoteWsStore.medicineOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, () => {
ElMessage.info('给药已断开!')
const status = remoteWsStore.getCloseStatus()
if (!status[currentRemote.value.patient + currentRemote.value.patientId + currentRemote.value.date + 'medicineWS']) {
setTimeout(() => {
remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
subscribeMedicine()
}, 3000)
}
})
}
function initData() { function initData() {
lungAlarm.value = false; lungAlarm.value = false;
heartAlarm.value = false; heartAlarm.value = false;
@ -458,7 +525,6 @@ const setDatabase = () => {
const viewPatientInfo = () => { const viewPatientInfo = () => {
getPatientInfo(currentRemote.value.patient, currentRemote.value.patientId, getPatientInfo(currentRemote.value.patient, currentRemote.value.patientId,
currentRemote.value.date).then(res => { currentRemote.value.date).then(res => {
console.log(res)
}) })
isPatientDialog.value = true; isPatientDialog.value = true;
setTimeout(() => { setTimeout(() => {

View File

@ -46,7 +46,7 @@ onMounted(() => {
function initRemoteTask() { function initRemoteTask() {
remoteTask.value = remoteWsStore.initRemoteTask() remoteTask.value = remoteWsStore.initRemoteTask()
remotePartRef.value.showData(remoteWsStore.currentTaskIndex); remotePartRef.value.initData()
} }
const viewThumbnail = () => { const viewThumbnail = () => {
@ -69,6 +69,7 @@ const editTask = (item: any) => {
const toRemoteControl = (item: any) => { const toRemoteControl = (item: any) => {
// //
if (item.isRemote) { if (item.isRemote) {
remoteWsStore.setCurrentTaskIndex(item.index)
router.push('/remote-manage/remote-control') router.push('/remote-manage/remote-control')
} else { } else {
remoteDialogRef.value.open(item.index) remoteDialogRef.value.open(item.index)

View File

@ -39,7 +39,7 @@ const remoteTask = ref([] as any);
const remoteWsStore = useRemoteWsStore(); const remoteWsStore = useRemoteWsStore();
onMounted(() => { onMounted(() => {
remoteTask.value = remoteWsStore.remoteTasks; remoteTask.value = remoteWsStore.getRemoteTask();
}) })
const openRemote = (params: any) => { const openRemote = (params: any) => {