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