Browse Source

[진료관리 - 상세] 건강정보 엑셀 다운로드시 사유 입력 모달창 추가.

sjpark 4 years ago
parent
commit
2d1d345870

+ 20 - 2
src/main/java/com/lemon/lifecenter/controller/ClinicController.java

@@ -47,12 +47,14 @@ import com.lemon.lifecenter.common.LifeCenterController;
 import com.lemon.lifecenter.common.LifeCenterFileDownload;
 import com.lemon.lifecenter.common.LifeCenterFunction;
 import com.lemon.lifecenter.common.LifeCenterSessionController;
+import com.lemon.lifecenter.dto.FileDownloadDTO;
 import com.lemon.lifecenter.dto.PatientDTO;
 import com.lemon.lifecenter.dto.PatientMemoDTO;
 import com.lemon.lifecenter.dto.PatientPHRHistoryDTO;
 import com.lemon.lifecenter.dto.PatientPHRLatestDTO;
 import com.lemon.lifecenter.dto.PatientSymptomSimDTO;
 import com.lemon.lifecenter.service.ClinicService;
+import com.lemon.lifecenter.service.FileDownloadService;
 import com.lemon.lifecenter.service.PHRService;
 import com.lemon.lifecenter.service.PatientService;
 
@@ -69,6 +71,9 @@ public class ClinicController extends LifeCenterController {
 	@Autowired
 	private PatientService patientService;
 	
+	@Autowired
+    private FileDownloadService fileDownloadService;
+	
 	private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
 	@RequestMapping("/state")
@@ -473,12 +478,25 @@ public class ClinicController extends LifeCenterController {
 	@RequestMapping("/excel")
 	public void getExcelFile(
 			@RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType,
-			@RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
+      @RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
+      @RequestParam(value="downMemo", required=true, defaultValue="") String downMemo,
 			HttpServletRequest request, HttpServletResponse response ) {
 
 		PatientDTO patientDto = new PatientDTO();
 		patientDto.setPatientIdx(patientIdx);
-		patientDto = patientService.selectPatientOne(patientDto);		
+	    patientDto = patientService.selectPatientOne(patientDto);		
+	    
+	    //excel 다운로드 로그 남기기
+	    String userId = LifeCenterSessionController.getSession(request, "sesId");
+	
+	    FileDownloadDTO fileDTO = new FileDownloadDTO();
+	    fileDTO.setId( userId );
+	    fileDTO.setIp( LifeCenterFunction.getRemoteAddr( request ) );
+	    fileDTO.setUrl( request.getRequestURI().toString() );
+	    fileDTO.setMemo( downMemo );
+	    fileDTO.setEtc( "진료관리, " + patientDto.getPatientName() + ", " + patientDto.getJumin() + ", " + Integer.toString(patientDto.getCenterCode()) );
+	    fileDTO.setPatientIdx( patientIdx );
+	    fileDownloadService.insertExcelDownloadLog( fileDTO );
 		
 		this.createExcel(request, response, patientDto);
 	}

+ 55 - 4
src/main/webapp/WEB-INF/jsp/clinic/info.jsp

@@ -715,11 +715,26 @@ function gotoPatientInfo() {
 	location.href = url;
 }
 
-function getExcel(type) {
-	const phrType = (type === "") ? "all" : type;
+function getExcel() {
 
-	const url = "./excel?patientIdx=" + mPatientIdx + "&phrType=" + phrType;
+  if (!$("#downMemo").val().trim()) {
+		alert("다운로드 사유를 입력해 주세요.");
+		$("#downMemo").val("").foucs();
+		return;
+	}
+
+  if ($("#downMemo").val().trim().length < 3) {
+		alert("다운로드 사유는 3글자 이상이어야 합니다.");
+		$("#downMemo").foucs();
+		return;
+	}
+
+  const downMemo = $("#downMemo").val().trim();
+  donwMemo = encodeURIComponent(downMemo);
+	const url = "./excel?patientIdx=" + mPatientIdx + "&downMemo=" + downMemo;
 	window.open(url);
+
+  $("#excelDownMemo").modal("hide");
 }
 
 function handleModifyMemo(memoId, recordedDate) {
@@ -813,6 +828,11 @@ $(document).ready(function() {
     }
   });
 
+  // 건강정보 엑셀 다운로드 사유 팝업 닫힐 때 처리
+  $('#excelDownMemo').on('hidden.bs.modal', function () {
+    $("#downMemo").val("");
+  })
+
   // phrData 기록 추가 클릭 이벤트
   $('#defaultModalPrimary_1').on('hidden.bs.modal', function () {
     $("#eventDateTime1").val("");
@@ -1035,6 +1055,37 @@ $(document).ready(function() {
   <div class="preloader">
 		<div class="loadingIcon"></div>
 	</div>
+  <div class="modal fade" id="excelDownMemo" tabindex="-1" role="dialog" aria-hidden="true" data-memoid="">
+        <div class="modal-dialog" role="document">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">건강정보 Excel 다운로드</h5>
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
+                            aria-hidden="true">&times;</span> </button>
+                </div>
+                <div class="modal-body m-3">
+                    <table class="table mobile-table">
+                        <colgroup>
+                            <col style="width: 20%">
+                            <col style="width: 80%">
+                        </colgroup>
+                        <tr>
+                            <th><span class="fix">*</span>다운로드 사유</th>
+                            <td>
+                                <div class="form-row">
+                                    <textarea id="downMemo" name="downMemo" class="form-control" cols="" rows="6" placeholder="" maxlength="200"></textarea>
+                                </div>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+                <div class="addMemoTools modal-footer">
+                    <button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
+                    <button type="button" class="btn btn-primary" onclick="getExcel();">제출 후 다운로드</button>
+                </div>
+            </div>
+        </div>
+    </div>
 	<div class="modal fade" id="legendGuide" tabindex="-1" role="dialog" aria-hidden="true">
 		<div class="modal-dialog modal-sm" role="document">
 			<div class="modal-content">
@@ -1239,7 +1290,7 @@ $(document).ready(function() {
                     <div class="col-12">
                       <button class="btn btn-lg btn-secondary mr-2" onclick="gotoList()"><i class="mdi mdi-backburger"></i> 대시보드</button>
                       <c:if test="${data._SES_GROUP_IDX ne '3'}">
-                      <button id="downloadData" type="button" class="btn btn-lg btn-success" onclick="getExcel('');"><i class="mdi mdi-file-excel-outline"></i> 건강정보 다운로드</button>
+                      <button id="downloadData" type="button" class="btn btn-lg btn-success" data-toggle="modal" data-target="#excelDownMemo"><i class="mdi mdi-file-excel-outline"></i> 건강정보 다운로드</button>
                       </c:if>
                     </div>
                   </div>