|
@ -1341,30 +1341,52 @@ public class MonitorPlatformService {
|
|
|
Integer lostContact = jdbcTemplate.queryForObject(sql.toString(), Integer.class);
|
|
|
result.put("lostContact", lostContact);
|
|
|
}
|
|
|
|
|
|
//deviceType包含小屋且设备名称为空||deviceType包含小屋且设备名称为健康小屋。
|
|
|
if ((deviceType.contains("5") && org.apache.commons.lang3.StringUtils.isBlank(deviceName)) || (deviceType.contains("5") && org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) && deviceName.contains("健康小屋"))) {
|
|
|
if ((deviceType.contains("5") && org.apache.commons.lang3.StringUtils.isBlank(deviceName))
|
|
|
|| (deviceType.contains("5") && org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) && deviceName.contains("健康小屋"))
|
|
|
|| (deviceType.contains("22") && org.apache.commons.lang3.StringUtils.isBlank(deviceName))
|
|
|
|| (deviceType.contains("22") && org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName) && deviceName.contains("智慧药房"))
|
|
|
) {
|
|
|
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);
|
|
|
tmp.put("total", count);
|
|
|
tmp.put("using", count + ygusing);
|
|
|
tmp.put("total", count + ygtotal);
|
|
|
tmp.put("type", "5");
|
|
|
tmp.put("stock", 0);
|
|
|
tmp.put("stock", 0 + ygstock);
|
|
|
if ("0".equals(showLevel)) {
|
|
|
tmp.put("device_name", "组合一体机");
|
|
|
tmp.put("Subdivision", true);
|
|
|
} 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);
|
|
|
}
|
|
|
tmp.put("showLevel", Integer.parseInt(showLevel));
|
|
|
result.getJSONArray("deviceInfo").add(tmp);
|
|
|
result.put("grantCount", result.getInteger("grantCount") + count);
|
|
|
|
|
|
|
|
|
//统计健康小屋数据/ 小屋全部统计为正常使用
|
|
|
sql = "select count(*) from xmiot.iot_equipmet_detail where device_code in (select DISTINCT sn device_model from xmiot.wlyy_iot_m)";
|
|
|
count = jdbcTemplate.queryForObject(sql, Integer.class);
|
|
|
result.put("iotCount", result.getInteger("iotCount") + count);//小屋物联
|
|
|
}
|
|
|
|
|
|
arrTmp = result.getJSONArray("deviceInfo");
|
|
|
for (int i = 0; i < arrTmp.size(); i++) {
|
|
|
JSONObject tmp = arrTmp.getJSONObject(i);
|
|
@ -1625,6 +1647,8 @@ public class MonitorPlatformService {
|
|
|
sql.append("and belong_are_code='" + area + "' ");
|
|
|
}
|
|
|
Integer tmp = jdbcTemplate.queryForObject(sql.toString(), Integer.class);
|
|
|
|
|
|
|
|
|
totalAll += tmp;
|
|
|
grant += tmp;
|
|
|
}
|
|
@ -1776,7 +1800,7 @@ public class MonitorPlatformService {
|
|
|
}
|
|
|
|
|
|
/*获取药柜所有设备信息 地址 编号 名字*/
|
|
|
public List<Map<String,String>> getMedicinecabinet() {
|
|
|
public List<Map<String, String>> getMedicinecabinet() {
|
|
|
JSONArray resultArr = new JSONArray();
|
|
|
List<Map<String, String>> list = new ArrayList<>();
|
|
|
try {
|
|
@ -1790,13 +1814,19 @@ public class MonitorPlatformService {
|
|
|
resultMap.put("equName", equName);
|
|
|
/*获取设备地址*/
|
|
|
String deliveryAddress = jsonObject.getString("deliveryAddress");
|
|
|
resultMap.put("deliveryAddress;", deliveryAddress);
|
|
|
resultMap.put("deliveryAddress", deliveryAddress);
|
|
|
/*获取设备编号*/
|
|
|
String equNum = jsonObject.getString("equNum");
|
|
|
resultMap.put("equNum", equNum);
|
|
|
/*获取设备编号*/
|
|
|
String id = jsonObject.getString("id");
|
|
|
resultMap.put("id", id);
|
|
|
/*投放经度*/
|
|
|
String lng = jsonObject.getString("lng");
|
|
|
resultMap.put("lng", lng);
|
|
|
/*投放纬度*/
|
|
|
String lat = jsonObject.getString("lat");
|
|
|
resultMap.put("lat", lat);
|
|
|
list.add(resultMap);
|
|
|
}
|
|
|
return list;
|
|
@ -1806,8 +1836,8 @@ public class MonitorPlatformService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*总数*/
|
|
|
public Map<String, String> getMedicinecabinetCount() {
|
|
|
/*药柜总数*/
|
|
|
public Map<String, Object> getMedicinecabinetCount() {
|
|
|
|
|
|
Map resultMap = new HashMap<>();
|
|
|
JSONObject jsonObject = getUrl("/open/noLogin/getDeviceList", null);
|
|
@ -1819,44 +1849,25 @@ public class MonitorPlatformService {
|
|
|
String usedTotal = jsonObject.get("usedTotal").toString();
|
|
|
|
|
|
resultMap.put("total", total);
|
|
|
resultMap.put("notUsedTotal", notUsedTotal);
|
|
|
resultMap.put("usedTotal", usedTotal);
|
|
|
resultMap.put("stock", notUsedTotal);
|
|
|
resultMap.put("using", usedTotal);
|
|
|
resultMap.put("device_name", "智慧药柜");
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
/*获取药柜详细信息*/
|
|
|
public Map<String, List<Map>> getadddd(String deviceid, String day) throws Exception {
|
|
|
public Map<String, List<Map>> getadddd(String deviceId, String day) throws Exception {
|
|
|
//返回参数
|
|
|
Map<String, List<Map>> resoultMap = new HashMap<>();
|
|
|
|
|
|
//参数加密
|
|
|
Map parameterMap = new HashMap<String, String>();
|
|
|
parameterMap.put("deviceId", deviceid);
|
|
|
parameterMap.put("deviceId", deviceId);
|
|
|
parameterMap.put("day", day);
|
|
|
String content = com.alibaba.fastjson.JSONObject.toJSONString(parameterMap);
|
|
|
String params = AesEncryptUtils.agEncrypt(content);
|
|
|
JSONObject jsonObject = getUrl("/open/noLogin/getDeviceInfo", params);
|
|
|
|
|
|
//医保曲线
|
|
|
JSONArray yibaoArray = jsonObject.getJSONArray("yibaoList");
|
|
|
/*for (int i = 0; i < yibaoList.size(); i++) {
|
|
|
Map listMap = new HashMap<>();
|
|
|
JSONObject yibaoListJSONObject = yibaoList.getJSONObject(i);
|
|
|
String date = yibaoListJSONObject.getString("date");
|
|
|
String avg = yibaoListJSONObject.getString("avg");
|
|
|
String count = yibaoListJSONObject.getString("count");
|
|
|
listMap.put("date",date);
|
|
|
listMap.put("avg",avg);
|
|
|
listMap.put("count",count);
|
|
|
yibaoListMap.add(listMap);
|
|
|
}
|
|
|
*/
|
|
|
List<Map> yibaoList = JSONObject.parseArray(yibaoArray.toJSONString(), Map.class);
|
|
|
|
|
|
//扫码曲线获取
|
|
|
JSONArray saomaArray = jsonObject.getJSONArray("saomaList");
|
|
|
List<Map> saomaList = JSONObject.parseArray(yibaoArray.toJSONString(), Map.class);
|
|
|
|
|
|
//取药列表获取
|
|
|
List<Map> mediicineorderListMap = new ArrayList<>();
|
|
|
JSONArray mediicineorderList = jsonObject.getJSONArray("mediicineorderList");
|
|
@ -1880,7 +1891,7 @@ public class MonitorPlatformService {
|
|
|
//设备名称
|
|
|
deviceListMapObject.put("equName", deviceObject.getString("equName"));
|
|
|
//设备地址
|
|
|
deviceListMapObject.put("detailAddress", deviceObject.getString("detailAddress"));
|
|
|
deviceListMapObject.put("deliveryAddress", deviceObject.getString("deliveryAddress"));
|
|
|
//设备编号
|
|
|
deviceListMapObject.put("equNum", deviceObject.getString("equNum"));
|
|
|
//湿度
|
|
@ -1895,21 +1906,49 @@ public class MonitorPlatformService {
|
|
|
List<Map> shippingTypeList = JSONObject.parseArray(shippingTypeArray.toJSONString(), Map.class);
|
|
|
|
|
|
|
|
|
//医保曲线存放
|
|
|
resoultMap.put("yibaoList", yibaoList);
|
|
|
//扫码曲线存放
|
|
|
resoultMap.put("saomaListMap", saomaList);
|
|
|
//取药列表存放
|
|
|
resoultMap.put("mediicineorderListMap", mediicineorderListMap);
|
|
|
resoultMap.put("mediicineorderList", mediicineorderListMap);
|
|
|
//设备信息存放
|
|
|
resoultMap.put("deviceList", deviceListMap);
|
|
|
//取药方式存放
|
|
|
resoultMap.put("shippingTypeListMap", shippingTypeList);
|
|
|
resoultMap.put("shippingTypeTotal", shippingTypeList);
|
|
|
return resoultMap;
|
|
|
}
|
|
|
|
|
|
/*获取药柜曲线图信息*/
|
|
|
public Map<String, List<Map>> getCabinetCurve(String deviceId, String day) throws Exception {
|
|
|
if ("".equals(day) || day == null) {
|
|
|
day = "365";
|
|
|
}
|
|
|
//返回参数
|
|
|
Map<String, List<Map>> resoultMap = new HashMap<>();
|
|
|
|
|
|
//参数加密
|
|
|
Map parameterMap = new HashMap<String, String>();
|
|
|
parameterMap.put("deviceId", deviceId);
|
|
|
parameterMap.put("day", day);
|
|
|
String content = com.alibaba.fastjson.JSONObject.toJSONString(parameterMap);
|
|
|
String params = AesEncryptUtils.agEncrypt(content);
|
|
|
JSONObject jsonObject = getUrl("/open/noLogin/getDeviceInfo", params);
|
|
|
|
|
|
//医保曲线
|
|
|
JSONArray yibaoArray = jsonObject.getJSONArray("yibaoList");
|
|
|
List<Map> yibaoList = JSONObject.parseArray(yibaoArray.toJSONString(), Map.class);
|
|
|
|
|
|
//扫码曲线获取
|
|
|
JSONArray saomaArray = jsonObject.getJSONArray("saomaList");
|
|
|
List<Map> saomaList = JSONObject.parseArray(yibaoArray.toJSONString(), Map.class);
|
|
|
|
|
|
//医保曲线存放
|
|
|
resoultMap.put("yibaoList", yibaoList);
|
|
|
//扫码曲线存放
|
|
|
resoultMap.put("saomaList", saomaList);
|
|
|
|
|
|
return resoultMap;
|
|
|
}
|
|
|
|
|
|
/*药柜地标*/
|
|
|
public List<Map<String,Object>> getLongitudeAndLatitude(){
|
|
|
public List<Map<String, Object>> getLongitudeAndLatitude() {
|
|
|
JSONArray resultArr = new JSONArray();
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
try {
|
|
@ -1924,6 +1963,9 @@ public class MonitorPlatformService {
|
|
|
/*投放纬度*/
|
|
|
String lat = jsonObject.getString("lat");
|
|
|
resultMap.put("lat;", lat);
|
|
|
/*id*/
|
|
|
String id = jsonObject.getString("id");
|
|
|
resultMap.put("id;", id);
|
|
|
list.add(resultMap);
|
|
|
}
|
|
|
return list;
|
|
@ -1934,8 +1976,6 @@ public class MonitorPlatformService {
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*请求接口*/
|
|
|
public JSONObject getUrl(String url, String parame) {
|
|
|
JSONObject resultObj = new JSONObject();
|