LAPTOP-KB9HII50\70708 2 éve
szülő
commit
f01fbe8a26

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

@ -515,7 +515,8 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.PatientDevice.findLocationByIdCard)
    @ApiOperation(value = "根据idCard查询设备地址", notes = "根据idCard查询设备地址")
    @ApiOperation(value = "根据idCard查询设备地址-废弃", notes = "根据idCard查询设备地址")
    @Deprecated
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocationsByIdCard(
            @ApiParam(name = "diseaseCondition", value = "病情:0绿标,1黄标,2红标,-1没有标注的居民", defaultValue = "")
            @RequestParam(value = "diseaseCondition", required = false) Integer diseaseCondition,
@ -550,6 +551,38 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findLocationPage")
    @ApiOperation(value = "新的物联网大屏地理搜索")
    public Envelop findLocationPage(
            @ApiParam(name = "deviceCommon", value = "设备通用名编码")
            @RequestParam(value = "deviceCommon", required = false) String deviceCommon,
            @ApiParam(name = "useCode", value = "用途")
            @RequestParam(value = "useCode", required = false) String useCode,
            @ApiParam(name = "combinationMethod", value = "组合方式")
            @RequestParam(value = "combinationMethod", required = false) String combinationMethod,
            @ApiParam(name = "networkTransmission", value = "网络传输", required = false)
            @RequestParam(value = "networkTransmission", required = false) String networkTransmission,
            @ApiParam(name = "page", value = "第几页(默认第一页)", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页几行(默认10条记录)", defaultValue = "10")
            @RequestParam(value = "pageSize", required = false) Integer pageSize,
            @ApiParam(name = "town", value = "地区")
            @RequestParam(value = "town", required = false) String town
    ) {
        try {
            if (page == null) {
                page = 1;
            }
            if (pageSize == null) {
                pageSize = 10;
            }
            return monitorPlatformService.findLocationPage(deviceCommon, page, pageSize, useCode, combinationMethod, networkTransmission, town);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");
        }
    }
    @RequestMapping(value = "/chronicDiseaseCount", method = RequestMethod.GET)
    @ApiOperation("慢病患者情况-统计")
    public String chronicDiseaseCount(

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -1187,7 +1187,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    public JSONObject getAppService(){
        JSONObject object = new JSONObject();
        String sql = "select * from iot_statistics_app order by num desc";
        String sql = "select * from iot_statistics_app where type = '1' or type='2' order by num desc";
        List<IotStatisticsAppDO> appDOS = jdbcTempalte.query(sql,new BeanPropertyRowMapper<>(IotStatisticsAppDO.class));
        if(appDOS.size()>0){
            Map<String,List<IotStatisticsAppDO>> listMap = appDOS.stream().collect(Collectors.groupingBy(IotStatisticsAppDO::getType));

+ 124 - 27
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -17,14 +17,17 @@ import com.yihu.iot.util.conceal.ConcealUtil;
import com.yihu.iot.util.excel.HibenateUtils;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsAppDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsCommonDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsRealtimeDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsStockDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.http.HttpClientUtil;
import io.swagger.annotations.ApiOperation;
import iot.device.IotLocationDataVO;
import iot.device.LocationDataVO;
import org.apache.http.Consts;
import org.apache.http.client.utils.URLEncodedUtils;
@ -43,6 +46,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
import static cn.hutool.core.util.ObjectUtil.hasEmpty;
@ -88,6 +92,75 @@ public class MonitorPlatformService {
    private WlyyIotTzDictDao wlyyIotTzDictDao;
    @Autowired
    private IotStatisticsCommonDao iotStatisticsCommonDao;
    @Autowired
    private JdbcTemplate jdbcTempalte;
    /**
     * 新的物联网大屏地理搜索
     * @param deviceCommon 设备通用名编码
     * @param page
     * @param size
     * @param use 用途
     * @param combinationMethod 组合方式
     * @param networkTransmission 网络传输
     * @param town 地理区划
     * @return
     */
    public PageEnvelop<IotLocationDataVO> findLocationPage(String deviceCommon, Integer page, Integer size,
                   String use, String combinationMethod, String networkTransmission, String town) {
        String countSql = "select count(*) ";
        String sql = "select * ";
        String fileter = " from wlyy_patient_device_location where del=0 ";
        if(!StringUtils.isEmpty(deviceCommon)){
            fileter += " and device_common = '"+deviceCommon+"'";
        }
        if(!StringUtils.isEmpty(use)){
            fileter += " and use_code = '"+use+"'";
        }
        if(!StringUtils.isEmpty(combinationMethod)){
            fileter += " and combination_method = '"+combinationMethod+"'";
        }
        if(!StringUtils.isEmpty(networkTransmission)){
            fileter += " and network_transmission = '"+networkTransmission+"'";
        }
        if(!StringUtils.isEmpty(town)&&"350200".equals(town)){
            fileter += " and town = '"+town+"'";
        }
        String limit = " limit "+(page-1)*size+","+size;
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql+fileter+limit);
        List<IotLocationDataVO> locationDataVOList = new ArrayList<>();
        result.forEach(map -> {
            IotLocationDataVO locationDataVO = new IotLocationDataVO();
            JSONObject location = JSONObject.parseObject(map.get("location").toString());
            GeoPoint geoPoint = new GeoPoint(Double.parseDouble(location.get("lat").toString()), Double.parseDouble(location.get("lon").toString()));
            locationDataVO.setId(map.get("id").toString());
            locationDataVO.setIdCard(AesEncryptUtils.decrypt(map.get("idcard")+""));
            locationDataVO.setCategoryCode(map.get("category_code")+"");
            locationDataVO.setDeviceSn(map.get("device_sn")+"");
            locationDataVO.setLocation(geoPoint);
            locationDataVO.setDeviceTime(map.get("device_time")+"");
            locationDataVO.setLabel(map.get("label")+"");
            if(map.get("disease_condition")!=null){
                locationDataVO.setDiseaseCondition(Integer.parseInt(map.get("disease_condition").toString()));
            }else {
                locationDataVO.setDiseaseCondition(0);
            }
            locationDataVO.setCreateTime(map.get("create_time")+"");
            locationDataVO.setPatient(map.get("patient")+"");
            locationDataVO.setDeviceCommon(map.get("device_common")+"");
            locationDataVO.setUseCode(map.get("useCode")+"");
            locationDataVO.setCombinationMethod(map.get("xombination_method")+"");
            locationDataVO.setTown(map.get("town")+"");
            locationDataVO.setNetworkTransmission(map.get("network_transmission")+"");
            locationDataVOList.add(locationDataVO);
        });
        Long totalCount = jdbcTemplate.queryForObject(countSql+fileter, Long.class);
        return PageEnvelop.getSuccessListWithPage("获取成功",locationDataVOList,page,size,totalCount);
    }
    /**
     * 获取位置信息
@ -1215,33 +1288,57 @@ public class MonitorPlatformService {
     */
    public JSONObject getBrandsAndManufacturer() {
        try {
            String sql = "select count(DISTINCT A.device_name) as total,A.device_name, IF(A.manufacturer = '健康之路', '福建健康之路信息技术有限公司',  A.manufacturer) manufacturer from (\n" +
                    "select pd.device_name,wd.manufacturer from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
                    "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 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";
            List<Map<String, Object>> Manufacturers = jdbcTemplate.queryForList(sql);
            JSONObject result = new JSONObject();
            JSONArray arr = JSONArray.parseArray(JSON.toJSONString(Manufacturers));
            result.put("Manufacturers", arr);
            sql = "select count(DISTINCT A.device_name)from (\n" +
                    "select pd.device_name from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
                    "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 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);
            result.put("Brands", BrandsCount);
            result.put("manufacturerCount", arr.size());
            return result;
            JSONObject object = new JSONObject();
            String sql = "select * from iot_statistics_app where type = '3' or type='4' order by num desc";
            List<IotStatisticsAppDO> appDOS = jdbcTempalte.query(sql,new BeanPropertyRowMapper<>(IotStatisticsAppDO.class));
            if(appDOS.size()>0){
                Map<String,List<IotStatisticsAppDO>> listMap = appDOS.stream().collect(Collectors.groupingBy(IotStatisticsAppDO::getType));
                IotStatisticsAppDO appDO = listMap.get("4").get(0);
                List<IotStatisticsAppDO> appDOList = listMap.get("3");
                JSONArray jsonArray = new JSONArray();
                for (IotStatisticsAppDO app:appDOList){
                    JSONObject json = new JSONObject();
                    json.put("manufacturer",app.getName());
                    json.put("total",app.getNum());
                    jsonArray.add(json);
                }
                object.put("Brands",appDO.getNum());//产品数
                object.put("Manufacturers",jsonArray);
                object.put("manufacturerCount",appDO.getName());
            }else {
                object.put("Brands",0);
                object.put("Manufacturers",new ArrayList<>());
                object.put("manufacturerCount",40);//目前暂无医疗机构接入,默认0家。
            }
            return object;
//            String sql = "select count(DISTINCT A.device_name) as total,A.device_name, IF(A.manufacturer = '健康之路', '福建健康之路信息技术有限公司',  A.manufacturer) manufacturer from (\n" +
//                    "select pd.device_name,wd.manufacturer from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
//                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
//                    "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 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";
//            List<Map<String, Object>> Manufacturers = jdbcTemplate.queryForList(sql);
//            JSONObject result = new JSONObject();
//            JSONArray arr = JSONArray.parseArray(JSON.toJSONString(Manufacturers));
//            result.put("Manufacturers", arr);
//            sql = "select count(DISTINCT A.device_name)from (\n" +
//                    "select pd.device_name from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
//                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
//                    "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 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);
//
//            result.put("Brands", BrandsCount);
//            result.put("manufacturerCount", arr.size());
//            return result;
        } catch (Exception e) {
            e.printStackTrace();