Forráskód Böngészése

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

 Conflicts:
	svr/svr-base/src/main/java/com/yihu/jw/base/service/notice/NoticeService.java
	svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
wangzhinan 1 éve
szülő
commit
141e684f11
40 módosított fájl, 1861 hozzáadás és 501 törlés
  1. 3 1
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
  2. 4 0
      business/base-service/src/main/java/com/yihu/jw/user/UserDao.java
  3. 32 0
      common/common-entity/src/main/java/com/yihu/jw/entity/IdEntityWithCreateTime.java
  4. 12 2
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceDO.java
  5. 60 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceUploadRecordDO.java
  6. 123 3
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java
  7. 7 6
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoPropertyDO.java
  8. 4 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  9. 105 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceVO.java
  10. 65 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java
  11. 49 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/WlyyDeviceVO.java
  12. 48 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/WlyyPatientDeviceVO.java
  13. 116 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/patient/PatientInfoVO.java
  14. 70 5
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoPropertyVO.java
  15. 7 2
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/AesEncryptUtils.java
  16. 2 5
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuManageEndpoint.java
  17. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuNoLoginEndpoint.java
  18. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/menu/BaseMenuManageService.java
  19. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/notice/NoticeService.java
  20. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  21. 1 0
      svr/svr-cloud-care/src/main/resources/application.yml
  22. 18 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  23. 40 9
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java
  24. 58 17
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java
  25. 31 15
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/WlyyDeviceController.java
  26. 16 6
      svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java
  27. 36 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/third/ThirdDataInputController.java
  28. 2 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceDao.java
  29. 12 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceUploadRecordDao.java
  30. 3 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoDao.java
  31. 4 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoPropertyDao.java
  32. 85 1
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java
  33. 2 0
      svr/svr-iot/src/main/java/com/yihu/iot/interceptor/XssHttpServletRequestWrapper.java
  34. 153 101
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java
  35. 357 236
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  36. 175 61
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/WlyyDeviceService.java
  37. 113 17
      svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java
  38. 33 7
      svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoPropertyService.java
  39. 7 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java
  40. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml

+ 3 - 1
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -665,7 +665,9 @@ public class FileUploadService {
            type = type.substring(type.lastIndexOf("."),type.length()-1);
        }
        logger.info(type);
        List img = new ArrayList(Arrays.asList("jpeg","bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp","xls","xlsx","text/plain","mp3","mp4","m4v","avi","ogm","wmv","mpg","webm","ogv","mov","asx","mpeg","image/png","amr"));
        List img = new ArrayList(Arrays.asList("jpeg","bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd",
                "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp","xls","xlsx","text/plain","mp3","mp4","m4v","avi",
                "ogm","wmv","mpg","webm","ogv","mov","asx","mpeg","image/png","amr","doc","docx","pdf"));
        if (!img.contains(type)) {
            return false;
        }

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/user/UserDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.user;
import com.yihu.jw.entity.base.user.UserDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
@ -22,4 +23,7 @@ public interface UserDao extends JpaRepository<UserDO, String>, JpaSpecification
    UserDO findByUsername(String username);
    @Query("from UserDO d where d.id = ?1 ")
    UserDO findById(String id);
}

+ 32 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/IdEntityWithCreateTime.java

@ -0,0 +1,32 @@
package com.yihu.jw.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.util.Date;
/**
 * Created by lith on 2019/3/13.
 */
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class IdEntityWithCreateTime extends IdEntity {
    protected Date createTime;
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 12 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceDO.java

@ -2,7 +2,6 @@ package com.yihu.jw.entity.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.util.StringFStringEncryptConverter;
import javax.persistence.Column;
@ -45,7 +44,7 @@ public class IotDeviceDO extends UuidIdentityEntity implements Serializable {
//    private String deviceType;//设备种类
    @Column(name = "device_source")
    private String deviceSource;//设备来源(1采购订单关联,2居民绑定,3管理员新增)
    private String deviceSource;//设备来源(1采购订单关联,2居民绑定,3管理员新增,4 第三方机构上传)
    @Column(name = "supplier_id")
    private String supplierId;//供应商code
@ -101,6 +100,17 @@ public class IotDeviceDO extends UuidIdentityEntity implements Serializable {
    private String updateUser;
    private String updateUserName;
    @Column(name = "device_unique_code")
    private String deviceUniqueCode;//设备唯一码'
    public String getDeviceUniqueCode() {
        return deviceUniqueCode;
    }
    public void setDeviceUniqueCode(String deviceUniqueCode) {
        this.deviceUniqueCode = deviceUniqueCode;
    }
    public enum DeviceStatus {
        normal("正常", "1"),
        scrap("报废", "2"),

+ 60 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceUploadRecordDO.java

@ -0,0 +1,60 @@
package com.yihu.jw.entity.iot.device;
import com.yihu.jw.entity.IdEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by yeshijie on 2023/7/7.
 */
@Entity
@Table(name = "iot_device_upload_record")
public class IotDeviceUploadRecordDO extends IdEntityWithCreateTime {
     private String jsonData;//体征数据
     private String deviceSn;//设备唯一码
     private String categoryCode;//设备类型
     private String hospital;//归属社区
     private Integer status;//状态0 未处理 1已处理
    public String getJsonData() {
        return jsonData;
    }
    public void setJsonData(String jsonData) {
        this.jsonData = jsonData;
    }
    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 String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 123 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java

@ -62,17 +62,137 @@ public class IotPatientDeviceDO extends UuidIdentityEntityWithOperator implement
    private String damageImages;//申请维修附件图片,多个用逗号隔开
    @Column(name = "repair_description")
    private String repairDescription;//维修说明
    @Column(name = "property_name")
    private Integer propertyName; //设备通用名称
    private String 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;//投放位置
    @Column(name = "address")
    private String  address;//居民地址
    @Column(name = "receive_org_code")
    private String  receiveOrgCode;//领用机构code
    @Column(name = "receive_org_name")
    private String  receiveOrgName;//领用机构名称
    @Column(name = "receive_org_contact_name")
    private String  receiveOrgContactName;//领用机构联系人
    @Column(name = "receive_org_contact_tel")
    private String  receiveOrgContactTel;//领用机构电话
    @Column(name = "receive_org_address")
    private String  receiveOrgAddress;//领用机构电话
    @Column(name = "iot_iccid")
    private String  iotIccid;//物联网卡ICCID
    @Column(name = "iot_imsi")
    private String  iotImsi;//物联网卡IMSI
    @Column(name = "device_unique_code")
    private String  deviceUniqueCode;//设备唯一码
    @Column(name = "product_id")
    private String productId;//产品id
    @Column(name = "product_name")
    private String productName;//产品名称
    public String getProductName() {
        return productName;
    }
    public void setProductName(String productName) {
        this.productName = productName;
    }
    public String getProductId() {
        return productId;
    }
    public void setProductId(String productId) {
        this.productId = productId;
    }
    public String getDeviceUniqueCode() {
        return deviceUniqueCode;
    }
    public void setDeviceUniqueCode(String deviceUniqueCode) {
        this.deviceUniqueCode = deviceUniqueCode;
    }
    public String getIotIccid() {
        return iotIccid;
    }
    public void setIotIccid(String iotIccid) {
        this.iotIccid = iotIccid;
    }
    public String getIotImsi() {
        return iotImsi;
    }
    public void setIotImsi(String iotImsi) {
        this.iotImsi = iotImsi;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getReceiveOrgCode() {
        return receiveOrgCode;
    }
    public void setReceiveOrgCode(String receiveOrgCode) {
        this.receiveOrgCode = receiveOrgCode;
    }
    public String getReceiveOrgName() {
        return receiveOrgName;
    }
    public void setReceiveOrgName(String receiveOrgName) {
        this.receiveOrgName = receiveOrgName;
    }
    public String getReceiveOrgContactName() {
        return receiveOrgContactName;
    }
    public void setReceiveOrgContactName(String receiveOrgContactName) {
        this.receiveOrgContactName = receiveOrgContactName;
    }
    public String getReceiveOrgContactTel() {
        return receiveOrgContactTel;
    }
    public void setReceiveOrgContactTel(String receiveOrgContactTel) {
        this.receiveOrgContactTel = receiveOrgContactTel;
    }
    public String getReceiveOrgAddress() {
        return receiveOrgAddress;
    }
    public void setReceiveOrgAddress(String receiveOrgAddress) {
        this.receiveOrgAddress = receiveOrgAddress;
    }
    public String getSaasId() {
        return saasId;
@ -253,11 +373,11 @@ public class IotPatientDeviceDO extends UuidIdentityEntityWithOperator implement
        this.repairDescription = repairDescription;
    }
    public Integer getPropertyName() {
    public String getPropertyName() {
        return propertyName;
    }
    public void setPropertyName(Integer propertyName) {
    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }

+ 7 - 6
common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoPropertyDO.java

@ -16,14 +16,15 @@ import java.io.Serializable;
@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 = "device_use")
    private String deviceUse;
    @Column(name = "network")
    private String network;
    @Column(name = "location")
@ -55,12 +56,12 @@ public class IotProductBaseInfoPropertyDO extends UuidIdentityEntityWithOperator
        this.combination = combination;
    }
    public String getUse() {
        return use;
    public String getDeviceUse() {
        return deviceUse;
    }
    public void setUse(String use) {
        this.use = use;
    public void setDeviceUse(String deviceUse) {
        this.deviceUse = deviceUse;
    }
    public String getNetwork() {

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

@ -212,6 +212,9 @@ public class IotRequestMapping {
        public static final String getOverhaulListByPatientDeviceId = "getOverhaulListByPatientDeviceId";
        public static final String delOverhaulByPatientDeviceId = "delOverhaulByPatientDeviceId";
        public static final String updateOverhaulStatusById = "updateOverhaulStatusById";
        //居民信息
        public static final String findPatientInfo = "findPatientInfo";
    }
@ -246,6 +249,7 @@ public class IotRequestMapping {
        public static final String api_queryPage = "queryDevicePage";
        public static final String api_getList = "getDeviceList";
        public static final String api_findByDeviceSn = "findByDeviceSn";
        public static final String findFreeDevice = "findFreeDevice";//根据产品id获取一个空闲设备
        //设备库存
        public static final String getDeviceInventoryList = "getDeviceInventoryList";

+ 105 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceVO.java

@ -3,6 +3,7 @@ package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoPropertyVO;
import com.yihu.jw.restmodel.iot.product.IotProductDataTransmissionVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -75,6 +76,30 @@ public class IotDeviceVO extends BaseVO implements Serializable {
    private String categoryCode;//设备类型标识
    @ApiModelProperty("设备类型名称")
    private String categoryName;//设备类型名称
    @ApiModelProperty("产品属性")
    private IotProductBaseInfoPropertyVO productBaseInfoPropertyVO;
    @ApiModelProperty("设备通用名")
    private String propertyName;
    @ApiModelProperty("组合方式")
    private String propertyCombination;
    @ApiModelProperty("用途")
    private String propertyUse;
    @ApiModelProperty("网络传输")
    private String propertyNetwork;
    @ApiModelProperty("投放位置")
    private String propertyLocation;
    @ApiModelProperty("数据采集字典")
    private String propertyDataAcquisitionDict;
    @ApiModelProperty("物联网卡ICCID")
    private String  iotIccid;
    @ApiModelProperty("物联网卡IMSI")
    private String  iotImsi;
    @ApiModelProperty("sim卡")
    private String sim;
    public String getName() {
        return name;
    }
@ -290,4 +315,84 @@ public class IotDeviceVO extends BaseVO implements Serializable {
    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
    public IotProductBaseInfoPropertyVO getProductBaseInfoPropertyVO() {
        return productBaseInfoPropertyVO;
    }
    public void setProductBaseInfoPropertyVO(IotProductBaseInfoPropertyVO productBaseInfoPropertyVO) {
        this.productBaseInfoPropertyVO = productBaseInfoPropertyVO;
    }
    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;
    }
    public String getPropertyDataAcquisitionDict() {
        return propertyDataAcquisitionDict;
    }
    public void setPropertyDataAcquisitionDict(String propertyDataAcquisitionDict) {
        this.propertyDataAcquisitionDict = propertyDataAcquisitionDict;
    }
    public String getIotIccid() {
        return iotIccid;
    }
    public void setIotIccid(String iotIccid) {
        this.iotIccid = iotIccid;
    }
    public String getIotImsi() {
        return iotImsi;
    }
    public void setIotImsi(String iotImsi) {
        this.iotImsi = iotImsi;
    }
    public String getSim() {
        return sim;
    }
    public void setSim(String sim) {
        this.sim = sim;
    }
}

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

@ -67,6 +67,7 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    private String sim;
    @ApiModelProperty("领用协议,多个用逗号隔开")
    private String imgs;
    @ApiModelProperty("设备通用名")
    private String propertyName;
    @ApiModelProperty("组合方式")
@ -77,6 +78,62 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    private String propertyNetwork;
    @ApiModelProperty("投放位置")
    private String propertyLocation;
    @ApiModelProperty("数据采集字典")
    private String propertyDataAcquisitionDict;
    @ApiModelProperty("物联网卡ICCID")
    private String  iotIccid;
    @ApiModelProperty("物联网卡IMSI")
    private String  iotImsi;
    @ApiModelProperty("设备唯一码")
    private String  deviceUniqueCode;
    @ApiModelProperty(name = "product_id")
    private String productId;//产品id
    @ApiModelProperty(name = "product_name")
    private String productName;//产品名称
    public String getProductName() {
        return productName;
    }
    public void setProductName(String productName) {
        this.productName = productName;
    }
    public String getProductId() {
        return productId;
    }
    public void setProductId(String productId) {
        this.productId = productId;
    }
    public String getDeviceUniqueCode() {
        return deviceUniqueCode;
    }
    public void setDeviceUniqueCode(String deviceUniqueCode) {
        this.deviceUniqueCode = deviceUniqueCode;
    }
    public String getIotImsi() {
        return iotImsi;
    }
    public void setIotImsi(String iotImsi) {
        this.iotImsi = iotImsi;
    }
    public String getIotIccid() {
        return iotIccid;
    }
    public void setIotIccid(String iotIccid) {
        this.iotIccid = iotIccid;
    }
    public String getPatient() {
        return patient;
@ -325,4 +382,12 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    public void setPropertyLocation(String propertyLocation) {
        this.propertyLocation = propertyLocation;
    }
    public String getPropertyDataAcquisitionDict() {
        return propertyDataAcquisitionDict;
    }
    public void setPropertyDataAcquisitionDict(String propertyDataAcquisitionDict) {
        this.propertyDataAcquisitionDict = propertyDataAcquisitionDict;
    }
}

+ 49 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/WlyyDeviceVO.java

@ -2,6 +2,7 @@ package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ -44,6 +45,14 @@ public class WlyyDeviceVO {
    private String neighborhoodCommitteeCode;//居委会code
    private String neighborhoodCommitteeName;//居委会name
    //补充字段
    private String propertyName;//设备通用名
    private String propertyCombination;//组合方式
    private String propertyUse;//用途
    private String propertyNetwork;//网络传输
    private String propertyLocation;//投放位置
    /** default constructor */
    public WlyyDeviceVO() {
    }
@ -70,6 +79,46 @@ public class WlyyDeviceVO {
        this.applicantMail = applicantMail;
    }
    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;
    }
    public Long getId() {
        return id;
    }

+ 48 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/WlyyPatientDeviceVO.java

@ -1,6 +1,7 @@
package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ -31,6 +32,13 @@ public class WlyyPatientDeviceVO {
	private String iccid;//设备物联卡iccid
	private String imsi;//设备物联卡imsi
	private String manufacturer;//厂家名称
	private String propertyName;//设备通用名
	private String propertyCombination;//组合方式
	private String propertyUse;//用途
	private String propertyNetwork;//网络传输
	private String propertyLocation;//投放位置
	
	public Integer getId() {
		return id;
@ -200,4 +208,44 @@ public class WlyyPatientDeviceVO {
	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}
	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;
	}
}

+ 116 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/patient/PatientInfoVO.java

@ -0,0 +1,116 @@
package com.yihu.jw.restmodel.iot.patient;
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 java.io.Serializable;
/**
 * 居民信息
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "居民信息", description = "居民信息")
public class PatientInfoVO extends BaseVO implements Serializable {
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民姓名")
    private String patientName;
    @ApiModelProperty("居民身份证")
    private String idcard;
    @ApiModelProperty("家庭地址")
    private String address;
    @ApiModelProperty("居民联系方式")
    private String tel;
    @ApiModelProperty("签约医生code")
    private String doctor;
    @ApiModelProperty("签约医生code")
    private String doctorName;
    @ApiModelProperty("签约社区code")
    private String hospital;
    @ApiModelProperty("签约社区code")
    private String hospitalName;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
}

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

@ -17,21 +17,86 @@ import java.io.Serializable;
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品属性表")
public class IotProductBaseInfoPropertyVO extends BaseVO implements Serializable {
    @ApiModelProperty("id")
    private String id;
    @ApiModelProperty("产品id")
    private String productId;
    @ApiModelProperty("设备通用名")
    private String name;
    private String nameCode;
    @ApiModelProperty("组合方式")
    private String combination;
    private String combinationCode;
    @ApiModelProperty("用途")
    private String use;
    private String deviceUse;
    private String deviceUseCode;
    @ApiModelProperty("网络传输")
    private String network;
    private String networkCode;
    @ApiModelProperty("投放位置")
    private String location;
    private String locationCode;
    @ApiModelProperty("数据采集字典")
    private String dictionaries;
    public String getNameCode() {
        return nameCode;
    }
    public void setNameCode(String nameCode) {
        this.nameCode = nameCode;
    }
    public String getCombinationCode() {
        return combinationCode;
    }
    public void setCombinationCode(String combinationCode) {
        this.combinationCode = combinationCode;
    }
    public String getDeviceUseCode() {
        return deviceUseCode;
    }
    public void setDeviceUseCode(String deviceUseCode) {
        this.deviceUseCode = deviceUseCode;
    }
    public String getNetworkCode() {
        return networkCode;
    }
    public void setNetworkCode(String networkCode) {
        this.networkCode = networkCode;
    }
    public String getLocationCode() {
        return locationCode;
    }
    public void setLocationCode(String locationCode) {
        this.locationCode = locationCode;
    }
    @Override
    public String getId() {
        return id;
    }
    @Override
    public void setId(String id) {
        this.id = id;
    }
    public String getProductId() {
        return productId;
    }
@ -56,12 +121,12 @@ public class IotProductBaseInfoPropertyVO extends BaseVO implements Serializable
        this.combination = combination;
    }
    public String getUse() {
        return use;
    public String getDeviceUse() {
        return deviceUse;
    }
    public void setUse(String use) {
        this.use = use;
    public void setDeviceUse(String deviceUse) {
        this.deviceUse = deviceUse;
    }
    public String getNetwork() {

+ 7 - 2
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/AesEncryptUtils.java

@ -67,12 +67,17 @@ public class AesEncryptUtils {
        map.put("idcard","350322198812052545");
        map.put("price","1");
        map.put("type","1");*/
        String content = "{\"idcard\":\"350322198812052545\",\"price\":\"1\",\"type\":\"1\"}";
        System.out.println("加密前:" + content);
 
        String encrypt = encrypt(content, KEY);
        System.out.println("加密后:" + encrypt);
 
        /**
         * WibZYHSxGPdkw8z37G/kyZLO6PwBxDzQBbTZig+m/gBTsvLSoVgp2fgf4fUgenTMfTxbZMbGfrQI969ZpS2Esg==
         */
        String decrypt = decrypt(encrypt, KEY);
        System.out.println("解密后:" + decrypt);
    }

+ 2 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuManageEndpoint.java

@ -1,8 +1,6 @@
package com.yihu.jw.base.endpoint.menu;
import com.yihu.jw.base.service.menu.BaseMenuManageService;
import com.yihu.jw.base.service.role.RoleMenuService;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.base.service.menu.BaseMenuManage1Service;
import com.yihu.jw.entity.base.menu.BaseLinkDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuShowDO;
@ -12,7 +10,6 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -26,7 +23,7 @@ public class BaseMenuManageEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseMenuManageService menuService;
    private BaseMenuManage1Service menuService;
    @PostMapping(value = BaseRequestMapping.MenuDict.deleteMenuDict)
    @ApiOperation(value = "删除菜单")
    public Envelop deleteMenuDict(

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuNoLoginEndpoint.java

@ -1,7 +1,7 @@
package com.yihu.jw.base.endpoint.menu;
import com.yihu.jw.base.service.article.KnowledgeArticleService;
import com.yihu.jw.base.service.menu.BaseMenuManageService;
import com.yihu.jw.base.service.menu.BaseMenuManage1Service;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
@Api(value = "首页菜单管理免登录接口", description = "首页菜单管理免登录接口", tags = {"基础服务 - 首页菜单管理免登录接口"})
public class BaseMenuNoLoginEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseMenuManageService menuService;
    private BaseMenuManage1Service menuService;
    @Autowired
    private KnowledgeArticleService knowledgeArticleService;
    @GetMapping(value = BaseRequestMapping.MenuNologin.findAllMenu)

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/menu/BaseMenuManageService.java

@ -26,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@Service
public class BaseMenuManageService {
public class BaseMenuManage1Service {
    @Autowired
    private BaseMenuDictDao baseMenuDictDao;
    @Autowired

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/notice/NoticeService.java

@ -7,6 +7,7 @@ import com.yihu.jw.base.util.delay.DelayService;
import com.yihu.jw.base.util.delay.Notice;
import com.yihu.jw.base.util.delay.OnDelayedListener;
import com.yihu.jw.base.util.delay.RedisLock;
import com.yihu.jw.base.util.threadPool.ThreadPoolUtil;
import com.yihu.jw.entity.base.notice.NoticeDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.base.user.UserDO;

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -9,6 +9,9 @@ import com.yihu.jw.base.dao.equipment.WlyyUserEquipmentDao;
import com.yihu.jw.base.dao.role.BaseRoleMenuDao;
import com.yihu.jw.base.dao.role.RoleDao;
import com.yihu.jw.base.dao.saas.SaasDao;
import com.yihu.jw.base.service.org.BaseOrgUserService;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.service.org.*;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;

+ 1 - 0
svr/svr-cloud-care/src/main/resources/application.yml

@ -212,6 +212,7 @@ spring:
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:

+ 18 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -2420,6 +2420,24 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findByIdcardAndDel(doctorIdcard);
        if (baseDoctorDO!=null){
            doctor = baseDoctorDO.getId();
        }else {
            result.put("imgCount",0);//图文复诊数量
            result.put("imgTotal",0);//图文复诊总数量
            result.put("videoCount",0);//视频复诊数量
            result.put("videoTotal",0);//视频复诊总数量
            result.put("xtCount",0);//协同门诊候诊数量
            result.put("xtTotal",0);//协同门诊候诊总数量
            result.put("imgConsultCount",0);//图文咨询数量
            result.put("imgConsultTotal",0);//图文咨询总数量
            result.put("videoConsultCount",0);//视频咨询数量
            result.put("videoConsultTotal",0);//视频咨询总数量
            result.put("homeConsultCount",0);//家医咨询数量
            result.put("homeConsultTotal",0);//家医咨询总数量
            result.put("zjUnreadMessageCount",0);//专家咨询未读数
            if ("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
                result.put("doorServiceCount",0);//上门服务数量
            }
            return success("请求成功",result);
        }
        logger.info("action:doctorReviewConsultCount--start:doctor"+doctor);
        result.put("imgCount",prescriptionService.getWaitVideoCount(doctor,"1","1",wxId));//图文复诊数量

+ 40 - 9
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java

@ -4,13 +4,16 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.iot.dao.device.IotDeviceImportRecordDao;
import com.yihu.iot.dao.product.IotProductBaseInfoPropertyDao;
import com.yihu.iot.service.device.IotDeviceService;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceImportRecordDO;
import com.yihu.jw.entity.iot.product.IotProductBaseInfoPropertyDO;
import com.yihu.jw.restmodel.iot.common.ExistVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportRecordVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoPropertyVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -37,7 +40,8 @@ public class IotDeviceController extends EnvelopRestEndpoint {
    private Logger logger = LoggerFactory.getLogger(IotDeviceController.class);
    @Autowired
    private IotDeviceService iotDeviceService;
    @Autowired
    private IotProductBaseInfoPropertyDao productBaseInfoPropertyDao;
    @Autowired
@ -273,21 +277,47 @@ public class IotDeviceController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.Device.api_findByDeviceSn)
    @ApiOperation(value = "根据sn查找设备", notes = "根据sn查找设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findByDeviceSn(@ApiParam(name = "deviceSn", value = "设备sn码")
                                                           @RequestParam(value = "deviceSn", required = true) String deviceSn,
                                                               @ApiParam(name = "productId", value = "产品id")
                                                               @RequestParam(value = "productId", required = false) String productId,
                                                               @ApiParam(name = "hospital", value = "单位")
                                                                   @RequestParam(value = "hospital", required = false) String hospital
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findByDeviceSn(
            @ApiParam(name = "deviceSn", value = "设备sn码") @RequestParam(value = "deviceSn", required = false) String deviceSn,
            @ApiParam(name = "productId", value = "产品id") @RequestParam(value = "productId", required = false) String productId,
            @ApiParam(name = "hospital", value = "单位") @RequestParam(value = "hospital", required = false) String hospital,
            @ApiParam(name = "deviceUniqueCode", value = "设备唯一码") @RequestParam(value = "deviceUniqueCode", required = false) String deviceUniqueCode
    ) {
        try {
            IotDeviceDO iotDeviceDO;
            IotDeviceDO iotDeviceDO =null;
            if(StringUtils.isNotEmpty(hospital)){
                iotDeviceDO = iotDeviceService.findDeviceBySn(deviceSn,productId,hospital);
            }else{
                iotDeviceDO = iotDeviceService.findByDeviceSn(deviceSn);
                if (StringUtils.isNotBlank(deviceSn)){
                    iotDeviceDO = iotDeviceService.findByDeviceSn(deviceSn);
                }
                if (StringUtils.isNotBlank(deviceUniqueCode)){
                    iotDeviceDO = iotDeviceService.findByDeviceUniqueCode(deviceUniqueCode);
                }
            }
            IotDeviceVO iotDeviceVO = convertToModel(iotDeviceDO,IotDeviceVO.class);
            if(iotDeviceDO!=null&&org.apache.commons.lang3.StringUtils.isNotBlank(iotDeviceDO.getProductId())){
                IotProductBaseInfoPropertyDO propertyDO = productBaseInfoPropertyDao.findProductPropertyByProductId(iotDeviceDO.getProductId());
                IotProductBaseInfoPropertyVO propertyVO = convertToModel(propertyDO,IotProductBaseInfoPropertyVO.class);
                iotDeviceVO.setProductBaseInfoPropertyVO(propertyVO);
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_find, iotDeviceVO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = IotRequestMapping.Device.findFreeDevice)
    @ApiOperation(value = "根据sn查找设备", notes = "根据sn查找设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findFreeDevice(
            @ApiParam(name = "productId", value = "产品id") @RequestParam(value = "productId", required = false) String productId,
            @ApiParam(name = "deviceSn", value = "设备sn码") @RequestParam(value = "deviceSn", required = false) String deviceSn
    ) {
        try {
            IotDeviceDO iotDeviceDO = iotDeviceService.findFreeDevice(productId,deviceSn);
            IotDeviceVO iotDeviceVO = convertToModel(iotDeviceDO,IotDeviceVO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_find, iotDeviceVO);
        } catch (Exception e) {
            e.printStackTrace();
@ -295,6 +325,7 @@ public class IotDeviceController extends EnvelopRestEndpoint {
        }
    }
    /*@PostMapping(value = IotRequestMapping.Device.uploadDeviceInfo)
    @ApiOperation(value = "导入设备sn码相关信息", notes = "导入设备sn码相关信息")
    public MixEnvelop<IotDeviceImportVO, IotDeviceImportVO> uploadStream(@ApiParam(value = "文件", required = true)

+ 58 - 17
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java

@ -1,8 +1,14 @@
package com.yihu.iot.controller.device;
import com.alibaba.fastjson.JSON;
import com.yihu.iot.service.device.IotPatientDeviceService;
import com.yihu.iot.service.label.FigureLabelSerachService;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.restmodel.iot.patient.PatientInfoVO;
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.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
@ -12,6 +18,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import iot.device.LocationDataVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;
@ -291,6 +298,10 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 设备发放
     * svr-iot/patientDevice/createPatientDevice
     */
    @PostMapping(value = IotRequestMapping.PatientDevice.createPatientDevice)
    @ApiOperation(value = "设备发放", notes = "设备发放")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> createPatientDevice(@ApiParam(name = "jsonData", value = "", defaultValue = "")
@ -306,6 +317,10 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.delPatientDevice)
    @ApiOperation(value = "设备回收", notes = "设备回收")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> delPatientDevice(@ApiParam(name = "id", value = "居民设备id", defaultValue = "")
@ -408,27 +423,32 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 表单的list
     */
    @GetMapping(value = IotRequestMapping.PatientDevice.getPatientDeviceList)
    @ApiOperation(value = "获取居民设备发放和回收列表", notes = "获取居民设备发放和回收列表")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> getDelPatientDeviceList(
            @ApiParam(name = "hospitalName", value = "机构名称", defaultValue = "")
            @RequestParam(value = "hospitalName", required = false) String hospitalName,
            @ApiParam(name = "deviceSn", value = "sn码", defaultValue = "")
            @RequestParam(value = "deviceSn", required = false) String deviceSn,
            @ApiParam(name = "deviceName", value = "设备名称", defaultValue = "")
            @RequestParam(value = "deviceName", required = false) String deviceName,
            @ApiParam(name = "categoryCode", value = "设备类型标识")
            @RequestParam(value = "categoryCode", required = false) String categoryCode,
            @ApiParam(name = "patientName", value = "居民姓名")
            @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(name = "isDel", value = "是否是设备回收列表(1是 0否,设备发放列表)")
            @RequestParam(value = "isDel", required = false) Integer isDel,
            @ApiParam(name = "page", value = "第几页", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页记录数")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
            @ApiParam(name = "hospitalName", value = "机构名称", defaultValue = "") @RequestParam(value = "hospitalName", required = false) String hospitalName,
            @ApiParam(name = "deviceSn", value = "sn码", defaultValue = "") @RequestParam(value = "deviceSn", required = false) String deviceSn,
            @ApiParam(name = "deviceName", value = "设备名称", defaultValue = "") @RequestParam(value = "deviceName", required = false) String deviceName,
            @ApiParam(name = "categoryCode", value = "设备类型标识") @RequestParam(value = "categoryCode", required = false) String categoryCode,
            @ApiParam(name = "patientName", value = "居民姓名") @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(name = "isDel", value = "是否是设备回收列表(1是 0否,设备发放列表)") @RequestParam(value = "isDel", required = false) Integer isDel,
            //补充查询
            @ApiParam(name = "propertyName", value = "设备通用名") @RequestParam(value = "propertyName", required = false) String propertyName,
            @ApiParam(name = "propertyCombination", value = "组合方式") @RequestParam(value = "propertyCombination", required = false) String propertyCombination,
            @ApiParam(name = "propertyUse", value = "用途") @RequestParam(value = "propertyUse", required = false) String propertyUse,
            @ApiParam(name = "propertyNetwork", value = "网络传输") @RequestParam(value = "propertyNetwork", required = false) String propertyNetwork,
            @ApiParam(name = "propertyLocation", value = "投放位置") @RequestParam(value = "propertyLocation", required = false) String propertyLocation,
            @ApiParam(name = "deviceStatus", value = "设备状态") @RequestParam(value = "deviceStatus", required = false) String deviceStatus,
            @ApiParam(name = "page", value = "第几页", defaultValue = "1") @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页记录数") @RequestParam(value = "pageSize", required = false) Integer pageSize
    ) {
        try {
            return iotPatientDeviceService.getPatientDeviceList(deviceSn, deviceName, categoryCode, patientName,hospitalName, isDel, page, pageSize);
            return iotPatientDeviceService.getPatientDeviceList(deviceSn, deviceName, categoryCode, patientName,hospitalName, isDel, page, pageSize,
                    propertyName,propertyCombination,propertyUse,propertyNetwork,propertyLocation,deviceStatus);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
@ -447,4 +467,25 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
            return MixEnvelop.getError("删除失败");
        }
    }
    /**
     * 获取居民信息
     * PatientInfoVO
     */
    @GetMapping(value = IotRequestMapping.PatientDevice.findPatientInfo)
    @ApiOperation(value = "获取居民信息", notes = "获取居民信息")
    public MixEnvelop<PatientInfoVO, PatientInfoVO> findPatientInfo(
            @ApiParam(name = "key", value = "身份证电话姓名") @RequestParam(value = "key", required = false) String key
    ) {
        try {
            List<PatientInfoVO> list = iotPatientDeviceService.findPatientInfo(key);
            return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_find, list);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
}

+ 31 - 15
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/WlyyDeviceController.java

@ -1,28 +1,21 @@
package com.yihu.iot.controller.device;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.dao.message.IotMessageDao;
import com.yihu.iot.service.device.IotPatientDeviceService;
import com.yihu.iot.service.device.WlyyDeviceService;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.patient.Message;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.patient.PatientDevice;
import com.yihu.jw.restmodel.iot.device.DeviceHealthIndexVO;
import com.yihu.jw.restmodel.iot.device.WlyyDeviceVO;
import com.yihu.jw.restmodel.iot.device.WlyyPatientDeviceVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * Created by yeshijie on 2020/7/29.
@ -37,13 +30,20 @@ public class WlyyDeviceController extends BaseController {
    @RequestMapping(value="deviceList",method = RequestMethod.GET)
    @ApiOperation("设备管理")
    public MixEnvelop<WlyyDeviceVO, WlyyDeviceVO> searchList(
    public Envelop searchList(
            @RequestParam(value = "deviceName",required = false)String deviceName,
            @RequestParam(value = "deviceCode",required = false) String deviceCode,
            @RequestParam(value = "orgName",required = false)String orgName,
            @RequestParam(value = "linkman",required = false) String linkman,
            @RequestParam(value = "page",required = false)Integer page,
            @RequestParam(value = "size",required = false)Integer size){
            @RequestParam(value = "size",required = false)Integer size,
            //补充查询
            @ApiParam(name = "propertyName", value = "设备通用名") @RequestParam(value = "propertyName", required = false) String propertyName,
            @ApiParam(name = "propertyCombination", value = "组合方式") @RequestParam(value = "propertyCombination", required = false) String propertyCombination,
            @ApiParam(name = "propertyUse", value = "用途") @RequestParam(value = "propertyUse", required = false) String propertyUse,
            @ApiParam(name = "propertyNetwork", value = "网络传输") @RequestParam(value = "propertyNetwork", required = false) String propertyNetwork,
            @ApiParam(name = "propertyLocation", value = "投放位置") @RequestParam(value = "propertyLocation", required = false) String propertyLocation
            ){
        try {
            if(page==null){
                page =1;
@ -51,7 +51,11 @@ public class WlyyDeviceController extends BaseController {
            if(size==null){
                size = 10;
            }
            return wlyyDeviceService.searchDeviceList(deviceName, deviceCode, orgName, linkman, page, size);
            return wlyyDeviceService.searchDeviceList(
                    deviceName, deviceCode, orgName, linkman, page, size,
                    propertyName,propertyCombination,propertyUse,propertyNetwork,propertyLocation
            );
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
@ -60,7 +64,7 @@ public class WlyyDeviceController extends BaseController {
    @RequestMapping(value = "findDeviceById",method = RequestMethod.GET)
    @ApiOperation("根据设备id查找设备管理")
    public MixEnvelop<WlyyDeviceVO,WlyyDeviceVO> getDevice(@RequestParam(value = "id") Long id){
    public Envelop getDevice(@RequestParam(value = "id") String id){
        try {
            return  wlyyDeviceService.findById(id);
        }catch (Exception e){
@ -85,7 +89,6 @@ public class WlyyDeviceController extends BaseController {
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "size",required = false) Integer size){
        try{
            Page<DeviceHealthIndexVO> deviceHealthIndexes = wlyyDeviceService.searchList(deviceSn,date, idcard, userName, indexType,page, size,indexTypeMin1, indexTypeMax1, indexTypeMin2,indexTypeMax2,doctorName);
            return write(200,"操作成功",page,size,deviceHealthIndexes);
        }catch (Exception ex){
@ -103,12 +106,25 @@ public class WlyyDeviceController extends BaseController {
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @RequestParam(value = "hospitalName",required = false) String hospitalName,
            //补充查询
            @ApiParam(name = "propertyName", value = "设备通用名") @RequestParam(value = "propertyName", required = false) String propertyName,
            @ApiParam(name = "propertyCombination", value = "组合方式") @RequestParam(value = "propertyCombination", required = false) String propertyCombination,
            @ApiParam(name = "propertyUse", value = "用途") @RequestParam(value = "propertyUse", required = false) String propertyUse,
            @ApiParam(name = "propertyNetwork", value = "网络传输") @RequestParam(value = "propertyNetwork", required = false) String propertyNetwork,
            @ApiParam(name = "propertyLocation", value = "投放位置") @RequestParam(value = "propertyLocation", required = false) String propertyLocation,
            @RequestParam(value = "page") Integer page,
            @RequestParam(value = "size") Integer size) {
        try {
            String hospitalCode = "";
            List<WlyyPatientDeviceVO> patientDevices = wlyyDeviceService.searchListNew(deviceName, categoryCode, deviceSn, userName, doctorName, hospitalName, hospitalCode, page, size);
            Long totalcount = wlyyDeviceService.getCountSearchListNew(deviceName, categoryCode, deviceSn, userName, doctorName, hospitalName, hospitalCode);
            //详情
            List<WlyyPatientDeviceVO> patientDevices = wlyyDeviceService.searchListNew(
                    deviceName, categoryCode, deviceSn, userName, doctorName, hospitalName, hospitalCode, page, size,
                    propertyName,propertyCombination,propertyUse,propertyNetwork,propertyLocation);
            //数量
            Long totalcount = wlyyDeviceService.getCountSearchListNew(
                    deviceName, categoryCode, deviceSn, userName, doctorName, hospitalName, hospitalCode,
                    propertyName,propertyCombination,propertyUse,propertyNetwork,propertyLocation);
            return write(200, "操作成功", page, size, totalcount, patientDevices);
        } catch (Exception ex) {
            error(ex);

+ 16 - 6
svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -1,12 +1,13 @@
package com.yihu.iot.controller.product;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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;
@ -145,9 +146,9 @@ public class IotProductController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Product.addProduct)
    @ApiOperation(value = "创建产品", notes = "创建产品")
    public MixEnvelop<IotProductVO, IotProductVO> addProduct(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
    public MixEnvelop<IotProductVO, IotProductVO> addProduct(String jsonData) {
        try {
            JSONObject jsonObject = JSON.parseObject(jsonData);
            IotProductVO iotProductVO = toEntity(jsonData, IotProductVO.class);
           return iotProductBaseInfoService.addProduct(iotProductVO);
@ -236,6 +237,9 @@ 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 = "[]")
@ -252,7 +256,8 @@ public class IotProductController extends EnvelopRestEndpoint {
        }
    }
    @ApiOperation(value = "修改产品熟悉 通过id")
    @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 {
@ -264,9 +269,10 @@ public class IotProductController extends EnvelopRestEndpoint {
        }
    }
    @ApiOperation(value = "修改产品熟悉 通过id")
    @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){
    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);
@ -276,4 +282,8 @@ public class IotProductController extends EnvelopRestEndpoint {
        }
    }
}

+ 36 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/third/ThirdDataInputController.java

@ -7,9 +7,11 @@ import com.yihu.iot.datainput.service.DataInputService;
import com.yihu.iot.datainput.service.DataSearchService;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.DataRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.entity.ServiceException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -29,6 +31,40 @@ public class ThirdDataInputController {
    @Autowired
    private DataSearchService dataSearchService;
    /**************************社区数据删除**********************************************/
    @PostMapping(value = "deviceRegistration")
    @ApiOperation(value = "设备注册", notes = "设备注册")
    public Envelop deviceRegistration(@ApiParam(name = "jsonData", value = "", defaultValue = "")
                                      @RequestBody String jsonData){
        try{
            dataInputService.deviceRegistration(jsonData);
            return Envelop.getSuccess("设备注册成功");
        } catch (ServiceException e){
            return Envelop.getError(e.getMessage());
        } catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("设备注册失败");
        }
    }
    @PostMapping(value = "uploadDeviceData")
    @ApiOperation(value = "设备注册", notes = "设备注册")
    public Envelop uploadDeviceData(@ApiParam(name = "jsonData", value = "", defaultValue = "")
                                    @RequestBody String jsonData){
        try{
            return Envelop.getSuccess(dataInputService.uploadDeviceData(jsonData));
        } catch (ServiceException e){
            return Envelop.getError(e.getMessage());
        } catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("设备注册失败");
        }
    }
    /************************************************************************/
    @PostMapping(value = IotRequestMapping.ThirdOpen.registedevice)
    @ApiOperation(value = "设备注册绑定", notes = "设备注册并绑定用户")
    public MixEnvelop registedevice(@ApiParam(name = "jsonData", value = "", defaultValue = "") @RequestParam String jsonData){

+ 2 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceDao.java

@ -52,5 +52,6 @@ public interface IotDeviceDao extends PagingAndSortingRepository<IotDeviceDO, St
    @Query("update IotDeviceDO w set w.del = ?2 where w.id = ?1 ")
    void updateDelById(String id, int del);
    @Query("from IotDeviceDO w where w.deviceUniqueCode =?1 and w.del=1")
    IotDeviceDO findByDeviceUniqueCode(String deviceUniqueCode);
}

+ 12 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceUploadRecordDao.java

@ -0,0 +1,12 @@
package com.yihu.iot.dao.device;
import com.yihu.jw.entity.iot.device.IotDeviceUploadRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2023/7/7.
 */
public interface IotDeviceUploadRecordDao  extends PagingAndSortingRepository<IotDeviceUploadRecordDO, Long>,
        JpaSpecificationExecutor<IotDeviceUploadRecordDO> {
}

+ 3 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoDao.java

@ -2,6 +2,7 @@ package com.yihu.iot.dao.product;
import com.yihu.jw.entity.iot.product.IotProductBaseInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -22,6 +23,7 @@ public interface IotProductBaseInfoDao extends PagingAndSortingRepository<IotPro
    @Query("from IotProductBaseInfoDO w where w.name =?1 and w.del = 1")
    IotProductBaseInfoDO findByName(String name);
    @Modifying
    @Query("UPDATE IotProductBaseInfoDO SET property = ?2  WHERE id = ?1")
    boolean updateProperty(String productId, String property);
    int updateProperty(String productId, String property);
}

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

@ -2,6 +2,7 @@ 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.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -16,4 +17,7 @@ public interface IotProductBaseInfoPropertyDao extends PagingAndSortingRepositor
    @Query("FROM IotProductBaseInfoPropertyDO d WHERE  d.productId = ?1 ")
    IotProductBaseInfoPropertyDO findProductPropertyByProductId(String productId);
    @Modifying
    @Query("delete from IotProductBaseInfoPropertyDO  where productId=?1  ")
    void deleteByProductId(String productId);
}

+ 85 - 1
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java

@ -3,6 +3,8 @@ package com.yihu.iot.datainput.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.elasticsearch.ElasticSearchHelper;
import com.yihu.iot.dao.device.IotDeviceDao;
import com.yihu.iot.dao.device.IotDeviceUploadRecordDao;
import com.yihu.iot.datainput.enums.DataOperationTypeEnum;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.datainput.util.RowKeyUtils;
@ -11,7 +13,9 @@ import com.yihu.iot.service.device.IotDeviceService;
import com.yihu.jw.datainput.DataBodySignsDO;
import com.yihu.jw.datainput.WeRunDataDO;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceUploadRecordDO;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.ServiceException;
import com.yihu.jw.util.http.HttpClientUtil;
import io.searchbox.client.JestResult;
import org.apache.commons.lang.StringUtils;
@ -46,7 +50,8 @@ public class DataInputService {
    @Autowired
    private IotDeviceService iotDeviceService;
    @Autowired
    private IotDeviceDao iotDeviceDao;
    @Autowired
    private DataProcessLogService dataProcessLogService;
    @Autowired
@ -57,12 +62,91 @@ public class DataInputService {
    private String profiles;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private IotDeviceUploadRecordDao iotDeviceUploadRecordDao;
//    @Autowired
//    private HBaseHelper hBaseHelper;
//    @Autowired
//    private HBaseAdmin hBaseAdmin;
    //设备注册
    public String deviceRegistration(String json) throws ServiceException {
        JSONObject jsonObject = JSONObject.parseObject(json);
        String deviceSn = jsonObject.getString("deviceSn");//设备唯一码
        String name = jsonObject.getString("name");//设备名称
        String hospital = jsonObject.getString("hospital");//设备归属机构编码
        String hospitalName = jsonObject.getString("hospitalName");//设备归属机构名称
        String categoryCode = jsonObject.getString("categoryCode");//设备类型编码
        String categoryName = jsonObject.getString("categoryName");//设备类型名称
        if(StringUtils.isBlank(deviceSn)){
            throw new ServiceException("设备唯一码不能为空");
        }
        if(StringUtils.isBlank(name)){
            throw new ServiceException("设备名称不能为空");
        }
        if(StringUtils.isBlank(hospital)){
            throw new ServiceException("设备归属机构编码不能为空");
        }
        if(StringUtils.isBlank(hospitalName)){
            throw new ServiceException("设备归属机构名称不能为空");
        }
        if(StringUtils.isBlank(categoryCode)){
            throw new ServiceException("设备类型编码不能为空");
        }
        if(StringUtils.isBlank(categoryName)){
            throw new ServiceException("设备类型名称不能为空");
        }
        String result = "";
        try {
            int count = iotDeviceService.countByDeviceSn(deviceSn);
            if(count > 0){
                throw new ServiceException("设备唯一码已存在,请检查是否已经上传过,或者换一个编码");
            }
            IotDeviceDO iotDeviceDO = new IotDeviceDO();
            iotDeviceDO.setDeviceSn(deviceSn);
            iotDeviceDO.setCategoryCode(categoryCode);
            iotDeviceDO.setCategoryName(categoryName);
            iotDeviceDO.setDel(1);
            iotDeviceDO.setStatus("1");
            iotDeviceDO.setCreateTime(new Date());
            iotDeviceDO.setDeviceSource("4");
            iotDeviceDO.setHospital(hospital);
            iotDeviceDO.setHospitalName(hospitalName);
            iotDeviceDao.save(iotDeviceDO);
        }catch (Exception e){
            e.printStackTrace();
        }
        return result;
    }
    /**
     * 上传设备数据
     */
    public String uploadDeviceData(String json){
        JSONObject jsonObject = JSONObject.parseObject(json);
        String deviceSn = jsonObject.getString("deviceSn");
        String hospital = jsonObject.getString("hospital");
        String categoryCode = jsonObject.getString("categoryCode");
        try {
            IotDeviceUploadRecordDO recordDO = new IotDeviceUploadRecordDO();
            recordDO.setDeviceSn(deviceSn);
            recordDO.setHospital(hospital);
            recordDO.setJsonData(jsonObject.getJSONArray("data").toJSONString());
            recordDO.setCategoryCode(categoryCode);
            recordDO.setStatus(0);
            recordDO.setCreateTime(new Date());
            iotDeviceUploadRecordDao.save(recordDO);
        }catch (Exception e){
            e.printStackTrace();
            logger.error("上传设备数据失败");
            //保存日志
            return "fail";
        }
        return "success";
    }
    /**
     * 居民设备注册及绑定
     */

+ 2 - 0
svr/svr-iot/src/main/java/com/yihu/iot/interceptor/XssHttpServletRequestWrapper.java

@ -100,7 +100,9 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
        value = value.replaceAll("'", "& #39;");
        value = value.replaceAll("eval\\((.*)\\)", "");
        value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\"");
        value = value.replaceAll("description", "descr_Ption");//解决description 被转成 deion
        value = value.replaceAll("script", "");
        value = value.replaceAll("descr_Ption", "description");
        value = cleanSqlKeyWords(value);
        return value;
    }

+ 153 - 101
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java

@ -45,7 +45,7 @@ import java.util.Map;
 * @author yeshijie on 2017/12/8.
 */
@Service
public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
public class IotDeviceService extends BaseJpaService<IotDeviceDO, IotDeviceDao> {
    @Autowired
    private IotDeviceDao iotDeviceDao;
@ -82,13 +82,14 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 新增
     *
     * @param iotDevice
     * @return
     */
    @Transactional
    public IotDeviceDO create(IotDeviceDO iotDevice) {
        if(iotDevice.getPurchaseId()!=null){
        if (iotDevice.getPurchaseId() != null) {
            IotOrderPurchaseDO purchaseDO = iotOrderPurchaseDao.findById(iotDevice.getPurchaseId());
            iotDevice.setName(purchaseDO.getDeviceName());
            iotDevice.setOrderNo(purchaseDO.getOrderNo());
@ -103,14 +104,14 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
            //获取质检信息
            IotDeviceQualityInspectionPlanDO planDO = iotDeviceQualityInspectionPlanDao.findLastByPurchaseId(iotDevice.getPurchaseId());
            if(planDO!=null){
            if (planDO != null) {
                iotDevice.setNextQualityTime(planDO.getPlanTime());//下次质检时间
            }
            //计算是否已经完成订单
            Integer num = iotDeviceDao.countByPurchaseId(iotDevice.getPurchaseId());//订单已经采购的数量
            Integer purchaseNum = iotOrderPurchaseDao.sumByOrderId(purchaseDO.getOrderId());//订单需采购的数量
            if((num+1)>=purchaseNum){
            if ((num + 1) >= purchaseNum) {
                //采购订单已经完成
                IotDeviceOrderDO iotDeviceOrderDO = iotDeviceOrderDao.findById(purchaseDO.getOrderId());
                iotDeviceOrderDO.setOrderStatus(IotDeviceOrderDO.DeviceOrderStatus.completed.getValue());
@ -126,6 +127,7 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 按id查找
     *
     * @param id
     * @return
     */
@ -135,16 +137,17 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 删除设备
     *
     * @param id
     * @return
     */
    public int delDevice(String id){
    public int delDevice(String id) {
        int re = 1;
        IotDeviceDO deviceDO = iotDeviceDao.findById(id);
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findByDeviceId(id);
        if(patientDeviceDOList!=null&&patientDeviceDOList.size()>0){
        if (patientDeviceDOList != null && patientDeviceDOList.size() > 0) {
            re = -1;
        }else {
        } else {
            deviceDO.setDel(0);
            iotDeviceDao.save(deviceDO);
        }
@ -153,10 +156,11 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 修改设备
     *
     * @param deviceVO
     * @return
     */
    public Envelop updDevice(IotDeviceVO deviceVO){
    public Envelop updDevice(IotDeviceVO deviceVO) {
        IotDeviceDO deviceDO = iotDeviceDao.findById(deviceVO.getId());
        deviceDO.setSimNo(deviceVO.getSimNo());
        deviceDO.setDeviceSn(deviceVO.getDeviceSn());
@ -168,6 +172,7 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 按sim卡号查找
     *
     * @param simNo
     * @return
     */
@ -177,11 +182,12 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 修改sim卡号
     *
     * @param sim
     * @param id
     */
    public Envelop updSim(String sim, String id){
        if(findBySimNo(sim)!=null){
    public Envelop updSim(String sim, String id) {
        if (findBySimNo(sim) != null) {
            return Envelop.getError("sim卡号已存在");
        }
@ -199,15 +205,17 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 设备注册及绑定
     *
     * @param iotDeviceDO
     */
    @Transactional
    public void bindUser(List<IotDeviceDO> iotDeviceDO){
    public void bindUser(List<IotDeviceDO> iotDeviceDO) {
        this.batchInsert(iotDeviceDO);
    }
    /**
     * 查询
     *
     * @param sn
     * @param hospital
     * @param orderId
@ -219,56 +227,56 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
     * @param size
     * @return
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> queryPage(String sn, String hospital, String hospitalName,String orderId, String purcharseId, String productId, String name, String categoryCode, String manufacturerId, Integer page, Integer size) throws Exception{
    public MixEnvelop<IotDeviceVO, IotDeviceVO> queryPage(String sn, String hospital, String hospitalName, String orderId, String purcharseId, String productId, String name, String categoryCode, String manufacturerId, Integer page, Integer size) throws Exception {
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_device c  WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_device c  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(orderId)){
        if (StringUtils.isNotBlank(orderId)) {
            sql.append(" and c.order_id = ? ");
            sqlCount.append(" and c.order_id = '").append(orderId).append("'");
            args.add(orderId);
        }
        if(StringUtils.isNotBlank(purcharseId)){
        if (StringUtils.isNotBlank(purcharseId)) {
            sql.append(" and c.purchase_id = ? ");
            sqlCount.append(" and c.purchase_id = '").append(purcharseId).append("'");
            args.add(purcharseId);
        }
        if(StringUtils.isNotBlank(hospital)){
        if (StringUtils.isNotBlank(hospital)) {
            sql.append(" and c.hospital = ? ");
            sqlCount.append(" and c.hospital = '").append(hospital).append("'");
            args.add(hospital);
        }
        if(StringUtils.isNotBlank(sn)){
            sn = "%"+sn+"%";
        if (StringUtils.isNotBlank(sn)) {
            sn = "%" + sn + "%";
            sql.append(" and (c.device_sn like ? or c.sim_no like ?)");
            sqlCount.append(" and (c.device_sn like '").append(sn).append("' or c.sim_no like '").append(sn).append("')");
            args.add(sn);
            args.add(sn);
        }
        if(StringUtils.isNotBlank(productId)){
        if (StringUtils.isNotBlank(productId)) {
            sql.append(" and c.product_id = ? ");
            sqlCount.append(" and c.product_id = '").append(productId).append("'");
            args.add(productId);
        }
        if(StringUtils.isNotBlank(name)){
            name = "%"+name+"%";
        if (StringUtils.isNotBlank(name)) {
            name = "%" + name + "%";
            sql.append(" and c.name like ?");
            sqlCount.append(" and c.name like '").append(name).append("'");
            args.add(name);
        }
        if(StringUtils.isNotBlank(categoryCode)){
        if (StringUtils.isNotBlank(categoryCode)) {
            sql.append(" and c.category_code = ? ");
            sqlCount.append(" and c.category_code = '").append(categoryCode).append("'");
            args.add(categoryCode);
        }
        if(StringUtils.isNotBlank(manufacturerId)){
        if (StringUtils.isNotBlank(manufacturerId)) {
            sql.append(" and c.manufacturer_id = ? ");
            sqlCount.append(" and c.manufacturer_id = '").append(manufacturerId).append("'");
            args.add(manufacturerId);
        }
        if(StringUtils.isNotBlank(hospitalName)){
            hospitalName = "%"+hospitalName+"%";
        if (StringUtils.isNotBlank(hospitalName)) {
            hospitalName = "%" + hospitalName + "%";
            sql.append(" and c.hospital_name like ?");
            sqlCount.append(" and c.hospital_name like '").append(hospitalName).append("'");
            args.add(hospitalName);
@ -276,25 +284,25 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
        if (!orgList.contains(userAgent.commonHospital)) {
            sql.append(" and c.hospital in (").append(orgUserService.getUserOrg(orgList)).append(")");
            sqlCount.append(" and c.hospital in (").append(orgUserService.getUserOrg(orgList)).append(")");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        sql.append("order by c.update_time desc limit ").append((page - 1) * size).append(",").append(size);
        List<IotDeviceDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceDO.class));
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        List<IotDeviceDO> list = jdbcTempalte.query(sql.toString(), args.toArray(), new BeanPropertyRowMapper(IotDeviceDO.class));
        List<Map<String, Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        //DO转VO
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceVO.class);
        iotDeviceVOList.forEach(one->{
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list, new ArrayList<>(list.size()), IotDeviceVO.class);
        iotDeviceVOList.forEach(one -> {
            String deviceSn = one.getDeviceSn();
            List<IotPatientDeviceDO>  deviceDOList = iotPatientDeviceDao.findByDeviceSn(deviceSn);
            if(deviceDOList!=null&&deviceDOList.size()>0){
            List<IotPatientDeviceDO> deviceDOList = iotPatientDeviceDao.findByDeviceSn(deviceSn);
            if (deviceDOList != null && deviceDOList.size() > 0) {
                one.setIsBinding(1);
            }else {
            } else {
                one.setIsBinding(2);
            }
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
@ -302,11 +310,12 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        });
        translateDictForList(iotDeviceVOList);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotDeviceVOList, page, size,count);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions, iotDeviceVOList, page, size, count);
    }
    /**
     * 是否绑定查询
     *
     * @param sn
     * @param hospital
     * @param orderId
@ -316,97 +325,97 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
     * @param size
     * @return
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> queryPage(String sn, String hospital, String orderId, String purcharseId, Integer isBinding, Integer page, Integer size){
    public MixEnvelop<IotDeviceVO, IotDeviceVO> queryPage(String sn, String hospital, String orderId, String purcharseId, Integer isBinding, Integer page, Integer size) {
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(orderId)){
        if (StringUtils.isNotBlank(orderId)) {
            sql.append(" and c.order_id = ? ");
            sqlCount.append(" and c.order_id = '").append(orderId).append("'");
            args.add(orderId);
        }
        if(StringUtils.isNotBlank(purcharseId)){
        if (StringUtils.isNotBlank(purcharseId)) {
            sql.append(" and c.purchase_id = ? ");
            sqlCount.append(" and c.purchase_id = '").append(purcharseId).append("'");
            args.add(purcharseId);
        }
        if(StringUtils.isNotBlank(hospital)){
        if (StringUtils.isNotBlank(hospital)) {
            sql.append(" and c.hospital = ? ");
            sqlCount.append(" and c.hospital = '").append(hospital).append("'");
            args.add(hospital);
        }
        if(StringUtils.isNotBlank(sn)){
        if (StringUtils.isNotBlank(sn)) {
            sql.append(" and (c.device_sn like ? or c.name like ?)");
            sqlCount.append(" and (c.device_sn like '").append(sn).append("' or c.name like '").append(sn).append("')");
            args.add(sn);
            args.add(sn);
        }
        if(isBinding==1){
        if (isBinding == 1) {
            sql.append(" and t.id is not null ");
            sqlCount.append("  and t.id is not null ");
        }else {
        } else {
            sql.append(" and t.id is null ");
            sqlCount.append("  and t.id is null ");
        }
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
        if (!orgList.contains(userAgent.commonHospital)) {
            sql.append(" and c.hospital in (?) ");
            sqlCount.append(" and c.hospital in (").append(orgUserService.getUserOrg(orgList)).append(")");
            args.add(orgUserService.getUserOrg(orgList));
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        sql.append("order by c.update_time desc limit ").append((page - 1) * size).append(",").append(size);
        List<IotDeviceDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceDO.class));
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        List<IotDeviceDO> list = jdbcTempalte.query(sql.toString(), args.toArray(), new BeanPropertyRowMapper(IotDeviceDO.class));
        List<Map<String, Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        //DO转VO
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceVO.class);
        iotDeviceVOList.forEach(one->{
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list, new ArrayList<>(list.size()), IotDeviceVO.class);
        iotDeviceVOList.forEach(one -> {
            one.setIsBinding(isBinding);
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        translateDictForList(iotDeviceVOList);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotDeviceVOList, page, size,count);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions, iotDeviceVOList, page, size, count);
    }
    /**
     *
     * @return
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findDevice(Integer page, Integer size) {
        String sql ="SELECT DISTINCT c.* from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 ";
        String sql = "SELECT DISTINCT c.* from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 ";
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
            sql += " and c.hospital in ("+orgUserService.getUserOrg(orgList)+")";
        if (!orgList.contains(userAgent.commonHospital)) {
            sql += " and c.hospital in (" + orgUserService.getUserOrg(orgList) + ")";
        }
        sql += " GROUP BY c.`name`";
        List<IotDeviceDO> list = jdbcTempalte.query(sql,new BeanPropertyRowMapper(IotDeviceDO.class));
        for (int i=0;i<list.size();i++){
        List<IotDeviceDO> list = jdbcTempalte.query(sql, new BeanPropertyRowMapper(IotDeviceDO.class));
        for (int i = 0; i < list.size(); i++) {
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        //DO转VO
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceVO.class);
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list, new ArrayList<>(list.size()), IotDeviceVO.class);
        translateDictForList(iotDeviceVOList);
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotDeviceVOList, page, size,count);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions, iotDeviceVOList, page, size, count);
    }
    /**
     * 根据设备序列号判断设备是否存在
     *
     * @param deviceSn
     * @return
     */
@ -416,6 +425,7 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 根据设备序列号查找设备
     *
     * @param deviceSn
     * @return
     */
@ -423,26 +433,39 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        return iotDeviceDao.findByDeviceSn(deviceSn);
    }
    /**
     * 根据设备唯一码查找设备
     *
     * @param deviceUniqueCode
     * @return
     */
    public IotDeviceDO findByDeviceUniqueCode(String deviceUniqueCode) {
        return iotDeviceDao.findByDeviceUniqueCode(deviceUniqueCode);
    }
    /**
     * 根据设备序列号查找设备
     *
     * @param deviceSn
     * @param productId
     * @param hospital
     * @return
     */
    public IotDeviceDO findDeviceBySn(String deviceSn,String productId,String hospital){
        String sql ="SELECT c.* from iot_device c  WHERE c.del=1 ";
        if(StringUtils.isNotEmpty(deviceSn)){
            sql += " and c.device_sn = '"+deviceSn+"'";
    public IotDeviceDO findDeviceBySn(String deviceSn, String productId, String hospital) {
        String sql = "SELECT c.* from iot_device c  WHERE c.del=1 ";
        if (StringUtils.isNotEmpty(deviceSn)) {
            sql += " and c.device_sn = '" + deviceSn + "'";
        }
        if(StringUtils.isNotEmpty(productId)){
            sql += " and c.product_id = '"+productId+"'";
        if (StringUtils.isNotEmpty(productId)) {
            sql += " and c.product_id = '" + productId + "'";
        }
        if(StringUtils.isNotEmpty(hospital)){
            sql += " and c.hospital = '"+hospital+"'";
        if (StringUtils.isNotEmpty(hospital)) {
            sql += " and c.hospital = '" + hospital + "'";
        }
        List<IotDeviceDO> list = jdbcTempalte.query(sql,new BeanPropertyRowMapper(IotDeviceDO.class));
        if(list.size()>0){
        List<IotDeviceDO> list = jdbcTempalte.query(sql, new BeanPropertyRowMapper(IotDeviceDO.class));
        if (list.size() > 0) {
            list.get(0).setCreateUserName(AesEncryptUtils.decrypt(list.get(0).getCreateUserName()));
            list.get(0).setUpdateUserName(AesEncryptUtils.decrypt(list.get(0).getUpdateUserName()));
            return list.get(0);
@ -453,7 +476,7 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 设备导入
     */
    public IotDeviceImportRecordVO importDevice(String fileUrl, String fileName, String purcharseId, List<IotDeviceImportVO> importVOList){
    public IotDeviceImportRecordVO importDevice(String fileUrl, String fileName, String purcharseId, List<IotDeviceImportVO> importVOList) {
        IotDeviceImportRecordDO recordDO = new IotDeviceImportRecordDO();
        IotOrderPurchaseDO purchaseDO = iotOrderPurchaseDao.findById(purcharseId);
        recordDO.setDel(1);
@ -465,57 +488,61 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        recordDO.setStatus(IotDeviceImportRecordDO.DeviceImportRecordStatus.create.getValue());
        iotDeviceImportRecordDao.save(recordDO);
        IotDeviceImportRecordVO vo = convertToModel(recordDO,IotDeviceImportRecordVO.class);
        IotDeviceImportRecordVO vo = convertToModel(recordDO, IotDeviceImportRecordVO.class);
        //批量导入 异步操作
        importRecordService.importDevice(purchaseDO,importVOList,recordDO);
        importRecordService.importDevice(purchaseDO, importVOList, recordDO);
        return vo;
    };
    }
    ;
    /**
     * 分页查找导入记录
     *
     * @param page
     * @param size
     * @param purcharseId
     * @return
     */
    public MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> queryImportRecordPage(Integer page, Integer size, String purcharseId){
    public MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> queryImportRecordPage(Integer page, Integer size, String purcharseId) {
        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_import_record c  WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count from iot_device_import_record c WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(purcharseId)){
        if (StringUtils.isNotBlank(purcharseId)) {
            sql.append(" and c.purchase_id=? ");
            sqlCount.append(" and c.purchase_id='").append(purcharseId).append("' ");
            args.add(purcharseId);
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        sql.append("order by c.update_time desc limit ").append((page - 1) * size).append(",").append(size);
        List<IotDeviceImportRecordDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceImportRecordDO.class));
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        List<IotDeviceImportRecordDO> list = jdbcTempalte.query(sql.toString(), args.toArray(), new BeanPropertyRowMapper(IotDeviceImportRecordDO.class));
        List<Map<String, Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        //DO转VO
        List<IotDeviceImportRecordVO> importRecordVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceImportRecordVO.class);
        List<IotDeviceImportRecordVO> importRecordVOList = convertToModels(list, new ArrayList<>(list.size()), IotDeviceImportRecordVO.class);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,importRecordVOList, page, size,count);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions, importRecordVOList, page, size, count);
    }
    /**
     * 字典翻译
     *
     * @param iotDeviceVOList
     */
    public void translateDictForList(List<IotDeviceVO> iotDeviceVOList){
        if(iotDeviceVOList.size()>0){
    public void translateDictForList(List<IotDeviceVO> iotDeviceVOList) {
        if (iotDeviceVOList.size() > 0) {
            //字典翻译
            Map<String,String> deviceBindingMap = iotSystemDictService.findByDictName("DEVICE_BINDING");
            Map<String,String> deviceSourceMap = iotSystemDictService.findByDictName("DEVICE_SOURCE");
            iotDeviceVOList.forEach(infoVO->{
                if(infoVO.getIsBinding()!=null){
            Map<String, String> deviceBindingMap = iotSystemDictService.findByDictName("DEVICE_BINDING");
            Map<String, String> deviceSourceMap = iotSystemDictService.findByDictName("DEVICE_SOURCE");
            iotDeviceVOList.forEach(infoVO -> {
                if (infoVO.getIsBinding() != null) {
                    infoVO.setIsBindingName(deviceBindingMap.get(infoVO.getIsBinding().toString()));
                }
                if(StringUtils.isNotBlank(infoVO.getDeviceSource())){
                if (StringUtils.isNotBlank(infoVO.getDeviceSource())) {
                    infoVO.setDeviceSourceName(deviceSourceMap.get(infoVO.getDeviceSource()));
                }
            });
@ -524,50 +551,51 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    /**
     * 字典翻译
     *
     * @param iotDeviceVO
     */
    public void translateDictForOne(IotDeviceVO iotDeviceVO){
        if(iotDeviceVO!=null){
    public void translateDictForOne(IotDeviceVO iotDeviceVO) {
        if (iotDeviceVO != null) {
            //字典翻译
            Map<String,String> deviceBindingMap = iotSystemDictService.findByDictName("DEVICE_BINDING");
            Map<String,String> deviceSourceMap = iotSystemDictService.findByDictName("DEVICE_SOURCE");
            Map<String,String> qualityStatusMap = iotSystemDictService.findByDictName("QUALITY_STATUS");
            Map<String, String> deviceBindingMap = iotSystemDictService.findByDictName("DEVICE_BINDING");
            Map<String, String> deviceSourceMap = iotSystemDictService.findByDictName("DEVICE_SOURCE");
            Map<String, String> qualityStatusMap = iotSystemDictService.findByDictName("QUALITY_STATUS");
            List<IotPatientDeviceDO>  deviceDOList = iotPatientDeviceDao.findByDeviceSn(iotDeviceVO.getDeviceSn());
            if(deviceDOList!=null&&deviceDOList.size()>0){
            List<IotPatientDeviceDO> deviceDOList = iotPatientDeviceDao.findByDeviceSn(iotDeviceVO.getDeviceSn());
            if (deviceDOList != null && deviceDOList.size() > 0) {
                iotDeviceVO.setIsBinding(1);
            }else {
            } else {
                iotDeviceVO.setIsBinding(2);
            }
            iotDeviceVO.setIsBindingName(deviceBindingMap.get(iotDeviceVO.getIsBinding().toString()));
            if(StringUtils.isNotBlank(iotDeviceVO.getDeviceSource())){
            if (StringUtils.isNotBlank(iotDeviceVO.getDeviceSource())) {
                iotDeviceVO.setDeviceSourceName(deviceSourceMap.get(iotDeviceVO.getDeviceSource()));
            }
            //获取质检信息
            IotDeviceQualityInspectionPlanDO planDO = iotDeviceQualityInspectionPlanDao.findByDeviceId(iotDeviceVO.getId());
            if(planDO!=null){
            if (planDO != null) {
                iotDeviceVO.setQualityStatus(qualityStatusMap.get(planDO.getStatus()));//质检状态
            }else if(StringUtils.isNotBlank(iotDeviceVO.getPurchaseId())){
            } else if (StringUtils.isNotBlank(iotDeviceVO.getPurchaseId())) {
                IotOrderPurchaseDO purchaseDO = iotOrderPurchaseDao.findById(iotDeviceVO.getPurchaseId());
                if(purchaseDO!=null&&StringUtils.isNotBlank(purchaseDO.getQualityStatus())){
                if (purchaseDO != null && StringUtils.isNotBlank(purchaseDO.getQualityStatus())) {
                    iotDeviceVO.setQualityStatus(qualityStatusMap.get(purchaseDO.getQualityStatus()));//质检状态
                }
            }
            //数据来源
            if(StringUtils.isNotBlank(iotDeviceVO.getPurchaseId())){
            if (StringUtils.isNotBlank(iotDeviceVO.getPurchaseId())) {
                List<IotProductDataTransmissionDO> dataTransmissionDOList = iotProductDataTransmissionDao.findByProductId(iotDeviceVO.getProductId());
                if(dataTransmissionDOList!=null){
                if (dataTransmissionDOList != null) {
                    List<IotProductDataTransmissionVO> dataTransmissionVOList =
                            convertToModels(dataTransmissionDOList,new ArrayList<>(dataTransmissionDOList.size()),IotProductDataTransmissionVO.class);
                            convertToModels(dataTransmissionDOList, new ArrayList<>(dataTransmissionDOList.size()), IotProductDataTransmissionVO.class);
                    iotDeviceVO.setDataTransmissionVOList(dataTransmissionVOList);
                }
            }
            //关联居民
            List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findByDeviceSn(iotDeviceVO.getDeviceSn());
            if(patientDeviceDOList!=null){
            if (patientDeviceDOList != null) {
                List<IotPatientDeviceVO> patientDeviceVOList =
                        convertToModels(patientDeviceDOList,new ArrayList<>(patientDeviceDOList.size()),IotPatientDeviceVO.class);
                        convertToModels(patientDeviceDOList, new ArrayList<>(patientDeviceDOList.size()), IotPatientDeviceVO.class);
                iotDeviceVO.setPatientDeviceVOList(patientDeviceVOList);
            }
        }
@ -613,4 +641,28 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
            inputStream.close();
        }
    }
    /**
     * 获取一个空闲设备
     *
     * @param productId
     * @return
     */
    public IotDeviceDO findFreeDevice(String productId,String deviceSn) {
        String sql = "SELECT c.* from iot_device c  WHERE c.del=1 ";
        if (StringUtils.isNotEmpty(productId)) {
            sql += " and c.product_id = '" + productId + "'";
        }
        if (StringUtils.isNotEmpty(deviceSn)) {
            sql += " and c.device_sn = '" + deviceSn + "'";
        }
        sql += " AND c.is_grant='0' AND c.`status`='1' ";
        List<IotDeviceDO> list = jdbcTempalte.query(sql, new BeanPropertyRowMapper(IotDeviceDO.class));
        if (list.size() > 0) {
            list.get(0).setCreateUserName(AesEncryptUtils.decrypt(list.get(0).getCreateUserName()));
            list.get(0).setUpdateUserName(AesEncryptUtils.decrypt(list.get(0).getUpdateUserName()));
            return list.get(0);
        }
        return null;
    }
}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 357 - 236
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java


+ 175 - 61
svr/svr-iot/src/main/java/com/yihu/iot/service/device/WlyyDeviceService.java

@ -5,10 +5,8 @@ import com.yihu.iot.service.common.OrgUserService;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.restmodel.iot.device.DeviceHealthIndexVO;
import com.yihu.jw.restmodel.iot.device.WlyyDeviceVO;
import com.yihu.jw.restmodel.iot.device.WlyyHealthStandardVO;
import com.yihu.jw.restmodel.iot.device.WlyyPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
@ -56,56 +54,125 @@ public class WlyyDeviceService {
    private UserAgent userAgent;
    @Autowired
    private OrgUserService orgUserService;
    public MixEnvelop<WlyyDeviceVO,WlyyDeviceVO> searchDeviceList(String deviceName,String deviceCode,String orgName,String linkman,Integer page,Integer pageSize){
        String sql = "select * from device.wlyy_devices where 1=1 ";
    @Autowired
    private IotPatientDeviceService patientDeviceService;
    public MixEnvelop<IotDeviceVO,IotDeviceVO> searchDeviceList(
            String deviceName,String deviceCode,String orgName,String linkman,Integer page,Integer pageSize,
            String propertyName, String propertyCombination, String propertyUse, String propertyNetwork, String propertyLocation)
    {
        //补充查询
        String sql = "SELECT\n" +
                " distinct	a.* ,\n" +
                "	c.`name` propertyName,\n" +
                "	c.`combination` propertyCombination,\n" +
                "	c.`device_use` propertyUse,\n" +
                "	c.`network` propertyNetwork,\n" +
                "	c.`location` propertyLocation, \n" +
                "	c.`dictionaries` propertyDataAcquisitionDict, \n" +
                "	d.`sim` sim, \n" +
                "	d.`iot_imsi` iotImsi, \n" +
                "	d.`iot_iccid` iotIccid \n" +
                "FROM\n" +
                "	iot_device a \n" +
                "	left JOIN iot_product_base_info_property c ON c.product_id = a.product_id \n" +
                "	left JOIN iot_patient_device d ON a.device_sn=d.device_sn \n" +
                "WHERE\n" +
                "	1 = 1";
        if(!StringUtils.isEmpty(orgName)){
            sql +=" and org_name like '%"+orgName+"%' ";
            sql +=" and a.hospital_name like '%"+orgName+"%' ";
        }
        if(!StringUtils.isEmpty(deviceCode)){
            sql +=" and device_code = '"+deviceCode+"' ";
            sql +=" and a.device_sn = '"+deviceCode+"' ";
        }
        if(!StringUtils.isEmpty(deviceName)){
            sql +=" and device_name like '%"+deviceName+"%' ";
            sql +=" and a.name like '%"+deviceName+"%' ";
        }
//        if(!StringUtils.isEmpty(linkman)){
//            sql +=" and AES_DECRYPT(from_base64(a.linkman),'jkzl2021ZJXL*#%a') like '%"+linkman+"%' ";//AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a')
//        }
        /**
         * 通用查询 补充字段
         */
        if (StringUtils.isNotBlank(propertyName)) {
            sql += " and c.name like '%" + propertyName + "%' ";
        }
        if (StringUtils.isNotBlank(propertyCombination)) {
            sql += " and c.combination like '%" + propertyCombination + "%' ";
        }
        if (StringUtils.isNotBlank(propertyUse)) {
            sql += " and c.`device_use` like '%" + propertyUse + "%' ";
        }
        if(!StringUtils.isEmpty(linkman)){
            sql +=" and AES_DECRYPT(from_base64(linkmam),'jkzl2021ZJXL*#%a') like '%"+linkman+"%' ";//AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a')
        if (StringUtils.isNotBlank(propertyNetwork)) {
            sql += " and c.network like '%" + propertyNetwork + "%' ";
        }
        if (StringUtils.isNotBlank(propertyLocation)) {
            sql += " and c.location like '%" + propertyLocation + "%' ";
        }
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
            sql += " and grant_org_code in ("+orgUserService.getUserOrg(orgList)+") ";
            sql += " and a.hospital in ("+orgUserService.getUserOrg(orgList)+") ";
        }
        sql += " order by id desc ";
        sql += " order by a.id desc ";
        Long count = Long.valueOf(jdbcTemplate.queryForList(sql).size());
        sql += "limit " + (page - 1) * pageSize + "," + pageSize;
        sql = TransforSqlUtl.deviceAll(sql);
        List<WlyyDeviceVO> deviceVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WlyyDeviceVO.class));
//        deviceVOList.forEach(one->{
//            one.setLinkman(AesEncryptUtils.decrypt(one.getLinkman()));
//            one.setTel(AesEncryptUtils.decrypt(one.getTel()));
//            one.setRepresentative(AesEncryptUtils.decrypt(one.getRepresentative()));
//            one.setApplicantName(AesEncryptUtils.decrypt(one.getApplicantName()));
//            one.setApplicantTel(AesEncryptUtils.decrypt(one.getApplicantTel()));
//            one.setApplicantIdentity(AesEncryptUtils.decrypt(one.getApplicantIdentity()));
//        });
        Map<String,String>  propertyNameMap = patientDeviceService.getHostpitalDictMap("Device_common_name");
        Map<String,String>  propertyCombinationMap = patientDeviceService.getHostpitalDictMap("Combination_method");
        Map<String,String>  propertyUseMap = patientDeviceService.getHostpitalDictMap("device_use");
        Map<String,String>  propertyNetworkMap = patientDeviceService.getHostpitalDictMap("Network_transmission");
        Map<String,String>  propertyLocationMap = patientDeviceService.getHostpitalDictMap("Drop_location");
        Map<String,String>  propertyDataAcquisitionDictMap = patientDeviceService.getHostpitalDictMap("Data_acquisition_dict");
        List<IotDeviceVO> deviceVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotDeviceVO.class));
        deviceVOList.forEach(one->{
            one.setPropertyName(propertyNameMap.get(one.getPropertyName()));
            one.setPropertyCombination(propertyCombinationMap.get(one.getPropertyCombination()));
            one.setPropertyLocation(propertyLocationMap.get(one.getPropertyLocation()));
            one.setPropertyNetwork(propertyNetworkMap.get(one.getPropertyNetwork()));
            one.setPropertyUse(propertyUseMap.get(one.getPropertyUse()));
            one.setPropertyDataAcquisitionDict(propertyDataAcquisitionDictMap.get(one.getPropertyDataAcquisitionDict()));
        });
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
    }
    public MixEnvelop<WlyyDeviceVO,WlyyDeviceVO> findById(Long id){
        String sql = "select * from device.wlyy_devices where id = "+id;
    public Envelop findById(String id){
        String sql = "SELECT\n" +
                " distinct	a.* ,\n" +
                "	c.`name` propertyName,\n" +
                "	c.`combination` propertyCombination,\n" +
                "	c.`device_use` propertyUse,\n" +
                "	c.`network` propertyNetwork,\n" +
                "	c.`location` propertyLocation, \n" +
                "	c.`dictionaries` propertyDataAcquisitionDict, \n" +
                "	d.`sim` sim, \n" +
                "	d.`iot_imsi` iotImsi, \n" +
                "	d.`iot_iccid` iotIccid \n" +
                "FROM\n" +
                "	iot_device a \n" +
                "	left JOIN iot_product_base_info_property c ON c.product_id = a.product_id \n" +
                "	left JOIN iot_patient_device d ON a.device_sn=d.device_sn \n" +
                "WHERE a.id = '"+id+"'";
        sql = TransforSqlUtl.deviceAll(sql);
        List<WlyyDeviceVO> deviceVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WlyyDeviceVO.class));
//        deviceVOList.forEach(one->{
//            one.setLinkman(AesEncryptUtils.decrypt(one.getLinkman()));
//            one.setTel(AesEncryptUtils.decrypt(one.getTel()));
//            one.setRepresentative(AesEncryptUtils.decrypt(one.getRepresentative()));
//            one.setApplicantName(AesEncryptUtils.decrypt(one.getApplicantName()));
//            one.setApplicantTel(AesEncryptUtils.decrypt(one.getApplicantTel()));
//            one.setApplicantIdentity(AesEncryptUtils.decrypt(one.getApplicantIdentity()));
//        });
        List<IotDeviceVO> deviceVOList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotDeviceVO.class));
        Map<String,String>  propertyNameMap = patientDeviceService.getHostpitalDictMap("Device_common_name");
        Map<String,String>  propertyCombinationMap = patientDeviceService.getHostpitalDictMap("Combination_method");
        Map<String,String>  propertyUseMap = patientDeviceService.getHostpitalDictMap("device_use");
        Map<String,String>  propertyNetworkMap = patientDeviceService.getHostpitalDictMap("Network_transmission");
        Map<String,String>  propertyLocationMap = patientDeviceService.getHostpitalDictMap("Drop_location");
        Map<String,String>  propertyDataAcquisitionDictMap = patientDeviceService.getHostpitalDictMap("Data_acquisition_dict");
        deviceVOList.forEach(one->{
            one.setPropertyName(propertyNameMap.get(one.getPropertyName()));
            one.setPropertyCombination(propertyCombinationMap.get(one.getPropertyCombination()));
            one.setPropertyLocation(propertyLocationMap.get(one.getPropertyLocation()));
            one.setPropertyNetwork(propertyNetworkMap.get(one.getPropertyNetwork()));
            one.setPropertyUse(propertyUseMap.get(one.getPropertyUse()));
            one.setPropertyDataAcquisitionDict(propertyDataAcquisitionDictMap.get(one.getPropertyDataAcquisitionDict()));
        });
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,deviceVOList.get(0));
    }
@ -287,35 +354,60 @@ public class WlyyDeviceService {
        return json;
    }
    public List<WlyyPatientDeviceVO> searchListNew(String deviceName,
                                                   String categoryCode,
                                                   String deviceSn,
                                                   String userName,
                                                   String doctorName,
                                                   String hospitalName,
                                                   String hospitalCode,
                                                   Integer page, Integer pageSize) throws Exception{
    public List<WlyyPatientDeviceVO> searchListNew(
            String deviceName, String categoryCode, String deviceSn, String userName, String doctorName,
            String hospitalName, String hospitalCode, Integer page, Integer pageSize,
            String propertyName,String propertyCombination,String propertyUse,String propertyNetwork,String propertyLocation)
     throws Exception{
        List<WlyyPatientDeviceVO> list = new ArrayList<>();
        String sql = "SELECT d.id as id,d.device_id as deviceId,d.user as user,p.name as userName,d.category_code as categoryCode,d.device_name as deviceName," +
                "d.device_sn as deviceSn,d.sim as sim,d.user_type as userType,p.mobile," +
                "CONCAT(LEFT (p.idcard,6),'**********',RIGHT (p.idcard,2)) userIdcard,d.czrq as czrq,s.doctor,s.doctor_name doctorName " +
                "FROM wlyy.wlyy_patient_device d left join wlyy.wlyy_sign_family s on d.`user` = s. patient and s.`status`>0,wlyy.wlyy_patient p " +
                "WHERE d.`user`=p.CODE ";
                " d.device_sn as deviceSn,d.sim as sim,d.user_type as userType,p.mobile," +
                " CONCAT(LEFT (p.idcard,6),'**********',RIGHT (p.idcard,2)) userIdcard,d.czrq as czrq,s.doctor,s.doctor_name doctorName, " +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Device_common_name' AND q.`dict_code`=a.`name` )\"propertyName\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Combination_method' AND q.`dict_code`=a.`combination` )\"propertyCombination\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='device_use' AND q.`dict_code`=a.`device_use` )\"propertyUse\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Network_transmission' AND q.`dict_code`=a.`network` )\"propertyNetwork\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Drop_location' AND q.`dict_code`=a.`location` )\"propertyLocation\" " +
                " FROM wlyy.wlyy_patient_device d " +
                " INNER JOIN wlyy.wlyy_patient p ON d.`user`=p.CODE " +
                " LEFT JOIN wlyy.wlyy_sign_family s on d.`user` = s. patient and s.`status`>0 " +
                " LEFT JOIN xmiot.iot_device b ON b.device_sn=d.device_sn\n" +
                " LEFT JOIN xmiot.iot_product_base_info_property a ON a.product_id =b.product_id " +
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(userName)){
            sql = sql + "AND p.name like '%"+userName+"%' ";
            sql = sql + " AND p.name like '%"+userName+"%' ";
        }
        if(StringUtils.isNotBlank(deviceSn)){
            sql = sql + "AND d.device_sn like '%"+deviceSn+"%' ";
            sql = sql + " AND d.device_sn like '%"+deviceSn+"%' ";
        }
        if(StringUtils.isNotBlank(categoryCode)){
            sql = sql + "AND d.category_code like '%"+categoryCode+"%' ";
            sql = sql + " AND d.category_code like '%"+categoryCode+"%' ";
        }
        if(StringUtils.isNotBlank(deviceName)){
            sql = sql + "AND d.device_name like '%"+deviceName+"%' ";
            sql = sql + " AND d.device_name like '%"+deviceName+"%' ";
        }
        /**
         * 通用查询 补充字段
         */
        if(StringUtils.isNotBlank(propertyName)){
            sql += " and a.name like '%" + propertyName + "%' ";
        }
        if(StringUtils.isNotBlank(propertyCombination)){
            sql += " and a.combination like '%" + propertyCombination + "%' ";
        }
        if(StringUtils.isNotBlank(propertyUse)){
            sql += " and a.`device_use` like '%" + propertyUse + "%' ";
        }
        if(StringUtils.isNotBlank(propertyNetwork)){
            sql += " and a.network like '%" + propertyNetwork + "%' ";
        }
        if(StringUtils.isNotBlank(propertyLocation)){
            sql += " and a.location like '%" + propertyLocation + "%' ";
        }
        //数据权限过滤
@ -330,28 +422,50 @@ public class WlyyDeviceService {
        return list ;
    }
    public Long getCountSearchListNew(String deviceName, String categoryCode, String deviceSn, String userName, String doctorName, String hospitalName,String hospitalCode) {
    public Long getCountSearchListNew(
            String deviceName, String categoryCode, String deviceSn, String userName, String doctorName, String hospitalName,String hospitalCode,
            String propertyName,String propertyCombination,String propertyUse,String propertyNetwork,String propertyLocation)
    {
        String sql  = "SELECT count(d.id) " +
                "FROM " +
                " wlyy.wlyy_patient_device d left join wlyy.wlyy_sign_family s on d.`user` = s. patient and s.`status`>0," +
                " wlyy.wlyy_patient p " +
                "WHERE " +
                " d.`user`=p.CODE ";
                " FROM  wlyy.wlyy_patient_device d " +
                " LEFT JOIN wlyy.wlyy_patient p on d.`user`=p.CODE " +
                " LEFT JOIN wlyy.wlyy_sign_family s on d.`user` = s. patient and s.`status`>0 " +
                " LEFT JOIN xmiot.iot_device b ON b.device_sn=d.device_sn\n" +
                " LEFT JOIN xmiot.iot_product_base_info_property a ON a.product_id =b.product_id " +
                " WHERE 1=1 " ;
        if(StringUtils.isNotBlank(userName)){
            sql = sql + "AND p.name like '%"+doctorName+"%' ";
            sql = sql + " AND p.name like '%"+doctorName+"%' ";
        }
        if(StringUtils.isNotBlank(deviceSn)){
            sql = sql + "AND d.device_sn like '%"+deviceSn+"%' ";
            sql = sql + " AND d.device_sn like '%"+deviceSn+"%' ";
        }
        if(StringUtils.isNotBlank(categoryCode)){
            sql = sql + "AND d.category_code like '%"+categoryCode+"%' ";
            sql = sql + " AND d.category_code like '%"+categoryCode+"%' ";
        }
        if(StringUtils.isNotBlank(deviceName)){
            sql = sql + "AND d.device_name like '%"+deviceName+"%' ";
            sql = sql + " AND d.device_name like '%"+deviceName+"%' ";
        }
        /**
         * 通用查询 补充字段
         */
        if(StringUtils.isNotBlank(propertyName)){
            sql += " and a.name like '%" + propertyName + "%' ";
        }
        if(StringUtils.isNotBlank(propertyCombination)){
            sql += " and a.combination like '%" + propertyCombination + "%' ";
        }
        if(StringUtils.isNotBlank(propertyUse)){
            sql += " and a.`device_use` like '%" + propertyUse + "%' ";
        }
        if(StringUtils.isNotBlank(propertyNetwork)){
            sql += " and a.network like '%" + propertyNetwork + "%' ";
        }
        if(StringUtils.isNotBlank(propertyLocation)){
            sql += " and a.location like '%" + propertyLocation + "%' ";
        }
        //数据权限过滤

+ 113 - 17
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -1082,25 +1082,121 @@ public class MonitorPlatformService {
     * @param hospital
     * @return
     */
    public JSONArray warningInformationAlarm_new(Integer page, Integer pageSize, String startTime, String endTime,
                                                 String deviceType, String area, String hospital, String deviceName) {
        String url = "/wlyygc/iot_monitoring/warningInformationAlarm_new";
        Map<String, Object> params = new HashMap<>();
        params.put("page", page);
        params.put("pageSize", pageSize);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        params.put("deviceType", deviceType);
        params.put("area", area);
        params.put("hospital", hospital);
        params.put("deviceName", deviceName);
        String response = sendGet(url, params);
        JSONObject json = JSONObject.parseObject(response);
        if (json.getInteger("status") == 200) {
            return json.getJSONArray("data");
//    public JSONArray warningInformationAlarm_new(Integer page, Integer pageSize, String startTime, String endTime,
//                                                 String deviceType, String area, String hospital, String deviceName) {
//        String url = "/wlyygc/iot_monitoring/warningInformationAlarm_new";
//        Map<String, Object> params = new HashMap<>();
//        params.put("page", page);
//        params.put("pageSize", pageSize);
//        params.put("startTime", startTime);
//        params.put("endTime", endTime);
//        params.put("deviceType", deviceType);
//        params.put("area", area);
//        params.put("hospital", hospital);
//        params.put("deviceName", deviceName);
//        String response = sendGet(url, params);
//        JSONObject json = JSONObject.parseObject(response);
//        if (json.getInteger("status") == 200) {
//            return json.getJSONArray("data");
//        }
//
//        return new JSONArray();
//    }
    public List<com.alibaba.fastjson.JSONObject> warningInformationAlarm_new(Integer page,Integer pageSize,String startTime,String endTime,
                                                                             String deviceType,String area,String hospital,String deviceName){
        List<com.alibaba.fastjson.JSONObject> list = new ArrayList<>();
        StringBuffer tz_type = new StringBuffer("''");
        if (org.apache.commons.lang3.StringUtils.isBlank(deviceType)){
            tz_type.append(",'1','2'");
        }
        else{
            if (deviceType.contains("1")){
                tz_type.append(",'1'");
            }
            if (deviceType.contains("2")) {
                tz_type.append(",'2'");
            }
        }
        if (tz_type.toString().contains("1")||tz_type.toString().contains("2")){
            StringBuffer sql = new StringBuffer("select  A.*,d.name from ( SELECT  m.sender,m.sender_name,m.create_time,m.value1,m.value2,m.tz_type,p.address," +
                    "p.photo,m.receiver  ");
            sql.append("from wlyy.wlyy_message m INNER JOIN wlyy.wlyy_patient p on m.sender=p.code ");
            if(!StringUtils.isEmpty(area)||!StringUtils.isEmpty(hospital)){
                sql.append("INNER join wlyy.wlyy_sign_family f on f.`status`>0 and f.patient = m.sender ");
            }
            if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){
                sql.append("INNER JOIN wlyy.wlyy_patient_device pd on  pd.`user` = p.`code` ");
            }
            sql.append("WHERE m.type = 2 " );
            if(org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)){
                sql.append("and m.create_time >= '"+startTime+"' ");
            }
            if(org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)){
                sql.append("and m.create_time <= '"+endTime+"' ");
            }
            if(org.apache.commons.lang3.StringUtils.isNoneBlank(deviceType)){
                sql.append("and m.tz_type in ("+tz_type+") ");
            }
            if(org.apache.commons.lang3.StringUtils.isNoneBlank(area)){
                sql.append("and f.hospital like '"+area+"%' ");
            }
            if(org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)){
                sql.append("and f.hospital = '"+hospital+"' ");
            }
            if (org.apache.commons.lang3.StringUtils.isNoneBlank(deviceName)){
                sql.append("and pd.device_name in ('").append(deviceName.replace(",","','")).append("')  ");
            }
            sql.append("ORDER BY m.id desc LIMIT ?,? ) A INNER JOIN wlyy.wlyy_doctor d on d.code = A.receiver ");
            List<com.alibaba.fastjson.JSONObject> tmp = myJdbcTemplate.queryJson(sql.toString(),new Object[]{(page-1)*pageSize,pageSize});
            list.addAll(tmp);
        }
        list.forEach(json->{
            json.put("value2Name",getTypeName(json.getString("tz_type"),String.valueOf(json.getIntValue("value2"))));
            //姓名脱敏
            json.put("sender_name",null==json.getString("sender_name")?"": ConcealUtil.nameOrAddrConceal(json.getString("sender_name").toString()) );
            json.put("name",null==json.getString("name")?"": ConcealUtil.nameOrAddrConceal(json.getString("name").toString()) );
            //地址脱敏
            json.put("address",null==json.getString("address")?"": ConcealUtil.nameOrAddrConceal(json.getString("address").toString()) );
        });
        return new JSONArray();
        return list;
    }
    private String getTypeName(String type,String value){
        String name = "";
        //1早餐前、2早餐后、3午餐前、4午餐后、5晚餐前 6晚餐后 7睡前)
        if ("1".equals(type)){
            switch (value){
                case "1":
                    name = "早餐前";
                    break;
                case "2":
                    name = "早餐后";
                    break;
                case "3":
                    name = "午餐前";
                    break;
                case "4":
                    name = "午餐后";
                    break;
                case "5":
                    name = "晚餐前";
                    break;
                case "6":
                    name = "晚餐后";
                    break;
                default:
                    name = "睡前";
                    break;
            }
        }else if("3".equals(type)){
            name = "收缩压";
        }else {
            name = "舒张压";
        }
        return name;
    }
    /**

+ 33 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoPropertyService.java

@ -1,20 +1,18 @@
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.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import static cn.hutool.core.util.ObjectUtil.hasEmpty;
import java.util.List;
/**
 * 类描述:
@ -53,6 +51,7 @@ public class IotProductBaseInfoPropertyService extends BaseJpaService<IotProduct
     */
    public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> update(IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO) {
        IotProductBaseInfoPropertyDO iotProductBaseInfoPropertyDO = convertToModel(iotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyDO.class);
        iotProductBaseInfoPropertyDao.deleteByProductId(iotProductBaseInfoPropertyVO.getProductId());
        iotProductBaseInfoPropertyDao.save(iotProductBaseInfoPropertyDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update);
    }
@ -80,7 +79,34 @@ public class IotProductBaseInfoPropertyService extends BaseJpaService<IotProduct
     * @date 2023/5/5 16:47
     */
    public IotProductBaseInfoPropertyVO findProductPropertyByProductId(String productId) {
        IotProductBaseInfoPropertyDO res = iotProductBaseInfoPropertyDao.findProductPropertyByProductId(productId);
        return convertToModel(res, IotProductBaseInfoPropertyVO.class);
        String sql="SELECT\n" +
                "a.id,\n" +
                "a.product_id \"productId\",\n" +
                "a.`name` \"nameCode\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Device_common_name' AND q.`dict_code`=a.`name` ) \"name\", \n" +
                "a.`combination` \"combinationCode\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Combination_method' AND q.`dict_code`=a.`combination` )\"combination\", \n" +
                "a.`device_use` \"deviceUseCode\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='device_use' AND q.`dict_code`=a.`device_use` )\"deviceUse\", \n" +
                "a.`network` \"networkCode\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Network_transmission' AND q.`dict_code`=a.`network` )\"network\", \n" +
                "a.`location` \"locationCode\",\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Drop_location' AND q.`dict_code`=a.`location` )\"location\",\n" +
                "a.dictionaries dictionariesCode,\n" +
                "(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Data_acquisition_dict' AND q.`dict_code`=a.`dictionaries` )\"dictionaries\" \n" +
                "FROM\n" +
                "	iot_product_base_info_property a" +
                " where 1=1 ";
        if (StringUtils.isNotBlank(productId)){
            sql += " and a.product_id='"+productId+"'";
        }
        List<IotProductBaseInfoPropertyVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(IotProductBaseInfoPropertyVO.class));
        if (list.isEmpty()){
            return null;
        }else {
            return list.get(0);
        }
    }
}

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

@ -68,6 +68,7 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        translateDictForOne(baseInfoVO);
        IotProductExtendInfoVO extendInfoVO = convertToModel(extendInfoDO,IotProductExtendInfoVO.class);
        extendInfoVO.setRatifyDate(DateUtil.dateToStrShort(extendInfoDO.getRatifyDate()));
        List<IotProductAttachmentVO> attachmentVOList =
                convertToModels(attachmentDOList,new ArrayList<>(attachmentDOList.size()),IotProductAttachmentVO.class);
        List<IotProductMeasuredDataVO> measuredDataVOList =
@ -258,6 +259,9 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        baseInfoDO.setStartTime(DateUtil.strToDate(baseInfoVO.getStartTime()));
        baseInfoDO.setEndTime(DateUtil.strToDate(baseInfoVO.getEndTime()));
        IotProductExtendInfoDO extendInfoDO = convertToModel(extendInfoVO,IotProductExtendInfoDO.class);
        if(StringUtils.isNotBlank(extendInfoVO.getRatifyDate())){
            extendInfoDO.setRatifyDate(DateUtil.strToDate(extendInfoVO.getRatifyDate()));
        }
        List<IotProductAttachmentDO> attachmentDOList =
                convertToModels(attachmentVOList,new ArrayList<>(attachmentVOList.size()),IotProductAttachmentDO.class);
        List<IotProductMeasuredDataDO> measuredDataDOList =
@ -434,7 +438,9 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
     * @author cx
     * @date 2023/5/5 16:12
     */
    public boolean updateProperty(String productId,String property) {
    public int updateProperty(String productId,String property) {
       return iotProductBaseInfoDao.updateProperty(productId, property);
    }
}

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

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