|  | @ -9,7 +9,8 @@ import com.yihu.iot.service.common.MyJdbcTemplate;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.device.IotPatientDeviceService;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.equipment.IotEqtDetailService;
 | 
	
		
			
				|  |  | import com.yihu.iot.service.label.FigureLabelSerachService;
 | 
	
		
			
				|  |  | import com.yihu.iot.util.excel.hibernate.HibenateUtils;
 | 
	
		
			
				|  |  | import com.yihu.iot.util.excel.HibenateUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.http.HttpClientUtil;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
	
		
			
				|  | @ -44,8 +45,6 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  |     private String appSecret;
 | 
	
		
			
				|  |  |     @Value("${wechat.id}")
 | 
	
		
			
				|  |  |     private String wxId;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${wechat.flag}")
 | 
	
		
			
				|  |  |     private boolean flag;
 | 
	
		
			
				|  |  |     public static Map<String,String> tokenMap = new HashMap<>();
 | 
	
	
		
			
				|  | @ -151,12 +150,19 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  |         params.put("area",area);
 | 
	
		
			
				|  |  |         params.put("hospital",hospital);
 | 
	
		
			
				|  |  |         String anotherResult = sendGet(url,params);
 | 
	
		
			
				|  |  |         String sqlAre = "select count(1) AS \"total\",t.belong_are AS \"belong_are\",t.belong_are_code AS \"belong_are_code\" from iot_equipmet_detail t group by t.belong_are_code order by \"total\" desc ";
 | 
	
		
			
				|  |  |         String sqlAre = dealSql(params);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> iotEquip = hibenateUtils.createSQLQuery(sqlAre);
 | 
	
		
			
				|  |  |         if("8"==deviceType){
 | 
	
		
			
				|  |  |            return iotEquip.toString();
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             JSONObject jsonObject = JSONObject.parseObject(anotherResult);
 | 
	
		
			
				|  |  |         if(StringUtils.isEmpty(deviceType)){
 | 
	
		
			
				|  |  |             deviceType = "";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String[] str =deviceType.split(",");
 | 
	
		
			
				|  |  |         List<String> list = new ArrayList<>();
 | 
	
		
			
				|  |  |         for (int i=0;i<str.length;i++){
 | 
	
		
			
				|  |  |             list.add(str[i]);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONObject jsonObject = JSONObject.parseObject(anotherResult);
 | 
	
		
			
				|  |  |         IotSystemDictDO iotSystemDictDO = iotSystemDictDao.findByDictNameAndValueAndDel("DEVICE_TYPE","健康小屋",1);
 | 
	
		
			
				|  |  |         if (null!=iotSystemDictDO&&list.size()>1&&list.contains(iotSystemDictDO.getCode())){
 | 
	
		
			
				|  |  |             if("200".equals(jsonObject.get("status").toString())){
 | 
	
		
			
				|  |  |                 JSONArray dataresult= jsonObject.getJSONArray("data");
 | 
	
		
			
				|  |  |                 JSONArray resultArray = new JSONArray();
 | 
	
	
		
			
				|  | @ -180,14 +186,19 @@ public class MonitorPlatformService  {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return jsonObject.toString();
 | 
	
		
			
				|  |  |         }else if (list.size()==1&&list.contains(iotSystemDictDO.getCode())){
 | 
	
		
			
				|  |  |             jsonObject.replace("data",iotEquip.toString());
 | 
	
		
			
				|  |  |             return jsonObject.toString();
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |            return anotherResult;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     private String dealSql(Map<String, Object> params){
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer();
 | 
	
		
			
				|  |  |         sql.append("select count(1) AS \"total\",t.belong_are AS \"belong_are\",t.belong_are_code AS \"belong_are_code\" from iot_equipmet_detail t ");
 | 
	
		
			
				|  |  |         sql.append("select count(1) AS \"num\",t.belong_are AS \"name\",t.belong_are_code AS \"code\" from iot_equipmet_detail t ");
 | 
	
		
			
				|  |  |         sql.append(" where 1=1 ");
 | 
	
		
			
				|  |  |         if (null!=params.get("area")){
 | 
	
		
			
				|  |  |             sql.append(" and t.belong_are = '"+params.get("area").toString()+"'");
 | 
	
		
			
				|  |  |             sql.append(" and t.belong_are_code = '"+params.get("area").toString()+"'");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (null!=params.get("startTime")) {
 | 
	
		
			
				|  |  |             //sql.append(" and t.update_time > '" + beginTime+"'");//DateUtil.stringToDate(beginTime,"yyyy-MM-dd HH:mm:ss")
 |