Shi Kejing 4 years ago
parent
commit
5265cea427

+ 61 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -506,6 +506,15 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        return list;
    }
@ -549,9 +558,27 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " +(page-1)* pageSize + "," +pageSize;
            List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            list.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Device.message_success_find, list,page, pageSize,count);
        }
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
    }
@ -599,9 +626,23 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            for (int i=0;i<deviceVOList.size();i++){
                deviceVOList.get(i).setPatientName(AesEncryptUtils.decrypt(deviceVOList.get(i).getPatientName()));
                deviceVOList.get(i).setIdcard(AesEncryptUtils.decrypt(deviceVOList.get(i).getIdcard()));
                deviceVOList.get(i).setMobile(AesEncryptUtils.decrypt(deviceVOList.get(i).getMobile()));
                deviceVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getCreateUserName()));
                deviceVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            for (int i=0;i<deviceVOList.size();i++){
                deviceVOList.get(i).setPatientName(AesEncryptUtils.decrypt(deviceVOList.get(i).getPatientName()));
                deviceVOList.get(i).setIdcard(AesEncryptUtils.decrypt(deviceVOList.get(i).getIdcard()));
                deviceVOList.get(i).setMobile(AesEncryptUtils.decrypt(deviceVOList.get(i).getMobile()));
                deviceVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getCreateUserName()));
                deviceVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
    }
@ -616,7 +657,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            sql += "and d.device_sn like '%" + deviceSn + "%' ";
        }
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patient_name like '%" + patientName + "%' ";
//            sql += "and d.patient_name like '%" + patientName + "%' ";
            sql += "and AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a') like '%" + patientName + "%' ";
        }
        if(StringUtils.isNotBlank(deviceName)){
            sql += "and d.device_name like '%" + deviceName + "%' ";
@ -638,9 +680,27 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
    }