소스 검색

居家离家和天然气

xiaoyunquan 2 년 전
부모
커밋
147fda72c3
1개의 변경된 파일58개의 추가작업 그리고 0개의 파일을 삭제
  1. 58 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

+ 58 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -872,6 +872,22 @@ public class PatientInfoPlatFormService {
                        tmp.put("city", dw.getString("last_city"));
                        tmp.put("province", dw.getString("last_province"));
                        tmp.put("address", dw.getString("last_address"));
                        //获取居民家庭定位
                        BasePatientDO p = patientDao.findById(patient);
                        if(p != null && StringUtils.isNotBlank(p.getHomeLatLon())){
                            String homeLatLon = p.getHomeLatLon();
                            double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
                            double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
                            double homeDistance = countDistance.getDistance(homeLat,homeLon,lat,lon);
                            if (homeDistance * 1000 > 50) {
                                detailInfo.put("isAtHome","离家");
                            }else {
                                detailInfo.put("isAtHome","居家");
                            }
                        }else {
                            detailInfo.put("isAtHome","");
                        }
                        detailInfo.put("location", tmp);
                    }
                }
@ -1052,9 +1068,26 @@ public class PatientInfoPlatFormService {
                    String address = LatitudeUtils.getLocationAddress(sqlResult.get(0).get("lat").toString(), sqlResult.get(0).get("lon").toString());
//                    JSONObject dz =  gpsUtil.gcj02_To_Bd09(Double.parseDouble(sqlResult.get(0).get("lat").toString()),Double.parseDouble(sqlResult.get(0).get("lon").toString()));
                    detailInfo.put("location", address);
                    //判断是否居家
                    BasePatientDO p = patientDao.findById(patient);
                    if(p != null && StringUtils.isNotBlank(p.getHomeLatLon())){
                        String homeLatLon = p.getHomeLatLon();
                        double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
                        double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
                        double homeDistance = countDistance.getDistance(homeLat,homeLon,Double.parseDouble(sqlResult.get(0).get("lat").toString()),(Double.parseDouble(sqlResult.get(0).get("lon").toString())));
                        if (homeDistance * 1000 > 50) {
                            detailInfo.put("isAtHome","离家");
                        }else {
                            detailInfo.put("isAtHome","居家");
                        }
                    }else {
                        detailInfo.put("isAtHome","");
                    }
                }else {
                    detailInfo.put("newlonlat",null);
                    detailInfo.put("location", null);
                    detailInfo.put("isAtHome","");
                }
                break;
            case "18"://日常用水监测
@ -1109,6 +1142,31 @@ public class PatientInfoPlatFormService {
                }else {
                    detailInfo.put("warnStatus",false);
                }
                break;
            case "21"://todo 天然气
                /*sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc,  " +
                        " o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
                        " INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1  ";
                pageSql = bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc  limit 1 ":" ORDER BY create_time desc limit 1 ";
                sqlResult = jdbcTemplate.queryForList(sql+pageSql);
                if (sqlResult.size()>0){
                    detailInfo.put("warnStatus",true);
                    detailInfo.put("orderInfo",sqlResult.get(0));
                }else {
                    detailInfo.put("warnStatus",false);
                }*/
                sql = " SELECT g.syndyqzl,g.syndfy,g.lszyql,CAST(DATE_FORMAT(g.tong_time,'%Y-%m-%d %H:%i:%S') as char) as createTime from hz.gsq_hzrqjmyhglxtrqgrxx g " +
                        " inner join base.base_patient p on g.yhsfzh = p.idcard " +
                        " where p.id = '"+patient+"' ";
                pageSql = bl?" and g.tong_time >= '"+beforeTime+"' and g.tong_time <= '"+afterTime+"' ORDER BY g.tongid desc LIMIT 1 ":" ORDER BY g.tongid desc LIMIT 1 ";
                sqlResult = jdbcTemplate.queryForList(sql+pageSql);
                if(sqlResult.size() >0 ){
                    detailInfo.putAll(sqlResult.get(0));
                }else {
                    detailInfo.put("syndyqzl","");
                    detailInfo.put("syndfy","");
                    detailInfo.put("lszyql","");
                }
        }
        return detailInfo;
    }