mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 04:54:58 +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 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
|
||||
};
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -28,6 +28,8 @@ connection().connect();
|
|||
featureTable.getTable();
|
||||
AIMedicineTable.getTable();
|
||||
doctorMedicineTable.getTable();
|
||||
AIMedicineTable.addTable();
|
||||
doctorMedicineTable.addTable();
|
||||
|
||||
// MedicineFeadbackInfoTable
|
||||
// TimingFeadbackInfoTable
|
||||
|
|
|
@ -82,7 +82,8 @@
|
|||
<div class="right-box">
|
||||
<div class="top-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"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
|
@ -168,7 +169,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, reactive } from 'vue';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { dateFormater } from './date-util';
|
||||
import { post } from "@/axios/index";
|
||||
import chartLine from './chart-line.vue';
|
||||
|
@ -191,15 +192,15 @@ const databaseOptions: { value: string, label: string }[] = [
|
|||
{ value: '数据模拟20231109185403', label: '模拟数据库' }
|
||||
];
|
||||
const medicineCustom: any[] = [
|
||||
{ name: '丙泊酚', plus: 0.5 },
|
||||
{ name: '舒芬太尼', plus: 1 },
|
||||
{ name: '瑞芬太尼', plus: 0.05 },
|
||||
{ name: '顺阿曲库胺', plus: 0.02 },
|
||||
{ name: '尼卡地平', plus: 1 },
|
||||
{ name: '艾司洛尔', plus: 1 },
|
||||
{ name: '麻黄素', plus: 1 },
|
||||
{ name: '阿托品', plus: 1 },
|
||||
{ name: '罗库溴铵', plus: 0.1 }
|
||||
{ name: '丙泊酚', plus: 0.5, total: 50 },
|
||||
{ name: '舒芬太尼', plus: 1, total: 100 },
|
||||
{ name: '瑞芬太尼', plus: 0.05, total: 5 },
|
||||
{ name: '顺阿曲库胺', plus: 0.02, total: 2 },
|
||||
{ name: '尼卡地平', plus: 1, total: 100 },
|
||||
{ name: '艾司洛尔', plus: 1, total: 100 },
|
||||
{ name: '麻黄素', plus: 1, total: 100 },
|
||||
{ name: '阿托品', plus: 1, total: 100 },
|
||||
{ name: '罗库溴铵', plus: 0.1, total: 10 }
|
||||
];
|
||||
const database = ref('数据模拟20231109185403');
|
||||
const messageSum = ref(10);
|
||||
|
@ -267,7 +268,7 @@ function getChartData() {
|
|||
function getEEG() {
|
||||
setTimeout(() => {
|
||||
// if (isStart.value) {
|
||||
chartDom4.value.updateChart(0, new Date());
|
||||
chartDom4.value.updateChart(0, new Date());
|
||||
// }
|
||||
getEEG();
|
||||
}, 1000);
|
||||
|
@ -275,28 +276,28 @@ function getChartData() {
|
|||
|
||||
function getData(callback: () => void) {
|
||||
// if (isStart.value) {
|
||||
post('/getfeature', { database: database.value, start: 0, end: 1 }, (res: any) => {
|
||||
const obj = res.data[0] || {};
|
||||
if (obj.ID !== chartNowData.ID) {
|
||||
chartNowData = obj;
|
||||
const isHR = obj.HR >= 50 && obj.HR <= 80;
|
||||
const isSBP = obj.SBP >= 90 && obj.SBP <= 120;
|
||||
const isDBP = obj.DBP >= 60 && obj.DBP <= 90;
|
||||
// const isST = obj.ST >= -0.2 && obj.ST <= 0.2;
|
||||
if (!isHR) unusualUpDate('心率异常');
|
||||
if (!isSBP) unusualUpDate('收缩压异常');
|
||||
if (!isDBP) unusualUpDate('舒张异常');
|
||||
// if (!isST) unusualUpDate('心电图ST段变异度异常');
|
||||
lungAlarm.value = Boolean(!isSBP || !isDBP);
|
||||
// heartAlarm.value = Boolean(!isHR || !isST);
|
||||
heartAlarm.value = Boolean(!isHR);
|
||||
chartDom1.value.updateChart([obj.BIS, obj.HR], obj.Time || obj.TIME);
|
||||
chartDom2.value.updateChart([obj.SBP, obj.DBP], obj.Time || obj.TIME);
|
||||
chartDom3.value.updateChart([obj.SPO2, obj.TEMP], obj.Time || obj.TIME);
|
||||
// chartDom4.value.updateChart(obj.ST, obj.Time || obj.TIME);
|
||||
}
|
||||
callback();
|
||||
})
|
||||
post('/getfeature', { database: database.value, start: 0, end: 1 }, (res: any) => {
|
||||
const obj = res.data[0] || {};
|
||||
if (obj.ID !== chartNowData.ID) {
|
||||
chartNowData = obj;
|
||||
const isHR = obj.HR >= 50 && obj.HR <= 80;
|
||||
const isSBP = obj.SBP >= 90 && obj.SBP <= 120;
|
||||
const isDBP = obj.DBP >= 60 && obj.DBP <= 90;
|
||||
// const isST = obj.ST >= -0.2 && obj.ST <= 0.2;
|
||||
if (!isHR) unusualUpDate('心率异常');
|
||||
if (!isSBP) unusualUpDate('收缩压异常');
|
||||
if (!isDBP) unusualUpDate('舒张异常');
|
||||
// if (!isST) unusualUpDate('心电图ST段变异度异常');
|
||||
lungAlarm.value = Boolean(!isSBP || !isDBP);
|
||||
// heartAlarm.value = Boolean(!isHR || !isST);
|
||||
heartAlarm.value = Boolean(!isHR);
|
||||
chartDom1.value.updateChart([obj.BIS, obj.HR], obj.Time || obj.TIME);
|
||||
chartDom2.value.updateChart([obj.SBP, obj.DBP], obj.Time || obj.TIME);
|
||||
chartDom3.value.updateChart([obj.SPO2, obj.TEMP], obj.Time || obj.TIME);
|
||||
// chartDom4.value.updateChart(obj.ST, obj.Time || obj.TIME);
|
||||
}
|
||||
callback();
|
||||
})
|
||||
// } else {
|
||||
// callback();
|
||||
// }
|
||||
|
@ -336,13 +337,13 @@ function getTableData(e: boolean) {
|
|||
for (let key in res.data[0]) {
|
||||
if (key !== 'ID' && key !== 'Phase' && key !== 'Time' && key !== 'TIME') {
|
||||
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 {
|
||||
const defaultMedicine: string[] = ['丙泊酚', '舒芬太尼', '瑞芬太尼', '顺阿曲库胺', '尼卡地平', '艾司洛尔', '麻黄素', '阿托品'];
|
||||
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));
|
||||
|
@ -410,13 +411,34 @@ const tableItemPlus = (e: any) => {
|
|||
};
|
||||
const tableItemMinus = (e: any) => {
|
||||
const obj = medicineCustom.find(item => item.name === e.row.name) || { plus: 1 };
|
||||
if(!isAIDose.value && e.row.speed - obj.plus <= 0) return;
|
||||
if (!isAIDose.value && e.row.speed - obj.plus <= 0) return;
|
||||
e.row.speed -= obj.plus;
|
||||
if (e.row.speed < 0) e.row.speed = 0;
|
||||
else e.row.speed = Number(e.row.speed.toFixed(2));
|
||||
};
|
||||
const tableItemConfirm = (e: any) => {
|
||||
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) => {
|
||||
e.row.speed = tableDataStore.value[e.$index].speed;
|
||||
|
@ -681,19 +703,23 @@ onMounted(() => {
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.top-left-btn-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.el-select {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-button {
|
||||
border-radius: 16px;
|
||||
height: 31px;
|
||||
background-color: transparent;
|
||||
color: #c77000;
|
||||
}
|
||||
|
||||
&>.el-button {
|
||||
border-radius: 4px;
|
||||
background-color: #f2f3f5;
|
||||
|
@ -732,7 +758,7 @@ onMounted(() => {
|
|||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -856,5 +882,4 @@ onMounted(() => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}</style>
|
||||
|
|
Loading…
Reference in New Issue
Block a user