From f6d62eaf70440d3183cad494d08a9e8c96c3d9d8 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 08 九月 2023 12:02:36 +0800
Subject: [PATCH] 增加体重秤串口通讯

---
 src/views/home/index.vue |   75 +++++++------------------------------
 1 files changed, 14 insertions(+), 61 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 3873aa7..992881b 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -221,6 +221,8 @@
 import {base64toFile} from '@/samples/faceApi'
 import{initPort} from '@/samples/portApi'
 import{initPort as oumulongHbp9030 } from '@/samples/deviceApi/oumulong-HBP-9030'
+import{initPort as zhiRongT605 } from '@/samples/deviceApi/zhiRongT605'
+
 import { ElLoading, ElMessage } from 'element-plus'
 let trackerTask: any = null;
 // 标识用的画布
@@ -254,7 +256,7 @@
       base64toFile(imgSrc)
     }
     setTimeout(() => {
-      console.log(configData.value.face_push+'秒跑一次人脸识别')
+      // console.log(configData.value.face_push+'秒跑一次人脸识别')
       trackerTask.run();
     }, configData.value.face_push*1000);
     // @ts-ignore
@@ -346,59 +348,6 @@
 })
 const settime = () => {
   clockNum.value = patientInfoStore().viewNumber
-  // // 清除定时器
-  // clearInterval(timerNum.value)
-  // if(timerNum.value===0){
-  //   timer = setInterval(() => {
-  //       if (clockNum.value > 0) {
-  //         clockNum.value--
-  //       }
-  //       else {
-  //         // clearInterval(timer)
-  //         clockNum.value = patientInfoStore().viewNumber
-  //         patientInfoStore().setpatientInfo({
-  //           id: 0,
-  //           code: '',
-  //           name: '',
-  //           patientAvatarIcon: '',
-  //           deviceCode: '',
-  //           hemoCode: '',
-  //           pureWeight: '',
-  //           datetime: ''
-  //         })
-  //         sockteStore().setweightSockte({
-  //           type: '体重秤',
-  //           deviceName: '',
-  //           result: '0',
-  //           resultTime: '',
-  //           state: 2
-  //         })
-  //         sockteStore().setxyjSockte({
-  //           type: '血压计',
-  //           deviceName: '',
-  //           result: '',
-  //           resultTime: '',
-  //           state: 2
-  //         })
-  //         sockteStore().setfaceSockte({
-  //           type: '人脸识别',
-  //           deviceName: '',
-  //           result: '',
-  //           resultTime: '',
-  //           state: 2
-  //         })
-  //         aimTSL.value = ''
-  //         gao_ya.value = ''
-  //         di_ya.value = ''
-  //         mai_bu.value = ''
-  //       }
-  //     }, 1000)
-  //   // 记录定时器
-  //   timerNum.value = timer
-  // }else{
-    
-  // }
- 
 }
 //发送消除某些状态
 const fuxuan=()=>{
@@ -462,8 +411,9 @@
     patientCodeLsXy = ''
     aimTSL.value = ''
       // 定时数秒器
-    settime()
+   
     if (patientInfo.value.id !== 0 && patientInfo.value.name !== '' && patientInfo.value.isScheduled === 1) {
+      settime()
       // 人脸识别成功后 1查看是否开启测温
       // console.log(`患者信息识别成功:${patientInfo.value.name}`)
       ipcRenderer.invoke('logger', `患者信息识别成功:${patientInfo.value.name}`)
@@ -498,6 +448,7 @@
     }
     // 没有排班
     else if (patientInfo.value.isScheduled === 0) {
+      settime()
       ipcRenderer.invoke('logger', `患者没有排班:${patientInfo.value.name}`)
       // console.log( `患者没有排班:${patientInfo.value.name}`)
       //关闭人脸弹框
@@ -537,8 +488,8 @@
           weight: weightInfo.value.result,
           bloodPressure: ''
         }
-        settime()
         if (patientCodeLs !== mode.patientCode) {
+          settime()
           // 定时数秒器
           const tt = mode.weight.replace('.', '点')
           speech.value?.speak({ text: `称重完成,${tt}kg` }).then(() => {
@@ -546,7 +497,6 @@
           })
           patientCodeLs = mode.patientCode
           fasongNum.value=0
-          // console.log(`开始发送结果到服务器:患者:${patientInfo.value.name},体重结果:${weightInfo.value.result}`)
           ipcRenderer.invoke('logger', `开始发送结果到服务器:患者:${patientInfo.value.name},体重结果:${weightInfo.value.result}`)
           console.log(`开始发送结果到服务器:患者:${patientInfo.value.name},体重结果:${weightInfo.value.result}`)
           sundModeTz()
@@ -709,12 +659,10 @@
     ipcRenderer.send('winClose')
   }
 }
-const openPort=()=>{
-  initPort('com5',115200)
-}
 onMounted(() => {
   console.log('页面初始化', os.hostname())
   setTimeout(()=>{
+
     console.log('8秒后执行')
     console.log('打印设置文件')
     console.log(configData.value)
@@ -726,7 +674,11 @@
     if(configData.value.Is_xyj){
       oumulongHbp9030(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate)
     }
-      // 是否开启脸识别
+    // 是否开启志荣体重秤联机
+    if(configData.value.Is_tzc){
+      zhiRongT605(configData.value.tzcPortPath,configData.value.tzcBaudRate)
+    }
+    // 是否开启脸识别
     isUseFaceRecogService.value = configData.value.isUseFaceRecogService
     console.log('人脸识别',isUseFaceRecogService.value)
     if (isUseFaceRecogService.value) {
@@ -741,6 +693,7 @@
     setInterval(function () {
       clockNum.value--
       if(clockNum.value===0){
+       
         fuxuan()
       }
       inputRef.value.focus();

--
Gitblit v1.8.0