Kaynağa Gözat

오픈 api 모니터링 통계 리스트 추가

junekeunsong 4 yıl önce
ebeveyn
işleme
7ccfd69e63

+ 75 - 0
src/main/java/com/lemon/lifecenter/controller/ApiMoniteringController.java

@@ -0,0 +1,75 @@
+package com.lemon.lifecenter.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.ModelAttribute;
+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.LifeCenterConfigVO;
+import com.lemon.lifecenter.common.LifeCenterController;
+import com.lemon.lifecenter.common.LifeCenterPaging;
+import com.lemon.lifecenter.dto.ApiMoniterDTO;
+import com.lemon.lifecenter.dto.CenterInfoDTO;
+import com.lemon.lifecenter.dto.LocationDTO;
+import com.lemon.lifecenter.service.ApiMoniterService;
+import com.lemon.lifecenter.service.CenterService;
+
+@Controller
+@RequestMapping("/apiMoniter")
+public class ApiMoniteringController extends LifeCenterController {
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+    
+    @Autowired
+    private CenterService centerService;
+    
+    @Autowired
+    private ApiMoniterService moniterService;
+    
+    @Autowired
+    private LifeCenterConfigVO config;
+    private LifeCenterPaging paging;
+    
+    @RequestMapping("/list")
+    public ModelAndView list(
+            @ModelAttribute("dto") ApiMoniterDTO dto,
+            @RequestParam(value="page", required=false, defaultValue="1") int page,
+            @RequestParam(value="centerName", required=false, defaultValue="") String centerName,
+            @RequestParam(value="locationCode", required=false, defaultValue="") String locationCode,
+            @RequestParam(value="startDate", required=false, defaultValue="") String startDate,
+            @RequestParam(value="endDate", required=false, defaultValue="") String endDate) {
+        
+        dto.setLimit( ( Integer.valueOf( page ) - 1 ) * config.pageDataSize );
+        dto.setLimitMax( config.pageDataSize );
+        
+        List<LocationDTO> locationList = centerService.selectLocation();
+        int total = moniterService.selectApiStatisticsCount(dto);
+        List<ApiMoniterDTO> list = new ArrayList<ApiMoniterDTO>();
+        if (total > 0) {
+            list = moniterService.selectApiStatistics(dto);
+        }
+        
+        String param = "centerName=" + dto.getCenterName() + "&locationCode=" + dto.getLocationCode() + "&startDate=" + dto.getStartDate() + "&endDate=" + dto.getEndDate();
+        paging = LifeCenterPaging.getInstance();
+        paging.paging(config, total, page, param);
+        
+        ModelAndView mv = setMV("api/moniter/list");
+        mv.addObject("locationList", locationList);
+        mv.addObject("total", total);
+        mv.addObject("item", list);
+        mv.addObject("startDate", startDate);
+        mv.addObject("endDate", endDate);
+        mv.addObject("locationCode", locationCode);
+        mv.addObject("centerName", centerName);
+        mv.addObject("paging", paging);
+        mv.addObject("page", page);
+        mv.addObject("pageSize", dto.getLimitMax());
+        return mv;
+    }
+}

+ 34 - 20
src/main/java/com/lemon/lifecenter/controller/RestApiController.java

@@ -83,6 +83,7 @@ public class RestApiController {
     @RequestMapping(value="/toAction", method = RequestMethod.POST)
     public String moveToAction(@RequestBody HlRequestDTO dto, HttpServletRequest request) {
         
+        ApiStatisticsDTO sDto = new ApiStatisticsDTO();
         String ip      = LifeCenterFunction.getRemoteAddr(request);
         String result  = "";
         String message = "";
@@ -102,6 +103,7 @@ public class RestApiController {
                     //int centerCode = Integer.parseInt(splitToken[1]);
                     String careAgencyCode = splitToken[1];
                     String time = splitToken[2];
+                    String resourceType = dto.getResourceType();
                     
                     if (managerId.equals(dto.getManagerId()) && careAgencyCode.equals(dto.getCareAgencyCode())) {
                         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -115,7 +117,6 @@ public class RestApiController {
                         Date nowDate = new Date();
                         if (nowDate.getTime() < getDate.getTime()) {
                             
-                            String resourceType = dto.getResourceType();
                             if (resourceType.equals("")) {
                                 object.put("error", "emptyResourceType");
                                 message = "emptyResourceType";
@@ -123,27 +124,25 @@ public class RestApiController {
                             } else {
                                 if (resourceType.equals("bloodPressure") || resourceType.equals("bloodSugar") || 
                                         resourceType.equals("oxygenSaturation") || resourceType.equals("pulseRate") || resourceType.equals("temperature")) {
-                                        
                                         result = selectPhrData(dto);
                                         
-                                    } else if (resourceType.equals("clinicMemo")) {
-                                        result = selectClinicMemoList(dto);
-                                    } else if (resourceType.equals("patientInfo")) {
-                                        result = selectHLPatientList(dto);
-                                    } else if (resourceType.equals("survey")) {
-                                        result = selectMunjinDataList(dto);
-                                    } else if (resourceType.equals("symptom")) {
-                                        result = selectSymptomDataList(dto);
-                                    } else if (resourceType.equals("vitalSign")) {
-                                        //String[] strAr = {"temperature", "bloodPressure", "bloodSugar", "oxygenSaturation", "pulseRate"};
+                                } else if (resourceType.equals("clinicMemo")) {
+                                    result = selectClinicMemoList(dto);
+                                } else if (resourceType.equals("patientInfo")) {
+                                    result = selectHLPatientList(dto);
+                                } else if (resourceType.equals("survey")) {
+                                    result = selectMunjinDataList(dto);
+                                } else if (resourceType.equals("symptom")) {
+                                    result = selectSymptomDataList(dto);
+//                                    } else if (resourceType.equals("vitalSign")) {
+                                    //String[] strAr = {"temperature", "bloodPressure", "bloodSugar", "oxygenSaturation", "pulseRate"};
 //                                        result = selectVitalSign(dto);
-                                    } else {
-                                        object.put("error", "invalidResourceType");
-                                        message = "invalidResourceType";
-                                        result = object.toString();
-                                    }
+                                } else {
+                                    object.put("error", "invalidResourceType");
+                                    message = "invalidResourceType";
+                                    result = object.toString();
+                                }
                             }
-
                             
                         } else {
                             object.put("error", "expireToken");
@@ -161,6 +160,7 @@ public class RestApiController {
                     message = "invalidParameters";
                     result = object.toString();
                 }
+                
             }
             
         } else {
@@ -172,8 +172,22 @@ public class RestApiController {
         if (message.equals("")) {
             message = "success";
         }
-//        ApiStatisticsDTO sDto = new ApiStatisticsDTO();
-//        service.insertStatisticsData(sDto);
+        
+        sDto = service.selectCodeData(dto.getCareAgencyCode());
+        
+        sDto.setResourceType(dto.getResourceType());
+        sDto.setResult(message);
+        sDto.setIp(ip);
+        
+        if (message.equals("success")) {
+            JSONArray jsArray = new JSONArray(result);
+            sDto.setApiCount(jsArray.length());
+        } else {
+            sDto.setApiCount(0);
+        }
+        
+        service.insertStatisticsData(sDto);
+        
         return result;
     }
     

+ 96 - 0
src/main/java/com/lemon/lifecenter/dto/ApiMoniterDTO.java

@@ -0,0 +1,96 @@
+package com.lemon.lifecenter.dto;
+
+public class ApiMoniterDTO {
+    private int centerCode         = 0;
+    private String locationCode    = "";
+    private String cooperativeCode = "";
+    private String centerName      = "";
+    private String locationName    = "";
+    private String cooperativeName = "";
+    private int apiCount           = 0;
+    private int numberOfCase       = 0;
+    private String inDate          = "";
+    private String startDate       = "";
+    private String endDate         = "";
+    private int limit              = 0;
+    private int limitMax           = 0;
+    
+    public int getCenterCode() {
+        return centerCode;
+    }
+    public void setCenterCode(int centerCode) {
+        this.centerCode = centerCode;
+    }
+    public String getLocationCode() {
+        return locationCode;
+    }
+    public void setLocationCode(String locationCode) {
+        this.locationCode = locationCode;
+    }
+    public String getCooperativeCode() {
+        return cooperativeCode;
+    }
+    public void setCooperativeCode(String cooperativeCode) {
+        this.cooperativeCode = cooperativeCode;
+    }
+    public String getCenterName() {
+        return centerName;
+    }
+    public void setCenterName(String centerName) {
+        this.centerName = centerName;
+    }
+    public String getLocationName() {
+        return locationName;
+    }
+    public void setLocationName(String locationName) {
+        this.locationName = locationName;
+    }
+    public String getCooperativeName() {
+        return cooperativeName;
+    }
+    public void setCooperativeName(String cooperativeName) {
+        this.cooperativeName = cooperativeName;
+    }
+    public int getApiCount() {
+        return apiCount;
+    }
+    public void setApiCount(int apiCount) {
+        this.apiCount = apiCount;
+    }
+    public int getNumberOfCase() {
+        return numberOfCase;
+    }
+    public void setNumberOfCase(int numberOfCase) {
+        this.numberOfCase = numberOfCase;
+    }
+    public String getInDate() {
+        return inDate;
+    }
+    public void setInDate(String inDate) {
+        this.inDate = inDate;
+    }
+    public String getStartDate() {
+        return startDate;
+    }
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+    public String getEndDate() {
+        return endDate;
+    }
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+    public int getLimit() {
+        return limit;
+    }
+    public void setLimit(int limit) {
+        this.limit = limit;
+    }
+    public int getLimitMax() {
+        return limitMax;
+    }
+    public void setLimitMax(int limitMax) {
+        this.limitMax = limitMax;
+    }
+}

+ 15 - 0
src/main/java/com/lemon/lifecenter/mapper/ApiMoniterMapper.java

@@ -0,0 +1,15 @@
+package com.lemon.lifecenter.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import com.lemon.lifecenter.dto.ApiMoniterDTO;
+
+@Repository
+@Mapper
+public interface ApiMoniterMapper {
+    public int selectApiStatisticsCount(ApiMoniterDTO dto);
+    public List<ApiMoniterDTO> selectApiStatistics(ApiMoniterDTO dto);
+}

+ 1 - 0
src/main/java/com/lemon/lifecenter/mapper/RestApiMapper.java

@@ -25,4 +25,5 @@ public interface RestApiMapper {
     public String selectApiKey(HlRequestDTO dto);
     
     public void insertStatisticsData(ApiStatisticsDTO dto);
+    public ApiStatisticsDTO selectCodeData(String careAgencyCode);
 }

+ 23 - 0
src/main/java/com/lemon/lifecenter/service/ApiMoniterService.java

@@ -0,0 +1,23 @@
+package com.lemon.lifecenter.service;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.lemon.lifecenter.dto.ApiMoniterDTO;
+import com.lemon.lifecenter.mapper.ApiMoniterMapper;
+
+@Service
+public class ApiMoniterService {
+    
+    @Autowired
+    private ApiMoniterMapper mapper;
+    
+    public int selectApiStatisticsCount(ApiMoniterDTO dto) {
+        return mapper.selectApiStatisticsCount(dto);
+    }
+    public List<ApiMoniterDTO> selectApiStatistics(ApiMoniterDTO dto) {
+        return mapper.selectApiStatistics(dto);
+    }
+}

+ 4 - 0
src/main/java/com/lemon/lifecenter/service/RestApiService.java

@@ -54,4 +54,8 @@ public class RestApiService {
     public void insertStatisticsData(ApiStatisticsDTO dto) {
         mapper.insertStatisticsData(dto);
     }
+    
+    public ApiStatisticsDTO selectCodeData(String careAgencyCode) {
+        return mapper.selectCodeData(careAgencyCode);
+    }
 }

+ 43 - 38
src/main/resources/mybatis/mapper/api/api.xml

@@ -34,7 +34,10 @@
         <choose>
             <when test='careAgencyCode != null and careAgencyCode != ""'>
                 <![CDATA[
-                       AND CENTER_CODE    = #{centerCode}
+                       AND CENTER_CODE    = (SELECT center_code
+                                               FROM api_manager
+                                              WHERE cooperative_code = #{careAgencyCode}
+                                                AND use_yn = 'C')
                 ]]>
             </when>
             <otherwise>
@@ -79,14 +82,7 @@
                    IFNULL(DATE_FORMAT(PPH.RECORDED_DATE, '%Y-%m-%d %H:%i'), '')      AS recordedDate,
                    IFNULL(DATE_FORMAT(PPH.CREATE_DATE, '%Y-%m-%d %H:%i'), '')      AS createDate
               FROM PATIENT_PHR_HISTORY PPH
-              LEFT JOIN (SELECT PATIENT_IDX,
-                                PATIENT_NUMBER,
-                                PATIENT_NAME,
-                                PATIENT_PHONE,
-                                JUMIN,
-                                CENTER_CODE
-                           FROM PATIENT_CARE
-                          WHERE CENTER_CODE = 63) PC
+              LEFT JOIN PATIENT_CARE PC
                 ON PC.PATIENT_IDX = PPH.PATIENT_IDX
              WHERE 1 = 1
                AND PPH.PHR_TYPE      = #{resourceType}
@@ -95,7 +91,10 @@
         <choose>
             <when test='careAgencyCode != null and careAgencyCode != ""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = #{centerCode}
+                       AND PC.CENTER_CODE    = (SELECT center_code
+                                                  FROM api_manager
+                                                 WHERE cooperative_code = #{careAgencyCode}
+                                                   AND use_yn = 'C')
                 ]]>
             </when>
             <otherwise>
@@ -130,21 +129,17 @@
                    IFNULL(PM.RECORDED_BY_ID, '')                             AS recordedById,
                    IFNULL(DATE_FORMAT(PM.CREATE_DATE, '%Y-%m-%d %H:%i'), '') AS createDate
               FROM PATIENT_MEMO PM
-              LEFT JOIN (SELECT PATIENT_IDX,
-                                PATIENT_NUMBER,
-                                PATIENT_NAME,
-                                PATIENT_PHONE,
-                                JUMIN,
-                                CENTER_CODE
-                           FROM PATIENT_CARE
-                          WHERE CENTER_CODE = 63) PC
+              LEFT JOIN PATIENT_CARE PC
                 ON PM.PATIENT_IDX = PC.PATIENT_IDX
              WHERE 1 = 1
         ]]>
         <choose>
             <when test='careAgencyCode != null and careAgencyCode != ""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = #{centerCode}
+                       AND PC.CENTER_CODE    = (SELECT center_code
+                                                  FROM api_manager
+                                                 WHERE cooperative_code = #{careAgencyCode}
+                                                   AND use_yn = 'C')
                 ]]>
             </when>
             <otherwise>
@@ -198,21 +193,17 @@
                    IFNULL(PS.BLOOD_PRESSURE_LEVEL, '') AS bloodPressureLevel,
                    IFNULL(PS.OXYGEN_SATURATION, '')    AS oxygenSaturation
               FROM PATIENT_SYMPTOM PS
-              LEFT JOIN (SELECT PATIENT_IDX,
-                                PATIENT_NUMBER,
-                                PATIENT_NAME,
-                                PATIENT_PHONE,
-                                JUMIN,
-                                CENTER_CODE
-                           FROM PATIENT_CARE
-                          WHERE CENTER_CODE = 63) PC
+              LEFT JOIN PATIENT_CARE PC
                 ON PS.PATIENT_IDX = PC.PATIENT_IDX
              WHERE 1 = 1
         ]]>
         <choose>
             <when test='careAgencyCode != null and careAgencyCode != ""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = #{centerCode}
+                       AND PC.CENTER_CODE    = (SELECT center_code
+                                                  FROM api_manager
+                                                 WHERE cooperative_code = #{careAgencyCode}
+                                                   AND use_yn = 'C')
                 ]]>
             </when>
             <otherwise>
@@ -264,21 +255,17 @@
                     IFNULL(PSS.RECORDED_DATE, '')                              AS recordedByDate,
                     IFNULL(DATE_FORMAT(PSS.CREATE_DATE, '%Y-%m-%d %H:%i'), '') AS createDate
                FROM PATIENT_SYMPTOM_SIM PSS
-               LEFT JOIN (SELECT PATIENT_IDX,
-                                 PATIENT_NUMBER,
-                                 PATIENT_NAME,
-                                 PATIENT_PHONE,
-                                 JUMIN,
-                                 CENTER_CODE
-                            FROM PATIENT_CARE
-                           WHERE CENTER_CODE = 63) PC
+               LEFT JOIN PATIENT_CARE PC
                  ON PC.PATIENT_IDX = PSS.PATIENT_IDX
               WHERE 1 = 1
         ]]>
         <choose>
             <when test='careAgencyCode != null and careAgencyCode != ""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = #{centerCode}
+                       AND PC.CENTER_CODE    = (SELECT center_code
+                                                  FROM api_manager
+                                                 WHERE cooperative_code = #{careAgencyCode}
+                                                   AND use_yn = 'C')
                 ]]>
             </when>
             <otherwise>
@@ -316,7 +303,10 @@
         <choose>
             <when test='centerCode != null and centerCode != ""'>
                 <![CDATA[
-                       AND CENTER_CODE    = #{centerCode}
+                       AND CENTER_CODE    = (SELECT center_code
+                                               FROM api_manager
+                                              WHERE cooperative_code = #{careAgencyCode}
+                                                AND use_yn = 'C')
                 ]]>
             </when>
             <otherwise>
@@ -365,6 +355,21 @@
         ]]>
      </select>
      
+     <select id="selectCodeData" parameterType="String" resultType="ApiStatisticsDTO">
+        <![CDATA[
+            SELECT CENTER_CODE                              AS centerCode,
+                   COOPERATIVE_CODE                         AS cooperativeCode,
+                   (SELECT LOCATION_CODE
+                      FROM CENTER_INFO CI
+                     WHERE CI.CENTER_CODE = AM.CENTER_CODE
+                       AND CI.COOPERATIVE_CODE = AM.COOPERATIVE_CODE) AS locationCode
+              FROM API_MANAGER AM
+             WHERE 1 = 1
+               AND COOPERATIVE_CODE = #{careAgencyCode}
+               AND USE_YN = 'C'
+        ]]>
+     </select>
+     
      <insert id="insertStatisticsData" parameterType="ApiStatisticsDTO">
         <![CDATA[
             INSERT INTO API_STATISTICS

+ 72 - 0
src/main/resources/mybatis/mapper/api/apiMoniter.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.lemon.lifecenter.mapper.ApiMoniterMapper">
+    <select id="selectApiStatisticsCount" parameterType="ApiMoniterDTO" resultType="int">
+        <![CDATA[
+             SELECT COUNT(DISTINCT (AST.CENTER_CODE))
+              FROM API_STATISTICS AST
+              LEFT JOIN CENTER_INFO CI
+                ON AST.CENTER_CODE = CI.CENTER_CODE
+              LEFT JOIN LOCATION_INFO LI
+                ON AST.LOCATION_CODE = LI.LOCATION_CODE
+             WHERE AST.RESULT = 'success'
+        ]]>
+        <if test='locationCode != null and locationCode != ""'>
+            <![CDATA[
+                AND LI.LOCATION_CODE = #{locationCode}
+            ]]>
+        </if>
+        <if test='centerName != null and centerName != ""'>
+            <![CDATA[
+                AND CI.CENTER_NAME LIKE CONCAT('%', #{centerName}, '%')
+            ]]>
+        </if>
+        <if test='startDate != null and startDate != "" and endDate != null and endDate != ""'>
+            <![CDATA[
+                AND DATE_FORMAT(AST.CREATE_DATE, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
+            ]]>
+        </if>
+    </select>
+    
+    <select id="selectApiStatistics" parameterType="ApiMoniterDTO" resultType="ApiMoniterDTO">
+        <![CDATA[
+            SELECT AST.CENTER_CODE                                  AS centerCode,
+                   AST.LOCATION_CODE                                AS locationCode,
+                   AST.COOPERATIVE_CODE                             AS cooperativeCode,
+                   CI.CENTER_NAME                                   AS centerName,
+                   LI.LOCATION_NAME                                 AS locationName,
+                   (SELECT COOPERATIVE_NAME 
+                      FROM COOPERATIVE_HOSPITAL 
+                     WHERE COOPERATIVE_CODE = AST.COOPERATIVE_CODE) AS cooperativeName,
+                   COUNT(*)                                         AS apiCount,
+                   SUM(API_COUNT)                                   AS numberOfCase
+              FROM API_STATISTICS AST
+              LEFT JOIN CENTER_INFO CI
+                ON AST.CENTER_CODE = CI.CENTER_CODE
+              LEFT JOIN LOCATION_INFO LI
+                ON AST.LOCATION_CODE = LI.LOCATION_CODE
+             WHERE AST.RESULT = 'success'
+        ]]>
+        <if test='locationCode != null and locationCode != ""'>
+            <![CDATA[
+                AND LI.LOCATION_CODE = #{locationCode}
+            ]]>
+        </if>
+        <if test='centerName != null and centerName != ""'>
+            <![CDATA[
+                AND CI.CENTER_NAME LIKE CONCAT('%', #{centerName}, '%')
+            ]]>
+        </if>
+        <if test='startDate != null and startDate != "" and endDate != null and endDate != ""'>
+            <![CDATA[
+                AND DATE_FORMAT(AST.CREATE_DATE, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
+            ]]>
+        </if>
+        <![CDATA[
+             GROUP BY AST.CENTER_CODE
+             ORDER BY CI.CENTER_NAME
+             LIMIT ${limit}, ${limitMax}
+        ]]>
+    </select>
+</mapper>

+ 267 - 0
src/main/webapp/WEB-INF/jsp/api/moniter/list.jsp

@@ -0,0 +1,267 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+    pageEncoding="UTF-8"%>
+<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
+<script>
+var startDate = "<c:out value='${startDate}'/>";
+var endDate   = "<c:out value='${endDate}'/>";
+
+    $(function() {
+        $("input[name=\"startDate\"]").daterangepicker({
+            singleDatePicker : true,
+            showDropdowns : true,
+//             startDate : "<c:out value='${startDate}'/>",
+            locale : {
+                //format : "M/DD hh:mm A"
+                format : "YYYY-MM-DD"
+            },
+            maxDate : new Date()
+        });
+        $("input[name=\"endDate\"]").daterangepicker({
+            singleDatePicker : true,
+            showDropdowns : true,
+//             startDate : "<c:out value='${endDate}'/>",
+            locale : {
+                //format : "M/DD hh:mm A"
+                format : "YYYY-MM-DD"
+            },
+            maxDate : new Date()
+        });
+        
+        $("input[name=\"startDate\"]").val( startDate );
+        $("input[name=\"endDate\"]").val( endDate );
+    });
+
+function getExcel(){
+    if( $.trim( $( "#downMemo" ).val() ) == "" ){
+        alertBox({ txt : "사유를 입력해주세요" });
+        $( ".modal-header>.modal-title h3" ).remove();
+        return false;
+    }
+    var newForm = $( "#searchForm" ).clone();
+    
+    newForm.attr( "id", "excelForm" );
+    newForm.attr( "method", "post" );
+    newForm.attr( "action", "./excel" );
+    newForm.attr( "target", "_blank" );
+    newForm.hide();
+    
+    $( document.body ).append( newForm );
+    newForm.submit();
+    $( "button.close" ).click();
+    $( "#downMemo" ).val( "" );
+    $( "#excelForm" ).remove();
+    
+}
+</script>
+</head>
+<body>
+    <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="wrapper">
+        <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>
+        
+        <div class="main">
+            <jsp:include page="${data._INCLUDE}/top.jsp"></jsp:include>
+
+            <main class="content">
+                <div class="container-fluid p-0">
+                    <!-- 환지관리 START -->
+                    <div class="row">
+                        <div class="col-12 col-lg-6">
+                            <h1 class="h3 mb-3">생활치료센터 오픈API 통계</h1>
+                        </div>
+                        <div class="col-12 col-lg-6  text-right">
+                            <nav aria-label="breadcrumb">
+                                <ol class="breadcrumb">
+                                    <li class="breadcrumb-item"><a href="javscript:;">Home</a></li>
+                                    <li class="breadcrumb-item active">생활치료센터 오픈API 통계</li>
+                                </ol>
+                            </nav>
+                        </div>
+                    </div>
+                    <div class="row">
+                        <div class="col-12">
+                            <div class="card">
+                                <form action="?" method="get" id="searchForm">
+                                    <div class="card-body">
+                                        <table class="table mobile-table">
+                                            <colgroup>
+                                                <col style="width:10%">
+                                                <col style="width:40%">
+                                                <col style="width:10%">
+                                                <col style="width:40%">
+                                            </colgroup>
+                                            <tr>
+                                                <th>지역</th>
+                                                <td>
+                                                    <select class="custom-select form-control" name="locationCode">
+                                                        <option value="">전체</option>
+                                                        <c:forEach var="i" items="${locationList}">
+                                                            <option value="${i.locationCode}" <c:if test="${i.locationCode eq locationCode}"> selected="selected"</c:if>><c:out value="${i.locationName}"/></option>
+                                                        </c:forEach>
+                                                    </select>
+                                                </td>
+                                                <th>생활치료센터명</th>
+                                                <td>
+                                                    <input type="text" class="form-control" name="centerName" placeholder="생활치료센터명" value="<c:out value="${centerName}" />">
+                                                </td>
+                                            </tr>
+                                            <tr>
+                                                <th>등록일</th>
+                                                <td>
+                                                    <div class="row">
+                                                        <div class="col-lg-5 col-sm-5">
+                                                            <div class="form-group calendar-bar mb-xl-0">
+                                                                <input class="form-control" type="text" name="startDate" placeholder="검색 시작일자" autocomplete="off">
+                                                                <i class="align-middle mr-2 fas fa-fw fa-calendar-alt"></i>
+                                                            </div>
+                                                        </div>
+                                                        <div class="col-lg-2 col-sm-2 text-center">
+                                                            ~
+                                                        </div>
+                                                        <div class="col-lg-5 col-sm-5">
+                                                            <div class="form-group calendar-bar mb-xl-0">
+                                                                <input class="form-control" type="text" name="endDate" placeholder="검색 종료일자" autocomplete="off">
+                                                                <i class="align-middle mr-2 fas fa-fw fa-calendar-alt"></i>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                </td>
+                                                <td colspan="2">
+                                                    <button class="btn btn-primary">검색</button>
+                                                </td>
+                                            </tr>
+                                        </table>
+                                    </div>
+                                </form>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="row">
+                        <div class="col-12">
+                            <div class="card">
+                                <div class="card-body">
+                                    <div class="row mb-3">
+                                        <div class="col-6">
+                                            전체 :
+                                            <fmt:formatNumber value="${total}" pattern="#,###" />
+                                        </div>
+                                        <div class="col-6 text-right">
+                                            <button class="btn btn-success" data-toggle="modal" data-target="#excelDownMemo">Excel 다운로드</button>
+                                            <c:if test="${role._CREATE eq 'Y'}">
+                                                <button class="btn btn-primary" onclick="location.href='./new';">생활치료센터 신규 등록</button>
+                                            </c:if>
+                                        </div>
+                                    </div>
+                                    <div class="table-responsive">
+                                        <table class="table table-striped text-center">
+                                            <colgroup>
+                                                <col style=" width: 5%; ">
+                                                <col style=" width: 14%; ">
+                                                <col style=" width: 6%; ">
+                                                <col style=" width: 12%; ">
+                                                <col style=" width: 8%; ">
+                                                <col style=" width: 8%; ">
+                                            </colgroup>
+                                            <thead>
+                                                <tr>
+                                                    <th rowspan="2">번호</th>
+                                                    <th rowspan="2">생활치료센터</th>
+                                                    <th rowspan="2">지역</th>
+                                                    <th rowspan="2">협력병원</th>
+                                                    <th rowspan="2">API 호출 횟수</th>
+                                                    <th rowspan="2">API 호출 건수</th>
+                                                </tr>
+                                            </thead>
+                                            <tbody>
+                                                <c:choose>
+                                                    <c:when test="${total > 0}">
+                                                        <c:forEach var="l" items="${item}" varStatus="lStatus">
+                                                            <c:set var="viewLink" value="./info?centerCode=${l.centerCode}" />
+                                                            <c:set var="pageNum" value="${ ( total - lStatus.index ) - ( (page - 1) * pageSize ) }" />
+                                                            
+                                                            <tr>
+                                                                <td><fmt:formatNumber value="${pageNum}" pattern="#,###" /></td>
+                                                                <td>
+                                                                    <c:out value="${l.centerName}" />
+                                                                </td>
+                                                                <td><c:out value="${l.locationName}" /></td>
+                                                                <td><c:out value="${l.cooperativeName}" /></td>
+                                                                <td><c:out value="${l.apiCount}"/></td>
+                                                                <td><c:out value="${l.numberOfCase}"/></td>
+                                                            </tr>
+                                                        </c:forEach>
+                                                    </c:when>
+                                                    <c:otherwise>
+                                                        <tr>
+                                                            <td colspan="13">오픈API 통계 정보가 없습니다.</td>
+                                                        </tr>
+                                                    </c:otherwise>
+                                                </c:choose>
+                                            </tbody>
+                                        </table>
+                                    </div>
+                                    <div class="row mt-5">
+                                        <div class="col-12 col-lg-6 mb-2">
+                                        </div>
+                                        <div class="col-12 col-lg-6 mb-2">
+                                            <jsp:include page="${data._INCLUDE}/paging.jsp" flush="true">
+                                                <jsp:param name="firstPageNo" value="${paging.firstPageNo}" />
+                                                <jsp:param name="prevPageNo"  value="${paging.prevPageNo}" />
+                                                <jsp:param name="startPageNo" value="${paging.startPageNo}" />
+                                                <jsp:param name="pageNo"      value="${paging.pageNo}" />
+                                                <jsp:param name="endPageNo"   value="${paging.endPageNo}" />
+                                                <jsp:param name="nextPageNo"  value="${paging.nextPageNo}" />
+                                                <jsp:param name="finalPageNo" value="${paging.finalPageNo}" />
+                                                <jsp:param name="preFix"      value="${paging.preFix}" />
+                                                <jsp:param name="url"         value="${paging.url}" />
+                                                <jsp:param name="total"       value="${paging.totalCount}" />
+                                            </jsp:include>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <!-- 환자관리 END -->
+                </div>
+            </main>
+
+            <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
+        </div>
+    </div>
+</body>
+</html>

+ 5 - 2
src/main/webapp/WEB-INF/jsp/mobile/menu/menu.jsp

@@ -58,7 +58,10 @@ function token(callback) {
 function searchingDevice() {
     var jsonMsg = {
             "type":"command",
-            "functionType":"searchingDevice"
+            "functionType":"searchingDevice",
+            "value" : {
+                "callbackFn" : "callback"
+            }
         }
         toNative(jsonMsg);
 }
@@ -202,7 +205,7 @@ function searchingDevice() {
                         </a>
                     </li>
                     <li>
-                        <a href="javascript:return;" onclick="test();" id="deviceBtn">
+                        <a href="javascript:void(0);" onclick="searchingDevice();" id="deviceBtn">
                             <div class="image">
 <!--                                 <div class="new_icon">NEW</div> -->
                                 <img src="/resources/images/mobile/quick_5.png" />