chenyc
2023-11-14 7394e5e60ec25ede11d1ef88358454da8f9c7390
增加通讯
5个文件已修改
1 文件已重命名
1个文件已删除
4个文件已添加
185 ■■■■ 已修改文件
electron/main/index.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1697008903330.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1699605795037.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1699609712817.png 补丁 | 查看 | 原始文档 | blame | 历史
imgs/1699956242639.png 补丁 | 查看 | 原始文档 | blame | 历史
package.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/samples/deviceApi/TM2655VP.ts 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/samples/deviceApi/XK3190A12.ts 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/stores/StoresConfing.ts 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/axios.ts 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/index.vue 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,
imgs/1697008903330.png
Binary files differ
imgs/1699605795037.png
imgs/1699609712817.png
imgs/1699956242639.png
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": "",
src/samples/deviceApi/TM2655VP.ts
File was renamed from src/samples/deviceApi/yaoHua.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
              }
src/samples/deviceApi/XK3190A12.ts
New file
@@ -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,
}
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体重秤有效  检验体重秤多次数据相等就传送
        
    })
    /**
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 || '未知错误,请刷新重试'}`)
    }
}
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();