From 509d38a14718ec9c76220b3a34bfe9dcb28c682c Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 18 七月 2023 17:56:09 +0800
Subject: [PATCH] 新增测温功能

---
 /dev/null                   |    0 
 src/views/home/index.vue    |   43 ++++++++++----
 src/samples/portApi.ts      |   78 ++++++++++++++++++++++++++
 src/samples/sockteStomp.ts  |    4 +
 src/stores/StoresConfing.ts |    3 +
 src/views/home/index.css    |    1 
 package.json                |    5 +
 src/samples/faceApi.ts      |    4 +
 src/stores/patient.ts       |    4 +
 src/utils/axios.ts          |    4 
 10 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/imgs/1686890782280.png b/imgs/1686890782280.png
deleted file mode 100644
index 26d8ca1..0000000
--- a/imgs/1686890782280.png
+++ /dev/null
Binary files differ
diff --git a/imgs/1686901190509.png b/imgs/1686901190509.png
deleted file mode 100644
index bbdb61e..0000000
--- a/imgs/1686901190509.png
+++ /dev/null
Binary files differ
diff --git a/imgs/1686906719633.png b/imgs/1686906719633.png
deleted file mode 100644
index e0818aa..0000000
--- a/imgs/1686906719633.png
+++ /dev/null
Binary files differ
diff --git a/imgs/1687242156020.png b/imgs/1687242156020.png
deleted file mode 100644
index 5a9be19..0000000
--- a/imgs/1687242156020.png
+++ /dev/null
Binary files differ
diff --git a/package.json b/package.json
index fe40e94..ae6af84 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "sign-tool",
-  "version": "2.6.5",
+  "version": "2.6.6",
   "icon": "public/favicon.ico",
   "main": "dist/electron/main/index.js",
   "author": "",
@@ -17,7 +17,7 @@
     }
   ],
   "engines": {
-    "node": ">=14.17.0"
+    "node": "^14.18.0 || >=16.0.0"
   },
   "devDependencies": {
     "@types/node": "^18.0.0",
@@ -66,6 +66,7 @@
     "less": "^4.1.3",
     "node-sass": "^8.0.0",
     "pinia": "^2.0.14",
+    "serialport": "^11.0.0",
     "sound-play": "^1.1.0",
     "speak-tts": "^2.0.8",
     "stompjs": "^2.3.3",
diff --git a/src/samples/faceApi.ts b/src/samples/faceApi.ts
index a4c5d9c..0495a30 100644
--- a/src/samples/faceApi.ts
+++ b/src/samples/faceApi.ts
@@ -58,6 +58,10 @@
       console.log(matchList)
       if(matchList?.length>0){
         const faceItems =matchList[0].faceItems
+        if(faceItems?.length===0){
+          console.log('没有找到患者对应的人脸')
+          return false
+        }
         if(faceItems[0].score>=faceScore){
           const entityId=faceItems[0].entityId
           console.log(entityId,'得到了人脸识别id,存患者code到vuex')
diff --git a/src/samples/portApi.ts b/src/samples/portApi.ts
new file mode 100644
index 0000000..744ae76
--- /dev/null
+++ b/src/samples/portApi.ts
@@ -0,0 +1,78 @@
+import { ElMessage } from 'element-plus'
+const { SerialPort } = require('serialport')
+const { DelimiterParser } = require('@serialport/parser-delimiter')
+
+let serialport={}
+// 解析器分隔符
+const buf=Buffer.from('A555','hex')
+const hexString = 'A55501FB0D0A';
+const hexBuffer = Buffer.from(hexString, 'hex');
+
+const initPort=(path:String,baudRate:Number)=>{
+    console.log('初始化打开测温端口')
+    serialport  = new SerialPort({ path, baudRate }, (err: any) => {
+        if (err) {
+            console.log(err)
+            ElMessage({
+                message: '端口打开失败!',
+                type: 'error',
+            })
+            console.log(err)
+        }else{
+            ElMessage({
+                message: '端口打开成功',
+                type: 'success',
+            })
+            setInterval(()=>{
+                serialport.write(hexBuffer,(err: any)=>{
+                    if(err){
+                        console.log('发送失败')
+                    }
+                })  
+            },3000)
+        } 
+    })
+    serialport.on("close",(err: any)=>{
+        console.log('端口异常端口链接断开')
+        console.log(err)
+    })
+    // 解析分割数据流
+    const parser = serialport.pipe(new DelimiterParser({ 
+        delimiter:buf
+    }))
+    parser.on('data', (value: string | any[])=>{
+        if(value.length>=5){
+          const hex4e=value[0]
+          const hex0e=value[1]
+          const wendu=(hex4e+hex0e*256)/100
+          ElMessage({
+                message: '收到温度:'+wendu,
+                type: 'success',
+            })
+        }
+      })
+}
+const sundGetKey=()=>{
+    const hexString = 'A55501FB';
+    const hexBuffer = Buffer.from(hexString, 'hex');
+    if(serialport){
+        console.log('串口没有初始化')
+        return false
+    }
+    serialport.write(hexBuffer,(err: any)=>{
+        if(err){
+            console.log('发送失败')
+        }
+        ElMessage({
+            message: '发送KEY成功',
+            type: 'success',
+        })
+    })  
+}
+
+
+
+export {
+    initPort,
+    sundGetKey
+}
diff --git a/src/samples/sockteStomp.ts b/src/samples/sockteStomp.ts
index 17ae283..63189f3 100644
--- a/src/samples/sockteStomp.ts
+++ b/src/samples/sockteStomp.ts
@@ -102,7 +102,9 @@
         txq:resultInfo.txq,
         medMethod:resultInfo.medMethod,
         glq:resultInfo.glq,
-        preBP:resultInfo.preBP
+        preBP:resultInfo.preBP,
+        nextRecordDate:resultInfo.nextRecordDate,
+        actuallyClliang:resultInfo.actuallyClliang
     }
     // 写入vuex里
     patientInfoStore().setpatientInfo(info)
diff --git a/src/stores/StoresConfing.ts b/src/stores/StoresConfing.ts
index ce9264c..8eeb2d1 100644
--- a/src/stores/StoresConfing.ts
+++ b/src/stores/StoresConfing.ts
@@ -10,6 +10,9 @@
         timeJg:10000,
         base_api:"",
         face_push:3,
+        Is_ce_wen:false,
+        portPath:'COM5',
+        baudRate:115200
         
     })
     /**
diff --git a/src/stores/patient.ts b/src/stores/patient.ts
index 487fc97..07ac50a 100644
--- a/src/stores/patient.ts
+++ b/src/stores/patient.ts
@@ -25,7 +25,9 @@
             lastTimeAfterBP:'',
             txq:'',
             medMethod:'',
-            glq:''
+            glq:'',
+            nextRecordDate:'',
+            actuallyClliang:'',
 
        })// 初始值
     const viewNumber=ref(150)
diff --git a/src/utils/axios.ts b/src/utils/axios.ts
index b80a459..722a686 100644
--- a/src/utils/axios.ts
+++ b/src/utils/axios.ts
@@ -3,8 +3,8 @@
 import { ElMessage } from 'element-plus'
 import { confingInfoStore } from '@/stores/StoresConfing'
 
-// const BASE_URL = 'https://hemobs.icoldchain.cn'
-let BASE_URL = 'https://hemobs.icoldchain.cn'
+let BASE_URL = 'http://testbs.ihemodialysis.com'
+// let BASE_URL = 'https://hemobs.icoldchain.cn'
 const TIME_OUT = 10 * 1000
 
 setTimeout(()=>{
diff --git a/src/views/home/index.css b/src/views/home/index.css
index b28a4fb..5ad93a1 100644
--- a/src/views/home/index.css
+++ b/src/views/home/index.css
@@ -22,4 +22,5 @@
     align-items: center;
     justify-content: center;
     border-radius: 2px
+    
 }
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 889188e..8a76ba4 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -33,10 +33,18 @@
             <el-row style="height: 30%;background: rgba(243, 247, 243, 0.3);border-radius: 8px; margin-top: 5%; font-size: 2rem;">
       
               <div style="height: 25%; line-height: 100%; width: 100%;color: #FFFFFF; "   >
-                <div  style="width: 200px; font-size: 2rem; text-align: center; height: 63px; line-height: 63px;background: #2CAAFD;border-radius: 0px 8px 0px 50px;float:right">签到时间</div>
+                <div v-if="patientInfo.isAfterMed===0"   style="width: 200px; font-size: 2rem; text-align: center; height: 63px; line-height: 63px;background: #2CAAFD;border-radius: 0px 8px 0px 50px;float:right">
+                  签到时间
+                </div>
+                <div v-if="patientInfo.isAfterMed===1"   style="width: 200px; font-size: 2rem; text-align: center; height: 63px; line-height: 63px;background: #2CAAFD;border-radius: 0px 8px 0px 50px;float:right">
+                  下次透析时间
+                </div>
               </div>
-              <div style="height: 75%; line-height: 100%; width: 100%;color: #FFFFFF; padding-top: 35px; padding-left: 20px; ">
+              <div v-if="patientInfo.isAfterMed===0" style="height: 75%; line-height: 100%; width: 100%;color: #FFFFFF; padding-top: 35px; padding-left: 20px; ">
                   <div >{{date}}</div>
+              </div>
+              <div v-else style="height: 75%; line-height: 100%; width: 100%;color: #FFFFFF; padding-top: 35px; padding-left: 20px; ">
+                  <div v-if="patientInfo.nextRecordDate!==''&&patientInfo.nextRecordDate!==null">{{patientInfo.nextRecordDate.substring(0,11)}}</div>
               </div>
             </el-row>
           </el-col>
@@ -106,14 +114,16 @@
             <div style="height: 48%; margin-top: 4%;">
               <div style="height: 25%;">
                 <div class="textjuzhong" style="background: #65AAF6; font-size: 2rem; color: #FFFFFF;">
-                  <template v-if="configData.deviceType==='体重秤'">目标脱水量(L)</template>
+                  <template v-if="configData.deviceType==='体重秤'&&patientInfo.isAfterMed===0">目标脱水量(L)</template>
+                  <template v-if="configData.deviceType==='体重秤'&&patientInfo.isAfterMed===1">实际超滤量(L)</template>
                   <template v-if="configData.deviceType==='血压计'">透前脉搏(次/分)</template>
                   
                 </div>
               </div>
               <div style="height: 75%;">
                 <div class="textjuzhong" style="background: rgba(243, 247, 243, 0.3); font-size: 6rem; font-weight: 800; color: #65AAF6;">
-                  <template v-if="configData.deviceType==='体重秤'">{{aimTSL}}</template>
+                  <template v-if="configData.deviceType==='体重秤'&&patientInfo.isAfterMed===0">{{aimTSL}}</template>
+                  <template v-if="configData.deviceType==='体重秤'&&patientInfo.isAfterMed===1">{{patientInfo.actuallyClliang}}</template>
                   <template v-if="configData.deviceType==='血压计'">{{mai_bu}}</template>
                 </div>
               </div>
@@ -158,13 +168,11 @@
             </el-col>
             <el-col :span="12" >
               <el-row>
-                <el-col :span="23" style="text-align: right; line-height: 67px;padding-right: 0px; font-size: 40px;font-weight: 400;color: #EB6F1C;">
-                  <div>{{clockNum}}S</div>
-                </el-col>
-                <el-col :span="1" style="padding-right: 10px;" class="divinput">
-                  <el-input  v-model="inputCode" ref="inputRef" id="inputCode" style="width: 0px; height: 0px;"  @change="inputChabge"
+                <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"
                     placeholder="请输入患者卡号或扫描条码" />
-                  </el-col>
+                </el-col>
               </el-row>
             </el-col>
           </el-row>
@@ -204,6 +212,7 @@
 import { formatDate } from '@/utils/formatTime'
 import { confingInfoStore } from '@/stores/StoresConfing'
 import {base64toFile} from '@/samples/faceApi'
+import{initPort} from '@/samples/portApi'
 import { ElLoading, ElMessage } from 'element-plus'
 let trackerTask: any = null;
 // 标识用的画布
@@ -260,6 +269,8 @@
 let patientCodeLs = ''
 // 临时血压
 let patientCodeLsXy = ''
+// 测温是否开启
+const is_ce_wen=ref()
 const isUseFaceRecogService = ref(false)
 const fasongNum=ref(0)
 const caozuo=ref(0)// 点击10下才能关闭
@@ -438,6 +449,7 @@
       // 定时数秒器
     settime()
     if (patientInfo.value.id !== 0 && patientInfo.value.name !== '' && patientInfo.value.isScheduled === 1) {
+      // 人脸识别成功后 1查看是否开启测温
       // console.log(`患者信息识别成功:${patientInfo.value.name}`)
       ipcRenderer.invoke('logger', `患者信息识别成功:${patientInfo.value.name}`)
       let str = `${patientInfo.value.name}识别成功。床号:${patientInfo.value.deviceNo}`
@@ -675,12 +687,19 @@
     ipcRenderer.send('winClose')
   }
 }
+const openPort=()=>{
+  initPort('com5',115200)
+}
 onMounted(() => {
   console.log('页面初始化', os.hostname())
   setTimeout(()=>{
-    console.log('5秒后执行')
+    console.log('8秒后执行')
     console.log('打印设置文件')
     console.log(configData.value)
+    is_ce_wen.value=configData.value.Is_ce_wen
+    if(is_ce_wen.value){
+      initPort(configData.value.portPath,configData.value.baudRate)
+    }
       // 是否开启脸识别
     isUseFaceRecogService.value = configData.value.isUseFaceRecogService
     console.log('人脸识别',isUseFaceRecogService.value)
@@ -789,7 +808,7 @@
   border-radius: 50px 0px 0px 50px;
   position: fixed;
   right: 0;
- 
 }
+  :v-deep .el-input__inner {background-color: transparent !important;}
 </style>
 

--
Gitblit v1.8.0