|
@ -56,8 +56,6 @@ public class MonitorPlatformService {
|
|
private String wxId;
|
|
private String wxId;
|
|
@Value("${wechat.flag}")
|
|
@Value("${wechat.flag}")
|
|
private boolean flag;
|
|
private boolean flag;
|
|
@Value("${hlw.baseUrl}")
|
|
|
|
private String baseUrl;
|
|
|
|
public static Map<String, String> tokenMap = new HashMap<>();
|
|
public static Map<String, String> tokenMap = new HashMap<>();
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@ -1350,35 +1348,50 @@ public class MonitorPlatformService {
|
|
) {
|
|
) {
|
|
String sql = "select COUNT(*) from xmiot.iot_equipmet_detail";
|
|
String sql = "select COUNT(*) from xmiot.iot_equipmet_detail";
|
|
|
|
|
|
/*取到智慧药柜*/
|
|
|
|
|
|
/*取到智慧药房*/
|
|
Map<String, Object> medicinecabinetCount = getMedicinecabinetCount();
|
|
Map<String, Object> medicinecabinetCount = getMedicinecabinetCount();
|
|
//智慧药柜
|
|
|
|
|
|
//智慧药房
|
|
int ygtotal = Integer.parseInt(medicinecabinetCount.get("total").toString());
|
|
int ygtotal = Integer.parseInt(medicinecabinetCount.get("total").toString());
|
|
int ygusing = Integer.parseInt(medicinecabinetCount.get("using").toString());
|
|
int ygusing = Integer.parseInt(medicinecabinetCount.get("using").toString());
|
|
int ygstock = Integer.parseInt(medicinecabinetCount.get("stock").toString());
|
|
int ygstock = Integer.parseInt(medicinecabinetCount.get("stock").toString());
|
|
|
|
|
|
Integer count = jdbcTemplate.queryForObject(sql, Integer.class);
|
|
Integer count = jdbcTemplate.queryForObject(sql, Integer.class);
|
|
JSONObject tmp = new JSONObject();
|
|
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)) {
|
|
if ("0".equals(showLevel)) {
|
|
tmp.put("device_name", "组合一体机");
|
|
tmp.put("device_name", "组合一体机");
|
|
tmp.put("Subdivision", true);
|
|
tmp.put("Subdivision", true);
|
|
|
|
tmp.put("using", count + ygusing);
|
|
|
|
tmp.put("total", count + ygtotal);
|
|
|
|
tmp.put("type", "5");
|
|
|
|
tmp.put("stock", 0 + ygstock);
|
|
|
|
result.getJSONArray("deviceInfo").add(tmp);
|
|
|
|
tmp.put("showLevel", Integer.parseInt(showLevel));
|
|
} else {
|
|
} 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 ");
|
|
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)) {
|
|
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");
|
|
sql.append(")A");
|
|
List<String> list = jdbcTemplate.queryForList(sql.toString(), String.class);
|
|
List<String> list = jdbcTemplate.queryForList(sql.toString(), String.class);
|
|
List<String> reList = new ArrayList<>();
|
|
List<String> reList = new ArrayList<>();
|
|
@ -1851,7 +1868,7 @@ public class MonitorPlatformService {
|
|
resultMap.put("total", total);
|
|
resultMap.put("total", total);
|
|
resultMap.put("stock", notUsedTotal);
|
|
resultMap.put("stock", notUsedTotal);
|
|
resultMap.put("using", usedTotal);
|
|
resultMap.put("using", usedTotal);
|
|
resultMap.put("device_name", "智慧药柜");
|
|
|
|
|
|
resultMap.put("device_name", "智慧药房");
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
|
|
@ -1982,7 +1999,9 @@ public class MonitorPlatformService {
|
|
List<Map<String, String>> list = new ArrayList<>();
|
|
List<Map<String, String>> list = new ArrayList<>();
|
|
try {
|
|
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);
|
|
JSONObject resultObject = JSONObject.parseObject(urlResult);
|
|
if (resultObject.get("status").equals("200")) {
|
|
if (resultObject.get("status").equals("200")) {
|
|
JSONObject jsonObjectData = JSONObject.parseObject(AesEncryptUtils.agDecrypt(resultObject.get("data").toString()));
|
|
JSONObject jsonObjectData = JSONObject.parseObject(AesEncryptUtils.agDecrypt(resultObject.get("data").toString()));
|