| | |
| | | const fs = require('fs').promises; |
| | | const fs2=require('fs') |
| | | const path = require('path'); |
| | | const moment = require('moment') |
| | | const logger = require('./logger'); // 根据实际情况调整路径 |
| | | const axios = require('axios'); |
| | | // 转成能识别的url |
| | | const ViapiUtil = require('@alicloud/viapi-utils'); |
| | |
| | | }); |
| | | app.get('/test', async (req, res) => { |
| | | const token=await thirdPartyApi.getAccessToken() |
| | | logger.info('返回token=='+JSON.stringify(token)) |
| | | res.json(token); |
| | | }); |
| | | // 定义 /webuser 路由处理器 用患者code 换信息 |
| | |
| | | const deviceID = req.body.deviceID; |
| | | const type = req.body.type; |
| | | const xid = req.body.xid; |
| | | console.log(`action=${action},deviceID=${deviceID},type=${type},xid=${xid}`) |
| | | console.log() |
| | | logger.info(`req body action=${action},deviceID=${deviceID},type=${type},xid=${xid}`) |
| | | if (action === 'doWebUser' && deviceID && type !== undefined) { |
| | | try { |
| | | const pathParams={code:xid} |
| | | const data = await thirdPartyApi.fetchThirdPartyData('/patient/info/detail2', 'POST', {}, null, pathParams,{}); |
| | | console.log('--------------获取到了患者信息',data.data) |
| | | logger.info(`get patInfo data=${JSON.stringify(data)}`) |
| | | console.log('get patInfo ----',data.data) |
| | | // console.log(data) |
| | | if(data?.code===200&&data?.message==='SUCCESS'&&data?.data){ |
| | | const user = data.data; |
| | |
| | | }, |
| | | remsg: "success" |
| | | }; |
| | | console.log('返回患者信息成功') |
| | | logger.info('Successfully returned patient information') |
| | | console.log('Successfully returned patient information') |
| | | }else{ |
| | | response = { |
| | | retcode: 1001, |
| | |
| | | |
| | | } catch (err) { |
| | | console.error(err); |
| | | logger.error(err) |
| | | res.status(500).json({ retCode: "-1", msg: err }); |
| | | } |
| | | } else { |