| | |
| | | |
| | | 人体分析仪接口 |
| | | |
| | | 患者验证接口 |
| | | 患者验证接口 /webuser |
| | | / |
| | | { |
| | | "action": "doWebUser", |
| | | "deviceID": "888888", |
| | |
| | | "xid": "PAT2204031316230148" |
| | | } |
| | | |
| | | 人脸识别验证 |
| | | 人脸识别验证 /faceuser |
| | | { |
| | | "action": "doFace", |
| | | "deviceID": "888888", |
| | |
| | | ## 启动开发环境 |
| | | "dev": "nodemon app.js", |
| | | ## 打包 |
| | | "build": "ncc build app.js -o dist", |
| | | "build": "ncc build app.js -o dist", 端口号 3000 |
| | | ## 运行生产环境 |
| | | "dev:prod":"node dist/index.js" |
| | |
| | | const mysql = require('mysql2'); |
| | | const fs = require('fs').promises; |
| | | const path = require('path'); |
| | | const moment = require('moment') |
| | | // 转成能识别的url |
| | | const ViapiUtil = require('@alicloud/viapi-utils'); |
| | | |
| | | const facebody20191230 = require('@alicloud/facebody20191230'); |
| | | const OpenApi = require('@alicloud/openapi-client'); |
| | | const Util = require('@alicloud/tea-util'); |
| | | const Tea = require('@alicloud/tea-typescript'); |
| | | |
| | | const app = express(); |
| | | const port = 3000; |
| | |
| | | |
| | | |
| | | }) |
| | | // 定义设备数据回传接口 |
| | | // 定义数据回传接口 |
| | | app.post('/webResults',async (req, res) =>{ |
| | | const action = req.body.action; |
| | | const deviceID = req.body.deviceID; |
| | | const mode=req.body |
| | | logHttps(mode) |
| | | try { |
| | | const datas=mode.datas |
| | | datas.forEach(async element => { |
| | | await installData(element) |
| | | }); |
| | | response = { |
| | | retCode: "1", |
| | | msg: "成功" |
| | | }; |
| | | res.json(response) |
| | | |
| | | }catch(err){ |
| | | res.status(400).json({ retCode: "-1", msg: "Invalid request parameters" }); |
| | | } |
| | | |
| | | }) |
| | | // 启动服务器 |
| | | app.listen(port, async () => { |
| | | console.log(`Server running at http://localhost:${port}/`); |
| | |
| | | let sqlStr=`INSERT INTO system_log (id, code, url, parameter) VALUES (0, '', '${mode.action}', '${JSON.stringify(mode)}')` |
| | | pool.promise().query(sqlStr) |
| | | } |
| | | // 插入数据 |
| | | const installData=async (mode)=>{ |
| | | try{ |
| | | let sqlStr=`INSERT INTO patient_rtcf_result (id, code, patient_code,`+ |
| | | `comm_time,rtcf_json_bmi,`+ |
| | | `rtcf_json_bp,`+ |
| | | `rtcf_json_bf,`+ |
| | | `rtcf_json_temp,`+ |
| | | `rtcf_json_bo,`+ |
| | | `rtcf_json_bs,`+ |
| | | `rtcf_json_whr,`+ |
| | | `rtcf_json_ncg,`+ |
| | | `rtcf_json_zytz,`+ |
| | | `rtcf_json_ecg,`+ |
| | | `rtcf_json_xzsx,`+ |
| | | `rtcf_json_eye,`+ |
| | | `rtcf_json_sds,`+ |
| | | `rtcf_json_txhxdb,`+ |
| | | `rtcf_json_fei,`+ |
| | | `rtcf_jiu,`+ |
| | | `rtcf_gmd)`+ |
| | | `VALUES (0, '', '${mode.UID}', '${moment(new Date()).format('YYYY-MM-DD HH:mm:ss')}','${JSON.stringify(mode.BMI)}',`+ |
| | | `'${JSON.stringify(mode.BP)}','${JSON.stringify(mode.BF)}','${JSON.stringify(mode.temp)}','${JSON.stringify(mode.bo)}',`+ |
| | | `'${JSON.stringify(mode.bs)}','${JSON.stringify(mode.whr)}','${JSON.stringify(mode.ncg)}','${JSON.stringify(mode.zytz)}',`+ |
| | | `'${JSON.stringify(mode.ecg)}','${JSON.stringify(mode.xzsx)}','${JSON.stringify(mode.eye)}',`+ |
| | | `'${JSON.stringify(mode.sds)}','${JSON.stringify(mode.thxhdb)}','${JSON.stringify(mode.fei)}','${JSON.stringify(mode.jiu)}','${JSON.stringify(mode.gmd)}')` |
| | | |
| | | console.log('-------------------') |
| | | console.log(sqlStr) |
| | | await pool.promise().query(sqlStr) |
| | | }catch(err){ |
| | | console.log('数据写入异常') |
| | | } |
| | | } |
| | |
| | | "@alicloud/viapi-utils": "^1.0.0", |
| | | "body-parser": "^1.20.3", |
| | | "express": "^4.21.1", |
| | | "moment": "^2.30.1", |
| | | "mysql2": "^3.11.3", |
| | | "pkg": "^5.8.1" |
| | | }, |