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

---
 /dev/null                          |    0 
 src/samples/deviceApi/TM2655VP.ts  |   24 +++---
 src/views/home/index.vue           |   51 +++++++++---
 src/stores/StoresConfing.ts        |   11 +-
 imgs/1699956242639.png             |    0 
 package.json                       |    2 
 electron/main/index.ts             |    2 
 imgs/1699609712817.png             |    0 
 src/samples/deviceApi/XK3190A12.ts |   85 +++++++++++++++++++++
 src/utils/axios.ts                 |   10 +-
 imgs/1699605795037.png             |    0 
 11 files changed, 149 insertions(+), 36 deletions(-)

diff --git a/electron/main/index.ts b/electron/main/index.ts
index ba603bc..78d324b 100644
--- a/electron/main/index.ts
+++ b/electron/main/index.ts
@@ -68,6 +68,8 @@
     frame:store.get('debug')===undefined?true:store.get('debug'),//关闭菜单栏
     fullscreen: true,// 开启默认全屏
     kiosk: true,
+    movable:false,// 关闭窗口移动
+
     // autoHideMenuBar:store.get('debug'), 
     webPreferences: {
       preload: splash,
diff --git a/imgs/1697008903330.png b/imgs/1697008903330.png
deleted file mode 100644
index 616bc83..0000000
--- a/imgs/1697008903330.png
+++ /dev/null
Binary files differ
diff --git a/imgs/1699605795037.png b/imgs/1699605795037.png
new file mode 100644
index 0000000..cf609f5
--- /dev/null
+++ b/imgs/1699605795037.png
Binary files differ
diff --git a/imgs/1699609712817.png b/imgs/1699609712817.png
new file mode 100644
index 0000000..a367e81
--- /dev/null
+++ b/imgs/1699609712817.png
Binary files differ
diff --git a/imgs/1699956242639.png b/imgs/1699956242639.png
new file mode 100644
index 0000000..755faa9
--- /dev/null
+++ b/imgs/1699956242639.png
Binary files differ
diff --git a/package.json b/package.json
index 92e76f9..7625ca5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "sign-tool",
-  "version": "2.7.1",
+  "version": "2.7.2",
   "icon": "public/favicon.ico",
   "main": "dist/electron/main/index.js",
   "author": "",
diff --git a/src/samples/deviceApi/yaoHua.ts b/src/samples/deviceApi/TM2655VP.ts
similarity index 66%
rename from src/samples/deviceApi/yaoHua.ts
rename to src/samples/deviceApi/TM2655VP.ts
index 5a17553..c94e0e1 100644
--- a/src/samples/deviceApi/yaoHua.ts
+++ b/src/samples/deviceApi/TM2655VP.ts
@@ -1,4 +1,4 @@
-// 欧姆龙 HBP-9030 115200 
+// 6.诊之助 TM2655VP
 import { ElMessage } from 'element-plus'
 const { SerialPort } = require('serialport')
 const { DelimiterParser } = require('@serialport/parser-delimiter')
@@ -7,40 +7,40 @@
 
 
 const initPort=(path:String,baudRate:Number)=>{
-    console.log('初始化打开耀华体重秤端口')
+    console.log('初始化打开诊之助 TM2655VP端口')
     const serialport  = new SerialPort({ path, baudRate }, (err: any) => {
         if (err) {
             console.log(err)
             ElMessage({
-                message: '耀华体重秤端口打开失败!',
+                message: '诊之助 TM2655VP端口打开失败!',
                 type: 'error',
             })
             console.log(err)
         }else{
             ElMessage({
-                message: '耀华体重秤端口打开成功',
+                message: '诊之助 TM2655VP端口打开成功',
                 type: 'success',
             })
         } 
     })
     serialport.on("close",(err: any)=>{
-        console.log('耀华体重秤端口异常端口链接断开')
+        console.log('诊之助 TM2655VP端口异常端口链接断开')
         console.log(err)
     })
     // 解析分割数据流
-    const parser = serialport.pipe(new ByteLengthParser({ length: 14*4-1 }))
+    const parser = serialport.pipe(new ByteLengthParser({ length: 32*2 }))
     parser.on('data', (value: string | any[])=>{
         console.log(value.toString())
         const str=value.toString()
-        const list=str.split(',')
-        console.log(list)
-        if(list.length===11){
-
+        console.log(str.length)
+        const re=str.substring(34,37)+','+str.substring(39,41)+','+str.substring(44,46)
+        console.log(re)
+        if(str.length>=11){
             sockteStore().setxyjSockte(
               {
-                  deviceName:'HBP-9030',
+                  deviceName:'TM2655VP',
                   type:"血压计",
-                  result:list[7]+','+list[8]+','+list[9],
+                  result:str.substring(34,37)+','+str.substring(44,47)+','+str.substring(49,52),
                   resultTime:new Date().toString(),
                   state:2
               }
diff --git a/src/samples/deviceApi/XK3190A12.ts b/src/samples/deviceApi/XK3190A12.ts
new file mode 100644
index 0000000..6c90111
--- /dev/null
+++ b/src/samples/deviceApi/XK3190A12.ts
@@ -0,0 +1,85 @@
+// 耀华XK3190-A12 
+import { ElMessage } from 'element-plus'
+const { SerialPort } = require('serialport')
+const { DelimiterParser } = require('@serialport/parser-delimiter')
+const { ReadyParser } = require('@serialport/parser-ready')
+import {sockteStore} from '@/stores/sockteInfo'
+import { confingInfoStore } from '@/stores/StoresConfing'
+
+const initPort=(path:String,baudRate:Number)=>{
+   
+    // 配置文件定义的对此次数
+    const yanjiancishu=confingInfoStore().confingInfo.jianyancishu===undefined?4:confingInfoStore().confingInfo.jianyancishu
+    console.log('初始化打开XK3190-A12体重秤端口',yanjiancishu)
+    let lisijieguo=''
+    let duibinum=0
+    const serialport  = new SerialPort({ path, baudRate }, (err: any) => {
+        if (err) {
+            console.log(err)
+            ElMessage({
+                message: 'XK3190-A12体重秤端口打开失败!',
+                type: 'error',
+            })
+            console.log(err)
+        }else{
+            ElMessage({
+                message: 'XK3190-A12体重秤端口打开成功',
+                type: 'success',
+            })
+        } 
+    })
+    serialport.on("close",(err: any)=>{
+        console.log('XK3190-A12体重秤端口异常端口链接断开')
+        console.log(err)
+    })
+    // 解析分割数据流
+    //
+    //
+    //
+    //
+    //
+    // 77 6E 30 30 30 30 30 2E 30 6B 67 0D 0A
+    const parser = serialport.pipe(new DelimiterParser({ delimiter:Buffer.from([107,103,13,10]),includeDelimiter:true }))
+    parser.on('data', (value: string | any[])=>{
+        console.log(value.toString())
+        const str=value.toString()
+        // 截取结果
+        const list=str.substring(2,9) 
+        if(Number(list)>20){
+            // 判断是否相等 相等加一
+            if(list===lisijieguo){
+                duibinum++
+            }else{
+                lisijieguo=list
+                duibinum=0
+            }
+            // 对比4次结果都一致
+            if(duibinum>=yanjiancishu){
+                const res=Number(list)
+                console.log(res,'获取到的体重')
+                sockteStore().setweightSockte(
+                    {
+                        deviceName:'XK3190-A12',
+                        type:"体重秤",
+                        result:res.toString(),
+                        resultTime:new Date().toString(),
+                        state:2
+                    }
+                )
+                duibinum=0
+                lisijieguo=''
+            }else{
+                
+            }
+
+            
+
+        }else{
+            console.log('小于20')
+        }  
+    }) // all data after READY is received
+}
+
+export {
+    initPort,
+}
diff --git a/src/stores/StoresConfing.ts b/src/stores/StoresConfing.ts
index a0d2e8b..067258a 100644
--- a/src/stores/StoresConfing.ts
+++ b/src/stores/StoresConfing.ts
@@ -14,14 +14,17 @@
         portPath:'COM5',
         baudRate:115200,
         Is_xyj:false,
+        xyj_type:'TM2655',
+        // HBP-9030 波特率115200 ,TM2655 波特率 2400
         xueyanjiPortPath:"COM35",
         xueyanjiBaudRate:115200,
-        Is_tzc:false,
-        // 志荣的[zhiRongT605];台衡的M523[taiHengM523] //[s]eca101]读文件夹 
+        Is_tzc:true,
+        // 志荣的[zhiRongT605];台衡的M523[taiHengM523] //[s]eca101]读文件夹//  耀华XK3190-A12
         tzc_type:"seca101",
         tzcPortPath:"COM34",
-        tzcBaudRate:120,// zhiRongT605波特率1200;台衡523波特率9600
-        seca101Path:"D:/seca101/data/"// 文件获取目录
+        tzcBaudRate:9600,// zhiRongT605波特率1200;台衡523波特率9600, 耀华XK3190-A12 9600
+        seca101Path:"D:/seca101/data/",//该参数只对体重秤 赛康101 文件获取目录,
+        jianyancishu:4,// 该参数只对耀华XK3190-A12体重秤有效  检验体重秤多次数据相等就传送
         
     })
     /**
diff --git a/src/utils/axios.ts b/src/utils/axios.ts
index 012fb06..3112807 100644
--- a/src/utils/axios.ts
+++ b/src/utils/axios.ts
@@ -23,15 +23,15 @@
     // HTTP状态码判断
     switch (status) {
         case 401:
-            return alert(`Error Code: ${status}, Message: ${error.msg || '登录失效,请重新登录'}`)
+            ElMessage.error(`Error Code: ${status}, Message: ${error.msg || '登录失效,请重新登录'}`)
         case 403:
-            return alert(`Error Code: ${status}, Message: ${error.msg || '你没有访问权限'}`)
+            ElMessage.error(`Error Code: ${status}, Message: ${error.msg || '你没有访问权限'}`)
         case 500:
-            return alert(`Error Code: ${status}, Message: ${error.msg || '后台错误,请联系管理员'}`)
+            ElMessage.error(`Error Code: ${status}, Message: ${error.msg || '后台错误,请联系管理员'}`)
         case 502:
-            return alert(`Error Code: ${status}, Message: ${error.msg || '平台环境异常'}`)
+            ElMessage.error(`Error Code: ${status}, Message: ${error.msg || '平台环境异常'}`)
         default:
-            alert(`Error Code: ${status}, Message: ${error.msg || '未知错误,请刷新重试'}`)
+            ElMessage.error(`Error Code: ${status}, Message: ${error.msg || '未知错误,请刷新重试'}`)
 
     }
 }
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index e102b5f..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>
@@ -221,11 +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);
@@ -525,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("播报完成...")
+        })
       }
   }
 );
@@ -661,10 +668,23 @@
 );
 // 文本框点击事件
 const inputChabge = () => {
-  sendPationCodeApi(inputCode.value)
-  setTimeout(function () {
-    inputCode.value = ''
-  }, 5000)
+  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 = () => {
@@ -686,7 +706,11 @@
     }
     // 是否开启血压计联机
     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){
@@ -697,6 +721,9 @@
       // 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)
@@ -728,14 +755,10 @@
       }else {
         timeShidaun.value='晚上好!'
       }
-      //5秒一次验证读取体重数据
-      console.log(clockNum.value,clockNum.value%5==0)
-      if(clockNum.value%3==0){
-        // 验证人脸识别已经通过但是还没有体重数据主动获取数据
-        if(patientInfo.value.name!==''&&weightInfo.value.result==='0'){
-          console.log('主动获取体重')
-          todatatzs(patientInfo.value.datetime)
-        }
+      // 验证人脸识别已经通过但是还没有体重数据主动获取数据
+      if(patientInfo.value.name!==''&&weightInfo.value.result==='0'&&configData.value.Is_tzc){
+        console.log('主动获取体重')
+        todatatzs(patientInfo.value.datetime)
       }
       inputRef.value.focus();
 

--
Gitblit v1.8.0