|
|
@@ -1,62 +0,0 @@
|
|
|
-package thyyxxk.webserver.xcTest;
|
|
|
-
|
|
|
-import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
-import org.apache.poi.ss.usermodel.Cell;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import thyyxxk.webserver.dao.his.xcTest.TestDao;
|
|
|
-
|
|
|
-import javax.annotation.PostConstruct;
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileOutputStream;
|
|
|
-import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-@Component
|
|
|
-@Slf4j
|
|
|
-@DS("his")
|
|
|
-public class Test {
|
|
|
-
|
|
|
- private final TestDao dao;
|
|
|
-
|
|
|
- public Test(TestDao dao) {
|
|
|
- this.dao = dao;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-// @PostConstruct
|
|
|
- public void test() throws IOException, InvalidFormatException {
|
|
|
- String 文件路径 = "C:\\Users\\Administrator\\Documents\\WeChat Files\\wxid_ii3i0go9bhwv22\\FileStorage\\File\\2022-11\\drg分组明细查询导出-2022 10月.xlsx";
|
|
|
- XSSFWorkbook xssfWorkbook = new XSSFWorkbook(new File(文件路径));
|
|
|
- XSSFSheet sheet = xssfWorkbook.getSheetAt(0);
|
|
|
-
|
|
|
- int maxRow = sheet.getLastRowNum();
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
- for (int row = 1; row <= maxRow; row++) {
|
|
|
- XSSFRow getRow = sheet.getRow(row);
|
|
|
- Cell cell1 = getRow.createCell(24);
|
|
|
- Cell cell2 = getRow.createCell(25);
|
|
|
-
|
|
|
- Map<String, String> map = dao.patientInfo(getRow.getCell(0).toString());
|
|
|
- if (map == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- cell1.setCellValue(map.get("name"));
|
|
|
- cell2.setCellValue(map.get("small_dept"));
|
|
|
-
|
|
|
- }
|
|
|
- FileOutputStream outputStream = new FileOutputStream("D:\\2.xlsx");
|
|
|
- xssfWorkbook.write(outputStream);
|
|
|
- //7、关闭流
|
|
|
- outputStream.close();
|
|
|
- System.out.println(String.join(",", list));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|