浏览代码

엑셀 다운로드 파일명 수정

maengje 4 年之前
父节点
当前提交
19134f0604
共有 1 个文件被更改,包括 54 次插入58 次删除
  1. 54 58
      src/main/java/com/lemon/lifecenter/controller/ClinicController.java

+ 54 - 58
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -337,35 +337,32 @@ public class ClinicController extends LifeCenterController {
         Cell cell1 = row.createCell(0);
         Cell cell2 = row.createCell(1);
         Cell cell3 = row.createCell(2);
-				Cell cell4 = row.createCell(3);
+        Cell cell4 = row.createCell(3);
 
         cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
 
-				sheet1.setColumnWidth( 0, 5000); //환자명
+        sheet1.setColumnWidth( 0, 5000); //환자명
         sheet1.setColumnWidth( 1, 5000); //기록일시
         sheet1.setColumnWidth( 2, 3000); //값
         sheet1.setColumnWidth( 3, 4000); //기록자
         
-				cell1.setCellValue("환자명");
+        cell1.setCellValue("환자명");
         cell2.setCellValue("기록일시");
-				if (phrType.equals("temperature")) {
+        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("혈당");
-				}
+		} 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) {
@@ -373,43 +370,41 @@ public class ClinicController extends LifeCenterController {
             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 = 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++;
@@ -419,7 +414,7 @@ public class ClinicController extends LifeCenterController {
         cell1 = row.createCell(2);
         cell2 = row.createCell(3);
         cell3 = row.createCell(4);
-				cell4 = row.createCell(4);
+        cell4 = row.createCell(4);
         
         try {
 //            File file = new File(".");
@@ -433,9 +428,10 @@ public class ClinicController extends LifeCenterController {
         		directory.mkdir();
         	}
         	
-			String timestamp = LifeCenterFunction.getNow("yyyyMMdd_HHmmss");
-			String downName = Integer.toString(patientDto.getPatientIdx()) + "_" + phrType + "_" + timestamp + ".xlsx";
-      String tempPath = directoryName + downName;
+			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);