From 6022cfd5cd15b8917ccfd5a635cd49ba47f14ce1 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期四, 24 七月 2025 15:43:02 +0800
Subject: [PATCH] gx大连INBODY人体成分分析仪
---
app.js | 85 ++++++++++++++
thirdPartyApi.js | 6
logs/app.log | 217 ++++++++++++++++++++++++++++++++++++
3 files changed, 306 insertions(+), 2 deletions(-)
diff --git a/app.js b/app.js
index 7ce52c2..397b688 100644
--- a/app.js
+++ b/app.js
@@ -13,6 +13,7 @@
const thirdPartyApi = require(path.resolve(__dirname, 'thirdPartyApi'));
const app = express();
+app.use(bodyParser.json())
const port = 3000;
// 设置 JSON 请求体的最大大小为 5MB
@@ -414,6 +415,77 @@
})
+// 假设这里有一个模拟的用户数据存储
+const usersData = [
+ {
+ USER_ID: 'test1',
+ USER_NAME: 'name1',
+ USER_GENDER: 'M',
+ USER_BIRTHDAY: '19821201',
+ USER_AGE: '36',
+ USER_HEIGHT: '178.5',
+ ORDER_DATE: '20191025'
+ }
+];
+// 大连新的InBody 人体成分分析仪患者注册
+app.post('/getuserinfo',async (req, res) => {
+ logger.info(`人体成分分析仪患者注册请求body=${JSON.stringify(req.body)}`)
+ // 从请求体中获取用户信息
+ // 这里假设请求体包含 USER_ID 和 ORDER_DATE 字段
+ const { USER_ID, ORDER_DATE } = req.body;
+ // 检查请求参数是否有效
+ if (!USER_ID || !ORDER_DATE) {
+ return res.status(400).json({
+ IsResult: false,
+ INBODY_USER_INFO: [],
+ ErrorMsg: 'USER_ID or ORDER_DATE is missing'
+ });
+ }
+ // 在模拟数据中查找匹配的用户信息
+ const userInfo = usersData.find(user => user.USER_ID === USER_ID && user.ORDER_DATE === ORDER_DATE);
+ const pathParams = { clientCode:'CLIENT9195181802236kHJF',patientHemoCode:USER_ID}
+ const data = await thirdPartyApi.fetchThirdPartyData('/patient/info/queryInAndOuts', 'POST', {}, null, {},pathParams);
+ console.log('查询InAndOuts数据',data)
+ if(data.code===200&&data?.message==='SUCCESS'&&data?.data){
+ const list= data.data.list;
+ if(list.length>0){
+
+ console.log(list[0])
+ const mode=list[0]
+ const user={
+ USER_ID: mode.code,
+ USER_NAME: mode.patientName,
+ USER_GENDER: mode.patientGender===0? 'M':'F',
+ USER_BIRTHDAY: '',
+ USER_AGE: mode.age,
+ USER_HEIGHT: mode.patientHeight,
+ ORDER_DATE: getCurrentDateFormatted()
+ }
+ res.json({
+ IsResult: true,
+ INBODY_USER_INFO: [user],
+ ErrorMsg: ''
+ });
+
+ logger.info(`请求患者成功:${mode.patientName}`)
+ }
+ else{
+ res.json({
+ IsResult: false,
+ INBODY_USER_INFO: [],
+ ErrorMsg: 'User not found'
+ });
+ logger.info(`请求患者失败:没有找到用户`)
+ }
+ }else{
+ res.json({
+ IsResult: false,
+ INBODY_USER_INFO: [],
+ ErrorMsg: 'User not found'
+ });
+ logger.info(`请求患者失败:没有找到用户`)
+ }
+})
// 启动服务器
app.listen(port, async () => {
@@ -531,4 +603,15 @@
}
-}
\ No newline at end of file
+}
+function getCurrentDateFormatted() {
+ const date = new Date();
+
+ const year = date.getFullYear(); // 获取年份,如 2025
+
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份(0-11),需要 +1,然后补零
+
+ const day = String(date.getDate()).padStart(2, '0'); // 获取日期,并补零
+
+ return `${year}${month}${day}`;
+}
diff --git a/logs/app.log b/logs/app.log
index 2a7f639..fc566e1 100644
--- a/logs/app.log
+++ b/logs/app.log
@@ -95,3 +95,220 @@
{"level":30,"time":1736256023442,"pid":8440,"hostname":"dachengzhi","msg":"血流量设备上报结果,请求信息clientCode=CLIENT9326174148672wykR"}
{"level":30,"time":1736256023448,"pid":8440,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/result/from/doppler/blood/flow/device/saveData,data={\"id\":0,\"code\":\"\",\"patient_code\":\"PAT2204031316230148\",\"client_code\":\"CLIENT9326174148672wykR\",\"exam_id\":\"33333333444\",\"SBPLB\":471,\"MBPLB\":-1,\"DBPLB\":-1,\"PPLB\":-1,\"SBPRB\":136,\"MBPRB\":-1,\"DBPRB\":-1,\"PPRB\":-1,\"SBPLA\":187,\"MBPLA\":-1,\"DBPLA\":-1,\"SBPRA\":151,\"MBPRA\":-1,\"DBPRA\":-1,\"ABIL\":1.2721088,\"ABIR\":1.2857143,\"BAIL\":0.7777778,\"BAIR\":0.7195767,\"PWVL\":-1,\"PWVR\":-1,\"TBIL\":-1,\"TBIR\":-1,\"SBPLAPTA\":97,\"DBPLAPTA\":-1,\"MBPLAPTA\":-1,\"PPLAPTA\":-1,\"SBPRAPTA\":189,\"DBPRAPTA\":-1,\"MBPRAPTA\":-1,\"PPRAPTA\":-1,\"SBPLAFA\":187,\"DBPLAFA\":-1,\"MBPLAFA\":-1,\"PPLAFA\":-1,\"SBPRAFA\":151,\"DBPRAFA\":-1,\"MBPRAFA\":-1,\"PPRAFA\":-1,\"index_LB\":1,\"index_RB\":0.92517006,\"index_LAPTA\":0.65986395,\"index_RAPTA\":1.2857143,\"index_LAFA\":1.2721088,\"index_RAFA\":1.0272108,\"image\":\"\",\"request_doctor\":\"李医生\",\"request_department\":\"申请科室\",\"request_date\":\"2024-12-20 00:00:00\",\"exam_department\":\"检查科室\",\"diagnostician_doctor\":\"谢医生\",\"check_date\":\"2024-12-20 00:00:00\",\"check_result\":\"左侧上肢血压偏高;右侧上肢血压未见异常;双侧上肢血压无明显差异;\\n左侧下肢胫后ABI低于正常值;右侧下肢胫后ABI在正常范围;\\n双侧下肢足背ABI在正常范围。\",\"diagnosis\":\"双侧下肢静态ABI未见异常。\\n\",\"exam_type_id\":\"001\",\"exam_type_name\":\"外周动脉阻塞检查\",\"operator_doctor\":\"1111111\",\"abi_advice\":\"本次检查结果未见异常。\",\"pwv_result\":\"\"}"}
{"level":30,"time":1736256023722,"pid":8440,"hostname":"dachengzhi","msg":"血流量设备上报结果,请求成功"}
+{"level":30,"time":1753260234052,"pid":26104,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753260435467,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=undefined,clintCode=undefined"}
+{"level":30,"time":1753260463614,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=undefined,clintCode=undefined"}
+{"level":30,"time":1753260488903,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=undefined,clintCode=211221102200228702"}
+{"level":30,"time":1753260490133,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=undefined,clintCode=211221102200228702"}
+{"level":30,"time":1753260496321,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=undefined,clintCode=211221102200228702"}
+{"level":30,"time":1753260508001,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=undefined,clintCode=211221102200228702"}
+{"level":30,"time":1753260623634,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=PAT9132105702480rHaq,clintCode=211221102200228702"}
+{"level":30,"time":1753260623634,"pid":26104,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/listPatsPublic,data=null"}
+{"level":30,"time":1753260623855,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求成功返回患者信息=[{\"patientId\":\"PAT9132105702480rHaq\",\"fullName\":\"小小黑\",\"gender\":0,\"age\":35,\"birthday\":\"\",\"phoneNum\":\"\",\"address\":\"https://dhcdn.leon056.com/hemo/favicon.svg\",\"idType\":0,\"idNum\":\"410923199001041234\",\"height\":\"\",\"weight\":\"\",\"requestDoctor\":\"\",\"requestDept\":\"\",\"examDoctor\":\"\",\"examDept\":\"\",\"diagnosisDoctor\":\"\"}]"}
+{"level":30,"time":1753260642455,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=6463,clintCode=211221102200228702"}
+{"level":30,"time":1753260642455,"pid":26104,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/listPatsPublic,data=null"}
+{"level":30,"time":1753260642665,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求成功返回患者信息=[]"}
+{"level":30,"time":1753260701146,"pid":26104,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=410923199001041234,clintCode=211221102200228702"}
+{"level":30,"time":1753260701147,"pid":26104,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/listPatsPublic,data=null"}
+{"level":30,"time":1753260769243,"pid":22664,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753260772056,"pid":22664,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=22,clintCode=211221102200228702"}
+{"level":30,"time":1753260772057,"pid":22664,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/listPatsPublic,data=null"}
+{"level":30,"time":1753260772249,"pid":22664,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求成功返回患者信息=[{\"patientId\":\"PAT9243094455474RnPN\",\"fullName\":\"222\",\"gender\":1,\"age\":null,\"birthday\":\"\",\"phoneNum\":\"\",\"address\":\"https://dhcdn.leon056.com/hemo/favicon.svg\",\"idType\":0,\"idNum\":\"123123123\",\"height\":\"\",\"weight\":\"\",\"requestDoctor\":\"\",\"requestDept\":\"\",\"examDoctor\":\"\",\"examDept\":\"\",\"diagnosisDoctor\":\"\"},{\"patientId\":\"PAT9251131750336ZZNd\",\"fullName\":\"测试患者122\",\"gender\":0,\"age\":25,\"birthday\":\"\",\"phoneNum\":\"\",\"address\":\"https://dhcdn.leon056.com/hemo/favicon.svg\",\"idType\":0,\"idNum\":\"411381199909172238\",\"height\":\"\",\"weight\":\"\",\"requestDoctor\":\"\",\"requestDept\":\"\",\"examDoctor\":\"\",\"examDept\":\"\",\"diagnosisDoctor\":\"\"}]"}
+{"level":30,"time":1753260800562,"pid":22664,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=PAT9251131750336ZZNd,clintCode=211221102200228702"}
+{"level":30,"time":1753260800562,"pid":22664,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/listPatsPublic,data=null"}
+{"level":30,"time":1753260800704,"pid":22664,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求成功返回患者信息=[{\"patientId\":\"PAT9251131750336ZZNd\",\"fullName\":\"测试患者122\",\"gender\":0,\"age\":25,\"birthday\":\"\",\"phoneNum\":\"\",\"address\":\"https://dhcdn.leon056.com/hemo/favicon.svg\",\"idType\":0,\"idNum\":\"411381199909172238\",\"height\":\"\",\"weight\":\"\",\"requestDoctor\":\"\",\"requestDept\":\"\",\"examDoctor\":\"\",\"examDept\":\"\",\"diagnosisDoctor\":\"\"}]"}
+{"level":30,"time":1753260933615,"pid":22664,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=6463,clintCode=211221102200228702"}
+{"level":30,"time":1753260933615,"pid":22664,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/listPatsPublic,data=null"}
+{"level":30,"time":1753260933766,"pid":22664,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求成功返回患者信息=[]"}
+{"level":30,"time":1753260963712,"pid":22664,"hostname":"dachengzhi","msg":"血流量设备请求患者信息,请求参数=6458,clintCode=211221102200228702"}
+{"level":30,"time":1753260963712,"pid":22664,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/listPatsPublic,data=null"}
+{"level":30,"time":1753264895514,"pid":29316,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264897728,"pid":16376,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264900372,"pid":17680,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264928067,"pid":39408,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264931417,"pid":19756,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264943376,"pid":18256,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264961170,"pid":14724,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264973933,"pid":19216,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264976422,"pid":7916,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264978067,"pid":29924,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264992681,"pid":29832,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753264994694,"pid":39972,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265076194,"pid":16132,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265142089,"pid":3960,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265143919,"pid":28748,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265146042,"pid":28676,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265222785,"pid":38176,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265229653,"pid":39848,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265232658,"pid":11256,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265233955,"pid":16688,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265257601,"pid":25580,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265259239,"pid":13992,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265268051,"pid":39580,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265272084,"pid":32712,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753265276365,"pid":20616,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327506251,"pid":41404,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327524806,"pid":29208,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327533799,"pid":11972,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327553423,"pid":39188,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327560742,"pid":7188,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327562402,"pid":39932,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327567771,"pid":22684,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327570912,"pid":40248,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327606395,"pid":43764,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327608016,"pid":1972,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327611163,"pid":42592,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327617948,"pid":31252,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327619901,"pid":29840,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753327624560,"pid":39852,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329651509,"pid":16844,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329653223,"pid":17228,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329656583,"pid":24488,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329658640,"pid":7928,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329660772,"pid":2840,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329664254,"pid":43076,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329668328,"pid":43076,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753329668328,"pid":43076,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753329668578,"pid":43076,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753329760516,"pid":31980,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329761838,"pid":17080,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329765011,"pid":17080,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753329765011,"pid":17080,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753329765257,"pid":17080,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753329903995,"pid":33328,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329907044,"pid":43572,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329910037,"pid":34288,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753329998987,"pid":34288,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753329998987,"pid":34288,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753329999225,"pid":34288,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753330078284,"pid":5752,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330090557,"pid":24584,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330091703,"pid":35512,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330093037,"pid":19452,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330099503,"pid":19452,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753330099503,"pid":19452,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753330099720,"pid":19452,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753330318577,"pid":43192,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330320168,"pid":29212,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330334670,"pid":15508,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330336092,"pid":43468,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330339231,"pid":37840,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330345358,"pid":9596,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330349271,"pid":43448,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753330351133,"pid":26616,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753339835325,"pid":41788,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753339839414,"pid":41788,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753339839414,"pid":41788,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753339839639,"pid":41788,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753340010707,"pid":22532,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340020002,"pid":19136,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340032176,"pid":13412,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340033303,"pid":34548,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340035252,"pid":42088,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340086665,"pid":42088,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753340086665,"pid":42088,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753340086935,"pid":42088,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753340140834,"pid":35796,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340147000,"pid":41228,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340156615,"pid":12548,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340159832,"pid":6652,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340162339,"pid":16848,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340165712,"pid":16848,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753340165712,"pid":16848,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753340165973,"pid":16848,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753340197764,"pid":42640,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340219419,"pid":7360,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340221913,"pid":12724,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340302212,"pid":12724,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753340302212,"pid":12724,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753340302445,"pid":12724,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753340313968,"pid":25516,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340315751,"pid":29100,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340319837,"pid":31876,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340344046,"pid":43616,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340345290,"pid":43560,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340369765,"pid":5104,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340389825,"pid":6428,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340398325,"pid":42456,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340402492,"pid":39948,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340408715,"pid":11348,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340418956,"pid":40472,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340425997,"pid":42160,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340428312,"pid":18308,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340467079,"pid":18896,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340470817,"pid":33372,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340480417,"pid":6600,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340481006,"pid":42956,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340488154,"pid":11820,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340492517,"pid":11820,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753340492517,"pid":11820,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753340492782,"pid":11820,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753340516458,"pid":16092,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340525350,"pid":19476,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340544851,"pid":42604,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340546981,"pid":14036,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340549086,"pid":17228,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340554683,"pid":17228,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753340554683,"pid":17228,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753340554900,"pid":17228,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753340577921,"pid":35760,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340613269,"pid":43300,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340615252,"pid":18596,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340616608,"pid":39964,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340618141,"pid":20724,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340642420,"pid":18660,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340646554,"pid":32916,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340654000,"pid":22316,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340656491,"pid":20936,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340677191,"pid":10640,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340690289,"pid":10488,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340700725,"pid":35956,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340707118,"pid":31964,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340710339,"pid":11544,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340718031,"pid":33204,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340720243,"pid":16052,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340729609,"pid":15688,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340780559,"pid":37188,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340828485,"pid":11376,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340835663,"pid":7096,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340890843,"pid":33940,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753340898676,"pid":39888,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342544735,"pid":39888,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753342544735,"pid":39888,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753342545003,"pid":39888,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753342566541,"pid":39888,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753342566541,"pid":39888,"hostname":"dachengzhi","msg":"有缓存token,直接输出"}
+{"level":30,"time":1753342566541,"pid":39888,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753342595036,"pid":25064,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342609235,"pid":17548,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342615782,"pid":26832,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342686584,"pid":42972,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342687940,"pid":42492,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342697241,"pid":17452,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342709332,"pid":7604,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342710905,"pid":28768,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342711863,"pid":11896,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342716000,"pid":25960,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342717055,"pid":31436,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342721398,"pid":31436,"hostname":"dachengzhi","msg":"获取缓存或新的 Token"}
+{"level":30,"time":1753342721398,"pid":31436,"hostname":"dachengzhi","msg":"如果 token 已经过期或不存在,则重新获取"}
+{"level":30,"time":1753342721637,"pid":31436,"hostname":"dachengzhi","msg":"打包token 请求头urlhttps://hemobs.icoldchain.cn//patient/info/queryInAndOuts,data=null"}
+{"level":30,"time":1753342731856,"pid":14532,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342744256,"pid":42032,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342754504,"pid":6148,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342756195,"pid":36012,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342758760,"pid":42772,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342761215,"pid":32752,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342764514,"pid":9248,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342771743,"pid":7412,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342773710,"pid":42640,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342783226,"pid":8248,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342793565,"pid":20992,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342795994,"pid":37252,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342800000,"pid":5540,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342805314,"pid":22168,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342806923,"pid":39304,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342810689,"pid":29244,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342813059,"pid":13548,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342814214,"pid":34824,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
+{"level":30,"time":1753342815310,"pid":37284,"hostname":"dachengzhi","msg":"Server running at http://localhost:3000/"}
diff --git a/thirdPartyApi.js b/thirdPartyApi.js
index 112e0fe..e8e7b7d 100644
--- a/thirdPartyApi.js
+++ b/thirdPartyApi.js
@@ -44,6 +44,7 @@
const { data, expires_in } = await getAccessToken();
cachedToken = data;
tokenExpiresAt = Date.now() + (expires_in - 60) * 1000; // 提前 60 秒刷新 token
+ console.log(`获取新的 token: ${cachedToken}, 过期时间: ${new Date(tokenExpiresAt)}`);
return cachedToken;
}
@@ -81,9 +82,12 @@
// 发起第三方 API 请求
async function fetchThirdPartyData(url, method = 'GET', headers = {}, data = null, queryParams = {}, pathParams = {}) {
try {
+ console.log(`打包token 请求头url${url},data=${JSON.stringify(data)}`)
+ console.log(`pathParams 请求头url${JSON.stringify(pathParams)}`)
const token = await getCachedOrNewToken();
const fullUrl = buildUrl(url, pathParams);
logger.info(`打包token 请求头url${fullUrl},data=${JSON.stringify(data)}`)
+
const response = await axios({
url: fullUrl,
method,
@@ -92,7 +96,7 @@
Authorization: `Bearer ${token}`
},
params: queryParams, // 查询字符串参数
- data // 请求体参数
+ data:pathParams // 请求体参数
});
return response.data;
--
Gitblit v1.8.0