Files
nxxmdata/government-backend/scripts/add-epidemic-test-data.js

186 lines
4.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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()