|
@@ -1,18 +1,22 @@
|
|
package com.lemon.lifecenter.controller;
|
|
package com.lemon.lifecenter.controller;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
+import org.json.JSONObject;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
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.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import com.lemon.lifecenter.common.LifeCenterConfigVO;
|
|
import com.lemon.lifecenter.common.LifeCenterConfigVO;
|
|
@@ -175,6 +179,17 @@ public class PatientController extends LifeCenterController {
|
|
jumin = jumin.substring(0, 4) + "년 " + jumin.substring(4, 6) + "월 " + jumin.substring(6, 8) + "일";
|
|
jumin = jumin.substring(0, 4) + "년 " + jumin.substring(4, 6) + "월 " + jumin.substring(6, 8) + "일";
|
|
dto.setJumin(jumin);
|
|
dto.setJumin(jumin);
|
|
|
|
|
|
|
|
+ dto.setPatientPhone(LifeCenterFunction.phone(dto.getPatientPhone()));
|
|
|
|
+ dto.setGuardianPhone(LifeCenterFunction.phone(dto.getGuardianPhone()));
|
|
|
|
+
|
|
|
|
+ String bloodPress = dto.getBloodPressureLevel();
|
|
|
|
+
|
|
|
|
+ if (!bloodPress.equals("")) {
|
|
|
|
+ String[] bloodPressureLevel = dto.getBloodPressureLevel().split("[|]");
|
|
|
|
+ logger.error("bloodPress -- > " + bloodPressureLevel[0]);
|
|
|
|
+ logger.error("bloodPress -- > " + bloodPressureLevel[1]);
|
|
|
|
+ }
|
|
|
|
+
|
|
mv.addObject("patientIdx", patientIdx);
|
|
mv.addObject("patientIdx", patientIdx);
|
|
mv.addObject("info", dto);
|
|
mv.addObject("info", dto);
|
|
return mv;
|
|
return mv;
|
|
@@ -193,4 +208,59 @@ public class PatientController extends LifeCenterController {
|
|
|
|
|
|
return mv;
|
|
return mv;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @RequestMapping( value="/nonFaceStart", method = RequestMethod.POST )
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public String nonFaceStart(
|
|
|
|
+ @RequestParam( value="pId", required = true ) String pId,
|
|
|
|
+ @RequestParam( value="roomId", required = true ) String roomId,
|
|
|
|
+ @RequestParam( value="pName", required = true ) String pName,
|
|
|
|
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
+
|
|
|
|
+ String salt = LifeCenterFunction.getSalt();
|
|
|
|
+ String timeStamp = LifeCenterFunction.getTimestamp();
|
|
|
|
+ String signature = LifeCenterFunction.getSignature(config.nonFaceApiSecret, salt, timeStamp);
|
|
|
|
+
|
|
|
|
+ String userId = LifeCenterSessionController.getSession(request, "sesId");
|
|
|
|
+ String userNm = LifeCenterSessionController.getSession(request, "sesName");
|
|
|
|
+
|
|
|
|
+ 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", userId);
|
|
|
|
+
|
|
|
|
+ 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, roomId + userId); //"1011503101"
|
|
|
|
+
|
|
|
|
+ object.put("api_key", config.nonFaceApiKey);
|
|
|
|
+ object.put("member_id", userId);
|
|
|
|
+ object.put("token", token);
|
|
|
|
+ object.put("room_id", roomId);
|
|
|
|
+ object.put("member_name", userNm);
|
|
|
|
+ object.put("classify", "d"); // p이면 환자 d이면 의사
|
|
|
|
+ object.put("hashData", hashData);
|
|
|
|
+ logger.error("pid -- > " + hashData);
|
|
|
|
+
|
|
|
|
+ return object.toString();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|