From 7394e5e60ec25ede11d1ef88358454da8f9c7390 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 14 十一月 2023 18:28:51 +0800
Subject: [PATCH] 增加通讯

---
 src/views/home/index.vue |  152 +++++++++++++++++++++++++++-----------------------
 1 files changed, 81 insertions(+), 71 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 3873aa7..e293f87 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -177,7 +177,7 @@
               <el-row>
                 <el-col   :span="24" style="text-align: right; line-height: 67px;padding-right: 0px; font-size: 40px;font-weight: 400;color: #EB6F1C;">
                   <div v-if="!dialogVisible">{{clockNum}}S</div>
-                  <el-input v-else  v-model="inputCode" ref="inputRef" id="inputCode"  style="width: 200px; height: 40px;"  @change="inputChabge"
+                  <el-input   v-else  v-model="inputCode" ref="inputRef" id="inputCode"  style="width: 200px; height: 40px;ime-mode:active"  @change="inputChabge"
                     placeholder="请输入患者卡号或扫描条码" />
                 </el-col>
               </el-row>
@@ -201,9 +201,9 @@
           </div>
         </div>
     </div>
-    <el-dialog title="提示" v-model="netLink" width="30%">
+    <!-- <el-dialog title="提示" v-model="netLink" width="30%">
       <span>无法链接到网络!</span>
-    </el-dialog>
+    </el-dialog> -->
   </div>
 </template>
 <script setup lang="ts">
@@ -221,7 +221,14 @@
 import {base64toFile} from '@/samples/faceApi'
 import{initPort} from '@/samples/portApi'
 import{initPort as oumulongHbp9030 } from '@/samples/deviceApi/oumulong-HBP-9030'
+import{initPort as  TM2655VP} from '@/samples/deviceApi/TM2655VP'
+import{initPort as zhiRongT605 } from '@/samples/deviceApi/zhiRongT605'
+import{initPort as taiHengM523 } from '@/samples/deviceApi/taiHengM523'
+import{initPort as XK3190A12 } from '@/samples/deviceApi/XK3190A12'
+// 读取体重文件
+import{toDataTz,todatatzs } from '@/samples/deviceApi/seca101'
 import { ElLoading, ElMessage } from 'element-plus'
+import { el } from 'element-plus/es/locale'
 let trackerTask: any = null;
 // 标识用的画布
 const myCanvas = ref<HTMLCanvasElement | null>(null);
@@ -254,7 +261,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
@@ -313,8 +320,16 @@
     ipcRenderer.invoke('logger', '网络已经断开')
   }else{
     ipcRenderer.invoke('logger', '网络已经恢复')
+   
   }
   return !sockte.netLink
+})
+watch(netLink,()=>{
+  if(!netLink.value){
+    ElMessage.success('网络已经连接')
+  }else{
+    ElMessage.warning('网络已断开,等待重连')
+  }
 })
 
 // 体重
@@ -346,59 +361,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 +424,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}`)
@@ -471,6 +434,7 @@
       dialogVisible.value = false
       speech.value?.speak({ text: str }).then(() => {
       })
+
       sockteStore().setweightSockte({
         type: "体重秤",
         state: 2,
@@ -485,6 +449,9 @@
         result: "",
         resultTime: ""
       })
+     
+     
+      
 
     }
     // 没有找到患者
@@ -498,6 +465,7 @@
     }
     // 没有排班
     else if (patientInfo.value.isScheduled === 0) {
+      settime()
       ipcRenderer.invoke('logger', `患者没有排班:${patientInfo.value.name}`)
       // console.log( `患者没有排班:${patientInfo.value.name}`)
       //关闭人脸弹框
@@ -537,16 +505,15 @@
           weight: weightInfo.value.result,
           bloodPressure: ''
         }
-        settime()
         if (patientCodeLs !== mode.patientCode) {
+          settime()
           // 定时数秒器
           const tt = mode.weight.replace('.', '点')
-          speech.value?.speak({ text: `称重完成,${tt}kg` }).then(() => {
+          speech.value?.speak({ text: `称重完成,${tt}千克` }).then(() => {
             console.log("播报完成...")
           })
           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()
@@ -561,6 +528,10 @@
         }else if(Number(patientInfo.value.pureWeight) !== 0&&patientInfo.value.isAfterMed===1 && patientInfo.value.preWeight>10){
           aimTSL.value = (Number(patientInfo.value.preWeight)- Number(patientInfo.value.pureWeight) - Number(patientInfo.value.clothesWeight)).toFixed(2)
         }
+      }else if(patientInfo.value.code===''&&weightInfo.value.result !== "0"){
+        speech.value?.speak({ text: "没有识别的患者,请先验证患者" }).then(() => {
+          // console.log("播报完成...")
+        })
       }
   }
 );
@@ -697,10 +668,23 @@
 );
 // 文本框点击事件
 const inputChabge = () => {
-  sendPationCodeApi(inputCode.value)
-  setTimeout(function () {
-    inputCode.value = ''
-  }, 1000)
+  console.log(inputCode.value.substring(0,4)==='1553')
+  // 更具沅江肾病医院的二维码匹配
+  if(inputCode.value.substring(0,4)==='1553'){
+    const list=inputCode.value.split(':')
+    console.log(list)
+    sendPationCodeApi(list[1])
+    setTimeout(function () {
+      inputCode.value = ''
+    }, 5000)
+  }else{
+    sendPationCodeApi(inputCode.value)
+    setTimeout(function () {
+      inputCode.value = ''
+    }, 5000)
+  }
+ 
+  
 }
 // 点击10下关闭程序
 const guyanbi = () => {
@@ -709,10 +693,8 @@
     ipcRenderer.send('winClose')
   }
 }
-const openPort=()=>{
-  initPort('com5',115200)
-}
 onMounted(() => {
+  console.log(0%5)
   console.log('页面初始化', os.hostname())
   setTimeout(()=>{
     console.log('8秒后执行')
@@ -724,9 +706,30 @@
     }
     // 是否开启血压计联机
     if(configData.value.Is_xyj){
-      oumulongHbp9030(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate)
+      if(configData.value.xyj_type==='TM2655'){
+        TM2655VP(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate)
+      }else{
+        oumulongHbp9030(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate)
+      } 
     }
-      // 是否开启脸识别
+    // 是否开启志荣体重秤联机
+    if(configData.value.Is_tzc){
+      //台衡M523
+      if(configData.value.tzc_type==='taiHengM523'){
+        taiHengM523(configData.value.tzcPortPath,configData.value.tzcBaudRate)
+      }
+      // seca101读取文件
+      else if(configData.value.tzc_type==='seca101'){
+        console.log('体重是读取文件')
+      }// 耀华XK3190-A12 
+      else if(configData.value.tzc_type==='XK3190-A12'){
+        XK3190A12(configData.value.tzcPortPath,configData.value.tzcBaudRate)
+      }
+      else{
+        zhiRongT605(configData.value.tzcPortPath,configData.value.tzcBaudRate)
+      }
+    }
+    // 是否开启脸识别
     isUseFaceRecogService.value = configData.value.isUseFaceRecogService
     console.log('人脸识别',isUseFaceRecogService.value)
     if (isUseFaceRecogService.value) {
@@ -743,7 +746,7 @@
       if(clockNum.value===0){
         fuxuan()
       }
-      inputRef.value.focus();
+      
       date.value=formatDate(new Date(),'YYYY-mm-dd HH:MM')
       if(Number(date.value.substring(11,13))<12){
         timeShidaun.value='上午好!'
@@ -752,6 +755,13 @@
       }else {
         timeShidaun.value='晚上好!'
       }
+      // 验证人脸识别已经通过但是还没有体重数据主动获取数据
+      if(patientInfo.value.name!==''&&weightInfo.value.result==='0'&&configData.value.Is_tzc){
+        console.log('主动获取体重')
+        todatatzs(patientInfo.value.datetime)
+      }
+      inputRef.value.focus();
+
     }, 1000)
     speech.value = new Speech();
     speech.value?.setLanguage('zh-CN')

--
Gitblit v1.8.0