|
@@ -228,7 +228,7 @@ public class StaffTotalManagerController extends LifeCenterController {
|
|
|
mv.addObject("paging", paging);
|
|
|
mv.addObject("page", page);
|
|
|
mv.addObject("pageSize", dto.getLimitMax());
|
|
|
-
|
|
|
+ mv.addObject( "nowYmd", LifeCenterFunction.getNow( "yyyy-MM-dd" ) );
|
|
|
return mv;
|
|
|
}
|
|
|
//의료인력현황 /meditotal
|
|
@@ -251,6 +251,10 @@ public class StaffTotalManagerController extends LifeCenterController {
|
|
|
dto.setGubun(inputgubun);
|
|
|
dto.setStatusFlag(inputStatusFlag);
|
|
|
|
|
|
+ if( dto.getRegistDay().equals( "" ) ) {
|
|
|
+ dto.setRegistDay( LifeCenterFunction.getNow( "yyyy-MM-dd" ) );
|
|
|
+ }
|
|
|
+
|
|
|
int total = service.selectStaffManagerCount(dto);
|
|
|
StaffManagerDTO ndto = new StaffManagerDTO();
|
|
|
if (total > 0) {
|
|
@@ -263,7 +267,7 @@ public class StaffTotalManagerController extends LifeCenterController {
|
|
|
ModelAndView mv = setMV("staffTotal/edit");
|
|
|
|
|
|
mv.addObject("list", ndto);
|
|
|
-
|
|
|
+ mv.addObject( "nowYmd", LifeCenterFunction.getNow( "yyyy-MM-dd" ) );
|
|
|
return mv;
|
|
|
}
|
|
|
//의료인력현황 /meditotal
|
|
@@ -443,6 +447,239 @@ public class StaffTotalManagerController extends LifeCenterController {
|
|
|
return mv;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/center/report/excel")
|
|
|
+ public void centerStaffReportExcel(
|
|
|
+ @ModelAttribute("dto") StaffManagerDTO dto,
|
|
|
+ @RequestParam(value="locationCode", required=false, defaultValue="") String inputlocationCode,
|
|
|
+ @RequestParam(value="centerName", required=false, defaultValue="") String inputCenterName,
|
|
|
+ @RequestParam(value="registDay", required=false, defaultValue="") String inputRegistDay,
|
|
|
+ @RequestParam(value="page", required=false, defaultValue="1") int page,
|
|
|
+ HttpServletRequest request,HttpServletResponse response) {
|
|
|
+
|
|
|
+ List<LocationDTO> locationCodeList = centerService.selectLocation();
|
|
|
+
|
|
|
+
|
|
|
+ dto.setGubun("m");
|
|
|
+
|
|
|
+ if (inputRegistDay.isEmpty()) {
|
|
|
+ inputRegistDay = LifeCenterFunction.getNow("yyyy-MM-dd");
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setRegistDay(inputRegistDay);
|
|
|
+
|
|
|
+ // 센터별관리화면에서는 레몬생치는 제외
|
|
|
+ dto.setEtcType( "manager" );
|
|
|
+
|
|
|
+ int total = service.selectStaffManagerCount(dto);
|
|
|
+ List<StaffManagerDTO> list = new ArrayList<StaffManagerDTO>();
|
|
|
+ if (total > 0) {
|
|
|
+
|
|
|
+ dto.setLimit( 0 );
|
|
|
+ dto.setLimitMax( total + 1 );
|
|
|
+
|
|
|
+ list = service.selectCenterStaffReportList(dto);
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ int staffTotal = list.get(i).getStaffTotal();
|
|
|
+ int staffCapacity = list.get(i).getStaffCapacity();
|
|
|
+
|
|
|
+ float rate = 0.f;
|
|
|
+
|
|
|
+
|
|
|
+ if (staffTotal == 0 || staffCapacity == 0) {
|
|
|
+ } else {
|
|
|
+ rate = (float) (((float) staffTotal / (float) staffCapacity) * 100.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ String str = String.format("%.1f", rate);
|
|
|
+ list.get(i).setRate(Float.parseFloat(str));
|
|
|
+ list.get(i).setStaff1(staffCapacity - staffTotal);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ getCenterStaffReportExcel(request, response, list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void getCenterStaffReportExcel(HttpServletRequest request, HttpServletResponse response, List<StaffManagerDTO> data ) {
|
|
|
+ String password = LifeCenterSessionController.getSession(request, "sesPhoneNumber");
|
|
|
+ password = password.toLowerCase();
|
|
|
+ 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.셀 스타일 및 폰트 설정
|
|
|
+ CellStyle styleOfBoardFillFontBlackBold16 = workbook.createCellStyle();
|
|
|
+ // 정렬
|
|
|
+ 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); // 볼드 (굵게)
|
|
|
+ styleOfBoardFillFontBlackBold16.setFont(fontOfGothicBlackBold16);
|
|
|
+
|
|
|
+ int i = 1;
|
|
|
+ Row row = sheet1.createRow(0);
|
|
|
+ Cell cell1 = row.createCell(0);
|
|
|
+ Cell cell2 = row.createCell(1);
|
|
|
+ Cell cell3 = row.createCell(2);
|
|
|
+ Cell cell4 = row.createCell(3);
|
|
|
+ Cell cell5 = row.createCell(4);
|
|
|
+ Cell cell6 = row.createCell(5);
|
|
|
+ Cell cell7 = row.createCell(6);
|
|
|
+ Cell cell8 = row.createCell(7);
|
|
|
+ Cell cell9 = row.createCell(8);
|
|
|
+ Cell cell10 = row.createCell(9);
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ sheet1.setColumnWidth(0, 10000); // 번호
|
|
|
+ sheet1.setColumnWidth(1, 10000); // 소관
|
|
|
+ sheet1.setColumnWidth(2, 5000); // 생활치료센터명
|
|
|
+ sheet1.setColumnWidth(3, 5000); // 정원
|
|
|
+ sheet1.setColumnWidth(4, 8000); // 현원
|
|
|
+ sheet1.setColumnWidth(5, 6000); // 가동률
|
|
|
+ sheet1.setColumnWidth(6, 4000); // 입실가능인원
|
|
|
+ sheet1.setColumnWidth(7, 4000); // 실가용인원
|
|
|
+ sheet1.setColumnWidth(8, 4000); // 사용불가 인원
|
|
|
+ sheet1.setColumnWidth(9, 4000); // 사용불가 사유
|
|
|
+
|
|
|
+ cell1.setCellValue("번호");
|
|
|
+ cell2.setCellValue("생활치료센터명");
|
|
|
+ cell3.setCellValue("소관");
|
|
|
+ cell4.setCellValue("정원");
|
|
|
+ cell5.setCellValue("현원");
|
|
|
+ cell6.setCellValue("가동률");
|
|
|
+ cell7.setCellValue("입실가능인원");
|
|
|
+ cell8.setCellValue("실가용인원");
|
|
|
+ cell9.setCellValue("사용불가 인원");
|
|
|
+ cell10.setCellValue("사용불가 사유");
|
|
|
+
|
|
|
+ for (StaffManagerDTO dto : data) {
|
|
|
+ row = sheet1.createRow(i);
|
|
|
+ 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);
|
|
|
+
|
|
|
+ String num = ( i > 1 )? String.valueOf(i -1) : "총계";
|
|
|
+ cell1.setCellValue( num );
|
|
|
+ cell2.setCellValue( dto.getCenterName() );
|
|
|
+ cell3.setCellValue( dto.getLocationName() );
|
|
|
+ cell4.setCellValue( dto.getStaffCapacity() );
|
|
|
+ cell5.setCellValue( dto.getStaffTotal() );
|
|
|
+ cell6.setCellValue( String.valueOf( dto.getRate() ) + "%" );
|
|
|
+ cell7.setCellValue( dto.getStaff1() );
|
|
|
+ cell8.setCellValue( dto.getStaff1() - dto.getUnavailableTotal() );
|
|
|
+ cell9.setCellValue( dto.getUnavailableTotal() );
|
|
|
+ cell10.setCellValue( dto.getUnavailableNote() );
|
|
|
+
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ row = sheet1.createRow(i);
|
|
|
+ cell1 = row.createCell(2);
|
|
|
+ cell2 = row.createCell(3);
|
|
|
+ cell3 = row.createCell(4);
|
|
|
+ cell4 = row.createCell(5);
|
|
|
+ cell5 = row.createCell(6);
|
|
|
+ cell6 = row.createCell(7);
|
|
|
+ cell7 = row.createCell(8);
|
|
|
+ cell8 = row.createCell(9);
|
|
|
+ cell9 = row.createCell(10);
|
|
|
+ cell10 = row.createCell(11);
|
|
|
+
|
|
|
+ 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);
|
|
|
+// 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 (GeneralSecurityException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvalidFormatException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//의료인력관리 /medi/managerlist
|
|
|
//행정인력현황 /gov/managerlist
|
|
|
@RequestMapping( value="{addr}/excel", method=RequestMethod.POST )
|