commit: 二期

This commit is contained in:
republicline 2024-11-14 16:29:50 +08:00
parent 22820d1035
commit 3480ee2af7
2 changed files with 940 additions and 921 deletions

View File

@ -193,7 +193,7 @@ export const useRemoteWsStore = defineStore("remoteWs", {
patientName: name, patientName: name,
idNum: id, idNum: id,
date: date, date: date,
msgType: "msg" msgType: "init"
})) }))
} }
} }
@ -251,10 +251,11 @@ export const useRemoteWsStore = defineStore("remoteWs", {
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 = {
msgType: "msg",
patientName: name, patientName: name,
idNum: id, idNum: id,
date: date, date: date,
msg content:msg
} }
patient.chatWS.send(JSON.stringify(params)) patient.chatWS.send(JSON.stringify(params))
cb({ cb({

View File

@ -38,12 +38,14 @@
<div class="top-btn-box"> <div class="top-btn-box">
<div class="top-left-btn-box" v-loading="connectionUnityLoading"> <div class="top-left-btn-box" v-loading="connectionUnityLoading">
<el-space direction="vertical"> <el-space direction="vertical">
<el-text style="margin-right:20px;font-size: 18px;font-weight:700;color:#006080 ">病人尿量(ml):500 <el-text style="margin-right:20px;font-size: 18px;font-weight:700;color:#006080 ">
病人尿量(ml):500
</el-text> </el-text>
</el-space> </el-space>
<el-button color="#C77000" @click="viewPatientInfo">患者信息</el-button> <el-button color="#C77000" @click="viewPatientInfo">患者信息</el-button>
<el-button type="text" color="#C77000">当前延迟{{timeDiffPing}}ms</el-button> <el-button type="text" color="#C77000">当前延迟{{ timeDiffPing }}ms</el-button>
<el-button color="#C77000" @click="connectionUnity('1')" v-if="!whetherControl">连接远程控制</el-button> <el-button color="#C77000" @click="connectionUnity('1')" v-if="!whetherControl">连接远程控制
</el-button>
<template v-else> <template v-else>
<el-button color="#C77000">已控制</el-button> <el-button color="#C77000">已控制</el-button>
<el-button color="#C77000" @click="connectionUnity('0')">断开远程控制</el-button> <el-button color="#C77000" @click="connectionUnity('0')">断开远程控制</el-button>
@ -64,24 +66,24 @@
</ul> </ul>
</div> </div>
<div class="right-box"> <div class="right-box">
<div class="video-box" @click="playPause"> <!--<div class="video-box" @click="playPause">-->
<div class="icon-box"> <!-- <div class="icon-box">-->
<el-icon v-if="isVideoPlay"> <!-- <el-icon v-if="isVideoPlay">-->
<VideoPause/> <!-- <VideoPause/>-->
</el-icon> <!-- </el-icon>-->
<el-icon v-else> <!-- <el-icon v-else>-->
<VideoPlay/> <!-- <VideoPlay/>-->
</el-icon> <!-- </el-icon>-->
</div> <!-- </div>-->
<!-- poster="@/assets/imgs/video_bck.png" --> <!-- &lt;!&ndash; poster="@/assets/imgs/video_bck.png" &ndash;&gt;-->
<video ref="liveVideo"> <!-- <video ref="liveVideo">-->
<source src="@/assets/medical.mp4" type="video/mp4"/> <!-- <source src="@/assets/medical.mp4" type="video/mp4"/>-->
</video> <!-- </video>-->
</div> <!--</div>-->
<div class="message-box"> <div class="message-box">
<ul ref="msgLog" class="message-log"> <ul ref="msgLog" class="message-log">
<li v-for="(item, index) in mssageList" :key="'msg-log-' + index" <li v-for="(item, index) in mssageList" :key="'msg-log-' + index"
:class="{ 'align-right': item.createName == userName }"> :class="{ 'align-right': item.createUser == userInfo.userInfo.username }">
<span>{{ item.content }}</span> <span>{{ item.content }}</span>
</li> </li>
</ul> </ul>
@ -102,9 +104,9 @@
<span>速度(ml/h)</span> <span>速度(ml/h)</span>
</template> </template>
<template #default="scope"> <template #default="scope">
<span style="margin-right:25px">{{scope.row.medicineRate}}</span> <span style="margin-right:25px">{{ scope.row.medicineRate }}</span>
<el-link type="success" v-if="scope.row.change>=0">+{{scope.row.change}}</el-link> <el-link type="success" v-if="scope.row.change>=0">+{{ scope.row.change }}</el-link>
<el-link type="danger" v-else>{{scope.row.change}}</el-link> <el-link type="danger" v-else>{{ scope.row.change }}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="countMedicine" label="累计药量(ml)" width="100"> <el-table-column prop="countMedicine" label="累计药量(ml)" width="100">
@ -113,7 +115,8 @@
<el-table-column label="特殊情况人为干预" align="center"> <el-table-column label="特殊情况人为干预" align="center">
<template #default="scope"> <template #default="scope">
<div class="table-btn-box"> <div class="table-btn-box">
<el-button size="small" color="#006080" @click="tableItemPlus(scope)" :disabled="!whetherControl" > <el-button size="small" color="#006080" @click="tableItemPlus(scope)"
:disabled="!whetherControl">
<el-icon> <el-icon>
<Plus/> <Plus/>
</el-icon> </el-icon>
@ -125,9 +128,11 @@
</el-icon> </el-icon>
</el-button> </el-button>
<el-button size="small" color="#006080" <el-button size="small" color="#006080"
@click="tableItemConfirm(scope, varTableData)" :disabled="!whetherControl">确定 @click="tableItemConfirm(scope, varTableData)"
:disabled="!whetherControl">确定
</el-button> </el-button>
<el-button size="small" color="#006080" @click="tableItemCancel(scope)" :disabled="!whetherControl">取消 <el-button size="small" color="#006080" @click="tableItemCancel(scope)"
:disabled="!whetherControl">取消
</el-button> </el-button>
</div> </div>
</template> </template>
@ -141,9 +146,9 @@
<el-table-column prop="medicineName" label="药物名称" align="center"/> <el-table-column prop="medicineName" label="药物名称" align="center"/>
<el-table-column prop="medicineRate" label="剂量(ml)" width="120"> <el-table-column prop="medicineRate" label="剂量(ml)" width="120">
<template #default="scope"> <template #default="scope">
<span style="margin-right:25px">{{scope.row.medicineRate}}</span> <span style="margin-right:25px">{{ scope.row.medicineRate }}</span>
<el-link type="success" v-if="scope.row.change>=0">+{{scope.row.change}}</el-link> <el-link type="success" v-if="scope.row.change>=0">+{{ scope.row.change }}</el-link>
<el-link type="danger" v-else>{{scope.row.change}}</el-link> <el-link type="danger" v-else>{{ scope.row.change }}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="countMedicine" label="累计药量(ml)" width="100"> <el-table-column prop="countMedicine" label="累计药量(ml)" width="100">
@ -152,7 +157,8 @@
<el-table-column label="特殊情况人为干预" align="center"> <el-table-column label="特殊情况人为干预" align="center">
<template #default="scope"> <template #default="scope">
<div class="table-btn-box"> <div class="table-btn-box">
<el-button size="small" color="#006080" @click="tableItemPlus(scope)" :disabled="!whetherControl"> <el-button size="small" color="#006080" @click="tableItemPlus(scope)"
:disabled="!whetherControl">
<el-icon> <el-icon>
<Plus/> <Plus/>
</el-icon> </el-icon>
@ -164,9 +170,11 @@
</el-icon> </el-icon>
</el-button> </el-button>
<el-button size="small" color="#006080" <el-button size="small" color="#006080"
@click="tableItemConfirm(scope, fixedTableData)" :disabled="!whetherControl">确定 @click="tableItemConfirm(scope, fixedTableData)"
:disabled="!whetherControl">确定
</el-button> </el-button>
<el-button size="small" color="#006080" @click="tableItemCancel(scope)" :disabled="!whetherControl">取消 <el-button size="small" color="#006080" @click="tableItemCancel(scope)"
:disabled="!whetherControl">取消
</el-button> </el-button>
</div> </div>
</template> </template>
@ -198,7 +206,7 @@ import {h} from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import {computed, onMounted, onUnmounted, reactive, ref, watch} from 'vue'; import {computed, onMounted, onUnmounted, reactive, ref, watch} from 'vue';
import {useRouter} from 'vue-router' import {useRouter} from 'vue-router'
import {ElMessage,ElMessageBox} from 'element-plus'; import {ElMessage, ElMessageBox} from 'element-plus';
import {dateFormater} from '@/utils/date-util'; import {dateFormater} from '@/utils/date-util';
import chartLine from './chart/chart-line.vue'; import chartLine from './chart/chart-line.vue';
import chartEcg from './chart/chart-ecg.vue'; import chartEcg from './chart/chart-ecg.vue';
@ -258,17 +266,17 @@ const unusual = ref([] as any);
const fixedTableData = ref([] as any[]); const fixedTableData = ref([] as any[]);
const varTableData = ref([] as any[]); const varTableData = ref([] as any[]);
const table1SpeedVal = ref(''); const table1SpeedVal = ref('');
const whetherControl =ref(false); const whetherControl = ref(false);
const subscribeMedicineData=ref(null); const subscribeMedicineData = ref(null);
const intervalFun=ref(null); const intervalFun = ref(null);
const timeDiffPing=ref(0); const timeDiffPing = ref(0);
let currentAIMedicine: any; let currentAIMedicine: any;
let currentDocMedicine: any; let currentDocMedicine: any;
const medicineSpeedTemp: any = {}; const medicineSpeedTemp: any = {};
const connectionUnityLoading=ref(false); const connectionUnityLoading = ref(false);
const lastAddMedicineTime=ref(null); const lastAddMedicineTime = ref(null);
onMounted(() => { onMounted(() => {
if (!(currentRemote.value&&currentRemote.value.isRemote)) { if (!(currentRemote.value && currentRemote.value.isRemote)) {
router.push('/remote-manage/remote-manage'); router.push('/remote-manage/remote-manage');
return; return;
} }
@ -276,7 +284,7 @@ onMounted(() => {
initScale() initScale()
createConnect() createConnect()
subscribeWS() subscribeWS()
intervalFun.value=setInterval(loopSendMedicinePing,1000*10) as any; intervalFun.value = setInterval(loopSendMedicinePing, 1000 * 10) as any;
}); });
onUnmounted(() => { onUnmounted(() => {
@ -286,41 +294,45 @@ onUnmounted(() => {
remoteWsStore.unsubscribeVital(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() disconnect()
} }
intervalFun.value=null intervalFun.value = null
}) })
watch(subscribeMedicineData,(newValue:any,oldValue:any)=>{ watch(subscribeMedicineData, (newValue: any, oldValue: any) => {
if (newValue) { if (newValue) {
const {msgType,unityConnectionFlag,msg}=newValue; const {msgType, unityConnectionFlag, msg} = newValue;
switch (msgType) { switch (msgType) {
case 'unityRequestConnection': case 'unityRequestConnection':
const params: any = { const params: any = {
name: currentRemote.value.patient, name: currentRemote.value.patient,
id: currentRemote.value.patientId, id: currentRemote.value.patientId,
date: currentRemote.value.date, date: currentRemote.value.date,
index:currentRemote.value.index, index: currentRemote.value.index,
msgType: "webResponseConnection", msgType: "webResponseConnection",
flag:"1" flag: "1"
} }
ElMessageBox.confirm('确定接受远程控制', '确认提示', { ElMessageBox.confirm('确定接受远程控制', '确认提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '拒绝', cancelButtonText: '拒绝',
}) })
.then(() => { .then(() => {
whetherControl.value = unityConnectionFlag==='1'; whetherControl.value = unityConnectionFlag === '1';
remoteWsStore.reqMedicineConnect({...params,flag:unityConnectionFlag},(res:any)=>{console.log('res >>>>>',res);}); remoteWsStore.reqMedicineConnect({...params, flag: unityConnectionFlag}, (res: any) => {
console.log('res >>>>>', res);
});
}) })
.catch(() => { .catch(() => {
// //
whetherControl.value = false; whetherControl.value = false;
remoteWsStore.reqMedicineConnect({...params,flag:'0'},(res:any)=>{console.log('res >>>>>',res);}); remoteWsStore.reqMedicineConnect({...params, flag: '0'}, (res: any) => {
console.log('res >>>>>', res);
});
}); });
break; break;
case 'unityResponseConnection': case 'unityResponseConnection':
connectionUnityLoading.value=false connectionUnityLoading.value = false
whetherControl.value=unityConnectionFlag==='1'; whetherControl.value = unityConnectionFlag === '1';
if (unityConnectionFlag==='1') { if (unityConnectionFlag === '1') {
ElMessage.success('连接成功') ElMessage.success('连接成功')
}else{ } else {
ElMessage.info('连接断开') ElMessage.info('连接断开')
} }
break; break;
@ -328,7 +340,7 @@ watch(subscribeMedicineData,(newValue:any,oldValue:any)=>{
ElMessage.success('给药成功') ElMessage.success('给药成功')
break; break;
case 'pong': case 'pong':
timeDiffPing.value=newValue.msg; timeDiffPing.value = newValue.msg;
break; break;
case 'connectionMsg': case 'connectionMsg':
ElMessage.info(msg) ElMessage.info(msg)
@ -337,39 +349,42 @@ watch(subscribeMedicineData,(newValue:any,oldValue:any)=>{
} }
} }
}) })
function createConnect() { function createConnect() {
remoteWsStore.createChatConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index) 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) remoteWsStore.createMedicineConnect(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index)
} }
function loopSendMedicinePing(){ function loopSendMedicinePing() {
remoteWsStore.loopSendMedicinePing(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index,(res:any)=>{}) remoteWsStore.loopSendMedicinePing(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, (res: any) => {
})
} }
// //
function connectionUnity(flag:string){ function connectionUnity(flag: string) {
if (flag==="1") { if (flag === "1") {
console.log("连接远程控制"); console.log("连接远程控制");
connectionUnityLoading.value=true connectionUnityLoading.value = true
}else{ } else {
console.log("断开远程控制"); console.log("断开远程控制");
connectionUnityLoading.value=false connectionUnityLoading.value = false
} }
const params: any = { const params: any = {
name: currentRemote.value.patient, name: currentRemote.value.patient,
id: currentRemote.value.patientId, id: currentRemote.value.patientId,
date: currentRemote.value.date, date: currentRemote.value.date,
index:currentRemote.value.index, index: currentRemote.value.index,
msgType: "webRequestConnection", msgType: "webRequestConnection",
flag flag
} }
remoteWsStore.reqMedicineConnect(params,()=>{ remoteWsStore.reqMedicineConnect(params, () => {
connectionUnityLoading.value=false connectionUnityLoading.value = false
}); });
setTimeout(()=>{ setTimeout(() => {
if (connectionUnityLoading.value) { if (connectionUnityLoading.value) {
connectionUnityLoading.value=false connectionUnityLoading.value = false
} }
},10000) }, 10000)
// //
} }
@ -395,7 +410,7 @@ const subscribeVital = () => {
onVitalClose() onVitalClose()
remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, remoteWsStore.subscribeVital(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index,
(res: any) => { (res: any) => {
console.log(res); // console.log(res);
if (res.status != 2) { if (res.status != 2) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
@ -403,14 +418,14 @@ const subscribeVital = () => {
chartDom2.value.updateChartData(data.vitalSignsList[0]); chartDom2.value.updateChartData(data.vitalSignsList[0]);
chartDom3.value.updateChartData(data.vitalSignsList[0]); chartDom3.value.updateChartData(data.vitalSignsList[0]);
chartDom4.value.updateChartData(data.vitalSignsList[0]); chartDom4.value.updateChartData(data.vitalSignsList[0]);
isAIDose.value=data.flags.aiFlag==='1'?1:0; isAIDose.value = data.flags.aiFlag === '1' ? 1 : 0;
console.log('data >>>>>',data); console.log('data >>>>>', data);
if (!data.rateModTime) { if (!data.rateModTime) {
updateMedicineTable(data.medicineList); updateMedicineTable(data.medicineList);
return return
} }
if (lastAddMedicineTime.value!==data.rateModTime) { if (lastAddMedicineTime.value !== data.rateModTime) {
lastAddMedicineTime.value=data.rateModTime lastAddMedicineTime.value = data.rateModTime
updateMedicineTable(data.medicineList); updateMedicineTable(data.medicineList);
} }
} }
@ -431,7 +446,7 @@ const subscribeMedicine = () => {
remoteWsStore.subscribeMedicine(currentRemote.value.patient, currentRemote.value.patientId, currentRemote.value.date, currentRemote.value.index, 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);
subscribeMedicineData.value=data; subscribeMedicineData.value = data;
if (data.status != 1) { if (data.status != 1) {
if (data.medicine) { if (data.medicine) {
if (varTableData.value[data.medicine]) varTableData.value[data.medicine] = medicineSpeedTemp[data.medicine]; if (varTableData.value[data.medicine]) varTableData.value[data.medicine] = medicineSpeedTemp[data.medicine];
@ -489,18 +504,18 @@ function initData() {
} }
function updateMedicineTable(doctorMedicine: any) { function updateMedicineTable(doctorMedicine: any) {
const varTableData1=doctorMedicine.slice(0,4) const varTableData1 = doctorMedicine.slice(0, 4)
const fixedTableData1=doctorMedicine.slice(4,8) const fixedTableData1 = doctorMedicine.slice(4, 8)
varTableData.value = varTableData1.map((i:any)=>{ varTableData.value = varTableData1.map((i: any) => {
return { return {
...i, ...i,
change:i?.change||0 change: i?.change || 0
} }
}) })
fixedTableData.value = fixedTableData1.map((i:any)=>{ fixedTableData.value = fixedTableData1.map((i: any) => {
return { return {
...i, ...i,
change:i?.change||0 change: i?.change || 0
} }
}) })
} }
@ -618,30 +633,31 @@ function msgLogScrollBottom() {
const tableItemPlus = (e: any) => { const tableItemPlus = (e: any) => {
const obj = medicineCustom.find(item => item.name === e.row.medicineName) || {plus: 1}; const obj = medicineCustom.find(item => item.name === e.row.medicineName) || {plus: 1};
const medicineRate= e.row.medicineRate const medicineRate = e.row.medicineRate
const currTotal=_.add(Number(medicineRate),Number(e.row.change)) const currTotal = _.add(Number(medicineRate), Number(e.row.change))
if (currTotal >=obj.total) { if (currTotal >= obj.total) {
ElMessage({ ElMessage({
type: 'error', type: 'error',
message: `当前药物速率已超过设定的最大值${obj.total},不能增加只能减少` message: `当前药物速率已超过设定的最大值${obj.total},不能增加只能减少`
}) })
return return
}; }
const currRate= Number(e.row.change); ;
const currRate = Number(e.row.change);
if (isNaN(currRate)) { if (isNaN(currRate)) {
return return
} }
const rate=_.add(Number(currRate), Number(obj.plus)); const rate = _.add(Number(currRate), Number(obj.plus));
e.row.change =_.floor(rate,2) e.row.change = _.floor(rate, 2)
} }
const tableItemMinus = (e: any) => { const tableItemMinus = (e: any) => {
const obj = medicineCustom.find(item => item.name === e.row.medicineName) || {plus: 1}; const obj = medicineCustom.find(item => item.name === e.row.medicineName) || {plus: 1};
const medicineRate= e.row.medicineRate; const medicineRate = e.row.medicineRate;
const change=e.row.change; const change = e.row.change;
if (Number(change)<0) { if (Number(change) < 0) {
const reds=Number(change)+Number(medicineRate) const reds = Number(change) + Number(medicineRate)
if (reds<=0) { if (reds <= 0) {
ElMessage({ ElMessage({
type: 'error', type: 'error',
message: '当前药物速率不能小于0' message: '当前药物速率不能小于0'
@ -649,21 +665,21 @@ const tableItemMinus = (e: any) => {
return return
} }
} }
const nowTotal=_.subtract(Number(medicineRate) ,Number(change)) const nowTotal = _.subtract(Number(medicineRate), Number(change))
e.row.change = _.subtract(change,obj.plus) e.row.change = _.subtract(change, obj.plus)
e.row.change = _.floor(e.row.change,2) e.row.change = _.floor(e.row.change, 2)
} }
const tableItemConfirm = (e: any, tableData: any) => { const tableItemConfirm = (e: any, tableData: any) => {
const finalRate=_.add(Number(e.row.medicineRate),Number(e.row.change)) const finalRate = _.add(Number(e.row.medicineRate), Number(e.row.change))
const final=_.floor(finalRate,2) const final = _.floor(finalRate, 2)
ElMessageBox.confirm('确定给药吗?', '确认提示', { ElMessageBox.confirm('确定给药吗?', '确认提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
message: h('p', null, [ message: h('p', null, [
h('span', null, '确定给药吗?'), h('span', null, '确定给药吗?'),
h('div', { style: 'font-size:14px;color:#085a75' }, `药物名称:${e.row.medicineName}`), h('div', {style: 'font-size:14px;color:#085a75'}, `药物名称:${e.row.medicineName}`),
h('div', { style: 'font-size:14px;color:#085a75' }, `速率:${final}`), h('div', {style: 'font-size:14px;color:#085a75'}, `速率:${final}`),
]), ]),
}) })
.then(() => { .then(() => {
@ -676,7 +692,7 @@ const tableItemConfirm = (e: any, tableData: any) => {
date: currentRemote.value.date, date: currentRemote.value.date,
flag: "1", flag: "1",
medicine: e.row.medicineName, medicine: e.row.medicineName,
value: _.add(Number(e.row.medicineRate),Number(e.row.change)), value: _.add(Number(e.row.medicineRate), Number(e.row.change)),
index: currentRemote.value.index index: currentRemote.value.index
} }
remoteWsStore.sendMedicine(params, function () { remoteWsStore.sendMedicine(params, function () {
@ -962,7 +978,7 @@ function startAI() {
height: 270px; height: 270px;
background: $main-color; background: $main-color;
/* background: url(@/assets/imgs/video_bck.png); /* background: url(@/assets/imgs/video_bck.png);
background-size: 100% 100%; */ background-size: 100% 100%; */
&:hover { &:hover {
.icon-box { .icon-box {
@ -994,7 +1010,7 @@ background-size: 100% 100%; */
.message-box { .message-box {
width: 100%; width: 100%;
// height: 270px; // height: 270px;
height: 149px; height: 300px;
// margin-bottom: 5px; // margin-bottom: 5px;
.message-log { .message-log {
@ -1105,4 +1121,6 @@ background-size: 100% 100%; */
} }
} }
} }
}</style> }
</style>