소스 검색

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 년 전
부모
커밋
e9d81b6509

+ 1 - 1
common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java

@ -39,7 +39,7 @@ public class LatitudeUtils {
        try {
            //将地址转换成utf-8的16进制
            address = URLEncoder.encode(address, "UTF-8");
            URL tirc = new URL("http://api.map.baidu.com/geocoder/v2/?address="+ address +"&output=json&key="+ UUID.randomUUID().toString().replace("-","")+"&ak="+ak);
            URL tirc = new URL("https://api.map.baidu.com/geocoder/v2/?address="+ address +"&output=json&key="+ UUID.randomUUID().toString().replace("-","")+"&ak="+ak);
            in = new BufferedReader(new InputStreamReader(tirc.openStream(),"UTF-8"));

+ 10 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -110,12 +110,16 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
     * 获取百度天气
     */
    public JSONObject getBaiduWeather(){
        String url = "https://api.map.baidu.com/weather/v1/?district_id=330100&data_type=now&ak=0vjnCSReegE7A47a941ohjv9a07ONiMC";
        String response = httpClientUtil.get(url,"UTF-8");
        JSONObject responseObj = JSONObject.parseObject(response);
        if (responseObj.getInteger("status")==0){
            JSONObject now = responseObj.getJSONObject("result").getJSONObject("now");
            return now;
        try {
            String url = "https://api.map.baidu.com/weather/v1/?district_id=330100&data_type=now&ak=0vjnCSReegE7A47a941ohjv9a07ONiMC";
            String response = httpClientUtil.get(url,"UTF-8");
            JSONObject responseObj = JSONObject.parseObject(response);
            if (responseObj.getInteger("status")==0){
                JSONObject now = responseObj.getJSONObject("result").getJSONObject("now");
                return now;
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return new JSONObject();
    }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceDetailService.java

@ -64,7 +64,7 @@ public class DeviceDetailService extends BaseJpaService<DeviceDetail, DeviceDeta
	@Transactional
	public void updateAfterBinding(DevicePatientDevice devicePatientDevice, Date grantTime, boolean isFirst)throws Exception{
		DeviceDetail deviceDetail = deviceDetailDao.findBySn(devicePatientDevice.getDeviceSn());
		int bind = deviceDetail.getIsBinding();
		int bind = null==deviceDetail.getIsBinding()?0:deviceDetail.getIsBinding();
		long adminTeam=0L;
		String hospital = "";
		String isFirstBind = "";

+ 10 - 8
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -47,6 +47,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -1203,16 +1204,17 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     */
    public com.alibaba.fastjson.JSONObject getX1Locations(String deviceSn,String time_begin){
        String url =AqgConfig.X1_locations;
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        param.add("device", deviceSn);
        param.add("depth", "1");
        param.add("rows_per_page", "300");
        String url = AqgConfig.X1_locations+"?device="+deviceSn+"&depth="+1+"&rows_per_page="+300;
        if (StringUtils.isNotBlank(time_begin)){
            param.add("time_begin", time_begin);
            url += "&time_begin="+time_begin;
        }
        HttpEntity<com.alibaba.fastjson.JSONObject> response = httpClientUtil.aqgCookieHttp(url, param, HttpMethod.GET, getCookie());
        return response.getBody();
        Map<String,Object> headers = new HashMap<>();
        headers.put("Accept", MediaType.APPLICATION_JSON.toString());
        headers.put("Cookie", getCookie());
        String  responseStr = httpClientUtil.get(url,"utf-8",headers);
        com.alibaba.fastjson.JSONObject result = JSON.parseObject(responseStr);
        return result;
    }
    public com.alibaba.fastjson.JSONObject getSleepDeviceInfo(String deviceSn){

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

+ 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);