Ver código fonte

测试查询接口

wangjun 4 anos atrás
pai
commit
84ba7c2233

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -31,6 +31,7 @@ public class IotRequestMapping {
        public static final String sim = api_iot_common + "/sim";
        public static final String openThird = api_iot_common + "/open/gc"; //第三方调用 需要accesstoken
        public static final String getHospital = "/getHospital";
        public static final String getNameAndCode = "/open/getNameAndCode";
        public static final String getEquipmentAndCount = "getEquipmentAndCount";

+ 10 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -662,4 +662,14 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
        return success( iotEqtDetailService.getHosptital(name, code, town,city));
    }
    @GetMapping(value = IotRequestMapping.Common.getNameAndCode)
    @ApiOperation(value = "查询idcard")
    public Envelop getByIdCard(
            @ApiParam(name = "idCard", value = "idCard", required = false)
            @RequestParam(value = "idCard", required = false)String idCard,
            @ApiParam(name = "snCode", value = "snCode", required = false)
            @RequestParam(value = "snCode", required = false)String snCode) throws Exception{
        return success( iotPatientDeviceService.getNameAndCode(idCard,snCode));
    }
}

+ 28 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -259,6 +259,32 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        JestResult esResult = elasticSearchHelper.search(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,queryStr.toString());
        return getESResultBeanList(esResult);
    }
    public JSONObject getNameAndCode(String idCard,String snCode){
        JSONObject jsonObject = new JSONObject();
        String sql = "select t.code as \"code\",t.name as \"name\" from wlyy.wlyy_patient t where 1=1 ";
        String sqlEqt="select t.device_name as\"device_name\" from device.wlyy_devices t where 1=1";
        if (StringUtils.isNotEmpty(idCard)){
            sql = sql +" and t.idcard = '"+idCard+"'";
        }if (StringUtils.isNotEmpty(snCode)){
            sqlEqt = sqlEqt +" and t.device_code = '"+snCode+"'";
        }
        System.out.println("查询患者name和code开始");
        List<Map<String,Object>> nameList = jdbcTempalte.queryForList(sql);
        System.out.println("查询患者name和code结束:"+nameList);
        System.out.println("查询设备名称开始");
        List<Map<String,Object>> deviceList = jdbcTempalte.queryForList(sqlEqt);
        System.out.println("查询设备名称结束:"+deviceList);
        if(nameList.size()>0){
            String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
            String name = null==nameList.get(0).get("name")?"":nameList.get(0).get("name").toString();
           jsonObject.put("nameList",nameList);
        }
        if (deviceList.size()>0){
            String equipmentName = null==deviceList.get(0).get("device_name")?"":deviceList.get(0).get("device_name").toString();
            jsonObject.put("deviceList",deviceList);
        }
        return jsonObject;
    }
    public List<LocationDataVO> addNameAndCodeToList(List<LocationDataVO> list){
        if(null!=list){
            for (LocationDataVO locationDataVO:list){
@ -271,6 +297,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                }if (StringUtils.isNotEmpty(snCoed)){
                    sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'";
                }
                System.out.println("idCard:="+idCard);
                System.out.println("snCode:="+snCoed);
                System.out.println("查询患者name和code开始");
                List<Map<String,Object>> nameList = jdbcTempalte.queryForList(sql);
                System.out.println("查询患者name和code结束:"+nameList);

+ 10 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/equipment/IotEqtDetailService.java

@ -141,7 +141,16 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
    public List<Map<String,Object>> getHosptital(String name,String code,String town,String city){
        StringBuffer sql = new StringBuffer();
        Map<String,Object> params = new HashedMap();
        sql.append("select * from wlyy.dm_hospital t where 1=1");
        sql.append("select t.id as \"id\",t.code as \"code\",t.province as \"province\" ," +
                "t.city as \"city\",t.town as \"town\",t.name as \"name\"," +
                "t.level as \"level\",t.address as \"address\",t.position as \"position\"," +
                "t.intro as \"intro\",t.del as \"del\",t.province_name as \"province_name\"," +
                "t.city_name as \"city_name\",t.town_name as \"town_name\",t.photo as \"photo\"," +
                "t.road_code as \"road_code\",t.center_site as \"center_site\",t.phone as \"phone\"," +
                "t.grade as \"grade\",t.departments as \"departments\",t.hos_level as \"hos_level\"," +
                "t.start_working_time_am as \"start_working_time_am\",t.stop_working_time_am as \"stop_working_time_am\"," +
                "t.start_working_time_pm as \"start_working_time_pm\",t.stop_working_time_pm as \"stop_working_time_pm\",t.description as \"description\"," +
                "t.zb_type as \"zb_type\" from wlyy.dm_hospital t where 1=1");
       if (StringUtils.isNotEmpty(name)){
           sql.append(" and t.name like '%"+name+"%'");
       }if (StringUtils.isNotEmpty(code)){