|
@ -9,7 +9,6 @@ import com.yihu.iot.service.common.MyJdbcTemplate;
|
|
import com.yihu.iot.service.device.IotPatientDeviceService;
|
|
import com.yihu.iot.service.device.IotPatientDeviceService;
|
|
import com.yihu.iot.service.equipment.IotEqtDetailService;
|
|
import com.yihu.iot.service.equipment.IotEqtDetailService;
|
|
import com.yihu.iot.service.label.FigureLabelSerachService;
|
|
import com.yihu.iot.service.label.FigureLabelSerachService;
|
|
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
|
|
|
|
import com.yihu.iot.util.excel.hibernate.HibenateUtils;
|
|
import com.yihu.iot.util.excel.hibernate.HibenateUtils;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
@ -43,6 +42,12 @@ public class MonitorPlatformService {
|
|
private String appid;
|
|
private String appid;
|
|
@Value("${spring.wlyy.appsecret}")
|
|
@Value("${spring.wlyy.appsecret}")
|
|
private String appSecret;
|
|
private String appSecret;
|
|
|
|
@Value("${wechat.id}")
|
|
|
|
private String wxId;
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${wechat.flag}")
|
|
|
|
private boolean flag;
|
|
public static Map<String,String> tokenMap = new HashMap<>();
|
|
public static Map<String,String> tokenMap = new HashMap<>();
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@ -54,13 +59,13 @@ public class MonitorPlatformService {
|
|
@Autowired
|
|
@Autowired
|
|
private FigureLabelSerachService figureLabelSerachService;
|
|
private FigureLabelSerachService figureLabelSerachService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
private IotEqtDetailService iotEqtDetailService;
|
|
|
|
@Autowired
|
|
private IotEquipmentDetailDao iotEquipmentDetailDao;
|
|
private IotEquipmentDetailDao iotEquipmentDetailDao;
|
|
@Autowired
|
|
@Autowired
|
|
private HibenateUtils hibenateUtils;
|
|
private HibenateUtils hibenateUtils;
|
|
@Autowired
|
|
@Autowired
|
|
private IotSystemDictDao iotSystemDictDao;
|
|
private IotSystemDictDao iotSystemDictDao;
|
|
@Autowired
|
|
|
|
private IotEqtDetailService iotEqtDetailService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取位置信息
|
|
* 获取位置信息
|
|
@ -146,10 +151,10 @@ public class MonitorPlatformService {
|
|
params.put("area",area);
|
|
params.put("area",area);
|
|
params.put("hospital",hospital);
|
|
params.put("hospital",hospital);
|
|
String anotherResult = sendGet(url,params);
|
|
String anotherResult = sendGet(url,params);
|
|
String sqlAre = "select count(1) AS \"total\",t.belong_are AS \"belong_are\",t.belong_are_code AS \"belong_are_code\" from iot_equipmet_detail t group by t.belong_are_code order by \"total\" desc ";
|
|
|
|
|
|
String sqlAre = dealSql(params);
|
|
List<Map<String, Object>> iotEquip = hibenateUtils.createSQLQuery(sqlAre);
|
|
List<Map<String, Object>> iotEquip = hibenateUtils.createSQLQuery(sqlAre);
|
|
if("8"==deviceType){
|
|
if("8"==deviceType){
|
|
return iotEquip.toString();
|
|
|
|
|
|
return iotEquip.toString();
|
|
}else {
|
|
}else {
|
|
JSONObject jsonObject = JSONObject.parseObject(anotherResult);
|
|
JSONObject jsonObject = JSONObject.parseObject(anotherResult);
|
|
if("200".equals(jsonObject.get("status").toString())){
|
|
if("200".equals(jsonObject.get("status").toString())){
|
|
@ -177,10 +182,40 @@ public class MonitorPlatformService {
|
|
return jsonObject.toString();
|
|
return jsonObject.toString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/*private String dealSql(Map<String, Object> params){
|
|
|
|
|
|
private String dealSql(Map<String, Object> params){
|
|
StringBuffer sql = new StringBuffer();
|
|
StringBuffer sql = new StringBuffer();
|
|
sql.append()
|
|
|
|
}*/
|
|
|
|
|
|
sql.append("select count(1) AS \"total\",t.belong_are AS \"belong_are\",t.belong_are_code AS \"belong_are_code\" from iot_equipmet_detail t ");
|
|
|
|
sql.append(" where 1=1 ");
|
|
|
|
if (null!=params.get("area")){
|
|
|
|
sql.append(" and t.belong_are = '"+params.get("area").toString()+"'");
|
|
|
|
}
|
|
|
|
if (null!=params.get("startTime")) {
|
|
|
|
//sql.append(" and t.update_time > '" + beginTime+"'");//DateUtil.stringToDate(beginTime,"yyyy-MM-dd HH:mm:ss")
|
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
|
if (flag){
|
|
|
|
sql.append( " and t.create_time >= str_to_date('" + params.get("startTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
|
|
|
|
}else {
|
|
|
|
sql.append( " and t.create_time >= to_date('" + params.get("startTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sql.append( " AND t.create_time >='" + params.get("startTime").toString() + " 00:00:00'");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (null!=params.get("endTime")) {
|
|
|
|
//sql.append(" and t.update_time < '" + endTime+"'");//DateUtil.stringToDate(endTime,"yyyy-MM-dd HH:mm:ss")
|
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
|
if (flag){
|
|
|
|
sql.append( " and t.create_time <= str_to_date('" + params.get("endTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
|
|
|
|
}else {
|
|
|
|
sql.append( " and t.create_time <= to_date('" + params.get("endTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sql.append( " AND t.create_time <='" + params.get("endTime").toString() + " 00:00:00'");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql.append(" group by t.belong_are_code order by \"total\" desc ");
|
|
|
|
return sql.toString();
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 慢病患者情况-统计
|
|
* 慢病患者情况-统计
|
|
@ -474,80 +509,18 @@ 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){
|
|
IotSystemDictDO iotSystemDictDO = iotSystemDictDao.findByDictNameAndValueAndDel("DEVICE_TYPE","健康小屋",1);
|
|
|
|
JSONArray jsonArray = json.getJSONArray("data");
|
|
JSONArray jsonArray = json.getJSONArray("data");
|
|
String[] str =deviceType.split(",");
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
for (int i=0;i<str.length;i++){
|
|
|
|
list.add(str[i]);
|
|
|
|
}
|
|
|
|
if (iotSystemDictDO!=null){
|
|
|
|
if (!list.contains(iotSystemDictDO.getCode())){
|
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
|
JSONObject jo = jsonArray.getJSONObject(i);
|
|
|
|
String tmp = jo.getString("type");
|
|
|
|
if("1".equals(tmp)){
|
|
|
|
jo.put("typeName","血糖仪");
|
|
|
|
}else if("2".equals(tmp)){
|
|
|
|
jo.put("typeName","血压计");
|
|
|
|
}else if("3".equals(tmp)){
|
|
|
|
jo.put("typeName","智能药盒");
|
|
|
|
}else if("4".equals(tmp)){
|
|
|
|
jo.put("typeName","智能手表");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
if (jsonArray!=null&&jsonArray.size()!=0){
|
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
|
JSONObject jo = jsonArray.getJSONObject(i);
|
|
|
|
String tmp = jo.getString("type");
|
|
|
|
if("1".equals(tmp)){
|
|
|
|
jo.put("typeName","血糖仪");
|
|
|
|
}else if("2".equals(tmp)){
|
|
|
|
jo.put("typeName","血压计");
|
|
|
|
}else if("3".equals(tmp)){
|
|
|
|
jo.put("typeName","智能药盒");
|
|
|
|
}else if("4".equals(tmp)){
|
|
|
|
jo.put("typeName","智能手表");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)){
|
|
|
|
JSONObject jsonObject= new JSONObject();
|
|
|
|
jsonObject.put("type",iotSystemDictDO.getCode());
|
|
|
|
jsonObject.put("typeName",iotSystemDictDO.getValue());
|
|
|
|
jsonObject.put("signNum",0);
|
|
|
|
jsonObject.put("unSignNum",0);
|
|
|
|
jsonArray.add(jsonObject);
|
|
|
|
}else {
|
|
|
|
Long count = iotEqtDetailService.findCountByHealthHourse(startTime,endTime,area);
|
|
|
|
JSONObject jsonObject= new JSONObject();
|
|
|
|
jsonObject.put("type",iotSystemDictDO.getCode());
|
|
|
|
jsonObject.put("typeName",iotSystemDictDO.getValue());
|
|
|
|
jsonObject.put("signNum",count);
|
|
|
|
jsonObject.put("unSignNum",0);
|
|
|
|
jsonArray.add(jsonObject);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)){
|
|
|
|
jsonArray = new JSONArray();
|
|
|
|
JSONObject jsonObject= new JSONObject();
|
|
|
|
jsonObject.put("type",iotSystemDictDO.getCode());
|
|
|
|
jsonObject.put("typeName",iotSystemDictDO.getValue());
|
|
|
|
jsonObject.put("signNum",0);
|
|
|
|
jsonObject.put("unSignNum",0);
|
|
|
|
jsonArray.add(jsonObject);
|
|
|
|
}else {
|
|
|
|
Long count = iotEqtDetailService.findCountByHealthHourse(startTime,endTime,area);
|
|
|
|
jsonArray = new JSONArray();
|
|
|
|
JSONObject jsonObject= new JSONObject();
|
|
|
|
jsonObject.put("type",iotSystemDictDO.getCode());
|
|
|
|
jsonObject.put("typeName",iotSystemDictDO.getValue());
|
|
|
|
jsonObject.put("signNum",count);
|
|
|
|
jsonObject.put("unSignNum",0);
|
|
|
|
jsonArray.add(jsonObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
|
JSONObject jo = jsonArray.getJSONObject(i);
|
|
|
|
String tmp = jo.getString("type");
|
|
|
|
if("1".equals(tmp)){
|
|
|
|
jo.put("typeName","血糖仪");
|
|
|
|
}else if("2".equals(tmp)){
|
|
|
|
jo.put("typeName","血压计");
|
|
|
|
}else if("3".equals(tmp)){
|
|
|
|
jo.put("typeName","智能药盒");
|
|
|
|
}else if("4".equals(tmp)){
|
|
|
|
jo.put("typeName","智能手表");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -647,7 +620,7 @@ public class MonitorPlatformService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject totalRange(String startTime,String endTime,
|
|
public JSONObject totalRange(String startTime,String endTime,
|
|
String deviceType,String area,String hospital,String quotaCode){
|
|
|
|
|
|
String deviceType,String area,String hospital,String quotaCode){
|
|
String url = "/wlyygc/iot_monitoring/totalRange";
|
|
String url = "/wlyygc/iot_monitoring/totalRange";
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("startTime",startTime);
|
|
params.put("startTime",startTime);
|
|
@ -674,7 +647,7 @@ public class MonitorPlatformService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject diseaseUseRange(String startTime,String endTime,
|
|
public JSONObject diseaseUseRange(String startTime,String endTime,
|
|
String deviceType,String area,String hospital){
|
|
|
|
|
|
String deviceType,String area,String hospital){
|
|
String url = "/wlyygc/iot_monitoring/diseaseUseRange";
|
|
String url = "/wlyygc/iot_monitoring/diseaseUseRange";
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("startTime",startTime);
|
|
params.put("startTime",startTime);
|
|
@ -700,7 +673,7 @@ public class MonitorPlatformService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject diseaseRange(String startTime,String endTime,
|
|
public JSONObject diseaseRange(String startTime,String endTime,
|
|
String deviceType,String area,String hospital){
|
|
|
|
|
|
String deviceType,String area,String hospital){
|
|
String url = "/wlyygc/iot_monitoring/diseaseRange";
|
|
String url = "/wlyygc/iot_monitoring/diseaseRange";
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("startTime",startTime);
|
|
params.put("startTime",startTime);
|
|
@ -727,7 +700,7 @@ public class MonitorPlatformService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject yellowOrRedRange(String startTime,String endTime,
|
|
public JSONObject yellowOrRedRange(String startTime,String endTime,
|
|
String deviceType,String area,String hospital,Integer diseaseCondition){
|
|
|
|
|
|
String deviceType,String area,String hospital,Integer diseaseCondition){
|
|
String url = "/wlyygc/iot_monitoring/yellowOrRedRange";
|
|
String url = "/wlyygc/iot_monitoring/yellowOrRedRange";
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("startTime",startTime);
|
|
params.put("startTime",startTime);
|
|
@ -756,7 +729,7 @@ public class MonitorPlatformService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONArray warningInformationAlarm_new(Integer page,Integer pageSize,String startTime,String endTime,
|
|
public JSONArray warningInformationAlarm_new(Integer page,Integer pageSize,String startTime,String endTime,
|
|
String deviceType,String area,String hospital){
|
|
|
|
|
|
String deviceType,String area,String hospital){
|
|
String url = "/wlyygc/iot_monitoring/warningInformationAlarm_new";
|
|
String url = "/wlyygc/iot_monitoring/warningInformationAlarm_new";
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("page",page);
|
|
params.put("page",page);
|
|
@ -785,7 +758,7 @@ public class MonitorPlatformService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject yellowAndRedRange(String startTime,String endTime,
|
|
public JSONObject yellowAndRedRange(String startTime,String endTime,
|
|
String deviceType,String area,String hospital){
|
|
|
|
|
|
String deviceType,String area,String hospital){
|
|
String url = "/wlyygc/iot_monitoring/yellowAndRedRange";
|
|
String url = "/wlyygc/iot_monitoring/yellowAndRedRange";
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("startTime",startTime);
|
|
params.put("startTime",startTime);
|