Browse Source

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

叶仕杰 3 năm trước cách đây
mục cha
commit
d20126c2cb

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

@ -863,7 +863,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @ApiOperation("获取设备品牌列表")
    public Envelop getBrandsDetail(
            @ApiParam(name = "deviceType", value = "设备类型", required = true)
            @RequestParam(value = "deviceType", required = true, defaultValue = "1,2,5") String deviceType) {
            @RequestParam(value = "deviceType", required = true, defaultValue = "1,2,5,22") String deviceType) {
        return success(monitorPlatformService.getBrandsDetail(deviceType));
    }

+ 69 - 33
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -56,8 +56,6 @@ public class MonitorPlatformService {
    private String wxId;
    @Value("${wechat.flag}")
    private boolean flag;
    @Value("${hlw.baseUrl}")
    private String baseUrl;
    public static Map<String, String> tokenMap = new HashMap<>();
    @Autowired
@ -1350,35 +1348,50 @@ public class MonitorPlatformService {
            ) {
                String sql = "select COUNT(*) from xmiot.iot_equipmet_detail";
                /*取到智慧药柜*/
                /*取到智慧药房*/
                Map<String, Object> medicinecabinetCount = getMedicinecabinetCount();
                //智慧药柜
                //智慧药房
                int ygtotal = Integer.parseInt(medicinecabinetCount.get("total").toString());
                int ygusing = Integer.parseInt(medicinecabinetCount.get("using").toString());
                int ygstock = Integer.parseInt(medicinecabinetCount.get("stock").toString());
                Integer count = jdbcTemplate.queryForObject(sql, Integer.class);
                JSONObject tmp = new JSONObject();
                tmp.put("using", count + ygusing);
                tmp.put("total", count + ygtotal);
                tmp.put("type", "5");
                tmp.put("stock", 0 + ygstock);
                if ("0".equals(showLevel)) {
                    tmp.put("device_name", "组合一体机");
                    tmp.put("Subdivision", true);
                    tmp.put("using", count + ygusing);
                    tmp.put("total", count + ygtotal);
                    tmp.put("type", "5,22");
                    tmp.put("stock", 0 + ygstock);
                    result.getJSONArray("deviceInfo").add(tmp);
                    tmp.put("showLevel", Integer.parseInt(showLevel));
                } else {
                    tmp.put("device_name", "健康小屋");
                    tmp.put("Subdivision", false);
                    //智慧药柜
                    medicinecabinetCount.put("Subdivision", false);
                    medicinecabinetCount.put("showLevel", 1);
                    result.getJSONArray("deviceInfo").add(medicinecabinetCount);
                    result.put("grantCount", result.getInteger("grantCount") + count);
                    /*string用,分割*/
                    String[] arrays = deviceType.split(",");
                    for (String string : arrays) {
                        if ("5".equals(string)) {
                            /*健康小屋*/
                            tmp.put("device_name", "健康小屋");
                            tmp.put("Subdivision", false);
                            tmp.put("total", count);
                            tmp.put("using", count);
                            tmp.put("stock", 0);
                            tmp.put("type", 5);
                            tmp.put("showLevel", Integer.parseInt(showLevel));
                            result.getJSONArray("deviceInfo").add(tmp);
                        }
                        if ("22".equals(string)) {
                            //智慧药房
                            medicinecabinetCount.put("Subdivision", false);
                            medicinecabinetCount.put("showLevel", Integer.parseInt(showLevel));
                            medicinecabinetCount.put("type", 22);
                            result.getJSONArray("deviceInfo").add(medicinecabinetCount);
                            result.put("grantCount", result.getInteger("grantCount") + count);
                        }
                    }
                }
                tmp.put("showLevel", Integer.parseInt(showLevel));
                result.getJSONArray("deviceInfo").add(tmp);
                //统计健康小屋数据/ 小屋全部统计为正常使用
@ -1547,8 +1560,12 @@ public class MonitorPlatformService {
            }
            sql.append("GROUP BY wd.manufacturer_code,pd.device_name ");
            if ((org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("5")) || org.apache.commons.lang3.StringUtils.isBlank(deviceType)) {
                sql.append("UNION select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name");
                sql.append(" UNION select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name");
            }
            if ((org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("22")) || org.apache.commons.lang3.StringUtils.isBlank(deviceType)) {
                sql.append(" UNION select case device_name when '自助体检一体机' then '智慧药房'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name");
            }
            sql.append(")A");
            List<String> list = jdbcTemplate.queryForList(sql.toString(), String.class);
            List<String> reList = new ArrayList<>();
@ -1647,25 +1664,33 @@ public class MonitorPlatformService {
                sql.append("and belong_are_code='" + area + "' ");
            }
            Integer tmp = jdbcTemplate.queryForObject(sql.toString(), Integer.class);
            totalAll += tmp;
            grant += tmp;
        }
        if (deviceType.contains("22")) {
            Map<String, Object> medicinecabinetCount = getMedicinecabinetCount();
            Integer total = Integer.parseInt(medicinecabinetCount.get("total").toString());
            Integer using = Integer.parseInt(medicinecabinetCount.get("using").toString());
            deviceType = deviceType.replaceAll("22", " ");
            totalAll += total;
            grant += using;
        }
        String allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where 1=1 ";
        int i = 0;
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("1")) {
            allCountSql += "   ";
            allCountSql += " ";
            i = 1;
        }
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType) && deviceType.contains("2")) {
            if (i == 1) {
                allCountSql += " or device_name like '%血压计%'";
            } else {
                allCountSql += " and ( device_name like '%血压计%' ";
                allCountSql += " and ( device_name like '%血压计%' )";
            }
        }
        allCountSql += " ) ";
       // allCountSql += "  ";
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(area)) {
            allCountSql += " and grant_org_code in (SELECT dh.code from wlyy.dm_hospital dh where dh.town ='" + area + "' and dh.del =1 )";
        }
@ -1799,7 +1824,7 @@ public class MonitorPlatformService {
        return heartDo;
    }
    /*获取药柜所有设备信息  地址  编号  名字*/
    /*获取智慧药房所有设备信息  地址  编号  名字*/
    public List<Map<String, String>> getMedicinecabinet() {
        JSONArray resultArr = new JSONArray();
        List<Map<String, String>> list = new ArrayList<>();
@ -1836,7 +1861,7 @@ public class MonitorPlatformService {
        }
    }
    /*药柜总数*/
    /*智慧药房总数*/
    public Map<String, Object> getMedicinecabinetCount() {
        Map resultMap = new HashMap<>();
@ -1851,11 +1876,11 @@ public class MonitorPlatformService {
        resultMap.put("total", total);
        resultMap.put("stock", notUsedTotal);
        resultMap.put("using", usedTotal);
        resultMap.put("device_name", "智慧药柜");
        resultMap.put("device_name", "智慧药房");
        return resultMap;
    }
    /*获取药柜详细信息*/
    /*获取智慧药房详细信息*/
    public Map<String, List<Map>> getadddd(String deviceId, String day) throws Exception {
        //返回参数
        Map<String, List<Map>> resoultMap = new HashMap<>();
@ -1915,7 +1940,7 @@ public class MonitorPlatformService {
        return resoultMap;
    }
    /*获取药柜曲线图信息*/
    /*获取智慧药房曲线图信息*/
    public Map<String, List<Map>> getCabinetCurve(String deviceId, String day) throws Exception {
        if ("".equals(day) || day == null) {
            day = "365";
@ -1947,7 +1972,7 @@ public class MonitorPlatformService {
        return resoultMap;
    }
    /*药柜地标*/
    /*智慧药房地标*/
    public List<Map<String, Object>> getLongitudeAndLatitude() {
        JSONArray resultArr = new JSONArray();
        List<Map<String, Object>> list = new ArrayList<>();
@ -1975,14 +2000,25 @@ public class MonitorPlatformService {
        }
    }
    /*智慧药房库存检测
     * 药房有6层,每层40个货道
     * 商品状态:未设商品、已有商品
     * 货道状态:货道故障、货道关闭、货道正常
     * */
    public void ygStockDetection(){
    }
    /*请求接口*/
    public JSONObject getUrl(String url, String parame) {
        JSONObject resultObj = new JSONObject();
        List<Map<String, String>> list = new ArrayList<>();
        try {
            //药柜请求地址
            String urlResult = httpClientUtil.getBodyRawForm(baseUrl + url, parame);
            //智慧药房请求地址
            String ygurl = "SELECT isd.dict_name,isd.`code` from iot_system_dict isd WHERE dict_name = 'HLW_YGBASEURL'";
            Map<String, Object> baseUrll = jdbcTemplate.queryForMap(ygurl);
            String urlResult = httpClientUtil.getBodyRawForm(baseUrll.get("code") + url, parame);
            JSONObject resultObject = JSONObject.parseObject(urlResult);
            if (resultObject.get("status").equals("200")) {
                JSONObject jsonObjectData = JSONObject.parseObject(AesEncryptUtils.agDecrypt(resultObject.get("data").toString()));

+ 17 - 10
svr/svr-iot/src/main/resources/application.yml

@ -81,6 +81,8 @@ spring:
    url: http://www.xmtyw.cn/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee61
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee57
#hlw:
#  baseUrl: https://zb.xmtyw.cn/medicine/cityihealth/base
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
@ -118,6 +120,8 @@ spring:
    url: http://www.xmtyw.cn/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee61
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee57
#hlw:
#  baseUrl: https://zb.xmtyw.cn/medicine/cityihealth/base
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
@ -155,6 +159,8 @@ spring:
    url: http://ehr.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee62
#hlw:
#  baseUrl: https://zb.xmtyw.cn/medicine/cityihealth/base
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
@ -192,8 +198,9 @@ spring:
    url: http://ehr.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee62
hlw:
  baseUrl: http://ehr.yihu.com/hlwyy/cityihealth/base
#hlw:
#  baseUrl: https://zb.xmtyw.cn/medicine/cityihealth/base    正式
#  #http://ehr.yihu.com/hlwyy/cityihealth/base     测试
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
@ -231,8 +238,8 @@ spring:
    url: http://ehr.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee62
hlw:
  baseUrl: http://ehr.yihu.com/hlwyy/cityihealth/base
#hlw:
#  baseUrl: https://zb.xmtyw.cn/medicine/cityihealth/base
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
fastDFS:
@ -257,8 +264,8 @@ spring:
    url: http://www.xmtyw.cn/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee61
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee57
hlw:
  baseUrl: http://ehr.yihu.com/hlwyy/cityihealth/base
#hlw:
#  baseUrl: http://ehr.yihu.com/hlwyy/cityihealth/base
fast-dfs:
  tracker-server: 10.95.22.139:22122 #服务器地址
fastDFS:
@ -282,8 +289,8 @@ spring:
    url: http://www.xmtyw.cn/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee61
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee57
hlw:
  baseUrl: http://ehr.yihu.com/hlwyy/cityihealth/base
#hlw:
#  baseUrl: https://zb.xmtyw.cn/medicine/cityihealth/base
fast-dfs:
  tracker-server: 10.95.22.139:22122 #服务器地址
fastDFS:
@ -307,8 +314,8 @@ spring:
    url: http://www.xmtyw.cn/wlyytest/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee62
hlw:
  baseUrl: http://ehr.yihu.com/hlwyy/cityihealth/base
#hlw:
#  baseUrl: https://zb.xmtyw.cn/medicine/cityihealth/base
es:
  pwflag: 1 # 1需要密码,2不需要密码
  host:  http://10.90.32.3:20011

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name:  svr-iot
    name:  svr-iot-wsl
  cloud:
    config:
      failFast: true