Pārlūkot izejas kodu

인력현황 엑셀다운로드 수정

databank102 4 gadi atpakaļ
vecāks
revīzija
55316dbba5

+ 98 - 25
src/main/java/com/lemon/lifecenter/controller/StaffManagerController.java

@@ -29,6 +29,7 @@ import org.apache.poi.ss.usermodel.IndexedColors;
 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.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -224,7 +225,7 @@ public class StaffManagerController extends LifeCenterController {
           fileDTO.setUrl( request.getRequestURI().toString() );
           fileDTO.setMemo( downMemo );
           fileDTO.setEtc( "" );
-          //fileDownloadService.insertExcelDownloadLog( fileDTO );
+          fileDownloadService.insertExcelDownloadLog( fileDTO );
           
           StaffManagerDTO dto = new StaffManagerDTO();
           dto.setGubun(inputgubun);
@@ -241,12 +242,13 @@ public class StaffManagerController extends LifeCenterController {
 //              for( StaffManagerDTO temp : result ) {
 //                  result.get( result.indexOf( temp ) ).setStaffPhoneNumber( LifeCenterFunction.phone( temp.getStaffPhoneNumber() ) );
 //              }
+             
           }
+          getstaffManagerListExcel(request, response, result, inputgubun);
           
-          getstaffManagerListExcel(request, response, result);
       }
       
-      private void getstaffManagerListExcel(HttpServletRequest request, HttpServletResponse response, List<StaffManagerDTO> data ) {
+      private void getstaffManagerListExcel(HttpServletRequest request, HttpServletResponse response, List<StaffManagerDTO> data,String inputgubun ) {
           String password = LifeCenterSessionController.getSession(request, "sesPhoneNumber");
           password = password.toLowerCase();
           if (!password.equals("null") && !password.equals( "" )) {
@@ -280,7 +282,7 @@ public class StaffManagerController extends LifeCenterController {
           fontOfGothicBlackBold16.setBoldweight(Font.BOLDWEIGHT_BOLD); //볼드 (굵게)
           styleOfBoardFillFontBlackBold16.setFont(fontOfGothicBlackBold16);
           
-          int i = 1;
+          int i = 2;
           Row row = sheet1.createRow(0);
           Cell cell1 = row.createCell(0);
           Cell cell2 = row.createCell(1);
@@ -318,7 +320,78 @@ public class StaffManagerController extends LifeCenterController {
           cell14.setCellStyle(styleOfBoardFillFontBlackBold16);
           cell15.setCellStyle(styleOfBoardFillFontBlackBold16);
           
-          if(data.get(0).getGubun().equals("M")) {
+          if(inputgubun.equals("M")) {
+              cell16.setCellStyle(styleOfBoardFillFontBlackBold16);
+              cell17.setCellStyle(styleOfBoardFillFontBlackBold16);
+              cell18.setCellStyle(styleOfBoardFillFontBlackBold16);
+              cell19.setCellStyle(styleOfBoardFillFontBlackBold16);
+          }
+          
+          cell1.setCellValue("생활치료센터명");
+          sheet1.addMergedRegion(new CellRangeAddress(0,1,0,0));
+          
+          cell2.setCellValue("지역");
+          sheet1.addMergedRegion(new CellRangeAddress(0,1,1,1));
+          cell3.setCellValue("협력병원명");
+          sheet1.addMergedRegion(new CellRangeAddress(0,1,2,2));
+          cell4.setCellValue("인력총계(단위:명)");
+          sheet1.addMergedRegion(new CellRangeAddress(0,1,3,3));
+          
+          cell5.setCellValue((inputgubun.equals("M") ? "협력병원" : "행정") + " 인력 현황 (단위 :명)");
+          sheet1.addMergedRegion(new CellRangeAddress(0,0,4,inputgubun.equals("M") ? 9 : 8));
+          
+          if (inputgubun.equals("M")) {
+              cell11.setCellValue("공공 인력 현황 (단위 :명)");
+              sheet1.addMergedRegion(new CellRangeAddress(0,0,10,12));
+              cell14.setCellValue("민간 인력 현황 (단위 :명)");
+              sheet1.addMergedRegion(new CellRangeAddress(0,0,13, 18));
+          } else {
+              cell10.setCellValue("서비스 인력 현황 (단위 :명)");
+              sheet1.addMergedRegion(new CellRangeAddress(0,0,9,11));
+              cell13.setCellValue("민간 인력 현황 (단위 :명)");
+              sheet1.addMergedRegion(new CellRangeAddress(0,0,12, 14));
+          }
+          
+          row = sheet1.createRow(1);
+          
+          cell1 = row.createCell(0);      
+          cell2 = row.createCell(1);      
+          cell3 = row.createCell(2);      
+          cell4 = row.createCell(3);      
+          cell5 = row.createCell(4);      
+          cell6 = row.createCell(5);      
+          cell7 = row.createCell(6);      
+          cell8 = row.createCell(7);      
+          cell9 = row.createCell(8);      
+          cell10 = row.createCell(9);     
+          cell11 = row.createCell(10);    
+          cell12 = row.createCell(11);    
+          cell13 = row.createCell(12);    
+          cell14 = row.createCell(13);    
+          cell15 = row.createCell(14);    
+          cell16 = row.createCell(15);    
+          cell17 = row.createCell(16);    
+          cell18 = row.createCell(17);    
+          cell19 = row.createCell(18);    
+                                          
+          
+          cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell5.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell6.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell7.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell8.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell9.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell10.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell11.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell12.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell13.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell14.setCellStyle(styleOfBoardFillFontBlackBold16);
+          cell15.setCellStyle(styleOfBoardFillFontBlackBold16);
+          
+          if(inputgubun.equals("M")) {
               cell16.setCellStyle(styleOfBoardFillFontBlackBold16);
               cell17.setCellStyle(styleOfBoardFillFontBlackBold16);
               cell18.setCellStyle(styleOfBoardFillFontBlackBold16);
@@ -341,30 +414,30 @@ public class StaffManagerController extends LifeCenterController {
           sheet1.setColumnWidth( 13, 4000); //민가모집의사, 청소
           sheet1.setColumnWidth( 14, 4000); //민간모집간호사, 기타
           
-          if(data.get(0).getGubun().equals("M")) {
+          if(inputgubun.equals("M")) {
               sheet1.setColumnWidth( 15, 6000); //민간모집간호조무사
               sheet1.setColumnWidth( 16, 6000); //민간모잡방사선사
               sheet1.setColumnWidth( 17, 6000); //민간모집임상병리사
               sheet1.setColumnWidth( 18, 6000); //민간모집기타인력
           }
           
-          cell1.setCellValue("생활치료센터명");
-          cell2.setCellValue("지역");
-          cell3.setCellValue("협력병원명");
-          cell4.setCellValue("인력총계(단위:명)");
-          cell5.setCellValue(data.get(0).getGubun().equals("M") ? "의사" : "복지부");
-          cell6.setCellValue(data.get(0).getGubun().equals("M") ?"간호사" : "지자체");
-          cell7.setCellValue(data.get(0).getGubun().equals("M") ?"간호조무사" : "환경부");
-          cell8.setCellValue(data.get(0).getGubun().equals("M") ?"임상병리사" : "소방청");
-          cell9.setCellValue(data.get(0).getGubun().equals("M") ?"방사선사" : "기타");
-          cell10.setCellValue(data.get(0).getGubun().equals("M") ?"행정인력" : "국방부");
-          cell11.setCellValue(data.get(0).getGubun().equals("M") ?"공보의" : "경찰청");
-          cell12.setCellValue(data.get(0).getGubun().equals("M") ?"군의관" : "기타");
-          cell13.setCellValue(data.get(0).getGubun().equals("M") ?"간호사관생도" : "방역");
-          cell14.setCellValue(data.get(0).getGubun().equals("M") ?"민가모집의사" : "청소");
-          cell15.setCellValue(data.get(0).getGubun().equals("M") ?"민간모집간호사" : "기타");
-          
-          if(data.get(0).getGubun().equals("M")) {
+          //cell1.setCellValue("생활치료센터명");
+          //cell2.setCellValue("지역");
+          //cell3.setCellValue("협력병원명");
+          //cell4.setCellValue("인력총계(단위:명)");
+          cell5.setCellValue(inputgubun.equals("M") ? "의사" : "복지부");
+          cell6.setCellValue(inputgubun.equals("M") ?"간호사" : "지자체");
+          cell7.setCellValue(inputgubun.equals("M") ?"간호조무사" : "환경부");
+          cell8.setCellValue(inputgubun.equals("M") ?"임상병리사" : "소방청");
+          cell9.setCellValue(inputgubun.equals("M") ?"방사선사" : "기타");
+          cell10.setCellValue(inputgubun.equals("M") ?"행정인력" : "국방부");
+          cell11.setCellValue(inputgubun.equals("M") ?"공보의" : "경찰청");
+          cell12.setCellValue(inputgubun.equals("M") ?"군의관" : "기타");
+          cell13.setCellValue(inputgubun.equals("M") ?"간호사관생도" : "방역");
+          cell14.setCellValue(inputgubun.equals("M") ?"민가모집의사" : "청소");
+          cell15.setCellValue(inputgubun.equals("M") ?"민간모집간호사" : "기타");
+          
+          if(inputgubun.equals("M")) {
               cell16.setCellValue("민간모집간호조무사");
               cell17.setCellValue("민간모잡방사선사");
               cell18.setCellValue("민간모집임상병리사");
@@ -462,7 +535,7 @@ public class StaffManagerController extends LifeCenterController {
           cell14 = row.createCell(15);
           cell15 = row.createCell(16);
           
-          if(data.get(0).getGubun().equals("M")) {
+          if(inputgubun.equals("M")) {
               cell16 = row.createCell(17);
               cell17 = row.createCell(18);
               cell18 = row.createCell(19);
@@ -475,7 +548,7 @@ public class StaffManagerController extends LifeCenterController {
             
             // JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
             String tempPath = "../excel-temp/testExcel.xlsx";
-            String downName = LifeCenterFunction.getNow() + "_" + (data.get(0).getGubun().equals("M") ? "의료" : "행정") +"인력 현황리스트.xlsx";
+            String downName = LifeCenterFunction.getNow() + "_" + (inputgubun.equals("M") ? "의료" : "행정") +"인력 현황리스트.xlsx";
             File xlsFile = new File(tempPath);
 //            FileOutputStream fileOut = new FileOutputStream(tempPath);
 //            workbook.write(fileOut);