Browse Source

[phr] 진료관리 상세 데이터 조회 후 display 코드 오류 수정.

sjpark 4 years ago
parent
commit
ebc96e816f
1 changed files with 57 additions and 56 deletions
  1. 57 56
      src/main/webapp/WEB-INF/jsp/clinic/info.jsp

+ 57 - 56
src/main/webapp/WEB-INF/jsp/clinic/info.jsp

@@ -6,39 +6,6 @@
 <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
 <script>
 
-$(document).ready(function() {
-
-	// 최초 로드시 phrData 체온이 로드됨. 해당 데이터 차트 그려줌.
-	var datas = [];
-	<c:forEach var="phr" items="${phrItems}" varStatus="status">
-	datas.push({createDate: "${phr.createDate}", phrValue: "${phr.phrValue}"});
-	</c:forEach>
-	
-	drawPhrChart(datas, "체온");
-
-	// 상단 환자 정보 영역 토글 이벤트
-	$('.toggle .card-header a.toggleBtn').click(function () {
-		$('.toggle .card-header a.toggleBtn').toggleClass('active');
-		$('.toggle .user-info').toggleClass('active');
-	})
-	
-	// 탭 클릭 이벤트
-	$(document).on('click','.tab-item',function(){
-		var targetTab = $(this).attr('tab-index');
-		$('.tab-item').removeClass('active');
-		$('.tab').removeClass('in');
-		$(this).addClass('active');
-		$(targetTab).addClass('in');
-
-		if (targetTab==="#tabPhr") {
-			retrievePhrData();
-		}
-		else if (targetTab==="#tabSymptom") {
-			retrieveSymptomData();
-		}
-	});
-});
-
 function retrievePhrData() {
 	var phrType = $("#phrTypeSelect option:selected").val();
 	var phrName = $("#phrTypeSelect option:selected").text();
@@ -62,13 +29,13 @@ function retrievePhrData() {
 			html += "<tbody>";
 			var contents = "<tr><td colspan=3>데이터가 없습니다.</td></tr>" ;
 			if (datas.length > 0) {
-				contents = datas.map(d => {
-					var h = "<tr>";
-					h += "<td>" + d.createDate + "</td>";
-					h += "<td><span class='text-danger'>" + d.phrValue + "</span></td>";
-					h += "<td>" + d.recordedBy + "</td>";
-					h += "</tr>";
-					return h;
+				contents = "";
+				datas.forEach(d => {
+					contents += "<tr>";
+					contents += "<td>" + d.createDate + "</td>";
+					contents += "<td><span class='text-danger'>" + d.phrValue + "</span></td>";
+					contents += "<td>" + d.recordedBy + "</td>";
+					contents += "</tr>";
 				});
 			};
 			html += contents;
@@ -83,6 +50,7 @@ function retrievePhrData() {
         console.log('done!');
     });
 }
+
 function retrieveSymptomData() {
 	var params = {patientIdx: ${patientIdx}};
 
@@ -94,26 +62,24 @@ function retrieveSymptomData() {
         success  : function( datas ){
             console.log(datas);
 
-           	var html = "";
-			var contents = "<tr><td colspan=10>데이터가 없습니다.</td></tr>" ;
+			var html = "<tr><td colspan=10>데이터가 없습니다.</td></tr>" ;
 			if (datas.length > 0) {
+				html = "";
 				contents = datas.map(d => {
-					var h = "<tr>";
-					h += "<th>" + d.createDate + "</th>";
-					h += "<td>" + d.coughCheck + "</td>";
-					h += "<td>" + d.dyspneaCheck + "</td>";
-					h += "<td>" + d.dolcFitCheck + "</td>";
-					h += "<td>" + d.musclePainCheck + "</td>";
-					h += "<td>" + d.headacheCheck + "</td>";
-					h += "<td>" + d.soreThroatCheck + "</td>";
-					h += "<td>" + d.smellPalateCheck + "</td>";
-					h += "<td>" + d.fatigueCheck + "</td>";
-					h += "<td>" + d.coughCheck + "</td>";
-					h += "</tr>";
-					return h;
+					html = "<tr>";
+					html += "<th>" + d.createDate + "</th>";
+					html += "<td>" + d.coughCheck + "</td>";
+					html += "<td>" + d.dyspneaCheck + "</td>";
+					html += "<td>" + d.dolcFitCheck + "</td>";
+					html += "<td>" + d.musclePainCheck + "</td>";
+					html += "<td>" + d.headacheCheck + "</td>";
+					html += "<td>" + d.soreThroatCheck + "</td>";
+					html += "<td>" + d.smellPalateCheck + "</td>";
+					html += "<td>" + d.fatigueCheck + "</td>";
+					html += "<td>" + d.coughCheck + "</td>";
+					html += "</tr>";
 				});
 			};
-			html += contents;
 
 			$("#symptomDataTable > tbody").html(html);
         },
@@ -152,6 +118,41 @@ function drawPhrChart(data, dataName) {
 	    }
 	});
 }
+
+$(document).ready(function() {
+
+	// 최초 로드시 phrData 체온이 로드됨. 해당 데이터 차트 그려줌.
+	var datas = [];
+	<c:forEach var="phr" items="${phrItems}" varStatus="status">
+	datas.push({createDate: "${phr.createDate}", phrValue: "${phr.phrValue}"});
+	</c:forEach>
+	
+	drawPhrChart(datas, "체온");
+
+	// 상단 환자 정보 영역 토글 이벤트
+	$('.toggle .card-header a.toggleBtn').click(function () {
+		$('.toggle .card-header a.toggleBtn').toggleClass('active');
+		$('.toggle .user-info').toggleClass('active');
+	})
+	
+	// 탭 클릭 이벤트
+	$(document).on('click','.tab-item',function(){
+		var targetTab = $(this).attr('tab-index');
+		$('.tab-item').removeClass('active');
+		$('.tab').removeClass('in');
+		$(this).addClass('active');
+		$(targetTab).addClass('in');
+
+		if (targetTab==="#tabPhr") {
+			retrievePhrData();
+		}
+		else if (targetTab==="#tabSymptom") {
+			retrieveSymptomData();
+		}
+	});
+});
+
+
 </script>
 </head>