添加政府,银行大屏,修改政府前后端代码
This commit is contained in:
185
government-backend/scripts/add-epidemic-test-data.js
Normal file
185
government-backend/scripts/add-epidemic-test-data.js
Normal file
@@ -0,0 +1,185 @@
|
||||
const { Sequelize } = require('sequelize')
|
||||
const EpidemicRecord = require('../models/EpidemicRecord')
|
||||
|
||||
// 测试数据
|
||||
const testData = [
|
||||
{
|
||||
farmName: '郑州市金水区阳光养殖场',
|
||||
type: 'vaccination',
|
||||
epidemicStaff: '张三',
|
||||
phone: '13812345678',
|
||||
epidemicDate: '2023-10-01',
|
||||
count: 150,
|
||||
vaccineName: '口蹄疫疫苗',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: null,
|
||||
description: '',
|
||||
notes: '无异常',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '新郑市绿源养殖场',
|
||||
type: 'disinfection',
|
||||
epidemicStaff: '李四',
|
||||
phone: '13912345678',
|
||||
epidemicDate: '2023-10-02',
|
||||
count: 0,
|
||||
vaccineName: '',
|
||||
area: '养殖场全场消毒,重点消毒牛舍、饲料仓库、消毒池等区域',
|
||||
disinfectant: '含氯消毒液',
|
||||
healthResult: null,
|
||||
description: '',
|
||||
notes: '消毒彻底,符合标准',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '新密市祥和养殖场',
|
||||
type: 'health_check',
|
||||
epidemicStaff: '王五',
|
||||
phone: '13712345678',
|
||||
epidemicDate: '2023-10-03',
|
||||
count: 0,
|
||||
vaccineName: '',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: 'normal',
|
||||
description: '',
|
||||
notes: '牛群健康状况良好',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '登封市幸福养殖场',
|
||||
type: 'vaccination',
|
||||
epidemicStaff: '赵六',
|
||||
phone: '13612345678',
|
||||
epidemicDate: '2023-10-04',
|
||||
count: 200,
|
||||
vaccineName: '牛瘟疫苗',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: null,
|
||||
description: '',
|
||||
notes: '部分牛只接种后有轻微发热现象',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '中牟县希望养殖场',
|
||||
type: 'other',
|
||||
epidemicStaff: '钱七',
|
||||
phone: '13512345678',
|
||||
epidemicDate: '2023-10-05',
|
||||
count: 0,
|
||||
vaccineName: '',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: null,
|
||||
description: '牛群驱虫,使用阿维菌素进行全群驱虫',
|
||||
notes: '按计划完成驱虫工作',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '荥阳市快乐养殖场',
|
||||
type: 'vaccination',
|
||||
epidemicStaff: '孙八',
|
||||
phone: '13412345678',
|
||||
epidemicDate: '2023-10-06',
|
||||
count: 180,
|
||||
vaccineName: '布鲁氏菌病疫苗',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: null,
|
||||
description: '',
|
||||
notes: '无异常反应',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '巩义市明星养殖场',
|
||||
type: 'disinfection',
|
||||
epidemicStaff: '周九',
|
||||
phone: '13312345678',
|
||||
epidemicDate: '2023-10-07',
|
||||
count: 0,
|
||||
vaccineName: '',
|
||||
area: '养殖场周边环境消毒',
|
||||
disinfectant: '过氧乙酸',
|
||||
healthResult: null,
|
||||
description: '',
|
||||
notes: '消毒效果良好',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '惠济区温馨养殖场',
|
||||
type: 'health_check',
|
||||
epidemicStaff: '吴十',
|
||||
phone: '13212345678',
|
||||
epidemicDate: '2023-10-08',
|
||||
count: 0,
|
||||
vaccineName: '',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: 'abnormal',
|
||||
description: '',
|
||||
notes: '发现2头牛只精神不振,已隔离观察',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '二七区红火养殖场',
|
||||
type: 'vaccination',
|
||||
epidemicStaff: '郑十一',
|
||||
phone: '13112345678',
|
||||
epidemicDate: '2023-10-09',
|
||||
count: 120,
|
||||
vaccineName: '口蹄疫疫苗',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: null,
|
||||
description: '',
|
||||
notes: '按时完成接种工作',
|
||||
status: 'completed'
|
||||
},
|
||||
{
|
||||
farmName: '中原区丰收养殖场',
|
||||
type: 'other',
|
||||
epidemicStaff: '王十二',
|
||||
phone: '13012345678',
|
||||
epidemicDate: '2023-10-10',
|
||||
count: 0,
|
||||
vaccineName: '',
|
||||
area: '',
|
||||
disinfectant: '',
|
||||
healthResult: null,
|
||||
description: '牛群营养状况评估,对瘦弱牛只进行重点饲养管理',
|
||||
notes: '已制定饲养调整方案',
|
||||
status: 'pending'
|
||||
}
|
||||
]
|
||||
|
||||
async function addTestData() {
|
||||
try {
|
||||
console.log('开始添加防疫记录测试数据...')
|
||||
|
||||
// 清空现有数据
|
||||
await EpidemicRecord.destroy({ where: {} })
|
||||
console.log('已清空现有防疫记录数据')
|
||||
|
||||
// 添加测试数据
|
||||
for (const data of testData) {
|
||||
await EpidemicRecord.create(data)
|
||||
}
|
||||
|
||||
console.log(`成功添加 ${testData.length} 条防疫记录测试数据`)
|
||||
|
||||
// 验证数据
|
||||
const count = await EpidemicRecord.count()
|
||||
console.log(`数据库中现有 ${count} 条防疫记录`)
|
||||
|
||||
} catch (error) {
|
||||
console.error('添加测试数据失败:', error)
|
||||
} finally {
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
// 运行脚本
|
||||
addTestData()
|
||||
28
government-backend/scripts/create-vaccine-table.js
Normal file
28
government-backend/scripts/create-vaccine-table.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const sequelize = require('../config/database')
|
||||
const Vaccine = require('../models/Vaccine')
|
||||
|
||||
async function createVaccineTable() {
|
||||
try {
|
||||
console.log('开始创建疫苗表...')
|
||||
|
||||
// 同步模型到数据库
|
||||
await Vaccine.sync({ force: true })
|
||||
console.log('疫苗表创建成功')
|
||||
|
||||
// 验证表是否创建成功
|
||||
const tableExists = await sequelize.getQueryInterface().showAllTables()
|
||||
console.log('数据库中的表:', tableExists)
|
||||
|
||||
} catch (error) {
|
||||
console.error('创建疫苗表失败:', error)
|
||||
} finally {
|
||||
await sequelize.close()
|
||||
}
|
||||
}
|
||||
|
||||
// 如果直接运行此脚本
|
||||
if (require.main === module) {
|
||||
createVaccineTable()
|
||||
}
|
||||
|
||||
module.exports = createVaccineTable
|
||||
169
government-backend/scripts/seed-vaccines.js
Normal file
169
government-backend/scripts/seed-vaccines.js
Normal file
@@ -0,0 +1,169 @@
|
||||
const Vaccine = require('../models/Vaccine')
|
||||
const sequelize = require('../config/database')
|
||||
|
||||
// 疫苗测试数据
|
||||
const vaccineData = [
|
||||
{
|
||||
name: '口蹄疫疫苗(O型-亚洲I型)二价灭活疫苗',
|
||||
type: 'foot_and_mouth_disease',
|
||||
manufacturer: '中国农业科学院兰州兽医研究所',
|
||||
approvalNumber: '兽药生字(2020)050356789',
|
||||
specification: '10ml/瓶',
|
||||
price: 8.5,
|
||||
validDays: 365,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '',
|
||||
stockCount: 1200,
|
||||
status: 'valid'
|
||||
},
|
||||
{
|
||||
name: '牛结核病提纯蛋白衍生物(PPD)检测试剂',
|
||||
type: 'bovine_tuberculosis',
|
||||
manufacturer: '中国兽医药品监察所',
|
||||
approvalNumber: '兽药生字(2020)010123456',
|
||||
specification: '1ml/瓶',
|
||||
price: 15.0,
|
||||
validDays: 270,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '用于牛结核病的皮内变态反应检测',
|
||||
stockCount: 850,
|
||||
status: 'valid'
|
||||
},
|
||||
{
|
||||
name: '布鲁氏菌病活疫苗(S2株)',
|
||||
type: 'brucellosis',
|
||||
manufacturer: '中国农业科学院哈尔滨兽医研究所',
|
||||
approvalNumber: '兽药生字(2020)080789012',
|
||||
specification: '100头份/瓶',
|
||||
price: 22.5,
|
||||
validDays: 180,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '用于预防牛、羊布鲁氏菌病',
|
||||
stockCount: 430,
|
||||
status: 'valid'
|
||||
},
|
||||
{
|
||||
name: '狂犬病疫苗(灭活疫苗)',
|
||||
type: 'rabies',
|
||||
manufacturer: '武汉生物制品研究所有限责任公司',
|
||||
approvalNumber: '兽药生字(2020)170456789',
|
||||
specification: '1ml/瓶',
|
||||
price: 35.0,
|
||||
validDays: 365,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '',
|
||||
stockCount: 520,
|
||||
status: 'valid'
|
||||
},
|
||||
{
|
||||
name: '牛支原体肺炎疫苗(灭活疫苗)',
|
||||
type: 'other',
|
||||
manufacturer: '青岛易邦生物工程有限公司',
|
||||
approvalNumber: '兽药生字(2020)150234567',
|
||||
specification: '20ml/瓶',
|
||||
price: 45.0,
|
||||
validDays: 270,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '用于预防牛支原体肺炎',
|
||||
stockCount: 180,
|
||||
status: 'low_stock'
|
||||
},
|
||||
{
|
||||
name: '牛副伤寒疫苗(灭活疫苗)',
|
||||
type: 'other',
|
||||
manufacturer: '中牧实业股份有限公司',
|
||||
approvalNumber: '兽药生字(2020)010678901',
|
||||
specification: '100ml/瓶',
|
||||
price: 98.0,
|
||||
validDays: 365,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '用于预防牛副伤寒',
|
||||
stockCount: 65,
|
||||
status: 'low_stock'
|
||||
},
|
||||
{
|
||||
name: '牛流行热疫苗(灭活疫苗)',
|
||||
type: 'other',
|
||||
manufacturer: '金宇保灵生物药品有限公司',
|
||||
approvalNumber: '兽药生字(2020)050345678',
|
||||
specification: '10ml/瓶',
|
||||
price: 28.0,
|
||||
validDays: 180,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '用于预防牛流行热',
|
||||
stockCount: 320,
|
||||
status: 'valid'
|
||||
},
|
||||
{
|
||||
name: '牛病毒性腹泻/粘膜病疫苗(弱毒疫苗)',
|
||||
type: 'other',
|
||||
manufacturer: '北京世纪元亨动物防疫技术有限公司',
|
||||
approvalNumber: '兽药生字(2020)010890123',
|
||||
specification: '10头份/瓶',
|
||||
price: 32.0,
|
||||
validDays: 270,
|
||||
storageCondition: '-15℃以下冷冻保存',
|
||||
notes: '用于预防牛病毒性腹泻/粘膜病',
|
||||
stockCount: 0,
|
||||
status: 'expired'
|
||||
},
|
||||
{
|
||||
name: '羊痘疫苗(弱毒疫苗)',
|
||||
type: 'other',
|
||||
manufacturer: '内蒙古生物药品厂',
|
||||
approvalNumber: '兽药生字(2020)150567890',
|
||||
specification: '50头份/瓶',
|
||||
price: 18.0,
|
||||
validDays: 180,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '用于预防羊痘',
|
||||
stockCount: 280,
|
||||
status: 'valid'
|
||||
},
|
||||
{
|
||||
name: '羊口疮疫苗(弱毒疫苗)',
|
||||
type: 'other',
|
||||
manufacturer: '新疆天康生物制药股份有限公司',
|
||||
approvalNumber: '兽药生字(2020)650123456',
|
||||
specification: '100头份/瓶',
|
||||
price: 25.0,
|
||||
validDays: 270,
|
||||
storageCondition: '2-8℃冷藏保存',
|
||||
notes: '用于预防羊口疮',
|
||||
stockCount: 150,
|
||||
status: 'low_stock'
|
||||
}
|
||||
]
|
||||
|
||||
async function seedVaccines() {
|
||||
try {
|
||||
console.log('开始添加疫苗测试数据...')
|
||||
|
||||
// 清空现有数据
|
||||
await Vaccine.destroy({ where: {} })
|
||||
console.log('已清空现有疫苗数据')
|
||||
|
||||
// 添加测试数据
|
||||
for (const vaccine of vaccineData) {
|
||||
await Vaccine.create(vaccine)
|
||||
}
|
||||
|
||||
console.log(`成功添加 ${vaccineData.length} 条疫苗测试数据`)
|
||||
|
||||
// 验证数据
|
||||
const count = await Vaccine.count()
|
||||
console.log(`数据库中现有疫苗数量: ${count}`)
|
||||
|
||||
} catch (error) {
|
||||
console.error('添加疫苗测试数据失败:', error)
|
||||
} finally {
|
||||
await sequelize.close()
|
||||
}
|
||||
}
|
||||
|
||||
// 如果直接运行此脚本
|
||||
if (require.main === module) {
|
||||
seedVaccines()
|
||||
}
|
||||
|
||||
module.exports = seedVaccines
|
||||
20
government-backend/scripts/sync-epidemic-table.js
Normal file
20
government-backend/scripts/sync-epidemic-table.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const sequelize = require('../config/database')
|
||||
const EpidemicRecord = require('../models/EpidemicRecord')
|
||||
|
||||
async function syncTable() {
|
||||
try {
|
||||
console.log('开始同步防疫记录表...')
|
||||
|
||||
// 同步模型到数据库
|
||||
await EpidemicRecord.sync({ force: true })
|
||||
console.log('防疫记录表同步成功')
|
||||
|
||||
} catch (error) {
|
||||
console.error('同步表失败:', error)
|
||||
} finally {
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
// 运行脚本
|
||||
syncTable()
|
||||
Reference in New Issue
Block a user