Ver Fonte

[진료관리] 대시보드 페이징 사이즈 추가, 진료관리 상세 화면 변경 반영.

sjpark há 4 anos atrás
pai
commit
637166d4ba

+ 156 - 36
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -98,7 +98,6 @@ public class ClinicController extends LifeCenterController {
 	@RequestMapping("/info")
 	public ModelAndView patientInfo(
 			@RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx,
-			@RequestParam(value = "phrType", required = true, defaultValue = "temperature") String phrType,
 			@RequestParam(value = "refererSearch", required = false, defaultValue = "") String refererSearch,
 			@RequestParam(value = "refererPage", required = false, defaultValue = "") String refererPage) {
 
@@ -108,7 +107,7 @@ public class ClinicController extends LifeCenterController {
 		patientDto = patientService.selectPatientOne(patientDto);
 
 		String jumin = patientDto.getJumin();
-		jumin = jumin.substring(0, 4) + "년 " + jumin.substring(4, 6) + "월 " + jumin.substring(6, 8) + "일";
+		jumin = LifeCenterFunction.changeJuminToBirthday(jumin);
 		patientDto.setJumin(jumin);
 		
 		patientDto.setPatientPhone(LifeCenterFunction.phone(patientDto.getPatientPhone()));
@@ -116,44 +115,67 @@ public class ClinicController extends LifeCenterController {
 		
 		String bloodPress = patientDto.getBloodPressureLevel();
 		
-        if (!bloodPress.equals("") && !bloodPress.equals("|")) {
-            String[] bloodPressureLevel = bloodPress.split("[|]");
-            if (bloodPressureLevel[0] != null) {
-                patientDto.setBloodPressureLevelCon(bloodPressureLevel[0]);
-            }
-            if (bloodPressureLevel[1] != null) {
-                patientDto.setBloodPressureLevelRel(bloodPressureLevel[1]);
-            }
+    if (!bloodPress.equals("") && !bloodPress.equals("|")) {
+        String[] bloodPressureLevel = bloodPress.split("[|]");
+        if (bloodPressureLevel[0] != null) {
+            patientDto.setBloodPressureLevelCon(bloodPressureLevel[0]);
         }
-        
-        String strDisease = "";
-        String strSymptom = LifeCenterFunction.getSymptom(patientDto);
-        if (patientDto.getBasalDiseaseYn().equals("Y")) {
-            strDisease = LifeCenterFunction.getDisease(patientDto);
+        if (bloodPressureLevel[1] != null) {
+            patientDto.setBloodPressureLevelRel(bloodPressureLevel[1]);
         }
+    }
+    
+    String strDisease = "";
+    String strSymptom = LifeCenterFunction.getSymptom(patientDto);
+    if (patientDto.getBasalDiseaseYn().equals("Y")) {
+        strDisease = LifeCenterFunction.getDisease(patientDto);
+    }
 
-		// phr 정보
-		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);
-		}
+    // 히스토리 데이터
+    PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
+    dto.setPatientIdx(patientIdx);
+		// 체온
+		dto.setPhrType("temperature");
+		List<PatientPHRHistoryDTO> temperatureResult = phrService.selectPHRHistoryList(dto);
+    // 혈압
+    dto.setPhrType("bloodPressure");
+    List<PatientPHRHistoryDTO> bloodPressureResult = phrService.selectPHRHistoryList(dto);
+    // 맥박
+    dto.setPhrType("pulseRate");
+    List<PatientPHRHistoryDTO> pulseRateResult = phrService.selectPHRHistoryList(dto);
+    // 산소포화도
+    dto.setPhrType("oxygenSaturation");
+    List<PatientPHRHistoryDTO> oxygenSaturationResult = phrService.selectPHRHistoryList(dto);
+    // 혈당
+    dto.setPhrType("bloodSugar");
+    List<PatientPHRHistoryDTO> bloodSugarResult = phrService.selectPHRHistoryList(dto);
+    // 증상
+    PatientSymptomSimDTO dto2 = new PatientSymptomSimDTO();
+		dto2.setPatientIdx(patientIdx);
+    List<PatientSymptomSimDTO> symptomResult = phrService.selectSymptomList(dto2);
+    // 메모
+    PatientMemoDTO dto3 = new PatientMemoDTO();
+		dto3.setPatientIdx(patientIdx);
+		List<PatientMemoDTO> memoResult = clinicService.selectMemoList(dto3);
+
+    // response
+    List<PatientPHRHistoryDTO> bloodPressureUnionResult = getBloodPressureUnionResult(patientIdx, bloodPressureResult, pulseRateResult);
 
 		ModelAndView mv = setMV("clinic/info");
 
 		mv.addObject("patientIdx", patientIdx);
-		mv.addObject("info", patientDto);
+    mv.addObject("info", patientDto);
 		mv.addObject("symptom", strSymptom);
 		mv.addObject("disease", strDisease);
-		mv.addObject("phrType", phrType);
-		mv.addObject("phrTotal", total);
-		mv.addObject("phrItems", result);
-		mv.addObject("refererSearch", refererSearch);
+		mv.addObject("temperatureResult", temperatureResult);
+    mv.addObject("bloodPressureResult", bloodPressureResult);
+    mv.addObject("pulseRateResult", pulseRateResult);
+    mv.addObject("bloodPressureUnionResult", bloodPressureUnionResult);
+    mv.addObject("oxygenSaturationResult", oxygenSaturationResult);
+    mv.addObject("bloodSugarResult", bloodSugarResult);
+    mv.addObject("symptomResult", symptomResult);
+    mv.addObject("memoResult", memoResult);
+    mv.addObject("refererSearch", refererSearch);
 		mv.addObject("refererPage", refererPage);
 
 		return mv;
@@ -242,9 +264,23 @@ public class ClinicController extends LifeCenterController {
 
 		PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
 		dto.setPatientIdx(patientIdx);
-		dto.setPhrType(phrType);
-
-		return phrService.selectPHRHistoryList(dto);
+    dto.setPhrType(phrType);
+
+    List<PatientPHRHistoryDTO> result = phrService.selectPHRHistoryList(dto);
+    
+    boolean needPulseRate = phrType.equals("bloodPressure");
+    if (needPulseRate) {
+      PatientPHRHistoryDTO dto2 = new PatientPHRHistoryDTO();
+		  dto2.setPatientIdx(patientIdx);
+      dto2.setPhrType("pulseRate");
+
+      List<PatientPHRHistoryDTO> pulseRateResult = phrService.selectPHRHistoryList(dto2);
+      List<PatientPHRHistoryDTO> bloodPressureUnionResult = getBloodPressureUnionResult(patientIdx, result, pulseRateResult);
+      return bloodPressureUnionResult;
+    }
+    else {
+      return result;
+    }
 
 	}
 
@@ -252,7 +288,18 @@ public class ClinicController extends LifeCenterController {
 	public @ResponseBody String insertPhrDataAPI(@ModelAttribute("dto") final PatientPHRHistoryDTO dto) {
 
 		try {
-			phrService.insertPHR(dto);
+      phrService.insertPHR(dto);
+      if (dto.getPhrValueExtra() != null) {
+        PatientPHRHistoryDTO pulseRateDto = new PatientPHRHistoryDTO();
+        pulseRateDto.setPatientIdx(dto.getPatientIdx());
+        pulseRateDto.setPhrType("pulseRate");
+        pulseRateDto.setPhrValue(dto.getPhrValueExtra());
+        pulseRateDto.setRecordedByName(dto.getRecordedByName());
+        if (dto.getRecordedById() != null) {
+          pulseRateDto.setRecordedById(dto.getRecordedById());
+        }
+        phrService.insertPHR(pulseRateDto);
+      }
 
 			JSONObject json = new JSONObject();
 
@@ -377,7 +424,80 @@ public class ClinicController extends LifeCenterController {
 
 			return json.toString();
 		}
-	}
+  }
+  
+  private List<PatientPHRHistoryDTO> getBloodPressureUnionResult(int patientIdx, List<PatientPHRHistoryDTO> bloodPressureResult, List<PatientPHRHistoryDTO>pulseRateResult) {
+    // 혈압 맥박 정리
+    int bloodPressureIndex = 0;
+    int pulseRateIndex = 0;
+    List<PatientPHRHistoryDTO> bloodPressureUnionResult = new ArrayList<PatientPHRHistoryDTO>();
+    while (bloodPressureIndex < bloodPressureResult.size() || pulseRateIndex < pulseRateResult.size()) {
+      PatientPHRHistoryDTO union = new PatientPHRHistoryDTO();
+      union.setPatientIdx(patientIdx);
+      union.setPhrType("bloodPressure");
+      
+      if (bloodPressureIndex == bloodPressureResult.size()) {
+        PatientPHRHistoryDTO pr = pulseRateResult.get(pulseRateIndex);
+        union.setCreateDate(pr.getCreateDate());
+        union.setPhrValueExtra(pr.getPhrValue());
+        union.setRecordedByName(pr.getRecordedByName());
+        union.setRecordedById(pr.getRecordedById());
+
+        bloodPressureUnionResult.add(union);
+        pulseRateIndex += 1;
+        continue;
+      }
+      else if (pulseRateIndex == pulseRateResult.size()) {
+        PatientPHRHistoryDTO bp = bloodPressureResult.get(bloodPressureIndex);
+        union.setCreateDate(bp.getCreateDate());
+        union.setPhrValue(bp.getPhrValue());
+        union.setPhrValue2(bp.getPhrValue2());
+        union.setRecordedByName(bp.getRecordedByName());
+        union.setRecordedById(bp.getRecordedById());
+
+        bloodPressureUnionResult.add(union);
+        bloodPressureIndex += 1;
+        continue;
+      }
+
+      PatientPHRHistoryDTO bp = bloodPressureResult.get(bloodPressureIndex);
+      PatientPHRHistoryDTO pr = pulseRateResult.get(pulseRateIndex);
+
+      int dateDiffer = bp.getCreateDateFormatted().compareTo(pr.getCreateDateFormatted());
+      if (dateDiffer == 0) {
+        union.setCreateDate(bp.getCreateDate());
+        union.setPhrValue(bp.getPhrValue());
+        union.setPhrValue2(bp.getPhrValue2());
+        union.setRecordedByName(bp.getRecordedByName());
+        union.setRecordedById(bp.getRecordedById());
+
+        union.setPhrValueExtra(pr.getPhrValue());
+
+        bloodPressureIndex += 1;
+        pulseRateIndex += 1;
+      }
+      else if (dateDiffer < 0) {
+    	  union.setCreateDate(bp.getCreateDate());
+          union.setPhrValue(bp.getPhrValue());
+          union.setPhrValue2(bp.getPhrValue2());
+          union.setRecordedByName(bp.getRecordedByName());
+          union.setRecordedById(bp.getRecordedById());
+
+          bloodPressureIndex += 1;
+      }
+      else if (dateDiffer > 0) {
+    	  union.setCreateDate(pr.getCreateDate());
+          union.setPhrValueExtra(pr.getPhrValue());
+          union.setRecordedByName(pr.getRecordedByName());
+          union.setRecordedById(pr.getRecordedById());
+
+          pulseRateIndex += 1;
+      }
+
+      bloodPressureUnionResult.add(union);
+    }
+    return bloodPressureUnionResult;
+  }
 
 	private void getPhrDataListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, String phrType, List<PatientPHRHistoryDTO> data) {
         Workbook workbook = new XSSFWorkbook();

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

@@ -1,8 +1,10 @@
 package com.lemon.lifecenter.dto;
 
+import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
+import java.util.Date;
 
 public class PatientMemoDTO {
 
@@ -77,5 +79,16 @@ public class PatientMemoDTO {
 		long hours = ChronoUnit.HOURS.between(targetDay, today);
 
 		return hours < 24;
+  }
+  public String getCreateDateFormatted() {
+		SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+		SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+		try {
+			Date t = originalFormat.parse(this.createDate);
+			return targetFormat.format(t);
+		}
+		catch (Exception e) {
+			return createDate;
+		}
 	}
 }

+ 26 - 4
src/main/java/com/lemon/lifecenter/dto/PatientPHRHistoryDTO.java

@@ -11,7 +11,8 @@ public class PatientPHRHistoryDTO {
 	private int patientIdx;
 	private String phrType;
 	private Float phrValue;
-	private Float phrValue2;
+  private Float phrValue2;
+  private Float phrValueExtra;  // phrType 이 혈압인 경우, 통합뷰의 경우 여기에 맥박이 들어가는 경우가 있음.
 	private String recordedByName;
 	private String recordedById;
 	private String createDate;
@@ -41,6 +42,12 @@ public class PatientPHRHistoryDTO {
 	}
 	public void setPhrValue2(Float phrValue2) {
 		this.phrValue2 = phrValue2;
+  }
+  public Float getPhrValueExtra() {
+		return phrValueExtra;
+	}
+	public void setPhrValueExtra(Float phrValueExtra) {
+		this.phrValueExtra = phrValueExtra;
 	}
 	public String getRecordedByName() {
 		return recordedByName != null ? recordedByName : "";
@@ -79,9 +86,14 @@ public class PatientPHRHistoryDTO {
 			}
 			else if (this.phrType.equals("bloodPressure")) {
 				boolean highBP = this.phrValue >= 149 || this.phrValue2 >= 99;
-				boolean lowBP = this.phrValue <= 90 || this.phrValue2 <= 60;
+        boolean lowBP = this.phrValue <= 90 || this.phrValue2 <= 60;
+        // phrType 이 혈압인 경우, 통합뷰의 경우 phrValueExtra 에 맥박이 들어가는 경우가 있음.
+        boolean lowPR = false;
+        // if (this.phrValueExtra != null) {
+        //   lowPR = this.phrValueExtra <= 55 || this.phrValueExtra >= 110;
+        // }  //getIsExtraWarning 으로 분리시킴
 			
-				return highBP || lowBP;
+				return highBP || lowBP || lowPR;
 			}
 			else if (this.phrType.equals("oxygenSaturation")) {
 				return this.phrValue <= 94;
@@ -97,11 +109,21 @@ public class PatientPHRHistoryDTO {
 			
 		}
 		
+		return false;
+  }
+  public boolean getIsExtraWarning() {
+		try {
+				return this.phrValueExtra <= 55 || this.phrValueExtra >= 110;
+		}
+		catch(Exception e) {
+			
+		}
+		
 		return false;
 	}
 	public String getCreateDateFormatted() {
 		SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
-		SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 		try {
 			Date t = originalFormat.parse(this.createDate);
 			return targetFormat.format(t);

+ 14 - 0
src/main/java/com/lemon/lifecenter/dto/PatientSymptomSimDTO.java

@@ -1,5 +1,8 @@
 package com.lemon.lifecenter.dto;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 public class PatientSymptomSimDTO {
 	
 	private int patientIdx;
@@ -163,5 +166,16 @@ public class PatientSymptomSimDTO {
 	}
 	public void setLimitMax(int limitMax) {
 		this.limitMax = limitMax;
+  }
+  public String getCreateDateFormatted() {
+		SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+		SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+		try {
+			Date t = originalFormat.parse(this.createDate);
+			return targetFormat.format(t);
+		}
+		catch (Exception e) {
+			return createDate;
+		}
 	}
 }

Diff do ficheiro suprimidas por serem muito extensas
+ 715 - 140
src/main/webapp/WEB-INF/jsp/clinic/info.jsp