|
@@ -14,6 +14,7 @@ import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Set;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -51,11 +52,13 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.json.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.MessageSource;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
@@ -63,6 +66,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.context.request.RequestContextHolder;
|
|
|
+import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
+import org.springframework.web.servlet.LocaleResolver;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
@Controller
|
|
@@ -83,6 +89,11 @@ public class ClinicController extends LifeCenterController {
|
|
|
|
|
|
@Autowired
|
|
|
private MentalService mentalService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ LocaleResolver localeResolver;
|
|
|
+ @Autowired
|
|
|
+ MessageSource messageSource;
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
@@ -1197,7 +1208,7 @@ public class ClinicController extends LifeCenterController {
|
|
|
List<MentalDTO> data = new ArrayList<MentalDTO>();
|
|
|
int mentalTotal = mentalService.selectMentalHealthTotalCount(mDTO);
|
|
|
if (mentalTotal > 0) {
|
|
|
- data = mentalService.selectMentalHealthTotalList(mDTO);
|
|
|
+ data = mentalService.selectMentalHealthExcelDownList(mDTO);
|
|
|
}
|
|
|
|
|
|
Sheet sheet1 = workbook.createSheet("정신건강");
|
|
@@ -1266,6 +1277,72 @@ public class ClinicController extends LifeCenterController {
|
|
|
cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); // 높이 가운데 정렬
|
|
|
cell5.setCellStyle(cs);
|
|
|
|
|
|
+ i++;
|
|
|
+
|
|
|
+
|
|
|
+ row = sheet1.createRow(i);
|
|
|
+ row.setHeightInPoints((float) 100.0);
|
|
|
+ cell1 = row.createCell(0);
|
|
|
+ cell2 = row.createCell(1);
|
|
|
+ cell3 = row.createCell(2);
|
|
|
+ cell4 = row.createCell(3);
|
|
|
+ cell5 = row.createCell(4);
|
|
|
+ cell6 = row.createCell(5);
|
|
|
+ cell7 = row.createCell(6);
|
|
|
+ cell8 = row.createCell(7);
|
|
|
+
|
|
|
+ cell1.setCellValue(" 자가진단 상세");
|
|
|
+ String[] stressTotalDetialArray = dto.getDetail().split(",");
|
|
|
+ String stressTotalDetial="";
|
|
|
+
|
|
|
+ HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder .getRequestAttributes()).getRequest();
|
|
|
+ Locale locale = localeResolver.resolveLocale(request);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for( String detail : stressTotalDetialArray ) {
|
|
|
+ String[] ds = detail.split("=");
|
|
|
+ String title = "";
|
|
|
+ String score="";
|
|
|
+
|
|
|
+ if (ds[0].contains("health.mental.question.stress")) {
|
|
|
+ score = ds[1].equals("0") ? "아니오(0점)" : "예(1점)";
|
|
|
+ } else if (ds[0].contains("health.mental.question.depressed")
|
|
|
+ && !ds[0].equals("health.mental.question.depressedChk")) {
|
|
|
+ score = ds[1].equals("0") ? "전혀 방해받지 않았다(0점)"
|
|
|
+ : ds[1].equals("1") ? "며칠 동안 방해 받았다(1점)" : ds[1].equals("2") ? "7일 이상 방해 받았다(2점)" : "거의 매일 방해 받았다(3점)";
|
|
|
+ } else if ( ds[0].equals("health.mental.question.depressedChk") ) {
|
|
|
+ score = ds[1].equals("0") ? "전혀 어렵지 않았다(0점)"
|
|
|
+ : ds[1].equals("1") ? "약간어려웠다(1점)" : ds[1].equals("2") ? "많이어려웠다(2점)" : "매우 많이어려웠다(3점)";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if( ds[0].equals( "health.mental.question.stress1" ) ) {
|
|
|
+ title = "[외상후 스트레스 증상]\r\n";
|
|
|
+
|
|
|
+ } else if( ds[0].equals( "health.mental.question.depressed1" ) ) {
|
|
|
+ title = "\r\n[우울 (9문항)]\r\n";
|
|
|
+
|
|
|
+ } else if( ds[0].equals( "health.mental.question.vas1" ) ) {
|
|
|
+ title = "\r\n[주관적 심리적 고통정도(VAS, 1문항)] \r\n";
|
|
|
+
|
|
|
+ score = ds[1] + "점";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ stressTotalDetial += title + messageSource.getMessage(ds[0], null, locale) + " - " + score + "\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ cell2.setCellValue(stressTotalDetial);
|
|
|
+ sheet1.addMergedRegion(new CellRangeAddress(i, i, 1, 7));
|
|
|
+
|
|
|
+ cs.setWrapText(true);
|
|
|
+ cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); // 높이 가운데 정렬
|
|
|
+ cell5.setCellStyle(cs);
|
|
|
+
|
|
|
+
|
|
|
i++;
|
|
|
}
|
|
|
}
|