| 
					
				 | 
			
			
				@ -47,6 +47,7 @@ import com.yihu.jw.util.common.LatitudeUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.entity.EntityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import jdk.nashorn.internal.runtime.FindProperty; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.LoggerFactory; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2230,10 +2231,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (deviceSns.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deviceSn = deviceSns.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (deviceSns.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deviceSn = deviceSns.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("deviceCode", deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("deviceSn", deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                switch (topicItem) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    case "actionTrack": 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2265,6 +2263,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("patientInfo", patientTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("deviceSn", deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                monitorInfos.add(object); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("topicInfo", monitorInfos); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2331,7 +2330,6 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " where  pd.user = sr.patient and pd.del=0 and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItemTmp + "',dd.service_topic)) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("preventLost".equals(topicItem)) {//有绑定围栏的居民 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2355,12 +2353,32 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String deviceSn = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<String> deviceSns = jdbcTemplate.queryForList("select pd.device_sn from wlyy_patient_device pd INNER JOIN dm_device dd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " on pd.device_id = dd.id where  pd.user = '" + patientTmp.get("id").toString() + "' and pd.del=0  and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItemTmp + "',dd.service_topic)", String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (deviceSns.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deviceSn = deviceSns.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("emergencyAssistance".equals(topicItem)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql = "select pd.device_sn,dd.category_code from wlyy_patient_device pd INNER JOIN dm_device dd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " on pd.device_id = dd.id where  pd.user = '" + patientTmp.get("id").toString() + "' and pd.del=0  and pd.category_code in (" + categoryCode + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<Map<String,Object>> deviceSns = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (deviceSns.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        boolean findFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        for (Map<String,Object> tmp:deviceSns){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if("4".equals(tmp.get("category_code").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                deviceSn = tmp.get("device_sn").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                findFlag=true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (!findFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            deviceSn = deviceSns.get(0).get("device_sn").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    object.put("deviceSn", deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql = "select pd.device_sn from wlyy_patient_device pd INNER JOIN dm_device dd " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " on pd.device_id = dd.id where  pd.user = '" + patientTmp.get("id").toString() + "' and pd.del=0  and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItemTmp + "',dd.service_topic)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<String> deviceSns = jdbcTemplate.queryForList(sql, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (deviceSns.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        deviceSn = deviceSns.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    object.put("deviceSn", deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("deviceSn", deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                switch (topicItem) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    case "actionTrack": 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2434,6 +2452,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("patientInfo", patientTmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object.put("deviceSn", deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                monitorInfos.add(object); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("topicInfo", monitorInfos); 
			 |