|
@ -162,10 +162,10 @@ public class DeviceService {
|
|
|
}
|
|
|
}
|
|
|
//发送紧急救助
|
|
|
String sql =" select Distinct item.org_code,item.org_name\n" +
|
|
|
String sql =" select Distinct pack.org_code,pack.org_name\n" +
|
|
|
"from base_service_package_sign_record sr INNER JOIN base_service_package_record pr\n" +
|
|
|
"on sr.id = pr.sign_id and sr.status=1 INNER JOIN base_service_package_item item on pr.service_package_id = item.service_package_id and item.del=1 \n" +
|
|
|
"where item.code='emergencyAssistance' and sr.patient='"+patientDO.getId()+"'";
|
|
|
"INNER JOIN base_service_package pack pack on pr.service_package_id = pack.id where item.code='emergencyAssistance' and sr.patient='"+patientDO.getId()+"'";
|
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
if (sqlResult.size()>0){
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
@ -268,7 +268,7 @@ public class DeviceService {
|
|
|
Double lon = jsonObjectData.getJSONObject("data").getJSONObject("obj").getJSONObject("locationdata").getJSONObject("point").getDouble("lon");
|
|
|
String address = jsonObjectData.getJSONObject("data").getJSONObject("obj").getJSONObject("locationdata").getString("address");
|
|
|
|
|
|
String sql ="select DISTINCT item.org_code,item.org_name\n" +
|
|
|
String sql ="select DISTINCT pack.org_code,pack.org_name\n" +
|
|
|
" from base_service_package_sign_record sr,base_service_package_record pr,base_service_package_item item ,base_service_package pack\n" +
|
|
|
"where pr.patient = '"+patientDO.getId()+"' and sr.id = pr.sign_id and pr.service_package_id = item.service_package_id \tand item.`code`='preventLost' and item.service_package_id = pack.id \n" +
|
|
|
" and pack.del=1";
|
|
@ -557,8 +557,51 @@ public class DeviceService {
|
|
|
if(StringUtils.isNotBlank(device)){
|
|
|
List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
|
|
|
if (devicePatientDeviceDos.size()>0){
|
|
|
if ("1".equals(is_warn)){//触发工单
|
|
|
|
|
|
if ("1".equals(is_warn)){//触发安防工单
|
|
|
BasePatientDO patientDO = patientDao.findById(devicePatientDeviceDos.get(0).getUser());
|
|
|
if(null==patientDO){
|
|
|
String sql ="select DISTINCT pack.org_code,pack.org_name\n" +
|
|
|
" from base_service_package_sign_record sr,base_service_package_record pr,base_service_package_item item ,base_service_package pack\n" +
|
|
|
"where pr.patient = '"+patientDO.getId()+"' and sr.id = pr.sign_id and pr.service_package_id = item.service_package_id \tand item.`code`='preventOutOfBed' and item.service_package_id = pack.id \n" +
|
|
|
" and pack.del=1";
|
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
Map<String, String> json = null;
|
|
|
String address= devicePatientDeviceDos.get(0).getSosAddress();
|
|
|
if (StringUtils.isNotBlank(devicePatientDeviceDos.get(0).getSosAddress())) {
|
|
|
json = LatitudeUtils.getGeocoderLatitude(address.replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
|
|
|
}
|
|
|
String lat=null;
|
|
|
String lng=null;
|
|
|
if (json != null) {
|
|
|
lat= json.get("lat".toString());
|
|
|
lng = json.get("lng".toString());
|
|
|
}
|
|
|
Map<String,Object> map = new HashMap();
|
|
|
String url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("patient",patientDO.getId());
|
|
|
jsonObject.put("patientName",patientDO.getName());
|
|
|
jsonObject.put("patientPhone",patientDO.getMobile());
|
|
|
jsonObject.put("serveDesc","疑似发生意外");
|
|
|
jsonObject.put("hospital",sqlResult.get(0).get("org_code"));
|
|
|
jsonObject.put("serveAddress",address.replace(" ",""));
|
|
|
jsonObject.put("serveLat",lat);
|
|
|
jsonObject.put("serveLon",lng);
|
|
|
jsonObject.put("topicItem","preventOutOfBed");
|
|
|
jsonObject.put("deviceSn",device);
|
|
|
JSONObject jsonObjectParam = new JSONObject();
|
|
|
jsonObjectParam.put("order", jsonObject);
|
|
|
map.put("jsonData", jsonObjectParam.toJSONString());
|
|
|
map.put("orderSource", 5);
|
|
|
map.put("warnStr", "疑似发生意外");
|
|
|
|
|
|
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());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -623,4 +666,9 @@ public class DeviceService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
String ss="123123,2323";
|
|
|
System.out.println(String.join(",",ss));
|
|
|
}
|
|
|
}
|