| 
															
																@ -11,6 +11,7 @@ import com.yihu.iot.service.device.IotPatientDeviceService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.iot.service.equipment.IotEqtDetailService; 
															 | 
															
															 | 
															
																import com.yihu.iot.service.equipment.IotEqtDetailService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.iot.service.label.FigureLabelSerachService; 
															 | 
															
															 | 
															
																import com.yihu.iot.service.label.FigureLabelSerachService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.iot.service.platform.IotInterfaceLogService; 
															 | 
															
															 | 
															
																import com.yihu.iot.service.platform.IotInterfaceLogService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.iot.util.conceal.ConcealUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.iot.util.excel.HibenateUtils; 
															 | 
															
															 | 
															
																import com.yihu.iot.util.excel.HibenateUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.iot.dict.IotSystemDictDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.iot.dict.IotSystemDictDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -150,7 +151,7 @@ public class MonitorPlatformService  { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){ 
															 | 
															
															 | 
															
																                         if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             String[] deviceNames = deviceName.split(","); 
															 | 
															
															 | 
															
																                             String[] deviceNames = deviceName.split(","); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             for (String tmp :deviceNames){ 
															 | 
															
															 | 
															
																                             for (String tmp :deviceNames){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                                 String sql="select DISTINCT device_code from device.wlyy_devices where device_name like '%"+tmp+"%'"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                 String sql="select DISTINCT device_code from device.wlyy_devices wd INNER JOIN wlyy.wlyy_patient_device pd on pd.device_sn = wd.device_code  where wd.device_name like '%"+tmp+"%'"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                                 List<String> tmpList = jdbcTemplate.queryForList(sql,String.class); 
															 | 
															
															 | 
															
																                                 List<String> tmpList = jdbcTemplate.queryForList(sql,String.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                                 listTmp.addAll(tmpList); 
															 | 
															
															 | 
															
																                                 listTmp.addAll(tmpList); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             } 
															 | 
															
															 | 
															
																                             } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -163,11 +164,12 @@ public class MonitorPlatformService  { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             } 
															 | 
															
															 | 
															
																                             } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         } 
															 | 
															
															 | 
															
																                         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         else{ 
															 | 
															
															 | 
															
																                         else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             json = new JSONObject(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                             String sql="select DISTINCT device_code from device.wlyy_devices wd INNER JOIN wlyy.wlyy_patient_device pd on pd.device_sn = wd.device_code  "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                             List<String> tmpList = jdbcTemplate.queryForList(sql,String.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             json.put("andOr","and"); 
															 | 
															
															 | 
															
																                             json.put("andOr","and"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             json.put("field","categoryCode"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             json.put("condition","="); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             json.put("value",Integer.parseInt(categoryCode)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                             json.put("field","deviceSn"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                             json.put("condition","in"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                             json.put("value",tmpList); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             jsonArray.add(json); 
															 | 
															
															 | 
															
																                             jsonArray.add(json); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         } 
															 | 
															
															 | 
															
																                         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         JSONObject jsonObject = new JSONObject(); 
															 | 
															
															 | 
															
																                         JSONObject jsonObject = new JSONObject(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -981,15 +983,34 @@ public class MonitorPlatformService  { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public JSONArray datafiltering(String name){ 
															 | 
															
															 | 
															
																    public JSONArray datafiltering(String name){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String url = "/wlyygc/iot_monitoring/datafiltering"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Map<String, Object> params = new HashMap<>(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        params.put("name",name); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String response = sendGet(url,params); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONObject json = JSONObject.parseObject(response); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(json.getInteger("status")==200){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            JSONArray jsonArray = json.getJSONArray("data"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        StringBuffer sql = new StringBuffer("SELECT d.category_code as categoryCode,d.id,d.device_sn deviceSn,p.code,p.name,d.device_name deviceName "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sql.append("from wlyy.wlyy_patient_device d,wlyy.wlyy_patient p  "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sql.append("WHERE d.`user` = p.`code`   "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(org.apache.commons.lang3.StringUtils.isNotBlank(name)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql.append("and (d.device_sn like '%"+name+"%' or p.`name` = '"+name+"') "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<JSONObject> jsonArray = myJdbcTemplate.queryJson(sql.toString(),new Object[]{}); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(jsonArray.size()==0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql= new StringBuffer(" select '5' as categoryCode, id,device_code as deviceSn,null as code,null as name,'健康小屋' as deviceName from xmiot.iot_equipmet_detail where device_code like '%"+name+"%'"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            jsonArray = myJdbcTemplate.queryJson(sql.toString(),new Object[]{}); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        for (int i=0;i<jsonArray.size();i++){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            com.alibaba.fastjson.JSONObject jsonObj= jsonArray.get(i); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (org.apache.commons.lang3.StringUtils.isNoneBlank(jsonObj.getString("name"))){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                jsonObj.put("name", ConcealUtil.nameOrAddrConceal(jsonObj.getString("name"))); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        String url = "/wlyygc/iot_monitoring/datafiltering"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        Map<String, Object> params = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        params.put("name",name); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        String response = sendGet(url,params); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        JSONObject json = JSONObject.parseObject(response); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        if(json.getInteger("status")==200){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//            JSONArray jsonArray = json.getJSONArray("data"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            for(int i=0;i<jsonArray.size();i++){ 
															 | 
															
															 | 
															
																            for(int i=0;i<jsonArray.size();i++){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                JSONObject data = jsonArray.getJSONObject(i); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                JSONObject data = jsonArray.get(i); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                String deviceSn = data.getString("deviceSn"); 
															 | 
															
															 | 
															
																                String deviceSn = data.getString("deviceSn"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                JSONArray jsonArray1 = new JSONArray(); 
															 | 
															
															 | 
															
																                JSONArray jsonArray1 = new JSONArray(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                JSONObject json1 = new JSONObject(); 
															 | 
															
															 | 
															
																                JSONObject json1 = new JSONObject(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1016,10 +1037,9 @@ public class MonitorPlatformService  { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            return jsonArray; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return new JSONArray(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            JSONArray result = new JSONArray(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            result.addAll(jsonArray); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return result; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1350,8 +1370,11 @@ public class MonitorPlatformService  { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sqlCondition.append("and f.`status`>0 and f.patient = d.`user` "); 
															 | 
															
															 | 
															
																            sqlCondition.append("and f.`status`>0 and f.patient = d.`user` "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sqlCondition.append("  and d.category_code in ('").append(deviceType.replace(",","','")).append("') "); 
															 | 
															
															 | 
															
																            sqlCondition.append("  and d.category_code in ('").append(deviceType.replace(",","','")).append("') "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sqlCondition.append("and d.device_sn not in (select device_sn from ( select device_sn,MAX(record_date) record_date from device.wlyy_patient_health_index where device_sn<>'' GROUP BY device_sn)a "); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sqlCondition.append("where TIMESTAMPDIFF(DAY,record_date,NOW()) <= 7)"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sqlCondition.append("and d.device_sn not in (select DISTINCT device_sn from device.wlyy_patient_health_index where device_sn<>''  "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)&&org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                sqlCondition.append("and record_date >='"+startTime+" 00:00:00' and record_date<='"+endTime+" 23:59:59'  "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sqlCondition.append(")"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql.append(sqlCondition); 
															 | 
															
															 | 
															
																            sql.append(sqlCondition); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            total=jdbcTemplate.queryForObject(sql.toString(),Integer.class); 
															 | 
															
															 | 
															
																            total=jdbcTemplate.queryForObject(sql.toString(),Integer.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1483,18 +1506,43 @@ public class MonitorPlatformService  { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public JSONObject getDeviceTotalCount(String startTime,String endTime,String deviceType,String area){ 
															 | 
															
															 | 
															
																    public JSONObject getDeviceTotalCount(String startTime,String endTime,String deviceType,String area){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String url = "/wlyygc/iot_monitoring/getDeviceTotalCount"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Map<String, Object> params = new HashMap<>(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        params.put("startTime",startTime); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        params.put("endTime",endTime); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        params.put("deviceType",deviceType); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        params.put("area",area); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String response = sendGet(url,params); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONObject json = JSONObject.parseObject(response); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if(json.getInteger("status")==200){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            return json.getJSONObject("data"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Integer totalAll=0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Integer grant=0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if (deviceType.contains("5")){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            StringBuffer sql = new StringBuffer("select count(*) from xmiot.iot_equipmet_detail where 1=1 "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if(org.apache.commons.lang3.StringUtils.isNoneBlank(area)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                sql.append("and belong_are_code='"+area+"' "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Integer tmp = jdbcTemplate.queryForObject(sql.toString(),Integer.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            totalAll +=tmp; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            grant +=tmp; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return new JSONObject(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        int i = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType)&&deviceType.contains("1")){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            allCountSql+= " where device_name like '%血糖仪%' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            i = 1; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType)&&deviceType.contains("2")){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if(i==1){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                allCountSql+= " or device_name like '%血压计%'"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                allCountSql+= " where device_name like '%血压计%' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Integer allCount = jdbcTemplate.queryForObject(allCountSql, Integer.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        totalAll+=allCount; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        StringBuffer sql = new StringBuffer("SELECT COUNT(*) from wlyy.wlyy_patient_device d,wlyy.wlyy_sign_family f  WHERE 1=1 and f.`status`>0 and f.patient = d.`user` "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sql.append("and d.category_code in ('").append(deviceType.replace(",","','")).append("') "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Integer count = jdbcTemplate.queryForObject(sql.toString(),Integer.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        grant +=count; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        JSONObject result = new JSONObject(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        result.put("totalAll",totalAll); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        result.put("using",grant); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        result.put("stock",totalAll-grant); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return result; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																} 
															 | 
															
															 | 
															
																} 
															 |