Просмотр исходного кода

엑셀 다운로드 기능 수정 중, recordDate 관련 기능 추가 중

maengje 4 лет назад
Родитель
Сommit
d57b2f88dc

+ 203 - 302
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -181,53 +181,6 @@ public class ClinicController extends LifeCenterController {
 		return mv;
 	}
 
-	@RequestMapping("/excel")
-	public void getExcelFile(
-			@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.equals("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.equals("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 String getStateAPI(HttpServletRequest request,
 			@RequestParam(value = "page", required = true, defaultValue = "1") int page,
@@ -498,67 +451,126 @@ public class ClinicController extends LifeCenterController {
     }
     return bloodPressureUnionResult;
   }
+  
+	@RequestMapping("/excel")
+	public void getExcelFile(
+			@RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType,
+			@RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
+			HttpServletRequest request, HttpServletResponse response ) {
 
-	private void getPhrDataListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, String phrType, List<PatientPHRHistoryDTO> data) {
-        Workbook workbook = new XSSFWorkbook();
-        Sheet sheet1 = workbook.createSheet("PHR");
+		PatientDTO patientDto = new PatientDTO();
+		patientDto.setPatientIdx(patientIdx);
+		patientDto = patientService.selectPatientOne(patientDto);		
+		
+		this.createExcel(request, response, patientDto);
+	}
 
-        //1.셀 스타일 및 폰트 설정
+	private void createExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto) {
+        Workbook workbook = new XSSFWorkbook();
+        
+        // 셀 스타일 및 폰트 설정
         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;
+        this.createPHRSheet(workbook, styleOfBoardFillFontBlackBold16, patientDto, "체온", "temperature");
+        this.createPHRSheet(workbook, styleOfBoardFillFontBlackBold16, patientDto, "혈압", "bloodPressure");
+        this.createPHRSheet(workbook, styleOfBoardFillFontBlackBold16, patientDto, "맥박", "pulseRate");
+        this.createPHRSheet(workbook, styleOfBoardFillFontBlackBold16, patientDto, "산소포화도", "oxygenSaturation");        
+        this.createPHRSheet(workbook, styleOfBoardFillFontBlackBold16, patientDto, "혈당", "bloodSugar");
+        
+        this.createSymptomSheet(workbook, styleOfBoardFillFontBlackBold16, patientDto);
+        
+        this.createMemoSheet(workbook, styleOfBoardFillFontBlackBold16, patientDto);
+        
+        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() + ")_건강정보기록_" + 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 createPHRSheet(Workbook workbook, CellStyle styleOfBoardFillFontBlackBold16, PatientDTO patientDto, String phrTypeKorean, String phrType) {
+    	PatientPHRHistoryDTO patientPHRHistoryDto = new PatientPHRHistoryDTO();
+    	patientPHRHistoryDto.setPhrType(phrType);
+    	patientPHRHistoryDto.setPatientIdx(patientDto.getPatientIdx());		
+		
+		int total = phrService.selectPHRHistoryCount(patientPHRHistoryDto);
+		List<PatientPHRHistoryDTO> data = new ArrayList<PatientPHRHistoryDTO>();
+
+		if (total > 0) {
+			data = phrService.selectPHRHistoryList(patientPHRHistoryDto);
+		}
+		
+        Sheet sheet1 = workbook.createSheet(phrTypeKorean);
         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);
 
         cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
-        cell5.setCellStyle(styleOfBoardFillFontBlackBold16);        
+        cell5.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell6.setCellStyle(styleOfBoardFillFontBlackBold16);
 
-        sheet1.setColumnWidth( 0, 5000); //환자명
-        sheet1.setColumnWidth( 1, 5000); //동호실
-        sheet1.setColumnWidth( 2, 5000); //기록일시
-        sheet1.setColumnWidth( 3, 3000); //값
-        sheet1.setColumnWidth( 4, 4000); //기록자
+        sheet1.setColumnWidth( 0, 5000); // 환자명
+        sheet1.setColumnWidth( 1, 5000); // 생년월일
+        sheet1.setColumnWidth( 2, 5000); // 동, 호실
+        sheet1.setColumnWidth( 3, 5000); // 기록일시
+        sheet1.setColumnWidth( 4, 3000); // 값
+        sheet1.setColumnWidth( 5, 4000); // 기록자
         
         cell1.setCellValue("환자명");
-        cell2.setCellValue("동,호실");
-        cell3.setCellValue("기록일시");
-        if (phrType.equals("temperature")) {
-        	cell4.setCellValue("체온");
-		} else if (phrType.equals("bloodPressure")) {
-			cell4.setCellValue("혈압");
-		} else if (phrType.equals("oxygenSaturation")) {
-			cell4.setCellValue("산소포화도");
-		} else if (phrType.equals("pulseRate")) {
-			cell4.setCellValue("맥박");
-		} else if (phrType.equals("bloodSugar")) {
-			cell4.setCellValue("혈당");
-		}
-        
-        cell5.setCellValue("기록자");
+        cell2.setCellValue("생년월일");
+        cell3.setCellValue("동,호실");
+        cell4.setCellValue("기록일시");
+        cell5.setCellValue(phrTypeKorean); 
+        cell6.setCellValue("기록자");
         
         // 동,호실
 		String roomNumber = "";
@@ -567,6 +579,7 @@ public class ClinicController extends LifeCenterController {
 		}
 		roomNumber += patientDto.getRoomNumber() + "호";
         
+		int i = 1;
         for (PatientPHRHistoryDTO dto : data) {
             row = sheet1.createRow(i);
             cell1 = row.createCell(0);
@@ -574,6 +587,7 @@ public class ClinicController extends LifeCenterController {
             cell3 = row.createCell(2);
 			cell4 = row.createCell(3);
 			cell5 = row.createCell(4);
+			cell6 = row.createCell(5);
 
 			// 일시
 			String createDate = null;
@@ -601,94 +615,36 @@ public class ClinicController extends LifeCenterController {
 			String recordedByName = dto.getRecordedByName();
 
 			cell1.setCellValue(patientDto.getPatientName());
-			cell2.setCellValue(roomNumber);
+			cell2.setCellValue(patientDto.getJumin());
+			cell3.setCellValue(roomNumber);
 			
-			cell3.setCellValue(createDate);
+			cell4.setCellValue(createDate);
 			if (phrType.equals("bloodPressure")) {
-				cell4.setCellValue(phrValue + "/" + phrValue2);
+				cell5.setCellValue(phrValue + "/" + phrValue2);
 			} else {
-				cell4.setCellValue(phrValue);
+				cell5.setCellValue(phrValue);
 			}
 			
-            cell5.setCellValue(recordedByName);
+            cell6.setCellValue(recordedByName);
 
             i++;
-        }     
-        
-       String phrTypeString = "체온";              
-               
-        switch (phrType) {
-        case "oxygenSaturation":
-        	phrTypeString = "산소포화도";
-        	break;
-        case "bloodPressure":
-        	phrTypeString = "혈압";
-        	break;
-        case "pulseRate":
-        	phrTypeString = "맥박";
-        	break;
-        case "bloodSugar":
-        	phrTypeString = "혈당";
-        	break;
-        }
-        
-        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() + ")_" + phrTypeString + "_" + 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("임상증상");
+	private void createSymptomSheet(Workbook workbook, CellStyle styleOfBoardFillFontBlackBold16, PatientDTO patientDto) {
+        
+		PatientSymptomSimDTO patientSymptomSimDto = new PatientSymptomSimDTO();
+		patientSymptomSimDto.setPatientIdx(patientDto.getPatientIdx());		
+		
+		int total = phrService.selectSymptomCount(patientSymptomSimDto);
+		List<PatientSymptomSimDTO> data = new ArrayList<PatientSymptomSimDTO>();
 
-        //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);
+		if (total > 0) {
+			data = phrService.selectSymptomList(patientSymptomSimDto);
+		}
+				
+        Sheet sheet1 = workbook.createSheet("임상증상");               
         
-        int i = 1;
         Row row = sheet1.createRow(0);
         Cell cell1 = row.createCell(0);
         Cell cell2 = row.createCell(1);
@@ -710,6 +666,7 @@ public class ClinicController extends LifeCenterController {
         Cell cell18 = row.createCell(17);
         Cell cell19 = row.createCell(18);
         Cell cell20 = row.createCell(19);
+        Cell cell21 = row.createCell(20);
 
         cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
@@ -731,48 +688,51 @@ public class ClinicController extends LifeCenterController {
         cell18.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell19.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell20.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell21.setCellStyle(styleOfBoardFillFontBlackBold16);
 
         sheet1.setColumnWidth(0, 5000); // 환자명
-        sheet1.setColumnWidth(1, 5000); // 동호실
-        sheet1.setColumnWidth(2, 5000); // 기록일시
-        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, 3000); // 콧물/코막힘
-        sheet1.setColumnWidth(18, 3000); // 기타증상
-        sheet1.setColumnWidth(19, 5000); // 기록자
+        sheet1.setColumnWidth(1, 5000); // 생년월일
+        sheet1.setColumnWidth(2, 5000); // 동호실
+        sheet1.setColumnWidth(3, 5000); // 기록일시
+        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, 3000); // 어지러움
+        sheet1.setColumnWidth(18, 3000); // 콧물/코막힘
+        sheet1.setColumnWidth(19, 3000); // 기타증상
+        sheet1.setColumnWidth(20, 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("콧물/코막힘");  
-        cell19.setCellValue("기타증상");
-        cell20.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("어지러움");        
+        cell19.setCellValue("콧물/코막힘");  
+        cell20.setCellValue("기타증상");
+        cell21.setCellValue("기록자");
         
         // 동,호실
 		String roomNumber = "";
@@ -781,6 +741,7 @@ public class ClinicController extends LifeCenterController {
 		}
 		roomNumber += patientDto.getRoomNumber() + "호";
      			
+		int i = 1;
         for (int index = data.size() - 1; index >= 0; index--) {
         	PatientSymptomSimDTO dto = data.get(index);
             row = sheet1.createRow(i);
@@ -804,6 +765,7 @@ public class ClinicController extends LifeCenterController {
 			cell18 = row.createCell(17);
 			cell19 = row.createCell(18);
 			cell20 = row.createCell(19);
+			cell21 = row.createCell(20);
 			
 			String createDate = null;
 			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@@ -815,107 +777,70 @@ public class ClinicController extends LifeCenterController {
 				createDate = dto.getCreateDate();
 			}			
 			
-			cell1.setCellValue(patientDto.getPatientName());			
-			cell2.setCellValue(roomNumber);			
-			cell3.setCellValue(createDate);			
-			cell4.setCellValue(dto.getCoughCheck().equals("Y") ? "V" : "-");
-			cell5.setCellValue(dto.getDyspneaCheck().equals("Y") ? "V" : "-");
-			cell6.setCellValue(dto.getColdFitCheck().equals("Y") ? "V" : "-");
-			cell7.setCellValue(dto.getMusclePainCheck().equals("Y") ? "V" : "-");
-			cell8.setCellValue(dto.getHeadacheCheck().equals("Y") ? "V" : "-");
-			cell9.setCellValue(dto.getSoreThroatCheck().equals("Y") ? "V" : "-");
-			cell10.setCellValue(dto.getSmellPalateCheck().equals("Y") ? "V" : "-");
-			cell11.setCellValue(dto.getFatigueCheck().equals("Y") ? "V" : "-");
-			cell12.setCellValue(dto.getAppetiteLossCheck().equals("Y") ? "V" : "-");
-			cell13.setCellValue(dto.getSputumCheck().equals("Y") ? "V" : "-");
-			cell14.setCellValue(dto.getOcinCheck().equals("Y") ? "V" : "-");
-			cell15.setCellValue(dto.getVomitingCheck().equals("Y") ? "V" : "-");
-			cell16.setCellValue(dto.getDiarrheaCheck().equals("Y") ? "V" : "-");
-			cell17.setCellValue(dto.getDizzinessCheck().equals("Y") ? "V" : "-");
-			cell18.setCellValue(dto.getNoseCheck().equals("Y") ? "V" : "-");
-			cell19.setCellValue(dto.getEtcCheck().equals("Y") ? dto.getEtcContent() : "-");			
-			cell20.setCellValue(dto.getRecordedByName());
+			cell1.setCellValue(patientDto.getPatientName());
+			cell2.setCellValue(patientDto.getJumin());
+			cell3.setCellValue(roomNumber);			
+			cell4.setCellValue(createDate);			
+			cell5.setCellValue(dto.getCoughCheck().equals("Y") ? "V" : "-");
+			cell6.setCellValue(dto.getDyspneaCheck().equals("Y") ? "V" : "-");
+			cell7.setCellValue(dto.getColdFitCheck().equals("Y") ? "V" : "-");
+			cell8.setCellValue(dto.getMusclePainCheck().equals("Y") ? "V" : "-");
+			cell9.setCellValue(dto.getHeadacheCheck().equals("Y") ? "V" : "-");
+			cell10.setCellValue(dto.getSoreThroatCheck().equals("Y") ? "V" : "-");
+			cell11.setCellValue(dto.getSmellPalateCheck().equals("Y") ? "V" : "-");
+			cell12.setCellValue(dto.getFatigueCheck().equals("Y") ? "V" : "-");
+			cell13.setCellValue(dto.getAppetiteLossCheck().equals("Y") ? "V" : "-");
+			cell14.setCellValue(dto.getSputumCheck().equals("Y") ? "V" : "-");
+			cell15.setCellValue(dto.getOcinCheck().equals("Y") ? "V" : "-");
+			cell16.setCellValue(dto.getVomitingCheck().equals("Y") ? "V" : "-");
+			cell17.setCellValue(dto.getDiarrheaCheck().equals("Y") ? "V" : "-");
+			cell18.setCellValue(dto.getDizzinessCheck().equals("Y") ? "V" : "-");
+			cell19.setCellValue(dto.getNoseCheck().equals("Y") ? "V" : "-");
+			cell20.setCellValue(dto.getEtcCheck().equals("Y") ? dto.getEtcContent() : "-");			
+			cell21.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() + ")_임상증상_" + 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);
+	private void createMemoSheet(Workbook workbook, CellStyle styleOfBoardFillFontBlackBold16, PatientDTO patientDto) {
+        
+		PatientMemoDTO patientMemoDto = new PatientMemoDTO();
+		patientMemoDto.setPatientIdx(patientDto.getPatientIdx());		
+		
+		List<PatientMemoDTO> data = new ArrayList<PatientMemoDTO>();
+		data = clinicService.selectMemoList(patientMemoDto);	
+				
+        Sheet sheet1 = workbook.createSheet("의료진 메모");               
         
-        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);
 
         cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell5.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell6.setCellStyle(styleOfBoardFillFontBlackBold16);
 
         sheet1.setColumnWidth(0, 5000); // 환자명
-        sheet1.setColumnWidth(1, 5000); // 동호실
-        sheet1.setColumnWidth(2, 5000); // 기록일시
-        sheet1.setColumnWidth(3, 20000); // 내용 
-        sheet1.setColumnWidth(4, 3000); // 기록자
+        sheet1.setColumnWidth(1, 5000); // 생년월일
+        sheet1.setColumnWidth(2, 5000); // 동호실
+        sheet1.setColumnWidth(3, 5000); // 기록일시
+        sheet1.setColumnWidth(4, 20000); // 내용 
+        sheet1.setColumnWidth(5, 3000); // 기록자
               
         cell1.setCellValue("환자명");
-        cell2.setCellValue("동,호실");
-        cell3.setCellValue("기록일시");
-        cell4.setCellValue("내용");
-        cell5.setCellValue("기록자");
+        cell2.setCellValue("생년월일");
+        cell3.setCellValue("동,호실");
+        cell4.setCellValue("기록일시");
+        cell5.setCellValue("내용");
+        cell6.setCellValue("기록자");
         
         // 동,호실
 		String roomNumber = "";
@@ -924,6 +849,7 @@ public class ClinicController extends LifeCenterController {
 		}
 		roomNumber += patientDto.getRoomNumber() + "호";
         
+		int i = 1;
         for (int index = data.size() - 1; index >= 0; index--) {
         	PatientMemoDTO dto = data.get(index);
             row = sheet1.createRow(i);
@@ -932,6 +858,7 @@ public class ClinicController extends LifeCenterController {
             cell3 = row.createCell(2);
             cell4 = row.createCell(3);
             cell5 = row.createCell(4);
+            cell6 = row.createCell(5);
 			
 			String createDate = null;
 			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@@ -944,45 +871,19 @@ public class ClinicController extends LifeCenterController {
 			}			
 			
 			cell1.setCellValue(patientDto.getPatientName());
-			cell2.setCellValue(roomNumber);
-			cell3.setCellValue(createDate);
-			cell4.setCellValue(dto.getContents());		
-			cell5.setCellValue(dto.getRecordedByName());			
+			cell2.setCellValue(patientDto.getJumin());
+			cell3.setCellValue(roomNumber);
+			cell4.setCellValue(createDate);
+			cell5.setCellValue(dto.getContents());		
+			cell6.setCellValue(dto.getRecordedByName());			
 			
 			CellStyle cs = workbook.createCellStyle();
 		    cs.setWrapText(true);
 		    cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //높이 가운데 정렬
-		    cell4.setCellStyle(cs);
+		    cell5.setCellStyle(cs);
 
             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() + ")_의료진메모_" + 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();
-        }
     }
 }
 

+ 8 - 8
src/main/java/com/lemon/lifecenter/dto/PatientMemoDTO.java

@@ -12,9 +12,9 @@ public class PatientMemoDTO {
 	private int patientIdx;
 	private String contents;
 	private String recordedByName;
-	private String recordedById;
+	private String recordedById;	
+	private String recordedDate;
 	private String createDate;
-	private String updateDate;
 	private int limit;
 	private int limitMax;
 	
@@ -47,6 +47,12 @@ public class PatientMemoDTO {
 	}
 	public void setRecordedById(String recordedById) {
 		this.recordedById = recordedById;
+	}	
+	public String getRecordedDate() {
+		return recordedDate;
+	}
+	public void setRecordedDate(String recordedDate) {
+		this.recordedDate = recordedDate;
 	}
 	public String getCreateDate() {
 		return createDate;
@@ -54,12 +60,6 @@ public class PatientMemoDTO {
 	public void setCreateDate(String createDate) {
 		this.createDate = createDate;
 	}
-	public String getUpdateDate() {
-		return updateDate;
-	}
-	public void setUpdateDate(String updateDate) {
-		this.updateDate = updateDate;
-	}
 	public int getLimit() {
 		return limit;
 	}

+ 10 - 3
src/main/java/com/lemon/lifecenter/dto/PatientPHRHistoryDTO.java

@@ -11,10 +11,11 @@ public class PatientPHRHistoryDTO {
 	private int patientIdx;
 	private String phrType;
 	private Float phrValue;
-  private Float phrValue2;
-  private Float phrValueExtra;  // phrType 이 혈압인 경우, 통합뷰의 경우 여기에 맥박이 들어가는 경우가 있음.
+	private Float phrValue2;
+	private Float phrValueExtra;  // phrType 이 혈압인 경우, 통합뷰의 경우 여기에 맥박이 들어가는 경우가 있음.
 	private String recordedByName;
-	private String recordedById;
+	private String recordedById;	
+	private String recordedDate;
 	private String createDate;
 	private int limit;
 	private int limitMax;
@@ -61,6 +62,12 @@ public class PatientPHRHistoryDTO {
 	public void setRecordedById(String recordedById) {
 		this.recordedById = recordedById;
 	}
+	public String getRecordedDate() {
+		return recordedDate;
+	}
+	public void setRecordedDate(String recordedDate) {
+		this.recordedDate = recordedDate;
+	}
 	public String getCreateDate() {
 		return createDate;
 	}

+ 8 - 1
src/main/java/com/lemon/lifecenter/dto/PatientSymptomSimDTO.java

@@ -24,7 +24,8 @@ public class PatientSymptomSimDTO {
 	private String etcCheck="N";
 	private String etcContent;
 	private String recordedByName;
-	private String recordedById;
+	private String recordedById;	
+	private String recordedDate;
 	private String createDate;
 	private int limit;
 	private int limitMax;	
@@ -148,6 +149,12 @@ public class PatientSymptomSimDTO {
 	}
 	public void setRecordedById(String recordedById) {
 		this.recordedById = recordedById;
+	}	
+	public String getRecordedDate() {
+		return recordedDate;
+	}
+	public void setRecordedDate(String recordedDate) {
+		this.recordedDate = recordedDate;
 	}
 	public String getCreateDate() {
 		return createDate;

+ 21 - 6
src/main/resources/mybatis/mapper/patient/patientMemo.xml

@@ -4,18 +4,18 @@
 <mapper namespace="com.lemon.lifecenter.mapper.PatientMemoMapper">
 	<insert id="insertMemo" parameterType="PatientMemoDTO" useGeneratedKeys="true">
 	<![CDATA[
-	    INSERT INTO patient_memo (patient_idx, contents, recorded_by_name, recorded_by_id, create_date)
+	    INSERT INTO patient_memo (patient_idx, contents, recorded_by_name, recorded_by_id, recorded_date, create_date)
        	VALUE (#{patientIdx}, #{contents}, #{recordedByName}, #{recordedById}
     ]]>
        	<choose>
-			<when test='createDate != null and createDate != ""'>
+			<when test='recordedDate != null and recordedDate != ""'>
 	            <![CDATA[
-		    	, #{createDate})
+		    	, #{recordedDate}, NOW())
 		    	]]>
 	        </when>
 	        <otherwise>
 	        	<![CDATA[
-       			, NOW())
+       			, NOW(), NOW())
        			]]>
       		</otherwise>
     	</choose>
@@ -33,7 +33,7 @@
 	    		create_date			AS createDate,
 	    		contents			AS contents,
 	    		recorded_by_name	AS recordedByName,
-	    		update_date			AS updateDate
+    			recorded_date		AS recordedDate
 		FROM patient_memo
 		WHERE 
 			patient_idx = #{patientIdx}
@@ -44,9 +44,24 @@
 	<![CDATA[
 	    UPDATE patient_memo
 	       SET contents = #{contents},
-	       	   update_date = NOW()
+	       	   
 	     WHERE idx = #{idx}
 	]]>
+       	<choose>
+			<when test='recordedDate != null and recordedDate != ""'>
+	            <![CDATA[
+		    	recorded_date = #{recordedDate}
+		    	]]>
+	        </when>
+	        <otherwise>
+	        	<![CDATA[
+       			recorded_date = NOW()
+       			]]>
+      		</otherwise>
+    	</choose>
+    <![CDATA[
+	     WHERE idx = #{idx}
+	]]>	
     </update>
     <delete id="deleteMemo" parameterType="PatientMemoDTO">
 	<![CDATA[

+ 6 - 4
src/main/resources/mybatis/mapper/patient/patientPHRHistory.xml

@@ -18,6 +18,7 @@
         </if>
 	<![CDATA[    	
 			, recorded_by_name
+			, recorded_date
 	    	, create_date)
        	VALUE (#{patientIdx}, #{phrType}, #{phrValue}
     ]]>
@@ -35,14 +36,14 @@
 			, #{recordedByName}
 	]]>
 		<choose>
-			<when test='createDate != null and createDate != ""'>
+			<when test='recordedDate != null and recordedDate != ""'>
 	            <![CDATA[
-		    	, #{createDate})
+		    	, #{recordedDate}, NOW())
 		    	]]>
 	        </when>
 	        <otherwise>
 	        	<![CDATA[
-       			, NOW())
+       			, NOW(), NOW())
        			]]>
       		</otherwise>
     	</choose>	
@@ -69,7 +70,8 @@
     	 ]]>
         </if>
 	<![CDATA[
-	    		recorded_by_name	AS recordedByName
+	    		recorded_by_name	AS recordedByName,
+	    		recorded_date		AS recordedDate
 		FROM patient_phr_history
 		WHERE 
 			patient_idx = #{patientIdx}

+ 6 - 5
src/main/resources/mybatis/mapper/patient/patientSymptomSim.xml

@@ -14,7 +14,7 @@
 	    	]]>
         </if>
 	<![CDATA[    	
-	    	, create_date)
+	    	, recorded_date, create_date)
         VALUE (#{patientIdx}, #{coughCheck}, #{dyspneaCheck}, #{coldFitCheck}, #{musclePainCheck}, #{headacheCheck}, #{soreThroatCheck}, 
         	#{smellPalateCheck}, #{fatigueCheck}, #{appetiteLossCheck}, #{sputumCheck}, #{ocinCheck}, #{vomitingCheck}, #{diarrheaCheck}, #{dizzinessCheck}, 
         	#{noseCheck}, #{etcCheck}, #{etcContent}, #{recordedByName}
@@ -25,14 +25,14 @@
 	    	]]>
         </if>
        	<choose>
-			<when test='createDate != null and createDate != ""'>
+			<when test='recordedDate != null and recordedDate != ""'>
 	            <![CDATA[
-		    	, #{createDate})
+		    	, #{recordedDate}, NOW())
 		    	]]>
 	        </when>
 	        <otherwise>
 	        	<![CDATA[
-       			, NOW())
+       			, NOW(), NOW())
        			]]>
       		</otherwise>
     	</choose>
@@ -65,7 +65,8 @@
 				etc_check           AS etcCheck,
 				etc_content         AS etcContent,
 				recorded_by_name	AS recordedByName,
-				recorded_by_id		AS recordedById
+				recorded_by_id		AS recordedById,
+				recorded_date		AS recordedDate
 		FROM patient_symptom_sim
 		WHERE 
 			patient_idx = #{patientIdx}