瀏覽代碼

Merge branch 'dev' of chaoren1/wlyy2.0 into medicare

wangzhinan 3 年之前
父節點
當前提交
e9ae419faa
共有 40 個文件被更改,包括 1334 次插入273 次删除
  1. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java
  2. 12 0
      common/common-entity/sql记录
  3. 22 55
      common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinedevice.java
  4. 13 34
      common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinedrugs.java
  5. 14 26
      common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicineorder.java
  6. 15 54
      common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicineorderdetail.java
  7. 9 32
      common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinestockout.java
  8. 73 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientSafeAreaConfirm.java
  9. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientSafeAreaDO.java
  10. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  11. 25 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  12. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  13. 177 6
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineDrugsEndpoint.java
  14. 4 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/device/DeviceManageEndpoint.java
  15. 202 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineDrugsService.java
  16. 20 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientSafeAreaConfirmDao.java
  17. 9 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientSafeAreaDao.java
  18. 15 8
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java
  19. 22 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  20. 87 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/safeArea/DoctorSafeAreaController.java
  21. 31 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  22. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java
  23. 21 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java
  24. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java
  25. 125 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  26. 4 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java
  27. 1 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java
  28. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java
  29. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java
  30. 68 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  31. 55 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/safeArea/SafeAreaService.java
  32. 244 24
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  33. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java
  34. 4 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java
  35. 2 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/dao/device/PatientSafeAreaDao.java
  36. 21 6
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java
  37. 2 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/DeviceDataPushLogUtil.java
  38. 4 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java
  39. 10 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/SecurityOrderUtil.java
  40. 4 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java

@ -69,4 +69,7 @@ public interface SystemMessageDao extends PagingAndSortingRepository<SystemMessa
    @Query("DELETE FROM SystemMessageDO where type='43' and relationCode in(?1) ")
    @Query("DELETE FROM SystemMessageDO where type='43' and relationCode in(?1) ")
    void delMessageByRelationCode(List<String> relationCode);
    void delMessageByRelationCode(List<String> relationCode);
    @Modifying
    @Query("update SystemMessageDO m set m.isRead=1 ,m.over=0,m.data=?3 where m.type=?1 and m.relationCode=?2 ")
    void readByTypeAndRelationCode(String type,String relationCode,String data);
}
}

+ 12 - 0
common/common-entity/sql记录

@ -1589,3 +1589,15 @@ CREATE TABLE `dm_ys_config` (
-- 2021-11-11
-- 2021-11-11
alter table base_patient  add column `home_lat_lon` varchar(100) DEFAULT NULL COMMENT '居民家庭经纬度';
alter table base_patient  add column `home_lat_lon` varchar(100) DEFAULT NULL COMMENT '居民家庭经纬度';
ALTER table wlyy_patient_safe_area add column manage_status TINYINT(2) default '0' COMMENT '电子围栏确认情况 0待确认 1已确认';
ALTER table wlyy_patient_safe_area add column manage_status TINYINT(2) default '0' COMMENT '电子围栏确认情况 0待确认 1已确认';
ALTER TABLE wlyy_patient_safe_area add column  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废';
CREATE TABLE wlyy_patient_safe_area_confirm (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL COMMENT '居民id',
	 doctor_code varchar(50) DEFAULT NULL COMMENT '助老员code',
	`safe_id` varchar(50) DEFAULT NULL COMMENT '安全区域id 关联居民电子围栏id',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建日期',
  `manage_status` tinyint(2) DEFAULT '0' COMMENT '电子围栏确认情况 0待确认 1已确认',
  `del` varchar(1) DEFAULT '1' COMMENT '作废标识,1正常,0作废',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='患者电子围栏新增记录';

+ 22 - 55
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinedevice.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.a1entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
@ -12,75 +13,58 @@ import java.util.Date;
@Entity
@Entity
@Table(name="t_mediicine_device")
@Table(name="t_mediicine_device")
public class Mediicinedevice implements Serializable {
public class Mediicinedevice extends UuidIdentityEntityWithOperator implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    /**
    /**
     * 设备id
     * 所属
     */
     */
    @Column(length = 50)
    private String idDevice;
    private String belongCommunity;
    /**
    /**
     * 设备分类
     * 设备分类
     */
     */
    @Column(length = 50)
    private String equClass;
    private String equClass;
    /**
     * 所属
     */
    @Column(length = 50)
    private String belongCommunity;
    /**
    /**
     * 网络状态
     * 网络状态
     */
     */
    @Column(length = 10)
    private Integer networkStatus;
    private String networkStatus;
    /**
    /**
     * 售卖状态
     * 售卖状态
     */
     */
    private Integer saleStatus;
    private String saleStatus;
    /**
    /**
     * 设备名称
     * 设备名称
     */
     */
    @Column(length = 50)
    private String equName;
    private String equName;
    /**
    /**
     * 设备编号
     * 设备编号
     */
     */
    @Column(length = 50)
    private Integer equNum;
    private String equNum;
    /**
    /**
     * 机器编码
     * 机器编码
     */
     */
    @Column(length = 50)
    private String machineCode;
    private String machineCode;
    /**
    /**
     * 设备型号
     * 设备型号
     */
     */
    @Column(length = 50)
    private String equType;
    private String equType;
    /**
    /**
     * 上电测试
     * 上电测试
     */
     */
    @Column(length = 50)
    private String poweronTest;
    private String poweronTest;
    /**
    /**
     * 设备详情
     * 设备详情
     */
     */
    @Column(length = 100)
    private String equInfo;
    private String equInfo;
    /**
    /**
@ -91,7 +75,7 @@ public class Mediicinedevice implements Serializable {
    /**
    /**
     * 信号强度
     * 信号强度
     */
     */
    private Integer signalintensity;
    private String signalintensity;
    /**
    /**
     * 所属
     * 所属
@ -101,82 +85,65 @@ public class Mediicinedevice implements Serializable {
    /**
    /**
     * 社区中心名称
     * 社区中心名称
     */
     */
    @Column(length = 100)
    private String community;
    private String community;
    /**
    /**
     * 投放地址
     * 投放地址
     */
     */
    @Column(length = 200)
    private String deliveryAddress;
    private String deliveryAddress;
    /**
    /**
     * 升级情况
     * 升级情况
     */
     */
    @Column(length = 40)
    private String upgrAdesit;
    private String upgrAdesit;
    /**
    /**
     * 设备区域
     * 设备区域
     */
     */
    @Column(length = 40)
    private String equArea;
    private String equArea;
    /**
    /**
     * 详细地址
     * 详细地址
     */
     */
    @Column(length = 140)
    private String detailAddress;
    private String detailAddress;
    /**
    /**
     * 套餐
     * 套餐
     */
     */
    @Column(length = 140)
    private String packAge;
    private String packAge;
    /**
    /**
     * 流量
     * 流量
     */
     */
    @Column(length = 140)
    private String flow;
    private String flow;
    /**
    /**
     * 已使用流量
     * 已使用流量
     */
     */
    @Column(length = 140)
    private String UsageFlow;
    private String UsageFlow;
    /**
    /**
     * 卡状态
     * 卡状态
     */
     */
    @Column(length = 140)
    private String cardStatus;
    private String cardStatus;
    /**
    /**
     * 运营商
     * 运营商
     */
     */
    @Column(length = 140)
    private String operator;
    private String operator;
    /**
    /**
     * 删除
     * 删除
     */
     */
    private Integer del;
    private String del;
    /**
    /**
     * 状态
     * 状态
     */
     */
    private Integer status;
    private String status;
    public Mediicinedevice() {
    public Mediicinedevice() {
    }
    }
    public String getIdDevice() {
        return idDevice;
    }
    public void setIdDevice(String idDevice) {
        this.idDevice = idDevice;
    }
    public String getEquClass() {
    public String getEquClass() {
        return equClass;
        return equClass;
@ -194,19 +161,19 @@ public class Mediicinedevice implements Serializable {
        this.belongCommunity = belongCommunity;
        this.belongCommunity = belongCommunity;
    }
    }
    public Integer getNetworkStatus() {
    public String getNetworkStatus() {
        return networkStatus;
        return networkStatus;
    }
    }
    public void setNetworkStatus(Integer networkStatus) {
    public void setNetworkStatus(String networkStatus) {
        this.networkStatus = networkStatus;
        this.networkStatus = networkStatus;
    }
    }
    public Integer getSaleStatus() {
    public String getSaleStatus() {
        return saleStatus;
        return saleStatus;
    }
    }
    public void setSaleStatus(Integer saleStatus) {
    public void setSaleStatus(String saleStatus) {
        this.saleStatus = saleStatus;
        this.saleStatus = saleStatus;
    }
    }
@ -218,11 +185,11 @@ public class Mediicinedevice implements Serializable {
        this.equName = equName;
        this.equName = equName;
    }
    }
    public Integer getEquNum() {
    public String getEquNum() {
        return equNum;
        return equNum;
    }
    }
    public void setEquNum(Integer equNum) {
    public void setEquNum(String equNum) {
        this.equNum = equNum;
        this.equNum = equNum;
    }
    }
@ -267,11 +234,11 @@ public class Mediicinedevice implements Serializable {
        this.regDate = regDate;
        this.regDate = regDate;
    }
    }
    public Integer getSignalintensity() {
    public String getSignalintensity() {
        return signalintensity;
        return signalintensity;
    }
    }
    public void setSignalintensity(Integer signalintensity) {
    public void setSignalintensity(String signalintensity) {
        this.signalintensity = signalintensity;
        this.signalintensity = signalintensity;
    }
    }
@ -363,19 +330,19 @@ public class Mediicinedevice implements Serializable {
        this.operator = operator;
        this.operator = operator;
    }
    }
    public Integer getDel() {
    public String getDel() {
        return del;
        return del;
    }
    }
    public void setDel(Integer del) {
    public void setDel(String del) {
        this.del = del;
        this.del = del;
    }
    }
    public Integer getStatus() {
    public String getStatus() {
        return status;
        return status;
    }
    }
    public void setStatus(Integer status) {
    public void setStatus(String status) {
        this.status = status;
        this.status = status;
    }
    }
}
}

+ 13 - 34
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinedrugs.java

@ -2,6 +2,8 @@ package com.yihu.jw.entity.a1entity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Id;
@ -10,99 +12,83 @@ import java.io.Serializable;
@Entity
@Entity
@Table(name="t_mediicine_drugs")
@Table(name="t_mediicine_drugs")
public class Mediicinedrugs implements Serializable {
public class Mediicinedrugs extends UuidIdentityEntityWithOperator implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    /**
    /**
     * iddrug
     * 状态
     */
     */
    @Column(length = 40)
    private String idDrug;
    private String state;
    /**
    /**
     * 名称
     * 名称
     */
     */
    @Column(length = 40)
    private String drugName;
    private String drugName;
    /**
    /**
     * 条码
     * 条码
     */
     */
    @Column(length = 40)
    private String barcode;
    private String barcode;
    /**
    /**
     * 编码
     * 编码
     */
     */
    @Column(length = 40)
    private String drugCode;
    private String drugCode;
    /**
    /**
     * 简码
     * 简码
     */
     */
    @Column(length = 40)
    private String drugShortCode;
    private String drugShortCode;
    /**
    /**
     * 药品分类
     * 药品分类
     */
     */
    @Column(length = 40)
    private String drugClass;
    private String drugClass;
    /**
    /**
     * 预警类型
     * 预警类型
     */
     */
    @Column(length = 40)
    private String earlywarningcate;
    private String earlywarningcate;
    /**
    /**
     * 药柜
     * 药柜
     */
     */
    @Column(length = 40)
    private String medCabinet;
    private String medCabinet;
    /**
    /**
     * 图片
     * 图片
     */
     */
    @Column(length = 200)
    private String pic;
    private String pic;
    /**
    /**
     * 药品名称
     * 药品名称
     */
     */
    @Column(length = 40)
    private String drugNameAlies;
    private String drugNameAlies;
    /**
    /**
     * 药品条码
     * 药品条码
     */
     */
    @Column(length = 40)
    private String drugBarCode;
    private String drugBarCode;
    /**
    /**
     * 分类
     * 分类
     */
     */
    @Column(length = 40)
    private String drugClassCode;
    private String drugClassCode;
    /**
    /**
     * 剂型
     * 剂型
     */
     */
    @Column(length = 40)
    private String dosForm;
    private String dosForm;
    /**
    /**
     * drugtypecode
     * drugtypecode
     */
     */
    @Column(length = 40)
    private String drugTypeCode;
    private String drugTypeCode;
    /**
    /**
     * 单位
     * 单位
     */
     */
    @Column(length = 40)
    private String unit;
    private String unit;
    /**
    /**
@ -113,54 +99,47 @@ public class Mediicinedrugs implements Serializable {
    /**
    /**
     * 库存
     * 库存
     */
     */
    @Column(length = 40)
    private String inventory;
    private String inventory;
    /**
    /**
     * 销量
     * 销量
     */
     */
    @Column(length = 40)
    private String saleVolume;
    private String saleVolume;
    /**
    /**
     * 自编码
     * 自编码
     */
     */
    @Column(length = 40)
    private String selfCode;
    private String selfCode;
    /**
    /**
     * 规格
     * 规格
     */
     */
    @Column(length = 40)
    private String specif;
    private String specif;
    /**
    /**
     * 厂家
     * 厂家
     */
     */
    @Column(length = 40)
    private String manufactor;
    private String manufactor;
    /**
    /**
     * 批准文号
     * 批准文号
     */
     */
    @Column(length = 40)
    private Integer approvalNum;
    private String approvalNum;
    /**
    /**
     * 品牌
     * 品牌
     */
     */
    @Column(length = 40)
    private String brand;
    private String brand;
    public Mediicinedrugs() {
    public Mediicinedrugs() {
    }
    }
    public String getIdDrug() {
        return idDrug;
    public String getState() {
        return state;
    }
    }
    public void setIdDrug(String idDrug) {
        this.idDrug = idDrug;
    public void setState(String state) {
        this.state = state;
    }
    }
    public String getDrugName() {
    public String getDrugName() {
@ -323,11 +302,11 @@ public class Mediicinedrugs implements Serializable {
        this.manufactor = manufactor;
        this.manufactor = manufactor;
    }
    }
    public Integer getApprovalNum() {
    public String getApprovalNum() {
        return approvalNum;
        return approvalNum;
    }
    }
    public void setApprovalNum(Integer approvalNum) {
    public void setApprovalNum(String approvalNum) {
        this.approvalNum = approvalNum;
        this.approvalNum = approvalNum;
    }
    }

+ 14 - 26
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicineorder.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.a1entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
@ -13,15 +14,9 @@ import java.util.Date;
@Entity
@Entity
@Table(name="t_mediicine_order")
@Table(name="t_mediicine_order")
public class Mediicineorder implements Serializable {
public class Mediicineorder extends UuidIdentityEntityWithOperator implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    /**
     * idorder
     */
    private String idOrder;
    /**
    /**
     * 订单号
     * 订单号
@ -88,7 +83,7 @@ public class Mediicineorder implements Serializable {
    /**
    /**
     * 取货码
     * 取货码
     */
     */
    private Integer pickUpNum;
    private String pickUpNum;
    /**
    /**
     * 订单金额
     * 订单金额
@ -119,12 +114,12 @@ public class Mediicineorder implements Serializable {
     * 身份证号
     * 身份证号
     */
     */
    private Integer idNum;
    private String idNum;
    /**
    /**
     * 年龄
     * 年龄
     */
     */
    private Integer age;
    private String age;
    /**
    /**
     * 联系方式
     * 联系方式
@ -144,7 +139,7 @@ public class Mediicineorder implements Serializable {
    /**
    /**
     * 设备编号
     * 设备编号
     */
     */
    private Integer equNum;
    private String equNum;
    /**
    /**
     * 设备地址
     * 设备地址
@ -171,13 +166,6 @@ public class Mediicineorder implements Serializable {
    public Mediicineorder() {
    public Mediicineorder() {
    }
    }
    public String getIdOrder() {
        return idOrder;
    }
    public void setIdOrder(String idOrder) {
        this.idOrder = idOrder;
    }
    public String getOrderNum() {
    public String getOrderNum() {
        return orderNum;
        return orderNum;
@ -276,11 +264,11 @@ public class Mediicineorder implements Serializable {
        this.infoAccess = infoAccess;
        this.infoAccess = infoAccess;
    }
    }
    public Integer getPickUpNum() {
    public String getPickUpNum() {
        return pickUpNum;
        return pickUpNum;
    }
    }
    public void setPickUpNum(Integer pickUpNum) {
    public void setPickUpNum(String pickUpNum) {
        this.pickUpNum = pickUpNum;
        this.pickUpNum = pickUpNum;
    }
    }
@ -324,19 +312,19 @@ public class Mediicineorder implements Serializable {
        this.sex = sex;
        this.sex = sex;
    }
    }
    public Integer getIdNum() {
    public String getIdNum() {
        return idNum;
        return idNum;
    }
    }
    public void setIdNum(Integer idNum) {
    public void setIdNum(String idNum) {
        this.idNum = idNum;
        this.idNum = idNum;
    }
    }
    public Integer getAge() {
    public String getAge() {
        return age;
        return age;
    }
    }
    public void setAge(Integer age) {
    public void setAge(String age) {
        this.age = age;
        this.age = age;
    }
    }
@ -364,11 +352,11 @@ public class Mediicineorder implements Serializable {
        this.shippingEqu = shippingEqu;
        this.shippingEqu = shippingEqu;
    }
    }
    public Integer getEquNum() {
    public String getEquNum() {
        return equNum;
        return equNum;
    }
    }
    public void setEquNum(Integer equNum) {
    public void setEquNum(String equNum) {
        this.equNum = equNum;
        this.equNum = equNum;
    }
    }

+ 15 - 54
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicineorderdetail.java

@ -1,5 +1,7 @@
package com.yihu.jw.entity.a1entity;
package com.yihu.jw.entity.a1entity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Id;
@ -9,33 +11,22 @@ import java.util.Date;
@Entity
@Entity
@Table(name="t_mediicine_order_detail")
@Table(name="t_mediicine_order_detail")
public class Mediicineorderdetail implements Serializable {
    private static final long serialVersionUID = 1L;
public class Mediicineorderdetail extends UuidIdentityEntityWithOperator implements Serializable {
    @Id
    /**
     * idorderdetail
     */
    @Column(length = 40)
    private String idOrderDetail;
    /**
    /**
     * idorder
     * idorder
     */
     */
    @Column(length = 40)
    private String idOrder;
    private String idOrder;
    /**
    /**
     * orderno
     * orderno
     */
     */
    @Column(length = 40)
    private String orderNo;
    private String orderNo;
    /**
    /**
     * 药品信息
     * 药品信息
     */
     */
    @Column(length = 40)
    private String medInfo;
    private String medInfo;
    /**
    /**
@ -51,55 +42,46 @@ public class Mediicineorderdetail implements Serializable {
    /**
    /**
     * 批次号
     * 批次号
     */
     */
    @Column(length = 40)
    private String batchNum;
    private String batchNum;
    /**
    /**
     * cargoinfo
     * cargoinfo
     */
     */
    @Column(length = 40)
    private String cargoInfo;
    private String cargoInfo;
    /**
    /**
     * drugcode
     * drugcode
     */
     */
    @Column(length = 40)
    private String drugCode;
    private String drugCode;
    /**
    /**
     * 订单号
     * 订单号
     */
     */
    @Column(length = 40)
    private String orderNum;
    private String orderNum;
    /**
    /**
     * 订单状态
     * 订单状态
     */
     */
    @Column(length = 40)
    private String orderState;
    private String orderState;
    /**
    /**
     * 出货状态
     * 出货状态
     */
     */
    @Column(length = 40)
    private String sellState;
    private String sellState;
    /**
    /**
     * 取药区域
     * 取药区域
     */
     */
    @Column(length = 40)
    private String dispensingWindow;
    private String dispensingWindow;
    /**
    /**
     * 开方时间
     * 开方时间
     */
     */
    @Column(length = 40)
    private Date prescribeTime;
    private Date prescribeTime;
    /**
    /**
     * 处方号
     * 处方号
     */
     */
    @Column(length = 40)
    private String prescribeNum;
    private String prescribeNum;
    /**
    /**
@ -117,7 +99,6 @@ public class Mediicineorderdetail implements Serializable {
    /**
    /**
     * 商品总金额
     * 商品总金额
     */
     */
    @Column(length = 40)
    private String goodsTotalAmount;
    private String goodsTotalAmount;
    /**
    /**
@ -128,19 +109,17 @@ public class Mediicineorderdetail implements Serializable {
    /**
    /**
     * 订单来源
     * 订单来源
     */
     */
    @Column(length = 40)
    private String orderSource;
    private String orderSource;
    /**
    /**
     * 存取信息
     * 存取信息
     */
     */
    @Column(length = 40)
    private String infoAccess;
    private String infoAccess;
    /**
    /**
     * 取货码
     * 取货码
     */
     */
    private Integer pickUpNum;
    private String pickUpNum;
    /**
    /**
     * 订单金额
     * 订单金额
@ -150,78 +129,67 @@ public class Mediicineorderdetail implements Serializable {
    /**
    /**
     * 订单类型
     * 订单类型
     */
     */
    @Column(length = 40)
    private String orderType;
    private String orderType;
    /**
    /**
     * 社保扣款
     * 社保扣款
     */
     */
    @Column(length = 40)
    private String socialinsurpayment;
    private String socialinsurpayment;
    /**
    /**
     * 姓名
     * 姓名
     */
     */
    @Column(length = 40)
    private String name;
    private String name;
    /**
    /**
     * 性别
     * 性别
     */
     */
    @Column(length = 40)
    private String sex;
    private String sex;
    /**
    /**
     * 身份证号
     * 身份证号
     */
     */
    private Integer idNum;
    private String idNum;
    /**
    /**
     * 年龄
     * 年龄
     */
     */
    private Integer age;
    private String age;
    /**
    /**
     * 联系方式
     * 联系方式
     */
     */
    @Column(length = 40)
    private String contact;
    private String contact;
    /**
    /**
     * 住址
     * 住址
     */
     */
    @Column(length = 40)
    private String address;
    private String address;
    /**
    /**
     * 出货设备
     * 出货设备
     */
     */
    @Column(length = 40)
    private String shippingEqu;
    private String shippingEqu;
    /**
    /**
     * 设备编号
     * 设备编号
     */
     */
    @Column(length = 40)
    private Integer equNum;
    private String equNum;
    /**
    /**
     * 设备地址
     * 设备地址
     */
     */
    @Column(length = 40)
    private String equAddress;
    private String equAddress;
    /**
    /**
     * 商品名称
     * 商品名称
     */
     */
    @Column(length = 40)
    private String goodsName;
    private String goodsName;
    /**
    /**
     * 出货时间
     * 出货时间
     */
     */
    @Column(length = 40)
    private Date shippingTime;
    private Date shippingTime;
@ -229,13 +197,6 @@ public class Mediicineorderdetail implements Serializable {
    public Mediicineorderdetail() {
    public Mediicineorderdetail() {
    }
    }
    public String getIdOrderDetail() {
        return idOrderDetail;
    }
    public void setIdOrderDetail(String idOrderDetail) {
        this.idOrderDetail = idOrderDetail;
    }
    public String getIdOrder() {
    public String getIdOrder() {
        return idOrder;
        return idOrder;
@ -397,11 +358,11 @@ public class Mediicineorderdetail implements Serializable {
        this.infoAccess = infoAccess;
        this.infoAccess = infoAccess;
    }
    }
    public Integer getPickUpNum() {
    public String getPickUpNum() {
        return pickUpNum;
        return pickUpNum;
    }
    }
    public void setPickUpNum(Integer pickUpNum) {
    public void setPickUpNum(String pickUpNum) {
        this.pickUpNum = pickUpNum;
        this.pickUpNum = pickUpNum;
    }
    }
@ -445,19 +406,19 @@ public class Mediicineorderdetail implements Serializable {
        this.sex = sex;
        this.sex = sex;
    }
    }
    public Integer getIdNum() {
    public String getIdNum() {
        return idNum;
        return idNum;
    }
    }
    public void setIdNum(Integer idNum) {
    public void setIdNum(String idNum) {
        this.idNum = idNum;
        this.idNum = idNum;
    }
    }
    public Integer getAge() {
    public String getAge() {
        return age;
        return age;
    }
    }
    public void setAge(Integer age) {
    public void setAge(String age) {
        this.age = age;
        this.age = age;
    }
    }
@ -485,11 +446,11 @@ public class Mediicineorderdetail implements Serializable {
        this.shippingEqu = shippingEqu;
        this.shippingEqu = shippingEqu;
    }
    }
    public Integer getEquNum() {
    public String getEquNum() {
        return equNum;
        return equNum;
    }
    }
    public void setEquNum(Integer equNum) {
    public void setEquNum(String equNum) {
        this.equNum = equNum;
        this.equNum = equNum;
    }
    }

+ 9 - 32
common/common-entity/src/main/java/com/yihu/jw/entity/a1entity/Mediicinestockout.java

@ -1,6 +1,8 @@
package com.yihu.jw.entity.a1entity;
package com.yihu.jw.entity.a1entity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Id;
@ -10,52 +12,38 @@ import java.util.Date;
@Entity
@Entity
@Table(name="t_mediicine_stockout")
@Table(name="t_mediicine_stockout")
public class Mediicinestockout implements Serializable {
    private static final long serialVersionUID = 1L;
public class Mediicinestockout extends UuidIdentityEntityWithOperator implements Serializable {
    /**
     * idstockout
     */
    @Id
    @Column(length = 40)
    private String idStockOut;
    /**
    /**
     * community
     * community
     */
     */
    @Column(length = 40)
    private String community;
    private String community;
    /**
    /**
     * replenisher
     * replenisher
     */
     */
    @Column(length = 40)
    private String replenishEr;
    private String replenishEr;
    /**
    /**
     * state
     * state
     */
     */
    @Column(length = 40)
    private String state;
    private String state;
    /**
    /**
     * replenishequ
     * replenishequ
     */
     */
    @Column(length = 40)
    private String replenishEqu;
    private String replenishEqu;
    /**
    /**
     * replenishcate
     * replenishcate
     */
     */
    @Column(length = 40)
    private String replenishCate;
    private String replenishCate;
    /**
    /**
     * replenishinventory
     * replenishinventory
     */
     */
    @Column(length = 40)
    private String replenishInventory;
    private String replenishInventory;
    /**
    /**
@ -66,42 +54,31 @@ public class Mediicinestockout implements Serializable {
    /**
    /**
     * remark
     * remark
     */
     */
    @Column(length = 40)
    private String remark;
    private String remark;
    /**
    /**
     * 单号
     * 单号
     */
     */
    private Integer trackNum;
    private String trackNum;
    /**
    /**
     * 地址
     * 地址
     */
     */
    @Column(length = 40)
    private String address;
    private String address;
    /**
    /**
     * 单据编号
     * 单据编号
     */
     */
    @Column(length = 40)
    private Integer docNum;
    private String docNum;
    /**
    /**
     * 领取状态
     * 领取状态
     */
     */
    @Column(length = 40)
    private String receiveState;
    private String receiveState;
    public Mediicinestockout() {
    public Mediicinestockout() {
    }
    }
    public String getIdStockOut() {
        return idStockOut;
    }
    public void setIdStockOut(String idStockOut) {
        this.idStockOut = idStockOut;
    }
    public String getCommunity() {
    public String getCommunity() {
        return community;
        return community;
@ -167,11 +144,11 @@ public class Mediicinestockout implements Serializable {
        this.remark = remark;
        this.remark = remark;
    }
    }
    public Integer getTrackNum() {
    public String getTrackNum() {
        return trackNum;
        return trackNum;
    }
    }
    public void setTrackNum(Integer trackNum) {
    public void setTrackNum(String trackNum) {
        this.trackNum = trackNum;
        this.trackNum = trackNum;
    }
    }
@ -183,11 +160,11 @@ public class Mediicinestockout implements Serializable {
        this.address = address;
        this.address = address;
    }
    }
    public Integer getDocNum() {
    public String getDocNum() {
        return docNum;
        return docNum;
    }
    }
    public void setDocNum(Integer docNum) {
    public void setDocNum(String docNum) {
        this.docNum = docNum;
        this.docNum = docNum;
    }
    }

+ 73 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientSafeAreaConfirm.java

@ -0,0 +1,73 @@
package com.yihu.jw.entity.care.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Bing on 2021/11/16.
 */
@Entity
@Table(name="wlyy_patient_safe_area_confirm")
public class PatientSafeAreaConfirm extends IdEntity {
    private String patient;
    private String doctorCode;//助老员code
    private String safeId; //安全区域id 关联居民电子围栏id
    private String del;//作废标识,1正常,0作废
    private Integer manageStatus;//电子围栏确认情况 0待确认 1已确认
    private Date createTime;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getSafeId() {
        return safeId;
    }
    public void setSafeId(String safeId) {
        this.safeId = safeId;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public Integer getManageStatus() {
        return manageStatus;
    }
    public void setManageStatus(Integer manageStatus) {
        this.manageStatus = manageStatus;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientSafeAreaDO.java

@ -21,6 +21,7 @@ public class PatientSafeAreaDO extends IdEntity {
    private Date createTime;
    private Date createTime;
    private Date updateTime;
    private Date updateTime;
    private String del;//作废标识,1正常,0作废
    private Integer manageStatus;//电子围栏确认情况 0待确认 1已确认
    private Integer manageStatus;//电子围栏确认情况 0待确认 1已确认
    public String getPatient() {
    public String getPatient() {
@ -73,4 +74,12 @@ public class PatientSafeAreaDO extends IdEntity {
    public void setManageStatus(Integer manageStatus) {
    public void setManageStatus(Integer manageStatus) {
        this.manageStatus = manageStatus;
        this.manageStatus = manageStatus;
    }
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -22,6 +22,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     * 人文关怀系统消息 41
     * 人文关怀系统消息 41
     * 体征设备测量系统消息 42
     * 体征设备测量系统消息 42
     * 设备离线系统消息 43
     * 设备离线系统消息 43
     * 监护确认消息 44
     * 家属紧急预警系统消息 50
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 新生儿在线咨询 850
     * 老人在线咨询 851
     * 老人在线咨询 851

+ 25 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -9,6 +9,31 @@ public class BaseRequestMapping {
    @Deprecated
    @Deprecated
    public static final String api_base_common = "/svr-bases";
    public static final String api_base_common = "/svr-bases";
    /**
     * 药品信息  BaseSensitive
     */
    public static class BaseDrug extends Basic {
        public static final String PREFIX  = "/baseDrug";
        public static final String DOCINFO  = "/docInfo";
        public static final String CREATE  = "/create";
        public static final String getOrgListByTown  = "/getOrgListByTown";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String docFullInfo  = "/docFullInfo";
        public static final String docOrgDutyTreeInfo  = "/docOrgDutyTreeInfo";
        public static final String docOrgDeptTreeInfo  = "/docOrgDeptTreeInfo";
        public static final String getDoctorListByDept  = "/getDoctorListByDept";
        public static final String DOCTOR_INFO_IMPORT  = "/baseDoctorInfoImport";
        public static final String findIncentive  = "/findIncentive";
        public static final String findIncentiveById  = "/findIncentiveById";
        public static final String deleteIncentiveById  = "/deleteIncentiveById";
        public static final String saveIncentiveById  = "/saveIncentiveById";
        public static final String saveDoctorIncentive  = "/saveDoctorIncentive";
        public static final String findDoctorIncentive  = "/findDoctorIncentive";
        public static final String findDoctorOtherIncentive  = "/findDoctorOtherIncentive";
        public static final String removeIncentive  = "/removeIncentive";
        public static final String resetDoctorPwd  = "/resetDoctorPwd";
    }
    /**
    /**
     * 基础请求地址
     * 基础请求地址
     */
     */

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -340,7 +340,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        }
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        if ("pad".equals(parameters.get("clientType"))&&("2".equals(wlyyUserSimple.getArchiveType())) ){//医养平板端登录限制
        if ("pad".equals(parameters.get("clientType"))&&!("1".equals(wlyyUserSimple.getArchiveType())) ){//医养平板端登录限制
            throw new InvalidGrantException("不允许登录该平台");
            throw new InvalidGrantException("不允许登录该平台");
        }
        }
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setAccessToken(token.getValue());

+ 177 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineDrugsEndpoint.java

@ -1,23 +1,48 @@
package com.yihu.jw.base.endpoint.a4endpoint;
package com.yihu.jw.base.endpoint.a4endpoint;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.service.a3service.MedicineDrugsService;
import com.yihu.jw.base.service.a3service.MedicineDrugsService;
import com.yihu.jw.base.service.a3service.MedicineOrderService;
import com.yihu.jw.base.service.a3service.MedicineOrderService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.a1entity.Mediicinedrugs;
import com.yihu.jw.entity.a1entity.Mediicinedrugs;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.List;
@Api(description = "药品信息")
@RestController
@RestController
@RequestMapping("/MedicineDrugsEndpoint")
public class MedicineDrugsEndpoint {
@RequestMapping(value = BaseRequestMapping.BaseDrug.PREFIX)
@Api(value = "药品信息管理", description = "药品信息管理服务接口", tags = {"wlyy基础服务 - 药品信息管理服务接口"})
public class MedicineDrugsEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    MedicineDrugsService drugsService;
    MedicineDrugsService drugsService;
    @Autowired
    @Autowired
@ -25,6 +50,152 @@ public class MedicineDrugsEndpoint {
    @Autowired
    @Autowired
    private ObjectMapper objectMapper;
    private ObjectMapper objectMapper;
    @Value("${wechat.id}")
    private String wechatId;
    @PostMapping(value = BaseRequestMapping.BaseDrug.CREATE)
    @ApiOperation(value = "新增药品信息")
    public Envelop create(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        JSONObject jsonObject = null;
        String str = drugsService.createDrug(jsonData);
        jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
    }
    @PostMapping(value = BaseRequestMapping.BaseDrug.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        drugsService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BaseDrug.UPDATE)
    @ApiOperation(value = "更新药品信息")
    public Envelop update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        String str = drugsService.updateDrug(jsonData);
        JSONObject jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("response"));
    }
    @GetMapping(value = BaseRequestMapping.BaseDrug.docFullInfo)
    @ApiOperation(value = "获取药品信息基础信息列表")
    public PageEnvelop getDrugFullInfolist(
            @ApiParam(name = "state", value = "药品状态")
            @RequestParam(value = "state", required = false) String state,
            @ApiParam(name = "content", value = "查询内容")
            @RequestParam(value = "content", required = false) String content,
            @ApiParam(name = "drugClass", value = "药品分类")
            @RequestParam(value = "drugClass", required = false) String drugClass,
            @ApiParam(name = "drugType", value = "药品类型")
            @RequestParam(value = "drugType", required = false) String drugType,
            @ApiParam(name = "lowVolume", value = "销量下限")
            @RequestParam(value = "lowVolume", required = false) String lowVolume,
            @ApiParam(name = "heightVolume", value = "销量上限")
            @RequestParam(value = "heightVolume", required = false) String heightVolume,
            @ApiParam(name = "lowPrice", value = "价格下限")
            @RequestParam(value = "lowPrice", required = false) String lowPrice,
            @ApiParam(name = "heightPrice", value = "价格上限")
            @RequestParam(value = "heightPrice", required = false) String heightPrice,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        JSONObject result = drugsService.queryDrugListFullInfo(state, content, drugClass, drugType, lowVolume, heightVolume, lowPrice, heightPrice,page,size,wechatId);
        return success(result.getJSONArray("msg"),result.getInteger("count"),page,size);
    }
    @GetMapping(value = "/excelControl/exportExcel")
    @ApiOperation("导出列表")
    @ResponseBody
    public void searchList(
            @ApiParam(name = "state", value = "药品状态")
            @RequestParam(value = "state", required = false) String state,
            @ApiParam(name = "content", value = "查询内容")
            @RequestParam(value = "content", required = false) String content,
            @ApiParam(name = "drugClass", value = "药品分类")
            @RequestParam(value = "drugClass", required = false) String drugClass,
            @ApiParam(name = "drugType", value = "药品类型")
            @RequestParam(value = "drugType", required = false) String drugType,
            @ApiParam(name = "lowVolume", value = "销量下限")
            @RequestParam(value = "lowVolume", required = false) String lowVolume,
            @ApiParam(name = "heightVolume", value = "销量上限")
            @RequestParam(value = "heightVolume", required = false) String heightVolume,
            @ApiParam(name = "lowPrice", value = "价格下限")
            @RequestParam(value = "lowPrice", required = false) String lowPrice,
            @ApiParam(name = "heightPrice", value = "价格上限")
            @RequestParam(value = "heightPrice", required = false) String heightPrice,
            HttpServletResponse response) {
        try {
            JSONObject result = drugsService.queryDrugListFullInfo(state, content, drugClass, drugType, lowVolume, heightVolume, lowPrice, heightPrice,1,10000,wechatId);
            List<Mediicinedrugs> list = JSONObject.parseArray(result.getJSONArray("msg").toJSONString(), Mediicinedrugs.class);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("volunteerInfo.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os, list);
        } catch (Exception ex) {
            Envelop.getError("导出失败");
        }
    }
    private void write(OutputStream os, List<Mediicinedrugs> list) throws Exception {
        WritableWorkbook wwb = Workbook.createWorkbook(os);
        try {
            WritableSheet sheet = wwb.createSheet("sheet", 1);
            String header[] = {"图片", "药品名称/药品条码", "分类", "剂型", "类型", "单位", "售价", "库存", "销量", "自编码", "规格", "厂家", "批准文号", "品牌", "状态"};
            int i = 0;
            for (String h : header) {
                addCell(sheet, 0, i, h);
                i++;
            }
            int j = 1;
            int ii=1;
            for (Mediicinedrugs tmp : list) {
                addCell(sheet, j, 0, ii + "img");
                addCell(sheet, j, 1, tmp.getDrugNameAlies() +"/" + tmp.getDrugBarCode());
                addCell(sheet, j, 2, tmp.getDrugTypeCode());
                addCell(sheet, j, 3, tmp.getDosForm() + "");
                addCell(sheet, j, 4, tmp.getDrugTypeCode()+"");
                addCell(sheet, j, 5, tmp.getUnit() + "");
                addCell(sheet, j, 6, tmp.getPrice() + "");
                addCell(sheet, j, 7, tmp.getInventory() + "");
                addCell(sheet, j, 8, tmp.getSaleVolume() + "");
                addCell(sheet, j, 9, tmp.getSelfCode() + "");
                addCell(sheet, j, 10, tmp.getSpecif() + "");
                addCell(sheet, j, 11, tmp.getManufactor() + "");
                addCell(sheet, j, 12, tmp.getApprovalNum() + "");
                addCell(sheet, j, 13, tmp.getBrand() + "");
                addCell(sheet, j, 14, tmp.getState() + "");
                j++;
                ii++;
            }
            wwb.write();
            wwb.close();
        } catch (Exception e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
        }
    }
    private void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column, row, data);
        ws.addCell(label);
    }
    @ApiOperation(value = "提交药品列表", notes="参数未添加通过数据区域查询获取")
    @ApiOperation(value = "提交药品列表", notes="参数未添加通过数据区域查询获取")
    @GetMapping("/list")
    @GetMapping("/list")
    public List<Mediicinedrugs> list(){
    public List<Mediicinedrugs> list(){

+ 4 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/device/DeviceManageEndpoint.java

@ -303,6 +303,7 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
                }
                }
                if (!StringUtils.isEmpty(errorMsg.trim())) {
                if (!StringUtils.isEmpty(errorMsg.trim())) {
                    deviceDetail.setErrorMsg(errorMsg);
                    deviceDetail.setErrorMsg(errorMsg);
                    deviceDetail.setDeviceCode(deviceCode);
                    errorLs.add(deviceDetail);
                    errorLs.add(deviceDetail);
                    continue;
                    continue;
                }
                }
@ -315,6 +316,8 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
                deviceDetail.setDeviceModel(deviceModel);
                deviceDetail.setDeviceModel(deviceModel);
                deviceDetail.setDeviceCode(deviceCode);
                deviceDetail.setDeviceCode(deviceCode);
                deviceDetail.setSim(sim);
                deviceDetail.setSim(sim);
                deviceDetail.setIccid(iccid);
                deviceDetail.setImsi(imsi);
                Device device = deviceDao.findByModel(deviceModel);
                Device device = deviceDao.findByModel(deviceModel);
                if (device!=null){
                if (device!=null){
                    deviceDetail.setDeviceType(device.getDeviceType());
                    deviceDetail.setDeviceType(device.getDeviceType());
@ -334,7 +337,7 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
            map.put("successNum", correctLs.size());
            map.put("successNum", correctLs.size());
            map.put("failedNum", rows-1 - correctLs.size() );
            map.put("failedNum", rows-1 - correctLs.size() );
            map.put("errorData", JSON.toJSONString(errorMsgMapTotal, SerializerFeature.WriteMapNullValue));
            map.put("errorData", JSON.toJSONString(errorMsgMapTotal, SerializerFeature.WriteMapNullValue));
            map.put("errorData", errorLs);
            map.put("errorDataList", errorLs);
            return ObjEnvelop.getSuccess("success",JSON.toJSONString(map,SerializerFeature.WriteMapNullValue));
            return ObjEnvelop.getSuccess("success",JSON.toJSONString(map,SerializerFeature.WriteMapNullValue));
        } catch (Exception e) {
        } catch (Exception e) {

+ 202 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicineDrugsService.java

@ -1,27 +1,48 @@
package com.yihu.jw.base.service.a3service;
package com.yihu.jw.base.service.a3service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.a2dao.MediicinedrugsDao;
import com.yihu.jw.base.dao.a2dao.MediicinedrugsDao;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.a1entity.Mediicinedrugs;
import com.yihu.jw.entity.a1entity.Mediicinedrugs;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.io.IOException;
import java.util.List;
import java.util.*;
import java.util.logging.Logger;
/**
/**
 * Created by Bing on 2021/9/23.
 * Created by Bing on 2021/9/23.
 */
 */
@Service
@Service
public class MedicineDrugsService  {
public class MedicineDrugsService extends BaseJpaService<Mediicinedrugs, MediicinedrugsDao> {
    @Autowired
    @Autowired
    private MediicinedrugsDao drugsDao;
    private MediicinedrugsDao drugsDao;
    @Autowired
    @Autowired
    private ObjectMapper objectMapper;
    private ObjectMapper objectMapper;
    @Autowired
    private HibenateUtils hibenateUtils;
    //获取药品信息列表
    //获取药品信息列表
    public List<Mediicinedrugs> getMediicinedrugs() {
    public List<Mediicinedrugs> getMediicinedrugs() {
@ -67,4 +88,183 @@ public class MedicineDrugsService  {
//        result.put(ResponseContant.resultMsg,"success");
//        result.put(ResponseContant.resultMsg,"success");
        return result;
        return result;
    }
    }
    /**
     * 新增药品信息
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String createDrug(String jsonData) {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(jsonData)){
            result.put("msg","jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        JSONObject drug = JSONObject.parseObject(jsonData);
        if(null == drug){
            result.put("msg","parameter drug of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        String orgCode="";
        //判断药品id是否存在
        if(StringUtils.isEmpty(drug.getString("id"))){
            result.put("msg","parameter id for drug is null when update drug");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        Mediicinedrugs mediicinedrugs = null;
        try {
            mediicinedrugs = objectMapper.readValue(drug.toJSONString(), Mediicinedrugs.class);
        } catch (IOException e) {
            result.put("msg", "convert drug jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        } catch (Exception e) {
            result.put("msg", "convert drug birth failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        this.save(mediicinedrugs);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",mediicinedrugs);
        return result.toJSONString();
    }
    /**
     * 修改药品信息
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String updateDrug(String jsonData){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(jsonData)){
            result.put("msg","jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        JSONObject drug = JSONObject.parseObject(jsonData);
        if(null == drug){
            result.put("msg","parameter drug of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        String orgCode="";
        //判断医生id是否存在
        if(StringUtils.isEmpty(drug.getString("id"))){
            result.put("msg","parameter id for drug is null when update drug");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        Mediicinedrugs mediicinedrugs = null;
        try {
            mediicinedrugs = objectMapper.readValue(drug.toJSONString(), Mediicinedrugs.class);
        } catch (IOException e) {
            result.put("msg", "convert drug jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        } catch (Exception e) {
            result.put("msg", "convert drug birth failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        this.save(mediicinedrugs);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",mediicinedrugs);
        return result.toJSONString();
    }
    public JSONObject queryDrugListFullInfo(String state, String content, String drugClass,
                                              String drugType, String lowVolume, String heightVolume,
                                              String lowPrice, String heightPrice, int page, int size,String wechatId) throws Exception {
        JSONObject result = new JSONObject();
        /*String orgCodeVale = null == orgCode ? "" : orgCode;
        String del = null == docStatus ? "" : docStatus;
        String nameOrIdcardValue = null == nameOrIdcard ? "" : "%" + nameOrIdcard + "%";
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;*/
        String sql="SELECT\n" +
                "    t.id as id,\n" +
                "    t.approval_num as approvalNum,\n" +
                "    t.barcode as barcode,\n" +
                "    t.brand as brand,\n" +
                "    t.dos_form as dosForm,\n" +
                "    t.state as state,\n" +
                "    t.drug_bar_code as drugBarCode,\n" +
                "    t.drug_class as drugClass,\n" +
                "    t.drug_class_code as drugClassCode,\n" +
                "    t.drug_code as drugCode,\n" +
                "    t.drug_name as drugName,\n" +
                "    t.drug_name_alies as drugNameAlies,\n" +
                "    t.drug_short_code as drugShortCode,\n" +
                "    t.drug_type_code as drugTypeCode,\n" +
                "    t.earlywarningcate as earlywarningcate,\n" +
                "    t.inventory as inventory,\n" +
                "    t.manufactor as manufactor,\n" +
                "    t.med_cabinet as medCabinet,\n" +
                "    t.pic as pic,\n" +
                "    t.price as price,\n" +
                "    t.sale_volume as saleVolume,\n" +
                "    t.self_code as selfCode,\n" +
                "    t.specif as specif,\n" +
                "    t.unit as unit,\n" +
                "    t.create_time as createTime,\n" +
                "    t.create_user as createUser,\n" +
                "    t.create_user_name as createUserName,\n" +
                "    t.update_time as updateTime,\n" +
                "    t.update_user as updateUser,\n" +
                "    t.update_user_name as updateUserName\n" +
                "FROM\n" +
                "    t_mediicine_drugs AS t where 1=1\n";
        String conditionSql = "";
        if (!StringUtils.isEmpty(state)){
            conditionSql += " and t.state = " + state;
        }
        if (!StringUtils.isEmpty(content)){
            conditionSql += " and CONCAT(t.drug_code, t.drug_bar_code, drug_name, t.drug_short_code) like '%"+content+"%'";
        }
        if (!StringUtils.isEmpty(drugClass)){
            conditionSql += " and t.drug_class_code = " + drugClass;
        }
        if (!StringUtils.isEmpty(drugType)){
            conditionSql += " and t.drug_type_code = " + drugType;
        }
        if (!StringUtils.isEmpty(lowVolume)){
            conditionSql += " and t.sale_volume >= " + lowVolume;
        }
        if (!StringUtils.isEmpty(heightVolume)) {
            conditionSql += " and t.sale_volume <= " + heightVolume;
        }
        if (!StringUtils.isEmpty(lowPrice)){
            conditionSql += " and t.price >= " + lowPrice;
        }
        if (!StringUtils.isEmpty(heightPrice)) {
            conditionSql += " and t.price <= " + heightPrice;
        }
        sql = sql + conditionSql;
        List<Map<String,Object>> list=null;
        list = hibenateUtils.createSQLQuery(sql,page,size);
        String countSql = " select " +
                "     COUNT(DISTINCT (t.id)) as count " +
                "   from " +
                "     t_mediicine_drugs t " +
                "  where " +
                "  1=1   " +
                conditionSql;
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        int count = jdbcTemplate.queryForObject(countSql,Integer.class);
        for (Map<String,Object> map:list){
        }
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
    }
}
}

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientSafeAreaConfirmDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.PatientSafeAreaConfirm;
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;
import java.util.List;
public interface PatientSafeAreaConfirmDao extends PagingAndSortingRepository<PatientSafeAreaConfirm,Long>,
        JpaSpecificationExecutor<PatientSafeAreaConfirm> {
    List<PatientSafeAreaConfirm> findByDoctorCodeAndPatient(String doctorCode,String patient);
    @Modifying
    @Query(value = "update  PatientSafeAreaConfirm p set p.manageStatus=1 where p.patient=?1")
    void manageByPatient(String patient);
}

+ 9 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientSafeAreaDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.List;
@ -13,9 +14,17 @@ import java.util.List;
public interface PatientSafeAreaDao extends PagingAndSortingRepository<PatientSafeAreaDO,Long>,
public interface PatientSafeAreaDao extends PagingAndSortingRepository<PatientSafeAreaDO,Long>,
        JpaSpecificationExecutor<PatientSafeAreaDO> {
        JpaSpecificationExecutor<PatientSafeAreaDO> {
    @Query(value = " select p from PatientSafeAreaDO p where p.patient=?1 and p.del='1' and p.manageStatus=1 ")
    List<PatientSafeAreaDO> findByPatient(String patient);
    List<PatientSafeAreaDO> findByPatient(String patient);
    @Query(value = " select p from PatientSafeAreaDO p where p.patient=?1 and p.del='1'")
    List<PatientSafeAreaDO> findByPatient2(String patient);
    @Modifying
    @Modifying
    @Query(value = "update PatientSafeAreaDO p set p.del='0' where p.patient=?1 ")
    void deleteByPatient(String patient);
    void deleteByPatient(String patient);
    @Modifying
    @Query(value = " update PatientSafeAreaDO p set p.manageStatus=1 where p.patient=?1")
    void manageByPatient(String patient);
}
}

+ 15 - 8
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java

@ -118,7 +118,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            if (result.getInteger(ResponseContant.resultFlag)==ResponseContant.success){
            if (result.getInteger(ResponseContant.resultFlag)==ResponseContant.success){
                return success("添加成功");
                return success("添加成功");
            }else {
            }else {
                return success(result.getString(ResponseContant.resultMsg));
                return Envelop.getError(result.getString(ResponseContant.resultMsg));
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            return failedException2(e);
            return failedException2(e);
@ -180,8 +180,12 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            if (StringUtils.isEmpty(member)) {
            if (StringUtils.isEmpty(member)) {
                return failed( "成员不能为空",-1);
                return failed( "成员不能为空",-1);
            }
            }
            int result = familyMemberService.deleteMember(getUID(), member);
            int result=-1;
            if (StringUtils.isNotBlank(getAgentUID())){
                result = familyMemberService.deleteMember(getAgentUID(), member);
            }else   {
                result = familyMemberService.deleteMember(getUID(), member);
            }
            if (result == -1) {
            if (result == -1) {
                return failed( "与该成员的关系不存在",-1);
                return failed( "与该成员的关系不存在",-1);
@ -228,12 +232,15 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
        try {
        try {
            JSONObject data = new JSONObject();
            JSONObject data = new JSONObject();
            JSONArray result = new JSONArray();
            JSONArray result = new JSONArray();
            if (StringUtils.isNotEmpty(patient)) {
                result = familyMemberService.getPatientMembers(patient, "", isContain,isContacts,archiveType);
            } else  {
                result = familyMemberService.getPatientFamilyMembers(getUID(), "",isContacts,archiveType);
            if (StringUtils.isNotBlank(getAgentUID())){
                result = familyMemberService.getPatientFamilyMembers(getAgentUID(), "",isContacts,archiveType);
            }else{
                if (StringUtils.isNotEmpty(patient)) {
                    result = familyMemberService.getPatientMembers(patient, "", isContain,isContacts,archiveType);
                } else  {
                    result = familyMemberService.getPatientFamilyMembers(getUID(), "",isContacts,archiveType);
                }
            }
            }
            data.put("normalmembers",result);//家人关系
            data.put("normalmembers",result);//家人关系
            return ObjEnvelop.getSuccess( "查询成功", data);
            return ObjEnvelop.getSuccess( "查询成功", data);

+ 22 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java

@ -1,7 +1,9 @@
package com.yihu.jw.care.endpoint.message;
package com.yihu.jw.care.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.message.PatientMessageService;
import com.yihu.jw.care.service.message.PatientMessageService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -115,5 +117,25 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
            return failedException2(e);
            return failedException2(e);
        }
        }
    }
        @PostMapping(value = "/ConfirmFences")
    @ApiOperation("家属确认电子围栏监护消息")
    @ObserverRequired
    public Envelop ConfirmFences(@ApiParam(name = "messageId",required = true)
                                 @RequestParam(value = "messageId")String messageId,
                                 @ApiParam(name = "safe_area",value = "lon1,lat1;lon2,lat2; 5个坐标 形成一个封闭区域  A;B;C;D;A ")
                                 @RequestParam(value = "safe_area",required = false)String safe_area){
        try {
            JSONObject result = patientMessageService.ConfirmFences(messageId,safe_area);
            if (result.getInteger(ResponseContant.resultFlag)==ResponseContant.success){
                return ObjEnvelop.getSuccess("已确认","");
            }else {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
        }catch (Exception e){
            return failedException2(e);
        }
    }
    }
}
}

+ 87 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/safeArea/DoctorSafeAreaController.java

@ -0,0 +1,87 @@
package com.yihu.jw.care.endpoint.safeArea;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.safeArea.SafeAreaService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Bing on 2021/11/16.
 */
@RestController
@RequestMapping(value = "doctor/safeArea")
@Api(description = " 医生电子围栏")
public class DoctorSafeAreaController extends EnvelopRestEndpoint {
    @Autowired
    private PatientDeviceService patientDeviceService;
    @Autowired
    private SafeAreaService safeAreaService;
    @ApiOperation("助老员新增电子围栏记录")
    @ObserverRequired
    @RequestMapping(value = "doctorNewSafeArea",method = RequestMethod.GET)
    public ObjEnvelop doctorNewSafeArea(@ApiParam(name = "doctor",value = "doctor")
                                    @RequestParam(value = "doctor",required = false)String doctor,
                                        @ApiParam(name = "patient",value = "患者")
                                    @RequestParam(value = "patient",required = false)String patient,
                                        @ApiParam(name = "safe_area",value = "lon1,lat1;lon2,lat2; 5个坐标 形成一个封闭区域  A;B;C;D;A ")
                                    @RequestParam(value = "safe_area",required = false)String safe_area
    ){
        try {
            com.alibaba.fastjson.JSONObject result = patientDeviceService.doctorNewSafeArea(doctor,patient,safe_area);
            if (result.getInteger(ResponseContant.resultFlag)==ResponseContant.success){
                return ObjEnvelop.getSuccess("添加成功","");
            }else {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @ApiOperation("查看新增围栏记录tab")
    @RequestMapping(value = "doctorNewSafeAreaTab",method = RequestMethod.GET)
    public ObjEnvelop doctorNewSafeArea(@ApiParam(name = "doctor",value = "doctor")
                                        @RequestParam(value = "doctor",required = false)String doctor,
                                        @ApiParam(name = "manageStatus",value = "患者")
                                        @RequestParam(value = "manageStatus",required = false)Integer manageStatus
    ){
        try {
            return ObjEnvelop.getSuccess("获取成功",safeAreaService.doctorNewSafeAreaTab(doctor,manageStatus));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @ApiOperation("查看新增围栏记录列表")
    @RequestMapping(value = "doctorNewSafeAreaList",method = RequestMethod.GET)
    public ObjEnvelop doctorNewSafeAreaList(@ApiParam(name = "doctor",value = "doctor")
                                        @RequestParam(value = "doctor",required = false)String doctor,
                                        @ApiParam(name = "manageStatus",value = "管理状态 0 1")
                                        @RequestParam(value = "manageStatus",required = false)Integer manageStatus
    ){
        try {
            try {
                return ObjEnvelop.getSuccess("获取成功",safeAreaService.doctorNewSafeAreaList(doctor,manageStatus));
            }catch (Exception e){
                return failedObjEnvelopException2(e);
            }
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
}

+ 31 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java

@ -68,11 +68,13 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
                                            @ApiParam(name="page",value = "page",required = true)
                                            @ApiParam(name="page",value = "page",required = true)
                                            @RequestParam(value = "page")Integer page,
                                            @RequestParam(value = "page")Integer page,
                                            @ApiParam(name="pageSize",value = "pageSize",required = true)
                                            @ApiParam(name="pageSize",value = "pageSize",required = true)
                                            @RequestParam(value = "pageSize")Integer pageSize){
                                            @RequestParam(value = "pageSize")Integer pageSize,
                                            @ApiParam(name = "dailyMonitor", value = "日常监护 1查询日常监护关联工单0否", required = false)
                                            @RequestParam(value = "dailyMonitor",required = false,defaultValue = "0") Integer dailyMonitor){
        try {
        try {
            page = page>1?page-1:0;
            page = page>1?page-1:0;
            return securityMonitoringOrderService.getSecurityOrderList(doctor,serverDoctor,patientName, patient, status, svrDesc,topicItem,page, pageSize);
            return securityMonitoringOrderService.getSecurityOrderList(doctor,serverDoctor,patientName, patient, status, svrDesc,topicItem,page, pageSize,dailyMonitor);
        }catch (Exception e){
        }catch (Exception e){
            return failedPageEnvelopException2(e);
            return failedPageEnvelopException2(e);
        }
        }
@ -89,7 +91,9 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
                                     @ApiParam(name="svrDesc",value = "服务类型 关联security_server_dict字典")
                                     @ApiParam(name="svrDesc",value = "服务类型 关联security_server_dict字典")
                                     @RequestParam(value = "svrDesc",required = false)String svrDesc,
                                     @RequestParam(value = "svrDesc",required = false)String svrDesc,
                                     @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                     @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                     @RequestParam(value = "topicItem",required = false) String topicItem){
                                     @RequestParam(value = "topicItem",required = false) String topicItem,
                                     @ApiParam(name = "dailyMonitor", value = "日常监护 1查询日常监护关联工单0否", required = false)
                                     @RequestParam(value = "dailyMonitor",required = false,defaultValue = "0") Integer dailyMonitor){
        try {
        try {
            if (org.apache.commons.lang3.StringUtils.isBlank(patient)&& org.apache.commons.lang3.StringUtils.isBlank(doctor)){
            if (org.apache.commons.lang3.StringUtils.isBlank(patient)&& org.apache.commons.lang3.StringUtils.isBlank(doctor)){
                return ObjEnvelop.getError("请求参数错误");
                return ObjEnvelop.getError("请求参数错误");
@ -97,7 +101,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
            if (org.apache.commons.lang3.StringUtils.isNotBlank(patient)&& org.apache.commons.lang3.StringUtils.isNotBlank(doctor)){
            if (org.apache.commons.lang3.StringUtils.isNotBlank(patient)&& org.apache.commons.lang3.StringUtils.isNotBlank(doctor)){
                return ObjEnvelop.getError("请求参数错误");
                return ObjEnvelop.getError("请求参数错误");
            }
            }
            return ObjEnvelop.getSuccess("查询成功",securityMonitoringOrderService.getSecurityTab(patient,doctor,status,svrDesc,topicItem));
            return ObjEnvelop.getSuccess("查询成功",securityMonitoringOrderService.getSecurityTab(patient,doctor,status,svrDesc,topicItem,dailyMonitor));
        }catch (Exception e){
        }catch (Exception e){
            return failedObjEnvelopException2(e);
            return failedObjEnvelopException2(e);
        }
        }
@ -327,7 +331,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
                                @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                @RequestParam(value = "topicItem",required = false,defaultValue = "preventLost") String topicItem) {
                                @RequestParam(value = "topicItem",required = false,defaultValue = "preventLost") String topicItem) {
        try {
        try {
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.patientMonitoringInfo(patient,topicItem));
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.patientMonitoringInfo(patient,topicItem,true));
        } catch (Exception e) {
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
            return failedObjEnvelopException2(e);
        }
        }
@ -345,6 +349,27 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @ApiOperation("助老员端获取日常监护居民")
    @GetMapping(value = "findMonitorPatientsByDoctor")
    @ResponseBody
    public ObjEnvelop findMonitorPatientsByDoctor(@ApiParam(name = "doctor",  required = true)@RequestParam(value = "doctor")String doctor,
                                                  @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典,actionTrack行动轨迹", required = true)
                                                  @RequestParam(value = "topicItem",required = true,defaultValue = "preventLost") String topicItem,
                                                  @ApiParam(name = "day", value = "day", required = false)
                                                  @RequestParam(value = "day",required = false) String day,
                                                  @ApiParam(name = "page")
                                                  @RequestParam(value = "page",required = false) Integer page,
                                                  @ApiParam(name = "pageSize")
                                                  @RequestParam(value = "pageSize",required = false) Integer pageSize,
                                                  @ApiParam(name = "detail", value = "是否返回专题详情0否 1是")
                                                  @RequestParam(value = "detail",required = false,defaultValue = "0") Integer detail) {
        try {
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.findMonitorPatientsByDoctor(doctor,topicItem,day,page,pageSize,detail));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @ApiOperation("获取居民签约专题信息")
    @ApiOperation("获取居民签约专题信息")
    @RequestMapping(value = "patientSignTopicInfo", method = {RequestMethod.POST, RequestMethod.GET})
    @RequestMapping(value = "patientSignTopicInfo", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    @ResponseBody
@ -353,7 +378,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
                                            @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                            @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                            @RequestParam(value = "topicItem") String topicItem) {
                                            @RequestParam(value = "topicItem") String topicItem) {
        try {
        try {
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.patientSignTopicInfo(null,patient,topicItem,null));
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.patientSignTopicInfo(null,patient,topicItem,null,true));
        } catch (Exception e) {
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
            return failedObjEnvelopException2(e);
        }
        }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java

@ -225,7 +225,7 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
                                     @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                     @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)
                                     @RequestParam(value = "topicItem",required = false) String topicItem){
                                     @RequestParam(value = "topicItem",required = false) String topicItem){
        try {
        try {
            return baseController.write (200,"查询成功","data",securityMonitoringOrderService.patientMonitoringInfo(patient,topicItem));
            return baseController.write (200,"查询成功","data",securityMonitoringOrderService.patientMonitoringInfo(patient,topicItem,true));
        }catch (Exception e){
        }catch (Exception e){
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }

+ 21 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java

@ -22,10 +22,12 @@ import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Date;
@ -65,6 +67,8 @@ public class ConsultTeamService {
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    @Autowired
    @Autowired
    private MessageUtil messageUtil;
    private MessageUtil messageUtil;
    @Value("${wechat.id}")
    private String wxId;
    private Logger logger= LoggerFactory.getLogger(ConsultTeamService.class);
    private Logger logger= LoggerFactory.getLogger(ConsultTeamService.class);
@ -197,6 +201,11 @@ public class ConsultTeamService {
        JSONObject participants = new JSONObject();
        JSONObject participants = new JSONObject();
        participants.put(patient, 0);
        participants.put(patient, 0);
        JSONArray familyArr =  familyMemberService.getPatientMembers(patient,null,null,null,"1,3");
        JSONArray familyArr =  familyMemberService.getPatientMembers(patient,null,null,null,"1,3");
        JSONObject templateJson = new JSONObject();
        templateJson.put("id",orderId);
        templateJson.put("OrderType",20);
        for (int i=0;i<familyArr.size();i++){
        for (int i=0;i<familyArr.size();i++){
            JSONObject tmp = familyArr.getJSONObject(i);
            JSONObject tmp = familyArr.getJSONObject(i);
            String patientId = tmp.getString("id");
            String patientId = tmp.getString("id");
@ -209,20 +218,22 @@ public class ConsultTeamService {
                String name = tmp.getString("name");
                String name = tmp.getString("name");
                //创建家属系统消息
                //创建家属系统消息
                SystemMessageDO messageDO = new SystemMessageDO();
                SystemMessageDO messageDO = new SystemMessageDO();
                messageDO.setTitle("安防监护");
                messageDO.setTitle("紧急救助");
                messageDO.setType("50");
                messageDO.setType("50");
                messageDO.setCode("22");
                messageDO.setCode("20");
                messageDO.setSender(patientDO.getId());
                messageDO.setSender(patientDO.getId());
                messageDO.setSenderName(patientDO.getName());
                messageDO.setSenderName(patientDO.getName());
                messageDO.setRelationCode(orderId);
                messageDO.setRelationCode(orderId);
                messageDO.setReceiver(patientId);
                messageDO.setReceiver(patientId);
                messageDO.setReceiverName(name);
                messageDO.setReceiverName(name);
                messageDO.setOver("0");
                messageDO.setOver("0");
                messageDO.setData(patientDO.getName()+"发起安防警报工单!");
                messageDO.setData(patientDO.getName()+"发起紧急救助!");
                messageDO.setDel("1");
                messageDO.setDel("1");
                messageDO.setIsRead("0");
                messageDO.setIsRead("0");
                messageDO.setCreateTime(new Date());
                messageDO.setCreateTime(new Date());
                systemMessageDao.save(messageDO);
                systemMessageDao.save(messageDO);
                messageUtil.putTemplateWxMessage(wxId,"template_error_notice","jjhjyctz",patientDO.getOpenid(),patientDO.getName()+"发起紧急呼叫",null,null,36,templateJson, DateUtil.getStringDate(),"紧急呼叫",title+",请及时核实处理");
            }
            }
        }
        }
@ -354,7 +365,7 @@ public class ConsultTeamService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public JSONObject addSecurityMoConsult(String orderId,String patient,String agent,String symptoms) throws Exception {
    public JSONObject addSecurityMoConsult(String orderId,String patient,String agent,String symptoms,String serverDesc) throws Exception {
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        // 判断居民是否已经签约
        // 判断居民是否已经签约
@ -376,7 +387,7 @@ public class ConsultTeamService {
        }
        }
        //咨询记录
        //咨询记录
        String title = patientDO.getName() + "疑似离开安全区域";
        String title = patientDO.getName() + serverDesc;
        ConsultDo consult = addConsult(patient,title,symptoms,patientDO.getPhone(),22);
        ConsultDo consult = addConsult(patient,title,symptoms,patientDO.getPhone(),22);
        //咨询详细信息
        //咨询详细信息
@ -406,6 +417,9 @@ public class ConsultTeamService {
        participants.put(patient, 0);
        participants.put(patient, 0);
        //家属
        //家属
        JSONArray familyArr =  familyMemberService.getPatientMembers(patient,null,null,null,"1,3");
        JSONArray familyArr =  familyMemberService.getPatientMembers(patient,null,null,null,"1,3");
        JSONObject templateJson = new JSONObject();
        templateJson.put("id",orderId);
        templateJson.put("OrderType",22);
        for (int i=0;i<familyArr.size();i++){
        for (int i=0;i<familyArr.size();i++){
            JSONObject tmp = familyArr.getJSONObject(i);
            JSONObject tmp = familyArr.getJSONObject(i);
            String patientId = tmp.getString("id");
            String patientId = tmp.getString("id");
@ -433,6 +447,8 @@ public class ConsultTeamService {
                messageDO.setIsRead("0");
                messageDO.setIsRead("0");
                messageDO.setCreateTime(new Date());
                messageDO.setCreateTime(new Date());
                systemMessageDao.save(messageDO);
                systemMessageDao.save(messageDO);
                messageUtil.putTemplateWxMessage(wxId,"template_error_notice","afjhyctz",patientDO.getOpenid(),title,null,null,36,templateJson, DateUtil.getStringDate(),"安防监护",title+",请及时核实处理");
            }
            }
        }
        }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/contacts/ContactsService.java

@ -424,7 +424,7 @@ public class ContactsService {
        result.put("currentPositioning",null);       //当前定位
        result.put("currentPositioning",null);       //当前定位
        result.put("currentLat",null);       //当前定位
        result.put("currentLat",null);       //当前定位
        result.put("currentLon",null);
        result.put("currentLon",null);
        List<PatientSafeAreaDO> safes =  safeAreaDao.findByPatient(patient);
        List<PatientSafeAreaDO> safes =  safeAreaDao.findByPatient2(patient);
        result.put("fences",safes);
        result.put("fences",safes);
        Double dulat = null;
        Double dulat = null;
        Double dulon = null;
        Double dulon = null;

+ 125 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -30,6 +30,7 @@ import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.Synchronize;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.Logger;
@ -48,6 +49,7 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.LinkedMultiValueMap;
@ -125,6 +127,11 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    private PatientSafeAreaDao safeAreaDao;
    private PatientSafeAreaDao safeAreaDao;
    @Autowired
    @Autowired
    private SecurityMonitoringOrderDao securityMonitoringOrderDao;
    private SecurityMonitoringOrderDao securityMonitoringOrderDao;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private PatientSafeAreaConfirmDao patientSafeAreaConfirmDao;
    @PostConstruct
    @PostConstruct
    public void init() {
    public void init() {
@ -1050,7 +1057,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    if (StringUtils.isBlank(day)) {
                    if (StringUtils.isBlank(day)) {
                        day = DateUtil.getStringDateShort();
                        day = DateUtil.getStringDateShort();
                    }
                    }
                    devInfoObj = securityMonitoringOrderService.patientSignTopicInfo(devInfoObj, patient, "preventLost",deviceSn);
                    devInfoObj = securityMonitoringOrderService.patientSignTopicInfo(devInfoObj, patient, "preventLost",deviceSn,true);
                    //轨迹动态
                    //轨迹动态
                    JSONArray locations = getX1Locations(deviceSn, day.replace("-", ""));
                    JSONArray locations = getX1Locations(deviceSn, day.replace("-", ""));
                    devInfoObj.put("routes", locations);
                    devInfoObj.put("routes", locations);
@ -1774,7 +1781,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    }
    }
    /**
    /**
     *
     *      修改电子围栏信息
     *    | enable       |  否  | Int          |  0,1 是否启用                        |
     *    | enable       |  否  | Int          |  0,1 是否启用                        |
     *    | name         |  否  | String       |   安全区名称                           |
     *    | name         |  否  | String       |   安全区名称                           |
     *    | freq         |  否  | Boolean      |  0,触发一天;1,每日触发        |
     *    | freq         |  否  | Boolean      |  0,触发一天;1,每日触发        |
@ -1816,6 +1823,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                safeAreaDao.deleteByPatient(patient);
                safeAreaDao.deleteByPatient(patient);
            }
            }
            else{//新增或修改
            else{//新增或修改
                safeAreaDO.setDel("1");
                safeAreaDO.setSafeAreaGz(safe_area);
                safeAreaDO.setSafeAreaGz(safe_area);
                safeAreaDO.setUpdateTime(new Date());
                safeAreaDO.setUpdateTime(new Date());
                safeAreaDO.setSuccessFlag(-1);
                safeAreaDO.setSuccessFlag(-1);
@ -1870,6 +1878,75 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        return "success";
        return "success";
    }
    }
    /**
     * 助老员新增电子围栏记录
     */
    public com.alibaba.fastjson.JSONObject doctorNewSafeArea(String doctor,String patient,String safe_area) throws Exception{
        com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject();
        List<PatientSafeAreaConfirm> SafeAreaConfirms = patientSafeAreaConfirmDao.findByDoctorCodeAndPatient(doctor,patient);
        if (SafeAreaConfirms.size()>0){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"你已为改居民新增过电子围栏!");
            return result;
        }
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        PatientSafeAreaDO safeAreaDO = new PatientSafeAreaDO();
        boolean firstAdd=false;
        List<Map<String,Object>> relatives = new ArrayList<>();
        if (StringUtils.isNotBlank(patient)){
            List<PatientSafeAreaDO> safeAreaDOS = safeAreaDao.findByPatient2(patient);
            if (safeAreaDOS.size()>0){
                safeAreaDO = safeAreaDOS.get(0);
            }else {//首次新增
                safeAreaDO.setPatient(patient);
                safeAreaDO.setCreateTime(new Date());
                safeAreaDO.setUpdateTime(new Date());
                safeAreaDO.setSuccessFlag(-1);
                safeAreaDO.setDel("1");
                // 发送确认消息给家属 有家属直接确认
                String sql = " select  t2.id,t2.name from  base_patient_family_member t1,  base_patient t2 where  " +
                        "t2.id in (select family_member from base_patient_family_member where patient = '"+patient+"' )  " +
                        " and t1.patient = '"+patient+"'  and t1.family_member = t2.id  " +
                        " and t2.archive_type=3 GROUP BY t2.id " ;
                relatives = jdbcTemplate.queryForList(sql);
                safeAreaDO.setManageStatus(relatives.size()>0?0:1);
                firstAdd=true;
            }
            safeAreaDO.setSafeAreaGz(safe_area);
            safeAreaDO.setUpdateTime(new Date());
            safeAreaDO.setSuccessFlag(-1);
            safeAreaDO = safeAreaDao.save(safeAreaDO);
            PatientSafeAreaConfirm patientSafeAreaConfirm = new PatientSafeAreaConfirm();
            patientSafeAreaConfirm.setPatient(patient);
            patientSafeAreaConfirm.setDoctorCode(doctor);
            patientSafeAreaConfirm.setDel("1");
            patientSafeAreaConfirm.setCreateTime(new Date());
            patientSafeAreaConfirm.setSafeId(safeAreaDO.getId()+"");
            if(firstAdd&&(null == safeAreaDO.getManageStatus()||0 == safeAreaDO.getManageStatus())){//首次添加给家属发送待确认消息
                patientSafeAreaConfirm.setManageStatus(0);
                for (Map<String,Object> tmp:relatives){
                    messageUtil.saveSystemMessage("",patient,"监护确认","44",doctorDO.getId(),doctorDO.getName(),tmp.get("id").toString(),
                            tmp.get("name").toString(),null,"0","0" );
                }
            }else {//无家属 直接确认
                patientSafeAreaConfirm.setManageStatus(1);
               Integer successFlag =  updatePatientSafeArea(patient,safe_area);
               safeAreaDO.setSuccessFlag(successFlag);
                safeAreaDao.save(safeAreaDO);
            }
            patientSafeAreaConfirmDao.save(patientSafeAreaConfirm);
        }
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,"添加成功");
        return result;
    }
    /**
    /**
     *获取设备轨迹
     *获取设备轨迹
     * @param deviceSn
     * @param deviceSn
@ -1977,4 +2054,50 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    /******************************************* 爱牵挂设备end *****************************************************/
    /******************************************* 爱牵挂设备end *****************************************************/
    public Integer updatePatientSafeArea(String patient,String safe_area){
        List<DevicePatientDevice> devices = patientDeviceDao.findAllByUserAndCategoryCode(patient,"4");
        if (devices.size()>0){
            DevicePatientDevice patientDevice = devices.get(0);
            String deviceSnTmp = patientDevice.getDeviceSn();
            String url ="";
            if ("4".equals(devices.get(0).getCategoryCode())){//手表
                Device device = deviceDao.findOne(devices.get(0).getDeviceId());
                if (device!=null){
                    if ("X1".equals(device.getModel())){
                        url = MessageFormat.format(AqgConfig.X1fence_area, deviceSnTmp,1);
                    }
                }
            }else {
                url = MessageFormat.format(AqgConfig.S3fence_area, deviceSnTmp,1);
            }
            MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
            if (StringUtils.isNotBlank(safe_area)){
                    String[] position = safe_area.split(";");
                    safe_area = "";
                    for (String tmp:position){
                        String[] point = tmp.split(",");
                        safe_area+= gpsUtil.bd09_To_Gcj02_str(Double.parseDouble(point[1]),Double.parseDouble(point[0]))+";";
                    }
            }
            param.add("name", "安全区域1");
            param.add("freq", "1");
            param.add("enable","1");
            param.add("time_begin", "0");
            param.add("time_end", "86400");
            param.add("safe_area", safe_area);
            HttpEntity<com.alibaba.fastjson.JSONObject> response = httpClientUtil.aqgCookieHttp(url, param, HttpMethod.POST, getCookie());
            com.alibaba.fastjson.JSONObject responseObj = response.getBody();
            if (responseObj.getBoolean("success")){
                return 1;
            }
            else {
                return -1;
            }
        }
        return -1;
    }
}
}

+ 4 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java

@ -1690,7 +1690,7 @@ public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealt
    public List<Map<String,Object>> getErrorHealthIndexPatients(String doctor){
    public List<Map<String,Object>> getErrorHealthIndexPatients(String doctor){
        String sql = " select count(id),patient,name,photo,mobile,record_date from (\n" +
        String sql = " select count(id),patient,name,photo,mobile,record_date from (\n" +
                "select idx.id,p.id patient,p.name,p.photo,DATE_FORMAT(idx.record_date,'%Y-%m-%d %H:%i:%S')record_date ,p.mobile from wlyy_patient_health_index idx,base_patient p " +
                "select idx.id,p.id patient,p.name,p.photo,DATE_FORMAT(idx.record_date,'%Y-%m-%d %H:%i:%S')record_date ,p.mobile from wlyy_patient_health_index idx,base_patient p " +
                "where  idx.user = p.id and  status=1 and (manage_result=0 or manage_result is null)  and EXISTS ( " +
                "where  idx.user = p.id and idx.type in (1,2) and  status=1 and (manage_result=0 or manage_result is null)  and EXISTS ( " +
                " SELECT 1 from base_service_package_sign_record sr,base_service_package_record r ,base_team_member m where " +
                " SELECT 1 from base_service_package_sign_record sr,base_service_package_record r ,base_team_member m where " +
                "idx.user = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and   m.team_code = r.team_code  " +
                "idx.user = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and   m.team_code = r.team_code  " +
                " and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1') order by idx.record_date " +
                " and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1') order by idx.record_date " +
@ -1700,8 +1700,9 @@ public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealt
    }
    }
    public List<Map<String,Object>> getErrorHealthIndexByPatients(String patient){
    public List<Map<String,Object>> getErrorHealthIndexByPatients(String patient){
        String sql = " select *,cast(DATE_FORMAT(max(idx.record_date),'%Y-%m-%d %H:%i:%S') as char)record_date  from  wlyy_patient_health_index idx where user='"+patient+"' and  " +
                "status=1 and (manage_result=0 or manage_result is null) ";
        String sql = " select *,DATE_FORMAT((idx.record_date),'%Y-%m-%d %H:%i:%S')record_date  from  wlyy_patient_health_index idx " +
                " where user='"+patient+"' and idx.type in (1,2) " +
                "and status=1 and (manage_result=0 or manage_result is null) ORDER BY idx.record_date desc";
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        return result;
        return result;
    }
    }

+ 1 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java

@ -247,7 +247,6 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
        if (register){
        if (register){
            patientDO.setArchiveType(3);
            patientDO.setArchiveType(3);
            patientDO.setArchiveStatus(3);
            patientDO.setArchiveStatus(3);
            patientDO = patientDao.save(patientDO);
        }
        }
        if (null == patientDO){
        if (null == patientDO){
@ -312,8 +311,8 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
            if (patientDO.getOpenidTime() == null) {
            if (patientDO.getOpenidTime() == null) {
                patientDO.setOpenidTime(new Date());
                patientDO.setOpenidTime(new Date());
            }
            }
            patientDao.save(patientDO);
        }
        }
        patientDao.save(patientDO);
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,"添加成功");
        result.put(ResponseContant.resultMsg,"添加成功");
        return result;
        return result;

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java

@ -76,7 +76,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
        }
        }
        if (StringUtils.isNotBlank(topicItem)){
        if (StringUtils.isNotBlank(topicItem)){
            filters += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
            filters += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
                    "where  pd.user = sr.patient and  FIND_IN_SET(dd.service_topic,'"+topicItem+"')) ";
                    "where  pd.user = sr.patient and  FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
        }
        }
        String orderBy = " ORDER BY sr.create_time DESC " +
        String orderBy = " ORDER BY sr.create_time DESC " +

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -146,7 +146,7 @@ public class DoctorMessageService {
            Map<String,Object> tmpObj = new HashMap<>();
            Map<String,Object> tmpObj = new HashMap<>();
            String sql = " select count(idx.id) count,DATE_FORMAT( max(idx.record_date),'%Y-%m-%d %H:%i:%S') record_date from wlyy_patient_health_index idx where status=1 and (manage_result=0 or manage_result is null) " +
            String sql = " select count(idx.id) count,DATE_FORMAT( max(idx.record_date),'%Y-%m-%d %H:%i:%S') record_date from wlyy_patient_health_index idx where status=1 and (manage_result=0 or manage_result is null) " +
                    "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r ,base_team_member m " +
                    "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r ,base_team_member m " +
                    " where idx.user = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and m.team_code = r.team_code " +
                    " where idx.user = CONVERT(sr.patient USING utf8) and idx.type in (1,2) and  sr.id = r.sign_id and sr.status=1 and m.team_code = r.team_code " +
                    "  and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1')  order by idx.record_date desc   ";
                    "  and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1')  order by idx.record_date desc   ";
            tmpObj = jdbcTemplate.queryForMap(sql);
            tmpObj = jdbcTemplate.queryForMap(sql);
            result.put("errorHealthIndex",tmpObj);
            result.put("errorHealthIndex",tmpObj);

+ 68 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -1,23 +1,40 @@
package com.yihu.jw.care.service.message;
package com.yihu.jw.care.service.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaConfirmDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaDao;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.care.dao.security.BaseEmergencyWarnLogDao;
import com.yihu.jw.care.dao.security.BaseEmergencyWarnLogDao;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.PatientSafeAreaConfirm;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO;
import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.text.MessageFormat;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -39,6 +56,12 @@ public class PatientMessageService {
    private BasePatientDao patientDao;
    private BasePatientDao patientDao;
    @Autowired
    @Autowired
    private BaseEmergencyWarnLogDao logDao;
    private BaseEmergencyWarnLogDao logDao;
    @Autowired
    private PatientSafeAreaDao patientSafeAreaDao;
    @Autowired
    private PatientSafeAreaConfirmDao patientSafeAreaConfirmDao;
    @Autowired
    private PatientDeviceService patientDeviceService;
    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){
    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){
        page = page>0?page-1:0;
        page = page>0?page-1:0;
@ -155,4 +178,49 @@ public class PatientMessageService {
            systemMessageDao.save(systemMessageDO);
            systemMessageDao.save(systemMessageDO);
        }
        }
    }
    }
    /**
     *
     * @param msgId
     * @param safe_area
     */
    @Transactional(rollbackFor =Exception.class )
    public JSONObject ConfirmFences(String msgId,String safe_area){
        JSONObject result = new JSONObject();
        SystemMessageDO systemMessageDO = systemMessageDao.findOne(msgId);
        if ("1".equals(systemMessageDO.getData())){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"已有家属确认管理,无需再次确认!");
            return result;
        }
        List<PatientSafeAreaDO> patientSafeAreaDOs = patientSafeAreaDao.findByPatient2(systemMessageDO.getRelationCode());
        PatientSafeAreaDO patientSafeAreaDO = null;
        if (patientSafeAreaDOs.size()>0){
            patientSafeAreaDO = patientSafeAreaDOs.get(0);
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"居民未绑定防走失设备!");
            return result;
        }
        if (StringUtils.isNotBlank(safe_area)&&null != patientSafeAreaDO){
            patientSafeAreaDO.setSafeAreaGz(safe_area);
        }
        //更新围栏
        Integer successFlag = patientDeviceService.updatePatientSafeArea(systemMessageDO.getRelationCode(),patientSafeAreaDO.getSafeAreaGz());
        patientSafeAreaDO.setManageStatus(1);
        patientSafeAreaDO.setSuccessFlag(successFlag);
        patientSafeAreaDao.save(patientSafeAreaDO);
        //修改数据
        patientSafeAreaConfirmDao.manageByPatient(patientSafeAreaDO.getPatient());
        systemMessageDao.readByTypeAndRelationCode("44",patientSafeAreaDO.getPatient(),"1");
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,"已确认");
        return result;
    }
}
}

+ 55 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/safeArea/SafeAreaService.java

@ -0,0 +1,55 @@
package com.yihu.jw.care.service.safeArea;
import com.alibaba.fastjson.JSONObject;
import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/11/16.
 */
@Service
public class SafeAreaService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public JSONObject doctorNewSafeAreaTab(String doctor,Integer manageStatus){
        JSONObject result = new JSONObject();
        result.put("status_all",0);
        result.put("status_0",0);
        result.put("status_1",0);
        String sql = " select manage_status,count(id) 'num' from wlyy_patient_safe_area_confirm where doctor_code='"+doctor+"' ";
        if (null != manageStatus){
            sql += " and manage_status ";
        }
        sql += " GROUP BY manage_status ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Integer total=0;
        for (Map<String,Object> tmp :list){
            Integer num = Integer.parseInt(tmp.get("num").toString());
            result.put("status_"+tmp.get("manage_status").toString(),num);
            total += num;
        }
        result.put("status_all",total);
        return result;
    }
    public List<Map<String,Object>> doctorNewSafeAreaList(String doctor,Integer manageStatus){
        String sql = " select p.id,p.name,p.sex,p.photo,TIMESTAMPDIFF(year,p.birthday,now()) as age,ac.manage_status manageStatus " +
                " from wlyy_patient_safe_area_confirm ac INNER JOIN base_patient p on ac.patient = p.id where ac.doctor_code='"+doctor+"' ";
        if (null != manageStatus){
            sql += " and ac.manage_status ";
        }
        sql += "GROUP BY p.id ";
        return jdbcTemplate.queryForList(sql);
    }
}

+ 244 - 24
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -41,7 +41,6 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.emergency.EmergencyOrderVO;
import com.yihu.jw.restmodel.emergency.EmergencyOrderVO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.common.LatitudeUtils;
@ -244,7 +243,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        orderDO.setServiceStatus("2");
        orderDO.setServiceStatus("2");
        this.save(orderDO);
        this.save(orderDO);
        //创建im会话  安防警报咨询的sessionid  为居民code+(wlyy_consult_team表consult)+20
        //创建im会话  安防警报咨询的sessionid  为居民code+(wlyy_consult_team表consult)+20
        JSONObject IMObj = consultTeamService.addSecurityMoConsult(orderDO.getId(),orderDO.getPatient(),null,null);
        JSONObject IMObj = consultTeamService.addSecurityMoConsult(orderDO.getId(),orderDO.getPatient(),null,null,orderDO.getServeDesc());
        String sessionId=orderDO.getPatient()+"_"+ IMObj.getJSONObject("resultMsg").getString("consult") + "_22";
        String sessionId=orderDO.getPatient()+"_"+ IMObj.getJSONObject("resultMsg").getString("consult") + "_22";
        orderDO.setSessionId(sessionId);
        orderDO.setSessionId(sessionId);
        if (StringUtils.isNotBlank(orderDO.getServeDesc())){
        if (StringUtils.isNotBlank(orderDO.getServeDesc())){
@ -456,7 +455,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                }else {
                }else {
                    monitorInfo.put("sleepPlan",false);
                    monitorInfo.put("sleepPlan",false);
                }
                }
                monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null);
                monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null,true);
                emergencyOrderVO.setInformation(monitorInfo);
                emergencyOrderVO.setInformation(monitorInfo);
            }catch (Exception e){
            }catch (Exception e){
                e.printStackTrace();
                e.printStackTrace();
@ -465,7 +464,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if (6==orderDO.getOrderSource()){//气感工单
        if (6==orderDO.getOrderSource()){//气感工单
            try {
            try {
                JSONObject monitorInfo = JSONObject.parseObject(orderDO.getWarnInfo());
                JSONObject monitorInfo = JSONObject.parseObject(orderDO.getWarnInfo());
                monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null);
                monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null,true);
                emergencyOrderVO.setInformation(monitorInfo);
                emergencyOrderVO.setInformation(monitorInfo);
            }catch (Exception e){
            }catch (Exception e){
                e.printStackTrace();
                e.printStackTrace();
@ -474,7 +473,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if (7==orderDO.getOrderSource()){//烟感工单
        if (7==orderDO.getOrderSource()){//烟感工单
            try {
            try {
                JSONObject monitorInfo = JSONObject.parseObject(orderDO.getWarnInfo());
                JSONObject monitorInfo = JSONObject.parseObject(orderDO.getWarnInfo());
                monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null);
                monitorInfo = patientSignTopicInfo(monitorInfo,orderDO.getPatient(),"preventFall",null,true);
                emergencyOrderVO.setInformation(monitorInfo);
                emergencyOrderVO.setInformation(monitorInfo);
            }catch (Exception e){
            }catch (Exception e){
                e.printStackTrace();
                e.printStackTrace();
@ -663,7 +662,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    }
    }
    public PageEnvelop getSecurityOrderList(String doctor, String serverDoctor, String patientName, String patient, String status,
    public PageEnvelop getSecurityOrderList(String doctor, String serverDoctor, String patientName, String patient, String status,
                                            String svrDesc,String topicItem, Integer page, Integer pageSize){
                                            String svrDesc,String topicItem, Integer page, Integer pageSize,Integer dailyMonitor){
        JSONArray result = new JSONArray();
        JSONArray result = new JSONArray();
        //服务权限
        //服务权限
        if(doctorServicePermissionsService.isPermission(doctor,10)==0){
        if(doctorServicePermissionsService.isPermission(doctor,10)==0){
@ -676,12 +675,53 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        String sql = " select p.id patientCode,p.name,p.sex,p.photo,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," +
        String sql = " select p.id patientCode,p.name,p.sex,p.photo,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," +
                "ord.doctor_name,ord.update_user,ord.update_user_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "ord.doctor_name,ord.update_user,ord.update_user_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where 1=1 ";
                "where 1=1 ";
        if (StringUtils.isNotBlank(doctor)){
            fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        if (1==dailyMonitor){//医生日常监护居民安防工单列表查询
            if (StringUtils.isBlank(topicItem)||StringUtils.isBlank(doctor)){
                return new PageEnvelop();
            }
            String categoryCode ="";
            switch (topicItem){
                case "preventLost":
                    categoryCode="'4'";
                    break;
                case "preventFall":
                    categoryCode="'12'";
                    break;
                case "preventFire":
                    categoryCode="'15'";
                    break;
                case "preventGasLeakage":
                    categoryCode="'14'";
                    break;
                case "preventOutOfBed":
                    categoryCode="'13'";
                    break;
            }
            if (StringUtils.isNotBlank(doctor)){//日常监护医生必传
                fliter += " and EXISTS( SELECT DISTINCT p.id,p.name,p.residential_area residentialArea,p.photo,p.idcard,p.mobile, " +
                        " p.openid,p.sex,p.pad_imei padImei " +
                        " from base_patient p , base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                        " WHERE p.id = sr.patient and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                        " and m.doctor_code = '"+doctor+"' and m.del = '1' ) ";
                fliter +=" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
                        " where  pd.user = p.id and pd.del=0 and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
                if ("preventLost".equals(topicItem)){//有绑定围栏的居民
                    fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
                }
            }
        }else {
            if (StringUtils.isNotBlank(doctor)){
                fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                        "base_team_member m " +
                        "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                        " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1') ";
            }
        }
        }
        if (StringUtils.isNotBlank(serverDoctor)){
        if (StringUtils.isNotBlank(serverDoctor)){
            fliter +=" and ord.doctor = '"+serverDoctor+"' ";
            fliter +=" and ord.doctor = '"+serverDoctor+"' ";
        }
        }
@ -756,7 +796,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
        return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
    }
    }
    public JSONObject getSecurityTab(String patient,String doctor,String status,String svrDesc,String topicItem){
    public JSONObject getSecurityTab(String patient,String doctor,String status,String svrDesc,String topicItem,Integer dailyMonitor){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        result.put("status_-2",0);//误报警
        result.put("status_-2",0);//误报警
@ -777,11 +817,49 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        sql = "select ord.status,ord.serve_desc,count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
        sql = "select ord.status,ord.serve_desc,count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where 1=1 ";
                "where 1=1 ";
        String fliter = "  ";
        String fliter = "  ";
        if (StringUtils.isNotBlank(doctor)){
            fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        if (1==dailyMonitor){//医生日常监护居民安防工单列表查询
            if (StringUtils.isBlank(topicItem)||StringUtils.isBlank(doctor)){
                return result;
            }
            String categoryCode ="";
            switch (topicItem){
                case "preventLost":
                    categoryCode="'4'";
                    break;
                case "preventFall":
                    categoryCode="'12'";
                    break;
                case "preventFire":
                    categoryCode="'15'";
                    break;
                case "preventGasLeakage":
                    categoryCode="'14'";
                    break;
                case "preventOutOfBed":
                    categoryCode="'13'";
                    break;
            }
            if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
                fliter += " and EXISTS( SELECT DISTINCT p.id,p.name,p.residential_area residentialArea,p.photo,p.idcard,p.mobile, " +
                        " p.openid,p.sex,p.pad_imei padImei " +
                        " from base_patient p , base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                        " WHERE p.id = sr.patient and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                        " and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
                fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
                        " where  pd.user = p.id and pd.del=0 and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItem + "',dd.service_topic)) ";
                if ("preventLost".equals(topicItem)) {//有绑定围栏的居民
                    fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
                }
            }
        }else {
            if (StringUtils.isNotBlank(doctor)){
                fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                        "base_team_member m " +
                        "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                        " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1') ";
            }
        }
        }
        if (StringUtils.isNotBlank(patient)){
        if (StringUtils.isNotBlank(patient)){
            fliter+=" and ord.patient='"+patient+"' ";
            fliter+=" and ord.patient='"+patient+"' ";
@ -1398,7 +1476,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return result;
        return result;
    }
    }
    public JSONObject patientMonitoringInfo(String patient,String topicItem){
    public JSONObject patientMonitoringInfo(String patient,String topicItem,boolean video){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        result.put("location",null);
        result.put("location",null);
        result.put("fences",null);
        result.put("fences",null);
@ -1406,6 +1484,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        result.put("fire",null);
        result.put("fire",null);
        result.put("fall",null);
        result.put("fall",null);
        result.put("sleep",null);
        result.put("sleep",null);
        result.put("sleepOrderInfo",null);//最近工单
        result.put("deviceSn",null);
        result.put("deviceSn",null);
        result.put("emeAssistance",false);
        result.put("emeAssistance",false);
        result.put("monitorInfo",null);
        result.put("monitorInfo",null);
@ -1443,6 +1522,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    count = Integer.parseInt(tmp.get("total").toString());
                    count = Integer.parseInt(tmp.get("total").toString());
                    if (count>0){
                    if (count>0){
                        result.put("sleep",true);
                        result.put("sleep",true);
                        sql = " select serve_desc from base_security_monitoring_order where topic_item='preventOutOfBed' " +
                                "and patient='"+patient+"' and `status`=1 order by create_time desc limit 1 ";
                        List<String> serveDesces = jdbcTemplate.queryForList(sql,String.class);
                        if (serveDesces.size()>0){
                            result.put("sleepOrderInfo",serveDesces.get(0));
                        }
                    }else {
                    }else {
                        result.put("sleep",false);
                        result.put("sleep",false);
                    }
                    }
@ -1454,7 +1539,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if (counnt>0){
        if (counnt>0){
            result.put("emeAssistance",true);
            result.put("emeAssistance",true);
        }
        }
        result = patientSignTopicInfo(result,patient,topicItem,null);
        result = patientSignTopicInfo(result,patient,topicItem,null,true);
        return result;
        return result;
    }
    }
@ -1472,6 +1557,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        result.put("fire",null);
        result.put("fire",null);
        result.put("fall",null);
        result.put("fall",null);
        result.put("sleep",null);
        result.put("sleep",null);
        result.put("sleepOrderInfo",null);//最近工单
        result.put("deviceSn",null);
        result.put("deviceSn",null);
        result.put("emeAssistance",false);
        result.put("emeAssistance",false);
        result.put("monitorInfo",null);
        result.put("monitorInfo",null);
@ -1509,6 +1595,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    count = Integer.parseInt(tmp.get("total").toString());
                    count = Integer.parseInt(tmp.get("total").toString());
                    if (count>0){
                    if (count>0){
                        result.put("sleep",true);
                        result.put("sleep",true);
                        sql = " select serve_desc from base_security_monitoring_order where topic_item='preventOutOfBed' " +
                                "and patient='"+patient+"' and `status`=1 order by create_time desc limit 1 ";
                        List<String> serveDesces = jdbcTemplate.queryForList(sql,String.class);
                        if (serveDesces.size()>0){
                            result.put("sleepOrderInfo",serveDesces.get(0));
                        }
                    }else {
                    }else {
                        result.put("sleep",false);
                        result.put("sleep",false);
                    }
                    }
@ -1522,9 +1614,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
        }
        List<DevicePatientDevice> devices4 = patientDeviceDao.findByUserAndCategoryCode(patient,"4");//手表
        List<DevicePatientDevice> devices4 = patientDeviceDao.findByUserAndCategoryCode(patient,"4");//手表
        if (devices4.size()>0){
        if (devices4.size()>0){
            result =  patientSignTopicInfo(result,patient,"preventLost",devices4.get(0).getDeviceSn());
            result =  patientSignTopicInfo(result,patient,"preventLost",devices4.get(0).getDeviceSn(),true);
        }
        }
        patientSignTopicInfo(result,patient,"preventFall",null);
        patientSignTopicInfo(result,patient,"preventFall",null,true);
        return result;
        return result;
    }
    }
@ -1561,6 +1653,11 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                        JSONObject locationTmp = response.getJSONObject("last_location");
                        JSONObject locationTmp = response.getJSONObject("last_location");
                        Double lon = locationTmp.getJSONArray("coordinates").getDouble(0);
                        Double lon = locationTmp.getJSONArray("coordinates").getDouble(0);
                        Double lat = locationTmp.getJSONArray("coordinates").getDouble(1);
                        Double lat = locationTmp.getJSONArray("coordinates").getDouble(1);
                        if (!response.getBoolean("online")){//设备离线 取居民表定位
                            result.put("X1online",false);
                        }else {
                            result.put("X1online",true);
                        }
                        JSONObject tmp = gpsUtil.gcj02_To_Bd09(lat,lon);
                        JSONObject tmp = gpsUtil.gcj02_To_Bd09(lat,lon);
                        tmp.put("city",response.getString("last_city"));
                        tmp.put("city",response.getString("last_city"));
                        tmp.put("province",response.getString("last_province"));
                        tmp.put("province",response.getString("last_province"));
@ -1851,7 +1948,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    }
    }
    public JSONObject patientSignTopicInfo(JSONObject result,String patient,String topicItem,String deviceSn){
    public JSONObject patientSignTopicInfo(JSONObject result,String patient,String topicItem,String deviceSn,boolean video){
        if (null==result){
        if (null==result){
            result = new JSONObject();
            result = new JSONObject();
        }
        }
@ -1865,14 +1962,15 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            preventOutOfBed(result, patient,true,null);
            preventOutOfBed(result, patient,true,null);
        }
        }
        if ("preventFire".equals(topicItem)||StringUtils.isBlank(topicItem)){
        if ("preventFire".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventFire(result, patient,null,true);
            preventFire(result, patient,null,video);
        }
        }
        if ("preventGasLeakage".equals(topicItem)||StringUtils.isBlank(topicItem)){
        if ("preventGasLeakage".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventGasLeakage(result, patient,true);
            preventGasLeakage(result, patient,video);
        }
        }
        return result;
        return result;
    }
    }
    public JSONObject updateDoctorLocation(String doctor,String orderId,String doctorAddress,String doctorLat,String doctorLon){
    public JSONObject updateDoctorLocation(String doctor,String orderId,String doctorAddress,String doctorLat,String doctorLon){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
@ -2044,4 +2142,126 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
        }
    }
    }
    public JSONObject findMonitorPatientsByDoctor(String doctor,String topicItem,String day,Integer page,Integer pageSize,Integer detail){
        JSONObject result = new JSONObject();
        String sql = " SELECT DISTINCT p.id,p.name,p.residential_area residentialArea,p.photo,p.idcard,p.mobile, " +
                " p.openid,p.sex,p.pad_imei padImei " +
                " from base_patient p , base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                " WHERE p.id = sr.patient and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                " and m.doctor_code = '"+doctor+"' and m.del = '1' ";
        String fliter = "";
        String categoryCode ="";
        String topicItemTmp = topicItem;
        switch (topicItem){
            case "actionTrack":
                categoryCode="'4'";
                topicItemTmp="preventLost";
                break;
            case "preventLost":
                categoryCode="'4'";
                break;
            case "preventFall":
                categoryCode="'12'";
                break;
            case "preventFire":
                categoryCode="'15'";
                break;
            case "preventGasLeakage":
                categoryCode="'14'";
                break;
            case "preventOutOfBed":
                categoryCode="'13'";
                break;
        }
        fliter =" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
                    " where  pd.user = sr.patient and pd.del=0 and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItemTmp+"',dd.service_topic)) ";
        if ("preventLost".equals(topicItem)){//有绑定围栏的居民
            fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
        }
        List<Map<String,Object>> list =  jdbcTemplate.queryForList(sql+fliter);
        result.put("total",list.size());
        if (1 == detail){//获取详情
            JSONArray monitorInfos = new JSONArray();
            page = page>0?page-1:0;
            Integer totalPage = 0;
            if(list.size()%pageSize==0){
                totalPage =list.size()/pageSize;
            }else{
                totalPage = list.size()/pageSize+1;
            }
            Integer currentIndexFrom = page*pageSize;
            Integer currentIndexEnd = page*pageSize+pageSize;
            result.put("totalPage",totalPage);
            result.put("currentPage",page+1);
            for (int i=currentIndexFrom;i<list.size()&&i<currentIndexEnd;i++){
                Map<String,Object> patientTmp = list.get(i);
                com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
                String deviceSn ="";
                List<String> deviceSns = jdbcTemplate.queryForList("select pd.device_sn from wlyy_patient_device pd INNER JOIN dm_device dd " +
                        " on pd.device_id = dd.id where  pd.user = '"+patientTmp.get("id").toString()+"' and pd.del=0  and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItemTmp+"',dd.service_topic)",String.class);
                if (deviceSns.size()>0){
                    deviceSn = deviceSns.get(0);
                }
                if (deviceSns.size()>0){
                    deviceSn = deviceSns.get(0);
                }
                object.put("deviceCode",deviceSn);
                switch (topicItem){
                    case "actionTrack":
                        JSONArray locations = JSON.parseArray(JSON.toJSONString(patientDeviceService.getX1Locations(deviceSn, day), SerializerFeature.WriteMapNullValue));
                        object.put("routes", locations);
                        //获取手表定位
                        JSONObject response= patientDeviceService.getAqgDeviceInfo2(deviceSn);
                        if (response!=null) {
                            //定位信息
                            if (response.containsKey("last_location") && response.get("last_location") != null) {
                                JSONObject locationTmp = response.getJSONObject("last_location");
                                Double lon = locationTmp.getJSONArray("coordinates").getDouble(0);
                                Double lat = locationTmp.getJSONArray("coordinates").getDouble(1);
                                if (!response.getBoolean("online")) {//设备离线 取居民表定位
                                    object.put("X1online", false);
                                } else {
                                    object.put("X1online", true);
                                }
                                JSONObject tmp = gpsUtil.gcj02_To_Bd09(lat, lon);
                                tmp.put("city", response.getString("last_city"));
                                tmp.put("province", response.getString("last_province"));
                                tmp.put("address", response.getString("last_address"));
                                object.put("location", tmp);
                            }
                        }
                        break;
                    default:
                        object = patientMonitoringInfo(patientTmp.get("id").toString(),topicItem,false);
                        break;
                }
                object.put("patientInfo",patientTmp);
                monitorInfos.add(object);
            }
            result.put("topicInfo",monitorInfos);
        }else {
            JSONArray monitorInfos = new JSONArray();
            for (int i=0;i<list.size();i++){
                Map<String,Object> patientTmp = list.get(i);
                String deviceSn ="";
                List<String> deviceSns = jdbcTemplate.queryForList("select pd.device_sn from wlyy_patient_device pd INNER JOIN dm_device dd " +
                        " on pd.device_id = dd.id where  pd.user = '"+patientTmp.get("id").toString()+"' and pd.del=0  and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItem+"',dd.service_topic)",String.class);
                if (deviceSns.size()>0){
                    deviceSn = deviceSns.get(0);
                }
                JSONObject object  = patientMonitoringInfo(patientTmp.get("id").toString(),"null",false);
                object.put("deviceSn",deviceSn);
                object.put("patientInfo",patientTmp);
                monitorInfos.add(object);
            }
            result.put("topicInfo",monitorInfos);
        }
        return result;
    }
}
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -283,7 +283,7 @@ public class PatientInfoPlatFormService {
     * @return
     * @return
     */
     */
    public JSONObject getPatientMonitoringInfo(String patient){
    public JSONObject getPatientMonitoringInfo(String patient){
        return securityMonitoringOrderService.patientMonitoringInfo(patient,null);
        return securityMonitoringOrderService.patientMonitoringInfo(patient,null,true);
    }
    }
    /**
    /**

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -238,6 +238,9 @@ public class MessageUtil {
            case 35:
            case 35:
                wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl()+json.getString("orderId")+"&isMask=1");
                wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl()+json.getString("orderId")+"&isMask=1");
                break;
                break;
            case 36://安防、救助工单详情地址
                wxTemplateConfigDO.setUrl(wxTemplateConfigDO.getUrl()+"?openid=" + openid+"&id="+json.getString("id")+"&OrderType="+json.getString("OrderType"));
                break;
        }
        }
        return wxTemplateConfigDO;
        return wxTemplateConfigDO;
    }
    }
@ -258,6 +261,7 @@ public class MessageUtil {
        messageDO.setReceiver(receiver);
        messageDO.setReceiver(receiver);
        messageDO.setReceiverName(receiverName);
        messageDO.setReceiverName(receiverName);
        messageDO.setData(msg);
        messageDO.setData(msg);
        messageDO.setDel("1");
        messageDO.setOver(over);
        messageDO.setOver(over);
        messageDO.setCreateTime(new Date());
        messageDO.setCreateTime(new Date());
        systemMessageDao.save(messageDO);
        systemMessageDao.save(messageDO);

+ 2 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/dao/device/PatientSafeAreaDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.List;
@ -13,6 +14,7 @@ import java.util.List;
public interface PatientSafeAreaDao extends PagingAndSortingRepository<PatientSafeAreaDO,Long>,
public interface PatientSafeAreaDao extends PagingAndSortingRepository<PatientSafeAreaDO,Long>,
        JpaSpecificationExecutor<PatientSafeAreaDO> {
        JpaSpecificationExecutor<PatientSafeAreaDO> {
    @Query(value = " select p from PatientSafeAreaDO p where p.patient=?1 and p.del='1' and p.manageStatus=1 ")
    List<PatientSafeAreaDO> findByPatient(String patient);
    List<PatientSafeAreaDO> findByPatient(String patient);
    @Modifying
    @Modifying

+ 21 - 6
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

@ -97,6 +97,8 @@ public class DeviceService {
    private DeviceDetailDao deviceDetailDao;
    private DeviceDetailDao deviceDetailDao;
    @Autowired
    @Autowired
    private DeviceDataPushLogUtil dataPushLogUtil;
    private DeviceDataPushLogUtil dataPushLogUtil;
    @Autowired
    private PatientSafeAreaDao safeAreaDao;
    /**
    /**
     * 获取爱牵挂管理员cookie
     * 获取爱牵挂管理员cookie
@ -308,6 +310,11 @@ public class DeviceService {
                                    "  and pack.del=1";
                                    "  and pack.del=1";
                            List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
                            List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
                            if (sqlResult.size()>0){
                            if (sqlResult.size()>0){
                                //疑似离开安全区域 v1.5电子围栏为确认管理时触发
                                List<PatientSafeAreaDO> safeAreaDOS = safeAreaDao.findByPatient(patientDO.getId());
                                if (safeAreaDOS.size()==0){
                                    return;
                                }
                                url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
                                url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
                                JSONObject jsonObject = new JSONObject();
                                JSONObject jsonObject = new JSONObject();
                                jsonObject.put("patient",patientDO.getId());
                                jsonObject.put("patient",patientDO.getId());
@ -359,7 +366,14 @@ public class DeviceService {
    public void byLocation(String imei,String time_begin,boolean is_reply,boolean is_track,String city,String address,double lon,double lat,String type) {
    public void byLocation(String imei,String time_begin,boolean is_reply,boolean is_track,String city,String address,double lon,double lat,String type) {
        try {
        try {
            if(StringUtils.isNotBlank(imei)){
            if(StringUtils.isNotBlank(imei)){
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(imei);
                if (devicePatientDeviceDos.size()>0){
                    DevicePatientDevice deviceDO = devicePatientDeviceDos.get(0);
                    BasePatientDO patientDO = patientDao.findById(deviceDO.getUser());
                    JSONObject position = gpsUtil.gcj02_To_Bd09(lat,lon);
                    patientDO.setLatLon(position.getDouble("lat")+","+position.getDouble("lon"));
                    patientDao.save(patientDO);
                }
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
@ -427,7 +441,7 @@ public class DeviceService {
                    for (int i=0;i<errorIndex.size();i++){
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (0!=tmp.getInteger("error")){
                        if (0!=tmp.getInteger("error")){
                            patientHealthIndex.setStatus(1);
//                            patientHealthIndex.setStatus(1);
                        }
                        }
                        if (1 == tmp.getInteger("error")){
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName")+"、";
                            content_notice += tmp.getString("indexName")+"、";
@ -441,8 +455,9 @@ public class DeviceService {
                    }
                    }
                    dataPushLogUtil.updContactStatus(imei,1,false);
                    dataPushLogUtil.updContactStatus(imei,1,false);
                    healthIndexDao.save(patientHealthIndex);
                    healthIndexDao.save(patientHealthIndex);
                    systemMessageDao.save(messageDO);
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                    //心率不做异常消息推送
//                    systemMessageDao.save(messageDO);
//                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                }
                }
            }
            }
@ -953,7 +968,7 @@ public class DeviceService {
                    patientHealthIndex.setStatus(0);
                    patientHealthIndex.setStatus(0);
                    Integer heartrate1 = Integer.parseInt(heartrate);
                    Integer heartrate1 = Integer.parseInt(heartrate);
                    if (heartrate1>theshold_heartrate_h||theshold_heartrate_h<theshold_heartrate_l){
                    if (heartrate1>theshold_heartrate_h||theshold_heartrate_h<theshold_heartrate_l){
                        patientHealthIndex.setStatus(1);
//                        patientHealthIndex.setStatus(1);
                    }
                    }
                    else {
                    else {
                        patientHealthIndex.setStatus(0);
                        patientHealthIndex.setStatus(0);
@ -979,7 +994,7 @@ public class DeviceService {
                    patientHealthIndex.setCzrq(new Date());
                    patientHealthIndex.setCzrq(new Date());
                    Integer breath1 = Integer.parseInt(breath);
                    Integer breath1 = Integer.parseInt(breath);
                    if (breath1>theshold_breath_h||breath1<theshold_breath_l){
                    if (breath1>theshold_breath_h||breath1<theshold_breath_l){
                        patientHealthIndex.setStatus(1);
//                        patientHealthIndex.setStatus(1);
                    }else {
                    }else {
                        patientHealthIndex.setStatus(0);
                        patientHealthIndex.setStatus(0);
                    }
                    }

+ 2 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/DeviceDataPushLogUtil.java

@ -11,6 +11,7 @@ import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.Date;
@ -67,6 +68,7 @@ public class DeviceDataPushLogUtil {
     * @param status
     * @param status
     * @param flag 状态 true 异常 false 正常 null其他
     * @param flag 状态 true 异常 false 正常 null其他
     */
     */
    @Transactional
    public void updContactStatus(String sn,Integer status,Boolean flag){
    public void updContactStatus(String sn,Integer status,Boolean flag){
        DeviceDetail deviceDetail = deviceDetailDao.findBySn(sn);
        DeviceDetail deviceDetail = deviceDetailDao.findBySn(sn);
        if(deviceDetail!=null){
        if(deviceDetail!=null){

+ 4 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

@ -37,6 +37,10 @@ public class DeviceLostMessageUtil {
    public void deviceLostMessage(List<String> devices){
    public void deviceLostMessage(List<String> devices){
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        for (String id:devices){
        for (String id:devices){
            List<SystemMessageDO> sendMessageBefore = systemMessageDao.queryByRelationCodeAndTypeIn(id,new String[]{"43"});
            if (sendMessageBefore.size()>0){//删除之前的离线消息
                systemMessageDao.delete(sendMessageBefore);
            }
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            if (pds.size()>0){
            if (pds.size()>0){
                DevicePatientDevice deviceDO = pds.get(0);
                DevicePatientDevice deviceDO = pds.get(0);

+ 10 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/SecurityOrderUtil.java

@ -5,9 +5,11 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.care.dao.device.DeviceSosLogDao;
import com.yihu.jw.care.dao.device.DeviceSosLogDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DeviceSosLogDO;
import com.yihu.jw.entity.care.device.DeviceSosLogDO;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import com.yihu.jw.exception.business.file_upload.*;
import com.yihu.jw.exception.business.file_upload.*;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.iot.common.UploadVO;
@ -52,6 +54,8 @@ public class SecurityOrderUtil {
    private String fastdfs_file_url;
    private String fastdfs_file_url;
    @Autowired
    @Autowired
    private DeviceSosLogDao sosLogDao;
    private DeviceSosLogDao sosLogDao;
    @Autowired
    private PatientSafeAreaDao safeAreaDao;
    /***创建安防工单***/
    /***创建安防工单***/
    public JSONObject createSecurityOrder(String deviceSN, String sceneUrl, JSONObject result,JSONObject addressInfo, Integer orderSource, String dictCode, String topicItem, String warnInfo){
    public JSONObject createSecurityOrder(String deviceSN, String sceneUrl, JSONObject result,JSONObject addressInfo, Integer orderSource, String dictCode, String topicItem, String warnInfo){
@ -97,7 +101,12 @@ public class SecurityOrderUtil {
                }else{
                }else{
                    return new JSONObject();
                    return new JSONObject();
                }
                }
                if ("1".equals(dictCode)){//疑似离开安全区域 v1.5电子围栏为确认管理时触发
                    List<PatientSafeAreaDO> safeAreaDOS = safeAreaDao.findByPatient(patientDO.getId());
                    if (safeAreaDOS.size()==0){
                        return new JSONObject();
                    }
                }
                JSONObject jsonObject = new JSONObject();
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("patient",patientDO.getId());
                jsonObject.put("patient",patientDO.getId());
                jsonObject.put("patientName",patientDO.getName());
                jsonObject.put("patientName",patientDO.getName());

+ 4 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

@ -38,6 +38,10 @@ public class DeviceLostMessageUtil {
    public void deviceLostMessage(List<String> devices){
    public void deviceLostMessage(List<String> devices){
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        for (String id:devices){
        for (String id:devices){
            List<SystemMessageDO> sendMessageBefore = systemMessageDao.queryByRelationCodeAndTypeIn(id,new String[]{"43"});
            if (sendMessageBefore.size()>0){//删除之前的离线消息
                systemMessageDao.delete(sendMessageBefore);
            }
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            if (pds.size()>0){
            if (pds.size()>0){
                DevicePatientDevice deviceDO = pds.get(0);
                DevicePatientDevice deviceDO = pds.get(0);