|
@@ -168,20 +168,43 @@ public class ClinicController extends LifeCenterController {
|
|
|
|
|
|
PatientDTO patientDto = new PatientDTO();
|
|
|
patientDto.setPatientIdx(patientIdx);
|
|
|
- patientDto = patientService.selectPatientOne(patientDto);
|
|
|
-
|
|
|
- PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
|
|
|
- dto.setPhrType(phrType);
|
|
|
- dto.setPatientIdx(patientIdx);
|
|
|
+ patientDto = patientService.selectPatientOne(patientDto);
|
|
|
+
|
|
|
+// phrType = "memo";
|
|
|
+ if (phrType == "symptom") {
|
|
|
+ PatientSymptomSimDTO dto = new PatientSymptomSimDTO();
|
|
|
+ dto.setPatientIdx(patientIdx);
|
|
|
+
|
|
|
+ int total = phrService.selectSymptomCount(dto);
|
|
|
+ List<PatientSymptomSimDTO> result = new ArrayList<PatientSymptomSimDTO>();
|
|
|
|
|
|
- int total = phrService.selectPHRHistoryCount(dto);
|
|
|
- List<PatientPHRHistoryDTO> result = new ArrayList<PatientPHRHistoryDTO>();
|
|
|
+ if (total > 0) {
|
|
|
+ result = phrService.selectSymptomList(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getPhrSymptomListExcel(request, response, patientDto, result);
|
|
|
+ } else if (phrType == "memo") {
|
|
|
+ PatientMemoDTO dto = new PatientMemoDTO();
|
|
|
+ dto.setPatientIdx(patientIdx);
|
|
|
+
|
|
|
+ List<PatientMemoDTO> result = new ArrayList<PatientMemoDTO>();
|
|
|
+ result = clinicService.selectMemoList(dto);
|
|
|
+
|
|
|
+ this.getMemoListExcel(request, response, patientDto, result);
|
|
|
+ } else {
|
|
|
+ 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);
|
|
|
+ if (total > 0) {
|
|
|
+ result = phrService.selectPHRHistoryList(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getPhrDataListExcel(request, response, patientDto, phrType, result);
|
|
|
}
|
|
|
-
|
|
|
- getPhrDataListExcel(request, response, patientDto, phrType, result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/api/state")
|
|
@@ -307,10 +330,9 @@ public class ClinicController extends LifeCenterController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void getPhrDataListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, String phrType, List<PatientPHRHistoryDTO> data ) {
|
|
|
+ private void getPhrDataListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, String phrType, List<PatientPHRHistoryDTO> data) {
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
|
- Sheet sheet1 = workbook.createSheet("firstSheet");
|
|
|
- DecimalFormat df = new DecimalFormat("#,###");
|
|
|
+ Sheet sheet1 = workbook.createSheet("PHR");
|
|
|
|
|
|
//1.셀 스타일 및 폰트 설정
|
|
|
CellStyle styleOfBoardFillFontBlackBold16 = workbook.createCellStyle();
|
|
@@ -417,10 +439,10 @@ public class ClinicController extends LifeCenterController {
|
|
|
cell4 = row.createCell(4);
|
|
|
|
|
|
try {
|
|
|
-// File file = new File(".");
|
|
|
-// String rootPath = file.getAbsolutePath();
|
|
|
-// System.out.println("현재 프로젝트의 경로 : "+rootPath );
|
|
|
-
|
|
|
+// File file = new File(".");
|
|
|
+// String rootPath = file.getAbsolutePath();
|
|
|
+// System.out.println("현재 프로젝트의 경로 : "+rootPath );
|
|
|
+
|
|
|
// JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
|
|
|
String directoryName = "../excel-temp/";
|
|
|
File directory = new File(directoryName);
|
|
@@ -434,6 +456,289 @@ public class ClinicController extends LifeCenterController {
|
|
|
String tempPath = directoryName + downName;
|
|
|
|
|
|
|
|
|
+ File xlsFile = new File(tempPath);
|
|
|
+ FileOutputStream fileOut = new FileOutputStream(xlsFile);
|
|
|
+ workbook.write(fileOut);
|
|
|
+
|
|
|
+ LifeCenterFileDownload.download(request, response, tempPath, downName);
|
|
|
+
|
|
|
+ xlsFile.delete();
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getPhrSymptomListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, List<PatientSymptomSimDTO> data) {
|
|
|
+ Workbook workbook = new XSSFWorkbook();
|
|
|
+ Sheet sheet1 = workbook.createSheet("임상증상");
|
|
|
+
|
|
|
+ //1.셀 스타일 및 폰트 설정
|
|
|
+ CellStyle styleOfBoardFillFontBlackBold16 = workbook.createCellStyle();
|
|
|
+ //정렬
|
|
|
+ styleOfBoardFillFontBlackBold16.setAlignment(CellStyle.ALIGN_CENTER); //가운데 정렬
|
|
|
+ styleOfBoardFillFontBlackBold16.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //높이 가운데 정렬
|
|
|
+ //배경색
|
|
|
+ styleOfBoardFillFontBlackBold16.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex());
|
|
|
+ styleOfBoardFillFontBlackBold16.setFillPattern(CellStyle.SOLID_FOREGROUND);
|
|
|
+ //테두리 선 (우,좌,위,아래)
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderRight(HSSFCellStyle.BORDER_THIN);
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderLeft(HSSFCellStyle.BORDER_THIN);
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderTop(HSSFCellStyle.BORDER_THIN);
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderBottom(HSSFCellStyle.BORDER_THIN);
|
|
|
+ //폰트 설정
|
|
|
+ Font fontOfGothicBlackBold16 = workbook.createFont();
|
|
|
+// fontOfGothicBlackBold16.setFontName("나눔고딕"); //글씨체
|
|
|
+ fontOfGothicBlackBold16.setFontHeight((short)(10*20)); //사이즈
|
|
|
+ fontOfGothicBlackBold16.setBoldweight(Font.BOLDWEIGHT_BOLD); //볼드 (굵게)
|
|
|
+ styleOfBoardFillFontBlackBold16.setFont(fontOfGothicBlackBold16);
|
|
|
+
|
|
|
+ int i = 1;
|
|
|
+ Row row = sheet1.createRow(0);
|
|
|
+ Cell cell1 = row.createCell(0);
|
|
|
+ Cell cell2 = row.createCell(1);
|
|
|
+ Cell cell3 = row.createCell(2);
|
|
|
+ Cell cell4 = row.createCell(3);
|
|
|
+ Cell cell5 = row.createCell(4);
|
|
|
+ Cell cell6 = row.createCell(5);
|
|
|
+ Cell cell7 = row.createCell(6);
|
|
|
+ Cell cell8 = row.createCell(7);
|
|
|
+ Cell cell9 = row.createCell(8);
|
|
|
+ Cell cell10 = row.createCell(9);
|
|
|
+ Cell cell11 = row.createCell(10);
|
|
|
+ Cell cell12 = row.createCell(11);
|
|
|
+ Cell cell13 = row.createCell(12);
|
|
|
+ Cell cell14 = row.createCell(13);
|
|
|
+ Cell cell15 = row.createCell(14);
|
|
|
+ Cell cell16 = row.createCell(15);
|
|
|
+ Cell cell17 = row.createCell(16);
|
|
|
+ Cell cell18 = row.createCell(17);
|
|
|
+
|
|
|
+ cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell4.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell5.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell6.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell7.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell8.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell9.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell10.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell11.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell12.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell13.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell14.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell15.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell16.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell17.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell18.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+
|
|
|
+ sheet1.setColumnWidth(0, 5000); // 기록일시
|
|
|
+ sheet1.setColumnWidth(1, 3000); // 기침
|
|
|
+ sheet1.setColumnWidth(2, 3000); // 호흡곤란
|
|
|
+ sheet1.setColumnWidth(3, 3000); // 오한
|
|
|
+ sheet1.setColumnWidth(4, 3000); // 근육통
|
|
|
+ sheet1.setColumnWidth(5, 3000); // 두통
|
|
|
+ sheet1.setColumnWidth(6, 3000); // 인후통
|
|
|
+ sheet1.setColumnWidth(7, 3000); // 후각/미각 손실
|
|
|
+ sheet1.setColumnWidth(8, 3000); // 피로
|
|
|
+ sheet1.setColumnWidth(9, 3000); // 식욕감소
|
|
|
+ sheet1.setColumnWidth(10, 3000); // 가래
|
|
|
+ sheet1.setColumnWidth(11, 3000); // 오심
|
|
|
+ sheet1.setColumnWidth(12, 3000); // 구토
|
|
|
+ sheet1.setColumnWidth(13, 3000); // 설사
|
|
|
+ sheet1.setColumnWidth(14, 3000); // 어지러움
|
|
|
+ sheet1.setColumnWidth(15, 3000); // 콧물/코막힘
|
|
|
+ sheet1.setColumnWidth(16, 3000); // 기타증상
|
|
|
+ sheet1.setColumnWidth(17, 5000); // 기록자
|
|
|
+
|
|
|
+ cell1.setCellValue("기록일시");
|
|
|
+ cell2.setCellValue("기침");
|
|
|
+ cell3.setCellValue("호흡곤란");
|
|
|
+ cell4.setCellValue("오한");
|
|
|
+ cell5.setCellValue("근육통");
|
|
|
+ cell6.setCellValue("두통");
|
|
|
+ cell7.setCellValue("인후통");
|
|
|
+ cell8.setCellValue("후각/미각 손실");
|
|
|
+ cell9.setCellValue("피로");
|
|
|
+ cell10.setCellValue("식욕감소");
|
|
|
+ cell11.setCellValue("가래");
|
|
|
+ cell12.setCellValue("오심");
|
|
|
+ cell13.setCellValue("구토");
|
|
|
+ cell14.setCellValue("설사");
|
|
|
+ cell15.setCellValue("어지러움");
|
|
|
+ cell16.setCellValue("콧물/코막힘");
|
|
|
+ cell17.setCellValue("기타증상");
|
|
|
+ cell18.setCellValue("기록자");
|
|
|
+
|
|
|
+ for (PatientSymptomSimDTO dto : data) {
|
|
|
+ row = sheet1.createRow(i);
|
|
|
+ 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);
|
|
|
+ cell9 = row.createCell(8);
|
|
|
+ cell10 = row.createCell(9);
|
|
|
+ cell11 = row.createCell(10);
|
|
|
+ cell12 = row.createCell(11);
|
|
|
+ cell13 = row.createCell(12);
|
|
|
+ cell14 = row.createCell(13);
|
|
|
+ cell15 = row.createCell(14);
|
|
|
+ cell16 = row.createCell(15);
|
|
|
+ cell17 = row.createCell(16);
|
|
|
+ cell18 = row.createCell(17);
|
|
|
+
|
|
|
+ String createDate = null;
|
|
|
+ SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
+ SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ try {
|
|
|
+ Date t = originalFormat.parse(dto.getCreateDate());
|
|
|
+ createDate = targetFormat.format(t);
|
|
|
+ } catch (Exception e) {
|
|
|
+ createDate = dto.getCreateDate();
|
|
|
+ }
|
|
|
+
|
|
|
+ cell1.setCellValue(createDate);
|
|
|
+ cell2.setCellValue(dto.getCoughCheck());
|
|
|
+ cell3.setCellValue(dto.getDyspneaCheck());
|
|
|
+ cell4.setCellValue(dto.getColdFitCheck());
|
|
|
+ cell5.setCellValue(dto.getMusclePainCheck());
|
|
|
+ cell6.setCellValue(dto.getHeadacheCheck());
|
|
|
+ cell7.setCellValue(dto.getSoreThroatCheck());
|
|
|
+ cell8.setCellValue(dto.getSmellPalateCheck());
|
|
|
+ cell9.setCellValue(dto.getFatigueCheck());
|
|
|
+ cell10.setCellValue(dto.getAppetiteLossCheck());
|
|
|
+ cell11.setCellValue(dto.getSputumCheck());
|
|
|
+ cell12.setCellValue(dto.getOcinCheck());
|
|
|
+ cell13.setCellValue(dto.getVomitingCheck());
|
|
|
+ cell14.setCellValue(dto.getDiarrheaCheck());
|
|
|
+ cell15.setCellValue(dto.getDizzinessCheck());
|
|
|
+ cell16.setCellValue(dto.getNoseCheck());
|
|
|
+
|
|
|
+ String etcCheckYN = dto.getEtcCheck();
|
|
|
+ String etcContent = etcCheckYN;
|
|
|
+ if (etcCheckYN == "Y") {
|
|
|
+ etcContent = dto.getEtcContent();
|
|
|
+ }
|
|
|
+ cell17.setCellValue(etcContent);
|
|
|
+
|
|
|
+ cell18.setCellValue(dto.getRecordedByName());
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
|
|
|
+ String directoryName = "../excel-temp/";
|
|
|
+ File directory = new File(directoryName);
|
|
|
+ if (! directory.exists()) {
|
|
|
+ directory.mkdir();
|
|
|
+ }
|
|
|
+
|
|
|
+ String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
|
|
|
+ // 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
|
|
|
+ String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_symptom_" + timestamp + ".xlsx";
|
|
|
+ String tempPath = directoryName + downName;
|
|
|
+
|
|
|
+
|
|
|
+ File xlsFile = new File(tempPath);
|
|
|
+ FileOutputStream fileOut = new FileOutputStream(xlsFile);
|
|
|
+ workbook.write(fileOut);
|
|
|
+
|
|
|
+ LifeCenterFileDownload.download(request, response, tempPath, downName);
|
|
|
+
|
|
|
+ xlsFile.delete();
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getMemoListExcel(HttpServletRequest request, HttpServletResponse response, PatientDTO patientDto, List<PatientMemoDTO> data) {
|
|
|
+ Workbook workbook = new XSSFWorkbook();
|
|
|
+ Sheet sheet1 = workbook.createSheet("의료진 메모");
|
|
|
+
|
|
|
+ //1.셀 스타일 및 폰트 설정
|
|
|
+ CellStyle styleOfBoardFillFontBlackBold16 = workbook.createCellStyle();
|
|
|
+ //정렬
|
|
|
+ styleOfBoardFillFontBlackBold16.setAlignment(CellStyle.ALIGN_CENTER); //가운데 정렬
|
|
|
+ styleOfBoardFillFontBlackBold16.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //높이 가운데 정렬
|
|
|
+ //배경색
|
|
|
+ styleOfBoardFillFontBlackBold16.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex());
|
|
|
+ styleOfBoardFillFontBlackBold16.setFillPattern(CellStyle.SOLID_FOREGROUND);
|
|
|
+ //테두리 선 (우,좌,위,아래)
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderRight(HSSFCellStyle.BORDER_THIN);
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderLeft(HSSFCellStyle.BORDER_THIN);
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderTop(HSSFCellStyle.BORDER_THIN);
|
|
|
+ styleOfBoardFillFontBlackBold16.setBorderBottom(HSSFCellStyle.BORDER_THIN);
|
|
|
+ //폰트 설정
|
|
|
+ Font fontOfGothicBlackBold16 = workbook.createFont();
|
|
|
+// fontOfGothicBlackBold16.setFontName("나눔고딕"); //글씨체
|
|
|
+ fontOfGothicBlackBold16.setFontHeight((short)(10*20)); //사이즈
|
|
|
+ fontOfGothicBlackBold16.setBoldweight(Font.BOLDWEIGHT_BOLD); //볼드 (굵게)
|
|
|
+ styleOfBoardFillFontBlackBold16.setFont(fontOfGothicBlackBold16);
|
|
|
+
|
|
|
+ int i = 1;
|
|
|
+ Row row = sheet1.createRow(0);
|
|
|
+ Cell cell1 = row.createCell(0);
|
|
|
+ Cell cell2 = row.createCell(1);
|
|
|
+ Cell cell3 = row.createCell(2);
|
|
|
+
|
|
|
+ cell1.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell2.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+ cell3.setCellStyle(styleOfBoardFillFontBlackBold16);
|
|
|
+
|
|
|
+ sheet1.setColumnWidth( 0, 5000); // 기록일시
|
|
|
+ sheet1.setColumnWidth( 1, 10000); // 내용
|
|
|
+ sheet1.setColumnWidth( 2, 3000); // 기록자
|
|
|
+
|
|
|
+ cell1.setCellValue("기록일시");
|
|
|
+ cell2.setCellValue("내용");
|
|
|
+ cell3.setCellValue("기록자");
|
|
|
+
|
|
|
+ for (PatientMemoDTO dto : data) {
|
|
|
+ row = sheet1.createRow(i);
|
|
|
+ cell1 = row.createCell(0);
|
|
|
+ cell2 = row.createCell(1);
|
|
|
+ cell3 = row.createCell(2);
|
|
|
+
|
|
|
+ String createDate = null;
|
|
|
+ SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
+ SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ try {
|
|
|
+ Date t = originalFormat.parse(dto.getCreateDate());
|
|
|
+ createDate = targetFormat.format(t);
|
|
|
+ } catch (Exception e) {
|
|
|
+ createDate = dto.getCreateDate();
|
|
|
+ }
|
|
|
+
|
|
|
+ cell1.setCellValue(createDate);
|
|
|
+ cell2.setCellValue(dto.getContents());
|
|
|
+ cell3.setCellValue(dto.getRecordedByName());
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // JBOSS에서 구동시 /home1/jboss/jboss-eap-7.3/domain/test/excel-temp 경로에 저장이됨
|
|
|
+ String directoryName = "../excel-temp/";
|
|
|
+ File directory = new File(directoryName);
|
|
|
+ if (! directory.exists()) {
|
|
|
+ directory.mkdir();
|
|
|
+ }
|
|
|
+
|
|
|
+ String timestamp = LifeCenterFunction.getNow("yyyy-MM-dd_HH-mm-ss");
|
|
|
+ // 다운로드 파일 명: 호실_환자명(생년월일)_항목명_다운로드일시.xlsx
|
|
|
+ String downName = patientDto.getRoomNumber() + "_" + patientDto.getPatientName() + "(" + patientDto.getJumin() + ")_memo_" + timestamp + ".xlsx";
|
|
|
+ String tempPath = directoryName + downName;
|
|
|
+
|
|
|
+
|
|
|
File xlsFile = new File(tempPath);
|
|
|
FileOutputStream fileOut = new FileOutputStream(xlsFile);
|
|
|
workbook.write(fileOut);
|
|
@@ -448,3 +753,4 @@ public class ClinicController extends LifeCenterController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|