mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 13:04:57 +08:00
添加药品速度insert接口
This commit is contained in:
parent
d1be1673d9
commit
3436ef912d
|
@ -2,6 +2,7 @@ import common from "./common.js";
|
||||||
const app = common.app;
|
const app = common.app;
|
||||||
const connection = common.connection;
|
const connection = common.connection;
|
||||||
const m_get = common.m_get;
|
const m_get = common.m_get;
|
||||||
|
const m_add = common.m_add;
|
||||||
const nowTime = common.nowTime;
|
const nowTime = common.nowTime;
|
||||||
|
|
||||||
const getTable = () => app.post('/getaimedicine', function (req, res) {
|
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) {
|
connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
||||||
connection(database).connect();
|
// connection(database).connect();
|
||||||
return res.status(500).send(error);
|
return res.status(500).send(error);
|
||||||
} else {
|
} else {
|
||||||
res.send(results);
|
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 {
|
export default {
|
||||||
getTable
|
getTable,
|
||||||
|
addTable
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ import common from "./common.js";
|
||||||
const app = common.app;
|
const app = common.app;
|
||||||
const connection = common.connection;
|
const connection = common.connection;
|
||||||
const m_get = common.m_get;
|
const m_get = common.m_get;
|
||||||
|
const m_add = common.m_add;
|
||||||
const nowTime = common.nowTime;
|
const nowTime = common.nowTime;
|
||||||
|
|
||||||
const getTable = () => app.post('/getdoctormedicine', function (req, res) {
|
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) {
|
connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
||||||
connection(database).connect();
|
// connection(database).connect();
|
||||||
return res.status(500).send(error);
|
return res.status(500).send(error);
|
||||||
} else {
|
} else {
|
||||||
res.send(results);
|
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 {
|
export default {
|
||||||
getTable
|
getTable,
|
||||||
|
addTable
|
||||||
};
|
};
|
||||||
|
|
|
@ -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) {
|
connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
||||||
connection(database).connect();
|
// connection(database).connect();
|
||||||
return res.status(500).send(error);
|
return res.status(500).send(error);
|
||||||
} else {
|
} else {
|
||||||
res.send(results);
|
res.send(results);
|
||||||
|
|
|
@ -28,6 +28,8 @@ connection().connect();
|
||||||
featureTable.getTable();
|
featureTable.getTable();
|
||||||
AIMedicineTable.getTable();
|
AIMedicineTable.getTable();
|
||||||
doctorMedicineTable.getTable();
|
doctorMedicineTable.getTable();
|
||||||
|
AIMedicineTable.addTable();
|
||||||
|
doctorMedicineTable.addTable();
|
||||||
|
|
||||||
// MedicineFeadbackInfoTable
|
// MedicineFeadbackInfoTable
|
||||||
// TimingFeadbackInfoTable
|
// TimingFeadbackInfoTable
|
||||||
|
|
|
@ -82,7 +82,8 @@
|
||||||
<div class="right-box">
|
<div class="right-box">
|
||||||
<div class="top-btn-box">
|
<div class="top-btn-box">
|
||||||
<div class="top-left-btn-box">
|
<div class="top-left-btn-box">
|
||||||
<el-select v-model="database" filterable placeholder="Select" style="width: 100%;" @change="selectDatabase">
|
<el-select v-model="database" filterable placeholder="Select" style="width: 100%;"
|
||||||
|
@change="selectDatabase">
|
||||||
<el-option v-for="item in databaseOptions" :key="item.value" :label="item.label"
|
<el-option v-for="item in databaseOptions" :key="item.value" :label="item.label"
|
||||||
:value="item.value" />
|
:value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -168,7 +169,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, reactive } from 'vue';
|
import { onMounted, ref, reactive } from 'vue';
|
||||||
import { ElMessageBox } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
import { dateFormater } from './date-util';
|
import { dateFormater } from './date-util';
|
||||||
import { post } from "@/axios/index";
|
import { post } from "@/axios/index";
|
||||||
import chartLine from './chart-line.vue';
|
import chartLine from './chart-line.vue';
|
||||||
|
@ -191,15 +192,15 @@ const databaseOptions: { value: string, label: string }[] = [
|
||||||
{ value: '数据模拟20231109185403', label: '模拟数据库' }
|
{ value: '数据模拟20231109185403', label: '模拟数据库' }
|
||||||
];
|
];
|
||||||
const medicineCustom: any[] = [
|
const medicineCustom: any[] = [
|
||||||
{ name: '丙泊酚', plus: 0.5 },
|
{ name: '丙泊酚', plus: 0.5, total: 50 },
|
||||||
{ name: '舒芬太尼', plus: 1 },
|
{ name: '舒芬太尼', plus: 1, total: 100 },
|
||||||
{ name: '瑞芬太尼', plus: 0.05 },
|
{ name: '瑞芬太尼', plus: 0.05, total: 5 },
|
||||||
{ name: '顺阿曲库胺', plus: 0.02 },
|
{ name: '顺阿曲库胺', plus: 0.02, total: 2 },
|
||||||
{ name: '尼卡地平', plus: 1 },
|
{ name: '尼卡地平', plus: 1, total: 100 },
|
||||||
{ name: '艾司洛尔', plus: 1 },
|
{ name: '艾司洛尔', plus: 1, total: 100 },
|
||||||
{ name: '麻黄素', plus: 1 },
|
{ name: '麻黄素', plus: 1, total: 100 },
|
||||||
{ name: '阿托品', plus: 1 },
|
{ name: '阿托品', plus: 1, total: 100 },
|
||||||
{ name: '罗库溴铵', plus: 0.1 }
|
{ name: '罗库溴铵', plus: 0.1, total: 10 }
|
||||||
];
|
];
|
||||||
const database = ref('数据模拟20231109185403');
|
const database = ref('数据模拟20231109185403');
|
||||||
const messageSum = ref(10);
|
const messageSum = ref(10);
|
||||||
|
@ -336,13 +337,13 @@ function getTableData(e: boolean) {
|
||||||
for (let key in res.data[0]) {
|
for (let key in res.data[0]) {
|
||||||
if (key !== 'ID' && key !== 'Phase' && key !== 'Time' && key !== 'TIME') {
|
if (key !== 'ID' && key !== 'Phase' && key !== 'Time' && key !== 'TIME') {
|
||||||
i++;
|
i++;
|
||||||
tableData.value.push({ num: i, name: key, speed: res.data[0][key], total: Number(res.data[0][key]), state: '正常' });
|
tableData.value.push({ Phase: res.data[0].Phase, num: i, name: key, speed: res.data[0][key], total: medicineCustom.find(o => o.name === key)?.total, state: '正常' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const defaultMedicine: string[] = ['丙泊酚', '舒芬太尼', '瑞芬太尼', '顺阿曲库胺', '尼卡地平', '艾司洛尔', '麻黄素', '阿托品'];
|
const defaultMedicine: string[] = ['丙泊酚', '舒芬太尼', '瑞芬太尼', '顺阿曲库胺', '尼卡地平', '艾司洛尔', '麻黄素', '阿托品'];
|
||||||
defaultMedicine.forEach((item, index) => {
|
defaultMedicine.forEach((item, index) => {
|
||||||
tableData.value.push({ num: index + 1, name: item, speed: 0, total: 0, state: '正常' });
|
tableData.value.push({ Phase: 1, num: index + 1, name: item, speed: 0, total: medicineCustom.find(o => o.name === item)?.total, state: '正常' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
tableDataStore.value = JSON.parse(JSON.stringify(tableData.value));
|
tableDataStore.value = JSON.parse(JSON.stringify(tableData.value));
|
||||||
|
@ -417,6 +418,27 @@ const tableItemMinus = (e: any) => {
|
||||||
};
|
};
|
||||||
const tableItemConfirm = (e: any) => {
|
const tableItemConfirm = (e: any) => {
|
||||||
tableDataStore.value[e.$index].speed = e.row.speed;
|
tableDataStore.value[e.$index].speed = e.row.speed;
|
||||||
|
if (tableData.value.length < 1) return;
|
||||||
|
let key = `Phase`;
|
||||||
|
let value = `${tableData.value[0].Phase}`;
|
||||||
|
tableData.value.forEach(item => {
|
||||||
|
key += `, ${item.name}`;
|
||||||
|
value += `, ${item.speed}`;
|
||||||
|
});
|
||||||
|
post(isAIDose.value ? '/addaimedicine' : '/adddoctormedicine', { database: database.value, key, value }, (res: any) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
tableDataStore.value = JSON.parse(JSON.stringify(tableData.value));
|
||||||
|
ElMessage({
|
||||||
|
message: '保存成功!',
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
ElMessage({
|
||||||
|
message: JSON.stringify(res),
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const tableItemCancel = (e: any) => {
|
const tableItemCancel = (e: any) => {
|
||||||
e.row.speed = tableDataStore.value[e.$index].speed;
|
e.row.speed = tableDataStore.value[e.$index].speed;
|
||||||
|
@ -681,19 +703,23 @@ onMounted(() => {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.top-left-btn-box {
|
.top-left-btn-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.el-select {
|
.el-select {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
height: 31px;
|
height: 31px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: #c77000;
|
color: #c77000;
|
||||||
}
|
}
|
||||||
|
|
||||||
&>.el-button {
|
&>.el-button {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: #f2f3f5;
|
background-color: #f2f3f5;
|
||||||
|
@ -856,5 +882,4 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}</style>
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user