Browse Source

代码提交

SGTY 4 months ago
parent
commit
c898d3342b
1 changed files with 14 additions and 14 deletions
  1. 14 14
      src/test/java/com/qizhen/healsphere/ZhengzhuangDataWriteTest31.java

+ 14 - 14
src/test/java/com/qizhen/healsphere/ZhengzhuangDataWriteTest31.java

@@ -53,14 +53,24 @@ public class ZhengzhuangDataWriteTest31 {
                 ",子类或分类##症状\t“#症状#”此处作为一种“症状”,“#症状#”的症状子类或症状分类有哪些症状(答案必须包含“#症状#”几个字,否则不提取)";
         String[] properties = propertyStr.split(",");
         workbook = new HSSFWorkbook();//这里也可以设置sheet的Name
-        String fileName = "temp";//
-        HSSFSheet sheet = workbook.createSheet(fileName);
-        int rows = 0;
+
         for(String property:properties){
+            int rows = 0;
             String[] split = property.split("\t");
             if(split.length<2){
                 continue;
             }
+            String endLabel = split[0];
+            String relationShip = split[0];
+            String[] endLabelSplit = endLabel.split("##");
+            if(endLabelSplit.length==2){
+                endLabel = endLabelSplit[1];
+                relationShip= endLabelSplit[0];
+            }
+            if(!startLabel.equals(endLabel)){
+                endLabel = startLabel+endLabel;
+            }
+            HSSFSheet sheet = workbook.createSheet(relationShip);
             List<Knowlege> data = getData(BaidubceUtil.getAccessToken(), property);
             if(!CollectionUtils.isEmpty(data)) {
 
@@ -74,17 +84,7 @@ public class ZhengzhuangDataWriteTest31 {
                     row.createCell(5).setCellValue(temp.getChunk() == null ? "" : temp.getChunk());
                     row.createCell(6).setCellValue(temp.getRefenrece() == null ? "" : temp.getRefenrece());
                 }
-                save(fileName);
-                String endLabel = split[0];
-                String relationShip = split[0];
-                String[] endLabelSplit = endLabel.split("##");
-                if(endLabelSplit.length==2){
-                    endLabel = endLabelSplit[1];
-                    relationShip= endLabelSplit[0];
-                }
-                if(!startLabel.equals(endLabel)){
-                    endLabel = startLabel+endLabel;
-                }
+                save(relationShip);
                 for (Knowlege temp:data) {
                     String value = temp.getValue();
                     if(StringUtils.isBlank(value)){