|  | @ -733,6 +733,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                 case "dailyWater":
 | 
	
		
			
				|  |  |                     categoryCode = "'18'";
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "accessControl":
 | 
	
		
			
				|  |  |                     categoryCode = "'19'";
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "electricControl":
 | 
	
		
			
				|  |  |                     categoryCode = "'20'";
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
 | 
	
		
			
				|  |  |                 BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 | 
	
	
		
			
				|  | @ -905,6 +911,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                 case "dailyWater":
 | 
	
		
			
				|  |  |                     categoryCode = "'18'";
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "accessControl":
 | 
	
		
			
				|  |  |                     categoryCode = "'19'";
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "electricControl":
 | 
	
		
			
				|  |  |                     categoryCode = "'20'";
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
 | 
	
		
			
				|  |  |                 BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 | 
	
	
		
			
				|  | @ -1692,6 +1704,42 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "accessControl":
 | 
	
		
			
				|  |  |                     if (patientDeviceService.patientDeviceListByTopic(patient,"accessControl").size()==0){
 | 
	
		
			
				|  |  |                         result.put("accessControl", null);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         Integer count = Integer.parseInt(tmp.get("total").toString());
 | 
	
		
			
				|  |  |                         if (count > 0) {
 | 
	
		
			
				|  |  |                             result.put("accessControl", true);
 | 
	
		
			
				|  |  |                             sql = " select serve_desc from base_security_monitoring_order where topic_item='accessControl' " +
 | 
	
		
			
				|  |  |                                     "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("accessControlOrderInfo", serveDesces.get(0));
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         } else {
 | 
	
		
			
				|  |  |                             result.put("accessControl", false);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "electricControl":
 | 
	
		
			
				|  |  |                     if (patientDeviceService.patientDeviceListByTopic(patient,"electricControl").size()==0){
 | 
	
		
			
				|  |  |                         result.put("electricControl", null);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         Integer count = Integer.parseInt(tmp.get("total").toString());
 | 
	
		
			
				|  |  |                         if (count > 0) {
 | 
	
		
			
				|  |  |                             result.put("electricControl", true);
 | 
	
		
			
				|  |  |                             sql = " select serve_desc from base_security_monitoring_order where topic_item='electricControl' " +
 | 
	
		
			
				|  |  |                                     "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("electricControlOrderInfo", serveDesces.get(0));
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         } else {
 | 
	
		
			
				|  |  |                             result.put("electricControl", false);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql = " select count(id) from base_emergency_assistance_order  where patient='" + patient + "' and status=" + EmergencyAssistanceDO.Status.apply.getType();
 | 
	
	
		
			
				|  | @ -1715,67 +1763,14 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                 "and dict.remark='security'  GROUP BY dict.code ";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         for (Map<String, Object> tmp : list) {
 | 
	
		
			
				|  |  |             switch (tmp.get("code").toString()) {
 | 
	
		
			
				|  |  |                 case "preventGasLeakage":
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> devices = patientDeviceService.patientDeviceListByTopic(patient,"preventGasLeakage");
 | 
	
		
			
				|  |  |                     if (devices.size()>0) {
 | 
	
		
			
				|  |  |                         tmp.put("band", true);
 | 
	
		
			
				|  |  |                         tmp.put("devices", devices);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         tmp.put("band", false);
 | 
	
		
			
				|  |  |                         tmp.put("devices", null);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "preventFire":
 | 
	
		
			
				|  |  |                     devices = patientDeviceService.patientDeviceListByTopic(patient,"preventFire");
 | 
	
		
			
				|  |  |                     if (devices.size()>0){
 | 
	
		
			
				|  |  |                         tmp.put("band", true);
 | 
	
		
			
				|  |  |                         tmp.put("devices", devices);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         tmp.put("band", false);
 | 
	
		
			
				|  |  |                         tmp.put("devices", null);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "preventFall":
 | 
	
		
			
				|  |  |                     devices = patientDeviceService.patientDeviceListByTopic(patient,"preventFall");
 | 
	
		
			
				|  |  |                     if (devices.size()>0){
 | 
	
		
			
				|  |  |                         tmp.put("band", true);
 | 
	
		
			
				|  |  |                         tmp.put("devices", devices);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         tmp.put("band", false);
 | 
	
		
			
				|  |  |                         tmp.put("devices", null);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "preventOutOfBed":
 | 
	
		
			
				|  |  |                     devices = patientDeviceService.patientDeviceListByTopic(patient,"preventOutOfBed");
 | 
	
		
			
				|  |  |                     if (devices.size()>0){
 | 
	
		
			
				|  |  |                         tmp.put("band", true);
 | 
	
		
			
				|  |  |                         tmp.put("devices", devices);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         tmp.put("band", false);
 | 
	
		
			
				|  |  |                         tmp.put("devices", null);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "preventLost":
 | 
	
		
			
				|  |  |                     devices = patientDeviceService.patientDeviceListByTopic(patient,"preventLost");
 | 
	
		
			
				|  |  |                     if (devices.size()>0){
 | 
	
		
			
				|  |  |                         tmp.put("band", true);
 | 
	
		
			
				|  |  |                         tmp.put("devices", devices);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         tmp.put("band", false);
 | 
	
		
			
				|  |  |                         tmp.put("devices", null);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "dailyWater":
 | 
	
		
			
				|  |  |                     devices = patientDeviceService.patientDeviceListByTopic(patient,"dailyWater");
 | 
	
		
			
				|  |  |                     if (devices.size()>0){
 | 
	
		
			
				|  |  |                         tmp.put("band", true);
 | 
	
		
			
				|  |  |                         tmp.put("devices", devices);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         tmp.put("band", false);
 | 
	
		
			
				|  |  |                         tmp.put("devices", null);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |             String topicStr = tmp.get("code").toString();
 | 
	
		
			
				|  |  |             List<Map<String,Object>> devices = patientDeviceService.patientDeviceListByTopic(patient,topicStr);
 | 
	
		
			
				|  |  |             if (devices.size()>0) {
 | 
	
		
			
				|  |  |                 tmp.put("band", true);
 | 
	
		
			
				|  |  |                 tmp.put("devices", devices);
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 tmp.put("band", false);
 | 
	
		
			
				|  |  |                 tmp.put("devices", null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql = " select 'emeAssistance' as code,ord.id,ord.patient,'20' as OrderType,'紧急呼叫' as serveDesc " +
 | 
	
	
		
			
				|  | @ -1883,7 +1878,34 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                         result.put("dailyWater", false);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 case "accessControl":
 | 
	
		
			
				|  |  |                     count = Integer.parseInt(tmp.get("total").toString());
 | 
	
		
			
				|  |  |                     if (count > 0) {
 | 
	
		
			
				|  |  |                         result.put("accessControl", true);
 | 
	
		
			
				|  |  |                         sql = " select serve_desc from base_security_monitoring_order where topic_item='accessControl' " +
 | 
	
		
			
				|  |  |                                 "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("accessControlOrderInfo", serveDesces.get(0));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         result.put("accessControl", false);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "electricControl":
 | 
	
		
			
				|  |  |                     count = Integer.parseInt(tmp.get("total").toString());
 | 
	
		
			
				|  |  |                     if (count > 0) {
 | 
	
		
			
				|  |  |                         result.put("electricControl", true);
 | 
	
		
			
				|  |  |                         sql = " select serve_desc from base_security_monitoring_order where topic_item='electricControl' " +
 | 
	
		
			
				|  |  |                                 "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("electricControlOrderInfo", serveDesces.get(0));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         result.put("electricControl", false);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql = " select count(id) from base_emergency_assistance_order  where patient='" + patient + "' and status=" + EmergencyAssistanceDO.Status.apply.getType();
 | 
	
	
		
			
				|  | @ -2610,6 +2632,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |             case "dailyWater":
 | 
	
		
			
				|  |  |                 categoryCode = "'18'";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "accessControl":
 | 
	
		
			
				|  |  |                 categoryCode = "'19'";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "electricControl":
 | 
	
		
			
				|  |  |                 categoryCode = "'20'";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         fliter = " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
 | 
	
	
		
			
				|  | @ -2745,6 +2773,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |             case "dailyWater":
 | 
	
		
			
				|  |  |                 categoryCode = "'18'";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "accessControl":
 | 
	
		
			
				|  |  |                 categoryCode = "'19'";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "electricControl":
 | 
	
		
			
				|  |  |                 categoryCode = "'20'";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "emergencyAssistance":
 | 
	
		
			
				|  |  |                 categoryCode = "'7','4'";
 | 
	
		
			
				|  |  |                 break;
 | 
	
	
		
			
				|  | @ -2941,7 +2975,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPatientDeviceTopic(String patient){
 | 
	
		
			
				|  |  |         List<Map<String,Object>> result = new ArrayList<>();
 | 
	
		
			
				|  |  |         String sql = " select distinct pd.device_sn,pd.category_code from wlyy_patient_device pd where pd.del=0  " +
 | 
	
		
			
				|  |  |                 " and pd.category_code in (4,7,12,13,14,15,18) and pd.`user`='"+patient+"' " +
 | 
	
		
			
				|  |  |                 " and pd.category_code in (4,7,12,13,14,15,18,19,20) and pd.`user`='"+patient+"' " +
 | 
	
		
			
				|  |  |                 " group by pd.category_code ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         for (Map<String,Object> tmp:list){
 | 
	
	
		
			
				|  | @ -2983,6 +3017,16 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                     mapTmp.put("topic","dailyWater");
 | 
	
		
			
				|  |  |                     result.add(mapTmp);
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "19":
 | 
	
		
			
				|  |  |                     mapTmp.put("deviceSn",tmp.get("device_sn").toString());
 | 
	
		
			
				|  |  |                     mapTmp.put("topic","accessControl");
 | 
	
		
			
				|  |  |                     result.add(mapTmp);
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "20":
 | 
	
		
			
				|  |  |                     mapTmp.put("deviceSn",tmp.get("device_sn").toString());
 | 
	
		
			
				|  |  |                     mapTmp.put("topic","electricControl");
 | 
	
		
			
				|  |  |                     result.add(mapTmp);
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return  result;
 |