123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- package com.lemon.lifecenter.controller;
- import java.text.ParseException;
- import java.util.ArrayList;
- import java.util.List;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- 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.servlet.ModelAndView;
- import com.lemon.lifecenter.common.LifeCenterController;
- import com.lemon.lifecenter.common.LifeCenterFunction;
- import com.lemon.lifecenter.common.LifeCenterSessionController;
- import com.lemon.lifecenter.dto.PatientDTO;
- import com.lemon.lifecenter.dto.PatientHealthDTO;
- import com.lemon.lifecenter.service.MobilePatientService;
- import com.lemon.lifecenter.service.PatientService;
- @Controller
- @RequestMapping("/mobile")
- public class MobileHistoryController extends LifeCenterController {
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- @Autowired
- private PatientService patientService;
-
- @Autowired
- private PatientService pService;
-
- @RequestMapping("/history")
- public ModelAndView history(
- @RequestParam( value="date", required=false, defaultValue="" ) String date,
- HttpServletRequest request, HttpServletResponse response) throws ParseException {
- String patientIdx = LifeCenterSessionController.getSession(request, "sesMpIdx");
-
- PatientHealthDTO hdto = new PatientHealthDTO();
- PatientHealthDTO historyData = new PatientHealthDTO();
- PatientDTO dto = new PatientDTO();
- dto.setPatientIdx(Integer.parseInt(patientIdx));
- int cnt = patientService.selectMunJinCount(dto);
-
- if( date.equals( "" ) ){
- date = LifeCenterFunction.getNow( "yyyy-MM-dd" );
- }
-
- hdto.setCreateDate( date );
- hdto.setPatientIdx( Integer.valueOf( patientIdx ) );
-
- // 체온, 맥박수/혈압, 산소포화도, 혈당 기록이 하나라도 되있는지 체크
- int historyTotal = pService.selectPatientPhrHistoryTotal( hdto );
- if( historyTotal > 0 ) {
- historyData = pService.selectPatientPhrHistoryData( hdto );
- }
-
- List<PatientDTO> pdto = new ArrayList<PatientDTO>();
- List<PatientDTO> symptomData = new ArrayList<PatientDTO>();
-
- // 임상증상 데이터가 하나라도 기록되었는지 체크
- int symptomTotal = pService.selectPatientSymptomSimTotal( hdto );
- if( symptomTotal > 0 ) {
- pdto = pService.selectPatientSymptomSimData( hdto );
- }
-
- for( PatientDTO p : pdto ) {
- p.setSymptomContent( this.getSymptom( p ) );
- System.out.println(" this.getSymptom( p ): " + this.getSymptom( p ));
- symptomData.add( p );
- }
-
- ModelAndView mv = setMobileMV( "history/history" );
-
-
- mv.addObject( "historyTotal", historyTotal );
- mv.addObject( "historyData", historyData );
-
- mv.addObject( "symptomTotal", symptomTotal );
- mv.addObject( "symptomData", symptomData );
-
-
-
- mv.addObject( "date", date );
- mv.addObject( "prevDate", LifeCenterFunction.getPrevDate( date ) );
- mv.addObject( "nextDate", LifeCenterFunction.getNextDate( date ) );
- mv.addObject( "nowDate", LifeCenterFunction.getNow( "yyyy-MM-dd" ) );
-
- mv.addObject("munjinCnt", cnt);
-
- return mv;
- }
-
- @RequestMapping("/serveyhistory")
- public ModelAndView serveyhistory(
- HttpServletRequest request, HttpServletResponse response) {
- PatientDTO dto = new PatientDTO();
- String sesMpIdx = LifeCenterSessionController.getSession(request, "sesMpIdx");
- dto.setPatientIdx(Integer.parseInt(sesMpIdx));
- dto = patientService.selectPatientOne(dto);
-
- String hDate = dto.getHospitalizationDate();
- String cDate = dto.getConfirmationDate();
- String sDate = dto.getSymptomStartDate();
- String jumin = dto.getJumin();
- jumin = LifeCenterFunction.changeJuminToBirthday(jumin);
- dto.setJumin(jumin);
-
- dto.setHospitalizationDate(hDate);
- dto.setConfirmationDate(cDate);
- dto.setSymptomStartDate(sDate);
-
- String bloodPress = dto.getBloodPressureLevel();
- if (!bloodPress.equals("")) {
- String[] bloodPressureLevel = dto.getBloodPressureLevel().split("[|]");
- dto.setBloodPressureLevelCon(bloodPressureLevel[0]);
- dto.setBloodPressureLevelRel(bloodPressureLevel[1]);
- }
-
- String strDisease = "";
- String strSymptom = getSymptom(dto);
- if (dto.getBasalDiseaseYn().equals("Y")) {
- strDisease = getDisease(dto);
- }
-
- ModelAndView mv = setMobileMV("history/serveyhistory");
- mv.addObject("info", dto);
- mv.addObject("disease", strDisease);
- mv.addObject("symptom", strSymptom);
- return mv;
- }
-
- private String getDisease(PatientDTO dto) {
- String highBloodPressureCheck = dto.getHighBloodPressureCheck().equals("Y") ? "고혈압" : "";
- String lowBloodPressureCheck = dto.getLowBloodPressureCheck().equals("Y") ? "저혈압" : "";
- String organTransplantCheck = dto.getOrganTransplantCheck().equals("Y") ? "장기이식(신장, 간 등)" : "";
- String diabetesCheck = dto.getDiabetesCheck().equals("Y") ? "당뇨" : "";
- String respiratoryDiseaseCheck = dto.getRespiratoryDiseaseCheck().equals("Y") ? "호흡기질환" : "";
- String immunologicalDiseaseCheck = dto.getImmunologicalDiseaseCheck().equals("Y") ? "면역질환(류마티스 등)" : "";
- String heartDisease = dto.getHeartDisease().equals("Y") ? "심장질환" : "";
- String liverDisease = dto.getLiverDisease().equals("Y") ? "간질환" : "";
- String operation = dto.getOperation().equals("Y") ? "수술" : "";
- String allergyCheck = dto.getAllergyCheck().equals("Y") ? "알레르기" : "";
- String kidneyDisease = dto.getKidneyDisease().equals("Y") ? "신장질환" : "";
- String cancerName = dto.getCancerName() == null ? "" : "(" + dto.getCancerName() + ")";
- String cancerCheck = dto.getCancerCheck().equals("Y") ? "암" + cancerName : "";
- String etcContent = dto.getEtcContentDisease() == null ? "" : dto.getEtcContentDisease();
- String ectCheckDisease = dto.getEtcCheckDisease().equals("Y") ? "기타(" + etcContent + ")" : "";
-
- ArrayList<String> disease = new ArrayList<String>();
- disease.add(highBloodPressureCheck);
- disease.add(lowBloodPressureCheck);
- disease.add(organTransplantCheck);
- disease.add(diabetesCheck);
- disease.add(respiratoryDiseaseCheck);
- disease.add(immunologicalDiseaseCheck);
- disease.add(heartDisease);
- disease.add(liverDisease);
- disease.add(operation);
- disease.add(allergyCheck);
- disease.add(kidneyDisease);
- disease.add(cancerCheck);
- disease.add(ectCheckDisease);
-
- String strDisease = "";
- for (int i = 0; i < disease.size(); i++) {
- String str = disease.get(i);
- if (!str.equals("")) {
- strDisease += str;
- strDisease += ", ";
- }
- }
-
- strDisease = strDisease.trim();
- if (!strDisease.equals("")) {
- strDisease = strDisease.substring(0, strDisease.length()-1);
- }
-
- return strDisease;
- }
-
- private String getSymptom(PatientDTO dto) {
- String feverCheck = dto.getFeverCheck().equals("Y") ? "열감(열나는 느낌)" : "";
- String coughCheck = dto.getCoughCheck().equals("Y") ? "기침" : "";
- String colic = dto.getColic().equals("Y") ? "복통(배아픔)" : "";
- String coldFitCheck = dto.getColdFitCheck().equals("Y") ? "오한(추운 느낌)" : "";
- String sputumCheck = dto.getSputumCheck().equals("Y") ? "가래" : "";
- String ocinCheck = dto.getOcinCheck().equals("Y") ? "오심(구역질)" : "";
- String chestPain = dto.getChestPain().equals("Y") ? "흉통" : "";
- String noseCheck = dto.getNoseCheck().equals("Y") ? "콧물 또는 코 막힘" : "";
- String vomitingCheck = dto.getVomitingCheck().equals("Y") ? "구토" : "";
- String musclePainCheck = dto.getMusclePainCheck().equals("Y") ? "근육통(몸살)" : "";
- String soreThroatCheck = dto.getSoreThroatCheck().equals("Y") ? "인후통(목 아픔)" : "";
- String diarrheaCheck = dto.getDiarrheaCheck().equals("Y") ? "설사" : "";
- String headacheCheck = dto.getHeadacheCheck().equals("Y") ? "두통(머리아픔)" : "";
- String dyspneaCheck = dto.getDyspneaCheck().equals("Y") ? "호흡곤란(숨가쁨)" : "";
- String fatigueCheck = dto.getFatigueCheck().equals("Y") ? "권태감(피로감)" : "";
- String etcContent = dto.getEtcContentSymptom() == null ? "" : dto.getEtcContentSymptom();
- String ectCheckSymptom = dto.getEtcCheckSymptom().equals("Y") ? "기타(" + etcContent + ")" : "";
-
- String strSymptom = "";
- ArrayList<String> symptom = new ArrayList<String>();
- symptom.add(feverCheck);
- symptom.add(coughCheck);
- symptom.add(colic);
- symptom.add(coldFitCheck);
- symptom.add(sputumCheck);
- symptom.add(ocinCheck);
- symptom.add(chestPain);
- symptom.add(noseCheck);
- symptom.add(vomitingCheck);
- symptom.add(musclePainCheck);
- symptom.add(soreThroatCheck);
- symptom.add(diarrheaCheck);
- symptom.add(headacheCheck);
- symptom.add(dyspneaCheck);
- symptom.add(fatigueCheck);
- symptom.add(ectCheckSymptom);
-
- for (int i = 0; i < symptom.size(); i++) {
- String str = symptom.get(i);
- if (!str.equals("")) {
- strSymptom += str;
- strSymptom += ", ";
- }
- }
-
- strSymptom = strSymptom.trim();
- if (!strSymptom.equals("")) {
- strSymptom = strSymptom.substring(0, strSymptom.length() - 1);
- }
-
-
- return strSymptom;
- }
- }
|