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

View File

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