Browse Source

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 years ago
parent
commit
19cc8794b9

+ 2 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/DevicePatientHealthIndexDao.java

@ -58,7 +58,7 @@ public interface DevicePatientHealthIndexDao
	@Query(value = "select DATE_FORMAT(a.record_date,'%Y-%m-%d') from wlyy_patient_health_index a where a.user = ?1 and a.type=?2 and a.record_date >= ?3 and a.record_date <= ?4 and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d') order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit ?5 ,?6",nativeQuery = true)
	List<String> findDateList(String patient, int type, Date start, Date end, int currentSize, int pageSize);
	
	@Query(value= " select * from wlyy_patient_health_index where type in (1,2) and record_date BETWEEN ?1 AND ?2  AND user in (select p.code from wlyy.wlyy_patient p INNER JOIN wlyy.wlyy_sign_family s on s.patient = p.code RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code where  s.status > 0 AND s.admin_team_code = ?3 and (s.doctor = ?4 or s.doctor_health =?4) and sp.status = 1 and sp.label_type = 3 and (sp.label = 1 or sp.label = 2))",nativeQuery = true)
	List<DevicePatientHealthIndex> findByTeamcodeAndRecordDate(Date start, Date end, String teamcode, String doctorcode);
@ -77,4 +77,5 @@ public interface DevicePatientHealthIndexDao
	@Modifying
	@Query("update DevicePatientHealthIndex a set a.manageResult=1 where a.id in (?1) ")
	void handleHealthIndex(Long[] id);
}

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DoctorDeviceController.java

@ -151,4 +151,5 @@ public class DoctorDeviceController extends BaseController {
		}
	}
}

+ 21 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PadDeviceController.java

@ -308,4 +308,25 @@ public class PadDeviceController extends BaseController {
        }
    }
    @RequestMapping(value ="addPatientSosContacts",method = RequestMethod.POST)
    @ApiOperation(value = "设备绑定添加联系人")
    public String addPatientSosContacts(@ApiParam(name = "patient", value = "patient", defaultValue = "patient")
                                           @RequestParam(value = "patient", required = true) String patient,
                                        @ApiParam(name = "jsonStr", value = "patient", defaultValue = "patient")
                                        @RequestParam(value = "jsonStr", required = true) String jsonStr){
        try {
            JSONObject result = contactsService.addPatientSosContacts(patient,jsonStr);
            if (ResponseContant.success == result.getInteger(ResponseContant.resultFlag)){
                return success("添加成功");
            }
            else {
                return error(-1,result.getString(ResponseContant.resultMsg));
            }
        }catch (Exception e){
            return errorResult(e);
        }
    }
}

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java

@ -77,7 +77,7 @@ public class PatientDeviceController extends BaseController {
                                   @ApiParam(name = "date", value = "日期", defaultValue = "2021-08-24")
                                   @RequestParam(value = "date", required = true) String date){
        try {
            return write(200,"获取成功","data",patientDeviceService.gasConcentration(patientId,date));
            return write(200,"获取成功","data",patientDeviceService.gasConcentration(patientId,date,null));
        } catch (Exception ex) {
            return errorResult(ex);
        }
@ -429,7 +429,7 @@ public class PatientDeviceController extends BaseController {
        }
    }
    @ApiOperation("获取设备详情信息")
    @ApiOperation("获取设备详情数据 --设备可多人绑定查询数据时与patient无关")
    @RequestMapping(value = "getPatientDeviceData",method = RequestMethod.GET)
    public String getPatientDeviceData(@ApiParam(name="patient")
                                       @RequestParam(value = "patient")String patient,

+ 45 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java

@ -290,6 +290,51 @@ public class ContactsService {
    }
    /**
     *设备绑定添加居民紧急联系人
     */
    public JSONObject addPatientSosContacts(String patient,String jsonStr) throws Exception {
        JSONObject result = new JSONObject();
        List<PatientSosContactsDO> list = sosContactsDao.findByPatientOrderByUpdateTimeDesc(patient);
        JSONArray jsonArray = JSONArray.parseArray(jsonStr);
        for (int i=0;i<jsonArray.size();i++){
            list = sosContactsDao.findByPatientAndDel(patient,1);
            JSONObject obj = jsonArray.getJSONObject(i);
            String num = obj.getString("num");
            String name = obj.getString("name");
            String relation = obj.getString("relation");
            Integer seqid=0;
            if (list.size()>=2){
                List<String> sosContacts =list.stream().map(PatientSosContactsDO::getSosPhone).collect(Collectors.toList());
                if (!sosContacts.contains(num)){
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"该用户紧急联系人已上限");
                    return result;
                }
            }
            if (list.size()>0){
                seqid = list.get(0).getPhoneSeqid();
            }
            PatientSosContactsDO contactsDO = sosContactsDao.findByPatientAndSosPhone(patient,num);
            if(null==contactsDO){
                contactsDO = new PatientSosContactsDO();
                contactsDO.setPhoneSeqid(1==seqid?2:1);
            }
            contactsDO.setDel(1);
            contactsDO.setPatient(patient);
            contactsDO.setSosName(name);
            contactsDO.setSosPhone(num);
            contactsDO.setRelation(Integer.parseInt(relation));
            contactsDO.setSuccessFlag(0);
            sosContactsDao.save(contactsDO);
        }
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,"修改成功");
        return result;
    }
    public void delSosNumber(List<Map<String,Object>> sims,String patient,String[] numTmp) {
        String delSuccess = "";//白名单删除号码
        for (Map<String,Object> simTmp : sims) {

+ 153 - 37
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -61,6 +61,7 @@ import javax.annotation.PostConstruct;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Component
@Transactional(rollbackFor = Exception.class)
@ -172,9 +173,15 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * 燃气浓度
     * @param patient
     */
    public List<Map<String,Object>> gasConcentration(String patient,String date){
    public List<Map<String,Object>> gasConcentration(String patient,String date,String deviceSn){
        String sql = "SELECT r.value,r.create_time from wlyy_patient_device pd,base_device_health_index r " +
                "WHERE pd.device_sn = r.device_sn and pd.`user` = '"+patient+"' ";
                "WHERE pd.device_sn = r.device_sn  ";
        if (StringUtils.isNotBlank(patient)){
            sql +=" and pd.`user` = '"+patient+"' ";
        }
        if (StringUtils.isNotBlank(deviceSn)){
            sql +=" and r.device_sn = '"+deviceSn+"' ";
        }
        sql += " and pd.category_code='14' and r.create_time>'"+date+" 00:00:00' and r.create_time<'"+date+" 23:59:59'  ORDER BY r.create_time desc ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -209,6 +216,11 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        String userType = devicePatientDevice.getUserType();
        String sosAddress = null;
        String url ="";
        String sql = " select count(id) from wlyy_patient_device where user='"+devicePatientDevice.getUser()+"' and  device_sn='sn' and del=0 ";
        if (jdbcTemplate.queryForObject(sql,Integer.class)>0){
            return -5;
        }
        if (userType == null) {
            userType = "-1";
            devicePatientDevice.setUserType("-1");
@ -247,7 +259,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                //V1.0.0    监控器、报警器、燃气传感器 烟雾传感器支持一个设备绑定多个居民
                //监控器 12   报警器 7  14  15
                if ("12".equals(type) || "14".equals(type) || "15".equals(type) || "7".equals(type) ) {
                if ("12".equals(type) || "14".equals(type) || "15".equals(type)) {
                    if (devicePatientDevice.getUser().equals(device.getUser())) {
                        System.out.println("居民已经绑定此sn码:"+sn);
                        return -5;
@ -902,12 +914,11 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"居民未绑定该设备");
            }else {
                String sql = "select dd.photo,pd.device_sn,dd.brands,dd.category_code,dd.model,pd.device_name,date_format(pd.czrq,'%Y-%m-%d %H:%i:%S' ) deviceTime " +
                        "from dm_device dd INNER JOIN wlyy_patient_device pd on dd.category_code = pd.category_code INNER JOIN wlyy_devices wd on dd.model = wd.device_model and pd.device_sn = wd.device_code \n" +
                        "where 1=1 and  pd.del=0 and pd.device_sn ='"+deviceSn+"' group by pd.user";
                String sql = "select dd.photo,GROUP_CONCAT( p.name) as patientName,pd.device_sn,dd.brands,dd.category_code,dd.model,pd.device_name,date_format(pd.czrq,'%Y-%m-%d %H:%i:%S' ) deviceTime " +
                        "from dm_device dd INNER JOIN wlyy_patient_device pd on dd.category_code = pd.category_code INNER JOIN base_patient p on p.id = pd.user \n" +
                        "where 1=1 and  pd.del=0 and pd.device_sn ='"+deviceSn+"' group by pd.device_sn";
                Map<String,Object> devInfo = jdbcTemplate.queryForMap(sql);
                devInfo.put("patient",patient);
                devInfo.put("patientName",patientDO.getName());
                devInfo.put("sosContactsDOS",new ArrayList<>());
                if ("4".equals(device.getCategoryCode())||"7".equals(device.getCategoryCode())){
                    devInfo.put("sosContactsDOS",contactsService.getPatientSosContacts(patient));
@ -919,9 +930,13 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    case "2"://血糖设备
                        break;
                    case "4"://手表 围栏与轨迹
                        if (StringUtils.isBlank(day)){
                            day = DateUtil.getStringDateShort();
                        }
                        devInfoObj =  securityMonitoringOrderService.patientSignTopicInfo(devInfoObj,patient,"preventLost");
                        //轨迹动态
                        JSONArray locations = getX1Locations(deviceSn,day.replace("-",""));
                        devInfoObj.put("routes",locations);
                        break;
                    case "7"://报警器 紧急工单
                        break;
@ -942,13 +957,13 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                        if (StringUtils.isBlank(day)){
                            day = DateUtil.getStringDateShort();
                        }
                        List<Map<String,Object>> listTmp = gasConcentration(patient,day);
                        List<Map<String,Object>> listTmp = gasConcentration(patient,day,deviceSn);
                        devInfoObj.put("monitorInfo",listTmp);
                        devInfoObj.put("day",day);
                        securityMonitoringOrderService.preventGasLeakage(devInfoObj,patient,false);
                        break;
                    case "15"://烟感报警器 获取最新浓度
                        securityMonitoringOrderService.preventFire(devInfoObj,patient,false);
                        securityMonitoringOrderService.preventFire(devInfoObj,patient,deviceSn,false);
                        devInfoObj.put("day",DateUtil.getStringDateShort());
                        break;
                }
@ -975,13 +990,13 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            }else{
                switch (device.getCategoryCode()){
                    case "1"://血压设备
                        result = getHealthIndex(result,deviceSn,patient,page,pageSize);
                        result = getHealthIndex(result,1,deviceSn,patient,page,pageSize);
                        break;
                    case "2"://血糖设备
                        result = getHealthIndex(result,deviceSn,patient,page,pageSize);
                        result = getHealthIndex(result,2,deviceSn,patient,page,pageSize);
                        break;
                    default://安防设备
                        result  = getEmeWarn(result,deviceSn,patient,page,pageSize);
                        result  = getEmeWarn(result,deviceSn,null,page,pageSize);
                        break;
                }
            }
@ -991,29 +1006,105 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        return result;
    }
    public JSONObject getHealthIndex(JSONObject result,String deviceSn,String patient,Integer page,Integer pageSize){
        String sqlCount = "select count(id) from wlyy_patient_health_index where user ='"+patient+"' and device_sn='"+deviceSn+"' " +
                " and del=1 ";
        String sql = "select *,CAST(DATE_FORMAT(record_date,'%Y-%m-%d %H:%i:%S') as char) record_date from wlyy_patient_health_index where user ='"+patient+"' and device_sn='"+deviceSn+"' " +
                " and del=1 order by record_date desc limit "+page*pageSize+","+pageSize;
        long count = jdbcTemplate.queryForObject(sqlCount,long.class);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> tmp:list){
            Integer type =Integer.parseInt(tmp.get("type").toString());
            String value1 = tmp.get("value1")==null?null:tmp.get("value1").toString();
            String value2 = tmp.get("value2")==null?null:tmp.get("value2").toString();
            String value3 = tmp.get("value3")==null?null:tmp.get("value3").toString();
            String value4 = tmp.get("value4")==null?null:tmp.get("value4").toString();
            String value5 = tmp.get("value5")==null?null:tmp.get("value5").toString();
            String value6 = tmp.get("value6")==null?null:tmp.get("value6").toString();
            String value7 = tmp.get("value7")==null?null:tmp.get("value7").toString();
            com.alibaba.fastjson.JSONArray errorInfo = healthIndexUtil.verifyHealthIndex(type,value1,value2,value3,value4,value5,value6,value7);
            tmp.put("errorInfo",errorInfo);
    public JSONObject getHealthIndex(JSONObject result,Integer type,String deviceSn,String patient,Integer page,Integer pageSize){
        page = page>0?page-1:0;
        Long count =0l;
        PageRequest pageRequest = new PageRequest(page, pageSize);
        result.put("dataList",new ArrayList<>());
        if (type == 1) {
            List<Object> re = new ArrayList<>();
            String countSql =" select count(Distinct DATE_FORMAT(a.record_date,'%Y-%m-%d')) from wlyy_patient_health_index a where a.user = '"+patient+"' " +
                    " and a.type=1 and a.device_sn='"+deviceSn+"' and a.del = '1' ";
            count = jdbcTemplate.queryForObject(countSql,Long.class);
            String sql =" select DATE_FORMAT(a.record_date,'%Y-%m-%d') from wlyy_patient_health_index a where a.user = '"+patient+"' " +
                    " and a.type=1 and a.device_sn='"+deviceSn+"' and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d') order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit "+pageRequest.getOffset()+" ,"+pageRequest.getPageSize();
            List<String> dateList = jdbcTemplate.queryForList(sql,String.class);
            if (dateList != null && dateList.size() > 0) {
                for (String dateString : dateList) {
                    com.alibaba.fastjson.JSONObject obj = healthIndexService.getPatientXT_Json(patient, dateString);
                    if (obj != null) {
                        re.add(obj);
                    }
                }
            }
            result.put("dataList",re);
        }
        else if (type == 2){
            JSONArray re = new JSONArray();
            // 排序
            String countSql =" select count(distinct user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date ) from wlyy_patient_health_index a where a.user = '"+patient+"' " +
                    " and a.type=2 and a.device_sn='"+deviceSn+"' and a.del = '1'  ";
            count = jdbcTemplate.queryForObject(countSql,Long.class);
            String sql = "SELECT " +
                    "MIN(id) id" +
                    ", user" +
                    ",value1" +
                    ",value2" +
                    ",value3" +
                    ",value4" +
                    ",value5" +
                    ",value6" +
                    ",value7" +
                    ",device_sn" +
                    ",type" +
                    ",record_date" +
                    ",sort_date" +
                    ",czrq as createDate" +
                    ",min(czrq) czrq " +
                    " from wlyy_patient_health_index " +
                    " WHERE `user` = '" + patient + "' " +
                    " and type =" + type +" "+
                    " and device_sn='"+deviceSn+"' "+
                    " and del = '1' " +
                    " GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
                    " order by record_date desc ,sort_date desc limit " + pageRequest.getOffset() + " ," + pageRequest.getPageSize() + " ";
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
            for (Map<String, Object> map : list) {
                JSONObject json = new JSONObject();
                json.put("id", map.get("id"));
                json.put("healthindexid", map.get("id"));
                json.put("patient", map.get("user"));
                json.put("value1", map.get("value1"));
                json.put("value2", map.get("value2"));
                json.put("value3", map.get("value3"));
                json.put("value4", map.get("value4"));
                json.put("value5", map.get("value5"));
                json.put("value6", map.get("value6"));
                json.put("value7", map.get("value7"));
                json.put("deviceSn", map.get("device_sn") == null ? "" : map.get("device_sn"));
                json.put("type", map.get("type"));
                Date date = (Date) map.get("record_date");
                if (type == 2) {
                    json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD_HH_MM_SS));
                } else {
                    json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD));
                }
                json.put("sortDate", map.get("sort_date"));
                json.put("czrq", map.get("czrq"));
                //是否为补传数据(设备上传且测量时间和创建时间不匹配)
                Date recordDate = (Date)map.get("record_date");
                Date createDate = (Date) map.get("createDate");
                String recordTime = DateUtil.dateToStr(recordDate,DateUtil.YYYY_MM_DD);
                String createTime = DateUtil.dateToStr(createDate,DateUtil.YYYY_MM_DD);
                if (map.get("device_sn") == null){
                    json.put("isSupplement",0);
                }else {
                    if (recordTime.compareToIgnoreCase(createTime)==0){
                        json.put("isSupplement",0);
                    }else {
                        json.put("isSupplement",1);
                    }
                }
                re.put(json);
            }
            result.put("dataList",re);
        }
        result.put("total",count);
        result.put("page",page+1);
        result.put("pageSize",pageSize);
        result.put("dataList",list);
        return result;
    }
@ -1024,15 +1115,23 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                " and ord.patient='"+patient+"' " +
                "UNION All " +
                "select count(ord.id)  as total from base_security_monitoring_order ord  where ord.device_sn='"+deviceSn+"' " +
                " and ord.patient='"+patient+"' )A ";
        long count = jdbcTemplate.queryForObject(sqlCount,long.class);
                " {{patient}} )A ";
        String sql = "select '20' as OrderType,ord.id,ord.patient,ord.patient_name,ord.doctor,ord.status,ord.doctor_name," +
                "'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                "from base_emergency_assistance_order ord  where ord.device_sn='"+deviceSn+"' and ord.patient='"+patient+"' " +
                "UNION " +
                "select  '22' as 'OrderType',ord.id,ord.patient,ord.patient_name,ord.doctor,ord.status,ord.doctor_name," +
                "ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order ord " +
                " where ord.device_sn='"+deviceSn+"' and ord.patient='"+patient+"'  order by create_time desc limit "+page*pageSize+","+pageSize;
                " where ord.device_sn='"+deviceSn+"' {{patient}}  order by create_time desc limit "+page*pageSize+","+pageSize;
        if (StringUtils.isNotBlank(patient)){
            sqlCount = sqlCount.replace("{{patient}}","and ord.patient='"+patient+"' ");
            sql = sql.replace("{{patient}}","and ord.patient='"+patient+"' ");
        }else {
            sqlCount = sqlCount.replace("{{patient}}"," ");
            sql = sql.replace("{{patient}}"," ");
        }
        long count = jdbcTemplate.queryForObject(sqlCount,long.class);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        result.put("total",count);
        result.put("page",page+1);
@ -1202,7 +1301,9 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @param time_begin YYYYMMDD 日期
     * @return
     */
    public com.alibaba.fastjson.JSONObject getX1Locations(String deviceSn,String time_begin){
    public JSONArray getX1Locations(String deviceSn,String time_begin){
        JSONArray result = new JSONArray();
        String url = AqgConfig.X1_locations+"?device="+deviceSn+"&depth="+1+"&rows_per_page="+300;
        if (StringUtils.isNotBlank(time_begin)){
@ -1212,8 +1313,23 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        headers.put("Accept", MediaType.APPLICATION_JSON.toString());
        headers.put("Cookie", getCookie());
        String  responseStr = httpClientUtil.get(url,"utf-8",headers);
        com.alibaba.fastjson.JSONObject result = JSON.parseObject(responseStr);
        com.alibaba.fastjson.JSONObject resObj = JSON.parseObject(responseStr);
        if (resObj.getBooleanValue("success")){
            com.alibaba.fastjson.JSONArray arr = resObj.getJSONArray("objs");
            arr.sort(Comparator.comparing(obj -> ((com.alibaba.fastjson.JSONObject) obj).getJSONObject("created_at").getLong("$date")));
            for (int i=0;i<arr.size();i++){
                try {
                    com.alibaba.fastjson.JSONObject obj = arr.getJSONObject(i);
                    com.alibaba.fastjson.JSONArray pointArr = obj.getJSONObject("point").getJSONArray("coordinates");
                    Double lon = pointArr.getDouble(0);
                    Double lat = pointArr.getDouble(1);
                    com.alibaba.fastjson.JSONObject pointJson = gpsUtil.gcj02_To_Bd09(lat,lon);
                    result.put(pointJson);
                }catch (Exception e){
                }
            }
        }
        return result;
    }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java

@ -245,7 +245,7 @@ public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealt
     *
     * @return
     */
    private com.alibaba.fastjson.JSONObject getPatientXT_Json(String patient, String dateString) {
    public com.alibaba.fastjson.JSONObject getPatientXT_Json(String patient, String dateString) {
        com.alibaba.fastjson.JSONObject obj = new com.alibaba.fastjson.JSONObject();
        obj.put("user", patient);
        boolean hadData = false;

+ 10 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -1413,9 +1413,16 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
    }
    public void preventFire(JSONObject result,String patient,boolean video){
    public void preventFire(JSONObject result,String patient,String deviceSn,boolean video){
        String sql = "SELECT r.value from wlyy_patient_device pd,base_device_health_index r " +
                "WHERE pd.device_sn = r.device_sn and pd.`user` = '"+patient+"' ";
                "WHERE pd.device_sn = r.device_sn  ";
        if (StringUtils.isNotBlank(patient)){
            sql+=" and pd.`user` = '"+patient+"' ";
        }
        if (StringUtils.isNotBlank(deviceSn)){
            sql+=" and  r.device_sn = '"+deviceSn+"' ";
        }
        sql += " and pd.category_code='15' ORDER BY r.create_time desc LIMIT 1";
        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql);
@ -1492,7 +1499,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            preventOutOfBed(result, patient,true,null);
        }
        if ("preventFire".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventFire(result, patient,true);
            preventFire(result, patient,null,true);
        }
        if ("preventGasLeakage".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventGasLeakage(result, patient,true);