Переглянути джерело

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 2 роки тому
батько
коміт
fd6bd2c107
35 змінених файлів з 1634 додано та 184 видалено
  1. 1 3
      common/common-entity/sql/2023.sql
  2. 8 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java
  3. 0 1
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java
  4. 51 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java
  5. 10 1
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoDO.java
  6. 89 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoPropertyDO.java
  7. 47 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsAppDO.java
  8. 37 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsCommonDO.java
  9. 57 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsRealtimeDO.java
  10. 269 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsStockDO.java
  11. 4 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  12. 249 0
      common/common-rest-model-es/src/main/java/iot/device/IotLocationDataVO.java
  13. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyAppVO.java
  14. 0 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java
  15. 50 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java
  16. 90 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoPropertyVO.java
  17. 11 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java
  18. 0 29
      svr/svr-iot/src/main/java/com/yihu/iot/config/jpa/HibernateProperties.java
  19. 0 65
      svr/svr-iot/src/main/java/com/yihu/iot/config/jpa/IotJpa.java
  20. 87 4
      svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java
  21. 49 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java
  22. 2 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoDao.java
  23. 19 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoPropertyDao.java
  24. 13 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsAppDao.java
  25. 12 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsCommonDao.java
  26. 13 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsRealtimeDao.java
  27. 17 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsStockDao.java
  28. 2 3
      svr/svr-iot/src/main/java/com/yihu/iot/interceptor/CrosXssFilter.java
  29. 0 3
      svr/svr-iot/src/main/java/com/yihu/iot/service/common/PermissionService.java
  30. 37 14
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  31. 297 51
      svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java
  32. 86 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoPropertyService.java
  33. 13 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java
  34. 3 3
      svr/svr-iot/src/main/resources/application.yml
  35. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml

+ 1 - 3
common/common-entity/sql/2023.sql

@ -2,6 +2,4 @@
ALTER TABLE wlyy_patient_device_location ADD city varchar(20) COMMENT '城市' ;
ALTER TABLE wlyy_patient_device_location ADD city_name varchar(20) COMMENT '城市名称' ;
ALTER TABLE wlyy_patient_device_location ADD town varchar(20) COMMENT '地区' ;
ALTER TABLE wlyy_patient_device_location ADD town_name varchar(20) COMMENT '地区名称' ;
ALTER TABLE wlyy_knowledge_article_dict ADD url varchar(500) COMMENT '外链地址' ;
ALTER TABLE wlyy_patient_device_location ADD town_name varchar(20) COMMENT '地区名称' ;

+ 8 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java

@ -15,6 +15,8 @@ import java.io.Serializable;
@Entity
@Table(name = "iot_company_app")
public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "secret_key")
    private String secretKey;//
    @Column(name = "saas_id")
    private String saasId;//
    @Column(name = "name")
@ -76,4 +78,10 @@ public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements S
    public void setStatus(String status) {
        this.status = status;
    }
    public String getSecretKey() {
        return secretKey;
    }
    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }
}

+ 0 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java

@ -15,7 +15,6 @@ import java.util.List;
@Entity
@Table(name = "iot_company")
public class IotCompanyDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//
    @Column(name = "status")

+ 51 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java

@ -62,6 +62,17 @@ public class IotPatientDeviceDO extends UuidIdentityEntityWithOperator implement
    private String damageImages;//申请维修附件图片,多个用逗号隔开
    @Column(name = "repair_description")
    private String repairDescription;//维修说明
    @Column(name = "property_name")
    private Integer propertyName; //设备通用名称
    @Column(name = "property_combination")
    private String propertyCombination;  //组合访视
    @Column(name = "property_use")
    private String propertyUse;//用途
    @Column(name = "property_network")
    private String propertyNetwork;//网络传输
    @Column(name = "property_location")
    private String propertyLocation;//投放位置
    public String getSaasId() {
        return saasId;
@ -241,4 +252,44 @@ public class IotPatientDeviceDO extends UuidIdentityEntityWithOperator implement
    public void setRepairDescription(String repairDescription) {
        this.repairDescription = repairDescription;
    }
    public Integer getPropertyName() {
        return propertyName;
    }
    public void setPropertyName(Integer propertyName) {
        this.propertyName = propertyName;
    }
    public String getPropertyCombination() {
        return propertyCombination;
    }
    public void setPropertyCombination(String propertyCombination) {
        this.propertyCombination = propertyCombination;
    }
    public String getPropertyUse() {
        return propertyUse;
    }
    public void setPropertyUse(String propertyUse) {
        this.propertyUse = propertyUse;
    }
    public String getPropertyNetwork() {
        return propertyNetwork;
    }
    public void setPropertyNetwork(String propertyNetwork) {
        this.propertyNetwork = propertyNetwork;
    }
    public String getPropertyLocation() {
        return propertyLocation;
    }
    public void setPropertyLocation(String propertyLocation) {
        this.propertyLocation = propertyLocation;
    }
}

+ 10 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoDO.java

@ -15,7 +15,6 @@ import java.util.Date;
@Entity
@Table(name = "iot_product_base_info")
public class IotProductBaseInfoDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//
    @Column(name = "parent_id")
@ -69,6 +68,8 @@ public class IotProductBaseInfoDO extends UuidIdentityEntityWithOperator impleme
    private String spec;//规格
    @Column(name = "unit")
    private String unit;//单位
    @Column(name = "property")
    private String property;//属性 1.是 0.否
    @Column(name = "purchase_price")
    private Double purchasePrice;//进货价
    @Column(name = "retail_price")
@ -337,4 +338,12 @@ public class IotProductBaseInfoDO extends UuidIdentityEntityWithOperator impleme
    public void setInventoryFloor(Integer inventoryFloor) {
        this.inventoryFloor = inventoryFloor;
    }
    public String getProperty() {
        return property;
    }
    public void setProperty(String property) {
        this.property = property;
    }
}

+ 89 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoPropertyDO.java

@ -0,0 +1,89 @@
package com.yihu.jw.entity.iot.product;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * 类描述:
 *
 * @author 陈鑫
 * @date 2023-05-05 14:37
 **/
@Entity
@Table(name = "iot_product_base_info_property")
public class IotProductBaseInfoPropertyDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "product_id")
    private String productId;
    @Column(name = "name")
    private String name;
    @Column(name = "combination")
    private String combination;
    @Column(name = "use")
    private String use;
    @Column(name = "network")
    private String network;
    @Column(name = "location")
    private String location;
    @Column(name = "dictionaries")
    private String dictionaries;
    public String getProductId() {
        return productId;
    }
    public void setProductId(String productId) {
        this.productId = productId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCombination() {
        return combination;
    }
    public void setCombination(String combination) {
        this.combination = combination;
    }
    public String getUse() {
        return use;
    }
    public void setUse(String use) {
        this.use = use;
    }
    public String getNetwork() {
        return network;
    }
    public void setNetwork(String network) {
        this.network = network;
    }
    public String getLocation() {
        return location;
    }
    public void setLocation(String location) {
        this.location = location;
    }
    public String getDictionaries() {
        return dictionaries;
    }
    public void setDictionaries(String dictionaries) {
        this.dictionaries = dictionaries;
    }
}

+ 47 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsAppDO.java

@ -0,0 +1,47 @@
package com.yihu.jw.entity.iot.statistics;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 大屏-统计-应用
 * Created by yeshijie on 2023/5/5.
 */
@Entity
@Table(name = "iot_statistics_app")
public class IotStatisticsAppDO extends UuidIdentityEntityWithCreateTime {
    private String type;//类型 1应用 2应用统计 3商家进驻 4商家进驻统计
    private String name;//名称
    private Long num;//数量
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "num")
    public Long getNum() {
        return num;
    }
    public void setNum(Long num) {
        this.num = num;
    }
}

+ 37 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsCommonDO.java

@ -0,0 +1,37 @@
package com.yihu.jw.entity.iot.statistics;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 大屏-统计-通用
 * Created by yeshijie on 2023/5/5.
 */
@Entity
@Table(name = "iot_statistics_common")
public class IotStatisticsCommonDO extends UuidIdentityEntityWithCreateTime {
    private String type;//类型 1设备组合方式 2设备网络传输
    private String content;//统计内容json格式
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
}

+ 57 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsRealtimeDO.java

@ -0,0 +1,57 @@
package com.yihu.jw.entity.iot.statistics;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 大屏-统计-实时数据
 * Created by yeshijie on 2023/5/5.
 */
@Entity
@Table(name = "iot_statistics_realtime")
public class IotStatisticsRealtimeDO extends UuidIdentityEntityWithCreateTime {
    private String type;//类型 1健康监测设备 2自助服务设备 3临床医疗设备
    private String deviceNum;//设备数据
    private String signNum;//体征数据
    private String abnormalNum;//异常数据
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "device_num")
    public String getDeviceNum() {
        return deviceNum;
    }
    public void setDeviceNum(String deviceNum) {
        this.deviceNum = deviceNum;
    }
    @Column(name = "sign_num")
    public String getSignNum() {
        return signNum;
    }
    public void setSignNum(String signNum) {
        this.signNum = signNum;
    }
    @Column(name = "abnormal_num")
    public String getAbnormalNum() {
        return abnormalNum;
    }
    public void setAbnormalNum(String abnormalNum) {
        this.abnormalNum = abnormalNum;
    }
}

+ 269 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/statistics/IotStatisticsStockDO.java

@ -0,0 +1,269 @@
package com.yihu.jw.entity.iot.statistics;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 大屏-统计-设备库存数据
 * Created by yeshijie on 2023/5/6.
 */
@Entity
@Table(name = "iot_statistics_stock")
public class IotStatisticsStockDO extends UuidIdentityEntityWithCreateTime {
    private String name;//名称
    private String type;//类别 设备通用名字典
    private String parentType;//父类别 顶级为0
    private String town;//地区编码
    private String townName;//地区名称
    private Long total;//总数
    private Long useing;//使用数
    private Long stock;//库存数
    private Long iotCount;//物联数
    private Long lostCount;//失联数
    private Long interveneCount;//干预数
    private Long issueCount;//发放数
    private Long bindingCount;//绑定数
    private Long diseasePatientCount;//慢病患者数
    private Long diseasePatientDeviceCount;//慢病患者设备数
    private Long diseasePatientUseCount;//慢病患者设备使用数
    private Long faultCount;//设备故障数
    private String iotRate;//设备物联率
    private String lostRate;//设备失联率
    private String interveneRate;//干预指导率
    private String issueRate;//设备发放率
    private String bindingRate;//设备绑定率
    private String diseasePatientDeviceRate;//慢病患者设备覆盖率
    private String diseasePatientUseRate;//慢病患者设备使用率
    private String faultRate;//设备故障率
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "parent_type")
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
    @Column(name = "town")
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    @Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    @Column(name = "total")
    public Long getTotal() {
        return total;
    }
    public void setTotal(Long total) {
        this.total = total;
    }
    @Column(name = "useing")
    public Long getUseing() {
        return useing;
    }
    public void setUseing(Long useing) {
        this.useing = useing;
    }
    @Column(name = "stock")
    public Long getStock() {
        return stock;
    }
    public void setStock(Long stock) {
        this.stock = stock;
    }
    @Column(name = "iot_count")
    public Long getIotCount() {
        return iotCount;
    }
    public void setIotCount(Long iotCount) {
        this.iotCount = iotCount;
    }
    @Column(name = "lost_count")
    public Long getLostCount() {
        return lostCount;
    }
    public void setLostCount(Long lostCount) {
        this.lostCount = lostCount;
    }
    @Column(name = "intervene_count")
    public Long getInterveneCount() {
        return interveneCount;
    }
    public void setInterveneCount(Long interveneCount) {
        this.interveneCount = interveneCount;
    }
    @Column(name = "issue_count")
    public Long getIssueCount() {
        return issueCount;
    }
    public void setIssueCount(Long issueCount) {
        this.issueCount = issueCount;
    }
    @Column(name = "binding_count")
    public Long getBindingCount() {
        return bindingCount;
    }
    public void setBindingCount(Long bindingCount) {
        this.bindingCount = bindingCount;
    }
    @Column(name = "disease_patient_count")
    public Long getDiseasePatientCount() {
        return diseasePatientCount;
    }
    public void setDiseasePatientCount(Long diseasePatientCount) {
        this.diseasePatientCount = diseasePatientCount;
    }
    @Column(name = "disease_patient_device_count")
    public Long getDiseasePatientDeviceCount() {
        return diseasePatientDeviceCount;
    }
    public void setDiseasePatientDeviceCount(Long diseasePatientDeviceCount) {
        this.diseasePatientDeviceCount = diseasePatientDeviceCount;
    }
    @Column(name = "disease_patient_use_count")
    public Long getDiseasePatientUseCount() {
        return diseasePatientUseCount;
    }
    public void setDiseasePatientUseCount(Long diseasePatientUseCount) {
        this.diseasePatientUseCount = diseasePatientUseCount;
    }
    @Column(name = "fault_count")
    public Long getFaultCount() {
        return faultCount;
    }
    public void setFaultCount(Long faultCount) {
        this.faultCount = faultCount;
    }
    @Transient
    public String getIotRate() {
        return iotRate;
    }
    public void setIotRate(String iotRate) {
        this.iotRate = iotRate;
    }
    @Transient
    public String getLostRate() {
        return lostRate;
    }
    public void setLostRate(String lostRate) {
        this.lostRate = lostRate;
    }
    @Transient
    public String getInterveneRate() {
        return interveneRate;
    }
    public void setInterveneRate(String interveneRate) {
        this.interveneRate = interveneRate;
    }
    @Transient
    public String getIssueRate() {
        return issueRate;
    }
    public void setIssueRate(String issueRate) {
        this.issueRate = issueRate;
    }
    @Transient
    public String getBindingRate() {
        return bindingRate;
    }
    public void setBindingRate(String bindingRate) {
        this.bindingRate = bindingRate;
    }
    @Transient
    public String getDiseasePatientDeviceRate() {
        return diseasePatientDeviceRate;
    }
    public void setDiseasePatientDeviceRate(String diseasePatientDeviceRate) {
        this.diseasePatientDeviceRate = diseasePatientDeviceRate;
    }
    @Transient
    public String getDiseasePatientUseRate() {
        return diseasePatientUseRate;
    }
    public void setDiseasePatientUseRate(String diseasePatientUseRate) {
        this.diseasePatientUseRate = diseasePatientUseRate;
    }
    @Transient
    public String getFaultRate() {
        return faultRate;
    }
    public void setFaultRate(String faultRate) {
        this.faultRate = faultRate;
    }
}

+ 4 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -42,6 +42,7 @@ public class IotRequestMapping {
        public static final String message_success_find_functions = "find success";
        public static final String message_success_import = "import success";
        public static final String message_fail = "fail";
        public static final String message_fail_name_is_null = "name is null";
        public static final String message_fail_is_no_exist = "is no exist";
        public static final String message_fail_id_no_exist = "id no exist";
@ -167,7 +168,9 @@ public class IotRequestMapping {
        public static final String setInventoryById = "setInventoryById";
        public static final String findAll = "findAll";
        public static final String findListByCategoryCode = "findListByCategoryCode";
        public static final String addProductProperty = "addProductProperty";
        public static final String updateProductProperty = "updateProductProperty";
        public static final String findProductProperty = "findProductProperty";
    }
    /**

+ 249 - 0
common/common-rest-model-es/src/main/java/iot/device/IotLocationDataVO.java

@ -0,0 +1,249 @@
package iot.device;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.searchbox.annotations.JestId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
/**
 * Created by yeshijie on 2023/5/6.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "设备地址信息新", description = "设备地址信息新")
public class IotLocationDataVO {
    @JestId
    private String id;
    @ApiModelProperty("设备绑定的居民身份证")
    private String idCard;
    @ApiModelProperty("设备类型标识")
    private String categoryCode;
    @ApiModelProperty("设备SnID")
    private String deviceSn;
    @ApiModelProperty("设备经纬度")
    private GeoPoint location;
    @ApiModelProperty("设备绑定时间")
    private String deviceTime;
    @ApiModelProperty("疾病标签:0无,1高血压,2糖尿病,3高血压糖尿病都有")
    private String label;
    @ApiModelProperty("病情:0绿标,1黄标,2红标")
    private Integer diseaseCondition;
    @ApiModelProperty("创建时间")
    private String createTime;
    @ApiModelProperty("居民姓名")
    private String name;
    @ApiModelProperty("居民编码")
    private String patient;
    @ApiModelProperty("设备名称")
    private String deviceName;
    @ApiModelProperty("设备通用名编码")
    private String deviceCommon;
    @ApiModelProperty("设备通用名名称")
    private String deviceCommonName;
    @ApiModelProperty("用途编码")
    private String useCode;
    @ApiModelProperty("用途名称")
    private String useCodeName;
    @ApiModelProperty("组合方式编码")
    private String combinationMethod;
    @ApiModelProperty("组合方式名称")
    private String combinationMethodName;
    @ApiModelProperty("网络传输编码")
    private String networkTransmission;
    @ApiModelProperty("网络传输名称")
    private String networkTransmissionName;
    @ApiModelProperty("地区编码")
    private String town;
    @ApiModelProperty("地区名称")
    private String townName;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    public String getCategoryCode() {
        return categoryCode;
    }
    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
    public GeoPoint getLocation() {
        return location;
    }
    public void setLocation(GeoPoint location) {
        this.location = location;
    }
    public String getDeviceTime() {
        return deviceTime;
    }
    public void setDeviceTime(String deviceTime) {
        this.deviceTime = deviceTime;
    }
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    public Integer getDiseaseCondition() {
        return diseaseCondition;
    }
    public void setDiseaseCondition(Integer diseaseCondition) {
        this.diseaseCondition = diseaseCondition;
    }
    public void setLocation(Double lat, Double lng) {
        GeoPoint geoPoint = new GeoPoint(lat, lng);
        this.location = geoPoint;
    }
    public String getLabel() {
        return label;
    }
    public void setLabel(String label) {
        this.label = label;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    public String getDeviceCommon() {
        return deviceCommon;
    }
    public void setDeviceCommon(String deviceCommon) {
        this.deviceCommon = deviceCommon;
    }
    public String getDeviceCommonName() {
        return deviceCommonName;
    }
    public void setDeviceCommonName(String deviceCommonName) {
        this.deviceCommonName = deviceCommonName;
    }
    public String getUseCode() {
        return useCode;
    }
    public void setUseCode(String useCode) {
        this.useCode = useCode;
    }
    public String getUseCodeName() {
        return useCodeName;
    }
    public void setUseCodeName(String useCodeName) {
        this.useCodeName = useCodeName;
    }
    public String getCombinationMethod() {
        return combinationMethod;
    }
    public void setCombinationMethod(String combinationMethod) {
        this.combinationMethod = combinationMethod;
    }
    public String getCombinationMethodName() {
        return combinationMethodName;
    }
    public void setCombinationMethodName(String combinationMethodName) {
        this.combinationMethodName = combinationMethodName;
    }
    public String getNetworkTransmission() {
        return networkTransmission;
    }
    public void setNetworkTransmission(String networkTransmission) {
        this.networkTransmission = networkTransmission;
    }
    public String getNetworkTransmissionName() {
        return networkTransmissionName;
    }
    public void setNetworkTransmissionName(String networkTransmissionName) {
        this.networkTransmissionName = networkTransmissionName;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyAppVO.java

@ -16,6 +16,8 @@ public class IotCompanyAppVO implements Serializable {
    @ApiModelProperty("应用ID")
    private String id;
    @ApiModelProperty("秘钥")
    private String secretKey;
    @ApiModelProperty("应用名称")
    private String name;
    @ApiModelProperty("访问IP地址")
@ -88,4 +90,12 @@ public class IotCompanyAppVO implements Serializable {
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getSecretKey() {
        return secretKey;
    }
    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }
}

+ 0 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java

@ -16,7 +16,6 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "企业表", description = "企业表")
public class IotCompanyVO extends BaseVO implements Serializable {
    @ApiModelProperty("审核状态(预留字段)")
    private String status;
    @ApiModelProperty("企业名称")

+ 50 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java

@ -67,7 +67,16 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    private String sim;
    @ApiModelProperty("领用协议,多个用逗号隔开")
    private String imgs;
    @ApiModelProperty("设备通用名")
    private String propertyName;
    @ApiModelProperty("组合方式")
    private String propertyCombination;
    @ApiModelProperty("用途")
    private String propertyUse;
    @ApiModelProperty("网络传输")
    private String propertyNetwork;
    @ApiModelProperty("投放位置")
    private String propertyLocation;
    public String getPatient() {
        return patient;
@ -276,4 +285,44 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    public void setImgs(String imgs) {
        this.imgs = imgs;
    }
    public String getPropertyName() {
        return propertyName;
    }
    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }
    public String getPropertyCombination() {
        return propertyCombination;
    }
    public void setPropertyCombination(String propertyCombination) {
        this.propertyCombination = propertyCombination;
    }
    public String getPropertyUse() {
        return propertyUse;
    }
    public void setPropertyUse(String propertyUse) {
        this.propertyUse = propertyUse;
    }
    public String getPropertyNetwork() {
        return propertyNetwork;
    }
    public void setPropertyNetwork(String propertyNetwork) {
        this.propertyNetwork = propertyNetwork;
    }
    public String getPropertyLocation() {
        return propertyLocation;
    }
    public void setPropertyLocation(String propertyLocation) {
        this.propertyLocation = propertyLocation;
    }
}

+ 90 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoPropertyVO.java

@ -0,0 +1,90 @@
package com.yihu.jw.restmodel.iot.product;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.io.Serializable;
/**
 * 类描述:
 *
 * @author 陈鑫
 * @date 2023-05-05 15:37
 **/
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品属性表")
public class IotProductBaseInfoPropertyVO extends BaseVO implements Serializable {
    @ApiModelProperty("产品id")
    private String productId;
    @ApiModelProperty("设备通用名")
    private String name;
    @ApiModelProperty("组合方式")
    private String combination;
    @ApiModelProperty("用途")
    private String use;
    @ApiModelProperty("网络传输")
    private String network;
    @ApiModelProperty("投放位置")
    private String location;
    @ApiModelProperty("数据采集字典")
    private String dictionaries;
    public String getProductId() {
        return productId;
    }
    public void setProductId(String productId) {
        this.productId = productId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCombination() {
        return combination;
    }
    public void setCombination(String combination) {
        this.combination = combination;
    }
    public String getUse() {
        return use;
    }
    public void setUse(String use) {
        this.use = use;
    }
    public String getNetwork() {
        return network;
    }
    public void setNetwork(String network) {
        this.network = network;
    }
    public String getLocation() {
        return location;
    }
    public void setLocation(String location) {
        this.location = location;
    }
    public String getDictionaries() {
        return dictionaries;
    }
    public void setDictionaries(String dictionaries) {
        this.dictionaries = dictionaries;
    }
}

+ 11 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java

@ -6,6 +6,7 @@ import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.List;
@ -16,7 +17,6 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品基本信息表")
public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    @ApiModelProperty("父类ID")
    private String parentId;
    @ApiModelProperty("产品分类")
@ -90,6 +90,8 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    private Double inventoryUpper;
    @ApiModelProperty("库存下限提醒值")
    private String inventoryFloor;
    @ApiModelProperty("属性 1.是 0.否")
    private String property;
    public String getParentId() {
        return parentId;
@ -370,4 +372,12 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
    public String getProperty() {
        return property;
    }
    public void setProperty(String property) {
        this.property = property;
    }
}

+ 0 - 29
svr/svr-iot/src/main/java/com/yihu/iot/config/jpa/HibernateProperties.java

@ -1,29 +0,0 @@
//package com.yihu.iot.config.jpa;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.cloud.context.config.annotation.RefreshScope;
//import org.springframework.stereotype.Component;
//
//import java.util.Properties;
//
///**
// * Created by chenweida on 2017/4/6.
// */
//@Component
//@RefreshScope
//public class HibernateProperties {
//    @Value("${hibernate.dialect}")
//    private String dialect;
//    @Value("${hibernate.show_sql}")
//    private String show_sql;
//    @Value("${hibernate.ejb.naming_strategy}")
//    private String naming_strategy;
//
//    public  Properties hibProperties() {
//        Properties properties = new Properties();
//        properties.put("hibernate.dialect",dialect);
//        properties.put("hibernate.show_sql", show_sql);
//        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
//        return properties;
//    }
//}

+ 0 - 65
svr/svr-iot/src/main/java/com/yihu/iot/config/jpa/IotJpa.java

@ -1,65 +0,0 @@
//package com.yihu.iot.config.jpa;
//
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
//import org.springframework.orm.jpa.JpaTransactionManager;
//import org.springframework.orm.jpa.JpaVendorAdapter;
//import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
//import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//
//import javax.persistence.EntityManagerFactory;
//import javax.sql.DataSource;
//
///**
// * Created by chenweida on 2017/4/6.
// */
//@Configuration
//@EnableTransactionManagement
//@EnableJpaRepositories(
//        entityManagerFactoryRef = "iotEntityManagerFactory",
//        transactionManagerRef = "iotTransactionManager",
//        basePackages = {"com.yihu.iot.dict","com.yihu.iot.datainput.dict"})   //设置Repository所在位置
//public class IotJpa {
//
//    @Autowired
//    private HibernateProperties hibernateProperties;
//
//    @Bean(name = "iotEntityManagerFactory")
//    @Primary
//    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(DataSource dataSource) {
//
//        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
//        emfb.setDataSource(dataSource);
//        emfb.setPackagesToScan("com.yihu.jw.entity.iot");
//        emfb.setPersistenceUnitName("iot");
//        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
//        emfb.setJpaVendorAdapter(vendorAdapter);
//        emfb.setJpaProperties(hibernateProperties.hibProperties());
//
//        return emfb;
//    }
//
//
//    @Bean(name = "iotTransactionManager")
//    @Primary
//    JpaTransactionManager transactionManagerSecondary(
//            @Qualifier("iotEntityManagerFactory") EntityManagerFactory builder) {
//        return new JpaTransactionManager(builder);
//    }
//
//    @Bean
//    @Primary
//    @ConfigurationProperties(prefix = "spring.datasource")
//    public DataSource dataSource(){
//        return DataSourceBuilder.create().build();
//    }
//
//}

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

@ -36,7 +36,7 @@ import java.util.*;
 * Created by yeshijie on 2020/5/11.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.monitorPlatform)
@RequestMapping("svr-iot/monitorPlatform")
@Api(tags = "健康监测平台相关操作", description = "大屏数据相关操作")
public class MonitorPlatformController extends EnvelopRestEndpoint {
@ -362,6 +362,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/totalRange", method = RequestMethod.GET)
    @ApiOperation("85-发放率,96使用率,86绑定率,88指导率")
    @Deprecated
    public MixEnvelop totalRange(
            @ApiParam(name = "startTime", value = "开始时间", defaultValue = "")
            @RequestParam(value = "startTime", required = false) String startTime,
@ -385,6 +386,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "getTotalRange", method = RequestMethod.GET)
    @ApiOperation("96使用率,86绑定率,88指导率,慢病患者设备使用率,慢病患者设备覆盖率整合")
    @Deprecated
    public MixEnvelop getTotalRange(@ApiParam(name = "startTime", value = "开始时间yyyy-MM-dd", defaultValue = "")
                                    @RequestParam(value = "startTime", required = false) String startTime,
                                    @ApiParam(name = "endTime", value = "结束时间", defaultValue = "")
@ -406,6 +408,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/diseaseUseRange", method = RequestMethod.GET)
    @ApiOperation("慢病患者设备使用率")
    @Deprecated
    public MixEnvelop diseaseUseRange(
            @ApiParam(name = "startTime", value = "开始时间", defaultValue = "")
            @RequestParam(value = "startTime", required = false) String startTime,
@ -427,6 +430,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/diseaseRange", method = RequestMethod.GET)
    @ApiOperation("慢病患者设备覆盖率")
    @Deprecated
    public MixEnvelop diseaseRange(
            @ApiParam(name = "startTime", value = "开始时间", defaultValue = "")
            @RequestParam(value = "startTime", required = false) String startTime,
@ -515,7 +519,8 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.PatientDevice.findLocationByIdCard)
    @ApiOperation(value = "根据idCard查询设备地址", notes = "根据idCard查询设备地址")
    @ApiOperation(value = "根据idCard查询设备地址-废弃", notes = "根据idCard查询设备地址")
    @Deprecated
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocationsByIdCard(
            @ApiParam(name = "diseaseCondition", value = "病情:0绿标,1黄标,2红标,-1没有标注的居民", defaultValue = "")
            @RequestParam(value = "diseaseCondition", required = false) Integer diseaseCondition,
@ -550,6 +555,40 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findLocationPage")
    @ApiOperation(value = "新的物联网大屏地理搜索")
    public Envelop findLocationPage(
            @ApiParam(name = "name", value = "居民姓名或sn码")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "deviceCommon", value = "设备通用名编码")
            @RequestParam(value = "deviceCommon", required = false) String deviceCommon,
            @ApiParam(name = "useCode", value = "用途")
            @RequestParam(value = "useCode", required = false) String useCode,
            @ApiParam(name = "combinationMethod", value = "组合方式")
            @RequestParam(value = "combinationMethod", required = false) String combinationMethod,
            @ApiParam(name = "networkTransmission", value = "网络传输", required = false)
            @RequestParam(value = "networkTransmission", required = false) String networkTransmission,
            @ApiParam(name = "page", value = "第几页(默认第一页)", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页几行(默认10条记录)", defaultValue = "10")
            @RequestParam(value = "pageSize", required = false) Integer pageSize,
            @ApiParam(name = "town", value = "地区")
            @RequestParam(value = "town", required = false) String town
    ) {
        try {
            if (page == null) {
                page = 1;
            }
            if (pageSize == null) {
                pageSize = 10;
            }
            return monitorPlatformService.findLocationPage(name,deviceCommon, page, pageSize, useCode, combinationMethod, networkTransmission, town);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");
        }
    }
    @RequestMapping(value = "/chronicDiseaseCount", method = RequestMethod.GET)
    @ApiOperation("慢病患者情况-统计")
    public String chronicDiseaseCount(
@ -592,6 +631,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/warningInformationAlarm", method = RequestMethod.GET)
    @ApiOperation("预警信息警报")
    @Deprecated
    public String warningInformationAlarm(
            @ApiParam(name = "page", value = "第几页(默认第一页)", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
@ -846,12 +886,12 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @GetMapping(value = "/getBrandsAndManufacturer")
    @ApiOperation("设备品牌以及商家")
    public Envelop getBrandsAndManufacturer() {
        return success(monitorPlatformService.getBrandsAndManufacturer());
    }
    @GetMapping(value = "/getEquipmentStatistics")
    @ApiOperation("设备库存、使用数、总备案、失联率、物联率")
    @ApiOperation("设备库存、使用数、总备案、失联率、物联率-废弃")
    @Deprecated
    public Envelop getEquipmentStatistics(@RequestParam(value = "deviceType", required = true, defaultValue = "1,2,5,22")
                                          @ApiParam(name = "deviceType", value = "设备类型,1血糖仪,2血压计,5健康小屋,22智慧药房", required = true) String deviceType,
                                          @RequestParam(value = "deviceName", required = false, defaultValue = "")
@ -862,6 +902,49 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
        return success(monitorPlatformService.getEquipmentStatistics(deviceType, monitorPlatformService.getDeviceNameByRequestParam(deviceName), showLevel));
    }
    @GetMapping(value = "/onboardingDeviceManagement")
    @ApiOperation("入驻设备管理")
    public Envelop onboardingDeviceManagement(@RequestParam(value = "type", required = false)
                                              @ApiParam(name = "type", value = "设备通用名code", required = false) String type,
                                              @RequestParam(value = "town", required = false)
                                              @ApiParam(name = "town", value = "地区code", required = false) String town) {
        try {
            if(StringUtils.isBlank(type)){
                type = "0";
            }
            if(StringUtils.isBlank(town)){
                town = "350200";
            }
            return success(monitorPlatformService.onboardingDeviceManagement(type,town));
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("查询失败");
        }
    }
    @GetMapping(value = "/getEquipmentStock")
    @ApiOperation("设备库存、使用中、总备案")
    public Envelop getEquipmentStock() {
        try {
            return success(monitorPlatformService.getEquipmentStock());
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("查询失败");
        }
    }
    @ApiOperation("设备组合方式和设备网络传输")
    @RequestMapping(value = "combinationMethodAndWeb", method = RequestMethod.GET)
    public Envelop combinationMethodAndWeb() {
        try {
            return success(monitorPlatformService.combinationMethodAndWeb());
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
    @ApiOperation("大屏应用服务")
    @RequestMapping(value = "/getAppService", method = RequestMethod.GET)
    public Envelop getAppService() {

+ 49 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -2,12 +2,14 @@ package com.yihu.iot.controller.product;
import com.yihu.iot.service.device.IotDeviceInventoryWarningService;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.iot.service.product.IotProductBaseInfoPropertyService;
import com.yihu.iot.service.product.IotProductBaseInfoService;
import com.yihu.jw.entity.iot.device.IotDeviceInventoryWarningDO;
import com.yihu.jw.entity.iot.product.IotProductBaseInfoDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.device.IotDeviceInventoryWarningVO;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoPropertyVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -31,7 +33,8 @@ import java.util.List;
@RequestMapping(IotRequestMapping.Common.product)
@Api(tags = "产品管理相关操作", description = "产品管理相关操作")
public class IotProductController extends EnvelopRestEndpoint {
    @Autowired
    private IotProductBaseInfoPropertyService iotProductBaseInfoPropertyService;
    @Autowired
    private IotProductBaseInfoService iotProductBaseInfoService;
    @Autowired
@ -47,6 +50,8 @@ public class IotProductController extends EnvelopRestEndpoint {
    public MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> findCompanyPage(
            @ApiParam(name = "name", value = "注册证号或产品名称", defaultValue = "")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "property", value = "属性", defaultValue = "")
            @RequestParam(value = "property", required = false) String property,
            @ApiParam(name = "classify", value = "产品分类", defaultValue = "")
            @RequestParam(value = "classify", required = false) String classify,
            @ApiParam(name = "companyId", value = "企业id", defaultValue = "")
@ -76,6 +81,10 @@ public class IotProductController extends EnvelopRestEndpoint {
                filters += semicolon +"productClassify="+classify;
                semicolon = ";";
            }
            if(StringUtils.isNotBlank(property)){
                filters += semicolon +"property="+property;
                semicolon = ";";
            }
            String sorts = "-updateTime";
            //得到list数据
            List<IotProductBaseInfoDO> list = iotProductBaseInfoService.search(null, filters, sorts, page, size);
@ -227,5 +236,44 @@ public class IotProductController extends EnvelopRestEndpoint {
        return iotProductBaseInfoService.findAll();
    }
    @ApiOperation(value = "增加产品属性")
    @PostMapping(value = IotRequestMapping.Product.addProductProperty)
    public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> addProductProperty(@ApiParam(name = "jsonData", value = "添加产品属性json", defaultValue = "[]")
                                                                     @RequestParam(value = "jsonData", required = true)String jsonData){
        try {
            IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO = toEntity(jsonData, IotProductBaseInfoPropertyVO.class);
            MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> res = iotProductBaseInfoPropertyService.create(iotProductBaseInfoPropertyVO);
            //创建熟悉 修改熟悉状态为 1
            iotProductBaseInfoService.updateProperty(iotProductBaseInfoPropertyVO.getProductId(), "1");
            return res;
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");
        }
    }
    @ApiOperation(value = "修改产品熟悉 通过id")
    @PostMapping(value = IotRequestMapping.Product.updateProductProperty)
    public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> updateProductProperty(@ApiParam(name = "jsonData", value = "添加产品属性json", defaultValue = "[]") @RequestParam(value = "jsonData", required = true)String jsonData){
        try {
            IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO = toEntity(jsonData, IotProductBaseInfoPropertyVO.class);
            return iotProductBaseInfoPropertyService.update(iotProductBaseInfoPropertyVO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");
        }
    }
    @ApiOperation(value = "修改产品熟悉 通过id")
    @PostMapping(value = IotRequestMapping.Product.findProductProperty)
    public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> findProductProperty(@ApiParam(name = "productId", value = "产品id") @RequestParam(value = "productId", required = true) String productId){
        try {
            IotProductBaseInfoPropertyVO vo = iotProductBaseInfoPropertyService.findProductPropertyByProductId(productId);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, vo);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");
        }
    }
}

+ 2 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoDao.java

@ -22,4 +22,6 @@ public interface IotProductBaseInfoDao extends PagingAndSortingRepository<IotPro
    @Query("from IotProductBaseInfoDO w where w.name =?1 and w.del = 1")
    IotProductBaseInfoDO findByName(String name);
    @Query("UPDATE IotProductBaseInfoDO SET property = ?2  WHERE id = ?1")
    boolean updateProperty(String productId, String property);
}

+ 19 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoPropertyDao.java

@ -0,0 +1,19 @@
package com.yihu.iot.dao.product;
import com.yihu.jw.entity.iot.product.IotProductBaseInfoPropertyDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 接口描述描述:属性列表
 *
 * @author 陈鑫
 * @date 2023-05-05 14:36
 **/
public interface IotProductBaseInfoPropertyDao extends PagingAndSortingRepository<IotProductBaseInfoPropertyDO, String>,
        JpaSpecificationExecutor<IotProductBaseInfoPropertyDO> {
    @Query("FROM IotProductBaseInfoPropertyDO d WHERE  d.productId = ?1 ")
    IotProductBaseInfoPropertyDO findProductPropertyByProductId(String productId);
}

+ 13 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsAppDao.java

@ -0,0 +1,13 @@
package com.yihu.iot.dao.statistics;
import com.yihu.jw.entity.iot.statistics.IotStatisticsAppDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2023/5/5.
 */
public interface IotStatisticsAppDao extends PagingAndSortingRepository<IotStatisticsAppDO,String>,
        JpaSpecificationExecutor<IotStatisticsAppDO> {
}

+ 12 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsCommonDao.java

@ -0,0 +1,12 @@
package com.yihu.iot.dao.statistics;
import com.yihu.jw.entity.iot.statistics.IotStatisticsCommonDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2023/5/5.
 */
public interface IotStatisticsCommonDao extends PagingAndSortingRepository<IotStatisticsCommonDO,String>,
        JpaSpecificationExecutor<IotStatisticsCommonDO> {
}

+ 13 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsRealtimeDao.java

@ -0,0 +1,13 @@
package com.yihu.iot.dao.statistics;
import com.yihu.jw.entity.iot.statistics.IotStatisticsRealtimeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2023/5/5.
 */
public interface IotStatisticsRealtimeDao  extends PagingAndSortingRepository<IotStatisticsRealtimeDO,String>,
        JpaSpecificationExecutor<IotStatisticsRealtimeDO> {
}

+ 17 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/statistics/IotStatisticsStockDao.java

@ -0,0 +1,17 @@
package com.yihu.iot.dao.statistics;
import com.yihu.jw.entity.iot.statistics.IotStatisticsStockDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2023/5/6.
 */
public interface IotStatisticsStockDao extends PagingAndSortingRepository<IotStatisticsStockDO,String>,
        JpaSpecificationExecutor<IotStatisticsStockDO> {
    @Query("from IotStatisticsStockDO w where w.parentType =?1 and w.town=?2 ")
    List<IotStatisticsStockDO> findByParentTypeAndTown(String parentType,String town);
}

+ 2 - 3
svr/svr-iot/src/main/java/com/yihu/iot/interceptor/CrosXssFilter.java

@ -1,6 +1,5 @@
package com.yihu.iot.interceptor;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -24,11 +23,11 @@ public class CrosXssFilter implements Filter {
        response.setContentType("text/html;charset=utf-8");
        //sql,xss过滤
        HttpServletRequest httpServletRequest=(HttpServletRequest)request;
        logger.info("CrosXssFilter.......orignal url:{},ParameterMap:{}",httpServletRequest.getRequestURI(), JSONObject.toJSONString(httpServletRequest.getParameterMap()));
//        logger.info("CrosXssFilter.......orignal url:{},ParameterMap:{}",httpServletRequest.getRequestURI(), JSONObject.toJSONString(httpServletRequest.getParameterMap()));
        XssHttpServletRequestWrapper xssHttpServletRequestWrapper=new XssHttpServletRequestWrapper(
                httpServletRequest);
        chain.doFilter(xssHttpServletRequestWrapper, response);
        logger.info("CrosXssFilter..........doFilter url:{},ParameterMap:{}",xssHttpServletRequestWrapper.getRequestURI(), JSONObject.toJSONString(xssHttpServletRequestWrapper.getParameterMap()));
//        logger.info("CrosXssFilter..........doFilter url:{},ParameterMap:{}",xssHttpServletRequestWrapper.getRequestURI(), JSONObject.toJSONString(xssHttpServletRequestWrapper.getParameterMap()));
    }
    @Override
    public void destroy() {

+ 0 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/common/PermissionService.java

@ -1,7 +1,5 @@
package com.yihu.iot.service.common;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.common.BaseLoginLogDao;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import org.apache.commons.lang3.StringUtils;
@ -92,7 +90,6 @@ public class PermissionService {
        String accessToken = this.extractToken(getRequest());
        String sql = "select * from "+getDbName()+".base_login_log a WHERE a.token=? ORDER BY a.create_time desc LIMIT 1";
        logger.info("sql+"+sql);
        List<BaseLoginLogDO> list = jdbcTemplate.query(sql,new Object[]{accessToken},new BeanPropertyRowMapper<>(BaseLoginLogDO.class));
        if(list!=null&&list.size()>0){
            return list.get(0);

+ 37 - 14
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -1,19 +1,25 @@
package com.yihu.iot.service.company;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.company.*;
import com.yihu.iot.dao.company.IotCompanyAppDao;
import com.yihu.iot.dao.company.IotCompanyCertificateChangeRecordDao;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.company.IotCompanyTypeDao;
import com.yihu.iot.dao.platform.IotCompanyAppInterfaceDao;
import com.yihu.iot.dao.platform.IotInterfaceLogDao;
import com.yihu.iot.model.AppServiceCount;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.*;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.company.IotCompanyCertificateChangeRecordDO;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.company.IotCompanyTypeDO;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceLogDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsAppDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
@ -25,8 +31,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @author yeshijie on 2018/1/15.
@ -884,6 +890,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                oldApp.setCompanyId(iotCompany.getId());
                oldApp.setCompanyName(iotCompany.getName());
                oldApp.setSaasId(getCode());
                oldApp.setSecretKey(newApp.getSecretKey());
                iotCompanyAppDao.save(oldApp);
                //修改平台申请接口的应用信息
@ -1177,17 +1184,33 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    }
    public JSONObject getAppService(){
        JSONObject object = new JSONObject();
        String str = "SELECT SUM(b.count) count,b.app_name appName FROM " +
                "(SELECT COUNT(id) count,app_name,interface_name FROM xmiot.iot_interface_log " +
                " WHERE state=0 OR (app_name IS NOT NULL and app_id<>'2c9a80ed72393a3301724abe57ec0032' AND app_id <> 'b5125656570011ec8771005056ab2351') " +
                "GROUP BY app_name,interface_name) b\n" +
                "GROUP BY b.app_name ORDER BY count DESC";
        List<AppServiceCount> counts = jdbcTemplate.query(str,new BeanPropertyRowMapper<>(AppServiceCount.class));
        object.put("appcount",counts.size());
        object.put("sortList",counts.subList(0,3));
        object.put("medicalcount",40);//目前暂无医疗机构接入,默认0家。
        String sql = "select * from iot_statistics_app where type = '1' or type='2' order by num desc";
        List<IotStatisticsAppDO> appDOS = jdbcTempalte.query(sql,new BeanPropertyRowMapper<>(IotStatisticsAppDO.class));
        if(appDOS.size()>0){
            Map<String,List<IotStatisticsAppDO>> listMap = appDOS.stream().collect(Collectors.groupingBy(IotStatisticsAppDO::getType));
            IotStatisticsAppDO appDO = listMap.get("2").get(0);
            object.put("appcount",appDO.getNum());
            object.put("sortList",listMap.get("1"));
            object.put("medicalcount",appDO.getName());
        }else {
            object.put("appcount",0);
            object.put("sortList",new ArrayList<>());
            object.put("medicalcount",40);//目前暂无医疗机构接入,默认0家。
        }
//        String str = "SELECT SUM(b.count) count,b.app_name appName FROM " +
//                "(SELECT COUNT(id) count,app_name,interface_name FROM xmiot.iot_interface_log " +
//                " WHERE state=0 OR (app_name IS NOT NULL and app_id<>'2c9a80ed72393a3301724abe57ec0032' AND app_id <> 'b5125656570011ec8771005056ab2351') " +
//                "GROUP BY app_name,interface_name) b\n" +
//                "GROUP BY b.app_name ORDER BY count DESC";
//        List<AppServiceCount> counts = jdbcTemplate.query(str,new BeanPropertyRowMapper<>(AppServiceCount.class));
//        object.put("appcount",counts.size());
//        object.put("sortList",counts.subList(0,3));
//        object.put("medicalcount",40);//目前暂无医疗机构接入,默认0家。
        return object;
    }

+ 297 - 51
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -5,22 +5,30 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.equipment.IotEquipmentDetailDao;
import com.yihu.iot.dao.statistics.IotStatisticsCommonDao;
import com.yihu.iot.dao.statistics.IotStatisticsStockDao;
import com.yihu.iot.service.analyzer.WlyyIotTzDict;
import com.yihu.iot.service.analyzer.WlyyIotTzDictDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.iot.service.common.PermissionService;
import com.yihu.iot.service.device.IotPatientDeviceService;
import com.yihu.iot.service.equipment.IotEqtDetailService;
import com.yihu.iot.service.label.FigureLabelSerachService;
import com.yihu.iot.service.platform.IotInterfaceLogService;
import com.yihu.iot.util.conceal.ConcealUtil;
import com.yihu.iot.util.excel.HibenateUtils;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsAppDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsCommonDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsRealtimeDO;
import com.yihu.jw.entity.iot.statistics.IotStatisticsStockDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.http.HttpClientUtil;
import io.swagger.annotations.ApiOperation;
import iot.device.IotLocationDataVO;
import iot.device.LocationDataVO;
import org.apache.http.Consts;
import org.apache.http.client.utils.URLEncodedUtils;
@ -28,6 +36,7 @@ import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@ -38,6 +47,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
import static cn.hutool.core.util.ObjectUtil.hasEmpty;
@ -66,7 +76,7 @@ public class MonitorPlatformService {
    @Autowired
    private MyJdbcTemplate myJdbcTemplate;
    @Autowired
    private FigureLabelSerachService figureLabelSerachService;
    private IotStatisticsStockDao iotStatisticsStockDao;
    @Autowired
    private IotEqtDetailService iotEqtDetailService;
    @Autowired
@ -81,6 +91,84 @@ public class MonitorPlatformService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private WlyyIotTzDictDao wlyyIotTzDictDao;
    @Autowired
    private IotStatisticsCommonDao iotStatisticsCommonDao;
    @Autowired
    private JdbcTemplate jdbcTempalte;
    @Value("${spring.profiles}")
    private String springProfiles;
    /**
     * 新的物联网大屏地理搜索
     * @param deviceCommon 设备通用名编码
     * @param page
     * @param size
     * @param use 用途
     * @param combinationMethod 组合方式
     * @param networkTransmission 网络传输
     * @param town 地理区划
     * @return
     */
    public PageEnvelop<IotLocationDataVO> findLocationPage(String name,String deviceCommon, Integer page, Integer size,
                   String use, String combinationMethod, String networkTransmission, String town) {
        String countSql = "select count(*) ";
        String sql = "select * ";
        String fileter = " from wlyy_patient_device_location where del=0 ";
        if(!StringUtils.isEmpty(use)){
            fileter += " and use_code = '"+use+"'";
        }
        if(!StringUtils.isEmpty(combinationMethod)){
            fileter += " and combination_method = '"+combinationMethod+"'";
        }
        if(!StringUtils.isEmpty(networkTransmission)){
            fileter += " and network_transmission = '"+networkTransmission+"'";
        }
        if(!StringUtils.isEmpty(town)&&!"350200".equals(town)){
            fileter += " and town = '"+town+"'";
        }
        if(!StringUtils.isEmpty(deviceCommon)){
            deviceCommon = deviceCommon.replace(",","','");
            fileter += " and device_common in ('"+deviceCommon+"')";
        }
        if(!StringUtils.isEmpty(name)){
            fileter += " and (name like '%"+name+"%' or device_sn like '%"+name+"%')";
        }
        String limit = " limit "+(page-1)*size+","+size;
        Long totalCount = jdbcTemplate.queryForObject(countSql+fileter, Long.class);
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql+fileter+limit);
        List<IotLocationDataVO> locationDataVOList = new ArrayList<>();
        result.forEach(map -> {
            IotLocationDataVO locationDataVO = new IotLocationDataVO();
            JSONObject location = JSONObject.parseObject(map.get("location").toString());
            GeoPoint geoPoint = new GeoPoint(Double.parseDouble(location.get("lat").toString()), Double.parseDouble(location.get("lon").toString()));
            locationDataVO.setId(map.get("id").toString());
            locationDataVO.setName(map.get("name")+"");
            locationDataVO.setDeviceName(map.get("device_name")+"");
            locationDataVO.setIdCard(map.get("idcard")+"");
            locationDataVO.setCategoryCode(map.get("category_code")+"");
            locationDataVO.setDeviceSn(map.get("device_sn")+"");
            locationDataVO.setLocation(geoPoint);
            locationDataVO.setDeviceTime(map.get("device_time")+"");
            locationDataVO.setLabel(map.get("label")+"");
            if(map.get("disease_condition")!=null){
                locationDataVO.setDiseaseCondition(Integer.parseInt(map.get("disease_condition").toString()));
            }else {
                locationDataVO.setDiseaseCondition(0);
            }
            locationDataVO.setCreateTime(map.get("create_time")+"");
            locationDataVO.setPatient(map.get("patient")+"");
            locationDataVO.setDeviceCommon(map.get("device_common")+"");
            locationDataVO.setUseCode(map.get("use_code")+"");
            locationDataVO.setCombinationMethod(map.get("xombination_method")+"");
            locationDataVO.setTown(map.get("town")+"");
            locationDataVO.setNetworkTransmission(map.get("network_transmission")+"");
            locationDataVOList.add(locationDataVO);
        });
        return PageEnvelop.getSuccessListWithPage("获取成功",locationDataVOList,page,size,totalCount);
    }
    /**
     * 获取位置信息
@ -1208,33 +1296,57 @@ public class MonitorPlatformService {
     */
    public JSONObject getBrandsAndManufacturer() {
        try {
            String sql = "select count(DISTINCT A.device_name) as total,A.device_name, IF(A.manufacturer = '健康之路', '福建健康之路信息技术有限公司',  A.manufacturer) manufacturer from (\n" +
                    "select pd.device_name,wd.manufacturer from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
                    "and wd.manufacturer_code is not null and wd.manufacturer_code <>'' and pd.device_name<>'血压计-null' and pd.device_name<>'血糖仪-自助体检一体机'  \n" +
                    "GROUP BY wd.manufacturer_code,pd.device_name\n" +
                    "UNION\n" +
                    "select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name,manufacturer from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
                    ")A\n" +
                    "GROUP BY A.manufacturer\n" +
                    "ORDER BY total desc";
            List<Map<String, Object>> Manufacturers = jdbcTemplate.queryForList(sql);
            JSONObject result = new JSONObject();
            JSONArray arr = JSONArray.parseArray(JSON.toJSONString(Manufacturers));
            result.put("Manufacturers", arr);
            sql = "select count(DISTINCT A.device_name)from (\n" +
                    "select pd.device_name from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
                    "and wd.manufacturer_code is not null and wd.manufacturer_code <>'' and pd.device_name<>'血压计-null' and pd.device_name<>'血糖仪-自助体检一体机' \n" +
                    "GROUP BY wd.manufacturer_code,pd.device_name\n" +
                    "UNION\n" +
                    "select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
                    ")A";
            Integer BrandsCount = jdbcTemplate.queryForObject(sql, Integer.class);
            result.put("Brands", BrandsCount);
            result.put("manufacturerCount", arr.size());
            return result;
            JSONObject object = new JSONObject();
            String sql = "select * from iot_statistics_app where type = '3' or type='4' order by num desc";
            List<IotStatisticsAppDO> appDOS = jdbcTempalte.query(sql,new BeanPropertyRowMapper<>(IotStatisticsAppDO.class));
            if(appDOS.size()>0){
                Map<String,List<IotStatisticsAppDO>> listMap = appDOS.stream().collect(Collectors.groupingBy(IotStatisticsAppDO::getType));
                IotStatisticsAppDO appDO = listMap.get("4").get(0);
                List<IotStatisticsAppDO> appDOList = listMap.get("3");
                JSONArray jsonArray = new JSONArray();
                for (IotStatisticsAppDO app:appDOList){
                    JSONObject json = new JSONObject();
                    json.put("manufacturer",app.getName());
                    json.put("total",app.getNum());
                    jsonArray.add(json);
                }
                object.put("Brands",appDO.getNum());//产品数
                object.put("Manufacturers",jsonArray);
                object.put("manufacturerCount",appDO.getName());
            }else {
                object.put("Brands",0);
                object.put("Manufacturers",new ArrayList<>());
                object.put("manufacturerCount",40);//目前暂无医疗机构接入,默认0家。
            }
            return object;
//            String sql = "select count(DISTINCT A.device_name) as total,A.device_name, IF(A.manufacturer = '健康之路', '福建健康之路信息技术有限公司',  A.manufacturer) manufacturer from (\n" +
//                    "select pd.device_name,wd.manufacturer from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
//                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
//                    "and wd.manufacturer_code is not null and wd.manufacturer_code <>'' and pd.device_name<>'血压计-null' and pd.device_name<>'血糖仪-自助体检一体机'  \n" +
//                    "GROUP BY wd.manufacturer_code,pd.device_name\n" +
//                    "UNION\n" +
//                    "select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name,manufacturer from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
//                    ")A\n" +
//                    "GROUP BY A.manufacturer\n" +
//                    "ORDER BY total desc";
//            List<Map<String, Object>> Manufacturers = jdbcTemplate.queryForList(sql);
//            JSONObject result = new JSONObject();
//            JSONArray arr = JSONArray.parseArray(JSON.toJSONString(Manufacturers));
//            result.put("Manufacturers", arr);
//            sql = "select count(DISTINCT A.device_name)from (\n" +
//                    "select pd.device_name from wlyy.wlyy_patient_device pd,device.wlyy_devices wd\n" +
//                    "where pd.device_sn = wd.device_code and pd.del=0 \n" +
//                    "and wd.manufacturer_code is not null and wd.manufacturer_code <>'' and pd.device_name<>'血压计-null' and pd.device_name<>'血糖仪-自助体检一体机' \n" +
//                    "GROUP BY wd.manufacturer_code,pd.device_name\n" +
//                    "UNION\n" +
//                    "select case device_name when '自助体检一体机' then '健康小屋'  else device_name  end AS device_name from xmiot.iot_equipmet_detail group BY manufacturer_code,device_name\n" +
//                    ")A";
//            Integer BrandsCount = jdbcTemplate.queryForObject(sql, Integer.class);
//
//            result.put("Brands", BrandsCount);
//            result.put("manufacturerCount", arr.size());
//            return result;
        } catch (Exception e) {
            e.printStackTrace();
@ -1242,6 +1354,94 @@ public class MonitorPlatformService {
        }
    }
    //入驻设备管理
    public IotStatisticsStockDO onboardingDeviceManagement(String type,String town){
        IotStatisticsStockDO stockDO;
        try {
            String sql = "select sum(total) total,sum(useing) useing,SUM(stock) stock,SUM(iot_count) iot_count,SUM(lost_count) lost_count, " +
                    "SUM(intervene_count) intervene_count,SUM(issue_count) issue_count,SUM(binding_count) binding_count,SUM(disease_patient_count) disease_patient_count, " +
                    "SUM(disease_patient_device_count) disease_patient_device_count,SUM(disease_patient_use_count) disease_patient_use_count, " +
                    "SUM(fault_count) fault_count from iot_statistics_stock WHERE town = '"+town+"' ";
            if("0".equals(type)){
                sql += " and parent_type = '0' ";
            }else {
                sql += " and type = '"+type+"' ";
            }
            List<IotStatisticsStockDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(IotStatisticsStockDO.class));
            if(list.size()>0){
                stockDO = list.get(0);
                stockDO.setBindingRate(rateLong(stockDO.getBindingCount(),stockDO.getTotal()));
                stockDO.setDiseasePatientDeviceRate(rateLong(stockDO.getDiseasePatientDeviceCount(),stockDO.getDiseasePatientCount()));
                stockDO.setDiseasePatientUseRate(rateLong(stockDO.getDiseasePatientUseCount(),stockDO.getDiseasePatientDeviceCount()));
                stockDO.setFaultRate(rateLong(stockDO.getFaultCount(),stockDO.getTotal()));
                stockDO.setInterveneRate(rateLong(stockDO.getInterveneCount(),stockDO.getTotal()));
                stockDO.setIotRate(rateLong(stockDO.getIotCount(),stockDO.getIssueCount()));
                stockDO.setIssueRate(rateLong(stockDO.getIssueCount(),stockDO.getTotal()));
                stockDO.setLostRate(rateLong(stockDO.getLostCount(),stockDO.getIssueCount()));
                return stockDO;
            }else {
                stockDO = new IotStatisticsStockDO();
                stockDO.setBindingRate("0.00%");
                stockDO.setDiseasePatientDeviceRate("0.00%");
                stockDO.setDiseasePatientUseRate("0.00%");
                stockDO.setFaultRate("0.00%");
                stockDO.setInterveneRate("0.00%");
                stockDO.setIotRate("0.00%");
                stockDO.setIssueRate("0.00%");
                stockDO.setLostRate("0.00%");
                stockDO.setTotal(0l);//总数
                stockDO.setUseing(0l);//使用数
                stockDO.setStock(0l);//库存数
                stockDO.setIotCount(0l);//物联数
                stockDO.setLostCount(0l);//失联数
                stockDO.setInterveneCount(0l);//干预数
                stockDO.setIssueCount(0l);//发放数
                stockDO.setBindingCount(0l);//绑定数
                stockDO.setDiseasePatientCount(0l);//慢病患者数
                stockDO.setDiseasePatientDeviceCount(0l);//慢病患者设备数
                stockDO.setDiseasePatientUseCount(0l);//慢病患者设备使用数
                stockDO.setFaultCount(0l);//设备故障数
            }
        }catch (Exception e){
            e.printStackTrace();
            stockDO = new IotStatisticsStockDO();
        }
        return stockDO;
    }
    /**
     * 计算百分比
     * @param molecule 分子
     * @param denominator 分母
     */
    public String rateLong(Long molecule,Long denominator){
        if(molecule==null||denominator==null){
            return "0.00%";
        }
        if (denominator == 0 && molecule > 0) {
            return "100%";
        } else if (molecule == 0 && denominator == 0) {
            return "0.00%";
        }
        float size = (float) (molecule * 100) / denominator;
        DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
        String filesize = df.format(size);
        return filesize + "%";
    }
    //设备库存、使用中、总备案、物联率、失联率
    public List<Map<String,Object>> getEquipmentStock(){
        List<Map<String,Object>> result = new ArrayList<>();
        try {
            String sql = "SELECT name,type,total,useing,stock from iot_statistics_stock WHERE parent_type = '0' and town = '350200'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            return list;
        }catch (Exception e){
            e.printStackTrace();
        }
        return result;
    }
    /**
     * 谁设备库存、使用中、总备案、物联率、失联率
     *
@ -1457,6 +1657,21 @@ public class MonitorPlatformService {
        }
    }
    //设备组合方式和设备网络传输
    public JSONObject combinationMethodAndWeb(){
        JSONObject json = new JSONObject();
        IotStatisticsCommonDO iotStatisticsCommonDO1 = iotStatisticsCommonDao.findOne("Combination_method1");
        IotStatisticsCommonDO iotStatisticsCommonDO2 = iotStatisticsCommonDao.findOne("Combination_method2");
        JSONObject Combination_method1 = JSONObject.parseObject(iotStatisticsCommonDO1.getContent());
        JSONObject Combination_method2 = JSONObject.parseObject(iotStatisticsCommonDO2.getContent());
        json.put("Combination_method1",Combination_method1);//设备组合方式
        json.put("Combination_method2",Combination_method2);//设备网络传输
        return json;
    }
    public String getRange(int first, int second, int i) {
        if (second == 0 && first > 0) {
            return "100";
@ -1630,7 +1845,49 @@ public class MonitorPlatformService {
    public JSONObject getDeviceData() {
        JSONObject object = new JSONObject();
        //血糖仪数量
        int homeHealthEquipment = 0;//健康监测设备数(血压血糖)
        int homePhysicalSignData = 0;//健康监测设备体征数
        int homeAbnormalSignData = 0;//健康监测设备异常数
        int medicalInstitutionIquipment = 0;//自助服务设备数(药柜)
        int medicalPhysicalSignData = 0;//自助服务设备体征数
        int medicalAbnormalSignData = 0;//自助服务设备异常数
        int hospitalEquipment = 0;//临床医疗设备数(小屋)
        int hospitalPhysicalSignData = 0;//临床医疗设备体征数
        int hospitalAbnormalSignData = 0;//临床医疗设备异常数
        String sql = " select * from iot_statistics_realtime";
        List<IotStatisticsRealtimeDO> realtimeDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(IotStatisticsRealtimeDO.class));
        for (IotStatisticsRealtimeDO realtimeDO:realtimeDOList){
            if("1".equals(realtimeDO.getType())){
                homeHealthEquipment = Integer.parseInt(realtimeDO.getDeviceNum());//健康监测设备(血压血糖)
                homePhysicalSignData = Integer.parseInt(realtimeDO.getSignNum());//
                homeAbnormalSignData = Integer.parseInt(realtimeDO.getAbnormalNum());//
                continue;
            }
            if("2".equals(realtimeDO.getType())){
                medicalInstitutionIquipment = Integer.parseInt(realtimeDO.getDeviceNum());//健康监测设备(血压血糖)
                medicalPhysicalSignData = Integer.parseInt(realtimeDO.getSignNum());//
                medicalAbnormalSignData = Integer.parseInt(realtimeDO.getAbnormalNum());//
                continue;
            }
            if("3".equals(realtimeDO.getType())){
                hospitalEquipment = Integer.parseInt(realtimeDO.getDeviceNum());//健康监测设备(血压血糖)
                hospitalPhysicalSignData = Integer.parseInt(realtimeDO.getSignNum());//
                hospitalAbnormalSignData = Integer.parseInt(realtimeDO.getAbnormalNum());//
                continue;
            }
        }
        object.put("homeHealthEquipment", homeHealthEquipment);
        object.put("homePhysicalSignData", homePhysicalSignData);
        object.put("homeAbnormalSignData", homeAbnormalSignData);
        object.put("medicalInstitutionIquipment", medicalInstitutionIquipment);
        object.put("medicalPhysicalSignData", medicalPhysicalSignData);
        object.put("medicalAbnormalSignData", medicalAbnormalSignData);
        object.put("hospitalEquipment", hospitalEquipment);
        object.put("hospitalPhysicalSignData", hospitalPhysicalSignData);
        object.put("hospitalAbnormalSignData", hospitalAbnormalSignData);
/*        //血糖仪数量
        String bloodGlucosemeterCount = "SELECT COUNT(1) FROM wlyy.wlyy_patient_device WHERE category_code = 1 AND del = 0";
        //血压计数量
        String sphygmomanometerCount = "SELECT COUNT(1) FROM wlyy.wlyy_patient_device WHERE category_code = 2 AND del = 0";
@ -1664,33 +1921,22 @@ public class MonitorPlatformService {
                "or (d.`code`='LowPressure' and (d.`value` not BETWEEN 60.0 and 90))\n" +
                ");";
        Integer gg = jdbcTemplate.queryForObject(abnormalSignDataOfCabin, Integer.class);
        object.put("medicalAbnormalSignData", gg);
        object.put("medicalAbnormalSignData", gg);*/
        return object;
    }
    @Autowired
    private PermissionService permissionService;
    public JSONArray getSearchTags() {
        String sql = "select id,`value` from xmiot.iot_system_dict where dict_name='DEVICE' and (value='组合一体机' or value ='单体征测量仪') and del=1;";
        String sql = "SELECT dict_code code,dict_value name from "+permissionService.getDbName()+".wlyy_hospital_sys_dict WHERE dict_name = 'Device_common_name' and hospital='1' ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        JSONArray result = new JSONArray();
        for (Map<String, Object> map : list) {
            sql = "select `code`,`value` from xmiot.iot_system_dict where dict_name='DEVICE_TYPE' AND del=1 AND code!=10 AND code!=11  AND parent_code='" + map.get("id").toString() + "'";
            StringBuffer buffer = new StringBuffer();
            List<Map<String, Object>> reList = jdbcTemplate.queryForList(sql);
            for (Map<String, Object> reMap : reList) {
                JSONObject tmp = new JSONObject();
                tmp.put("name", reMap.get("value").toString());
                tmp.put("code", reMap.get("code").toString());
                buffer.append("," + reMap.get("code").toString());
                result.add(tmp);
            }
            //组合一体机 单体征测量仪 数据
//            if (org.apache.commons.lang3.StringUtils.isNoneBlank(buffer.toString())) {
//                buffer.deleteCharAt(0);
//                JSONObject tmp = new JSONObject();
//                tmp.put("name", map.get("value").toString());
//                tmp.put("code", buffer.toString());
//                result.add(tmp);
//            }
            JSONObject tmp = new JSONObject();
            tmp.put("name", map.get("name").toString());
            tmp.put("code", map.get("code").toString());
            result.add(tmp);
        }
        return result;
    }
@ -1818,7 +2064,7 @@ public class MonitorPlatformService {
                    JSONObject location = new JSONObject();
                    location.put("lat", Double.valueOf(json.get("lat")));
                    location.put("lon", Double.valueOf(json.get("lng")));
                    String insertSql = "INSERT INTO device.wlyy_patient_device_location(patient,idcard,disease_condition,device_sn,\n" +
                    String insertSql = "INSERT INTO wlyy_patient_device_location(patient,idcard,disease_condition,device_sn,\n" +
                            "device_name,category_code,device_time,create_time,location)\n" +
                            "VALUES('" + map.get("code").toString() + "','" + map.get("idcard").toString() + "','" + map.get("disease_condition").toString() + "','" + map.get("device_sn").toString() + "','" + map.get("device_name") + "',\n" +
                            "'" + map.get("category_code").toString() + "','" + map.get("create_time") + "','" + map.get("create_time").toString() + "','" + location.toJSONString() + "')\n";

+ 86 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoPropertyService.java

@ -0,0 +1,86 @@
package com.yihu.iot.service.product;
import com.yihu.iot.dao.product.IotProductBaseInfoDao;
import com.yihu.iot.dao.product.IotProductBaseInfoPropertyDao;
import com.yihu.jw.entity.iot.product.IotProductBaseInfoDO;
import com.yihu.jw.entity.iot.product.IotProductBaseInfoPropertyDO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoPropertyVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import static cn.hutool.core.util.ObjectUtil.hasEmpty;
/**
 * 类描述:
 *
 * @author 陈鑫
 * @date 2023-05-05 14:35
 **/
@Service
@Transactional(rollbackFor = Exception.class)
public class IotProductBaseInfoPropertyService extends BaseJpaService<IotProductBaseInfoPropertyDO, IotProductBaseInfoPropertyDao> {
    @Autowired
    IotProductBaseInfoPropertyDao iotProductBaseInfoPropertyDao;
    /**
     * 创建数据
     *
     * @param iotProductBaseInfoPropertyVO
     * @return boolean
     * @author cx
     * @date 2023/5/5 15:09
     */
    public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> create(IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO) {
        IotProductBaseInfoPropertyDO iotProductBaseInfoPropertyDO = convertToModel(iotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyDO.class);
        iotProductBaseInfoPropertyDao.save(iotProductBaseInfoPropertyDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update);
    }
    /**
     * 修改数据
     *
     * @param iotProductBaseInfoPropertyVO
     * @return boolean
     * @author cx
     * @date 2023/5/5 15:13
     */
    public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> update(IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO) {
        IotProductBaseInfoPropertyDO iotProductBaseInfoPropertyDO = convertToModel(iotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyDO.class);
        iotProductBaseInfoPropertyDao.save(iotProductBaseInfoPropertyDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update);
    }
    /**
     * 删除数据
     *
     * @param id
     * @return boolean
     * @author cx
     * @date 2023/5/5 15:19
     */
    public boolean del(String id) {
        iotProductBaseInfoPropertyDao.delete(id);
        //判断对象是否存在
        return iotProductBaseInfoPropertyDao.exists(id);
    }
    /**
     * 通过产品id 查找属性
     *
     * @param productId
     * @return IotProductBaseInfoPropertyVO
     * @author cx
     * @date 2023/5/5 16:47
     */
    public IotProductBaseInfoPropertyVO findProductPropertyByProductId(String productId) {
        IotProductBaseInfoPropertyDO res = iotProductBaseInfoPropertyDao.findProductPropertyByProductId(productId);
        return convertToModel(res, IotProductBaseInfoPropertyVO.class);
    }
}

+ 13 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java

@ -13,7 +13,6 @@ import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.omg.CORBA.BAD_CONTEXT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -425,4 +424,17 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,list);
    }
    /**
     * 修改属性
     *
     * @param productId
     * @param property
     * @return boolean
     * @author cx
     * @date 2023/5/5 16:12
     */
    public boolean updateProperty(String productId,String property) {
       return iotProductBaseInfoDao.updateProperty(productId, property);
    }
}

+ 3 - 3
svr/svr-iot/src/main/resources/application.yml

@ -159,7 +159,7 @@ spring:
#    jest:
#      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
  wlyy:
    url: http://ehr.yihu.com/wlyy/
    url: https://ehr.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee62
#hlw:
@ -198,7 +198,7 @@ spring:
#    jest:
#      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
  wlyy:
    url: http://ehr.yihu.com/wlyy/
    url: https://ehr.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee62
#hlw:
@ -238,7 +238,7 @@ spring:
    jest:
      uris: http://172.26.0.190:9200,http://172.26.0.190:9200
  wlyy:
    url: http://ehr.yihu.com/wlyy/
    url: https://ehr.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee62
#hlw:

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

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