This commit is contained in:
mouse 2024-01-20 09:21:48 +08:00
parent cfaca9d1f9
commit f268349edf
6 changed files with 355 additions and 294 deletions

View File

@ -1,4 +1,4 @@
import {getData, postData} from '@/axios/index' import { getData, postData } from '@/axios/index'
export const getHospitalsData = () => { export const getHospitalsData = () => {
const hospitals = [] as any const hospitals = [] as any
@ -63,35 +63,36 @@ export const getNarcotismWay = () => {
const narcotismWay = [] const narcotismWay = []
while (narcotismWay.length < 10) { while (narcotismWay.length < 10) {
const str: string = '麻醉方式' + (narcotismWay.length + 1) const str: string = '麻醉方式' + (narcotismWay.length + 1)
narcotismWay.push({label: str, value: str}) narcotismWay.push({ label: str, value: str })
} }
return narcotismWay return narcotismWay
} }
export const getFormTypes = () => { export const getFormTypes = () => {
const types = [ const types = [
{name: '生命体征表单'}, { name: '生命体征表单' },
{name: 'AI给药记录'}, { name: 'AI给药记录' },
{name: '医生给药记录'}, { name: '医生给药记录' },
{name: '给药命令反馈'}, { name: '给药命令反馈' },
{name: '输药泵定时间反馈'}, { name: '输药泵定时间反馈' },
{name: '术后信息表单'}, { name: '术后信息表单' },
{name: '1生命体征表单'}, { name: '1生命体征表单' },
{name: '1AI给药记录'}, { name: '1AI给药记录' },
{name: '1医生给药记录'}, { name: '1医生给药记录' },
{name: '1给药命令反馈'}, { name: '1给药命令反馈' },
{name: '1输药泵定时间反馈'}, { name: '1输药泵定时间反馈' },
{name: '1术后信息表单'}, { name: '1术后信息表单' },
{name: '2生命体征表单'}, { name: '2生命体征表单' },
{name: '2AI给药记录'}, { name: '2AI给药记录' },
{name: '2医生给药记录'}, { name: '2医生给药记录' },
{name: '2给药命令反馈'}, { name: '2给药命令反馈' },
{name: '2输药泵定时间反馈'}, { name: '2输药泵定时间反馈' },
{name: '2术后信息表单'}, { name: '2术后信息表单' },
] ]
return types return types
} }
export const getDataAlarmState = (value: number, key: string) => { export const getDataAlarmState = (value: number | undefined, key: string) => {
if (value === undefined) return
const alarms: any = { const alarms: any = {
BIS: { min: 40, max: 60 }, BIS: { min: 40, max: 60 },
HR: { min: 50, max: 80 }, HR: { min: 50, max: 80 },
@ -102,9 +103,26 @@ export const getDataAlarmState = (value: number, key: string) => {
} }
const obj = alarms[key] const obj = alarms[key]
let res: 'min' | 'max' | '' = '' let res: 'min' | 'max' | '' = ''
if(obj) { if (obj) {
if(value < obj.min) res = 'min' if (value < obj.min) res = 'min'
else if(value > obj.max) res = 'max' else if (value > obj.max) res = 'max'
} }
return res return res
} }
export const setRemoteLog = (obj: any, callback: (title: string, size: string) => void) => {
const alarms = {
BIS: getDataAlarmState(obj.BIS, 'BIS'),
SBP: getDataAlarmState(obj.SBP, 'SBP'),
SPO2: getDataAlarmState(obj.SPO2, 'SPO2'),
DBP: getDataAlarmState(obj.DBP, 'DBP'),
HR: getDataAlarmState(obj.HR, 'HR'),
TEMP: getDataAlarmState(obj.TEMP, 'TEMP')
}
if (alarms.BIS) callback('脑电双频指数', alarms.BIS)
if (alarms.SBP) callback('收缩率', alarms.SBP)
if (alarms.SPO2) callback('氧饱和度', alarms.SPO2)
if (alarms.DBP) callback('舒张压', alarms.DBP)
if (alarms.HR) callback('心率', alarms.HR)
if (alarms.TEMP) callback('体温', alarms.TEMP)
}

View File

@ -25,6 +25,11 @@ export const useRemoteStore = defineStore('remote', {
this.remoteTasks[index].log.push(obj) this.remoteTasks[index].log.push(obj)
} }
}, },
setRemoteDataAlarm(bol: boolean, index: number) {
if(this.remoteTasks[index]) {
this.remoteTasks[index].dataAlarm = bol
}
},
getCurrentRemote() { getCurrentRemote() {
return this.currentRemote return this.currentRemote
}, },

View File

@ -40,10 +40,12 @@ remoteTasks.value = useRemoteStore().remoteTasks
// }) // })
function scrollToBottom() { function scrollToBottom() {
setTimeout(() => {
listRef.value.scrollTo({ listRef.value.scrollTo({
top: listRef.value.scrollHeight, top: listRef.value.scrollHeight,
behavior: 'smooth' behavior: 'smooth'
}); })
}, 0)
} }
</script> </script>

View File

@ -3,9 +3,9 @@
<div class="title"> <div class="title">
<span>消息通知</span> <span>消息通知</span>
</div> </div>
<div class="content"> <div ref="listRef" class="content">
<el-timeline> <el-timeline>
<el-timeline-item v-for="(item, index) in currentRemote.log || []" :key="index" <el-timeline-item v-for="(item, index) in remoteStore.currentRemote.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.title + ' ' + item.state }} {{ item.title + ' ' + item.state }}
@ -24,17 +24,25 @@ import { dateFormater } from '@/utils/date-util'
defineExpose({ defineExpose({
setData, setData,
scrollToBottom
}) })
const remoteStore = useRemoteStore() const remoteStore = useRemoteStore()
const currentRemote = ref({} as RemoteItem) const listRef = ref()
currentRemote.value = useRemoteStore().currentRemote
function setData(e: RemoteLogItem, index: number) { function setData(e: RemoteLogItem, index: number) {
remoteStore.setRemoteLog(e, index) remoteStore.setRemoteLog(e, index)
remoteStore.setCurrentRemoteLog(e)
remoteStore.$patch({currentRemote: remoteStore.remoteTasks[index]}) remoteStore.$patch({currentRemote: remoteStore.remoteTasks[index]})
} }
function scrollToBottom() {
setTimeout(() => {
listRef.value.scrollTo({
top: listRef.value.scrollHeight,
behavior: 'smooth'
})
}, 0)
}
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>

View File

@ -117,15 +117,17 @@ import { onMounted, onBeforeUnmount, reactive, ref, toRefs, watch } from 'vue'
import { dateFormater } from '@/utils/date-util' import { dateFormater } from '@/utils/date-util'
import { useRemoteStore } from '@/stores/remote-info-store'; import { useRemoteStore } from '@/stores/remote-info-store';
import type { RemoteItem, PatientInfoItem } from '@/utils/public-interface' import type { RemoteItem, PatientInfoItem } from '@/utils/public-interface'
import { setRemoteLog } from '@/static-data/core'
const emit = defineEmits(['breakRemote']) const emit = defineEmits(['addLogAfter', 'breakRemote'])
const remoteStore = useRemoteStore()
let timer = 0 let timer = 0
const mediaMini800 = ref(false) const mediaMini800 = ref(false)
const remoteItem = ref<RemoteItem>({} as RemoteItem) const remoteItem = ref<RemoteItem>({} as RemoteItem)
const patientInfo = ref({} as PatientInfoItem) const patientInfo = ref({} as PatientInfoItem)
initData(useRemoteStore().getCurrentRemote()) initData(remoteStore.currentRemote)
defineExpose({ defineExpose({
initData initData
@ -133,7 +135,6 @@ defineExpose({
onBeforeUnmount(() => { onBeforeUnmount(() => {
// //
console.log('~~~~~~~~~~~~~~~')
clearInterval(timer) clearInterval(timer)
}) })
@ -141,26 +142,43 @@ window.addEventListener('resize', () => {
mediaMini800.value = Boolean(window.innerWidth < 801) mediaMini800.value = Boolean(window.innerWidth < 801)
}); });
function initData(e?: any) { function initData(e?: RemoteItem) {
if(e) remoteItem.value = e const obj = e || {} as RemoteItem
const obj = e || {} remoteItem.value = obj
patientInfo.value.state = obj.dataAlarm patientInfo.value.state = obj.dataAlarm
patientInfo.value.name = obj.patientName || '' patientInfo.value.name = obj.patientName || ''
patientInfo.value.code = 'XXXXXX' patientInfo.value.code = 'XXXXXX'
clearInterval(timer) clearInterval(timer)
if(!patientInfo.value.name) return
timer = setInterval(() => { timer = setInterval(() => {
getData() getData()
}, 2000) }, 2000)
} }
function getData() { function getData() {
remoteItem.value.dataAlarm = false
const obj = {
BIS: Math.ceil(Math.random() * 100),
SBP: Math.ceil(Math.random() * 100),
SPO2: Math.ceil(Math.random() * 100),
DBP: Math.ceil(Math.random() * 100),
HR: Math.ceil(Math.random() * 100),
TEMP: Math.ceil(Math.random() * 100),
} as PatientInfoItem
patientInfo.value.time = new Date() patientInfo.value.time = new Date()
patientInfo.value.BIS = Math.ceil(Math.random() * 100) setRemoteLog(obj, (title: string, size: string) => {
patientInfo.value.SBP = Math.ceil(Math.random() * 100) obj.state = true
patientInfo.value.SPO2 = Math.ceil(Math.random() * 100) remoteItem.value.dataAlarm = true
patientInfo.value.DBP = Math.ceil(Math.random() * 100) remoteStore.setRemoteLog({
patientInfo.value.HR = Math.ceil(Math.random() * 100) time: new Date(),
patientInfo.value.TEMP = Math.ceil(Math.random() * 100) title,
state: '异常'
}, remoteItem.value.index)
})
remoteStore.setRemoteDataAlarm(remoteItem.value.dataAlarm, remoteItem.value.index)
remoteStore.$patch({currentRemote: remoteStore.remoteTasks[remoteItem.value.index]})
Object.assign(patientInfo.value, obj)
emit('addLogAfter')
} }
const breakRemote = () => { const breakRemote = () => {

View File

@ -2,7 +2,9 @@
<div class="remote-manage-page"> <div class="remote-manage-page">
<div class="header-box"> <div class="header-box">
<div class="thumbnail" @click="viewThumbnail"> <div class="thumbnail" @click="viewThumbnail">
<el-icon><Menu /></el-icon> <el-icon>
<Menu />
</el-icon>
<span>缩略图</span> <span>缩略图</span>
</div> </div>
<div class="task-btn-item" v-for="(item, index) in remoteTask" :key="'task-' + index" <div class="task-btn-item" v-for="(item, index) in remoteTask" :key="'task-' + index"
@ -13,7 +15,7 @@
</div> </div>
<div class="content-box"> <div class="content-box">
<div class="remote-box"> <div class="remote-box">
<RemotePart ref="remotePartRef" @breakRemote="breakRemote" /> <RemotePart ref="remotePartRef" @addLogAfter="addLogAfter" @breakRemote="breakRemote" />
</div> </div>
<div class="message-box"> <div class="message-box">
<MessagePart ref="messagePartRef" /> <MessagePart ref="messagePartRef" />
@ -42,7 +44,7 @@ const remoteTask = ref([] as Array<RemoteItem>)
initRemoteTask() initRemoteTask()
function resetRemoteTaskItem(e: RemoteItem) { function resetRemoteTaskItem(e: RemoteItem) {
remoteTask.value[e.index] = { Object.assign(remoteTask.value[e.index], {
isRemote: false, isRemote: false,
dataAlarm: false, dataAlarm: false,
title: '', title: '',
@ -50,12 +52,11 @@ function resetRemoteTaskItem(e: RemoteItem) {
patientName: '', patientName: '',
patientCode: '', patientCode: '',
index: e.index, index: e.index,
log: [] })
}
} }
function initRemoteTask() { function initRemoteTask() {
remoteTask.value = useRemoteStore().remoteTasks remoteTask.value = useRemoteStore().remoteTasks
if(remoteTask.value.length < 1) { if (remoteTask.value.length < 1) {
while (remoteTask.value.length < 10) { while (remoteTask.value.length < 10) {
const obj = { const obj = {
isRemote: false, // isRemote: false, //
@ -79,7 +80,7 @@ function initRemoteTask() {
useRemoteStore().setRemoteTasks(remoteTask.value) useRemoteStore().setRemoteTasks(remoteTask.value)
const remoteStore = useRemoteStore().currentRemote const remoteStore = useRemoteStore().currentRemote
if (!remoteStore.index) { if (!remoteStore.index) {
useRemoteStore().$patch({currentRemote: remoteTask.value[0]}) useRemoteStore().$patch({ currentRemote: remoteTask.value[0] })
} }
} }
} }
@ -136,6 +137,9 @@ const breakRemote = (e: RemoteItem) => {
state: '断开连接' state: '断开连接'
}, e.index) }, e.index)
} }
const addLogAfter = () => {
messagePartRef.value.scrollToBottom()
}
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
@ -145,6 +149,7 @@ const breakRemote = (e: RemoteItem) => {
padding-top: 15px; padding-top: 15px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
.header-box { .header-box {
position: relative; position: relative;
width: 100%; width: 100%;
@ -153,6 +158,7 @@ const breakRemote = (e: RemoteItem) => {
padding: 0 30px; padding: 0 30px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.thumbnail { .thumbnail {
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
@ -170,23 +176,28 @@ const breakRemote = (e: RemoteItem) => {
font-size: 20px; font-size: 20px;
color: white; color: white;
transition: all .1s; transition: all .1s;
.el-icon { .el-icon {
font-size: 1.4em; font-size: 1.4em;
} }
&>span { &>span {
display: none; display: none;
margin-left: 5px; margin-left: 5px;
line-height: 1; line-height: 1;
white-space: nowrap; white-space: nowrap;
} }
&:hover { &:hover {
width: 160px; width: 160px;
transition: all .3s; transition: all .3s;
&>span { &>span {
display: block; display: block;
} }
} }
} }
.task-btn-item { .task-btn-item {
cursor: pointer; cursor: pointer;
flex-grow: 1; flex-grow: 1;
@ -251,5 +262,4 @@ const breakRemote = (e: RemoteItem) => {
margin-left: 20px; margin-left: 20px;
} }
} }
} }</style>
</style>