错误修复

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) => { return new Promise((resolve, reject) => {
request.get(getPageUrl, { request.get(getPageUrl, {
params: { 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 {defineStore} from "pinia";
import { Session } from "@/utils/storage"; import {Session} from "@/utils/storage";
import { ElMessage } from "element-plus"; 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: () => {
return { return {
patient: {} as any, patient: {} as any,
remoteTasks: [] as any, remoteTasks: [] as any,
remoteTasksCap: 10, remoteTasksCap: 10,
currentTaskIndex: -1, currentTaskIndex: -1,
varMedicine: ["丙泊酚", "舒芬太尼", "瑞芬太尼", "顺阿曲库胺"], varMedicine: ["丙泊酚", "舒芬太尼", "瑞芬太尼", "顺阿曲库胺"],
fixedMedicine: ["尼卡地平", "艾司洛尔", "麻黄素", "阿托品"], fixedMedicine: ["尼卡地平", "艾司洛尔", "麻黄素", "阿托品"],
exceptionType: ["BIS_except", "DBP_except", "EtCO2_except", "HR_except", "SBP_except", "ST_except"], exceptionType: ["BIS_except", "DBP_except", "EtCO2_except", "HR_except", "SBP_except", "ST_except"],
exceptionMsg: { exceptionMsg: {
"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,
} }
}, },
actions: { actions: {
setCurrentTaskIndex(i: number) { setCurrentTaskIndex(i: number) {
this.currentTaskIndex = i this.currentTaskIndex = i
Session.set("currentTaskIndex", i) Session.set("currentTaskIndex", i)
}, },
getCurrentTaskIndex() { getCurrentTaskIndex() {
if (Session.get("currentTaskIndex") > -1) { if (Session.get("currentTaskIndex") > -1) {
this.currentTaskIndex = Session.get("currentTaskIndex") this.currentTaskIndex = Session.get("currentTaskIndex")
} }
return this.currentTaskIndex return this.currentTaskIndex
}, },
setRemoteTask() { setRemoteTask() {
Session.set("remoteTasks", this.remoteTasks) Session.set("remoteTasks", this.remoteTasks)
}, },
getRemoteTask() { getRemoteTask() {
if (Session.get("remoteTasks")) { if (Session.get("remoteTasks")) {
this.remoteTasks = Session.get("remoteTasks") this.remoteTasks = Session.get("remoteTasks")
} }
return this.remoteTasks return this.remoteTasks
}, },
initRemoteTask() { initRemoteTask() {
if (Session.get("remoteTasks")) { if (Session.get("remoteTasks")) {
this.remoteTasks = Session.get("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({
isRemote: false, isRemote: false,
isException: false, isException: false,
taskName: "", taskName: "",
server: "", server: "",
serverun: "", serverun: "",
serverps: "", serverps: "",
patient: "", patient: "",
patientId: "", patientId: "",
date: "", date: "",
log: [], log: [],
index: i index: i
}) })
} }
} }
return this.remoteTasks return this.remoteTasks
}, },
resetRemoteTask(i: number) { resetRemoteTask(i: number) {
this.remoteTasks[i] = Object.assign(this.remoteTasks[i], { this.remoteTasks[i] = Object.assign(this.remoteTasks[i], {
isRemote: false, isRemote: false,
isException: false, isException: false,
taskName: "", taskName: "",
server: "", server: "",
serverun: "", serverun: "",
serverps: "", serverps: "",
patient: "", patient: "",
patientId: "", patientId: "",
date: "", date: "",
log: [], log: [],
index: i, index: i,
message: [] message: []
}) })
Session.set("remoteTasks", this.remoteTasks) Session.set("remoteTasks", this.remoteTasks)
}, },
getActiveRemoteTask() { getActiveRemoteTask() {
let index = 0 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) index = i if (this.remoteTasks[i].isRemote) index = i
} }
return index 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, index: number) { createConnect(name: string, id: string, date: string, index: number) {
if (!this.patient[name + id + date + index]) { if (!this.patient[name + id + date + index]) {
const vitalWS = new WebSocket(vitalUrl) const vitalWS = new WebSocket(vitalUrl)
const medicineWS = new WebSocket(medicineUrl) const medicineWS = new WebSocket(medicineUrl)
const chatWS = new WebSocket(chatUrl) const chatWS = new WebSocket(chatUrl)
vitalWS.onopen = function () { vitalWS.onopen = function () {
vitalWS.send(JSON.stringify({ vitalWS.send(JSON.stringify({
patientName: name, patientName: name,
idNum: id, idNum: id,
date: date date: date
})) }))
} }
vitalWS.onclose = () => { vitalWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "已断开") ElMessage.info("远程管理" + (index + 1) + "已断开")
} }
vitalWS.onerror = () => { vitalWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "出错") ElMessage.error("远程管理" + (index + 1) + "出错")
} }
medicineWS.onopen = function () { medicineWS.onopen = function () {
medicineWS.send(JSON.stringify({ medicineWS.send(JSON.stringify({
patientName: name, patientName: name,
idNum: id, idNum: id,
date: date date: date
})) }))
} }
medicineWS.onclose = () => { medicineWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "给药已断开") ElMessage.info("远程管理" + (index + 1) + "给药已断开")
} }
medicineWS.onerror = () => { medicineWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "给药出错") ElMessage.error("远程管理" + (index + 1) + "给药出错")
} }
chatWS.onopen = function () { chatWS.onopen = function () {
chatWS.send(JSON.stringify({ chatWS.send(JSON.stringify({
patientName: name, patientName: name,
idNum: id, idNum: id,
date: date date: date
})) }))
} }
chatWS.onclose = () => { chatWS.onclose = () => {
ElMessage.info("远程管理" + (index + 1) + "通讯已断开") ElMessage.info("远程管理" + (index + 1) + "通讯已断开")
} }
chatWS.onerror = () => { chatWS.onerror = () => {
ElMessage.error("远程管理" + (index + 1) + "通讯出错") ElMessage.error("远程管理" + (index + 1) + "通讯出错")
} }
this.patient[name + id + date + index] = { this.patient[name + id + date + index] = {
vitalWS, vitalWS,
medicineWS, medicineWS,
chatWS chatWS
} }
} }
}, },
disconnect(name: string, id: string, date: string, index: number) { disconnect(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.vitalWS.close() patient.vitalWS.close()
patient.medicineWS.close() patient.medicineWS.close()
patient.chatWS.close() patient.chatWS.close()
delete this.patient[name + id + date + index] delete this.patient[name + id + date + index]
} }
}, },
subscribeVital(name: string, id: string, date: string, index: number, cb: any) { subscribeVital(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.vitalWS.onmessage = cb patient.vitalWS.onmessage = cb
patient.vitalCB = cb patient.vitalCB = cb
} else { } else {
this.createConnect(name, id, date, index) this.createConnect(name, id, date, index)
this.patient[name + id + date + index].vitalWS.onmessage = cb this.patient[name + id + date + index].vitalWS.onmessage = cb
this.patient[name + id + date + index].vitalCB = cb this.patient[name + id + date + index].vitalCB = cb
} }
}, },
vitalOnclose(name: string, id: string, date: string, index: number, cb: any) { vitalOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
patient.vitalWS.onclose = cb patient.vitalWS.onclose = cb
}, },
unsubscribeVital(name: string, id: string, date: string, index: number) { unsubscribeVital(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
if (patient && patient.vitalWS) { if (patient && patient.vitalWS) {
patient.vitalWS.onmessage = undefined; patient.vitalWS.onmessage = undefined;
patient.vitalCB = undefined; patient.vitalCB = undefined;
} }
}, },
sendMsg(name: string, id: string, date: string, msg: string, index: number, cb: any) { sendMsg(name: string, id: string, date: string, msg: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
const params = { const params = {
patientName: name, patientName: name,
idNum: id, idNum: id,
date: date, date: date,
msg msg
} }
patient.chatWS.send(JSON.stringify(params)) patient.chatWS.send(JSON.stringify(params))
cb({ cb({
status: 0 status: 0
}) })
} else { } else {
cb({ cb({
status: 1, status: 1,
msg: "已断开连接" msg: "已断开连接"
}) })
} }
}, },
subscribeChat(name: string, id: string, date: string, index: number, cb: any) { subscribeChat(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.chatCB = cb patient.chatCB = cb
patient.chatWS.onmessage = cb patient.chatWS.onmessage = cb
} else { } else {
cb({ cb({
status: 1, status: 1,
msg: "已断开连接" msg: "已断开连接"
}) })
} }
}, },
chatOnclose(name: string, id: string, date: string, index: number, cb: any) { chatOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
patient.chatWS.onclose = cb patient.chatWS.onclose = cb
}, },
unsubscribeChat(name: string, id: string, date: string, index: number) { unsubscribeChat(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
patient.chatCB = undefined; patient.chatCB = undefined;
patient.chatWS.onmessage = undefined; patient.chatWS.onmessage = undefined;
}, },
sendMedicine(args: { sendMedicine(args: {
name: string, name: string,
id: string, id: string,
date: string, date: string,
flag: string, flag: string,
medicine: string, medicine: string,
value: string value: string
}, index: number, cb: any) { }, index: number, cb: any) {
const patient: any = this.patient[args.name + args.id + args.date + index] const patient: any = this.patient[args.name + args.id + args.date + index]
if (patient) { if (patient) {
const params = { const params = {
patientName: args.name, patientName: args.name,
idNum: args.id, idNum: args.id,
date: args.date, date: args.date,
flag: args.flag, flag: args.flag,
medicine: args.medicine, medicine: args.medicine,
value: args.value value: args.value
} }
patient.medicineWS.send(JSON.stringify(params)) patient.medicineWS.send(JSON.stringify(params))
cb({ cb({
status: 0 status: 0
}) })
} else { } else {
cb({ cb({
status: 1, status: 1,
msg: "已断开连接" msg: "已断开连接"
}) })
} }
}, },
subscribeMedicine(name: string, id: string, date: string, index: number, cb: any) { subscribeMedicine(name: string, id: string, date: string, index: number, cb: any) {
const patient = this.patient[name + id + date + index] const patient = this.patient[name + id + date + index]
if (patient) { if (patient) {
patient.medicineCB = cb patient.medicineCB = cb
patient.medicineWS.onmessage = cb patient.medicineWS.onmessage = cb
} else { } else {
cb({ cb({
status: 1, status: 1,
msg: "已断开连接" msg: "已断开连接"
}) })
} }
}, },
medicineOnclose(name: string, id: string, date: string, index: number, cb: any) { medicineOnclose(name: string, id: string, date: string, index: number, cb: any) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
patient.medicineWS.onclose = cb patient.medicineWS.onclose = cb
}, },
unsubscribeMedicine(name: string, id: string, date: string, index: number) { unsubscribeMedicine(name: string, id: string, date: string, index: number) {
const patient: any = this.patient[name + id + date + index] const patient: any = this.patient[name + id + date + index]
patient.medicineCB = undefined; patient.medicineCB = undefined;
patient.medicineWS.onmessage = undefined; patient.medicineWS.onmessage = undefined;
} }
} }
}) })

View File

@ -69,3 +69,9 @@ function componentToHex(c: number) {
const hex = c.toString(16); const hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex; 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"; 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']
}); });
@ -76,7 +76,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) {
@ -121,7 +121,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':
@ -186,7 +186,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',
@ -208,7 +208,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

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

View File

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