Browse Source

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

叶仕杰 4 years ago
parent
commit
4d4317475b

+ 0 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java

@ -90,7 +90,6 @@ public class IotCompanyDO extends UuidIdentityEntityWithOperator implements Seri
        this.status = status;
    }
    @Convert(converter = StringFStringEncryptConverter.class)
    public String getName() {
        return name;
    }

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

@ -104,15 +104,15 @@ public class LatitudeUtils {
        return distanceStr;
    }
//    public static void main(String args[]){
//        try {
//            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("浦东区张杨路1725号");
//            System.out.println("经度 : " + json.get("lng"));
//            System.out.println("纬度 : " + json.get("lat"));
//        }catch (Exception e ){
//            e.printStackTrace();
//        }
//    }
    public static void main(String args[]){
        try {
            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("厦门海沧区新阳海新阳光公寓15梯304");
            System.out.println("经度 : " + json.get("lng"));
            System.out.println("纬度 : " + json.get("lat"));
        }catch (Exception e ){
            e.printStackTrace();
        }
    }
}

+ 4 - 2
svr/svr-base/src/main/resources/application.yml

@ -436,8 +436,10 @@ spring:
    host: 10.90.32.3 # Redis server host.
    port: 20008  # Redis server port.
    password: jkzlehr
fast-dfs:
  tracker-server: 10.90.32.3:20003 #服务器地址
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://www.xmtyw.cn/
demo:
  flag: true
hospital:
@ -447,7 +449,7 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://www.xmtyw.cn/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
  flag: false

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -902,9 +902,9 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    }
    @RequestMapping(value = "savePatientDeviceLocation",method = RequestMethod.POST)
    public Envelop savePatientDeviceLocation(){
    public Envelop savePatientDeviceLocation(String categoryCode){
        try {
            return success(monitorPlatformService.savePatientDeviceLocation());
            return success(monitorPlatformService.savePatientDeviceLocation(categoryCode));
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");

+ 10 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/equipment/IotEqtDetailService.java

@ -171,7 +171,7 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
       return list;
    }
    public List<LocationDataVO> getEquipmentLocation(Integer page, Integer size){
    public List<LocationDataVO> getEquipmentLocation(Integer page, Integer size,String manufacturerCode){
        List<Map<String, Object>> jsonArray = new ArrayList<>();
@ -185,8 +185,11 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
                "longitude AS lon, " +
                "create_time AS createTime " +
                "FROM " +
                "iot_equipmet_detail LIMIT "+(page-1)*size+","+size;
                "iot_equipmet_detail ";
        if(StringUtils.isNoneBlank(manufacturerCode)){
            sql += " where manufacturer_code in ('"+manufacturerCode+"')";
        }
        sql += " LIMIT "+(page-1)*size+","+size;
        jsonArray = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> jsobj:jsonArray){
            LocationDataVO locationDataVO = new LocationDataVO();
@ -208,8 +211,11 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
        return result;
    }
    public Integer getEquipmentCount(){
    public Integer getEquipmentCount(String manufacturerCode){
        String sql = "SELECT count(1) totalCount FROM iot_equipmet_detail ";
        if(StringUtils.isNoneBlank(manufacturerCode)){
            sql += " where manufacturer_code in ('"+manufacturerCode+"')";
        }
        Integer totalCount = jdbcTemplate.queryForObject(sql,Integer.class);
        return totalCount;
    }

+ 17 - 94
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -3,7 +3,6 @@ package com.yihu.iot.service.monitorPlatform;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.equipment.IotEquipmentDetailDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
@ -24,23 +23,18 @@ import iot.device.LocationDataVO;
import org.apache.http.Consts;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
import org.apache.jasper.tagplugins.jstl.core.ForEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlInOutParameter;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.print.DocFlavor;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.text.DecimalFormat;
import java.time.temporal.Temporal;
import java.util.*;
/**
@ -118,19 +112,6 @@ public class MonitorPlatformService  {
                    locationDataVO = iotPatientDeviceService.addNameAndCodeToLocationVO(locationDataVO);
                    locationDataVOList.add(locationDataVO);
                });
//                JSONArray jsonArrayTemp = new JSONArray();
//                JSONObject deviceSn = new JSONObject();
//                deviceSn.put("andOr","or");
//                deviceSn.put("field","deviceSn");
//                deviceSn.put("condition","=");
//                deviceSn.put("value",list.getString(i));
//                jsonArrayTemp.add(deviceSn);
//                JSONObject jsonObject = new JSONObject();
//                jsonObject.put("filter",jsonArrayTemp);
//                jsonObject.put("page",page);
//                jsonObject.put("size",size);
//                List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
                //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
                envelop.getDetailModelList().addAll(locationDataVOList);
            }
            envelop.setTotalCount(total);
@ -140,24 +121,20 @@ public class MonitorPlatformService  {
            int totalEqCount=0;
            int totalCount=0;
            //小屋总数
            if(deviceType.contains("5")){
                if (org.apache.commons.lang3.StringUtils.isBlank(deviceName)||(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) &&deviceName.contains("健康小屋"))){
                    totalEqCount = iotEqtDetailService.getEquipmentCount();
                }
            String manufacturerCode = deviceType;
            manufacturerCode = manufacturerCode.replace(",","','").replace("5","yituo").replace("10","xeek").replace("11","xiaomi");
            if(deviceType.contains("5")||deviceType.contains("10")||deviceType.contains("11")){
                totalEqCount = iotEqtDetailService.getEquipmentCount(manufacturerCode);
            }
            String[] categoryCodes= deviceType.split(",");
            if(categoryCodes.length==1&&"5".equals(deviceType)){
                if (org.apache.commons.lang3.StringUtils.isBlank(deviceName)||(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) &&deviceName.contains("健康小屋"))){
                    euipmentList = iotEqtDetailService.getEquipmentLocation(page,size);
                    envelop.getDetailModelList().addAll(euipmentList);
                }
            if(categoryCodes.length==1&&(deviceType.contains("5")||deviceType.contains("10")||deviceType.contains("11"))){
                euipmentList = iotEqtDetailService.getEquipmentLocation(page,size,manufacturerCode);
                envelop.getDetailModelList().addAll(euipmentList);
            }
            else{
                if(deviceType.contains("5")){
                    if (org.apache.commons.lang3.StringUtils.isBlank(deviceName)||(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) &&deviceName.contains("健康小屋"))){
                        euipmentList = iotEqtDetailService.getEquipmentLocation(page,size);
                        envelop.getDetailModelList().addAll(euipmentList);
                    }
                if(deviceType.contains("5")||deviceType.contains("10")||deviceType.contains("11")){
                    euipmentList = iotEqtDetailService.getEquipmentLocation(page,size,manufacturerCode);
                    envelop.getDetailModelList().addAll(euipmentList);
                }
                StringBuffer sql = new StringBuffer("select id,idcard idCard,category_code categoryCode,device_sn deviceSn,location,device_time deviceTime,disease_condition diseaseCondition,\n" +
                        "create_time createTime,device_name equimentName\n" +
@ -198,60 +175,6 @@ public class MonitorPlatformService  {
                    locationDataVOList.add(locationDataVO);
                });
                envelop.getDetailModelList().addAll(locationDataVOList);
//                for (String categoryCode:categoryCodes){
//                    JSONObject json = new JSONObject();
//                    JSONArray jsonArray = new JSONArray();
//                    if(diseaseCondition!=null){
//                        json.put("andOr","and");
//                        json.put("field","diseaseCondition");
//                        json.put("condition","=");
//                        json.put("value",diseaseCondition);
//                        jsonArray.add(json);
//                    }
//                     if(!"5".equals(categoryCode)){
//                         json = new JSONObject();
//                         List<String> listTmp = new ArrayList<>();
//                         if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){
//                             String[] deviceNames = deviceName.split(",");
//                             for (String tmp :deviceNames){
//                                 String sql="select DISTINCT device_code  from device.wlyy_devices wd   where wd.device_name like '%"+tmp+"%'  ";
//                                 List<String> tmpList = jdbcTemplate.queryForList(sql,String.class);
//                                 listTmp.addAll(tmpList);
//                             }
//                             if (listTmp.size()!=0){
//                                 json.put("andOr","and");
//                                 json.put("field","deviceSn");
//                                 json.put("condition","in");
//                                 json.put("value",listTmp);
//                                 jsonArray.add(json);
//                             }
//                         }
//                         else{
//                            if(!"5".equals(categoryCode)) {
//                                json.put("andOr", "and");
//                                json.put("field", "categoryCode");
//                                json.put("condition", "=");
//                                json.put("value", Integer.parseInt(categoryCode));
//                                jsonArray.add(json);
//                            }
//                         }
//                         JSONObject jsonObject = new JSONObject();
//                         jsonObject.put("filter",jsonArray);
//                         jsonObject.put("page",page);
//                         jsonObject.put("size",size);
//                         if (jsonArray.size()!=0){
//                             List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
//                             List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(locationDataVOList);
//                             //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
//                             envelop.getDetailModelList().addAll(list2);
//                           totalCount += iotPatientDeviceService.getESCount(jsonObject.toString());
//                         }
//                     }
//                     if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){
//                         break;
//                     }
//                }
            }
            envelop.setTotalCount(totalCount>totalEqCount?totalCount:totalEqCount);
            return envelop;
@ -1206,7 +1129,7 @@ public class MonitorPlatformService  {
            params.put("appid", appid);
            params.put("appSecret", appSecret);
            String url = "/gc/accesstoken";
            String response = httpClientUtil.httpPost(wlyyUrl + url, params);
            String response = HttpClientUtil.httpPost(wlyyUrl + url, params);
            JSONObject jsonObject = JSON.parseObject(response);
            if(jsonObject.getInteger("status")==10000){
                String accesstoken = jsonObject.getJSONObject("result").getString("accesstoken");
@ -1248,7 +1171,7 @@ public class MonitorPlatformService  {
                    "and wd.manufacturer_code is not null and wd.manufacturer_code <>'' and pd.device_name<>'血压计-null' and pd.device_name<>'血糖仪-自助体检一体机'  \n" +
                    "GROUP BY wd.manufacturer_code,pd.device_name\n" +
                    "UNION\n" +
                    "select '健康小屋' device_name,manufacturer from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
                    "select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name,manufacturer from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
                    ")A\n" +
                    "GROUP BY A.manufacturer\n" +
                    "ORDER BY total desc";
@ -1262,7 +1185,7 @@ public class MonitorPlatformService  {
                    "and wd.manufacturer_code is not null and wd.manufacturer_code <>'' and pd.device_name<>'血压计-null' and pd.device_name<>'血糖仪-自助体检一体机' \n" +
                    "GROUP BY wd.manufacturer_code,pd.device_name\n" +
                    "UNION\n" +
                    "select '健康小屋' device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
                    "select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
                    ")A";
            Integer BrandsCount = jdbcTemplate.queryForObject(sql,Integer.class);
@ -1564,7 +1487,7 @@ public class MonitorPlatformService  {
            }
            sql.append("GROUP BY wd.manufacturer_code,pd.device_name ");
            if ((org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType)&&deviceType.contains("5"))||org.apache.commons.lang3.StringUtils.isBlank(deviceType)){
                sql.append("UNION select '健康小屋' device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name");
                sql.append("UNION select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name");
            }
            sql.append(")A");
            List<String> list = jdbcTemplate.queryForList(sql.toString(),String.class);
@ -1726,13 +1649,13 @@ public class MonitorPlatformService  {
        return deviceName;
    }
    public JSONObject savePatientDeviceLocation(){
    public JSONObject savePatientDeviceLocation(String categoryCode){
        String sql = "select DISTINCT pd.category_code ,pd.czrq create_time,pd.device_sn ,pd.device_name, p.disease_condition ,p.`code`,p.idcard ,p.address,sf.hospital_name\n" +
                "from  wlyy.wlyy_patient_device pd \n" +
                "INNER JOIN wlyy.wlyy_sign_family sf on pd.`user` = sf.patient and sf.type=2 \n" +
                "INNER JOIN wlyy.wlyy_patient p on p.idcard = sf.idcard and p.`status`=1\n" +
                "where  pd.del=0 and pd.category_code in (1,2)";
//        sql="select * from device.wlyy_patient_device_location_tmp";
                "where  pd.del=0 and pd.category_code in ("+categoryCode+")";
//                "where  pd.del=0 and pd.category_code in (1,2)";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        list.forEach(map->{
            try {