|
@@ -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();
|