Prechádzať zdrojové kódy

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

shikejing 4 rokov pred
rodič
commit
385d0d1cf8

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

@ -206,7 +206,9 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            @ApiParam(name="area",value="地区",defaultValue = "")
            @RequestParam(value="area",required = false) String area,
            @ApiParam(name="hospital",value="机构",defaultValue = "")
            @RequestParam(value="hospital",required = false) String hospital){
            @RequestParam(value="hospital",required = false) String hospital,
            @ApiParam(name="deviceName",value = "设备名称(品牌)",required = false)
            @RequestParam(value = "deviceName",required = false,defaultValue = "")String deviceName){
        try {
            if(page==null){
                page = 1;
@ -215,7 +217,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
                pageSize = 20;
            }
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.warningInformationAlarm_new(page,pageSize,startTime,endTime,deviceType,area,hospital));
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.warningInformationAlarm_new(page,pageSize,startTime,endTime,deviceType,area,hospital,deviceName));
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
@ -449,6 +451,8 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            @RequestParam(value = "type",required = false) String type,
            @ApiParam(name="deviceType",value="设备类型 对应设备字典库的DEVICE_TYPE值",required = true)
            @RequestParam(value="deviceType",required = true) String deviceType,
            @ApiParam(name="deviceName",value = "设备名称(品牌)",required = false)
            @RequestParam(value = "deviceName",required = false,defaultValue = " ")String deviceName,
            @ApiParam(name="page",value="第几页(默认第一页)",defaultValue = "1")
            @RequestParam(value="page",required = false) Integer page,
            @ApiParam(name="pageSize",value="每页几行(默认10条记录)",defaultValue = "10")
@ -460,7 +464,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            if(pageSize==null){
                pageSize = 10;
            }
            return monitorPlatformService.findDeviceLocations(diseaseCondition,page,pageSize,type,deviceType);
            return monitorPlatformService.findDeviceLocations(diseaseCondition,page,pageSize,type,deviceType,deviceName);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");
@ -814,4 +818,16 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
        }
    }
    @RequestMapping(value = "/getSearchTags",method = RequestMethod.GET)
    @ApiOperation("快速搜索标签")
    public Envelop getSearchTags(){
        try {
            return success(monitorPlatformService.getSearchTags());
        }
        catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
}

+ 32 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -79,7 +79,7 @@ public class MonitorPlatformService  {
     * @param diseaseCondition
     * @return
     */
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type,String deviceType) throws IOException {
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type,String deviceType,String deviceName) throws IOException {
        MixEnvelop<LocationDataVO, LocationDataVO> envelop = new MixEnvelop<>();
        MixEnvelop<LocationDataVO, LocationDataVO> envelopTmp = null;
        JSONArray jsonArray = new JSONArray();
@ -890,7 +890,7 @@ public class MonitorPlatformService  {
     * @return
     */
    public JSONArray warningInformationAlarm_new(Integer page,Integer pageSize,String startTime,String endTime,
                                                 String deviceType,String area,String hospital){
                                                 String deviceType,String area,String hospital,String deviceName){
        String url = "/wlyygc/iot_monitoring/warningInformationAlarm_new";
        Map<String, Object> params = new HashMap<>();
        params.put("page",page);
@ -900,6 +900,7 @@ public class MonitorPlatformService  {
        params.put("deviceType",deviceType);
        params.put("area",area);
        params.put("hospital",hospital);
        params.put("deviceName",deviceName);
        String response = sendGet(url,params);
        JSONObject json = JSONObject.parseObject(response);
        if(json.getInteger("status")==200){
@ -951,7 +952,6 @@ public class MonitorPlatformService  {
            for(int i=0;i<jsonArray.size();i++){
                JSONObject data = jsonArray.getJSONObject(i);
                String deviceSn = data.getString("deviceSn");
                JSONArray jsonArray1 = new JSONArray();
                JSONObject json1 = new JSONObject();
                json1.put("andOr","and");
@ -1118,7 +1118,7 @@ public class MonitorPlatformService  {
                StringBuffer sql = new StringBuffer("SELECT a.category_code type,a.device_name,a.c as 'using',b.c-a.c as 'stock',b.c as 'total' from ( ");
                StringBuffer sqlCondition = new StringBuffer();
                if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){
                    sqlCondition.append("and d.device_name='"+deviceName+"' ");
                    sqlCondition.append("and d.device_name in ('").append(deviceName.replace(",","','")).append("') ");
                }
                sql.append("SELECT d.category_code,d.device_name, COUNT(*) c from wlyy.wlyy_patient_device d,wlyy.wlyy_sign_family f WHERE f.`status`>0 and f.patient = d.`user` "+sqlCondition+" ");
                if ("0".equals(showLevel)){//组合一体机(5健康小屋,取自物联网),单体征测量仪(2血压计、1血糖仪)
@ -1206,7 +1206,7 @@ public class MonitorPlatformService  {
                result.put("lostContact",lostContact);
            }
            //deviceType包含小屋且设备名称为空||deviceType包含小屋且设备名称为健康小屋。
          if ((deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType))||(deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)&&"健康小屋".equals(deviceName))){
          if ((deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isBlank(deviceName))||(deviceType.contains("5")&&org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)&&deviceName.contains("健康小屋"))){
                String sql = "select COUNT(*) from xmiot.iot_equipmet_detail";
                Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
                JSONObject tmp = new JSONObject();
@ -1413,4 +1413,31 @@ public class MonitorPlatformService  {
        object.put("medicalAbnormalSignData",gg);
        return object;
    }
    public JSONArray getSearchTags(){
        String sql = "select id,`value` from xmiot.iot_system_dict where dict_name='DEVICE' and del=1;";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        JSONArray result = new JSONArray();
        for (Map<String,Object> map :list){
            sql="select `code`,`value` from xmiot.iot_system_dict where dict_name='DEVICE_TYPE' and del=1 and parent_code='"+map.get("id").toString()+"'";
            StringBuffer buffer = new StringBuffer();
            List<Map<String,Object>> reList = jdbcTemplate.queryForList(sql);
            for (Map<String,Object> reMap:reList){
                JSONObject tmp = new JSONObject();
                tmp.put("name",reMap.get("value").toString());
                tmp.put("code",reMap.get("code").toString());
                buffer.append(","+reMap.get("code").toString());
                result.add(tmp);
            }
            if (org.apache.commons.lang3.StringUtils.isNoneBlank(buffer.toString())){
                buffer.deleteCharAt(0);
                JSONObject tmp = new JSONObject();
                tmp.put("name",map.get("value").toString());
                tmp.put("code",buffer.toString());
                result.add(tmp);
            }
        }
        return  result;
    }
}