错误修复

This commit is contained in:
yy 2024-05-30 14:57:25 +08:00
parent 6dfbce71dd
commit aa69fcab6c
9 changed files with 1158 additions and 1305 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) => {
request.get(getPageUrl, {
params: {

File diff suppressed because it is too large Load Diff

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,278 +1,278 @@
import { defineStore } from "pinia";
import { Session } from "@/utils/storage";
import { ElMessage } from "element-plus";
import {defineStore} from "pinia";
import {Session} from "@/utils/storage";
import {ElMessage} from "element-plus";
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()
const vitalUrl = "ws://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
const medicineUrl = "ws://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
const chatUrl = "ws://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
export const useRemoteWsStore = defineStore("remoteWs", {
state: () => {
return {
patient: {} as any,
remoteTasks: [] as any,
remoteTasksCap: 10,
currentTaskIndex: -1,
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异常"
} as any,
}
},
actions: {
setCurrentTaskIndex(i: number) {
this.currentTaskIndex = i
Session.set("currentTaskIndex", i)
},
getCurrentTaskIndex() {
if (Session.get("currentTaskIndex") > -1) {
this.currentTaskIndex = Session.get("currentTaskIndex")
}
return this.currentTaskIndex
},
setRemoteTask() {
Session.set("remoteTasks", this.remoteTasks)
},
getRemoteTask() {
if (Session.get("remoteTasks")) {
this.remoteTasks = Session.get("remoteTasks")
}
return this.remoteTasks
},
initRemoteTask() {
if (Session.get("remoteTasks")) {
this.remoteTasks = Session.get("remoteTasks")
}
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: []
})
Session.set("remoteTasks", this.remoteTasks)
},
getActiveRemoteTask() {
let index = 0
for (let i = 0; i < this.remoteTasks.length; i++) {
if (this.remoteTasks[i].isRemote) index = i
}
return index
},
setRemoteLog(log: any, i: number) {
this.remoteTasks[i].log.push(log)
},
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 chatWS = new WebSocket(chatUrl)
vitalWS.onopen = function () {
vitalWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date
}))
}
state: () => {
return {
patient: {} as any,
remoteTasks: [] as any,
remoteTasksCap: 10,
currentTaskIndex: -1,
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异常"
} as any,
}
},
actions: {
setCurrentTaskIndex(i: number) {
this.currentTaskIndex = i
Session.set("currentTaskIndex", i)
},
getCurrentTaskIndex() {
if (Session.get("currentTaskIndex") > -1) {
this.currentTaskIndex = Session.get("currentTaskIndex")
}
return this.currentTaskIndex
},
setRemoteTask() {
Session.set("remoteTasks", this.remoteTasks)
},
getRemoteTask() {
if (Session.get("remoteTasks")) {
this.remoteTasks = Session.get("remoteTasks")
}
return this.remoteTasks
},
initRemoteTask() {
if (Session.get("remoteTasks")) {
this.remoteTasks = Session.get("remoteTasks")
}
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: []
})
Session.set("remoteTasks", this.remoteTasks)
},
getActiveRemoteTask() {
let index = 0
for (let i = 0; i < this.remoteTasks.length; i++) {
if (this.remoteTasks[i].isRemote) index = i
}
return index
},
setRemoteLog(log: any, i: number) {
this.remoteTasks[i].log.push(log)
},
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 chatWS = new WebSocket(chatUrl)
vitalWS.onopen = function () {
vitalWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date
}))
}
vitalWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "已断开")
}
vitalWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "已断开")
}
vitalWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "出错")
}
vitalWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "出错")
}
medicineWS.onopen = function () {
medicineWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date
}))
}
medicineWS.onopen = function () {
medicineWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date
}))
}
medicineWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "给药已断开")
}
medicineWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "给药已断开")
}
medicineWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "给药出错")
}
medicineWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "给药出错")
}
chatWS.onopen = function () {
chatWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date
}))
}
chatWS.onopen = function () {
chatWS.send(JSON.stringify({
patientName: name,
idNum: id,
date: date
}))
}
chatWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "通讯已断开")
}
chatWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "通讯已断开")
}
chatWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "通讯出错")
}
chatWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "通讯出错")
}
this.patient[name + id + date + index] = {
vitalWS,
medicineWS,
chatWS
}
}
},
disconnect(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
if (patient) {
patient.vitalWS.close()
patient.medicineWS.close()
patient.chatWS.close()
delete this.patient[name + id + date + index]
}
},
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.vitalCB = cb
} else {
this.createConnect(name, id, date, index)
this.patient[name + id + date + index].vitalWS.onmessage = cb
this.patient[name + id + date + index].vitalCB = cb
}
},
vitalOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.vitalWS.onclose = cb
},
unsubscribeVital(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
if (patient && patient.vitalWS) {
patient.vitalWS.onmessage = undefined;
patient.vitalCB = undefined;
}
},
sendMsg(name: string, id: string, date: string, msg: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
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, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
if (patient) {
patient.chatCB = cb
patient.chatWS.onmessage = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
chatOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.chatWS.onclose = cb
},
unsubscribeChat(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
patient.chatCB = undefined;
patient.chatWS.onmessage = undefined;
},
sendMedicine(args: {
name: string,
id: string,
date: string,
flag: string,
medicine: string,
value: string
}, index: number, cb: any) {
const patient: any = this.patient[args.name + args.id + args.date + index]
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, index: number, cb: any) {
const patient = this.patient[name + id + date + index]
if (patient) {
patient.medicineCB = cb
patient.medicineWS.onmessage = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
medicineOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.medicineWS.onclose = cb
},
unsubscribeMedicine(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
patient.medicineCB = undefined;
patient.medicineWS.onmessage = undefined;
}
}
this.patient[name + id + date + index] = {
vitalWS,
medicineWS,
chatWS
}
}
},
disconnect(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
if (patient) {
patient.vitalWS.close()
patient.medicineWS.close()
patient.chatWS.close()
delete this.patient[name + id + date + index]
}
},
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.vitalCB = cb
} else {
this.createConnect(name, id, date, index)
this.patient[name + id + date + index].vitalWS.onmessage = cb
this.patient[name + id + date + index].vitalCB = cb
}
},
vitalOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.vitalWS.onclose = cb
},
unsubscribeVital(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
if (patient && patient.vitalWS) {
patient.vitalWS.onmessage = undefined;
patient.vitalCB = undefined;
}
},
sendMsg(name: string, id: string, date: string, msg: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
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, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
if (patient) {
patient.chatCB = cb
patient.chatWS.onmessage = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
chatOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.chatWS.onclose = cb
},
unsubscribeChat(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
patient.chatCB = undefined;
patient.chatWS.onmessage = undefined;
},
sendMedicine(args: {
name: string,
id: string,
date: string,
flag: string,
medicine: string,
value: string
}, index: number, cb: any) {
const patient: any = this.patient[args.name + args.id + args.date + index]
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, index: number, cb: any) {
const patient = this.patient[name + id + date + index]
if (patient) {
patient.medicineCB = cb
patient.medicineWS.onmessage = cb
} else {
cb({
status: 1,
msg: "已断开连接"
})
}
},
medicineOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index]
patient.medicineWS.onclose = cb
},
unsubscribeMedicine(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index]
patient.medicineCB = undefined;
patient.medicineWS.onmessage = undefined;
}
}
})

View File

@ -68,4 +68,10 @@ function rgbToHex(r: number, g: number, b: number) {
function componentToHex(c: number) {
const hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
// 获取assets静态资源
export const getAssetsFile = (url: string) => {
return new URL(`../assets/${url}`, import.meta.url).href
}

View File

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

View File

@ -12,7 +12,7 @@ import {useRemoteWsStore} from "@/stores/remote-ws-store";
const chartDom = ref();
const props = withDefaults(defineProps<{
names: string[]
names: any
}>(), {
names: ['BIS', 'HR']
});
@ -76,7 +76,7 @@ function chartInit() {
let str = '';
str += params[0].axisValue;
str += '<br>';
props.names.forEach((item, index) => {
props.names.forEach((item: any, index: any) => {
str += params[index].marker;
str += params[index].seriesName + ' ';
switch (item) {
@ -121,7 +121,7 @@ function chartInit() {
lineHeight: 30,
},
formatter: (params: string) => {
const index = props.names.findIndex((item) => item === params);
const index = props.names.findIndex((item: any) => item === params);
let str = params + ' ';
switch (params) {
case 'BIS':
@ -186,7 +186,7 @@ function chartInit() {
}
function getSeries() {
props.names.forEach(name => {
props.names.forEach((name: any) => {
const serie = {
name,
type: 'line',
@ -208,7 +208,7 @@ function getXData() {
}
function getLegendData() {
props.names.forEach((name, index) => {
props.names.forEach((name: any, index: any) => {
legendData.push({
name,
textStyle: {color: colors[index]},

View File

@ -1,124 +1,124 @@
<template>
<div class="remote-part">
<div class="title">
<span>{{ remoteItem?.taskName || '远程控制' }}</span>
<el-button v-if="remoteItem?.taskName" class="break-btn" @click="breakRemote">断开连接</el-button>
</div>
<!-- 小分辨率 -->
<div v-if="mediaMini800" class="content mini" :class="{ 'is-total': remoteItem?.isRemote }">
<div class="left-box">
<div class="info-box">
<div class="row-item">
<span class="label">病人名称</span>
<span class="input-value">{{ remoteItem.patient }}</span>
</div>
<div class="row-item">
<span class="label">住院号</span>
<span class="input-value">{{ remoteItem.patientId }}</span>
</div>
<div class="row-item">
<span class="label">手术时间</span>
<span class="input-value">{{
remoteItem?.date
}}</span>
</div>
<div class="row-item">
<span class="label">手术状态</span>
<span class="tag-value" :class="{ 'normal': !patientInfo.state }">正常</span>
<span class="tag-value" :class="{ 'alarm': patientInfo.state }">异常</span>
</div>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.BIS_except }">
<span class="label">BIS</span>
<span class="value">{{ patientInfo.BIS }}</span>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.SBP_except }">
<span class="label">SBP</span>
<span class="value">{{ patientInfo.SBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item">
<span class="label">SPO2</span>
<span class="value">{{ patientInfo.SPO2 }}</span>
</div>
<div class="row-item yellow" :class="{ 'alarm': patientInfo.DBP_except }">
<span class="label">DBP</span>
<span class="value">{{ patientInfo.DBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item yellow" :class="{ 'alarm': patientInfo.HR_except }">
<span class="label">HR</span>
<span class="value">{{ patientInfo.HR }}<span class="unit">/</span></span>
</div>
<div class="row-item yellow">
<span class="label">TEMP</span>
<span class="value">{{ patientInfo.TEMP }}</span>
</div>
</div>
<div class="center-box">
<img src="@/assets/imgs/main_body_intact.png">
</div>
</div>
<div v-else class="content" :class="{ 'is-total': remoteItem?.isRemote }">
<div class="left-box">
<div class="info-box">
<div class="row-item">
<span class="label">病人名称</span>
<span class="input-value">{{ remoteItem?.patient }}</span>
</div>
<div class="row-item">
<span class="label">住院号</span>
<span class="input-value">{{ remoteItem?.patientId }}</span>
</div>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.BIS_except }">
<span class="label">BIS</span>
<span class="value">{{ patientInfo.BIS }}</span>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.SBP_except }">
<span class="label">SBP</span>
<span class="value">{{ patientInfo.SBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item">
<span class="label">SPO2</span>
<span class="value">{{ patientInfo.SPO2 }}</span>
</div>
</div>
<div class="center-box">
<img src="@/assets/imgs/main_body_intact.png">
</div>
<div class="right-box">
<div class="info-box">
<div class="row-item">
<span class="label">手术时间</span>
<span class="input-value">{{
remoteItem?.date
}}</span>
</div>
<div class="row-item">
<span class="label">手术状态</span>
<span class="tag-value" :class="{ 'normal': !patientInfo.state }">正常</span>
<span class="tag-value" :class="{ 'alarm': patientInfo.state }">异常</span>
</div>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.DBP_except }">
<span class="label">DBP</span>
<span class="value">{{ patientInfo.DBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.HR_except }">
<span class="label">HR</span>
<span class="value">{{ patientInfo.HR }}<span class="unit">/</span></span>
</div>
<div class="row-item">
<span class="label">TEMP</span>
<span class="value">{{ patientInfo.TEMP }}</span>
</div>
</div>
</div>
</div>
<div class="remote-part">
<div class="title">
<span>{{ remoteItem?.taskName || '远程控制' }}</span>
<el-button v-if="remoteItem?.taskName" class="break-btn" @click="breakRemote">断开连接</el-button>
</div>
<!-- 小分辨率 -->
<div v-if="mediaMini800" class="content mini" :class="{ 'is-total': remoteItem?.isRemote }">
<div class="left-box">
<div class="info-box">
<div class="row-item">
<span class="label">病人名称</span>
<span class="input-value">{{ remoteItem.patient }}</span>
</div>
<div class="row-item">
<span class="label">住院号</span>
<span class="input-value">{{ remoteItem.patientId }}</span>
</div>
<div class="row-item">
<span class="label">手术时间</span>
<span class="input-value">{{
remoteItem?.date
}}</span>
</div>
<div class="row-item">
<span class="label">手术状态</span>
<span class="tag-value" :class="{ 'normal': !patientInfo.state }">正常</span>
<span class="tag-value" :class="{ 'alarm': patientInfo.state }">异常</span>
</div>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.BIS_except }">
<span class="label">BIS</span>
<span class="value">{{ patientInfo.BIS }}</span>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.SBP_except }">
<span class="label">SBP</span>
<span class="value">{{ patientInfo.SBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item">
<span class="label">SPO2</span>
<span class="value">{{ patientInfo.SPO2 }}</span>
</div>
<div class="row-item yellow" :class="{ 'alarm': patientInfo.DBP_except }">
<span class="label">DBP</span>
<span class="value">{{ patientInfo.DBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item yellow" :class="{ 'alarm': patientInfo.HR_except }">
<span class="label">HR</span>
<span class="value">{{ patientInfo.HR }}<span class="unit">/</span></span>
</div>
<div class="row-item yellow">
<span class="label">TEMP</span>
<span class="value">{{ patientInfo.TEMP }}</span>
</div>
</div>
<div class="center-box">
<img src="@/assets/imgs/main_body_intact.png">
</div>
</div>
<div v-else class="content" :class="{ 'is-total': remoteItem?.isRemote }">
<div class="left-box">
<div class="info-box">
<div class="row-item">
<span class="label">病人名称</span>
<span class="input-value">{{ remoteItem?.patient }}</span>
</div>
<div class="row-item">
<span class="label">住院号</span>
<span class="input-value">{{ remoteItem?.patientId }}</span>
</div>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.BIS_except }">
<span class="label">BIS</span>
<span class="value">{{ patientInfo.BIS }}</span>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.SBP_except }">
<span class="label">SBP</span>
<span class="value">{{ patientInfo.SBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item">
<span class="label">SPO2</span>
<span class="value">{{ patientInfo.SPO2 }}</span>
</div>
</div>
<div class="center-box">
<img src="@/assets/imgs/main_body_intact.png">
</div>
<div class="right-box">
<div class="info-box">
<div class="row-item">
<span class="label">手术时间</span>
<span class="input-value">{{
remoteItem?.date
}}</span>
</div>
<div class="row-item">
<span class="label">手术状态</span>
<span class="tag-value" :class="{ 'normal': !patientInfo.state }">正常</span>
<span class="tag-value" :class="{ 'alarm': patientInfo.state }">异常</span>
</div>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.DBP_except }">
<span class="label">DBP</span>
<span class="value">{{ patientInfo.DBP }}<span class="unit">mmHg</span></span>
</div>
<div class="row-item" :class="{ 'alarm': patientInfo.HR_except }">
<span class="label">HR</span>
<span class="value">{{ patientInfo.HR }}<span class="unit">/</span></span>
</div>
<div class="row-item">
<span class="label">TEMP</span>
<span class="value">{{ patientInfo.TEMP }}</span>
</div>
</div>
</div>
</div>
</template>
<script lang='ts' setup>
import { onMounted, onUnmounted, ref } from 'vue'
import { useRemoteWsStore } from "@/stores/remote-ws-store";
import {onMounted, onUnmounted, ref} from 'vue'
import {useRemoteWsStore} from "@/stores/remote-ws-store";
const emit = defineEmits(['addLogAfter', 'breakRemote'])
const mediaMini800 = ref(false)
@ -126,307 +126,311 @@ const remoteItem = ref({} as any)
let currentIndex = -1;
const patientInfo = ref({} as any)
const remoteWsStore = useRemoteWsStore()
let currentException: any = {}
defineExpose({
initData, showData
initData, showData
});
window.addEventListener('resize', () => {
mediaMini800.value = Boolean(window.innerWidth < 801)
mediaMini800.value = Boolean(window.innerWidth < 801)
});
onMounted(() => {
initData();
initData();
})
onUnmounted(() => {
if (remoteItem.value) {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex);
}
if (remoteItem.value) {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex);
}
})
function showData(i: any) {
const lastTaskIndex = remoteWsStore.getCurrentTaskIndex();
const lastTask: any = remoteWsStore.getRemoteTask()[lastTaskIndex];
if (lastTask) {
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date, lastTaskIndex);
}
remoteWsStore.setCurrentTaskIndex(i)
currentIndex = remoteWsStore.getCurrentTaskIndex()
remoteItem.value = remoteWsStore.getRemoteTask()[currentIndex]
getData()
const lastTaskIndex = remoteWsStore.getCurrentTaskIndex();
const lastTask: any = remoteWsStore.getRemoteTask()[lastTaskIndex];
if (lastTask) {
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date, lastTaskIndex);
}
remoteWsStore.setCurrentTaskIndex(i)
currentIndex = remoteWsStore.getCurrentTaskIndex()
remoteItem.value = remoteWsStore.getRemoteTask()[currentIndex]
getData()
}
function initData() {
const remoteTasks = remoteWsStore.getRemoteTask()
currentIndex = remoteWsStore.getCurrentTaskIndex()
remoteItem.value = remoteTasks[currentIndex]
if (remoteItem.value && remoteItem.value.patient) {
remoteWsStore.createConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
getData()
}
const remoteTasks = remoteWsStore.getRemoteTask()
currentIndex = remoteWsStore.getCurrentTaskIndex()
remoteItem.value = remoteTasks[currentIndex]
if (remoteItem.value && remoteItem.value.patient) {
remoteWsStore.createConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
getData()
}
}
function getData() {
if (currentIndex > -1 && remoteItem.value?.patient) {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex);
remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex, (res: any) => {
if (res && res.data) {
const data = JSON.parse(res.data);
if (data.vitalSignsList && data.vitalSignsList.length > 0) {
Object.assign(patientInfo.value, data.vitalSignsList[0]);
patientInfo.value.state = (patientInfo.value.BIS_except || patientInfo.value.SBP_except ||
patientInfo.value.DBP_except || patientInfo.value.HR_except);
setLog(patientInfo.value)
emit('addLogAfter')
}
}
})
if (currentIndex > -1 && remoteItem.value?.patient) {
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex);
remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex, (res: any) => {
if (res && res.data) {
const data = JSON.parse(res.data);
if (data.vitalSignsList && data.vitalSignsList.length > 0) {
Object.assign(patientInfo.value, data.vitalSignsList[0]);
patientInfo.value.state = (patientInfo.value.BIS_except || patientInfo.value.SBP_except ||
patientInfo.value.DBP_except || patientInfo.value.HR_except);
setLog(patientInfo.value)
emit('addLogAfter')
}
}
})
}
}
}
function setLog(data: any) {
remoteWsStore.exceptionType.forEach((item: any) => {
if (data[item]) {
const msg: any = remoteWsStore.exceptionMsg[item];
remoteWsStore.setRemoteLog({
state: msg,
taskName: remoteItem.value.taskName,
time: new Date(),
type: "exception"
}, currentIndex);
}
})
if (currentException?.Time != data.Time) {
currentException = data
remoteWsStore.exceptionType.forEach((item: any) => {
if (data[item]) {
const msg: any = remoteWsStore.exceptionMsg[item];
remoteWsStore.setRemoteLog({
state: msg,
taskName: remoteItem.value.taskName,
time: item.Time,
type: "exception"
}, currentIndex);
}
})
}
}
const breakRemote = () => {
remoteWsStore.getRemoteTask()[currentIndex]
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
remoteWsStore.resetRemoteTask(currentIndex)
showData(remoteWsStore.getActiveRemoteTask())
emit('breakRemote')
remoteWsStore.getRemoteTask()[currentIndex]
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, currentIndex)
remoteWsStore.resetRemoteTask(currentIndex)
showData(remoteWsStore.getActiveRemoteTask())
emit('breakRemote')
}
</script>
<style lang='scss' scoped>
.remote-part {
width: 100%;
height: 100%;
border: 1px solid $border-color;
width: 100%;
height: 100%;
border: 1px solid $border-color;
.title {
position: relative;
width: 100%;
height: 40px;
font-size: 20px;
text-align: center;
line-height: 40px;
font-weight: 600;
color: white;
background: $main-color;
.title {
position: relative;
width: 100%;
height: 40px;
font-size: 20px;
text-align: center;
line-height: 40px;
font-weight: 600;
color: white;
background: $main-color;
.break-btn {
position: absolute;
top: 4px;
right: 20px;
}
}
.break-btn {
position: absolute;
top: 4px;
right: 20px;
}
}
.content {
width: 100%;
height: calc(100% - 40px);
padding: 20px 50px;
display: flex;
justify-content: space-between;
.content {
width: 100%;
height: calc(100% - 40px);
padding: 20px 50px;
display: flex;
justify-content: space-between;
.common-box {
width: 30%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}
.common-box {
width: 30%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}
.left-box {
@extend .common-box;
.left-box {
@extend .common-box;
.label {
background: $main-color;
}
}
.label {
background: $main-color;
}
}
.center-box {
@extend .common-box;
.center-box {
@extend .common-box;
img {
max-width: 100%;
max-height: 100%;
}
}
img {
max-width: 100%;
max-height: 100%;
}
}
.right-box {
@extend .common-box;
.right-box {
@extend .common-box;
.label {
background: $main-color;
}
}
.label {
background: $main-color;
}
}
.row-item {
width: 100%;
display: flex;
justify-content: space-between;
.row-item {
width: 100%;
display: flex;
justify-content: space-between;
.label {
flex-shrink: 0;
width: 100%;
height: 40px;
color: white;
font-size: 18px;
line-height: 40px;
text-align: center;
border-radius: 5px;
}
}
.label {
flex-shrink: 0;
width: 100%;
height: 40px;
color: white;
font-size: 18px;
line-height: 40px;
text-align: center;
border-radius: 5px;
}
}
.info-box,
.row-item .value {
display: none;
}
.info-box,
.row-item .value {
display: none;
}
&.is-total {
&.is-total {
.info-box,
.row-item .value {
display: block;
}
.info-box,
.row-item .value {
display: block;
}
.label {
width: calc(50% - 10px);
}
.label {
width: calc(50% - 10px);
}
.value {
width: 50%;
height: 40px;
border-width: 1px;
border-style: solid;
text-align: center;
border-radius: 5px;
color: $main-color;
border-color: $main-color;
font-size: 22px;
line-height: 40px;
font-weight: 600;
.value {
width: 50%;
height: 40px;
border-width: 1px;
border-style: solid;
text-align: center;
border-radius: 5px;
color: $main-color;
border-color: $main-color;
font-size: 22px;
line-height: 40px;
font-weight: 600;
.unit {
font-size: 16px;
font-family: 400;
}
}
.unit {
font-size: 16px;
font-family: 400;
}
}
.right-box .value {
color: $main-color;
border-color: $main-color;
}
.right-box .value {
color: $main-color;
border-color: $main-color;
}
.row-item.alarm {
.label {
background: red !important;
}
.row-item.alarm {
.label {
background: red !important;
}
.value {
color: red !important;
border-color: red !important;
}
}
.value {
color: red !important;
border-color: red !important;
}
}
.info-box {
width: 100%;
.info-box {
width: 100%;
.row-item {
padding: 10px 0;
height: 40px;
justify-content: flex-start;
align-items: center;
.row-item {
padding: 10px 0;
height: 40px;
justify-content: flex-start;
align-items: center;
.label {
width: 70px;
height: 20px;
background: transparent;
color: $main-color;
font-size: 16px;
line-height: 20px;
font-weight: 600;
text-align: left;
}
.label {
width: 70px;
height: 20px;
background: transparent;
color: $main-color;
font-size: 16px;
line-height: 20px;
font-weight: 600;
text-align: left;
}
.input-value {
width: 100%;
height: 21px;
line-height: 20px;
font-size: 16px;
color: $main-color;
border-bottom: 1px solid $border2-color;
}
.input-value {
width: 100%;
height: 21px;
line-height: 20px;
font-size: 16px;
color: $main-color;
border-bottom: 1px solid $border2-color;
}
.tag-value {
margin-left: 30px;
padding: 0 20px;
height: 30px;
line-height: 30px;
font-size: 16px;
color: white;
font-weight: 600;
background: $border2-color;
border-radius: 8px;
.tag-value {
margin-left: 30px;
padding: 0 20px;
height: 30px;
line-height: 30px;
font-size: 16px;
color: white;
font-weight: 600;
background: $border2-color;
border-radius: 8px;
&.normal {
background: $main-color;
}
&.normal {
background: $main-color;
}
&.alarm {
background: red;
}
}
}
}
}
&.alarm {
background: red;
}
}
}
}
}
&.mini {
padding: 20px;
&.mini {
padding: 20px;
.left-box {
width: 240px;
}
.left-box {
width: 240px;
}
.center-box {
width: calc(100% - 250px);
}
.center-box {
width: calc(100% - 250px);
}
&.is-total {
.left-box {
.info-box {
display: block;
flex-shrink: 0;
}
&.is-total {
.left-box {
.info-box {
display: block;
flex-shrink: 0;
}
.row-item.yellow {
.label {
background: $main-color;
}
.row-item.yellow {
.label {
background: $main-color;
}
.value {
color: $main-color;
border-color: $main-color;
}
}
}
}
.value {
color: $main-color;
border-color: $main-color;
}
}
}
}
}
}
}
}
}
</style>

View File

@ -6,7 +6,7 @@ import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
base: '/medical/',
// base: '/medical/',
plugins: [vue()],
resolve: {
alias: {