ソースを参照

엑셀 파일 내용에 환자명, 동호실 항목 추가

maengje 4 年 前
コミット
8eeba567fc

+ 153 - 91
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -402,33 +402,43 @@ public class ClinicController extends LifeCenterController {
         Cell cell2 = row.createCell(1);
         Cell cell3 = row.createCell(2);
         Cell cell4 = row.createCell(3);
+        Cell cell5 = row.createCell(4);
 
         cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
-        
+        cell5.setCellStyle(styleOfBoardFillFontBlackBold16);        
 
         sheet1.setColumnWidth( 0, 5000); //환자명
-        sheet1.setColumnWidth( 1, 5000); //기록일시
-        sheet1.setColumnWidth( 2, 3000); //값
-        sheet1.setColumnWidth( 3, 4000); //기록자
+        sheet1.setColumnWidth( 1, 5000); //동호실
+        sheet1.setColumnWidth( 2, 5000); //기록일시
+        sheet1.setColumnWidth( 3, 3000); //값
+        sheet1.setColumnWidth( 4, 4000); //기록자
         
         cell1.setCellValue("환자명");
-        cell2.setCellValue("기록일시");
+        cell2.setCellValue("동,호실");
+        cell3.setCellValue("기록일시");
         if (phrType.equals("temperature")) {
-        	cell3.setCellValue("체온");
+        	cell4.setCellValue("체온");
 		} else if (phrType.equals("bloodPressure")) {
-			cell3.setCellValue("혈압");
+			cell4.setCellValue("혈압");
 		} else if (phrType.equals("oxygenSaturation")) {
-			cell3.setCellValue("산소포화도");
+			cell4.setCellValue("산소포화도");
 		} else if (phrType.equals("pulseRate")) {
-			cell3.setCellValue("맥박");
+			cell4.setCellValue("맥박");
 		} else if (phrType.equals("bloodSugar")) {
-			cell3.setCellValue("혈당");
+			cell4.setCellValue("혈당");
 		}
         
-        cell4.setCellValue("기록자");
+        cell5.setCellValue("기록자");
+        
+        // 동,호실
+		String roomNumber = "";
+		if (!patientDto.getWardNumber().equals("")) {
+			roomNumber = patientDto.getWardNumber() + "동";
+		}
+		roomNumber += patientDto.getRoomNumber() + "호";
         
         for (PatientPHRHistoryDTO dto : data) {
             row = sheet1.createRow(i);
@@ -436,6 +446,7 @@ public class ClinicController extends LifeCenterController {
             cell2 = row.createCell(1);
             cell3 = row.createCell(2);
 			cell4 = row.createCell(3);
+			cell5 = row.createCell(4);
 
 			// 일시
 			String createDate = null;
@@ -462,24 +473,37 @@ public class ClinicController extends LifeCenterController {
 			// 기록자
 			String recordedByName = dto.getRecordedByName();
 
-			cell1.setCellValue( patientDto.getPatientName() );
-			cell2.setCellValue( createDate );
+			cell1.setCellValue(patientDto.getPatientName());
+			cell2.setCellValue(roomNumber);
+			
+			cell3.setCellValue(createDate);
 			if (phrType.equals("bloodPressure")) {
-				cell3.setCellValue( phrValue + "/" + phrValue2 );
+				cell4.setCellValue(phrValue + "/" + phrValue2);
 			} else {
-				cell3.setCellValue( phrValue );
+				cell4.setCellValue(phrValue);
 			}
 			
-            cell4.setCellValue( recordedByName );
+            cell5.setCellValue(recordedByName);
 
             i++;
+        }     
+        
+       String phrTypeString = "체온";              
+               
+        switch (phrType) {
+        case "oxygenSaturation":
+        	phrTypeString = "산소포화도";
+        	break;
+        case "bloodPressure":
+        	phrTypeString = "혈압";
+        	break;
+        case "pulseRate":
+        	phrTypeString = "맥박";
+        	break;
+        case "bloodSugar":
+        	phrTypeString = "혈당";
+        	break;
         }
-
-        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(".");
@@ -495,7 +519,7 @@ public class ClinicController extends LifeCenterController {
         	
 			String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
 			// 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
-			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_" + phrType + "_" + timestamp + ".xlsx";
+			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_" + phrTypeString + "_" + timestamp + ".xlsx";
 			String tempPath = directoryName + downName;
             
       
@@ -557,6 +581,8 @@ public class ClinicController extends LifeCenterController {
         Cell cell16 = row.createCell(15);
         Cell cell17 = row.createCell(16);
         Cell cell18 = row.createCell(17);
+        Cell cell19 = row.createCell(18);
+        Cell cell20 = row.createCell(19);
 
         cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
@@ -576,45 +602,58 @@ public class ClinicController extends LifeCenterController {
         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); // 기록자
+        cell19.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell20.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); // 기록자
         
-        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("기록자");
+        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("기록자");
         
+        // 동,호실
+		String roomNumber = "";
+		if (!patientDto.getWardNumber().equals("")) {
+			roomNumber = patientDto.getWardNumber() + "동";
+		}
+		roomNumber += patientDto.getRoomNumber() + "호";
+     			
         for (int index = data.size() - 1; index >= 0; index--) {
         	PatientSymptomSimDTO dto = data.get(index);
             row = sheet1.createRow(i);
@@ -625,7 +664,7 @@ public class ClinicController extends LifeCenterController {
 			cell5 = row.createCell(4);
             cell6 = row.createCell(5);
             cell7 = row.createCell(6);
-			    cell8 = row.createCell(7);
+		    cell8 = row.createCell(7);
 			cell9 = row.createCell(8);
             cell10 = row.createCell(9);
             cell11 = row.createCell(10);
@@ -636,6 +675,8 @@ public class ClinicController extends LifeCenterController {
 			cell16 = row.createCell(15);
 			cell17 = row.createCell(16);
 			cell18 = row.createCell(17);
+			cell19 = row.createCell(18);
+			cell20 = row.createCell(19);
 			
 			String createDate = null;
 			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@@ -647,24 +688,26 @@ public class ClinicController extends LifeCenterController {
 				createDate = dto.getCreateDate();
 			}			
 			
-			cell1.setCellValue(createDate);			
-			cell2.setCellValue(dto.getCoughCheck().equals("Y") ? "V" : "-");
-			cell3.setCellValue(dto.getDyspneaCheck().equals("Y") ? "V" : "-");
-			cell4.setCellValue(dto.getColdFitCheck().equals("Y") ? "V" : "-");
-			cell5.setCellValue(dto.getMusclePainCheck().equals("Y") ? "V" : "-");
-			cell6.setCellValue(dto.getHeadacheCheck().equals("Y") ? "V" : "-");
-			cell7.setCellValue(dto.getSoreThroatCheck().equals("Y") ? "V" : "-");
-			cell8.setCellValue(dto.getSmellPalateCheck().equals("Y") ? "V" : "-");
-			cell9.setCellValue(dto.getFatigueCheck().equals("Y") ? "V" : "-");
-			cell10.setCellValue(dto.getAppetiteLossCheck().equals("Y") ? "V" : "-");
-			cell11.setCellValue(dto.getSputumCheck().equals("Y") ? "V" : "-");
-			cell12.setCellValue(dto.getOcinCheck().equals("Y") ? "V" : "-");
-			cell13.setCellValue(dto.getVomitingCheck().equals("Y") ? "V" : "-");
-			cell14.setCellValue(dto.getDiarrheaCheck().equals("Y") ? "V" : "-");
-			cell15.setCellValue(dto.getDizzinessCheck().equals("Y") ? "V" : "-");
-			cell16.setCellValue(dto.getNoseCheck().equals("Y") ? "V" : "-");
-			cell17.setCellValue(dto.getEtcCheck().equals("Y") ? dto.getEtcContent() : "-");			
-			cell18.setCellValue(dto.getRecordedByName());
+			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());
 
             i++;
         }
@@ -679,7 +722,7 @@ public class ClinicController extends LifeCenterController {
         	
 			String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
 			// 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
-			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_symptom_" + timestamp + ".xlsx";
+			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_임상증상_" + timestamp + ".xlsx";
 			String tempPath = directoryName + downName;
             
       
@@ -726,18 +769,33 @@ 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 cell5 = row.createCell(4);
 
         cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
         cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
+        cell5.setCellStyle(styleOfBoardFillFontBlackBold16);
 
-        sheet1.setColumnWidth( 0, 5000); // 기록일시
-        sheet1.setColumnWidth( 1, 20000); // 내용 
-        sheet1.setColumnWidth( 2, 3000); // 기록자
+        sheet1.setColumnWidth(0, 5000); // 환자명
+        sheet1.setColumnWidth(1, 5000); // 동호실
+        sheet1.setColumnWidth(2, 5000); // 기록일시
+        sheet1.setColumnWidth(3, 20000); // 내용 
+        sheet1.setColumnWidth(4, 3000); // 기록자
               
-        cell1.setCellValue("기록일시");
-        cell2.setCellValue("내용");
-        cell3.setCellValue("기록자");
+        cell1.setCellValue("환자명");
+        cell2.setCellValue("동,호실");
+        cell3.setCellValue("기록일시");
+        cell4.setCellValue("내용");
+        cell5.setCellValue("기록자");
+        
+        // 동,호실
+		String roomNumber = "";
+		if (!patientDto.getWardNumber().equals("")) {
+			roomNumber = patientDto.getWardNumber() + "동";
+		}
+		roomNumber += patientDto.getRoomNumber() + "호";
         
         for (int index = data.size() - 1; index >= 0; index--) {
         	PatientMemoDTO dto = data.get(index);
@@ -745,6 +803,8 @@ public class ClinicController extends LifeCenterController {
             cell1 = row.createCell(0);
             cell2 = row.createCell(1);
             cell3 = row.createCell(2);
+            cell4 = row.createCell(3);
+            cell5 = row.createCell(4);
 			
 			String createDate = null;
 			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@@ -756,14 +816,16 @@ public class ClinicController extends LifeCenterController {
 				createDate = dto.getCreateDate();
 			}			
 			
-			cell1.setCellValue(createDate);
-			cell2.setCellValue(dto.getContents());		
-			cell3.setCellValue(dto.getRecordedByName());			
+			cell1.setCellValue(patientDto.getPatientName());
+			cell2.setCellValue(roomNumber);
+			cell3.setCellValue(createDate);
+			cell4.setCellValue(dto.getContents());		
+			cell5.setCellValue(dto.getRecordedByName());			
 			
 			CellStyle cs = workbook.createCellStyle();
 		    cs.setWrapText(true);
 		    cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //높이 가운데 정렬
-		    cell2.setCellStyle(cs);
+		    cell4.setCellStyle(cs);
 
             i++;
         }
@@ -778,7 +840,7 @@ public class ClinicController extends LifeCenterController {
         	
 			String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
 			// 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
-			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_memo_" + timestamp + ".xlsx";
+			String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_의료진메모_" + timestamp + ".xlsx";
 			String tempPath = directoryName + downName;