瀏覽代碼

Merge remote-tracking branch 'origin/simplatform'

junekeunsong 4 年之前
父節點
當前提交
44831b1107

+ 93 - 1
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -1,19 +1,111 @@
 package com.lemon.lifecenter.controller;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.lemon.lifecenter.common.LifeCenterController;
+import com.lemon.lifecenter.common.LifeCenterSessionController;
+import com.lemon.lifecenter.dto.PatientPHRHistoryDTO;
+import com.lemon.lifecenter.dto.PatientPHRLatestDTO;
+import com.lemon.lifecenter.service.ClinicService;
+import com.lemon.lifecenter.service.PHRService;
+import com.lemon.lifecenter.service.PatientService;
 
 @Controller
 @RequestMapping("/clinic")
 public class ClinicController extends LifeCenterController {
+	
+	@Autowired
+	private ClinicService clinicService;
+	
+	@Autowired
+	private PHRService phrService;
+	
+	@Autowired
+	private PatientService patientService;
 
     @RequestMapping("/state")
-    public ModelAndView clinicState() {
+    public ModelAndView clinicState(
+    		HttpServletRequest request,
+    		@RequestParam(value="page", required=true, defaultValue="1") int page,
+    		@RequestParam(value="wardNumber", required=false, defaultValue="") String wardNumber,
+    		@RequestParam(value="patientName", required=false, defaultValue="") String patientName) {
+    	
+    	System.err.println( "page : " + page );
+    	
+    	final int pageSize = 18;
+    	String centerCode = "0000";//LifeCenterSessionController.getSession( request, "sesCenterCode" );
+        
+    	PatientPHRLatestDTO dto = new PatientPHRLatestDTO();
+        dto.setLimit( ( Integer.valueOf( page ) - 1 ) * pageSize );
+        dto.setLimitMax( pageSize );
+        dto.setCenterCode(centerCode);
+        dto.setWardNumber(wardNumber);
+        dto.setPatientName(patientName);
+        
+        int total = clinicService.selectPHRLatestCount(dto);
+        List<PatientPHRLatestDTO> result = new ArrayList<PatientPHRLatestDTO>();
+
+        if (total > 0) {
+            result = clinicService.selectPHRLatestList(dto);
+        }
+
         ModelAndView mv = setMV("clinic/state");
+        
+        mv.addObject("total", 18);
+        mv.addObject("items", result);
+        
+        return mv;
+    }
+    
+    @RequestMapping("/info")
+    public ModelAndView patientInfo(
+    		@RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
+    		@RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType) {
+    	
+    	String centerCode = "0000";//LifeCenterSessionController.getSession( request, "sesCenterCode" );
+        
+    	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);
+        }
+    	
+    	
+        ModelAndView mv = setMV("clinic/info");
+        
+        mv.addObject("patientIdx", patientIdx);
+        mv.addObject("phrType", phrType);
+        mv.addObject("phrTotal", total);
+        mv.addObject("phrItems", result);
 
         return mv;
     }
+    
+    @RequestMapping("/api/phrDatas")
+    public @ResponseBody List<PatientPHRHistoryDTO> phrDatas(
+    		@RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
+    		@RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType) {
+    	
+    	PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
+    	dto.setPatientIdx(patientIdx);
+        dto.setPhrType(phrType);
+        
+    	return phrService.selectPHRHistoryList(dto);
+    	
+    }
 }

+ 57 - 40
src/main/java/com/lemon/lifecenter/dto/PatientPHRLatestDTO.java

@@ -5,24 +5,41 @@ import org.springframework.stereotype.Repository;
 @Repository
 public class PatientPHRLatestDTO {
 
+	private int patientIdx;
 	private String patientName;
+	private String centerCode;	
 	private String wardNumber;
 	private String roomNumber;
-	private float fever;
-	private String feverCreateDate;
-	private int oxygenSaturation;
+	private Float temperature;
+	private String temperatureCreateDate;
+	private Integer oxygenSaturation;
 	private String oxygenSaturationCreateDate;
-	private int pulseRate;
+	private Integer pulseRate;
 	private String pulseRateCreateDate;
-	private int systolicBloodPressure;
+	private Integer systolicBloodPressure;
 	private String systolicBloodPressureCreateDate;
-	private int diastolicBloodPressure;
+	private Integer diastolicBloodPressure;
 	private String diastolicBloodPressureCreateDate;
-	private int bloodSugar;
+	private Integer bloodSugar;
 	private String bloodSugarCreateDate;
+	private int memoCount;
+	private String symptomLastDate;	
+	private String searchText;	
 	private int limit;
 	private int limitMax;
 	
+	public int getPatientIdx() {
+		return patientIdx;
+	}
+	public void setPatientIdx(int patientIdx) {
+		this.patientIdx = patientIdx;
+	}
+	public String getCenterCode() {
+		return centerCode;
+	}
+	public void setCenterCode(String centerCode) {
+		this.centerCode = centerCode;
+	}
 	public String getPatientName() {
 		return patientName;
 	}
@@ -41,19 +58,16 @@ public class PatientPHRLatestDTO {
 	public void setRoomNumber(String roomNumber) {
 		this.roomNumber = roomNumber;
 	}
-	public float getFever() {
-		return fever;
-	}
-	public void setFever(float fever) {
-		this.fever = fever;
+	public Float getTemperature() {
+		return temperature;
 	}
-	public String getFeverCreateDate() {
-		return feverCreateDate;
+	public void setTemperature(float temperature) {
+		this.temperature = temperature;
 	}
-	public void setFeverCreateDate(String feverCreateDate) {
-		this.feverCreateDate = feverCreateDate;
-	}
-	public int getOxygenSaturation() {
+	public String getTemperatureCreateDate() {
+		return temperatureCreateDate;
+	}	
+	public Integer getOxygenSaturation() {
 		return oxygenSaturation;
 	}
 	public void setOxygenSaturation(int oxygenSaturation) {
@@ -61,11 +75,8 @@ public class PatientPHRLatestDTO {
 	}
 	public String getOxygenSaturationCreateDate() {
 		return oxygenSaturationCreateDate;
-	}
-	public void setOxygenSaturationCreateDate(String oxygenSaturationCreateDate) {
-		this.oxygenSaturationCreateDate = oxygenSaturationCreateDate;
-	}
-	public int getPulseRate() {
+	}	
+	public Integer getPulseRate() {
 		return pulseRate;
 	}
 	public void setPulseRate(int pulseRate) {
@@ -73,11 +84,8 @@ public class PatientPHRLatestDTO {
 	}
 	public String getPulseRateCreateDate() {
 		return pulseRateCreateDate;
-	}
-	public void setPulseRateCreateDate(String pulseRateCreateDate) {
-		this.pulseRateCreateDate = pulseRateCreateDate;
-	}
-	public int getSystolicBloodPressure() {
+	}	
+	public Integer getSystolicBloodPressure() {
 		return systolicBloodPressure;
 	}
 	public void setSystolicBloodPressure(int systolicBloodPressure) {
@@ -85,11 +93,8 @@ public class PatientPHRLatestDTO {
 	}
 	public String getSystolicBloodPressureCreateDate() {
 		return systolicBloodPressureCreateDate;
-	}
-	public void setSystolicBloodPressureCreateDate(String systolicBloodPressureCreateDate) {
-		this.systolicBloodPressureCreateDate = systolicBloodPressureCreateDate;
-	}
-	public int getDiastolicBloodPressure() {
+	}	
+	public Integer getDiastolicBloodPressure() {
 		return diastolicBloodPressure;
 	}
 	public void setDiastolicBloodPressure(int diastolicBloodPressure) {
@@ -97,11 +102,8 @@ public class PatientPHRLatestDTO {
 	}
 	public String getDiastolicBloodPressureCreateDate() {
 		return diastolicBloodPressureCreateDate;
-	}
-	public void setDiastolicBloodPressureCreateDate(String diastolicBloodPressureCreateDate) {
-		this.diastolicBloodPressureCreateDate = diastolicBloodPressureCreateDate;
-	}
-	public int getBloodSugar() {
+	}	
+	public Integer getBloodSugar() {
 		return bloodSugar;
 	}
 	public void setBloodSugar(int bloodSugar) {
@@ -109,9 +111,24 @@ public class PatientPHRLatestDTO {
 	}
 	public String getBloodSugarCreateDate() {
 		return bloodSugarCreateDate;
+	}	
+	public int getMemoCount() {
+		return memoCount;
+	}
+	public void setMemoCount(int memoCount) {
+		this.memoCount = memoCount;
+	}
+	public String getSymptomLastDate() {
+		return symptomLastDate;
+	}
+	public void setSymptomLastDate(String symptomLastDate) {
+		this.symptomLastDate = symptomLastDate;
+	}
+	public String getSearchText() {
+		return searchText;
 	}
-	public void setBloodSugarCreateDate(String bloodSugarCreateDate) {
-		this.bloodSugarCreateDate = bloodSugarCreateDate;
+	public void setSearchText(String searchText) {
+		this.searchText = searchText;
 	}
 	public int getLimit() {
 		return limit;

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

@@ -1,7 +1,8 @@
 package com.lemon.lifecenter.dto;
 
-public class PatientSymptomDTO {
+public class PatientSymptomSimDTO {
 	
+	private int patientIdx;
 	private String coughCheck;
 	private String dyspneaCheck;	
 	private String coldFitCheck;
@@ -24,6 +25,12 @@ public class PatientSymptomDTO {
 	private int limit;
 	private int limitMax;	
 	
+	public int getPatientIdx() {
+		return patientIdx;
+	}
+	public void setPatientIdx(int patientIdx) {
+		this.patientIdx = patientIdx;
+	}	
 	public String getCoughCheck() {
 		return coughCheck;
 	}

+ 0 - 18
src/main/java/com/lemon/lifecenter/mapper/PatientSymptomMapper.java

@@ -1,18 +0,0 @@
-package com.lemon.lifecenter.mapper;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Mapper;
-import org.springframework.stereotype.Repository;
-
-import com.lemon.lifecenter.dto.PatientSymptomDTO;
-
-@Repository
-@Mapper
-public interface PatientSymptomMapper {
-
-public void insertSymptom(PatientSymptomDTO dto);
-	
-	public void selectSymptomCount(PatientSymptomDTO dto);
-	public List<PatientSymptomDTO> selectSymptomList(PatientSymptomDTO dto);
-}

+ 18 - 0
src/main/java/com/lemon/lifecenter/mapper/PatientSymptomSimMapper.java

@@ -0,0 +1,18 @@
+package com.lemon.lifecenter.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import com.lemon.lifecenter.dto.PatientSymptomSimDTO;
+
+@Repository
+@Mapper
+public interface PatientSymptomSimMapper {
+
+public void insertSymptom(PatientSymptomSimDTO dto);
+	
+	public int selectSymptomCount(PatientSymptomSimDTO dto);
+	public List<PatientSymptomSimDTO> selectSymptomList(PatientSymptomSimDTO dto);
+}

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

@@ -29,11 +29,11 @@ public class ClinicService {
     
     public List<PatientPHRLatestDTO> selectPHRLatestList(PatientPHRLatestDTO dto) {
         return mapperPHRLatest.selectPHRLatestList(dto);
-    }
+    }  
 	
 	public void insertMemo(PatientMemoDTO dto) {
 		mapperMemo.insertMemo(dto);
-	}
+	}	
 	
     public List<PatientMemoDTO> selectMemoList(PatientMemoDTO dto) {
         return mapperMemo.selectMemoList(dto);

+ 52 - 4
src/main/java/com/lemon/lifecenter/service/PHRService.java

@@ -6,23 +6,71 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.lemon.lifecenter.dto.PatientPHRHistoryDTO;
+import com.lemon.lifecenter.dto.PatientPHRLatestDTO;
+import com.lemon.lifecenter.dto.PatientSymptomSimDTO;
 import com.lemon.lifecenter.mapper.PatientPHRHistoryMapper;
+import com.lemon.lifecenter.mapper.PatientPHRLatestMapper;
+import com.lemon.lifecenter.mapper.PatientSymptomSimMapper;
 
 @Service
 public class PHRService {
 
 	@Autowired
-	private PatientPHRHistoryMapper mapper;
+	private PatientPHRHistoryMapper mapperHistory;
+	
+	@Autowired
+	private PatientPHRLatestMapper mapperPHRLatest;
+	
+	@Autowired
+	private PatientSymptomSimMapper mapperSymptom;
 	
 	public void insertPHR(PatientPHRHistoryDTO dto) {
-		mapper.insertPHRHistory(dto);
+		mapperHistory.insertPHRHistory(dto);
+		
+		PatientPHRLatestDTO phrLatestDTO = new PatientPHRLatestDTO();
+		phrLatestDTO.setPatientIdx(dto.getPatientIdx());
+		
+		switch (dto.getPhrType()) {
+			case "temperature":
+				phrLatestDTO.setTemperature(dto.getPhrValue());
+				break;
+			case "oxygenSaturation":
+				phrLatestDTO.setOxygenSaturation((int) dto.getPhrValue());
+				break;
+			case "pulseRate":
+				phrLatestDTO.setPulseRate((int) dto.getPhrValue());
+				break;
+			case "systolicBloodPressure":
+				phrLatestDTO.setSystolicBloodPressure((int) dto.getPhrValue());
+				break;
+			case "diastolicBloodPressure":
+				phrLatestDTO.setDiastolicBloodPressure((int) dto.getPhrValue());
+				break;
+			case "bloodSugar":
+				phrLatestDTO.setBloodSugar((int) dto.getPhrValue());
+				break;
+		}
+		
+		mapperPHRLatest.insertPHRLatest(phrLatestDTO);		
 	}
 	
 	public int selectPHRHistoryCount(PatientPHRHistoryDTO dto) {
-        return mapper.selectPHRHistoryCount(dto);
+        return mapperHistory.selectPHRHistoryCount(dto);
     }
     
     public List<PatientPHRHistoryDTO> selectPHRHistoryList(PatientPHRHistoryDTO dto) {
-        return mapper.selectPHRHistoryList(dto);
+        return mapperHistory.selectPHRHistoryList(dto);
+    }
+    
+    public void insertSymptom(PatientSymptomSimDTO dto) {
+    	mapperSymptom.insertSymptom(dto);
+    }
+    
+    public int selectSymptomCount(PatientSymptomSimDTO dto) {
+        return mapperSymptom.selectSymptomCount(dto);
+    }
+    
+    public List<PatientSymptomSimDTO> selectSymptomList(PatientSymptomSimDTO dto) {
+        return mapperSymptom.selectSymptomList(dto);
     }
 }

+ 32 - 15
src/main/resources/mybatis/mapper/patient/patientPHRLatest.xml

@@ -5,11 +5,11 @@
 	<insert id="insertPHRLatest" parameterType="PatientPHRLatestDTO" useGeneratedKeys="true">
 	<![CDATA[
 	    INSERT INTO patient_phr_latest (
-	    	patient_idx,
+	    	patient_idx
     ]]>
-	    <if test='fever != null and fever != ""'>
+	    <if test='temperature != null and temperature != ""'>
 	    <![CDATA[
-   			, fever, fever_create_date
+   			, temperature, temperature_create_date
 	    ]]>
 	    </if>
 	    <if test='oxygenSaturation != null and oxygenSaturation != ""'>
@@ -42,9 +42,9 @@
 	    ) VALUE (
 	    	#{patientIdx}
    	]]>
-   		<if test='fever != null and fever != ""'>
+   		<if test='temperature != null and temperature != ""'>
 	    <![CDATA[
-   			, #{fever}, NOW()
+   			, #{temperature}, NOW()
 	    ]]>
 	    </if>
 	    <if test='oxygenSaturation != null and oxygenSaturation != ""'>
@@ -73,12 +73,13 @@
 	    ]]>
 	    </if>
     <![CDATA[
+    		, NOW()
 	    )
 	    ON DUPLICATE KEY UPDATE update_date = NOW()
     ]]>
-	    <if test='fever != null and fever != ""'>
+	    <if test='temperature != null and temperature != ""'>
 	    <![CDATA[
-   			, fever = #{fever}, fever_create_date = NOW()
+   			, temperature = #{temperature}, temperature_create_date = NOW()
 	    ]]>
 	    </if>
 	    <if test='oxygenSaturation != null and oxygenSaturation != ""'>
@@ -110,18 +111,25 @@
     <select id="selectPHRLatestCount" parameterType="PatientPHRLatestDTO" resultType="int">
 	<![CDATA[
 	    SELECT count(*) AS total
-		FROM patient_phr_latest p INNER JOIN patient_care c ON p.patient_idx = c.patient_idx
+		FROM patient_care c LEFT JOIN patient_phr_latest p ON p.patient_idx = c.patient_idx
 		WHERE c.center_code = #{centerCode}
 	]]>
+		<if test='searchText != null and searchText != ""'>
+            <![CDATA[
+               AND (c.patient_name LIKE CONCAT('%', #{searchText}, '%') OR c.ward_number LIKE CONCAT('%', #{searchText}, '%'))
+            ]]>
+        </if>
     </select>
     <select id="selectPHRLatestList" parameterType="PatientPHRLatestDTO" resultType="PatientPHRLatestDTO">
     <![CDATA[
-   		SELECT	c.patient_name							AS patientName,
+   		SELECT	
+   				c.patient_idx							AS patientIdx,
+   				c.patient_name							AS patientName,
 	    		c.ward_number							AS wardNumber,
-	    		c_room_number							AS roomNumber,
-	    		p.fever									AS fever,
-	    		p.fever_create_Date						AS feverCreateDate,
-	    		p.oxygen_saturation						AS feverCreateDate,
+	    		c.room_number							AS roomNumber,
+	    		p.temperature							AS temperature,
+	    		p.temperature_create_date				AS temperatureCreateDate,
+	    		p.oxygen_saturation						AS oxygenSaturation,
 	    		p.oxygen_saturation_create_date 		AS oxygenSaturationCreateDate,
 	    		p.pulse_rate							AS pulseRate,
 	    		p.pulse_rate_create_date				AS pulseRateCreateDate,
@@ -130,9 +138,18 @@
    				p.diastolic_blood_pressure				AS diastolicBloodPressure,
     			p.diastolic_blood_pressure_create_date	AS diastolicBloodPressureCreateDate,
     			p.blood_sugar							AS bloodSugar,
-	    		p.blood_sugar_create_date				AS bloodSugarCreateDate
-		FROM patient_phr_latest p INNER JOIN patient_care c ON p.patient_idx = c.patient_idx
+	    		p.blood_sugar_create_date				AS bloodSugarCreateDate,
+	    		(SELECT count(*) FROM patient_memo m WHERE m.patient_idx = c.patient_idx) AS memoCount,
+	    		(SELECT s.create_date FROM patient_symptom_sim s WHERE s.patient_idx = c.patient_idx AND DATEDIFF(DATE(s.create_date), CURDATE()) = 0) AS symptomLastDate
+		FROM patient_care c LEFT JOIN patient_phr_latest p ON p.patient_idx = c.patient_idx
 		WHERE c.center_code = #{centerCode}
+	]]>
+		<if test='searchText != null and searchText != ""'>
+            <![CDATA[
+               AND (c.patient_name LIKE CONCAT('%', #{searchText}, '%') OR c.ward_number LIKE CONCAT('%', #{searchText}, '%'))
+            ]]>
+        </if>
+    <![CDATA[
 		ORDER BY c.room_number ASC
 		LIMIT #{limit}, #{limitMax}
 	]]>

+ 7 - 7
src/main/resources/mybatis/mapper/patient/patientSymptom.xml

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
-<mapper namespace="com.lemon.lifecenter.mapper.PatientSymptomMapper">
-	<insert id="insertSymptom" parameterType="PatientSymptomDTO" useGeneratedKeys="true">
+<mapper namespace="com.lemon.lifecenter.mapper.PatientSymptomSimMapper">
+	<insert id="insertSymptom" parameterType="PatientSymptomSimDTO" useGeneratedKeys="true">
 	<![CDATA[
-	    INSERT INTO patient_symptom (patient_idx, cough_check, dyspnea_check, cold_fit_check, muscle_pain_check, headache_check, sore_throat_check,
+	    INSERT INTO patient_symptom_sim (patient_idx, cough_check, dyspnea_check, cold_fit_check, muscle_pain_check, headache_check, sore_throat_check,
 	    	smell_palate_check, fatigue_check, appetite_loss_check, sputum_check, ocin_check, vomiting_check, diarrhea_check, dizziness_check,
 	    	nose_check, etc_check, etc_content, recorded_by, create_date)
         VALUE (#{patientIdx}, #{coughCheck}, #{dyspneaCheck}, #{coldFitCheck}, #{musclePainCheck}, #{headacheCheck}, #{soreThroatCheck}, 
@@ -12,14 +12,14 @@
         	#{noseCheck}, #{etcCheck}, #{etcContent}, #{recordedBy}, NOW())
 	]]>
 	</insert>
-    <select id="selectSymptomCount" parameterType="PatientSymptomDTO" resultType="int">
+    <select id="selectSymptomCount" parameterType="PatientSymptomSimDTO" resultType="int">
 	<![CDATA[
 	    SELECT count(*) AS total
-		FROM patient_symptom
+		FROM patient_symptom_sim
 		WHERE patient_idx = #{patientIdx}
 	]]>
     </select>
-    <select id="selectSymptomList" parameterType="PatientSymptomDTO" resultType="PatientSymptomDTO">
+    <select id="selectSymptomList" parameterType="PatientSymptomSimDTO" resultType="PatientSymptomSimDTO">
     <![CDATA[
 	    SELECT	create_date			AS createDate,
 	    		cough_check         AS  coughCheck,
@@ -40,7 +40,7 @@
 				etc_check           AS etcCheck,
 				etc_content         AS etcContent,
 				recorded_by			AS recordedBy
-		FROM patient_symptom
+		FROM patient_symptom_sim
 		WHERE 
 			patient_idx = #{patientIdx}		
 		ORDER BY create_date DESC

+ 765 - 0
src/main/webapp/WEB-INF/jsp/clinic/info.jsp

@@ -0,0 +1,765 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+    pageEncoding="UTF-8"%>
+<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
+<script>
+
+function changeButtonSelected(buttonId) {
+	var buttonIds = ["buttonPhr", "buttonSymptom", "buttonMemo"];
+
+	buttonIds.forEach(el => {
+		if (el === buttonId) {
+			$("#"+el).addClass("btn-success");
+			$("#"+el).removeClass("btn-outline-success");
+		}
+		else {
+			$("#"+el).removeClass("btn-success");
+			$("#"+el).addClass("btn-outline-success");
+		}
+	});
+}
+
+function changeTabSelected(tabId) {
+	var tabIds = ["tabPhr", "tabSymptom", "tabMemo"];
+
+	tabIds.forEach(el => {
+		if (el === tabId) {
+			$("#"+el).show();
+		}
+		else {
+			$("#"+el).hide();
+		}
+	});
+}
+
+function showUntactTab() {
+/* 	alert("비대면 진료를 실행합니다!"); */
+}
+
+function showPhrTab() {
+	changeButtonSelected("buttonPhr");
+	changeTabSelected("tabPhr");
+}
+
+function showSymptomTab() {
+	changeButtonSelected("buttonSymptom");
+	changeTabSelected("tabSymptom");
+}
+
+function showMemoTab() {
+	changeButtonSelected("buttonMemo");
+	changeTabSelected("tabMemo");
+}
+
+function retrievePhrData() {
+	var phrType = $("#phrTypeSelect option:selected").val();
+	var phrName = $("#phrTypeSelect option:selected").text();
+	var params = {patientIdx: ${patientIdx}, phrType: phrType};
+
+	$.ajax({
+        url      : "./api/phrDatas",
+        data     : params,
+        method   : "GET",
+        dataType : "json",
+        success  : function( datas ){
+            console.log(datas);
+
+           	var html = "<thead><tr>";
+			html += "<th>진료일시</th>";
+			html += "<th>"+phrName+"</th>";
+			html += "<th>진료담당자</th>";
+			html += "</tr></thead>";
+			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;
+				});
+			};
+			html += contents;
+			html += "</tbody>";
+
+			$("#phrDataTable").html(html);
+
+            
+/*             var resultCode = data.code;
+            var resultMsg  = data.message;
+            
+            if( data.code == "00" ) {
+                location.href="/patient/list";
+            } else {
+                $( "#password" ).after( "<label id='msg' class='error'>" + resultMsg + "</label>" );
+                $( "#submitLoading" ).toggleClass( "d-none", true );
+                $( "#submitBtn" ).toggleClass( "d-none", false );
+            }; */
+        },
+        error : function(){
+            console.error('error!');
+/*             $( "#submitLoading" ).toggleClass( "d-none", true );
+            $( "#submitBtn" ).toggleClass( "d-none", false ); */
+        }
+    }).done( function(){
+        console.log('done!');
+/*         if( $( "#saveId" ).is( ":checked" ) ) {
+            setCookie( "userInputId", $( "#id" ).val(), 365 );
+        } else {
+            deleteCookie( "userInputId" );
+        } */
+    });
+}
+</script>
+</head>
+
+<body>
+    <div class="wrapper">
+        <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>
+
+        <div class="main">
+            <jsp:include page="${data._INCLUDE}/top.jsp"></jsp:include>
+
+            <main class="content">
+            	<div class="container-fluid p-0">
+				<div class="row">
+					<div class="col-12 col-lg-6">
+						<h1 class="h3 mb-3">
+							건강정보 조회
+						</h1>
+					</div>
+					<div class="col-12 col-lg-6  text-right">
+						<nav aria-label="breadcrumb">
+							<ol class="breadcrumb">
+								<li class="breadcrumb-item"><a href="javscript:;">Home</a></li>
+								<li class="breadcrumb-item">진료관리</li>
+								<li class="breadcrumb-item active">건강정보 조회</li>
+							</ol>
+						</nav>
+					</div>
+				</div>
+				<div class="row">
+					<div class="col-12">
+						<div class="card">
+							<div class="card-header">
+								<h1 class="h4">- 환자 기본정보</h1>
+							</div>
+							<div class="card-body">
+								<table class="table mobile-table">
+									<colgroup>
+										<col style="width: 15%">
+										<col style="width: 35%">
+										<col style="width: 15%">
+										<col style="width: 35%">
+									</colgroup>
+									<tr>
+										<th>입소일시</th>
+										<td colspan="3">
+											2020-10-10 10:25 <button class="btn btn-primary ml-2">진료시작</button>
+										</td>
+									</tr>
+									<tr>
+										<th>병동번호</th>
+										<td>
+											1501
+										</td>
+										<th>이름</th>
+										<td>
+											김레몬
+										</td>
+									</tr>
+									<tr>
+										<th>성별</th>
+										<td>
+											남
+										</td>
+										<th>생년월일</th>
+										<td>
+											1975년 8월 8일
+										</td>
+									</tr>
+									<tr>
+										<th>연락처</th>
+										<td>
+											010-1234-1234
+										</td>
+										<th>보호자 연락처</th>
+										<td>
+											010-1234-1234
+										</td>
+									</tr>
+									<tr>
+										<th>증상시작일</th>
+										<td>
+											2020-10-08
+										</td>
+										<th>확진일</th>
+										<td>
+											2020-10-09
+										</td>
+									</tr>
+									<tr>
+										<th>격리해제(퇴소)예정일</th>
+										<td colspan="3">
+											2020-10-25
+											<!-- BEGIN primary modal -->
+											<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#defaultModalPrimary">변경</button>
+											<div class="modal fade" id="defaultModalPrimary" tabindex="-1" role="dialog" aria-hidden="true">
+												<div class="modal-dialog" role="document">
+													<div class="modal-content">
+														<div class="modal-header">
+															<h5 class="modal-title">격리해제(퇴소) 예정일 변경</h5>
+															<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span> </button>
+														</div>
+														<div class="modal-body m-3">
+															<table class="table mobile-table">
+																<colgroup>
+																	<col style="width: 15%">
+																	<col style="width: 35%">
+																	<col style="width: 15%">
+																	<col style="width: 35%">
+																</colgroup>
+																<tr>
+																	<th>입소일시</th>
+																	<td>
+																		2020-10-10 10:25
+																	</td>
+																	<th>병동번호</th>
+																	<td >
+																		1501
+																	</td>
+																</tr>
+																<tr>
+																	<th>이름</th>
+																	<td>
+																		김레몬
+																	</td>
+																	<th>성별</th>
+																	<td>
+																		남
+																	</td>
+																</tr>
+																<tr>
+																	<th>생년월일</th>
+																	<td colspan="3">
+																		1975년 8월 8일
+																	</td>
+																</tr>
+																<tr>
+																	<th>연락처</th>
+																	<td>
+																		010-1234-1234
+																	</td>
+																	<th>보호자 연락처</th>
+																	<td>
+																		010-1234-1234
+																	</td>
+																</tr>
+																<tr>
+																	<th>증상시작일</th>
+																	<td>
+																		2020-10-08
+																	</td>
+																	<th>보호자 연락처</th>
+																	<td>
+																		2020-10-09
+																	</td>
+																</tr>
+																<tr>
+																	<th>격리해제(퇴소)예정일</th>
+																	<td colspan="3">
+																		<div class="form-group calendar-bar mb-xl-0">
+																			<input class="form-control" type="text" name="datesingle">
+																			<i class="align-middle mr-2 fas fa-fw fa-calendar-alt"></i>
+																		</div>
+																	</td>
+																</tr>
+																<tr>
+																	<th>변경사유</th>
+																	<td colspan="3">
+																		<div class="form-row">
+																			<div class="col-5">
+																				<select class="custom-select">
+																			          <option selected="">귀가조치(격지해제)</option>
+																			          <option>지정병원이송</option>
+																			          <option>기타</option>
+																		        </select>
+																			</div>
+																			<div class="col-7">
+																				<input type="text" name="" class="form-control">
+																			</div>
+																		</div>
+																	</td>
+																</tr>
+															</table>
+														</div>
+														<div class="modal-footer">
+															<button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
+															<button type="button" class="btn btn-primary">등록</button>
+														</div>
+													</div>
+												</div>
+											</div>
+											<!-- END primary modal -->
+										</td>
+									</tr>
+									<tr>
+										<th>기저질환</th>
+										<td>
+											무
+										</td>
+										<th>임신</th>
+										<td >
+											무
+										</td>
+									</tr>
+									<tr>
+										<th>중증도 분류</th>
+										<td>
+											하
+										</td>
+										<th>흉부 X선 결과</th>
+										<td>
+											정상
+										</td>
+									</tr>
+									<tr>
+										<th>산소포화도</th>
+										<td colspan="3">
+											90%
+										</td>
+									</tr>
+									<tr>
+										<th>상태 및 특이사항</th>
+										<td colspan="3">
+											없음
+										</td>
+									</tr>
+								</table>
+								<div class="row mt-3">
+									<div class="col-lg-6">
+									</div>
+									<div class="col-lg-6">
+										<div class="text-right">
+											<button id="buttonUntact" class="btn btn-outline-success" onclick="showUntactTab()">비대면 진료</button>
+											<button id="buttonPhr" class="btn btn-success" onclick="showPhrTab()">건강정보이력</button>
+											<button id="buttonSymptom" class="btn btn-outline-success" onclick="showSymptomTab()">임상증상</button>
+											<button id="buttonMemo" class="btn btn-outline-success" onclick="showMemoTab()">의료진 메모</button>
+											<button class="btn btn-primary" onclick="location='./state'">목록</button>
+										</div>
+									</div>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div id="tabPhr" class="row">
+					<div class="col-12">
+						<div class="card">
+							<div class="card-header">
+								<h1 class="h4">
+									- 건강정보 조회
+									<label>
+										<select class="custom-select ml-1 form-control" id=phrTypeSelect name="inputState" onchange="retrievePhrData">
+									        <option value="temperature" selected>체온</option>
+									        <option value="oxygenSaturation">산소포화도</option>
+									        <option value=pulseRate>혈압</option>
+									    </select>
+									</label>
+									<label class="ml-1">
+										<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#defaultModalPrimary_1">기록추가</button>
+										<div class="modal fade" id="defaultModalPrimary_1" tabindex="-1" role="dialog" aria-hidden="true">
+											<div class="modal-dialog max360" role="document">
+												<div class="modal-content">
+													<div class="modal-header">
+														<h5 class="modal-title">건강정보 입력</h5>
+														<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span> </button>
+													</div>
+													<div class="modal-body m-3">
+														<table class="table mobile-table">
+															<colgroup>
+																<col style="width: 30%">
+																<col style="width: 70%">
+															</colgroup>
+															<tr>
+																<th>기록자</th>
+																<td>
+																	<div class="form-group mb-xl-0">
+																		<input class="form-control" type="text">
+																	</div>
+																</td>
+															</tr>
+															<tr>
+																<th>건강정보</th>
+																<td>
+																	<div class="form-group mb-xl-0">
+																		<input class="form-control" type="text">
+																	</div>
+																</td>
+															</tr>
+														</table>
+													</div>
+													<div class="modal-footer">
+														<button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
+														<button type="button" class="btn btn-primary">등록</button>
+													</div>
+												</div>
+											</div>
+										</div>
+									</label>
+								</h1>
+							</div>
+							<div class="card-body">
+								<div class="graph-area mb-4">
+									<div style="height:400px;background-color:#dddddd;">그래프영역</div>
+								</div>
+								<div class="table-responsive">
+									<table id="phrDataTable" class="table data-table text-center">
+										<thead>
+											<tr>
+												<th>진료일시</th>
+												<th>체온</th>
+												<th>진료담당자</th>
+											</tr>
+										</thead>
+										<tbody>
+										  <c:choose>
+										  <c:when test="${phrTotal > 0}">
+										  <c:forEach var="phr" items="${phrItems}">
+											<tr>
+												<td><c:out value="${phr.createDate}" /></td>
+												<td>
+													<span class="text-danger"><c:out value="${phr.phrValue} ℃" /></span>
+												</td>
+												<td><c:out value="${phr.recordedBy}" /></td>
+											</tr>
+										  </c:forEach>
+										  </c:when>
+										  <c:otherwise>
+										  	<tr>
+												<td colspan=3>데이터가 없습니다.</td>
+											</tr>
+										  </c:otherwise>
+										  </c:choose>
+										</tbody>
+									</table>
+								</div>
+								<div class="row mt-3">
+									<div class="col-lg-6">
+									</div>
+									<div class="col-lg-6">
+										<div class="text-right">
+											<button class="btn btn-primary w100">확인</button>
+										</div>
+									</div>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div id="tabSymptom" class="row" style="display:none;">
+						<div class="col-12">
+							<div class="card">
+								<div class="card-header">
+									<h1 class="h4">
+										- 임상증상 (2020-10-10 ~ 2020-10-26)
+										<label class="ml-1">
+											<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#defaultModalPrimary_1">증상추가</button>
+											<div class="modal fade" id="defaultModalPrimary_1" tabindex="-1" role="dialog" aria-hidden="true">
+												<div class="modal-dialog" role="document">
+													<div class="modal-content">
+														<div class="modal-header">
+															<h5 class="modal-title">임상증상 입력</h5>
+															<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span> </button>
+														</div>
+														<div class="modal-body m-3">
+															<table class="table mobile-table">
+																<colgroup>
+																	<col style="width: 30%">
+																	<col style="width: 70%">
+																</colgroup>
+																<tr>
+																	<th>기록자</th>
+																	<td>
+																		<div class="form-group mb-xl-0">
+																			<input class="form-control" type="text">
+																		</div>
+																	</td>
+																</tr>
+																<tr>
+																	<th>임상증상</th>
+																	<td>
+																		<div class="form-group mb-xl-0">
+																			<label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	기침
+																	            </span>
+																	        </label>
+																			<label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	호흡곤란
+																	            </span>
+																	        </label>
+																			<label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	오한
+																	            </span>
+																	        </label>
+																			<label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	근육통
+																	            </span>
+																	        </label>
+																			<label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	두통
+																	            </span>
+																	        </label>
+																			<label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	인후통
+																	            </span>
+																	        </label>
+																			<label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	후각/미각 손실
+																	            </span>
+																	        </label>
+																	        <label class="form-check form-check-inline">
+																	            <input class="form-check-input" type="checkbox" value="option1">
+																	            <span class="form-check-label">
+																	            	기타 ( <input type="text" class="form-control form-control-sm w150" name=""> )
+																	            </span>
+																	        </label>
+																		</div>
+																	</td>
+																</tr>
+															</table>
+														</div>
+														<div class="modal-footer">
+															<button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
+															<button type="button" class="btn btn-primary">등록</button>
+														</div>
+													</div>
+												</div>
+											</div>
+										</label>
+									</h1>
+								</div>
+								<div class="card-body">
+									<div class="table-responsive">
+										<table class="table data-table text-center">
+											<thead>
+												<tr>
+													<th>증상정보</th>
+													<th>기침</th>
+													<th>호흡곤란</th>
+													<th>오한</th>
+													<th>근육통</th>
+													<th>두통</th>
+													<th>인후통</th>
+													<th>후각/미각 손실</th>
+													<th>기타증상</th>
+													<th>기록자</th>
+												</tr>
+											</thead>
+											<tbody>
+												<tr>
+													<th>2020-11-05 09:23:526</th>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>-</td>
+													<td>-</td>
+													<td>-</td>
+													<td><span class="text-danger">설사</span></td>
+													<td>김레몬</td>
+												</tr>
+												<tr>
+													<th>2020-11-05 09:23:526</th>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>-</td>
+													<td>-</td>
+													<td>-</td>
+													<td><span class="text-danger">설사</span></td>
+													<td>김레몬</td>
+												</tr>
+												<tr>
+													<th>2020-11-05 09:23:526</th>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>-</td>
+													<td>-</td>
+													<td>-</td>
+													<td><span class="text-danger">설사</span></td>
+													<td>김레몬</td>
+												</tr>
+												<tr>
+													<th>2020-11-05 09:23:526</th>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>V</td>
+													<td>-</td>
+													<td>-</td>
+													<td>-</td>
+													<td><span class="text-danger">설사</span></td>
+													<td>김레몬</td>
+												</tr>
+											</tbody>
+										</table>
+									</div>
+									<div class="row mt-3">
+										<div class="col-lg-6">
+										</div>
+										<div class="col-lg-6">
+											<div class="text-right">
+												<button class="btn btn-primary w100">확인</button>
+											</div>
+										</div>
+									</div>
+								</div>
+							</div>
+						</div>
+					</div>
+				<div id="tabMemo" class="row" style="display:none;">
+						<div class="col-12">
+							<div class="card">
+								<div class="card-header">
+									<h1 class="h4">
+										- 의료진 메모 (2020-10-10 ~2020-10-26)
+										<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#defaultModalPrimaryMemo">메모추가</button>
+										<div class="modal fade" id="defaultModalPrimaryMemo" tabindex="-1" role="dialog" aria-hidden="true">
+											<div class="modal-dialog" role="document">
+												<div class="modal-content">
+													<div class="modal-header">
+														<h5 class="modal-title">의료진 메모 입력</h5>
+														<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span> </button>
+													</div>
+													<div class="modal-body m-3">
+														<table class="table mobile-table">
+															<colgroup>
+																<col style="width: 20%">
+																<col style="width: 80%">
+															</colgroup>
+															<tr>
+																<th>작성자</th>
+																<td>
+																	<div class="form-row">
+																		<input type="text" name="" class="form-control" placeholder="이름을 입력하세요">
+																	</div>
+																</td>
+															</tr>
+															<tr>
+																<th>소견</th>
+																<td>
+																	<div class="form-row">
+																		<textarea class="form-control" rows="2" placeholder="내용을 입력하세요"></textarea>
+																	</div>
+																</td>
+															</tr>
+														</table>
+													</div>
+													<div class="modal-footer">
+														<button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
+														<button type="button" class="btn btn-primary">등록</button>
+													</div>
+												</div>
+											</div>
+										</div>
+									</h1>
+								</div>
+								<div class="card-body">
+									<div class="table-responsive">
+										<table class="table data-table text-center">
+											<thead>
+												<tr>
+													<th>진료일시</th>
+													<th>진료내용</th>
+													<th>특이사항</th>
+													<th>진료담당자</th>
+												</tr>
+											</thead>
+											<tbody>
+												<tr>
+													<td>2020-10-10 10:25</td>
+													<td>소화가 잘 안된다고 소화제 복용 문의...</td>
+													<td>-</td>
+													<td>홍길동</td>
+												</tr>
+												<tr>
+													<td>2020-10-10 10:25</td>
+													<td>소화가 잘 안된다고 소화제 복용 문의...</td>
+													<td>-</td>
+													<td>홍길동</td>
+												</tr>
+												<tr>
+													<td>2020-10-10 10:25</td>
+													<td>소화가 잘 안된다고 소화제 복용 문의...</td>
+													<td>-</td>
+													<td>홍길동</td>
+												</tr>
+												<tr>
+													<td>2020-10-10 10:25</td>
+													<td>소화가 잘 안된다고 소화제 복용 문의...</td>
+													<td>-</td>
+													<td>홍길동</td>
+												</tr>
+												<tr>
+													<td>2020-10-10 10:25</td>
+													<td>소화가 잘 안된다고 소화제 복용 문의...</td>
+													<td>-</td>
+													<td>홍길동</td>
+												</tr>
+												<tr>
+													<td>2020-10-10 10:25</td>
+													<td>소화가 잘 안된다고 소화제 복용 문의...</td>
+													<td>-</td>
+													<td>홍길동</td>
+												</tr>
+												<tr>
+													<td>2020-10-10 10:25</td>
+													<td>소화가 잘 안된다고 소화제 복용 문의...</td>
+													<td>-</td>
+													<td>홍길동</td>
+												</tr>
+											</tbody>
+										</table>
+									</div>
+									<div class="row mt-3">
+										<div class="col-lg-6">
+										</div>
+										<div class="col-lg-6">
+											<div class="text-right">
+												<button class="btn btn-primary w100">확인</button>
+											</div>
+										</div>
+									</div>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+            </main>
+
+            <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
+        </div>
+    </div>
+</body>
+</html>

文件差異過大導致無法顯示
+ 148 - 1944
src/main/webapp/WEB-INF/jsp/clinic/state.jsp


+ 17 - 0
src/test/java/com/lemon/lifecenter/LifeCenterApplicationTests.java

@@ -1,13 +1,30 @@
 package com.lemon.lifecenter;
 
 import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
+import com.lemon.lifecenter.dto.PatientPHRHistoryDTO;
+import com.lemon.lifecenter.service.PHRService;
+
 @SpringBootTest
 class LifeCenterApplicationTests {
 
 	@Test
 	void contextLoads() {
 	}
+	
+	@Autowired PHRService phrService;
+	
+	@Test
+	void insertPhr() {
+		PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
+    	dto.setPatientIdx(1046);
+    	dto.setPhrType("temperature");
+    	dto.setPhrValue(36.5f);
+    	dto.setRecordedBy("홍길동");
+    	
+    	phrService.insertPHR(dto);
+	}
 
 }