Browse Source

眼科医院处方物流

ysj 5 years ago
parent
commit
9f5492606f

+ 15 - 8
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -1,5 +1,6 @@
package com.yihu.iot.controller.monitorPlatform;
package com.yihu.iot.controller.monitorPlatform;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.iot.service.monitorPlatform.MonitorPlatformService;
import com.yihu.iot.service.monitorPlatform.MonitorPlatformService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -52,12 +53,18 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/smartDeviceDistribution",method = RequestMethod.GET)
    @RequestMapping(value = "/smartDeviceDistribution",method = RequestMethod.GET)
    @ApiOperation("智能设备发放")
    @ApiOperation("智能设备发放")
    public MixEnvelop smartDeviceDistribution(@ApiParam(name="type",value="设备类型")
                                              @RequestParam(value="type",required = false) String type,
                                              @ApiParam(name="name",value="产品名称")
                                              @RequestParam(value="name",required = false) String name){
    public MixEnvelop smartDeviceDistribution(@ApiParam(name="startTime",value="开始时间",defaultValue = "")
                                                  @RequestParam(value="startTime",required = false) String startTime,
                                              @ApiParam(name="endTime",value="结束时间",defaultValue = "")
                                                  @RequestParam(value="endTime",required = false) String endTime,
                                              @ApiParam(name="deviceType",value="设备类型",defaultValue = "")
                                                  @RequestParam(value="deviceType",required = false) String deviceType,
                                              @ApiParam(name="area",value="地区",defaultValue = "")
                                                  @RequestParam(value="area",required = false) String area,
                                              @ApiParam(name="hospital",value="机构",defaultValue = "")
                                                  @RequestParam(value="hospital",required = false) String hospital){
        try {
        try {
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.smartDeviceDistribution(type,name));
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.smartDeviceDistribution(startTime,endTime,deviceType,area,hospital));
        }catch (Exception e){
        }catch (Exception e){
            e.printStackTrace();
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
            return MixEnvelop.getError("查询失败");
@ -159,8 +166,8 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            if(pageSize==null){
            if(pageSize==null){
                pageSize = 10;
                pageSize = 10;
            }
            }
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.deviceUseData(page,pageSize,deviceSn));
            JSONObject jsonObject = monitorPlatformService.deviceUseData(page,pageSize,deviceSn);
            return MixEnvelop.getSuccess("查询成功",jsonObject.getJSONArray("list"),jsonObject.getInteger("total"));
        }catch (Exception e){
        }catch (Exception e){
            e.printStackTrace();
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
            return MixEnvelop.getError("查询失败");
@ -197,7 +204,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            if(pageSize==null){
            if(pageSize==null){
                pageSize = 10;
                pageSize = 10;
            }
            }
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.deviceOverhaulList(page,pageSize,deviceSn));
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.deviceOverhaulList(page,pageSize,deviceSn),monitorPlatformService.deviceOverhaulListTotal(deviceSn));
        }catch (Exception e){
        }catch (Exception e){
            e.printStackTrace();
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
            return MixEnvelop.getError("查询失败");

+ 20 - 6
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -281,6 +281,16 @@ public class MonitorPlatformService  {
        return myJdbcTemplate.queryJson(sql.toString(),new Object[]{(page-1)*pageSize,pageSize});
        return myJdbcTemplate.queryJson(sql.toString(),new Object[]{(page-1)*pageSize,pageSize});
    }
    }
    public Integer deviceOverhaulListTotal(String deviceSn){
        String sql = "SELECT count(o.id) c from iot_patient_device d,iot_device_overhaul o" +
                " WHERE d.device_sn = '"+deviceSn+"' and d.id = o.patient_device_id ";
        List<JSONObject> list = myJdbcTemplate.queryJson(sql.toString(),new Object[]{});
        if(list.size()>0){
            return list.get(0).getInteger("c");
        }
        return 0;
    }
    /**
    /**
     * 入住情况
     * 入住情况
     * @return
     * @return
@ -404,11 +414,15 @@ public class MonitorPlatformService  {
    /**
    /**
     * 智能设备发放
     * 智能设备发放
     */
     */
    public JSONArray smartDeviceDistribution(String type,String name){
    public JSONArray smartDeviceDistribution(String startTime,String endTime,
                                             String deviceType,String area,String hospital){
        String url = "/wlyygc/iot_monitoring/smartDeviceDistribution";
        String url = "/wlyygc/iot_monitoring/smartDeviceDistribution";
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> params = new HashMap<>();
        params.put("type",type);
        params.put("name",name);
        params.put("startTime",startTime);
        params.put("endTime",endTime);
        params.put("deviceType",deviceType);
        params.put("area",area);
        params.put("hospital",hospital);
        String response = sendGet(url,params);
        String response = sendGet(url,params);
        JSONObject json = JSONObject.parseObject(response);
        JSONObject json = JSONObject.parseObject(response);
        if(json.getInteger("status")==200){
        if(json.getInteger("status")==200){
@ -440,7 +454,7 @@ public class MonitorPlatformService  {
     * @param deviceSn
     * @param deviceSn
     * @return
     * @return
     */
     */
    public JSONArray deviceUseData(Integer page,Integer pageSize,String deviceSn){
    public JSONObject deviceUseData(Integer page,Integer pageSize,String deviceSn){
        String url = "/wlyygc/iot_monitoring/deviceUseData";
        String url = "/wlyygc/iot_monitoring/deviceUseData";
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> params = new HashMap<>();
        params.put("page",page);
        params.put("page",page);
@ -449,10 +463,10 @@ public class MonitorPlatformService  {
        String response = sendGet(url,params);
        String response = sendGet(url,params);
        JSONObject json = JSONObject.parseObject(response);
        JSONObject json = JSONObject.parseObject(response);
        if(json.getInteger("status")==200){
        if(json.getInteger("status")==200){
            return json.getJSONArray("data");
            return json.getJSONObject("data");
        }
        }
        return new JSONArray();
        return new JSONObject();
    }
    }
    /**
    /**