面向冠状病毒疾病药物数据采集系统 -模拟数据
package com.controller;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Random;
public class CoronavirusDataGenerator {
public static void main(String[] args) {
// 创建一个工作簿
try (Workbook workbook = new XSSFWorkbook()) {
// 创建一个工作表
Sheet sheet = workbook.createSheet("Coronavirus Data");
// 创建标题行
Row headerRow = sheet.createRow(0);
String[] headers = {"冠状病毒类型", "靶标信息", "相关疾病临床数据", "已知药物作用机制", "治疗方法",
"传播途径", "潜伏期", "疫苗研究", "预防措施", "药物名称"};
for (int i = 0; i < headers.length; i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers[i]);
}
// 模拟数据
String[] virusTypes = {"HCoV-229E", "HCoV-OC43", "HCoV-NL63", "HCoV-HKU1", "SARS-CoV", "MERS-CoV", "2019-nCoV"};
String[] targetInfos = {"ACE2受体", "TMPRSS2蛋白酶", "Furin蛋白酶", "CD147受体", "DPP4受体"};
String[] clinicalDatas = {"呼吸困难、发热", "嗜睡、食欲不振", "胸闷、呕吐、腹泻", "高热、全身疼痛", "头痛、失去嗅觉"};
String[] drugMechanisms = {"抑制病毒RNA复制", "阻断病毒侵入宿主细胞", "干扰病毒蛋白的剪切过程", "提高宿主细胞的免疫反应", "抑制病毒与宿主细胞融合"};
String[] treatmentMethods = {"抗病毒药物治疗", "对症支持治疗", "免疫疗法", "氧疗", "抗炎疗法"};
String[] transmissionRoutes = {"飞沫传播和接触传播", "空气传播", "粪口传播", "垂直传播", "血液传播"};
String[] incubationPeriods = {"平均5-6天", "2-14天不等", "3-7天", "7-10天", "4-8天"};
String[] vaccineResearches = {"进行中,针对Spike蛋白的疫苗候选研发", "正在临床试验阶段", "已获得紧急使用授权", "疫苗研究尚在起步阶段", "暂无有效疫苗"};
String[] preventionMeasures = {"戴口罩、勤洗手、保持社交距离", "封锁疫情严重地区", "限制公共聚集活动", "提倡居家办公", "加强入境人员检疫"};
String[] drugNames = {"雷尼替丁", "阿奇霉素", "氯喹", "利巴韦林", "地塞米松", "瑞德西韦", "法匹拉韦", "瑞芬太尼", "泼尼松", "布地奈德"};
Random random = new Random();
// 生成数据
for (int i = 1; i <= 3000; i++) {
Row row = sheet.createRow(i);
row.createCell(0).setCellValue(virusTypes[random.nextInt(virusTypes.length)]);
row.createCell(1).setCellValue(targetInfos[random.nextInt(targetInfos.length)]);
row.createCell(2).setCellValue(clinicalDatas[random.nextInt(clinicalDatas.length)]);
row.createCell(3).setCellValue(drugMechanisms[random.nextInt(drugMechanisms.length)]);
row.createCell(4).setCellValue(treatmentMethods[random.nextInt(treatmentMethods.length)]);
row.createCell(5).setCellValue(transmissionRoutes[random.nextInt(transmissionRoutes.length)]);
row.createCell(6).setCellValue(incubationPeriods[random.nextInt(incubationPeriods.length)]);
row.createCell(7).setCellValue(vaccineResearches[random.nextInt(vaccineResearches.length)]);
row.createCell(8).setCellValue(preventionMeasures[random.nextInt(preventionMeasures.length)]);
row.createCell(9).setCellValue(drugNames[random.nextInt(drugNames.length)]);
}
// 将工作簿保存到文件
String filePath = "D:/Daily Tools/Coronavirus_Data.xlsx";
try (FileOutputStream fileOut = new FileOutputStream(filePath)) {
workbook.write(fileOut);
System.out.println("数据已成功保存到:" + filePath);
} catch (IOException e) {
System.out.println("保存文件时出错:" + e.getMessage());
}
} catch (IOException e) {
System.out.println("创建工作簿时出错:" + e.getMessage());
}
}
}
数据结果集展示:
还没有评论,来说两句吧...