面向冠状病毒疾病药物数据采集系统 -模拟数据

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

数据结果集展示:

491677a1d3624e79bc238b5dd777d81a.png

发表评论

表情:
评论列表 (有 0 条评论,138人围观)

还没有评论,来说两句吧...

相关阅读