Bladeren bron

Merge remote-tracking branch 'origin/simplatform'

junekeunsong 4 jaren geleden
bovenliggende
commit
b5c6a98925

+ 204 - 98
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -206,7 +206,7 @@ public class ClinicController extends LifeCenterController {
 	}
 
 	@RequestMapping("/api/state")
-	public @ResponseBody List<PatientPHRLatestDTO> state(HttpServletRequest request,
+	public @ResponseBody List<PatientPHRLatestDTO> getStateAPI(HttpServletRequest request,
 			@RequestParam(value = "page", required = true, defaultValue = "1") int page,
 			@RequestParam(value = "searchText", required = false, defaultValue = "") String searchText) {
 
@@ -229,7 +229,7 @@ public class ClinicController extends LifeCenterController {
 	}
 
 	@RequestMapping("/api/phrDatas")
-	public @ResponseBody List<PatientPHRHistoryDTO> phrDatas(
+	public @ResponseBody List<PatientPHRHistoryDTO> getPhrDatasAPI(
 			@RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx,
 			@RequestParam(value = "phrType", required = true, defaultValue = "temperature") String phrType) {
 
@@ -242,7 +242,7 @@ public class ClinicController extends LifeCenterController {
 	}
 
 	@RequestMapping(value = "/api/phrData", method = RequestMethod.POST)
-	public @ResponseBody String insertPhrData(@ModelAttribute("dto") final PatientPHRHistoryDTO dto) {
+	public @ResponseBody String insertPhrDataAPI(@ModelAttribute("dto") final PatientPHRHistoryDTO dto) {
 
 		try {
 			phrService.insertPHR(dto);
@@ -264,7 +264,7 @@ public class ClinicController extends LifeCenterController {
 	}
 
 	@RequestMapping("/api/symptomDatas")
-	public @ResponseBody List<PatientSymptomSimDTO> symptomDatas(
+	public @ResponseBody List<PatientSymptomSimDTO> getSymptomDatasAPI(
 			@RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx) {
 
 		PatientSymptomSimDTO dto = new PatientSymptomSimDTO();
@@ -275,7 +275,7 @@ public class ClinicController extends LifeCenterController {
 	}
 
 	@RequestMapping(value = "/api/symptomData", method = RequestMethod.POST)
-	public @ResponseBody String symptomData(@ModelAttribute("dto") final PatientSymptomSimDTO dto) {
+	public @ResponseBody String insertSymptomDataAPI(@ModelAttribute("dto") final PatientSymptomSimDTO dto) {
 
 		try {
 			phrService.insertSymptom(dto);
@@ -297,7 +297,7 @@ public class ClinicController extends LifeCenterController {
 	}
 
 	@RequestMapping("/api/memoDatas")
-	public @ResponseBody List<PatientMemoDTO> memoDatas(
+	public @ResponseBody List<PatientMemoDTO> getMemoDatasAPI(
 			@RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx) {
 
 		PatientMemoDTO dto = new PatientMemoDTO();
@@ -307,7 +307,7 @@ public class ClinicController extends LifeCenterController {
 	}
 
 	@RequestMapping(value = "/api/memoData", method = RequestMethod.POST)
-	public @ResponseBody String memoData(@ModelAttribute("dto") final PatientMemoDTO dto) {
+	public @ResponseBody String insertMemoDataAPI(@ModelAttribute("dto") final PatientMemoDTO dto) {
 
 		try {
 			clinicService.insertMemo(dto);
@@ -328,6 +328,50 @@ public class ClinicController extends LifeCenterController {
 		}
 	}
 
+  @RequestMapping(value = "/api/memoData", method = RequestMethod.DELETE)
+	public @ResponseBody String deleteMemoDataAPI(@ModelAttribute("dto") final PatientMemoDTO dto) {
+
+		try {
+			clinicService.deleteMemo(dto);
+
+			JSONObject json = new JSONObject();
+
+			json.put("code", "00");
+			json.put("message", "");
+
+			return json.toString();
+		} catch (Exception e) {
+			JSONObject json = new JSONObject();
+
+			json.put("code", "01");
+			json.put("message", e.getLocalizedMessage());
+
+			return json.toString();
+		}
+	}
+
+  @RequestMapping(value = "/api/memoData", method = RequestMethod.PATCH)
+	public @ResponseBody String updateMemoDataAPI(@ModelAttribute("dto") final PatientMemoDTO dto) {
+
+		try {
+			clinicService.updateMemo(dto);
+
+			JSONObject json = new JSONObject();
+
+			json.put("code", "00");
+			json.put("message", "");
+
+			return json.toString();
+		} catch (Exception e) {
+			JSONObject json = new JSONObject();
+
+			json.put("code", "01");
+			json.put("message", e.getLocalizedMessage());
+
+			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");
@@ -358,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);
@@ -392,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;
@@ -418,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(".");
@@ -451,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;
             
       
@@ -513,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);
@@ -532,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);
@@ -581,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);
@@ -592,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");
@@ -603,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++;
         }
@@ -635,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;
             
       
@@ -682,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);
@@ -701,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");
@@ -712,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++;
         }
@@ -734,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;
             
       

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

@@ -1,15 +1,27 @@
 package com.lemon.lifecenter.dto;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+
 public class PatientMemoDTO {
 
+	private int idx;
 	private int patientIdx;
 	private String contents;
 	private String recordedByName;
 	private String recordedById;
 	private String createDate;
+	private String updateDate;
 	private int limit;
 	private int limitMax;
 	
+	public int getIdx() {
+        return idx;
+    }
+    public void setIdx(int idx) {
+        this.idx = idx;
+    }
 	public int getPatientIdx() {
 		return patientIdx;
 	}
@@ -40,6 +52,12 @@ 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;
 	}
@@ -52,4 +70,12 @@ public class PatientMemoDTO {
 	public void setLimitMax(int limitMax) {
 		this.limitMax = limitMax;
 	}
+	public boolean getCanModify() {
+		LocalDateTime today = LocalDateTime.now();
+		LocalDateTime targetDay = LocalDateTime.parse(this.createDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
+
+		long hours = ChronoUnit.HOURS.between(targetDay, today);
+
+		return hours < 24;
+	}
 }

+ 4 - 0
src/main/java/com/lemon/lifecenter/mapper/PatientMemoMapper.java

@@ -16,4 +16,8 @@ public interface PatientMemoMapper {
 	
 	public void selectMemoCount(PatientPHRHistoryDTO dto);
 	public List<PatientMemoDTO> selectMemoList(PatientMemoDTO dto);
+	
+	public void updateMemo(PatientMemoDTO dto);
+	
+	public void deleteMemo(PatientMemoDTO dto);
 }

+ 8 - 0
src/main/java/com/lemon/lifecenter/service/ClinicService.java

@@ -38,4 +38,12 @@ public class ClinicService {
     public List<PatientMemoDTO> selectMemoList(PatientMemoDTO dto) {
         return mapperMemo.selectMemoList(dto);
     }
+    
+    public void updateMemo(PatientMemoDTO dto) {
+		mapperMemo.updateMemo(dto);
+	}
+    
+    public void deleteMemo(PatientMemoDTO dto) {
+		mapperMemo.deleteMemo(dto);
+	}
 }

+ 20 - 3
src/main/resources/mybatis/mapper/patient/patientMemo.xml

@@ -20,7 +20,7 @@
       		</otherwise>
     	</choose>
 	</insert>
-	 <select id="selectMemoCount" parameterType="PatientMemoDTO" resultType="int">
+	<select id="selectMemoCount" parameterType="PatientMemoDTO" resultType="int">
 	<![CDATA[
 	    SELECT count(*) AS total
 		FROM patient_memo
@@ -29,13 +29,30 @@
     </select>
     <select id="selectMemoList" parameterType="PatientMemoDTO" resultType="PatientMemoDTO">
     <![CDATA[
-	    SELECT	create_date			AS createDate,
+	    SELECT	idx,
+	    		create_date			AS createDate,
 	    		contents			AS contents,
-	    		recorded_by_name	AS recordedByName
+	    		recorded_by_name	AS recordedByName,
+	    		update_date			AS updateDate
 		FROM patient_memo
 		WHERE 
 			patient_idx = #{patientIdx}
 		ORDER BY create_date DESC, idx DESC
 	]]>
     </select>
+    <update id="updateMemo" parameterType="PatientMemoDTO">
+	<![CDATA[
+	    UPDATE patient_memo
+	       SET contents = #{contents},
+	       	   update_date = NOW()
+	     WHERE idx = #{idx}
+	]]>
+    </update>
+    <delete id="deleteMemo" parameterType="PatientMemoDTO">
+	<![CDATA[
+	    DELETE 
+	      FROM patient_memo
+	     WHERE idx = #{idx}
+	]]>
+    </delete>
 </mapper>

+ 123 - 16
src/main/webapp/WEB-INF/jsp/clinic/info.jsp

@@ -498,7 +498,7 @@ function retrieveSymptomData() {
  * 메모 탭 처리
  */
 
- function handleMemoData() {
+function insertMemoData() {
 
 	 var memoContent = $("#memoContent").val().trim();
 
@@ -508,14 +508,54 @@ function retrieveSymptomData() {
 		return;
 	}
 
-	createMemoData(memoContent);
-
-	$("#memoContent").val("");
+	requestInsertMemoData(memoContent);
 
 	$("#defaultModalPrimaryMemo").modal("hide");
 }
 
-function createMemoData(memoContent) {
+function deleteMemoData() {
+
+	const memoId = $("#defaultModalPrimaryMemo").data("memoid");
+
+	if (memoId === undefined || memoId === null || memoId === "") {
+    alert("오류! 삭제할 메모를 찾을 수 없습니다.");
+    return;
+  }
+
+  const result = confirm("메모를 삭제하시겠습니까?\n삭제후에는 복구가 불가능 합니다.");
+  if(result){
+    requestDeleteMemoData(memoId);
+  
+  $("#defaultModalPrimaryMemo").modal("hide");
+  }  
+}
+
+function modifyMemoData() {
+
+	const memoId = $("#defaultModalPrimaryMemo").data("memoid");
+
+	if (memoId === undefined || memoId === null || memoId === "") {
+    alert("오류! 삭제할 메모를 찾을 수 없습니다.");
+    return;
+  }
+
+  var memoContent = $("#memoContent").val().trim();
+
+	if (!memoContent) {
+		alert("메모 내용을 입력해 주세요.");
+		$("#memoContent").val("");
+		return;
+	}
+
+  const result = confirm("메모를 수정하시겠습니까?");
+  if(result){
+    requestUpdateMemoData(memoId, memoContent);
+  
+  $("#defaultModalPrimaryMemo").modal("hide");
+  }  
+}
+
+function requestInsertMemoData(memoContent) {
 	
 	$.ajax({
         url      : "./api/memoData",
@@ -531,6 +571,42 @@ function createMemoData(memoContent) {
     });
 }
 
+function requestDeleteMemoData(memoIdx) {
+	
+	$.ajax({
+        url      : "./api/memoData",
+        data     : {idx:memoIdx},
+        method   : "DELETE",
+        dataType : "json",
+        success  : function( datas ){
+
+            retrieveMemoData();
+        },
+        error : ajaxErrorHandler
+    }).done( function(){
+    });
+}
+
+function requestUpdateMemoData(memoIdx, memoContent) {
+	
+	$.ajax({
+        url      : "./api/memoData",
+        data     : {idx:memoIdx, contents:memoContent},
+        method   : "PATCH",
+        dataType : "json",
+        success  : function( datas ){
+          if (datas.code === "00") {
+            retrieveMemoData();
+          }
+          else {
+            alert("메모 수정 실패.\n" + datas.code);
+          }
+        },
+        error : ajaxErrorHandler
+    }).done( function(){
+    });
+}
+
 function retrieveMemoData() {
 	var ignoreCache = moment().unix();
 	var params = {patientIdx: ${patientIdx}, ignoreCache:ignoreCache};
@@ -547,8 +623,13 @@ function retrieveMemoData() {
 				html = "";
 				contents = datas.forEach(function(d) {
 					html += "<tr>";
-					html += "<td>" + gridDateFormatter(d.createDate) + "</td>";
-					html += "<td><pre>" + d.contents + "</pre></td>";
+          html += "<td>" + gridDateFormatter(d.updateDate) + "</td>";
+          if (d.canModify) {
+            html += "<td><pre id='memo_"+d.idx+"' class='contentsEdit' onClick='modifyMemo("+d.idx+")'>" + d.contents + "</pre></td>";
+          }
+          else {
+            html += "<td><pre>" + d.contents + "</pre></td>";
+          }
 					html += "<td>" + d.recordedByName + "</td>";
 					html += "</tr>";
 				});
@@ -794,7 +875,7 @@ $(document).ready(function() {
 	});
 
 	// 의료진 메모 추가 클릭 이벤트
-	$(document).on('click','[data-target="#defaultModalPrimaryMemo"]',function(){
+	$(document).on('click','.addMemo',function(){
 		var memoInfoHTML = '';
 			memoInfoHTML += '<th>내용</th>';
 			memoInfoHTML += '<td>';
@@ -803,14 +884,35 @@ $(document).ready(function() {
 			memoInfoHTML += '	</div>';
 			memoInfoHTML += '</td>';
 		
-		$('#memoInfo').html(memoInfoHTML);
+    $('#memoInfo').html(memoInfoHTML);
+    $('.addMemoTools').show();
+    $('.modifMemoTools').hide();
+    $('#defaultModalPrimaryMemo').modal();
 		setTimeout(function (){
 			$('#memoInfo').find('.form-row textarea').focus();
-		}, 500);
-		
-	});
+    }, 500);
+  });
 });
 
+function modifyMemo(memoId) {
+  $("#defaultModalPrimaryMemo").data("memoid", memoId);
+  const content = $("#memo_"+memoId).html();
+  var memoInfoHTML = '';
+			memoInfoHTML += '<th>내용</th>';
+			memoInfoHTML += '<td>';
+			memoInfoHTML += '	<div class="form-row">';
+			memoInfoHTML += '		<textarea id="memoContent" class="form-control" rows="15" placeholder="내용을 입력하세요">'+content+'</textarea>';
+			memoInfoHTML += '	</div>';
+			memoInfoHTML += '</td>';
+		
+    $('#memoInfo').html(memoInfoHTML);
+    $('.addMemoTools').hide();
+    $('.modifMemoTools').show();
+    $('#defaultModalPrimaryMemo').modal();
+		setTimeout(function (){
+			$('#memoInfo').find('.form-row textarea').focus();
+    }, 500);
+}
 
 </script>
 </head>
@@ -934,7 +1036,7 @@ $(document).ready(function() {
 		</div>
 	</div>
 
-	<div class="modal fade" id="defaultModalPrimaryMemo" tabindex="-1" role="dialog" aria-hidden="true">
+	<div class="modal fade" id="defaultModalPrimaryMemo" tabindex="-1" role="dialog" aria-hidden="true" data-memoid="">
 		<div class="modal-dialog" role="document">
 			<div class="modal-content">
 				<div class="modal-header">
@@ -961,9 +1063,14 @@ $(document).ready(function() {
 						</tr>
 					</table>
 				</div>
-				<div class="modal-footer">
+        <div class="addMemoTools modal-footer">
+					<button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
+					<button type="button" class="btn btn-primary" onclick="insertMemoData()">등록</button>
+				</div>
+				<div class="modifMemoTools modal-footer">
+					<button type="button" class="removeMemo btn btn-danger" onclick="deleteMemoData()">삭제</button>
 					<button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
-					<button type="button" class="btn btn-primary" onclick="handleMemoData()">등록</button>
+					<button type="button" class="btn btn-primary" onclick="modifyMemoData()">수정</button>
 				</div>
 			</div>
 		</div>
@@ -1123,7 +1230,7 @@ $(document).ready(function() {
 									<div class="card-header">
 										<h1 class="h4">
 											- 의료진 메모
-											<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#defaultModalPrimaryMemo">메모추가</button>
+											<button type="button" class="addMemo btn btn-primary ml-2" data-toggle="modal">메모추가</button>
 										<button class="btn btn-success text-right" style="float:right;" onclick="getExcel('memo');">Excel 다운로드</button>
 										</h1>
 									</div>

+ 29 - 1
src/main/webapp/resources/css/common/classic.css

@@ -179,4 +179,32 @@ div.daterangepicker div.calendar-time{margin-top:10px !important;margin:10px !im
 div.daterangepicker div.calendar-time>select{height:30px !important;font-size:14px !important;width:28% !important;min-width:50px;}
 div.daterangepicker select.monthselect,
 div.daterangepicker select.yearselect{height:30px !important;font-size:14px !important;border:1px solid #d0d0d0 !important;}
-div.daterangepicker select.ampmselect{float:left;margin:0 10px 0 0 !important;}
+div.daterangepicker select.ampmselect{float:left;margin:0 10px 0 0 !important;}
+
+/* 의료진 메모 수정 추가되는 CSS */
+.contentsEdit {
+  position: relative;
+  padding-right: 20px;
+  cursor: pointer;
+  z-index: 1;
+}
+.contentsEdit:after {
+  content: "\F3EA";
+  font-family: 'Material Design Icons';
+  position: absolute;
+  top: 50%;
+  right: 0px;
+  font-size: 20px;
+  line-height: 1;
+  color: #999999;
+  transform: translateY(-50%);
+  -webkit-transform: translateY(-50%);
+  -moz-transform: translateY(-50%);
+  -ms-transform: translateY(-50%);
+  -o-transform: translateY(-50%);
+}
+.contentsEdit:hover,
+.contentsEdit:hover:after {
+  color: #47bac1;
+}
+/* 의료진 메모 수정 추가되는 CSS */