mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-23 20:44:58 +08:00
远程重连
This commit is contained in:
parent
bba30d939d
commit
2ca8b04bd6
|
@ -103,15 +103,15 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
setRemoteLog(log: any, i: number) {
|
||||
this.remoteTasks[i].log.push(log)
|
||||
},
|
||||
disconnect(name: string, id: string, date: string) {
|
||||
this.disconnectVital(name, id, date)
|
||||
this.disconnectChat(name, id, date)
|
||||
this.disconnectMedicine(name, id, date)
|
||||
delete this.patient[name + id + date]
|
||||
disconnect(name: string, id: string, date: string, index: number) {
|
||||
this.disconnectVital(name, id, date, index)
|
||||
this.disconnectChat(name, id, date, index)
|
||||
this.disconnectMedicine(name, id, date, index)
|
||||
delete this.patient[name + id + date + index]
|
||||
},
|
||||
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]
|
||||
createVitalConnect(name: string, id: string, date: string, index: number) {
|
||||
if (!this.patient[name + id + date + index]) this.patient[name + id + date + index] = {}
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (!patient['vitalWS']) {
|
||||
patient['vitalWS'] = new WebSocket(vitalUrl)
|
||||
patient.vitalWS.onopen = () => {
|
||||
|
@ -124,8 +124,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
}
|
||||
}
|
||||
},
|
||||
subscribeVital(name: string, id: string, date: string, cb: any) {
|
||||
const patient = this.patient[name + id + date]
|
||||
subscribeVital(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (patient.vitalWS) {
|
||||
patient.vitalWS.onmessage = (e: any) => {
|
||||
if (e && e.data) {
|
||||
|
@ -144,19 +144,18 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
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: "已断开连接"
|
||||
})
|
||||
vitalOnclose(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
patient.vitalWS.onclose = () => {
|
||||
const status = this.getCloseStatus()
|
||||
if (!status[name + id + date + index + 'vitalWS']) {
|
||||
delete patient.vitalWS
|
||||
cb()
|
||||
}
|
||||
}
|
||||
},
|
||||
vitalOnerror(name: string, id: string, date: string, cb: any) {
|
||||
const patient = this.patient[name + id + date]
|
||||
vitalOnerror(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (patient.vitalWS) {
|
||||
patient.vitalWS.onerror = cb
|
||||
} else {
|
||||
|
@ -166,26 +165,26 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
unsubscribeVital(name: string, id: string, date: string) {
|
||||
const patient: any = this.patient[name + id + date]
|
||||
unsubscribeVital(name: string, id: string, date: string, index: number) {
|
||||
const patient: any = this.patient[name + id + date + index]
|
||||
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]
|
||||
disconnectVital(name: string, id: string, date: string, index: number) {
|
||||
const patient: any = this.patient[name + id + date + index]
|
||||
if (patient && patient.vitalWS) {
|
||||
this.closeStatus[name + id + date + 'vitalWS'] = true
|
||||
this.closeStatus[name + id + date + index + 'vitalWS'] = true
|
||||
patient.vitalWS.close()
|
||||
delete patient['vitalWS']
|
||||
delete this.closeStatus[name + id + date + 'vitalWS']
|
||||
delete this.closeStatus[name + id + date + index + '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]
|
||||
createChatConnect(name: string, id: string, date: string, index: number) {
|
||||
if (!this.patient[name + id + date + index]) this.patient[name + id + date + index] = {}
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (!patient['chatWS']) {
|
||||
patient['chatWS'] = new WebSocket(chatUrl)
|
||||
patient.chatWS.onopen = function () {
|
||||
|
@ -198,8 +197,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
}
|
||||
}
|
||||
},
|
||||
subscribeChat(name: string, id: string, date: string, cb: any) {
|
||||
const patient = this.patient[name + id + date]
|
||||
subscribeChat(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (patient.chatWS) {
|
||||
patient.chatWS.onmessage = (e: any) => {
|
||||
if (e && e.data) {
|
||||
|
@ -218,19 +217,18 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
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: "已断开连接"
|
||||
})
|
||||
chatOnclose(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
patient.chatWS.onclose = () => {
|
||||
const status = this.getCloseStatus()
|
||||
if (!status[name + id + date + index + 'chatWS']) {
|
||||
delete patient.chatWS
|
||||
cb()
|
||||
}
|
||||
}
|
||||
},
|
||||
chatOnerror(name: string, id: string, date: string, cb: any) {
|
||||
const patient = this.patient[name + id + date]
|
||||
chatOnerror(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (patient.chatWS) {
|
||||
patient.chatWS.onerror = cb
|
||||
} else {
|
||||
|
@ -240,16 +238,16 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
unsubscribeChat(name: string, id: string, date: string) {
|
||||
const patient: any = this.patient[name + id + date]
|
||||
unsubscribeChat(name: string, id: string, date: string, index: number) {
|
||||
const patient: any = this.patient[name + id + date + index]
|
||||
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) {
|
||||
const patient: any = this.patient[name + id + date]
|
||||
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,
|
||||
|
@ -268,18 +266,18 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
disconnectChat(name: string, id: string, date: string) {
|
||||
const patient: any = this.patient[name + id + date]
|
||||
disconnectChat(name: string, id: string, date: string, index: number) {
|
||||
const patient: any = this.patient[name + id + date + index]
|
||||
if (patient && patient.chatWS) {
|
||||
this.closeStatus[name + id + date + 'chatWS'] = true
|
||||
this.closeStatus[name + id + date + index + 'chatWS'] = true
|
||||
patient.chatWS.close()
|
||||
delete patient['chatWS']
|
||||
delete this.closeStatus[name + id + date + 'chatWS']
|
||||
delete this.closeStatus[name + id + date + index + '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]
|
||||
createMedicineConnect(name: string, id: string, date: string, index: number) {
|
||||
if (!this.patient[name + id + date + index]) this.patient[name + id + date + index] = {}
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (!patient['medicineWS']) {
|
||||
patient['medicineWS'] = new WebSocket(medicineUrl)
|
||||
patient.medicineWS.onopen = function () {
|
||||
|
@ -292,8 +290,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
}
|
||||
}
|
||||
},
|
||||
subscribeMedicine(name: string, id: string, date: string, cb: any) {
|
||||
const patient = this.patient[name + id + date]
|
||||
subscribeMedicine(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (patient) {
|
||||
patient.medicineWS.onmessage = (e: any) => {
|
||||
if (e && e.data) {
|
||||
|
@ -312,19 +310,18 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
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: "已断开连接"
|
||||
})
|
||||
medicineOnclose(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
patient.medicineWS.onclose = () => {
|
||||
const status = this.getCloseStatus()
|
||||
if (!status[name + id + date + index + 'medicineWS']) {
|
||||
delete patient.medicineWS
|
||||
cb()
|
||||
}
|
||||
}
|
||||
},
|
||||
medicineOnerror(name: string, id: string, date: string, cb: any) {
|
||||
const patient = this.patient[name + id + date]
|
||||
medicineOnerror(name: string, id: string, date: string, index: number, cb: any) {
|
||||
const patient = this.patient[name + id + date + index]
|
||||
if (patient.medicineWS) {
|
||||
patient.medicineWS.onerror = cb
|
||||
} else {
|
||||
|
@ -334,8 +331,8 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
unsubscribeMedicine(name: string, id: string, date: string) {
|
||||
const patient: any = this.patient[name + id + date]
|
||||
unsubscribeMedicine(name: string, id: string, date: string, index: number) {
|
||||
const patient: any = this.patient[name + id + date + index]
|
||||
if (patient) {
|
||||
patient.medicineWS.onmessage = undefined
|
||||
patient.medicineWS.onclose = undefined
|
||||
|
@ -346,11 +343,12 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
name: string,
|
||||
id: string,
|
||||
date: string,
|
||||
index: number,
|
||||
flag: string,
|
||||
medicine: string,
|
||||
value: string
|
||||
}, cb: any) {
|
||||
const patient: any = this.patient[args.name + args.id + args.date]
|
||||
const patient: any = this.patient[args.name + args.id + args.date + args.index]
|
||||
if (patient) {
|
||||
const params = {
|
||||
patientName: args.name,
|
||||
|
@ -371,13 +369,13 @@ export const useRemoteWsStore = defineStore("remoteWs", {
|
|||
})
|
||||
}
|
||||
},
|
||||
disconnectMedicine(name: string, id: string, date: string) {
|
||||
const patient: any = this.patient[name + id + date]
|
||||
disconnectMedicine(name: string, id: string, date: string, index: number) {
|
||||
const patient: any = this.patient[name + id + date + index]
|
||||
if (patient && patient.medicineWS) {
|
||||
this.closeStatus[name + id + date + 'medicineWS'] = true
|
||||
this.closeStatus[name + id + date + index + 'medicineWS'] = true
|
||||
patient.medicineWS.close()
|
||||
delete patient['medicineWS']
|
||||
delete this.closeStatus[name + id + date + 'medicineWS']
|
||||
delete this.closeStatus[name + id + date + index + 'medicineWS']
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<el-input v-model="registerParams.phone" placeholder="请输入手机号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="医院" prop="hospital">
|
||||
<el-select v-model="registerParams.hospital" style="width: 100%;">
|
||||
<el-select v-model="registerParams.hospitalId" style="width: 100%;">
|
||||
<el-option v-for="item in hospitals" :key="item.id" :label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
|
@ -201,7 +201,7 @@ const registerRules = reactive({
|
|||
phone: [
|
||||
{required: true, validator: validatorPhone, trigger: 'change'},
|
||||
],
|
||||
hospital: [
|
||||
hospitalId: [
|
||||
{required: true, message: '请选择医院', trigger: 'blur'},
|
||||
],
|
||||
code: [
|
||||
|
@ -231,7 +231,7 @@ const registerParams = ref({
|
|||
confirmPassword: '',
|
||||
name: '',
|
||||
phone: '',
|
||||
hospital: '',
|
||||
hospitalId: '',
|
||||
sex: '',
|
||||
code: ''
|
||||
})
|
||||
|
@ -276,22 +276,23 @@ function validateAccount(rule: any, value: any, callback: any) {
|
|||
const register = async () => {
|
||||
await registerFormRef.value.validate((valid: any, fields: any) => {
|
||||
if (valid) {
|
||||
loginApi.register({...registerParams.value, randomStr}).then(data => {
|
||||
ElMessageBox.confirm(
|
||||
'注册成功,是否登录?',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'success',
|
||||
draggable: true
|
||||
}
|
||||
).then(() => {
|
||||
loginParams.value.account = registerFormRef.value.account
|
||||
loginParams.value.name = registerFormRef.value.name
|
||||
currentHospital.value = registerFormRef.value.hospital
|
||||
isShowRegister.value = false;
|
||||
}).catch(() => {
|
||||
})
|
||||
loginApi.register({...registerParams.value, randomStr}).then((data: any) => {
|
||||
if (data.code == 0) {
|
||||
ElMessageBox.confirm(
|
||||
'注册成功,是否登录?',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'success',
|
||||
draggable: true
|
||||
}
|
||||
).then(() => {
|
||||
isShowRegister.value = false;
|
||||
}).catch(() => {
|
||||
})
|
||||
} else {
|
||||
ElMessage.error("注册失败")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// console.log('error submit!', fields)
|
||||
|
|
|
@ -96,7 +96,7 @@ const unsubscribeLastTask = () => {
|
|||
const lastTaskIndex = remoteWsStore.getCurrentTaskIndex();
|
||||
const lastTask: any = remoteWsStore.getRemoteTask()[lastTaskIndex];
|
||||
if (lastTask) {
|
||||
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date);
|
||||
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date, lastTask.index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ onMounted(() => {
|
|||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
remoteWsStore.unsubscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date);
|
||||
remoteWsStore.unsubscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, remoteTask.value.index);
|
||||
})
|
||||
|
||||
function initData() {
|
||||
|
@ -87,7 +87,7 @@ function initData() {
|
|||
}
|
||||
|
||||
function subscribeVital() {
|
||||
remoteWsStore.subscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, (res: any) => {
|
||||
remoteWsStore.subscribeVital(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, remoteTask.value.index, (res: any) => {
|
||||
const data = JSON.parse(res.data);
|
||||
if (data.vitalSignsList && data.vitalSignsList.length > 0) {
|
||||
Object.assign(patientInfo.value, data.vitalSignsList[0]);
|
||||
|
@ -100,14 +100,11 @@ 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)
|
||||
}
|
||||
remoteWsStore.vitalOnclose(remoteTask.value.patient, remoteTask.value.patientId, remoteTask.value.date, remoteTask.value.index, () => {
|
||||
ElMessage.info('远程控制' + (props.index + 1) + ', 生命体征数据连接断开,正在尝试重连……')
|
||||
setTimeout(() => {
|
||||
initData()
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -136,14 +136,14 @@ window.addEventListener('resize', () => {
|
|||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
|
||||
remoteWsStore.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, remoteItem.value.index)
|
||||
})
|
||||
|
||||
function showData(i: any) {
|
||||
const lastTaskIndex = remoteWsStore.getCurrentTaskIndex();
|
||||
const lastTask: any = remoteWsStore.getRemoteTask()[lastTaskIndex];
|
||||
if (lastTask) {
|
||||
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date)
|
||||
remoteWsStore.unsubscribeVital(lastTask.patient, lastTask.patientId, lastTask.date, lastTask.index)
|
||||
}
|
||||
remoteWsStore.setCurrentTaskIndex(i)
|
||||
remoteItem.value = remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()]
|
||||
|
@ -154,27 +154,24 @@ function showData(i: any) {
|
|||
function initData() {
|
||||
remoteItem.value = remoteWsStore.getRemoteTask()[remoteWsStore.getCurrentTaskIndex()]
|
||||
if (remoteItem.value.patient && remoteItem.value.patientId && remoteItem.value.date) {
|
||||
remoteWsStore.createVitalConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
|
||||
remoteWsStore.createVitalConnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, remoteItem.value.index)
|
||||
onClose()
|
||||
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)
|
||||
}
|
||||
remoteWsStore.vitalOnclose(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, remoteItem.value.index, () => {
|
||||
ElMessage.info('远程控制' + (remoteItem.value.index + 1) + ', 生命体征数据连接断开,正在尝试重连……')
|
||||
setTimeout(() => {
|
||||
initData()
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
|
||||
function getData() {
|
||||
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.unsubscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, remoteItem.value.index)
|
||||
remoteWsStore.subscribeVital(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, remoteItem.value.index, (res: any) => {
|
||||
if (res && res.data) {
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.vitalSignsList && data.vitalSignsList.length > 0) {
|
||||
|
@ -208,7 +205,7 @@ function setLog(data: any) {
|
|||
}
|
||||
|
||||
const breakRemote = () => {
|
||||
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date)
|
||||
remoteWsStore.disconnect(remoteItem.value.patient, remoteItem.value.patientId, remoteItem.value.date, remoteItem.value.index)
|
||||
remoteWsStore.resetRemoteTask(remoteWsStore.getCurrentTaskIndex())
|
||||
if (remoteWsStore.getActiveRemoteTask()) {
|
||||
showData(remoteWsStore.getActiveRemoteTask())
|
||||
|
|
|
@ -275,20 +275,20 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
remoteWsStore.unsubscribeChat(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.unsubscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index);
|
||||
remoteWsStore.unsubscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index);
|
||||
remoteWsStore.unsubscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index);
|
||||
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)
|
||||
remoteWsStore.createChatConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||
remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||
}
|
||||
|
||||
function disconnect() {
|
||||
remoteWsStore.disconnectMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
|
||||
remoteWsStore.disconnectChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date)
|
||||
remoteWsStore.disconnectMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||
remoteWsStore.disconnectChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||
}
|
||||
|
||||
function subscribeWS() {
|
||||
|
@ -298,7 +298,7 @@ function subscribeWS() {
|
|||
}
|
||||
|
||||
const subscribeVital = () => {
|
||||
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date,
|
||||
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index,
|
||||
(res: any) => {
|
||||
const data = JSON.parse(res.data);
|
||||
chartDom1.value.updateChartData(data.vitalSignsList[0]);
|
||||
|
@ -310,14 +310,14 @@ const subscribeVital = () => {
|
|||
}
|
||||
|
||||
const subscribeChat = () => {
|
||||
remoteWsStore.subscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date,
|
||||
remoteWsStore.subscribeChat(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index,
|
||||
(res: any) => {
|
||||
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, currentRemote.value.index,
|
||||
(res: any) => {
|
||||
const data = JSON.parse(res.data);
|
||||
if (data.status != 1) {
|
||||
|
@ -332,41 +332,32 @@ const subscribeMedicine = () => {
|
|||
}
|
||||
|
||||
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)
|
||||
}
|
||||
remoteWsStore.vitalOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, () => {
|
||||
ElMessage.info('远程控制' + (currentRemote.value.index + 1) + ', 生命体征数据连接断开,正在尝试重连……')
|
||||
setTimeout(() => {
|
||||
remoteWsStore.createVitalConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||
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)
|
||||
}
|
||||
remoteWsStore.chatOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, () => {
|
||||
ElMessage.info('远程控制' + (currentRemote.value.index + 1) + ', 通讯连接断开,正在尝试重连……')
|
||||
setTimeout(() => {
|
||||
remoteWsStore.createChatConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||
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)
|
||||
}
|
||||
remoteWsStore.medicineOnclose(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, () => {
|
||||
ElMessage.info('远程控制' + (currentRemote.value.index + 1) + ', 给药连接断开,正在尝试重连……')
|
||||
setTimeout(() => {
|
||||
remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
|
||||
subscribeMedicine()
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -561,7 +552,7 @@ const playPause = () => {
|
|||
const sendMsg = () => {
|
||||
if (msgVal.value.trim() == '') return;
|
||||
remoteWsStore.sendMsg(currentRemote.value.patient, currentRemote.value.patientId,
|
||||
currentRemote.value.date, msgVal.value, function (res: any) {
|
||||
currentRemote.value.date, msgVal.value, currentRemote.value.index, function (res: any) {
|
||||
if (res.code == 1) {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
|
@ -601,7 +592,8 @@ const tableItemConfirm = (e: any, tableData: any) => {
|
|||
date: currentRemote.value.date,
|
||||
flag: "1",
|
||||
medicine: e.row.name,
|
||||
value: e.row.speed
|
||||
value: e.row.speed,
|
||||
index: currentRemote.value.index
|
||||
}
|
||||
remoteWsStore.sendMedicine(params, function () {
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user