Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/simplatform' into databank

junekeunsong 4 anni fa
parent
commit
8bae452449

+ 490 - 1
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -1,10 +1,27 @@
 package com.lemon.lifecenter.controller;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
-
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Font;
+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.xssf.usermodel.XSSFWorkbook;
 import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -18,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.lemon.lifecenter.common.LifeCenterController;
+import com.lemon.lifecenter.common.LifeCenterFileDownload;
 import com.lemon.lifecenter.common.LifeCenterFunction;
 import com.lemon.lifecenter.common.LifeCenterSessionController;
 import com.lemon.lifecenter.dto.LoginDTO;
@@ -142,6 +160,53 @@ public class ClinicController extends LifeCenterController {
 		return mv;
 	}
 
+	@RequestMapping("/excel")
+	public void getPatientList(
+			@RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType,
+			@RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
+			HttpServletRequest request, HttpServletResponse response ) {
+
+		PatientDTO patientDto = new PatientDTO();
+		patientDto.setPatientIdx(patientIdx);
+		patientDto = patientService.selectPatientOne(patientDto);		
+		
+//		phrType = "memo";
+		if (phrType == "symptom") {
+			PatientSymptomSimDTO dto = new PatientSymptomSimDTO();
+			dto.setPatientIdx(patientIdx);		
+			
+			int total = phrService.selectSymptomCount(dto);
+			List<PatientSymptomSimDTO> result = new ArrayList<PatientSymptomSimDTO>();
+
+			if (total > 0) {
+				result = phrService.selectSymptomList(dto);
+			}
+			
+			this.getPhrSymptomListExcel(request, response, patientDto, result);
+		} else if (phrType == "memo") {
+			PatientMemoDTO dto = new PatientMemoDTO();
+			dto.setPatientIdx(patientIdx);		
+			
+			List<PatientMemoDTO> result = new ArrayList<PatientMemoDTO>();
+			result = clinicService.selectMemoList(dto);
+			
+			this.getMemoListExcel(request, response, patientDto, result);
+		} else {
+			PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
+			dto.setPhrType(phrType);
+			dto.setPatientIdx(patientIdx);		
+			
+			int total = phrService.selectPHRHistoryCount(dto);
+			List<PatientPHRHistoryDTO> result = new ArrayList<PatientPHRHistoryDTO>();
+
+			if (total > 0) {
+				result = phrService.selectPHRHistoryList(dto);
+			}
+			
+			this.getPhrDataListExcel(request, response, patientDto, phrType, result);
+		}
+	}
+
 	@RequestMapping("/api/state")
 	public @ResponseBody List<PatientPHRLatestDTO> state(HttpServletRequest request,
 			@RequestParam(value = "page", required = true, defaultValue = "1") int page,
@@ -264,4 +329,428 @@ public class ClinicController extends LifeCenterController {
 			return json.toString();
 		}
 	}
+
+	private void getPhrDataListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, String phrType, List<PatientPHRHistoryDTO> data) {
+        Workbook workbook = new XSSFWorkbook();
+        Sheet sheet1 = workbook.createSheet("PHR");
+
+        //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);
+
+        cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
+
+        sheet1.setColumnWidth( 0, 5000); //환자명
+        sheet1.setColumnWidth( 1, 5000); //기록일시
+        sheet1.setColumnWidth( 2, 3000); //값
+        sheet1.setColumnWidth( 3, 4000); //기록자
+        
+        cell1.setCellValue("환자명");
+        cell2.setCellValue("기록일시");
+        if (phrType.equals("temperature")) {
+        	cell3.setCellValue("체온");
+		} else if (phrType.equals("bloodPressure")) {
+			cell3.setCellValue("혈압");
+		} else if (phrType.equals("oxygenSaturation")) {
+			cell3.setCellValue("산소포화도");
+		} else if (phrType.equals("pulseRate")) {
+			cell3.setCellValue("맥박");
+		} else if (phrType.equals("bloodSugar")) {
+			cell3.setCellValue("혈당");
+		}
+        
+        cell4.setCellValue("기록자");
+        
+        for (PatientPHRHistoryDTO dto : data) {
+            row = sheet1.createRow(i);
+            cell1 = row.createCell(0);
+            cell2 = row.createCell(1);
+            cell3 = row.createCell(2);
+			cell4 = row.createCell(3);
+
+			// 일시
+			String createDate = null;
+			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+			SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			try {
+				Date t = originalFormat.parse(dto.getCreateDate());
+				createDate =  targetFormat.format(t);
+			} catch (Exception e) {
+				createDate = dto.getCreateDate();
+			}
+
+			// 값
+			String phrValue = "";
+			String phrValue2 = "";
+			if (phrType.equals("temperature")) {
+				phrValue = String.format("%.1f", dto.getPhrValue());
+				phrValue2 = String.format("%.1f", dto.getPhrValue2());
+			} else {
+				phrValue = String.format("%.0f", dto.getPhrValue());
+				phrValue2 = String.format("%.0f", dto.getPhrValue2());
+			}
+
+			// 기록자
+			String recordedByName = dto.getRecordedByName();
+
+			cell1.setCellValue( patientDto.getPatientName() );
+			cell2.setCellValue( createDate );
+			if (phrType.equals("bloodPressure")) {
+				cell3.setCellValue( phrValue + "/" + phrValue2 );
+			} else {
+				cell3.setCellValue( phrValue );
+			}
+			
+            cell4.setCellValue( recordedByName );
+
+            i++;
+        }
+
+        row = sheet1.createRow(i);
+        cell1 = row.createCell(2);
+        cell2 = row.createCell(3);
+        cell3 = row.createCell(4);
+        cell4 = row.createCell(4);
+        
+        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 directoryName = "../excel-temp/";
+        	File directory = new File(directoryName);
+        	if (! directory.exists()) {
+        		directory.mkdir();
+        	}
+        	
+			String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
+			// 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
+			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_" + phrType + "_" + timestamp + ".xlsx";
+			String tempPath = directoryName + downName;
+            
+      
+            File xlsFile = new File(tempPath);
+            FileOutputStream fileOut = new FileOutputStream(xlsFile);
+            workbook.write(fileOut);
+
+            LifeCenterFileDownload.download(request, response, tempPath, downName);
+
+            xlsFile.delete();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+	
+	private void getPhrSymptomListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, List<PatientSymptomSimDTO> data) {
+        Workbook workbook = new XSSFWorkbook();
+        Sheet sheet1 = workbook.createSheet("임상증상");
+
+        //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);
+        Cell cell11 = row.createCell(10);
+        Cell cell12 = row.createCell(11);
+        Cell cell13 = row.createCell(12);
+        Cell cell14 = row.createCell(13);
+        Cell cell15 = row.createCell(14);
+        Cell cell16 = row.createCell(15);
+        Cell cell17 = row.createCell(16);
+        Cell cell18 = row.createCell(17);
+
+        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);
+        cell16.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell17.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell18.setCellStyle(styleOfBoardFillFontBlackBold16);
+
+        sheet1.setColumnWidth(0, 5000); // 기록일시
+        sheet1.setColumnWidth(1, 3000); // 기침
+        sheet1.setColumnWidth(2, 3000); // 호흡곤란
+        sheet1.setColumnWidth(3, 3000); // 오한	
+        sheet1.setColumnWidth(4, 3000); // 근육통	
+        sheet1.setColumnWidth(5, 3000); // 두통
+        sheet1.setColumnWidth(6, 3000); // 인후통
+        sheet1.setColumnWidth(7, 3000); // 후각/미각 손실									
+        sheet1.setColumnWidth(8, 3000); // 피로
+        sheet1.setColumnWidth(9, 3000); // 식욕감소
+        sheet1.setColumnWidth(10, 3000); // 가래
+        sheet1.setColumnWidth(11, 3000); // 오심	
+        sheet1.setColumnWidth(12, 3000); // 구토	
+        sheet1.setColumnWidth(13, 3000); // 설사
+        sheet1.setColumnWidth(14, 3000); // 어지러움
+        sheet1.setColumnWidth(15, 3000); // 콧물/코막힘
+        sheet1.setColumnWidth(16, 3000); // 기타증상
+        sheet1.setColumnWidth(17, 5000); // 기록자
+        
+        cell1.setCellValue("기록일시");
+        cell2.setCellValue("기침");
+        cell3.setCellValue("호흡곤란");        
+        cell4.setCellValue("오한");
+        cell5.setCellValue("근육통");
+        cell6.setCellValue("두통");
+        cell7.setCellValue("인후통");        
+        cell8.setCellValue("후각/미각 손실");
+        cell9.setCellValue("피로");        
+        cell10.setCellValue("식욕감소");        
+        cell11.setCellValue("가래");
+        cell12.setCellValue("오심");
+        cell13.setCellValue("구토");
+        cell14.setCellValue("설사");
+        cell15.setCellValue("어지러움");        
+        cell16.setCellValue("콧물/코막힘");  
+        cell17.setCellValue("기타증상");
+        cell18.setCellValue("기록자");
+        
+        for (PatientSymptomSimDTO 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);
+            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);
+			
+			String createDate = null;
+			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+			SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			try {
+				Date t = originalFormat.parse(dto.getCreateDate());
+				createDate =  targetFormat.format(t);
+			} catch (Exception e) {
+				createDate = dto.getCreateDate();
+			}			
+			
+			cell1.setCellValue(createDate);			
+			cell2.setCellValue(dto.getCoughCheck());
+			cell3.setCellValue(dto.getDyspneaCheck());
+			cell4.setCellValue(dto.getColdFitCheck());
+			cell5.setCellValue(dto.getMusclePainCheck());
+			cell6.setCellValue(dto.getHeadacheCheck());
+			cell7.setCellValue(dto.getSoreThroatCheck());
+			cell8.setCellValue(dto.getSmellPalateCheck());
+			cell9.setCellValue(dto.getFatigueCheck());
+			cell10.setCellValue(dto.getAppetiteLossCheck());
+			cell11.setCellValue(dto.getSputumCheck());
+			cell12.setCellValue(dto.getOcinCheck());
+			cell13.setCellValue(dto.getVomitingCheck());
+			cell14.setCellValue(dto.getDiarrheaCheck());
+			cell15.setCellValue(dto.getDizzinessCheck());
+			cell16.setCellValue(dto.getNoseCheck());
+			
+			String etcCheckYN = dto.getEtcCheck();
+			String etcContent = etcCheckYN;
+			if (etcCheckYN == "Y") {
+				etcContent = dto.getEtcContent();
+			}
+			cell17.setCellValue(etcContent);			
+			
+            cell18.setCellValue(dto.getRecordedByName());
+
+            i++;
+        }
+ 
+        try {
+            // JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
+        	String directoryName = "../excel-temp/";
+        	File directory = new File(directoryName);
+        	if (! directory.exists()) {
+        		directory.mkdir();
+        	}
+        	
+			String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
+			// 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
+			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_symptom_" + timestamp + ".xlsx";
+			String tempPath = directoryName + downName;
+            
+      
+            File xlsFile = new File(tempPath);
+            FileOutputStream fileOut = new FileOutputStream(xlsFile);
+            workbook.write(fileOut);
+            
+            LifeCenterFileDownload.download(request, response, tempPath, downName);
+
+            xlsFile.delete();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+	
+	private void getMemoListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, List<PatientMemoDTO> data) {
+        Workbook workbook = new XSSFWorkbook();
+        Sheet sheet1 = workbook.createSheet("의료진 메모");
+
+        //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);
+
+        cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
+
+        sheet1.setColumnWidth( 0, 5000); // 기록일시
+        sheet1.setColumnWidth( 1, 10000); // 내용 
+        sheet1.setColumnWidth( 2, 3000); // 기록자
+              
+        cell1.setCellValue("기록일시");
+        cell2.setCellValue("내용");
+        cell3.setCellValue("기록자");
+        
+        for (PatientMemoDTO dto : data) {
+            row = sheet1.createRow(i);
+            cell1 = row.createCell(0);
+            cell2 = row.createCell(1);
+            cell3 = row.createCell(2);
+			
+			String createDate = null;
+			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+			SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			try {
+				Date t = originalFormat.parse(dto.getCreateDate());
+				createDate =  targetFormat.format(t);
+			} catch (Exception e) {
+				createDate = dto.getCreateDate();
+			}			
+			
+			cell1.setCellValue(createDate);
+			cell2.setCellValue(dto.getContents());		
+			cell3.setCellValue(dto.getRecordedByName());			
+
+            i++;
+        }
+        
+        try {            
+            // JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
+        	String directoryName = "../excel-temp/";
+        	File directory = new File(directoryName);
+        	if (! directory.exists()) {
+        		directory.mkdir();
+        	}
+        	
+			String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
+			// 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
+			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_memo_" + timestamp + ".xlsx";
+			String tempPath = directoryName + downName;
+            
+      
+            File xlsFile = new File(tempPath);
+            FileOutputStream fileOut = new FileOutputStream(xlsFile);
+            workbook.write(fileOut);
+
+            LifeCenterFileDownload.download(request, response, tempPath, downName);
+
+            xlsFile.delete();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
 }
+

+ 1 - 1
src/main/resources/application.properties

@@ -7,7 +7,7 @@ spring.mvc.view.suffix=.jsp
 #spring.datasource.url=jdbc:cubrid:localhost:30000:LIFE_CENTER:::?charset=UTF-8
 spring.datasource.driver-class-name=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
 #spring.datasource.url=jdbc:log4jdbc:cubrid:61.97.184.187:30000:LIFE_CENTER:::?charset=UTF-8
-spring.datasource.url=jdbc:log4jdbc:cubrid:localhost:30000:LIFE_CENTER:::?charset=UTF-8
+spring.datasource.url=jdbc:log4jdbc:cubrid:118.67.133.187:30000:LIFE_CENTER:::?charset=UTF-8
 
 spring.datasource.username=dba
 spring.datasource.password=#zo240s!

+ 9 - 0
src/main/webapp/WEB-INF/jsp/clinic/info.jsp

@@ -580,6 +580,14 @@ function gotoList() {
 	location.href = url;
 }
 
+function getExcel() {
+	const patientIdx = ${patientIdx};
+	const phrType = $("#phrTypeSelect option:selected").val();
+
+	const url = "./excel?patientIdx=" + patientIdx + "&phrType=" + phrType;
+	window.open(url);
+}
+
 $(document).ready(function() {
 
 	// 최초 로드시 phrData 체온이 로드됨. 해당 데이터 차트 그려줌.
@@ -1035,6 +1043,7 @@ $(document).ready(function() {
 										<div class="graph-area mb-4" style="height:300px;">
 											<canvas id="phrChart"></canvas>
 										</div>
+										<button class="btn btn-success" onclick="getExcel();">Excel 다운로드</button>
 										<h1 class="h4 text-right"><span class="small showLegend ml-2" data-toggle="modal" data-target="#legendGuide"><i class="mdi mdi-comment-question-outline"></i> 알람 표시 기준</span></h1>
 										<div class="table-responsive">
 											<table id="phrDataTable" class="table data-table text-center">