From ef98fd01a5fd839e041f49b1c6e09f77ba00c9c4 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期日, 22 十二月 2024 12:29:18 +0800
Subject: [PATCH] 45
---
app.js | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/app.js b/app.js
index eafc44d..42e03c7 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值
@@ -249,12 +293,12 @@
if (rows.length > 0) {
const user = rows[0];
const response = {
- code: "1",
result:[ {
patientId: user.code,
- fullName: user.patient_name,
+ name: user.patient_name,
gender: user.patient_gender,
age: getAgeFromIdCard(user.patient_identity_no),
+ birthday:'',
phoneNum:user.patient_mobile,
address: user.patient_avatar_icon,
idType: user.patient_identity_type,
@@ -267,7 +311,6 @@
examDept:"",
diagnosisDoctor:''
}],
- msg: "success"
};
res.json(response);
} else {
@@ -284,7 +327,7 @@
}else{
// 如果请求参数不符合预期,则返回错误信息
- res.status(400).json({ retCode: "-1", msg: "Invalid request parameters" });
+ res.status(400).json({ retCode: "-1", msg: "Invalid request parameters333" });
}
@@ -294,11 +337,12 @@
* PostCheckExam 病人信息及检测结果以JSON的形式回传至服务器
*/
app.post('/PostCheckExam',async(req,res)=>{
- const mode=req.body
+ // 查看body参数
+ const body=req.body
+
if(mode){
logHttps(mode)
}else{
- mode.action='hahhaha'
logHttps(mode)
}
res.status(400).json({ retCode: "-1", msg: "kankan" });
--
Gitblit v1.8.0