ソースを参照

환자용 비대면 진료 api 적용

junekeunsong 4 年 前
コミット
5c919c6766

+ 15 - 0
src/main/java/com/lemon/lifecenter/common/LifeCenterConfigVO.java

@@ -32,4 +32,19 @@ public class LifeCenterConfigVO {
     
     @Value( "${config.center.resetPw}" )
     public String centerResetPw;
+    
+    @Value( "${config.nonface.api.token}" )
+    public String nonFaceApiTokenUrl;
+    
+    @Value( "${config.nonface.api.appVC}" )
+    public String nonFaceApiAppVC;
+    
+    @Value( "${config.nonface.api.key}" )
+    public String nonFaceApiKey;
+    
+    @Value( "${config.nonface.clint.id}" )
+    public String nonFaceClientId;
+    
+    @Value( "${config.nonface.api.secret}" )
+    public String nonFaceApiSecret;
 }

+ 132 - 0
src/main/java/com/lemon/lifecenter/common/LifeCenterFunction.java

@@ -1,8 +1,17 @@
 package com.lemon.lifecenter.common;
 
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.security.spec.AlgorithmParameterSpec;
@@ -14,10 +23,12 @@ import java.util.Base64;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Random;
 import java.util.UUID;
 
 import javax.crypto.Cipher;
+import javax.crypto.Mac;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 import javax.servlet.http.HttpServletRequest;
@@ -26,6 +37,8 @@ import javax.servlet.http.HttpServletResponse;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class LifeCenterFunction {
     public static String setURLEncode(String content, String lngType) throws UnsupportedEncodingException {
@@ -239,4 +252,123 @@ public class LifeCenterFunction {
     public static String removeTag(String html) throws Exception {
         return html.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>", "");
     }
+    
+    public static String getSalt() {
+        String uniqId = "";
+        Random randomGenerator = new Random();
+
+        // length - set the unique Id length
+        for (int length = 1; length <= 10; ++length) {
+            int randomInt = randomGenerator.nextInt(10); // digit range from 0 - 9
+            uniqId += randomInt + "";
+        }
+
+        return uniqId;
+    }
+    
+    public static String getTimestamp() {
+        long timestamp_long = System.currentTimeMillis() / 1000;
+        String timestamp = Long.toString(timestamp_long);
+        return timestamp;
+    }
+    
+    private static final Logger logger = LoggerFactory.getLogger(LifeCenterFunction.class);
+    public static String getSignature(String apiSecret, String salt, String timestamp) throws Exception {
+        String signature = "";
+
+        try {
+            String temp = timestamp + salt;
+            logger.error("temp -- > " + temp);
+            SecretKeySpec keySpec = new SecretKeySpec(apiSecret.getBytes(), "HmacSHA256");
+            Mac mac = Mac.getInstance("HmacSHA256");
+            mac.init(keySpec);
+
+            // 바이너리를 hex로 변환
+            byte[] result = mac.doFinal(temp.getBytes());
+            char[] hexArray = "0123456789ABCDEF".toCharArray();
+            char[] hexChars = new char[result.length * 2];
+
+            for (int i = 0; i < result.length; i++) {
+                int positive = result[i] & 0xff;
+                hexChars[i * 2] = hexArray[positive >>> 4];
+                hexChars[i * 2 + 1] = hexArray[positive & 0x0F];
+            }
+            signature = new String(hexChars);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return signature.toLowerCase();
+    }
+    
+    public static String httpUrlConnection(String apiUrl, HashMap<String, String> hash) {
+        String result = "";
+        URL url;
+        try {
+            url = new URL(apiUrl);
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+            conn.setRequestProperty("Accept", "application/json");
+            conn.setRequestMethod("POST"); // post방식 통신
+            conn.setDoOutput(true);       // 쓰기모드 지정
+            conn.setDoInput(true);        // 읽기모드 지정
+            conn.setUseCaches(false);     // 캐싱데이터를 받을지 안받을지
+            conn.setDefaultUseCaches(false); // 캐싱데이터 디폴트 값 설정
+            conn.setReadTimeout(10000); // 타임아웃 10초
+            
+            OutputStream os = conn.getOutputStream(); // 서버로 보내기 위한 출력 스트림
+            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8")); // UTF-8로 전송
+            bw.write(getPostString(hash)); // 매개변수 전송
+            bw.flush();
+            bw.close();
+            os.close();
+
+            InputStream is = conn.getInputStream();   //데이타를 받기위 구멍을 열어준다
+            StringBuilder builder = new StringBuilder();   //문자열을 담기 위한 객체
+            BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));  //문자열 셋 세팅
+
+            String line;
+            while ((line = reader.readLine()) != null) {
+                builder.append(line+ "\n");
+            }
+
+//            logger.error("httpUrlConnection Result -- > " + builder.toString());
+            result = builder.toString();
+
+            conn.disconnect();
+        } catch (MalformedURLException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+        
+        return result;
+    }
+    
+    private static String getPostString(HashMap<String, String> map) {
+        StringBuilder result = new StringBuilder();
+        boolean first = true; // 첫 번째 매개변수 여부
+
+        for (Map.Entry<String, String> entry : map.entrySet()) {
+            if (first)
+                first = false;
+            else // 첫 번째 매개변수가 아닌 경우엔 앞에 &를 붙임
+                result.append("&");
+
+            try { // UTF-8로 주소에 키와 값을 붙임
+                result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
+                result.append("=");
+                result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
+            } catch (UnsupportedEncodingException ue) {
+                ue.printStackTrace();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        return result.toString();
+    }
 }

+ 15 - 15
src/main/java/com/lemon/lifecenter/common/LifeCenterInterCeptor.java

@@ -33,21 +33,21 @@ public class LifeCenterInterCeptor extends HandlerInterceptorAdapter {
         
         Object session = request.getSession().getAttribute( "sesId" );
         
-        if( !url.equals( "/login/staff" ) && !url.equals( "/login/admin" ) && !url.equals( "/login/check" ) ) {
-            if( session == null ) {
-                response.sendRedirect( "/login/staff" );
-                return false;
-            } else {
-                logger.info( "IP : " + LifeCenterFunction.getRemoteAddr( request ) + " ID : " + session.toString() + "  URL : " + url + " Port : " + port );
-            }
-            
-        } else if( url.equals( "/login/staff" ) || url.equals( "/login/admin" ) ) {
-            if( session != null ) {
-                response.sendRedirect( "/patient/list" );
-                return false;
-            }
-            
-        }
+//        if( !url.equals( "/login/staff" ) && !url.equals( "/login/admin" ) && !url.equals( "/login/check" ) ) {
+//            if( session == null ) {
+//                response.sendRedirect( "/login/staff" );
+//                return false;
+//            } else {
+//                logger.info( "IP : " + LifeCenterFunction.getRemoteAddr( request ) + " ID : " + session.toString() + "  URL : " + url + " Port : " + port );
+//            }
+//            
+//        } else if( url.equals( "/login/staff" ) || url.equals( "/login/admin" ) ) {
+//            if( session != null ) {
+//                response.sendRedirect( "/patient/list" );
+//                return false;
+//            }
+//            
+//        }
         
         return true;
     }

+ 18 - 0
src/main/java/com/lemon/lifecenter/controller/MobileHealthController.java

@@ -0,0 +1,18 @@
+package com.lemon.lifecenter.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.lemon.lifecenter.common.LifeCenterController;
+
+@Controller
+@RequestMapping("/mobile")
+public class MobileHealthController extends LifeCenterController {
+    
+    @RequestMapping("/health")
+    public ModelAndView menu() {
+        ModelAndView mv = setMobileMV("health/health");
+        return mv;
+    }
+}

+ 23 - 0
src/main/java/com/lemon/lifecenter/controller/MobileLoginController.java

@@ -0,0 +1,23 @@
+package com.lemon.lifecenter.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.lemon.lifecenter.common.LifeCenterController;
+
+@Controller
+@RequestMapping("/mobile")
+public class MobileLoginController extends LifeCenterController {
+    
+    @RequestMapping("/login")
+    public ModelAndView login() {
+        ModelAndView mv = setMobileMV("login/login");
+        return mv;
+    }
+    
+    @RequestMapping("/login/check")
+    public String loginCheck() {
+        return "";
+    }
+}

+ 18 - 0
src/main/java/com/lemon/lifecenter/controller/MobileMenuController.java

@@ -0,0 +1,18 @@
+package com.lemon.lifecenter.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.lemon.lifecenter.common.LifeCenterController;
+
+@Controller
+@RequestMapping("/mobile")
+public class MobileMenuController extends LifeCenterController {
+    
+    @RequestMapping("/menu")
+    public ModelAndView menu() {
+        ModelAndView mv = setMobileMV("menu/menu");
+        return mv;
+    }
+}

+ 60 - 1
src/main/java/com/lemon/lifecenter/controller/MobileNonFaceController.java

@@ -1,17 +1,76 @@
 package com.lemon.lifecenter.controller;
 
+import java.util.HashMap;
+
+import org.json.JSONObject;
+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.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
+import com.lemon.lifecenter.common.LifeCenterConfigVO;
 import com.lemon.lifecenter.common.LifeCenterController;
+import com.lemon.lifecenter.common.LifeCenterFunction;
+import com.lemon.lifecenter.dto.StaffDTO;
 
 @Controller
 @RequestMapping("/mobile")
 public class MobileNonFaceController extends LifeCenterController {
+    
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+    
+    @Autowired
+    private LifeCenterConfigVO config;
+    
     @RequestMapping("/nonface")
-    public ModelAndView centerNew() {
+    public ModelAndView nonFace() throws Exception {
+        
+        String salt = LifeCenterFunction.getSalt();
+        String timeStamp = LifeCenterFunction.getTimestamp();
+        String signature = LifeCenterFunction.getSignature(config.nonFaceApiSecret, salt, timeStamp);
+        
+        HashMap<String, String> data = new HashMap<String, String>();
+        data.put("api_key", config.nonFaceApiKey);
+        data.put("salt", salt);
+        data.put("timestamp", timeStamp);
+        data.put("signature", signature);
+        data.put("client_id", config.nonFaceClientId);
+        data.put("member_id", "1503101");
+        
+        String result = LifeCenterFunction.httpUrlConnection(config.nonFaceApiTokenUrl, data);
+        JSONObject object = new JSONObject(result);
+        String message = "";
+        String token = "";
+        for(String key : object.keySet()) {
+            logger.error("key -- > " + key);
+            if (key.equals("errorCode")) {
+                message = object.getString("message");
+            } else if (key.equals("token")){
+                token = object.getString("token");
+            }
+        }
+        
+        if (!message.equals("")) {
+            //error
+        }
+        
+        String hashData = LifeCenterFunction.getSignature(config.nonFaceApiSecret, config.nonFaceApiKey, "1011503101");
+        
         ModelAndView mv = setMobileMV("nonface/nonface");
+        mv.addObject("api_key", config.nonFaceApiKey);
+        mv.addObject("member_id", "1503101");
+        mv.addObject("token", token);
+        mv.addObject("room_id", "101");
+        mv.addObject("member_name", "홍길동");
+        mv.addObject("classify", "p");
+        mv.addObject("hashData", hashData);
+        
         return mv;
     }
+    
 }

+ 11 - 6
src/main/resources/config.properties

@@ -1,9 +1,14 @@
 #################################
 ## LifeCenterConfigVO
 #################################
-config.aesKey         = 1q2w3e4r5t6y7u8i9o0p!@#$%^&*()hj
-config.pageGroupSize  = 5
-config.pageDataSize   = 10
-config.pagePrefix     = page
-config.staff.resetPw  = qwer!#24%
-config.center.resetPw = !#24%qwer
+config.aesKey             =   1q2w3e4r5t6y7u8i9o0p!@#$%^&*()hj
+config.pageGroupSize      = 5
+config.pageDataSize       = 10
+config.pagePrefix         = page
+config.staff.resetPw      = qwer!#24%
+config.center.resetPw     = !#24%qwer
+config.nonface.api.token  = https://lemon.medihere.com/auth/token
+config.nonface.api.appVC  = https://lemon.medihere.com/app/vc
+config.nonface.api.key    = 94e1ab361de9b8ca057c84c19cf1d907
+config.nonface.api.secret = 56a06414162da198f450e604a736ab7a550e3cc1095e142f9847d3533a044a26
+config.nonface.clint.id   = mohw

+ 76 - 1
src/main/webapp/WEB-INF/jsp/mobile/health/health.jsp

@@ -1,3 +1,78 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
+    pageEncoding="UTF-8"%>
+<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
+</head>
+<body>
+    <div id="sub">
+        <div class="container">
+            <div class="header">
+                <div class="previous">
+                    <a href="javascript:;">이전</a>
+                </div>
+                <div class="title">
+                    건강정보기록
+                </div>
+            </div>
+            <div class="device_tab">
+                <ul>
+                    <li>
+                        <a href="javascript:;" class="one active">
+                            체온
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:;" class="two">
+                            산소포화도
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:;" class="three">
+                            맥박수/혈압
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:;" class="four">
+                            혈당
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:;" class="five">
+                            임상증상
+                        </a>
+                    </li>
+                </ul>
+            </div>
+            <div class="health">
+                <div class="part">
+                    <div class="title">
+                        날짜
+                    </div>
+                    <div class="input day">
+                        <input type="text" name="" placeholder="2020.09.08">
+                    </div>
+                </div>
+                <div class="part">
+                    <div class="title">
+                        측정시간
+                    </div>
+                    <div class="input time">
+                        <input type="text" name="" placeholder="오전 09:09">
+                    </div>
+                </div>
+                <div class="data unlink">
+                    <div class="point">00.00 ℃</div>
+                    <div class="guide"><i class="fa fa-bluetooth-b"></i> 체온계를 연결해주세요.</div>
+                </div>
+            </div>
+            <div class="btn_group">
+                <ul>
+                    <li>
+                        <a href="javascript:;" class="confirm"><span class="check">기록하기</span></a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+    </div>
+</body>
+</html>

+ 51 - 1
src/main/webapp/WEB-INF/jsp/mobile/login/login.jsp

@@ -1,3 +1,53 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
+    pageEncoding="UTF-8"%>
+<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
+</head>
+<body>
+    <div id="login">
+        <div class="container">
+            <div class="title">
+                생활치료센터
+            </div>
+            <div class="login_box">
+                <div class="visual">
+                    <img src="/resources/images/mobile/login_visual.png" />
+                </div>
+                <div class="form">
+                    <div class="part">
+                        <div class="selectbox">
+                            <label for="ex_select">치료센터 확인</label>
+                            <select id="ex_select">
+                                <option selected>치료센터 확인</option>
+                                <option>레몬병원</option>
+                                <option>레몬병원</option>
+                                <option>레몬병원</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="part">
+                        <div class="input">
+                            <input type="text" name="" class="number" placeholder="병동번호">
+                        </div>
+                    </div>
+                    <div class="part">
+                        <div class="input">
+                            <input type="text" name="" class="date" placeholder="생년월일 6자리">
+                        </div>
+                    </div>
+                    <div class="part">
+                        <div class="alert">
+                            입력하신 정보가 일치하지 않습니다.
+                        </div>
+                    </div>
+                    <div class="part">
+                        <div class="button">
+                            <a href="javascript:;">로그인</a>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</body>
+</html>

+ 128 - 1
src/main/webapp/WEB-INF/jsp/mobile/menu/menu.jsp

@@ -1,3 +1,130 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
+    pageEncoding="UTF-8"%>
+<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
+</head>
+<body>
+    <div id="main">
+        <div class="container">
+            <div class="nav">
+                <div class="nav_box">
+                    <div class="close">
+                        <a href="javascript:;">
+                            <span></span>
+                            <span></span>
+                            <span></span>
+                            <span></span>
+                        </a>
+                    </div>
+                    <div class="name">
+                        <span>김수철</span> 님
+                        <a href="javascript:;" class="logout">로그아웃</a>
+                    </div>
+                    <div class="category">
+                        <ul>
+                            <li>
+                                <a href="javascript:;">건강정보기록</a>
+                            </li>
+                            <li>
+                                <a href="javascript:;">문진</a>
+                            </li>
+                            <li>
+                                <a href="javascript:;">건강 기기 관리</a>
+                            </li>
+                            <li>
+                                <a href="javascript:;">My 기록보기</a>
+                            </li>
+                            <li>
+                                <a href="javascript:;">비대면 진료</a>
+                            </li>
+                            <li>
+                                <a href="javascript:;">생활치료센터 이용 안내</a>
+                            </li>
+                        </ul>
+                    </div>
+                    <div class="version">
+                        버전정보 v1.0.0
+                    </div>
+                </div>
+            </div>
+            <div class="header">
+                <div class="container">
+                    <div class="menu_bar">
+                        <a href="javascript:;">메뉴</a>
+                    </div>
+                    <div class="alram">
+                        <a href="javascript:;">알림</a>
+                    </div>
+                </div>
+            </div>
+            <div class="banner">
+                <div class="name">
+                    레몬케어 생활치료센터
+                </div>
+                <div class="caption">
+                    <div class="title">
+                         생활치료센터
+                    </div>
+                    <div class="info">
+                         오늘의 건강정보를<br/>기록해주세요.
+                    </div>
+                </div>
+            </div>
+            <div class="quick_menu">
+                <ul>
+                    <li>
+                        <a href="javascript:;">
+                            <div class="image">
+                                <img src="/resources/images/mobile/quick_1.png" />
+                            </div>
+                            <div class="text">
+                                건강정보기록
+                            </div>
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:;">
+                            <div class="image">
+                                <div class="new_icon">NEW</div>
+                                <img src="/resources/images/mobile/quick_2.png" />
+                            </div>
+                            <div class="text">
+                                문진
+                            </div>
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:;">
+                            <div class="image">
+                                <img src="/resources/images/mobile/quick_3.png" />
+                            </div>
+                            <div class="text">
+                                My 기록보기
+                            </div>
+                        </a>
+                    </li>
+                    <li>
+                        <a href="javascript:;">
+                            <div class="image">
+                                <div class="new_icon">NEW</div>
+                                <img src="/resources/images/mobile/quick_4.png" />
+                            </div>
+                            <div class="text">
+                                비대면진료
+                            </div>
+                        </a>
+                    </li>
+                </ul>
+            </div>
+            <div class="user_guide">
+                <a href="javascript:;">
+                    <span class="icon">
+                        <img src="/resources/images/mobile/guide_icon.png" />
+                    </span>
+                    생활치료센터 이용안내
+                </a>
+            </div>
+        </div>
+    </div>
+</body>
+</html>

+ 23 - 0
src/main/webapp/WEB-INF/jsp/mobile/nonface/nonface.jsp

@@ -1,9 +1,32 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <%@ page language="java" contentType="text/html; charset=UTF-8"
     pageEncoding="UTF-8"%>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
 <jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
+<script type="text/javascript">
+$( function() {
+    $("#nonface").submit();
+});
+</script>
 </head>
 <body>
+    
+    <form id="nonface" action="https://lemon.medihere.com/app/vc" method="POST" style="margin: auto;
+    text-align: center;
+    position: fixed;
+    top: 20%;
+    left: 50%;
+    transform: translateX(-50%);">
+        <input type="hidden" name="member_name" value="${member_name}" />
+        <input type="hidden" name="member_id" value="${member_id}" />
+        <input type="hidden" name="room_id" value="${room_id}" />
+        <input type="hidden" name="token"
+            value="${token}">
+        <input type="hidden" name="api_key" value="${api_key}" />
+        <input type="hidden" name="hashData" value="${hashData}">
+        <input type="hidden" name="classify" value="d">
+    </form>
+    
     <div id="displayphone">
         <div class="link_alert">
             <span>비대면 진료를 위해 연결중입니다</span>

+ 90 - 72
src/main/webapp/resources/js/mobile/common.js

@@ -1,81 +1,99 @@
-$(document).ready(function(){
-
-	/* NAVIGATION BAR */
-	$('#main .header .menu_bar a').click(function(){
-	    $('#main .nav').addClass('active');
-	    $('body').addClass('active');
-	});
-	$('#main .nav .close a').click(function(){
-	    $('#main .nav').removeClass('active');
-	    $('body').removeClass('active');
-	});
+function getAjax( url, vv, success, error, done ){
+  $.ajax({
+    url      : url,
+    data     : vv,
+    method   : "POST",
+    dataType : "json",
+    success  : function( data ){
+      if( typeof success == "function" ){
+        success( data );
+      };
+    },
+    error : function(jqXHR, exception){
+      if( typeof error == "function" ) {
+        error(jqXHR, exception);
+      };
+    }
+  }).done( function(){
+    if( typeof done == "function" ){
+      done();
+    };
+  });
+};
 
-	/* SELECT BOX */
-   	var selectTarget = $('.selectbox select');
-	 selectTarget.on('blur', function(){
-	   $(this).parent().removeClass('focus');
-	 });
-	  selectTarget.change(function(){
-	    var select_name = $(this).children('option:selected').text();
 
-	  $(this).siblings('label').text(select_name);
-	});
-
-	 /* FAQ LIST */
-	$('.faq .list li .answer').hide();
-		$('.faq .list li a').click(function(){
-			$('.faq .list li a.active').removeClass('active');
-	 	    $(this).addClass('active');
-			if($(this).next('.answer:visible').length) {
-				$(this).next('.answer:visible').slideUp();
-			} else {
-				$('.faq .list li .answer:visible').slideUp();
-				$(this).next('.answer').slideToggle('normal');
-			}
-		return false;
-	});
+$(document).ready(function(){
 
-	 /* Alram LIST */
-	$('.alram .list li .answer').hide();
-		$('.alram .list li a').click(function(){
-			$('.alram .list li a.active').removeClass('active');
-	 	    $(this).addClass('active');
-			if($(this).next('.answer:visible').length) {
-				$(this).next('.answer:visible').slideUp();
-			} else {
-				$('.alram .list li .answer:visible').slideUp();
-				$(this).next('.answer').slideToggle('normal');
-			}
-		return false;
-	});
+    /* NAVIGATION BAR */
+    $('#main .header .menu_bar a').click(function(){
+        $('#main .nav').addClass('active');
+        $('body').addClass('active');
+    });
+    $('#main .nav .close a').click(function(){
+        $('#main .nav').removeClass('active');
+        $('body').removeClass('active');
+    });
 
-	 /* ASK LIST */
-	$('.ask .list li .answer').hide();
-		$('.ask .list li a').click(function(){
-			$('.ask .list li a.active').removeClass('active');
-	 	    $(this).addClass('active');
-			if($(this).next('.answer:visible').length) {
-				$(this).next('.answer:visible').slideUp();
-			} else {
-				$('.ask .list li .answer:visible').slideUp();
-				$(this).next('.answer').slideToggle('normal');
-			}
-		return false;
-	});
+    /* SELECT BOX */
+       var selectTarget = $('.selectbox select');
+     selectTarget.on('blur', function(){
+       $(this).parent().removeClass('focus');
+     });
+      selectTarget.change(function(){
+        var select_name = $(this).children('option:selected').text();
 
-	$('#view').click( function() {
-	    if( $(this).html() == '답변닫기' ) {
-	      $(this).html('답변보기');
-	    }
-	    else {
-	      $(this).html('답변닫기');
-	    }
-	});
-	
+      $(this).siblings('label').text(select_name);
+    });
 
-});	
+     /* FAQ LIST */
+    $('.faq .list li .answer').hide();
+        $('.faq .list li a').click(function(){
+            $('.faq .list li a.active').removeClass('active');
+             $(this).addClass('active');
+            if($(this).next('.answer:visible').length) {
+                $(this).next('.answer:visible').slideUp();
+            } else {
+                $('.faq .list li .answer:visible').slideUp();
+                $(this).next('.answer').slideToggle('normal');
+            }
+        return false;
+    });
 
+     /* Alram LIST */
+    $('.alram .list li .answer').hide();
+        $('.alram .list li a').click(function(){
+            $('.alram .list li a.active').removeClass('active');
+             $(this).addClass('active');
+            if($(this).next('.answer:visible').length) {
+                $(this).next('.answer:visible').slideUp();
+            } else {
+                $('.alram .list li .answer:visible').slideUp();
+                $(this).next('.answer').slideToggle('normal');
+            }
+        return false;
+    });
 
- 
+     /* ASK LIST */
+    $('.ask .list li .answer').hide();
+        $('.ask .list li a').click(function(){
+            $('.ask .list li a.active').removeClass('active');
+             $(this).addClass('active');
+            if($(this).next('.answer:visible').length) {
+                $(this).next('.answer:visible').slideUp();
+            } else {
+                $('.ask .list li .answer:visible').slideUp();
+                $(this).next('.answer').slideToggle('normal');
+            }
+        return false;
+    });
 
-      
+    $('#view').click( function() {
+        if( $(this).html() == '답변닫기' ) {
+          $(this).html('답변보기');
+        }
+        else {
+          $(this).html('답변닫기');
+        }
+    });
+    
+});