| New file |
| | |
| | | // 脉搏波 rbp-9000c 115200 |
| | | import { ElMessage } from 'element-plus' |
| | | const { SerialPort } = require('serialport') |
| | | const { DelimiterParser } = require('@serialport/parser-delimiter') |
| | | const { ByteLengthParser } = require('@serialport/parser-byte-length') |
| | | import {sockteStore} from '@/stores/sockteInfo' |
| | | |
| | | |
| | | const initPort=(path:String,baudRate:Number)=>{ |
| | | const serialport = new SerialPort({ path, baudRate }, (err: any) => { |
| | | if (err) { |
| | | console.log(err) |
| | | ElMessage({ |
| | | message: '端口打开失败!', |
| | | type: 'error', |
| | | }) |
| | | console.log(err) |
| | | }else{ |
| | | ElMessage({ |
| | | message: 'rbp-9000c端口打开成功', |
| | | type: 'success', |
| | | }) |
| | | } |
| | | }) |
| | | serialport.on("close",(err: any)=>{ |
| | | console.log('端口异常端口链接断开') |
| | | console.log(err) |
| | | }) |
| | | // 解析分割数据流 AA 80 09 0F 01 06 00 17 05 0E 10 11 0F 00 8D 00 44 00 56 8C |
| | | //AA 80 09 0F 01 06 00 17 05 0E 0F 37 37 00 74 00 46 00 50 70 |
| | | const parser = serialport.pipe(new ByteLengthParser({ length: 20 })) |
| | | 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){ |
| | | sockteStore().setxyjSockte( |
| | | { |
| | | deviceName:'HBP-9030', |
| | | type:"血压计", |
| | | result:list[14]+','+list[16]+','+list[18], |
| | | resultTime:new Date().toString(), |
| | | state:2 |
| | | } |
| | | ) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | export { |
| | | initPort, |
| | | } |
| | |
| | | // |
| | | // |
| | | // 77 6E 30 30 30 30 30 2E 30 6B 67 0D 0A |
| | | // 77 6E 30 30 30 30 32 38 2E 36 6B 67 0D 0A |
| | | // 77 6E 30 30 30 30 32 38 2E 36 6B 67 0D 0A |
| | | //wn000016.6kg |
| | | 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,10) |
| | | console.log(list) |
| | | if(Number(list)>20){ |
| | | // 判断是否相等 相等加一 |
| | | if(list===lisijieguo){ |
| New file |
| | |
| | | // 欧姆龙 HBP-9030 115200 |
| | | 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' |
| | | |
| | | const initPort=(path:String,baudRate:Number)=>{ |
| | | console.log('初始化打开mbp9020血压计端口') |
| | | const serialport = new SerialPort({ path, baudRate }, (err: any) => { |
| | | if (err) { |
| | | console.log(err) |
| | | ElMessage({ |
| | | message: 'mbp9020血压计端口打开失败!', |
| | | type: 'error', |
| | | }) |
| | | console.log(err) |
| | | }else{ |
| | | ElMessage({ |
| | | message: 'mbp9020血压计端口打开成功', |
| | | type: 'success', |
| | | }) |
| | | } |
| | | }) |
| | | serialport.on("close",(err: any)=>{ |
| | | console.log('mbp9020血压计端口异常端口链接断开') |
| | | console.log(err) |
| | | }) |
| | | // 解析分割数据流 |
| | | //bp,99999999999999999999,2024/04/26,20:41,116,083,067,099,1 |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // 62 702C 39 39 39 39 39 39 39 39 39 39 39 3939 39 39 39 39 39 39 39 2C 32 30 32 34 2F 30 34 2F32 36 2C 32 30 3A 34 36 2C 31 31 38 2C 30 38 31 2C30 36 33 2C 30 39 35 2C 30 0D |
| | | const parser = serialport.pipe(new DelimiterParser({ delimiter:Buffer.from([13]),includeDelimiter:true })) |
| | | parser.on('data', (value: string | any[])=>{ |
| | | console.log(value.toString()) |
| | | const str=value.toString() |
| | | const list=str.split(',') |
| | | console.log(list) |
| | | if(list.length>=5&&list[0].search('bp')!==-1){ |
| | | sockteStore().setxyjSockte( |
| | | { |
| | | deviceName:'mbp9020', |
| | | type:"血压计", |
| | | result:list[4]+','+list[6]+','+list[7], |
| | | resultTime:new Date().toString(), |
| | | state:2 |
| | | } |
| | | ) |
| | | }else{ |
| | | console.log('数据格式不对') |
| | | } |
| | | }) // all data after READY is received |
| | | } |
| | | |
| | | export { |
| | | initPort, |
| | | } |
| | |
| | | * @param path 图片路径 |
| | | */ |
| | | const faceShibie= async(path:any)=>{ |
| | | console.log('文件路径',path) |
| | | const fileStream = fs.createReadStream(path); |
| | | let client=createClient() |
| | | // 通过本地文件 |
| | |
| | | delImg(path) |
| | | }) |
| | | } |
| | | // 验证---逻辑 |
| | | const yanzhengimg=async(path:any)=>{ |
| | | console.log('文件路径--逻辑',path) |
| | | const fileStream = fs.createReadStream(path); |
| | | let client=createClient() |
| | | // 通过本地文件 |
| | | const facedata= confingInfoStore().confingInfo.face_database |
| | | const faceScore=confingInfoStore().confingInfo.face_score |
| | | let searchFaceAdvanceRequest = new $facebody20191230.SearchFaceAdvanceRequest(); |
| | | searchFaceAdvanceRequest.imageUrlObject = fileStream; |
| | | searchFaceAdvanceRequest.dbName = facedata |
| | | searchFaceAdvanceRequest.limit = 2; |
| | | let runtime = new $Util.RuntimeOptions({ }); |
| | | client.searchFaceAdvance(searchFaceAdvanceRequest, runtime).then(re=>{ |
| | | if(re.statusCode===200){ |
| | | const matchList=re.body.data?.matchList |
| | | // console.log('得到的人脸库') |
| | | 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') |
| | | sockteStore().setfaceSockte({ |
| | | deviceType: "人脸识别", |
| | | deviceName: "人脸识别", |
| | | result: entityId, |
| | | resultTime: '' |
| | | }) |
| | | }else{ |
| | | console.log('没有找到患者对应的人脸') |
| | | } |
| | | } |
| | | |
| | | } |
| | | }).finally(()=>{ |
| | | // console.log('---------------都要执行的') |
| | | // 删除图片 |
| | | // delImg(path) |
| | | }) |
| | | } |
| | | const faceApiCheck=async(path:any)=>{ |
| | | fs.readFile(path, (err, data) => { |
| | | if (err) throw err; |
| | | let blobFile = new File([data], 'name.png', {type:"image/png"}) |
| | | console.log(blobFile) |
| | | const formData = new FormData() // 下面有备注 |
| | | formData.append('File1', blobFile) |
| | | formData.append('file', blobFile) |
| | | checkUploadFile(formData).then(re=>{ |
| | | console.log('-----') |
| | | console.log('-----',re) |
| | | }).finally(()=>{ |
| | | // 删除图片 |
| | | delImg(path) |
| | | }) |
| | | }) |
| | | |
| | | |
| | | |
| | | } |
| | | // base64z转文件后验证 |
| | | } |
| | | // base64z转文件后验证 |
| | | const base64toFile = (dataurl:any,filename='file') => { |
| | | if (!fs.existsSync('./imgs')) { |
| | | fs.mkdir('./imgs', (err) => { |
| | |
| | | if (err) { |
| | | console.log(err); |
| | | } else { |
| | | |
| | | // console.log('写入成功!验证阿里', path); |
| | | // getOssUrl(path) |
| | | // 验证图片 |
| | | faceShibie(path) |
| | | // faceApiCheck(path) |
| | | // 是否本地识别 |
| | | const isLanFace= confingInfoStore().confingInfo.isLanFace |
| | | if(isLanFace){ |
| | | //本地识别 |
| | | faceApiCheck(path) |
| | | }else{ |
| | | //阿里验证外网 |
| | | faceShibie(path) |
| | | } |
| | | |
| | | |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export { |
| | | yanzhengimg, |
| | | createClient, |
| | | faceShibie, |
| | | base64toFile |
| | |
| | | import { ref } from 'vue' |
| | | export const confingInfoStore =defineStore('confingInfo',()=>{ |
| | | const confingInfo=ref({ |
| | | isLanFace:false, |
| | | screenTimeout: 150, |
| | | isUseFaceRecogService: true, |
| | | deviceType:"血压计", |
| | |
| | | timeJg:10000, |
| | | base_api:"", |
| | | face_push:3, |
| | | imgHeight:200, |
| | | // 播报定时 |
| | | BobaoJg:4, |
| | | beginWorkTime:5, |
| | |
| | | if(info.BobaoJg===undefined){ |
| | | confingInfo.value.BobaoJg=4 |
| | | } |
| | | // |
| | | if(info.isLanFace===undefined){ |
| | | confingInfo.value.isLanFace=true |
| | | } |
| | | } |
| | | return {confingInfo,setconfingInfo} |
| | | }) |
| | |
| | | <img class="image_1" style="margin-left: 20px;display: inline-block;" referrerpolicy="no-referrer" src="@/assets/logo.png" /> |
| | | |
| | | </div> |
| | | <div class="titlecss">自助签到系统</div> |
| | | <div @click="yanzhengTUpian" class="titlecss">自助签到系统</div> |
| | | </div> |
| | | </el-col> |
| | | <el-col v-if="dialogVisible" :span="12" style="text-align: right;padding-top: 10px;"> |
| | |
| | | 返回 |
| | | </div> |
| | | </div> |
| | | <el-dialog |
| | | v-model="centerDialogVisible" |
| | | title="" |
| | | width="40%" |
| | | align-center |
| | | > |
| | | <span> |
| | | <div> |
| | | 找到该程序根目录下imgs/1708401593426.png下路径 把图片名改成一致 就可以测试了, |
| | | </div> |
| | | |
| | | <el-button @click="yanzhengTUpianClick">验证</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | |
| | | </div> |
| | |
| | | import { sendPationCodeApi } from '../../samples/httpApi' |
| | | import { formatDate,jgTime,isworkTime } from '@/utils/formatTime' |
| | | import { confingInfoStore } from '@/stores/StoresConfing' |
| | | import {base64toFile} from '@/samples/faceApi' |
| | | import {base64toFile,yanzhengimg} 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 taiHengM523 } from '@/samples/deviceApi/taiHengM523' |
| | | import{initPort as XK3190A12 } from '@/samples/deviceApi/XK3190A12' |
| | | import {initPort as mbp7000} from '@/samples/deviceApi/mbp7000' |
| | | import {initPort as mbp9020} from '@/samples/deviceApi/mbp-9020' |
| | | import {initPort as rbp9000c} from '@/samples/deviceApi/RBP-9000c' |
| | | |
| | | import {initPort as M503} from '@/samples/deviceApi/M503' |
| | | import {initPort as seca102} from '@/samples/deviceApi/seca102' |
| | | // 引入模块 |
| | | import config from '../../../package.json' |
| | | import { Delete, Download, Plus, ZoomIn } from '@element-plus/icons-vue' |
| | | |
| | | |
| | | // 读取体重文件 |
| | | import{todatatzs } from '@/samples/deviceApi/seca101' |
| | | import {ElMessage } from 'element-plus' |
| | | import {ElMessage, UploadFile, UploadInstance, UploadProps } from 'element-plus' |
| | | const { proxy } = getCurrentInstance() as any; |
| | | // 人脸检测对象 |
| | | const options = new SsdMobilenetv1Options({ |
| | |
| | | const gao_ya=ref("")//高压 |
| | | const di_ya=ref("")//低压 |
| | | const mai_bu=ref("")//脉搏, |
| | | |
| | | const tupianpath=ref('') //验证图片地址 |
| | | const centerDialogVisible=ref(false) |
| | | const uploadRef = ref<UploadInstance>() |
| | | const fileList=ref([]) |
| | | const imageUrl = ref('') |
| | | const dialogImageUrl = ref('') |
| | | // 打开图片验证 |
| | | const yanzhengTUpian=()=>{ |
| | | |
| | | centerDialogVisible.value=true |
| | | } |
| | | //验证图片 |
| | | const yanzhengTUpianClick=()=>{ |
| | | const path = './imgs/1708401593426.png' |
| | | yanzhengimg(path) |
| | | } |
| | | const tzjs=computed(()=>{ |
| | | if(weightInfo.value.result!=='0'&&weightInfo.value.result!==undefined&&weightInfo.value.result!==null){ |
| | | return (patientInfo.value.preWeight-Number(weightInfo.value.result)).toFixed(1) |
| | |
| | | } |
| | | const updateChengxu=()=>{ |
| | | console.log('检查更新') |
| | | ipcRenderer.invoke("check-update"); |
| | | if(configData.value.isLanFace){ |
| | | console.log('是内网不能检查更新') |
| | | }else{ |
| | | ipcRenderer.invoke("check-update"); |
| | | } |
| | | |
| | | } |
| | | onMounted(() => { |
| | | console.log('页面初始化', os.hostname()) |
| | |
| | | TM2655VP(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate) |
| | | }else if(configData.value.xyj_type==='mbp7000'){ |
| | | mbp7000(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate) |
| | | }else if(configData.value.xyj_type==='mbp9020'){ |
| | | mbp9020(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate) |
| | | } |
| | | else if(configData.value.xyj_type==='RBP-9000c'){ |
| | | rbp9000c(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate) |
| | | } |
| | | else{ |
| | | oumulongHbp9030(configData.value.xueyanjiPortPath,configData.value.xueyanjiBaudRate) |
| | |
| | | const resizedResult = resizeResults(result, dims) |
| | | const box = resizedResult.box |
| | | // 不要小头像 |
| | | if(box._height<120) return detectFace() |
| | | console.log('000') |
| | | const h=configData.value.imgHeight===undefined?140:configData.value.imgHeight |
| | | console.log('000',h) |
| | | if(box._height<h) return detectFace() |
| | | //检测框是否在取景框内 |
| | | // if (!checkInViewFinder(box)) return detectFace() |
| | | // drawViewFinder() |
| | |
| | | // console.log(image) |
| | | if(dialogVisible.value&&X>configData.value.face_push&&isworkTime(new Date())){ |
| | | lsDateTime=new Date() |
| | | console.log(X,'上传阿里识别间隔') |
| | | console.log(X,'上传图片间隔') |
| | | base64toFile(image) |
| | | } |
| | | return detectFace() |