|  | @ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.iot.dao.dict.IotSystemDictDao;
 | 
	
		
			
				|  |  | import com.yihu.iot.dao.equipment.IotEquipmentDetailDao;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.analyzer.WlyyIotTzDict;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.analyzer.WlyyIotTzDictDao;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.common.MyJdbcTemplate;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.device.IotPatientDeviceService;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.equipment.IotEqtDetailService;
 | 
	
	
		
			
				|  | @ -75,6 +77,8 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  |     private IotInterfaceLogService iotInterfaceLogService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyIotTzDictDao wlyyIotTzDictDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取位置信息
 | 
	
	
		
			
				|  | @ -1208,6 +1212,8 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject getEquipmentStatistics(String deviceType,String deviceName,String showLevel){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             WlyyIotTzDict dictObj =wlyyIotTzDictDao.findByCodeAndDel("IOT_LOST_DAY",1);
 | 
	
		
			
				|  |  |             String lost_day = dictObj.getValue();
 | 
	
		
			
				|  |  |             JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |             JSONArray arrTmp = new JSONArray();
 | 
	
		
			
				|  |  |             result.put("deviceInfo",arrTmp);
 | 
	
	
		
			
				|  | @ -1301,7 +1307,7 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //失联设备(一周未上传当作失联)
 | 
	
		
			
				|  |  |                 sql.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 ");
 | 
	
		
			
				|  |  |                 sql.append("where TIMESTAMPDIFF(DAY,record_date,NOW()) <= 30)");
 | 
	
		
			
				|  |  |                 sql.append("where TIMESTAMPDIFF(DAY,record_date,NOW()) <= "+lost_day+")");
 | 
	
		
			
				|  |  |                 Integer lostContact = jdbcTemplate.queryForObject(sql.toString(),Integer.class);
 | 
	
		
			
				|  |  |                 result.put("lostContact",lostContact);
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -1371,6 +1377,8 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject iotAndLostRange(String startTime,String endTime,
 | 
	
		
			
				|  |  |                                       String deviceType,String area,String hospital,String quotaCode){
 | 
	
		
			
				|  |  |         WlyyIotTzDict dictObj =wlyyIotTzDictDao.findByCodeAndDel("IOT_LOST_DAY",1);
 | 
	
		
			
				|  |  |         String lost_day = dictObj.getValue();
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer("select count(*) from wlyy.wlyy_patient_device d ,wlyy.wlyy_sign_family f WHERE f.`status`>0 and d.del=0 and f.patient = d.`user`  ");
 | 
	
		
			
				|  |  |         StringBuffer sqlCondition = new StringBuffer(" ");
 | 
	
	
		
			
				|  | @ -1424,7 +1432,7 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  |                 sqlCondition.append("and record_date >='"+startTime+" 00:00:00' and record_date<='"+endTime+" 23:59:59'  ");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 sqlCondition.append("and  TIMESTAMPDIFF(DAY,record_date,NOW()) <= 30  ");
 | 
	
		
			
				|  |  |                 sqlCondition.append("and  TIMESTAMPDIFF(DAY,record_date,NOW()) <= "+lost_day+"  ");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             sqlCondition.append(")");
 | 
	
		
			
				|  |  |             sql.append(sqlCondition);
 |