|
|
@@ -0,0 +1,76 @@
|
|
|
+package thyyxxk.webserver.service.xctest;
|
|
|
+
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import thyyxxk.webserver.service.zhuyuanyisheng.EmrServer;
|
|
|
+import thyyxxk.webserver.utils.StringUtil;
|
|
|
+
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
+
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
+import java.io.IOException;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Paths;
|
|
|
+
|
|
|
+import static thyyxxk.webserver.utils.ExcelUtil.readExcel;
|
|
|
+
|
|
|
+@Service
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class xctest {
|
|
|
+
|
|
|
+ private final EmrServer server;
|
|
|
+
|
|
|
+ public xctest(EmrServer server) {
|
|
|
+ this.server = server;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void init() {
|
|
|
+// log.info("抽取到的诊断:{}", server.getEmrData("0410033", 2, EmrType.OPERATION));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws IOException {
|
|
|
+ String filePath = "D:\\world\\创智类\\患者基本信息.xlsx";
|
|
|
+ XSSFWorkbook xssfWorkbook = new XSSFWorkbook(Files.newInputStream(Paths.get(filePath)));
|
|
|
+ XSSFSheet sheet = xssfWorkbook.getSheetAt(0);
|
|
|
+ //获取最大行数
|
|
|
+ int maxRow = sheet.getLastRowNum();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ for (int row = 1; row < maxRow; row++) {
|
|
|
+ Row rowStr = sheet.getRow(row);
|
|
|
+ String str = String.format(
|
|
|
+ "/**\n" +
|
|
|
+ "* %s \n" +
|
|
|
+ "* 说明 %s \n" +
|
|
|
+ "*/ \n" +
|
|
|
+ "@JSONField(name = \"%s\") \n" +
|
|
|
+ "private %s %s; \n",
|
|
|
+ rowStr.getCell(1).toString(),
|
|
|
+ rowStr.getCell(6).toString(),
|
|
|
+ rowStr.getCell(0).toString(),
|
|
|
+ type(rowStr.getCell(2).toString()),
|
|
|
+ StringUtil.lineToHump(rowStr.getCell(0).toString()));
|
|
|
+ System.out.println(str);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static String type(String str) {
|
|
|
+ switch (str) {
|
|
|
+ case "字符型":
|
|
|
+ case "数值型":
|
|
|
+ return "String";
|
|
|
+ default:
|
|
|
+ return "String";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|