diff --git a/node-server/core/AIMedicineTable.js b/node-server/core/AIMedicineTable.js index d55e389..c4065e3 100644 --- a/node-server/core/AIMedicineTable.js +++ b/node-server/core/AIMedicineTable.js @@ -2,6 +2,7 @@ import common from "./common.js"; const app = common.app; const connection = common.connection; const m_get = common.m_get; +const m_add = common.m_add; const nowTime = common.nowTime; const getTable = () => app.post('/getaimedicine', function (req, res) { @@ -14,7 +15,7 @@ const getTable = () => app.post('/getaimedicine', function (req, res) { connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) { if (error) { console.log(`${nowTime()} 错误:${JSON.stringify(error)}`); - connection(database).connect(); + // connection(database).connect(); return res.status(500).send(error); } else { res.send(results); @@ -22,6 +23,24 @@ const getTable = () => app.post('/getaimedicine', function (req, res) { }); }); +const addTable = () => app.post('/addaimedicine', (req, res) => { + const database = req.body.database; + const table = `AIMedicineTable`; + const key = req.body.key; + // `name, region, area, house_type, phone, create_time, remark`; + const values = req.body.value; + // `'${v.name}', '${v.region}', '${v.area}', '${v.house_type}', '${v.phone}', '${nowTime()}', '${remark}'`; + connection(database).query(m_add(table, key, values), function (error, results, fields) { + if (error) { + console.log(`${nowTime()} 错误:${JSON.stringify(error)}`); + return res.status(500).send(error); + } else { + res.send(results); + } + }); +}) + export default { - getTable + getTable, + addTable }; diff --git a/node-server/core/doctorMedicineTable.js b/node-server/core/doctorMedicineTable.js index 751be1d..3797508 100644 --- a/node-server/core/doctorMedicineTable.js +++ b/node-server/core/doctorMedicineTable.js @@ -2,6 +2,7 @@ import common from "./common.js"; const app = common.app; const connection = common.connection; const m_get = common.m_get; +const m_add = common.m_add; const nowTime = common.nowTime; const getTable = () => app.post('/getdoctormedicine', function (req, res) { @@ -14,7 +15,7 @@ const getTable = () => app.post('/getdoctormedicine', function (req, res) { connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) { if (error) { console.log(`${nowTime()} 错误:${JSON.stringify(error)}`); - connection(database).connect(); + // connection(database).connect(); return res.status(500).send(error); } else { res.send(results); @@ -22,6 +23,22 @@ const getTable = () => app.post('/getdoctormedicine', function (req, res) { }); }); +const addTable = () => app.post('/adddoctormedicine', (req, res) => { + const database = req.body.database; + const table = `DoctorMedicineTable`; + const key = req.body.key; + const values = req.body.value; + connection(database).query(m_add(table, key, values), function (error, results, fields) { + if (error) { + console.log(`${nowTime()} 错误:${JSON.stringify(error)}`); + return res.status(500).send(error); + } else { + res.send(results); + } + }); +}) + export default { - getTable + getTable, + addTable }; diff --git a/node-server/core/featureTable.js b/node-server/core/featureTable.js index 254334d..16731a7 100644 --- a/node-server/core/featureTable.js +++ b/node-server/core/featureTable.js @@ -14,7 +14,7 @@ const getTable = () => app.post('/getfeature', function (req, res) { connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) { if (error) { console.log(`${nowTime()} 错误:${JSON.stringify(error)}`); - connection(database).connect(); + // connection(database).connect(); return res.status(500).send(error); } else { res.send(results); diff --git a/node-server/index.js b/node-server/index.js index 1debc3e..e2fb82c 100644 --- a/node-server/index.js +++ b/node-server/index.js @@ -28,6 +28,8 @@ connection().connect(); featureTable.getTable(); AIMedicineTable.getTable(); doctorMedicineTable.getTable(); +AIMedicineTable.addTable(); +doctorMedicineTable.addTable(); // MedicineFeadbackInfoTable // TimingFeadbackInfoTable diff --git a/src/views/remote-manage/remote-manage.vue b/src/views/remote-manage/remote-manage.vue index 880e8fb..4a7ba63 100644 --- a/src/views/remote-manage/remote-manage.vue +++ b/src/views/remote-manage/remote-manage.vue @@ -82,7 +82,8 @@
- + @@ -168,7 +169,7 @@