|
@@ -6,7 +6,7 @@ import com.zhentao.prescription.dto.PrescriptionDTO;
|
|
|
import com.zhentao.prescription.dto.PrescriptionDetailDTO;
|
|
|
import com.zhentao.prescription.mapper.PrescriptionDetailMapper;
|
|
|
import com.zhentao.prescription.mapper.PrescriptionMapper;
|
|
|
-import com.zhentao.prescription.model.*;
|
|
|
+import com.zhentao.prescription.pojo.*;
|
|
|
import com.zhentao.prescription.service.PrescriptionService;
|
|
|
|
|
|
import org.modelmapper.ModelMapper;
|
|
@@ -14,8 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
import java.time.LocalDate;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -247,7 +248,9 @@ public class PrescriptionServiceImpl implements PrescriptionService {
|
|
|
style.setBorderBottom(BorderStyle.THIN);
|
|
|
style.setBorderLeft(BorderStyle.THIN);
|
|
|
style.setBorderRight(BorderStyle.THIN);
|
|
|
- row.getCell(i).setCellStyle(style);
|
|
|
+
|
|
|
+ Cell cell = row.createCell(i);
|
|
|
+ cell.setCellStyle(style);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -258,15 +261,22 @@ public class PrescriptionServiceImpl implements PrescriptionService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- try {
|
|
|
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
- workbook.write(outputStream);
|
|
|
- byte[] bytes = outputStream.toByteArray();
|
|
|
- workbook.close();
|
|
|
- return bytes;
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException("导出Excel失败", e);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ try (FileOutputStream fileOut = new FileOutputStream("D:/prescriptions.xlsx")) {
|
|
|
+ workbook.write(fileOut);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
+ return new byte[0];
|
|
|
}
|
|
|
|
|
|
|