|
@@ -323,37 +323,37 @@ public class CenterController extends LifeCenterController {
|
|
|
private void getCenterListExcel(HttpServletRequest request, HttpServletResponse response, List<CenterInfoDTO> data ) {
|
|
|
String password = LifeCenterSessionController.getSession(request, "sesPhoneNumber");
|
|
|
password = password.toLowerCase();
|
|
|
- if (!password.equals("null") && !password.equals( "" )) {
|
|
|
+ if (!password.equals("null") && !password.equals("")) {
|
|
|
password = password.replace("-", "");
|
|
|
password = password.substring(3).trim();
|
|
|
} else {
|
|
|
password = "";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
|
Sheet sheet1 = workbook.createSheet("firstSheet");
|
|
|
DecimalFormat df = new DecimalFormat("#,###");
|
|
|
-
|
|
|
- //1.셀 스타일 및 폰트 설정
|
|
|
+
|
|
|
+ // 1.셀 스타일 및 폰트 설정
|
|
|
CellStyle styleOfBoardFillFontBlackBold16 = workbook.createCellStyle();
|
|
|
- //정렬
|
|
|
- styleOfBoardFillFontBlackBold16.setAlignment(CellStyle.ALIGN_CENTER); //가운데 정렬
|
|
|
- styleOfBoardFillFontBlackBold16.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //높이 가운데 정렬
|
|
|
- //배경색
|
|
|
+ // 정렬
|
|
|
+ styleOfBoardFillFontBlackBold16.setAlignment(CellStyle.ALIGN_CENTER); // 가운데 정렬
|
|
|
+ styleOfBoardFillFontBlackBold16.setVerticalAlignment(CellStyle.VERTICAL_CENTER); // 높이 가운데 정렬
|
|
|
+ // 배경색
|
|
|
styleOfBoardFillFontBlackBold16.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex());
|
|
|
styleOfBoardFillFontBlackBold16.setFillPattern(CellStyle.SOLID_FOREGROUND);
|
|
|
- //테두리 선 (우,좌,위,아래)
|
|
|
+ // 테두리 선 (우,좌,위,아래)
|
|
|
styleOfBoardFillFontBlackBold16.setBorderRight(HSSFCellStyle.BORDER_THIN);
|
|
|
styleOfBoardFillFontBlackBold16.setBorderLeft(HSSFCellStyle.BORDER_THIN);
|
|
|
styleOfBoardFillFontBlackBold16.setBorderTop(HSSFCellStyle.BORDER_THIN);
|
|
|
styleOfBoardFillFontBlackBold16.setBorderBottom(HSSFCellStyle.BORDER_THIN);
|
|
|
- //폰트 설정
|
|
|
+ // 폰트 설정
|
|
|
Font fontOfGothicBlackBold16 = workbook.createFont();
|
|
|
// fontOfGothicBlackBold16.setFontName("나눔고딕"); //글씨체
|
|
|
- fontOfGothicBlackBold16.setFontHeight((short)(10*20)); //사이즈
|
|
|
- fontOfGothicBlackBold16.setBoldweight(Font.BOLDWEIGHT_BOLD); //볼드 (굵게)
|
|
|
+ fontOfGothicBlackBold16.setFontHeight((short) (10 * 20)); // 사이즈
|
|
|
+ fontOfGothicBlackBold16.setBoldweight(Font.BOLDWEIGHT_BOLD); // 볼드 (굵게)
|
|
|
styleOfBoardFillFontBlackBold16.setFont(fontOfGothicBlackBold16);
|
|
|
-
|
|
|
+
|
|
|
int i = 1;
|
|
|
Row row = sheet1.createRow(0);
|
|
|
Cell cell1 = row.createCell(0);
|
|
@@ -373,7 +373,7 @@ public class CenterController extends LifeCenterController {
|
|
|
Cell cell15 = row.createCell(14);
|
|
|
Cell cell16 = row.createCell(15);
|
|
|
Cell cell17 = row.createCell(16);
|
|
|
-
|
|
|
+
|
|
|
cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
@@ -391,25 +391,25 @@ public class CenterController extends LifeCenterController {
|
|
|
cell15.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
cell16.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
cell17.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
-
|
|
|
- sheet1.setColumnWidth( 0, 10000); //생활치료센터명
|
|
|
- sheet1.setColumnWidth( 1, 5000); //지역
|
|
|
- sheet1.setColumnWidth( 2, 5000); //소관
|
|
|
- sheet1.setColumnWidth( 3, 8000); //협력병원
|
|
|
- sheet1.setColumnWidth( 4, 6000); //담당자 이름
|
|
|
- sheet1.setColumnWidth( 5, 4000); //담당자 아이디
|
|
|
- sheet1.setColumnWidth( 6, 4000); //담당자 전화번호
|
|
|
- sheet1.setColumnWidth( 7, 4000); //전화번호
|
|
|
- sheet1.setColumnWidth( 8, 2500); //의료진수
|
|
|
- sheet1.setColumnWidth( 9, 2500); //환자 총 수용인원
|
|
|
- sheet1.setColumnWidth( 10, 2500); //입소자수
|
|
|
- sheet1.setColumnWidth( 11, 2500); //퇴소자수
|
|
|
- sheet1.setColumnWidth( 12, 2500); //지정병원이송
|
|
|
- sheet1.setColumnWidth( 13, 2500); //기타
|
|
|
- sheet1.setColumnWidth( 14, 3500); // 등록일
|
|
|
- sheet1.setColumnWidth( 15, 3500); // 종료일
|
|
|
- sheet1.setColumnWidth( 16, 3500); // 상태
|
|
|
-
|
|
|
+
|
|
|
+ sheet1.setColumnWidth(0, 10000); // 생활치료센터명
|
|
|
+ sheet1.setColumnWidth(1, 5000); // 지역
|
|
|
+ sheet1.setColumnWidth(2, 5000); // 소관
|
|
|
+ sheet1.setColumnWidth(3, 8000); // 협력병원
|
|
|
+ sheet1.setColumnWidth(4, 6000); // 담당자 이름
|
|
|
+ sheet1.setColumnWidth(5, 4000); // 담당자 아이디
|
|
|
+ sheet1.setColumnWidth(6, 4000); // 담당자 전화번호
|
|
|
+ sheet1.setColumnWidth(7, 4000); // 전화번호
|
|
|
+ sheet1.setColumnWidth(8, 2500); // 의료진수
|
|
|
+ sheet1.setColumnWidth(9, 2500); // 환자 총 수용인원
|
|
|
+ sheet1.setColumnWidth(10, 2500); // 입소자수
|
|
|
+ sheet1.setColumnWidth(11, 2500); // 퇴소자수
|
|
|
+ sheet1.setColumnWidth(12, 2500); // 지정병원이송
|
|
|
+ sheet1.setColumnWidth(13, 2500); // 기타
|
|
|
+ sheet1.setColumnWidth(14, 3500); // 등록일
|
|
|
+ sheet1.setColumnWidth(15, 3500); // 종료일
|
|
|
+ sheet1.setColumnWidth(16, 3500); // 상태
|
|
|
+
|
|
|
cell1.setCellValue("생활치료센터명");
|
|
|
cell2.setCellValue("지역");
|
|
|
cell3.setCellValue("소관");
|
|
@@ -427,7 +427,7 @@ public class CenterController extends LifeCenterController {
|
|
|
cell15.setCellValue("등록일");
|
|
|
cell16.setCellValue("종료일");
|
|
|
cell17.setCellValue("상태");
|
|
|
-
|
|
|
+
|
|
|
for (CenterInfoDTO dto : data) {
|
|
|
row = sheet1.createRow(i);
|
|
|
cell1 = row.createCell(0);
|
|
@@ -447,7 +447,7 @@ public class CenterController extends LifeCenterController {
|
|
|
cell15 = row.createCell(14);
|
|
|
cell16 = row.createCell(15);
|
|
|
cell17 = row.createCell(16);
|
|
|
-
|
|
|
+
|
|
|
String centerName = dto.getCenterName();
|
|
|
String locationName = dto.getLocationName();
|
|
|
String jurisdictionName = dto.getJurisdictionName();
|
|
@@ -462,7 +462,7 @@ public class CenterController extends LifeCenterController {
|
|
|
int patientTotalD = dto.getTotalPatientD();
|
|
|
int patientTotalT = dto.getTotalPatientT();
|
|
|
int patientTotalE = dto.getTotalPatientE();
|
|
|
-
|
|
|
+
|
|
|
cell1.setCellValue(centerName);
|
|
|
cell2.setCellValue(locationName);
|
|
|
cell3.setCellValue(jurisdictionName);
|
|
@@ -480,10 +480,10 @@ public class CenterController extends LifeCenterController {
|
|
|
cell15.setCellValue(dto.getCreateDate());
|
|
|
cell16.setCellValue(dto.getExpirationDate());
|
|
|
cell17.setCellValue(dto.getUseYn());
|
|
|
-
|
|
|
+
|
|
|
i++;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
row = sheet1.createRow(i);
|
|
|
cell1 = row.createCell(2);
|
|
|
cell2 = row.createCell(3);
|
|
@@ -502,57 +502,57 @@ public class CenterController extends LifeCenterController {
|
|
|
cell15 = row.createCell(16);
|
|
|
cell16 = row.createCell(17);
|
|
|
cell17 = row.createCell(18);
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
// File file = new File(".");
|
|
|
// String rootPath = file.getAbsolutePath();
|
|
|
// System.out.println("현재 프로젝트의 경로 : "+rootPath );
|
|
|
-
|
|
|
- // JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
|
|
|
- String tempPath = "../excel-temp/testExcel.xlsx";
|
|
|
- String downName = LifeCenterFunction.getNow() + " 환자리스트.xlsx";
|
|
|
- File xlsFile = new File(tempPath);
|
|
|
+
|
|
|
+ // JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
|
|
|
+ String tempPath = "../excel-temp/testExcel.xlsx";
|
|
|
+ String downName = LifeCenterFunction.getNow() + " 생활치료센터_리스트.xlsx";
|
|
|
+ File xlsFile = new File(tempPath);
|
|
|
// FileOutputStream fileOut = new FileOutputStream(tempPath);
|
|
|
// workbook.write(fileOut);
|
|
|
// fileOut.close();
|
|
|
-
|
|
|
- ByteArrayOutputStream fileOut = new ByteArrayOutputStream();
|
|
|
- FileOutputStream fos = new FileOutputStream(tempPath);
|
|
|
- workbook.write(fileOut);
|
|
|
-
|
|
|
- InputStream filein = new ByteArrayInputStream(fileOut.toByteArray());
|
|
|
- OPCPackage opc = OPCPackage.open(filein);
|
|
|
-
|
|
|
- POIFSFileSystem fileSystem = new POIFSFileSystem();
|
|
|
-
|
|
|
- EncryptionInfo encryptionInfo = new EncryptionInfo(EncryptionMode.agile);
|
|
|
- Encryptor encryptor = encryptionInfo.getEncryptor();
|
|
|
- encryptor.confirmPassword(password);
|
|
|
-
|
|
|
- opc.save(encryptor.getDataStream(fileSystem));
|
|
|
- opc.flush();
|
|
|
-
|
|
|
- fileSystem.writeFilesystem(fos);
|
|
|
-
|
|
|
- fileOut.close();
|
|
|
- opc.close();
|
|
|
-
|
|
|
- filein.close();
|
|
|
- fileSystem.close();
|
|
|
-
|
|
|
- LifeCenterFileDownload.download(request, response, tempPath, downName);
|
|
|
-
|
|
|
- xlsFile.delete();
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (InvalidFormatException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- } catch (GeneralSecurityException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+
|
|
|
+ ByteArrayOutputStream fileOut = new ByteArrayOutputStream();
|
|
|
+ FileOutputStream fos = new FileOutputStream(tempPath);
|
|
|
+ workbook.write(fileOut);
|
|
|
+
|
|
|
+ InputStream filein = new ByteArrayInputStream(fileOut.toByteArray());
|
|
|
+ OPCPackage opc = OPCPackage.open(filein);
|
|
|
+
|
|
|
+ POIFSFileSystem fileSystem = new POIFSFileSystem();
|
|
|
+
|
|
|
+ EncryptionInfo encryptionInfo = new EncryptionInfo(EncryptionMode.agile);
|
|
|
+ Encryptor encryptor = encryptionInfo.getEncryptor();
|
|
|
+ encryptor.confirmPassword(password);
|
|
|
+
|
|
|
+ opc.save(encryptor.getDataStream(fileSystem));
|
|
|
+ opc.flush();
|
|
|
+
|
|
|
+ fileSystem.writeFilesystem(fos);
|
|
|
+
|
|
|
+ fileOut.close();
|
|
|
+ opc.close();
|
|
|
+
|
|
|
+ filein.close();
|
|
|
+ fileSystem.close();
|
|
|
+
|
|
|
+ LifeCenterFileDownload.download(request, response, tempPath, downName);
|
|
|
+
|
|
|
+ xlsFile.delete();
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvalidFormatException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (GeneralSecurityException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|