|  | @ -456,7 +456,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     monitorInfo.put("sleepPlan",false);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null);
 | 
	
		
			
				|  |  |                 monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null,true);
 | 
	
		
			
				|  |  |                 emergencyOrderVO.setInformation(monitorInfo);
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
	
		
			
				|  | @ -465,7 +465,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         if (6==orderDO.getOrderSource()){//气感工单
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 JSONObject monitorInfo = JSONObject.parseObject(orderDO.getWarnInfo());
 | 
	
		
			
				|  |  |                 monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null);
 | 
	
		
			
				|  |  |                 monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null,true);
 | 
	
		
			
				|  |  |                 emergencyOrderVO.setInformation(monitorInfo);
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
	
		
			
				|  | @ -474,7 +474,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         if (7==orderDO.getOrderSource()){//烟感工单
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 JSONObject monitorInfo = JSONObject.parseObject(orderDO.getWarnInfo());
 | 
	
		
			
				|  |  |                 monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null);
 | 
	
		
			
				|  |  |                 monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null,true);
 | 
	
		
			
				|  |  |                 emergencyOrderVO.setInformation(monitorInfo);
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
	
		
			
				|  | @ -1398,7 +1398,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject patientMonitoringInfo(String patient,String topicItem){
 | 
	
		
			
				|  |  |     public JSONObject patientMonitoringInfo(String patient,String topicItem,boolean video){
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         result.put("location",null);
 | 
	
		
			
				|  |  |         result.put("fences",null);
 | 
	
	
		
			
				|  | @ -1406,7 +1406,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         result.put("fire",null);
 | 
	
		
			
				|  |  |         result.put("fall",null);
 | 
	
		
			
				|  |  |         result.put("sleep",null);
 | 
	
		
			
				|  |  |         result.put("sleepInfo",null);//最近工单
 | 
	
		
			
				|  |  |         result.put("sleepOrderInfo",null);//最近工单
 | 
	
		
			
				|  |  |         result.put("deviceSn",null);
 | 
	
		
			
				|  |  |         result.put("emeAssistance",false);
 | 
	
		
			
				|  |  |         result.put("monitorInfo",null);
 | 
	
	
		
			
				|  | @ -1448,7 +1448,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                                 "and patient='"+patient+"' and `status`=1 order by create_time desc limit 1 ";
 | 
	
		
			
				|  |  |                         List<String> serveDesces = jdbcTemplate.queryForList(sql,String.class);
 | 
	
		
			
				|  |  |                         if (serveDesces.size()>0){
 | 
	
		
			
				|  |  |                             result.put("sleepInfo",serveDesces.get(0));
 | 
	
		
			
				|  |  |                             result.put("sleepOrderInfo",serveDesces.get(0));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         result.put("sleep",false);
 | 
	
	
		
			
				|  | @ -1461,7 +1461,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         if (counnt>0){
 | 
	
		
			
				|  |  |             result.put("emeAssistance",true);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         result = patientSignTopicInfo(result,patient,topicItem,null);
 | 
	
		
			
				|  |  |         result = patientSignTopicInfo(result,patient,topicItem,null,true);
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1479,7 +1479,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         result.put("fire",null);
 | 
	
		
			
				|  |  |         result.put("fall",null);
 | 
	
		
			
				|  |  |         result.put("sleep",null);
 | 
	
		
			
				|  |  |         result.put("sleepInfo",null);//最近工单
 | 
	
		
			
				|  |  |         result.put("sleepOrderInfo",null);//最近工单
 | 
	
		
			
				|  |  |         result.put("deviceSn",null);
 | 
	
		
			
				|  |  |         result.put("emeAssistance",false);
 | 
	
		
			
				|  |  |         result.put("monitorInfo",null);
 | 
	
	
		
			
				|  | @ -1521,7 +1521,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                                 "and patient='"+patient+"' and `status`=1 order by create_time desc limit 1 ";
 | 
	
		
			
				|  |  |                         List<String> serveDesces = jdbcTemplate.queryForList(sql,String.class);
 | 
	
		
			
				|  |  |                         if (serveDesces.size()>0){
 | 
	
		
			
				|  |  |                             result.put("sleepInfo",serveDesces.get(0));
 | 
	
		
			
				|  |  |                             result.put("sleepOrderInfo",serveDesces.get(0));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         result.put("sleep",false);
 | 
	
	
		
			
				|  | @ -1536,9 +1536,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<DevicePatientDevice> devices4 = patientDeviceDao.findByUserAndCategoryCode(patient,"4");//手表
 | 
	
		
			
				|  |  |         if (devices4.size()>0){
 | 
	
		
			
				|  |  |             result =  patientSignTopicInfo(result,patient,"preventLost",devices4.get(0).getDeviceSn());
 | 
	
		
			
				|  |  |             result =  patientSignTopicInfo(result,patient,"preventLost",devices4.get(0).getDeviceSn(),true);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         patientSignTopicInfo(result,patient,"preventFall",null);
 | 
	
		
			
				|  |  |         patientSignTopicInfo(result,patient,"preventFall",null,true);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -1870,7 +1870,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject patientSignTopicInfo(JSONObject result,String patient,String topicItem,String deviceSn){
 | 
	
		
			
				|  |  |     public JSONObject patientSignTopicInfo(JSONObject result,String patient,String topicItem,String deviceSn,boolean video){
 | 
	
		
			
				|  |  |         if (null==result){
 | 
	
		
			
				|  |  |             result = new JSONObject();
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -1884,14 +1884,15 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |             preventOutOfBed(result, patient,true,null);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventFire".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             preventFire(result, patient,null,true);
 | 
	
		
			
				|  |  |             preventFire(result, patient,null,video);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventGasLeakage".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             preventGasLeakage(result, patient,true);
 | 
	
		
			
				|  |  |             preventGasLeakage(result, patient,video);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject updateDoctorLocation(String doctor,String orderId,String doctorAddress,String doctorLat,String doctorLon){
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 | 
	
	
		
			
				|  | @ -2063,7 +2064,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject findMonitorPatientsByDoctor(String doctor,String topicItem,Integer page,Integer pageSize,Integer detail){
 | 
	
		
			
				|  |  |     public JSONObject findMonitorPatientsByDoctor(String doctor,String topicItem,String day,Integer page,Integer pageSize,Integer detail){
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = " SELECT DISTINCT p.id,p.name,p.residential_area residentialArea,p.photo,p.idcard,p.mobile, " +
 | 
	
	
		
			
				|  | @ -2071,9 +2072,21 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                 " from base_patient p , base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
 | 
	
		
			
				|  |  |                 " WHERE p.id = sr.patient and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
 | 
	
		
			
				|  |  |                 " and m.doctor_code = '"+doctor+"' and m.del = '1' ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String filter =" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
 | 
	
		
			
				|  |  |                          " where  pd.user = sr.patient and pd.del=0 and  FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
 | 
	
		
			
				|  |  |         String filter = "";
 | 
	
		
			
				|  |  |         String deviceSn ="";
 | 
	
		
			
				|  |  |         if ("actionTrack".equals(topicItem)){//行动轨迹
 | 
	
		
			
				|  |  |             filter =" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
 | 
	
		
			
				|  |  |                     " where  pd.user = sr.patient and pd.del=0 and  FIND_IN_SET('preventLost',dd.service_topic)) ";
 | 
	
		
			
				|  |  |             List<String> deviceSns = jdbcTemplate.queryForList("select 1 from wlyy_patient_device pd INNER JOIN dm_device dd " +
 | 
	
		
			
				|  |  |                     " on pd.device_id = dd.id where  pd.user = sr.patient and pd.del=0 and  FIND_IN_SET('preventLost',dd.service_topic)",String.class);
 | 
	
		
			
				|  |  |             if (deviceSns.size()>0){
 | 
	
		
			
				|  |  |                 deviceSn = deviceSns.get(0);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         else{
 | 
	
		
			
				|  |  |             filter =" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
 | 
	
		
			
				|  |  |                     " where  pd.user = sr.patient and pd.del=0 and  FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if ("preventLost".equals(topicItem)){//有绑定围栏的居民
 | 
	
		
			
				|  |  |             filter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
 | 
	
	
		
			
				|  | @ -2095,7 +2108,16 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |             result.put("currentPage",page+1);
 | 
	
		
			
				|  |  |             for (int i=currentIndexFrom;i<list.size()&&i<currentIndexEnd;i++){
 | 
	
		
			
				|  |  |                 Map<String,Object> patientTmp = list.get(i);
 | 
	
		
			
				|  |  |                 JSONObject object = patientMonitoringInfo(patientTmp.get("id").toString(),topicItem);
 | 
	
		
			
				|  |  |                 JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |                 switch (topicItem){
 | 
	
		
			
				|  |  |                     case "actionTrack":
 | 
	
		
			
				|  |  |                         List<Map<String , Object>> actionTracks = getActionTrack(deviceSn,day);
 | 
	
		
			
				|  |  |                         object.put("actionTrack",actionTracks);
 | 
	
		
			
				|  |  |                         break;
 | 
	
		
			
				|  |  |                     default:
 | 
	
		
			
				|  |  |                         object = patientMonitoringInfo(patientTmp.get("id").toString(),topicItem,false);
 | 
	
		
			
				|  |  |                         break;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 object.put("patientInfo",patientTmp);
 | 
	
		
			
				|  |  |                 monitorInfos.add(object);
 | 
	
		
			
				|  |  |             }
 |