From 538cd003c2ff88d4beae458cf66c89f52f01f5e3 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期四, 19 十二月 2024 17:04:15 +0800
Subject: [PATCH] gx
---
app.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
public/index.html | 2 +-
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/app.js b/app.js
index eafc44d..9c4656c 100644
--- a/app.js
+++ b/app.js
@@ -116,6 +116,49 @@
res.status(400).json({ retCode: "-1", msg: "Invalid request parameters" });
}
});
+app.post('/webuserPatientId',async(req,res)=>{
+ const mode=req.body
+ logHttps(mode)
+ const patientId = req.query.patientId;
+ if (patientId) {
+ let query = `SELECT * FROM patient_info WHERE code = '${xid}'`
+ try {
+ const [rows] = await pool.promise().query(query);
+ if (rows.length > 0) {
+ const user = rows[0];
+ const response = {
+ retCode: "1",
+ uinfo: {
+ title: user.client_code,
+ cardID: user.code,
+ userNum: user.patient_no,
+ name: user.patient_name,
+ sex: user.patient_gender === 0 ? '男' : '女',
+ age: getAgeFromIdCard(user.patient_identity_no),
+ headimgurl: user.patient_avatar_icon,
+ imgBaseData: '',
+ remark: ''
+ },
+ dbinfo: {}, // 如果没有需要更新的数据库信息,可以保持空
+ msg: "success"
+ };
+ res.json(response);
+ } else {
+ const response = {
+ retCode: "0",
+ msg: "没有找到患者,请先检查患者code"
+ };
+ res.json(response);
+ }
+ } catch (err) {
+ console.error(err);
+ res.status(500).json({ retCode: "-1", msg: "Database error" });
+ }
+ } else {
+ // 如果请求参数不符合预期,则返回错误信息
+ res.status(400).json({ retCode: "-1", msg: "Invalid request parameters" });
+ }
+})
// 定义人脸识别 用base64图片文件换患者信息
app.post('/faceuser', async (req, res) => {
@@ -237,8 +280,9 @@
*/
app.get('/getpatientInfo',async(req,res)=>{
// 使用req.query访问查询字符串参数
- const patientId = req.query.patientid;
+ const patientId = req.query.patientId;
const mode={"action":'getpatientInfo',"patientId":patientId}
+ console.log(patientId,'-----------------')
logHttps(mode)
if(patientId){
// 输出传入的patientid值
@@ -284,7 +328,7 @@
}else{
// 如果请求参数不符合预期,则返回错误信息
- res.status(400).json({ retCode: "-1", msg: "Invalid request parameters" });
+ res.status(400).json({ retCode: "-1", msg: "Invalid request parameters333" });
}
diff --git a/public/index.html b/public/index.html
index 666635f..9dbaad1 100644
--- a/public/index.html
+++ b/public/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>聊天机器人</title>
+ <title>聊天机器人11</title>
<style>
body, html {
margin: 0;
--
Gitblit v1.8.0