Browse Source

代码修改

liubing 3 years ago
parent
commit
767bc55133

+ 30 - 43
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

@ -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);
                            }
                        }
                    }
@ -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){

+ 9 - 11
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java

@ -16,7 +16,9 @@ import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.encode.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.entity.ContentType;
import org.apache.http.message.BasicNameValuePair;
import org.csource.common.MyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,6 +38,7 @@ import java.net.URL;
import java.net.URLConnection;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -166,8 +169,6 @@ public class YsDeviceService {
                BasePatientDO patientDO = patientDao.findById(deviceDO.getUser());
                String  url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
                Map map = new HashMap<String, String>();
                map = new HashMap();
                String hospital = "";
                String sql ="select DISTINCT pack.org_code,pack.org_name " +
                        " from base_service_package_sign_record sr,base_service_package_record pr,base_service_package_item item ,base_service_package pack " +
@ -202,16 +203,13 @@ public class YsDeviceService {
                }
                JSONObject jsonObjectParam = new JSONObject();
                jsonObjectParam.put("order", jsonObject);
                map.put("jsonData", jsonObjectParam.toJSONString());
                map.put("orderSource", orderSource);
                map.put("warnStr", serveDesc);
                String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
                String postParams = AesEncryptUtils.agEncrypt(content);
                String response = httpClientUtil.postBodyRawForm(url,postParams);
                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", serveDesc));
                params.add(new BasicNameValuePair("orderSource", orderSource+""));
                String response = httpClientUtil.post(url, params,"UTF-8");
                System.out.println(response);
            }
        }catch (Exception e){
            e.printStackTrace();

+ 2 - 2
svr/svr-cloud-device/src/main/resources/application.yml

@ -169,7 +169,7 @@ baiduApi:
  AK: 0vjnCSReegE7A47a941ohjv9a07ONiMC
  url: http://api.map.baidu.com/
cloudCare:
  url: http://ehr.yihu.com/hlwyy/cloudCare/
  url: http://127.0.0.1:10301/
---
spring:
@ -269,7 +269,7 @@ baiduApi:
  url: http://api.map.baidu.com/
cloudCare:
  url: http://ehr.yihu.com/hlwyy/cloudCare/
  url: http://127.0.0.1:10301/
---
spring:
  profiles: hzprod

+ 13 - 8
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PatientSosContactsJob.java

@ -58,19 +58,24 @@ public class PatientSosContactsJob implements Job {
                    JSONObject response = cardService.setPatientContacts(sim, null, null, "1", sos_phone, null);//移动白名单
                    //0成功 12102名单重复
                    if (response.getInteger("status")==0||response.getInteger("status")==12108){
                        //设备修改
                        JSONObject response2 =  deviceService.updAqgDeviceSosInfo(device_sn,phone_seqid,sos_name,sos_phone,"1",null);
                        if (response2.getBoolean("success")){
                        sosContactsDO.setSuccessFlag(1);
                    }else {
                        sosContactsDO.setSuccessFlag(-1);
                        modify.add(sosContactsDO);
                    }
                    //设备修改
                    JSONObject response2 =  deviceService.updAqgDeviceSosInfo(device_sn,phone_seqid,sos_name,sos_phone,"1",null);
                    System.out.println(response2.toString());
                    if (response2.getBoolean("success")){
                        if (1==sosContactsDO.getSuccessFlag()){
                            sosContactsDO.setSuccessFlag(1);
                        }else {
                            sosContactsDO.setSuccessFlag(-1);
                        }
                        modify.add(sosContactsDO);
                        sosContactsDO.setSuccessFlag(-1);
                    }else {
                        sosContactsDO.setSuccessFlag(-1);
                        modify.add(sosContactsDO);
                        throw new Exception("物联网卡操作失败:"+response);
                    }
                    modify.add(sosContactsDO);
                }
            }catch (Exception e){
                logger.info(sim+"--同步失败--"+sos_phone);