|  | @ -19,6 +19,8 @@ import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.healthIndex.HealthIndexUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.http.HttpClientUtil;
 | 
	
		
			
				|  |  | import org.apache.commons.lang.StringUtils;
 | 
	
		
			
				|  |  | import org.apache.http.NameValuePair;
 | 
	
		
			
				|  |  | import org.apache.http.message.BasicNameValuePair;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @ -180,27 +182,17 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                 jsonObject.put("patientName",logDO.getPatientName());
 | 
	
		
			
				|  |  |                 jsonObject.put("deviceSn",logDO.getDeviceSn());
 | 
	
		
			
				|  |  |                 String url = cloudCareUrl+"cloudCare/noLogin/emergency_assistance/newOrder";
 | 
	
		
			
				|  |  |                 Map map = new HashMap<String, String>();
 | 
	
		
			
				|  |  |                 map.put("patientId", logDO.getPatient());
 | 
	
		
			
				|  |  |                 List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  |                 params.add(new BasicNameValuePair("jsonData", jsonObject.toJSONString()));
 | 
	
		
			
				|  |  |                 params.add(new BasicNameValuePair("patientId", logDO.getPatient()));
 | 
	
		
			
				|  |  |                 if (deviceDO.getCategoryCode().equals("4")) {
 | 
	
		
			
				|  |  |                     map.put("orderSource", 2); //工单来源工单发起来源状态 1APP 2手环 3居家报警
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("orderSource", "2"));//工单来源工单发起来源状态 1APP 2手环 3居家报警
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (deviceDO.getCategoryCode().equals("7")) {
 | 
	
		
			
				|  |  |                     map.put("orderSource", 3);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 map.put("jsonData", jsonObject.toJSONString());
 | 
	
		
			
				|  |  |                 String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
 | 
	
		
			
				|  |  |                 String postParams = AesEncryptUtils.agEncrypt(content);
 | 
	
		
			
				|  |  |                 String response = httpClientUtil.postBodyRawForm(url,postParams);
 | 
	
		
			
				|  |  |                 JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                 JSONObject jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
 | 
	
		
			
				|  |  |                 logDO.setSosSendStatus(jsonObjectData.getInteger("status").toString());
 | 
	
		
			
				|  |  |                 if (jsonObjectData.containsKey("message")){
 | 
	
		
			
				|  |  |                     logDO.setSosSendMessage(jsonObjectData.getString("message"));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (jsonObjectData.containsKey("msg")){
 | 
	
		
			
				|  |  |                     logDO.setSosSendMessage(jsonObjectData.getString("msg"));
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("orderSource", "3"));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 String response = httpClientUtil.post(url, params,"UTF-8");
 | 
	
		
			
				|  |  |                 System.out.println(response);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             sosLogDao.save(logDO);
 | 
	
	
		
			
				|  | @ -259,11 +251,9 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                         if (deviceDO.getCategoryCode().equals("4")) {
 | 
	
		
			
				|  |  |                             //获取手环最新定位信息
 | 
	
		
			
				|  |  |                             String url = cloudCareUrl+"/cloudCare/noLogin/device/getDeviceLastLocation";
 | 
	
		
			
				|  |  |                             Map map = new HashMap<String, String>();
 | 
	
		
			
				|  |  |                             map.put("deviceSn",deviceDO.getDeviceSn());
 | 
	
		
			
				|  |  |                             String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
 | 
	
		
			
				|  |  |                             String postParams = AesEncryptUtils.agEncrypt(content);
 | 
	
		
			
				|  |  |                             String response = httpClientUtil.getBodyRawForm(url,postParams);
 | 
	
		
			
				|  |  |                             List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  |                             params.add(new BasicNameValuePair("deviceSn", deviceDO.getDeviceSn()));
 | 
	
		
			
				|  |  |                             String response = httpClientUtil.post(url, params,"UTF-8");
 | 
	
		
			
				|  |  |                             JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                             JSONObject jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
 | 
	
		
			
				|  |  |                             Double lat = jsonObjectData.getJSONObject("data").getJSONObject("obj").getJSONObject("locationdata").getJSONObject("point").getDouble("lat");
 | 
	
	
		
			
				|  | @ -276,7 +266,6 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                     "  and pack.del=1";
 | 
	
		
			
				|  |  |                             List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |                             if (sqlResult.size()>0){
 | 
	
		
			
				|  |  |                                 map = new HashMap();
 | 
	
		
			
				|  |  |                                 url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
 | 
	
		
			
				|  |  |                                 JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |                                 jsonObject.put("patient",patientDO.getId());
 | 
	
	
		
			
				|  | @ -291,16 +280,16 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                 jsonObject.put("deviceSn",deviceid);
 | 
	
		
			
				|  |  |                                 JSONObject jsonObjectParam = new JSONObject();
 | 
	
		
			
				|  |  |                                 jsonObjectParam.put("order", jsonObject);
 | 
	
		
			
				|  |  |                                 map.put("jsonData", jsonObjectParam.toJSONString());
 | 
	
		
			
				|  |  |                                 map.put("orderSource", 2);
 | 
	
		
			
				|  |  |                                 map.put("warnStr", "疑似离开安全区域");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                                 content = com.alibaba.fastjson.JSONObject.toJSONString(map);
 | 
	
		
			
				|  |  |                                 postParams = AesEncryptUtils.agEncrypt(content);
 | 
	
		
			
				|  |  |                                 response = httpClientUtil.postBodyRawForm(url,postParams);
 | 
	
		
			
				|  |  |                                 result = com.alibaba.fastjson.JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                                 jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
 | 
	
		
			
				|  |  |                                 System.out.println(jsonObjectData.toJSONString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                                 params = new ArrayList<>();
 | 
	
		
			
				|  |  |                                 params.add(new BasicNameValuePair("jsonData", jsonObjectParam.toJSONString()));
 | 
	
		
			
				|  |  |                                 params.add(new BasicNameValuePair("orderSource", "2"));
 | 
	
		
			
				|  |  |                                 params.add(new BasicNameValuePair("warnStr", "疑似离开安全区域"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                                 response = httpClientUtil.post(url, params,"UTF-8");
 | 
	
		
			
				|  |  |                                 System.out.println(response);
 | 
	
		
			
				|  |  |                                 System.out.println(response);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
	
		
			
				|  | @ -613,16 +602,16 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                                     planDetail.setUpTime(timeDate);
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         else if (3600*upLongWarn*1000<timeDiffer){//距离起床超过三个小时还在床
 | 
	
		
			
				|  |  |                             if ("1".equals(bed_status)){//还在床
 | 
	
		
			
				|  |  |                                 if (null==planDetail.getUpStatus()) {
 | 
	
		
			
				|  |  |                                     planDetail.setUpStatus(1);
 | 
	
		
			
				|  |  |                                     planDetail.setBedStatus(1);
 | 
	
		
			
				|  |  |                                     planDetail.setBreath(breath);
 | 
	
		
			
				|  |  |                                     planDetail.setHeartRate(heartrate);
 | 
	
		
			
				|  |  |                                     outBedOrder(null, timeDate,devicePatientDeviceDos.get(0), patient, device, "超时未起床", JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                     orderCreate = true;
 | 
	
		
			
				|  |  |                                 if (3600*upLongWarn*1000<timeDiffer){//距离起床超过三个小时还在床
 | 
	
		
			
				|  |  |                                     if (null==planDetail.getUpStatus()) {
 | 
	
		
			
				|  |  |                                         planDetail.setUpStatus(1);
 | 
	
		
			
				|  |  |                                         planDetail.setBedStatus(1);
 | 
	
		
			
				|  |  |                                         planDetail.setBreath(breath);
 | 
	
		
			
				|  |  |                                         planDetail.setHeartRate(heartrate);
 | 
	
		
			
				|  |  |                                         outBedOrder(null, timeDate,devicePatientDeviceDos.get(0), patient, device, "超时未起床", JSON.toJSONStringWithDateFormat(planDetail, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                                         orderCreate = true;
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
	
		
			
				|  | @ -802,16 +791,14 @@ public class DeviceService {
 | 
	
		
			
				|  |  |                     jsonObject.put("warnInfo",warnInfo);
 | 
	
		
			
				|  |  |                     JSONObject jsonObjectParam = new JSONObject();
 | 
	
		
			
				|  |  |                     jsonObjectParam.put("order", jsonObject);
 | 
	
		
			
				|  |  |                     map.put("jsonData", jsonObjectParam.toJSONString());
 | 
	
		
			
				|  |  |                     map.put("orderSource", 5);
 | 
	
		
			
				|  |  |                     map.put("warnStr", serverName);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
 | 
	
		
			
				|  |  |                     String postParams = AesEncryptUtils.agEncrypt(content);
 | 
	
		
			
				|  |  |                     String response = httpClientUtil.postBodyRawForm(url,postParams);
 | 
	
		
			
				|  |  |                     JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                     JSONObject jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
 | 
	
		
			
				|  |  |                     System.out.println(jsonObjectData.toJSONString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("jsonData", jsonObjectParam.toJSONString()));
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("warnStr", serverName));
 | 
	
		
			
				|  |  |                     params.add(new BasicNameValuePair("orderSource", "5"));
 | 
	
		
			
				|  |  |                     String response = httpClientUtil.post(url, params,"UTF-8");
 | 
	
		
			
				|  |  |                     System.out.println(response);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (null!=record){
 |