فهرست منبع

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

lulihong 3 سال پیش
والد
کامیت
f61485d2e7
49فایلهای تغییر یافته به همراه1255 افزوده شده و 175 حذف شده
  1. 3 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorDao.java
  2. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java
  3. 8 0
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  4. 17 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  5. 5 0
      common/common-entity/sql记录
  6. 5 5
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseSleepDeviceReport.java
  7. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DeviceDetail.java
  8. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/BaseAdminServiceDynamic.java
  9. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  10. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/job/QuartzJobConfig.java
  11. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/servicePackage/ServicePackageRecordDao.java
  12. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamDao.java
  13. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/WlyyPatientLabelDao.java
  14. 244 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java
  15. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DeviceController.java
  16. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java
  17. 41 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java
  18. 11 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/OnlineContactEndpoint.java
  19. 1 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java
  20. 4 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/admin/AdminDoorCoachOrderService.java
  21. 30 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  22. 6 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceDetailService.java
  23. 57 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  24. 62 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/DoctorServicePermissionsService.java
  25. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  26. 4 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  27. 27 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java
  28. 33 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java
  29. 8 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  30. 92 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/OnlineContactService.java
  31. 27 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  32. 31 13
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/DetectionPlatformService.java
  33. 51 19
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java
  34. 3 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/yunxin/YunxinService.java
  35. 1 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java
  36. 16 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java
  37. 11 13
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java
  38. 13 5
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/HvDeviceService.java
  39. 1 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java
  40. 103 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java
  41. 5 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/dao/device/WlyyDeviceDao.java
  42. 2 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PatientSosContactsJob.java
  43. 43 64
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  44. 104 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java
  45. 2 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/MessageUtil.java
  46. 41 26
      svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java
  47. 29 3
      svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java
  48. 1 1
      svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/EsToEsQuotaJob.java
  49. 2 1
      svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorDao.java

@ -40,6 +40,9 @@ public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO,
    List<BaseDoctorDO> findByIdcard(String idcard);
    List<BaseDoctorDO> findByIdcard(String idcard);
    @Query("from BaseDoctorDO d where d.name = ?1 AND d.del ='1'")
    BaseDoctorDO findByNameAndDel(String name);
    @Query("from BaseDoctorDO d where d.idcard = ?1 AND d.del ='1'")
    @Query("from BaseDoctorDO d where d.idcard = ?1 AND d.del ='1'")
    BaseDoctorDO findByIdcardAndDel(String id);
    BaseDoctorDO findByIdcardAndDel(String id);
    @Query("from BaseDoctorDO d where d.mobile = ?1")
    @Query("from BaseDoctorDO d where d.mobile = ?1")

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

@ -52,6 +52,7 @@ public interface SystemMessageDao extends PagingAndSortingRepository<SystemMessa
    @Modifying
    @Modifying
    void setMessageOverByType(String doctor, Integer type, Date start, Date end);
    void setMessageOverByType(String doctor, Integer type, Date start, Date end);
    @Query("select a from SystemMessageDO a where a.receiver=?1 and a.type=?2 and  a.del='1'")
    List<SystemMessageDO> getByReceiverAndType(String doctor,String type);
}
}

+ 8 - 0
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -109,6 +109,14 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        return basePatientDao.findById(patientId);
        return basePatientDao.findById(patientId);
    }
    }
    public boolean findByIdCard(String idcard){
        BasePatientDO patientDO = basePatientDao.findByIdcardAndDel(idcard,"1");
        if (patientDO != null) {
            return true;
        }
        return false;
    }
    /**
    /**
     * 居民id
     * 居民id
     * @param patientId
     * @param patientId

+ 17 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -892,4 +892,21 @@ public class ImUtil {
		String ret = HttpClientUtil.get(url, "UTF-8");
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
		return ret;
	}
	}
	/**
	 *按会话类型、会话状态获取会话列表
	 * @param user_id
	 * @param page
	 * @param size
	 * @param type
	 * @param status 不传为获取所有状态
	 * @param name
	 * @param search_type 仅当type为2时有效 1与医生p2p会话 2与患者p2p
	 * @return
	 */
	public String getSessionListByType(String user_id, String page, String size, String type, String status, String name,String search_type){
		String url = im_host + "api/v2/sessions/sessionListByType?user_id="+user_id+"&page="+page+"&size="+size+"&type="+type+"&status="+(status==null?"":status)+"&name="+(name==null?"":name)+"&search_type="+(search_type==null?"":search_type);
		String ret = HttpClientUtil.get(url, "utf-8");
		return ret;
	}
}
}

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

@ -1487,5 +1487,10 @@ CREATE TABLE `base_onenet_receive_record` (
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='onenet 数据接收记录表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='onenet 数据接收记录表';
-- 2021-09-10
ALTER table wlyy_job_config_new add COLUMN area_level VARCHAR(1) default null comment '1省2市3区县4机构5团队6医生'
-- 2021-09-13
alter table base_admin_service_dynamic add column photo varchar(255) default null COMMENT '用户头像';
alter table base_admin_service_dynamic add column del TINYINT(2) default 1 COMMENT '1有效,0失效';

+ 5 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseSleepDeviceReport.java

@ -16,7 +16,7 @@ import java.util.Date;
public class BaseSleepDeviceReport extends IdEntity {
public class BaseSleepDeviceReport extends IdEntity {
    public String patient;
    public String patient;
    public String deviceSN; //睡眠带MAC地址
    public String deviceSn; //睡眠带MAC地址
    public String fallaSleep;   //入睡时长 (分钟)
    public String fallaSleep;   //入睡时长 (分钟)
    public String sleepTime;    //睡眠时长 (分钟)
    public String sleepTime;    //睡眠时长 (分钟)
    public String restTime;     //休息时长 (分钟)
    public String restTime;     //休息时长 (分钟)
@ -44,12 +44,12 @@ public class BaseSleepDeviceReport extends IdEntity {
        this.patient = patient;
        this.patient = patient;
    }
    }
    public String getDeviceSN() {
        return deviceSN;
    public String getDeviceSn() {
        return deviceSn;
    }
    }
    public void setDeviceSN(String deviceSN) {
        this.deviceSN = deviceSN;
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    }
    public String getFallaSleep() {
    public String getFallaSleep() {

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DeviceDetail.java

@ -35,7 +35,7 @@ public class DeviceDetail extends IdEntity {
    private String applicantMail;//申请人(发放人/医生)邮箱
    private String applicantMail;//申请人(发放人/医生)邮箱
    //1.4.8版本新增字段
    //1.4.8版本新增字段
    private String sim;//SIM卡
    private String sim;//SIM卡 iccid卡号
    private String manufacturerId;//厂商表的业务关联code
    private String manufacturerId;//厂商表的业务关联code
    private Integer isGrant;//是否发放(0否1是)
    private Integer isGrant;//是否发放(0否1是)
    private String grantAdminTeam;//发放的患者所在团队
    private String grantAdminTeam;//发放的患者所在团队

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/BaseAdminServiceDynamic.java

@ -28,6 +28,7 @@ public class BaseAdminServiceDynamic extends IdEntity {
    private Date createTime;
    private Date createTime;
    private String doctor;
    private String doctor;
    private String doctorName;
    private String doctorName;
    private String photo;
    public String getPatient() {
    public String getPatient() {
        return patient;
        return patient;
@ -93,4 +94,12 @@ public class BaseAdminServiceDynamic extends IdEntity {
    public void setDoctorName(String doctorName) {
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
        this.doctorName = doctorName;
    }
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
}
}

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

@ -21,6 +21,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     * 人文关怀系统消息 41
     * 人文关怀系统消息 41
     * 体征设备测量系统消息 42
     * 体征设备测量系统消息 42
     * 设备离线系统消息 43
     * 家属紧急预警系统消息 50
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 新生儿在线咨询 850
     * 老人在线咨询 851
     * 老人在线咨询 851

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/job/QuartzJobConfig.java

@ -16,6 +16,7 @@ public class QuartzJobConfig implements java.io.Serializable {
	private String jobName;//任务名称
	private String jobName;//任务名称
	private String jobInfo;//任务描述
	private String jobInfo;//任务描述
	private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
	private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
	private String areaLevel;//1省2市3区县4机构5团队6医生
	private String jobClass;//任务执行的class
	private String jobClass;//任务执行的class
	private String quartzCron;//quartz表达式
	private String quartzCron;//quartz表达式
	private String status;//1 启动 0停止
	private String status;//1 启动 0停止
@ -222,4 +223,13 @@ public class QuartzJobConfig implements java.io.Serializable {
    public void setTimeLevel(String timeLevel) {
    public void setTimeLevel(String timeLevel) {
        this.timeLevel = timeLevel;
        this.timeLevel = timeLevel;
    }
    }
	@Column(name = "area_level", length = 1)
	public String getAreaLevel() {
		return areaLevel;
	}
	public void setAreaLevel(String areaLevel) {
		this.areaLevel = areaLevel;
	}
}
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/servicePackage/ServicePackageRecordDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.dao.servicePackage;
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface ServicePackageRecordDao extends PagingAndSortingRepository<ServicePackageRecordDO, String>, JpaSpecificationExecutor<ServicePackageRecordDO> {
    List<ServicePackageRecordDO> findBySignId(String signId);
}

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamDao.java

@ -1,5 +1,6 @@
package com.yihu.jw.base.dao.team;
package com.yihu.jw.base.dao.team;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -8,6 +9,7 @@ import com.yihu.jw.entity.base.team.BaseTeamDO;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.Set;
/**
/**
 * 
 * 
@ -24,4 +26,8 @@ import java.util.Map;
public interface BaseTeamDao extends PagingAndSortingRepository<BaseTeamDO, String>, JpaSpecificationExecutor<BaseTeamDO>  {
public interface BaseTeamDao extends PagingAndSortingRepository<BaseTeamDO, String>, JpaSpecificationExecutor<BaseTeamDO>  {
    @Query("select orgCode as code,orgName as name from BaseTeamDO")
    @Query("select orgCode as code,orgName as name from BaseTeamDO")
    List<Map<String,Object>> getTeamOrgList();
    List<Map<String,Object>> getTeamOrgList();
    @Query(" from BaseTeamDO t where t.name = ?1")
    BaseTeamDO findByName(String teamCode);
 }
 }

+ 22 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/WlyyPatientLabelDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.base.dao.team;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
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;
/**
 * Created by yeshijie on 2021/4/7.
 */
public interface WlyyPatientLabelDao extends PagingAndSortingRepository<WlyyPatientLabelDO, String>, JpaSpecificationExecutor<WlyyPatientLabelDO> {
    @Modifying
    @Query("delete WlyyPatientLabelDO a where a.patient=?1 and a.labelType=?2")
    int deleteByPatientAndLabelType(String patient, String labelType) throws Exception;
    @Query("from WlyyPatientLabelDO w where  w.patient=?1 group by w.labelType,w.labelCode order by w.czrq desc")
    List<WlyyPatientLabelDO> findByPatient(String patient);
}

+ 244 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -1,20 +1,45 @@
package com.yihu.jw.base.endpoint.patient;
package com.yihu.jw.base.endpoint.patient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.base.dao.servicePackage.ServicePackageRecordDao;
import com.yihu.jw.base.dao.servicePackage.ServicePackageSignRecordDao;
import com.yihu.jw.base.dao.sign.ArchiveDao;
import com.yihu.jw.base.dao.team.BaseTeamDao;
import com.yihu.jw.base.dao.team.WlyyPatientLabelDao;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.team.BaseTeamDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.utils.date.DateUtil;
import com.yihu.utils.security.MD5;
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 io.swagger.annotations.ApiParam;
import jxl.Sheet;
import jxl.Workbook;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
/**
/**
 * 居民信息控制器
 * 居民信息控制器
@ -33,6 +58,20 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private BasePatientService basePatientService;
    private BasePatientService basePatientService;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private ServicePackageSignRecordDao servicePackageSignRecordDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BaseTeamDao baseTeamDao;
    @Autowired
    private ServicePackageRecordDao servicePackageRecordDao;
    @Autowired
    private ArchiveDao archiveDao;
    @Autowired
    private WlyyPatientLabelDao patientLabelDao;
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
    @ApiOperation(value = "创建")
    @ApiOperation(value = "创建")
@ -175,4 +214,208 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
        }
        }
        return success(msg);
        return success(msg);
    }
    }
    /**
     *   如果添加失败,注释MultipartConfig配置
     *   如果导入失败,将Excel修改为97-2003版本.xls
     *   签约服务包id固定
     *   签约日期 开始时间为当前时间,结束时间为2023-12-31 23:59:59
     *   patientLabelDO.setLabelType("1");  居民标签类型 固定为能力完好
     *   patientLabelDO.setLabelCode("0");  居民标签类型 固定为能力完好
     *   姓名	性别	年龄	身份证号	      联系方式	   小区	            地址	                 签约团队	        能力类型
     * 沈xxx	女	    88	330103xxxxxxxx0720	1525xxxx711	朝晖九区	朝晖九区10幢4单元103	    虹园/稻香园服务团队	    能力完好
     * 沈xxx	女	    86	330103xxxxxxxx0720	1525xxxx711	朝晖九区	朝晖九区天盛居4幢1202室	  大木桥服务团队	    能力完好
     * @param request
     * @param file
     * @return
     */
    @RequestMapping(value = "/importPatientFromExcel", produces = "application/json;charset=UTF-8",method = RequestMethod.POST)
    @ResponseBody
    public ObjEnvelop importPatientFromExcel(HttpServletRequest request, @ApiParam(value = "文件", required = true)
    @RequestParam(value = "file", required = true) MultipartFile file) {
        Calendar c1 = Calendar.getInstance();
        /**
         * c1  签约结束时间
         */
        c1.set(2023, 12 - 1, 31,23,59,59);
        List errorLs = new ArrayList<>();
        List correctLs = new ArrayList<>();
        List idcardList = new ArrayList<>();
        Map<String, String> errorMsgMap = new HashMap<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        List<String> deviceCodes = new ArrayList<>();
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = file.getInputStream();
            Workbook rwb = Workbook.getWorkbook(inputStream);
            Sheet[] sheets = rwb.getSheets();
            int rows;
            int row;
            String name=null;//用户姓名
            String sex; //性别
            String age; //年龄
            String idcard;  //身份证号
            String mobile;  //联系方式
            String residentialArea; //居住小区
            String address; //居住地址
            String signTeam; //签约团队
            String label; //能力类型
            Sheet sheet = sheets[0];    //第一张表
            rows = sheet.getRows();
            for (int j = 1; j < rows; j++) {
                if (sheet.getRow(j).length == 0) {
                    continue;
                }
                BasePatientDO basePatientVO = new BasePatientDO();
                JSONObject infoMap = new JSONObject();
                row = j;
                name = sheet.getCell(0, row).getContents().trim();    //0 用户姓名
                sex = sheet.getCell(1, row).getContents().trim();  //1 性别
                age = sheet.getCell(2, row).getContents().trim();   //2 年龄
                idcard = sheet.getCell(3, row).getContents().trim(); //3 身份证号
                mobile = sheet.getCell(4, row).getContents().trim();  //4 联系方式
                residentialArea = sheet.getCell(5, row).getContents().trim(); //5 居住小区
                address = sheet.getCell(6, row).getContents().trim(); //6 居住地址
                signTeam = sheet.getCell(7, row).getContents().trim();; //签约团队
                label = sheet.getCell(8, row).getContents().trim();; //能力类型
                if (StringUtils.isBlank(idcard)){
                    continue;
                }
                if (StringUtils.isBlank(name)){
                    errorMsgMap.put(idcard,"姓名不能为空");
                    continue;
                }
                if (basePatientService.findByIdCard(idcard)){
                    errorMsgMap.put(idcard,"身份证号重复");
                    continue;
                }
                if (StringUtils.isBlank(sex)){
                    sex = "3";
                } else {
                    if (sex.equals("男")) {
                        sex = "1";
                    } else {
                        sex = "2";
                    }
                }
                if (StringUtils.isBlank(signTeam)){
                    errorMsgMap.put(idcard,"签约团队不能为空");
                    continue;
                }
                if (StringUtils.isBlank(label)){
                    errorMsgMap.put(idcard,"能力类型不能为空");
                    continue;
                }
                basePatientVO.setAddress(address);
                basePatientVO.setDel("1");
                basePatientVO.setEnabled(1);
                basePatientVO.setIdcard(idcard);
                basePatientVO.setSex(new Integer(sex));
                basePatientVO.setName(name);
                basePatientVO.setMobile(mobile);
                basePatientVO.setArchiveStatus(3);
                basePatientVO.setArchiveType(1); //默认添加老人
                String pw = idcard.substring(idcard.length()-6);
                String salt = UUID.randomUUID().toString().substring(0,5);
                basePatientVO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                basePatientVO.setSalt(salt);
                basePatientVO.setResidentialArea(residentialArea);
                infoMap.put("idcard",idcard);
                infoMap.put("signTeam",signTeam);
                infoMap.put("label",label);
                correctLs.add(basePatientVO);
                idcardList.add(infoMap);
            }
            basePatientDao.save(correctLs);
            String patient= "";
            /**
             * 添加签约数据
             */
            if (idcardList.size() > 0) {
                for (int i=0;i<idcardList.size();i++) {
                    ServicePackageSignRecordDO signRecordDO = new ServicePackageSignRecordDO();
                    BasePatientDO basePatientVO = new BasePatientDO();
                    try {
                        idcard = retOne(idcardList.get(i).toString(),"idcard").toString();
                        signTeam = retOne(idcardList.get(i).toString(),"signTeam").toString();
                        label = retOne(idcardList.get(i).toString(),"label").toString();
                        basePatientVO = basePatientDao.findByIdcardAndDel(idcard,"1");
                        if (basePatientVO == null) {
                            errorMsgMap.put(idcard,"居民信息获取失败");
                            continue;
                        }
                        patient = basePatientVO.getId();
                        name = basePatientVO.getName();
                        signRecordDO.setPatient(patient);
                        signRecordDO.setName(name);
                        signRecordDO.setStatus(1);
                        signRecordDO.setStartTime(new Date());
                        signRecordDO.setEndTime(c1.getTime());
                        BaseTeamDO teamDO = baseTeamDao.findByName(signTeam);
                        if (teamDO == null) {
                            errorMsgMap.put(idcard,"团队信息获取失败");
                            continue;
                        }
                        BaseDoctorDO doctorDO = baseDoctorDao.findById(teamDO.getLeaderCode());
                        if (doctorDO == null) {
                            errorMsgMap.put(idcard,"医生信息获取失败");
                            continue;
                        }
                        signRecordDO.setSignDoctor(doctorDO.getId());
                        signRecordDO.setSignDoctorName(doctorDO.getName());
                        signRecordDO = servicePackageSignRecordDao.save(signRecordDO);
                        ServicePackageRecordDO packageRecordDO = new ServicePackageRecordDO();
                        packageRecordDO.setSignId(signRecordDO.getId());
                        packageRecordDO.setServicePackageId("8a92aba97b48824a017b56c5ee710019");
                        packageRecordDO.setPatient(patient);
                        packageRecordDO.setCreateTime(new Date());
                        packageRecordDO.setTeamCode(teamDO.getId());
                        servicePackageRecordDao.save(packageRecordDO);
                        //建档状态
                        ArchiveDO archiveDO = new ArchiveDO();
                        archiveDO.setCreateTime(new Date());
                        archiveDO.setArchiveOperatorName(doctorDO.getName());
                        archiveDO.setDoctorCode(doctorDO.getId());
                        archiveDO.setPatient(patient);
                        archiveDO.setSickName(name);
                        archiveDO.setIdcard(idcard);
                        archiveDO.setSignStatus(1);
                        archiveDao.save(archiveDO);
                        //居民标签
                        WlyyPatientLabelDO patientLabelDO = new WlyyPatientLabelDO();
                        patientLabelDO.setCzrq(new Date());
                        patientLabelDO.setLabelType("1");
                        patientLabelDO.setPatient(patient);
                        patientLabelDO.setLabelCode("0");
                        patientLabelDO.setLabelName(label);
                        patientLabelDao.save(patientLabelDO);
                        basePatientVO.setSignStatus(1);
                        basePatientDao.save(basePatientVO);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
            //包装导入结果(导入成功数量、错误对象集合)
            Map<String, Object> map = new HashMap<>();
            map.put("successNum", correctLs.size());
            map.put("failedNum", rows-1 - correctLs.size() );
            map.put("errorData", JSON.toJSONString(errorMsgMap, SerializerFeature.WriteMapNullValue));
            System.out.println(map);
            return ObjEnvelop.getSuccess("获取成功",map);
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
    public Object retOne(String str,String name){
        JSONObject object = JSONObject.parseObject(str);
        return object.get(""+name+"");
    }
}
}

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DeviceController.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.endpoint.device;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.device.DeviceDetailService;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -25,7 +26,23 @@ public class DeviceController extends BaseController {
    @Autowired
    @Autowired
    private DeviceService deviceService;
    private DeviceService deviceService;
    @Autowired
    private DeviceDetailService deviceDetailService;
    /**
     * 清除设备失联状态
     */
    @ApiOperation("清除设备失联状态")
    @RequestMapping(value = "updateContactStatus",method = {RequestMethod.GET,RequestMethod.POST})
    public String updateContactStatus(@ApiParam(name = "deviceSn", value = "设备sn码")
                                      @RequestParam(value = "deviceSn", required = true) String deviceSn) {
        try {
            deviceDetailService.updateContactStatus(deviceSn);
            return success("设备失联信息已清除!");
        } catch (Exception ex) {
            return errorResult(ex);
        }
    }
    @ApiOperation("获取设备列表")
    @ApiOperation("获取设备列表")
    @RequestMapping(value = "DeviceList", method = {RequestMethod.POST, RequestMethod.GET})
    @RequestMapping(value = "DeviceList", method = {RequestMethod.POST, RequestMethod.GET})

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.endpoint.doctor;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -40,4 +41,18 @@ public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
            return failedObjEnvelopException2(e);
            return failedObjEnvelopException2(e);
        }
        }
    }
    }
    /**************************v1.1.0新增 设备异常动态************************************/
    @GetMapping(value = "getHealthMonitoringListNew")
    @ApiOperation(value = "体征监测/安防监护")
    public PageEnvelop getHealthMonitoringListNew(
            @ApiParam(name="page",value = "page") @RequestParam(required = true) int page,
            @ApiParam(name="size",value = "size") @RequestParam(required = true) int size,
            @ApiParam(name="hospital",value = "hospital") @RequestParam(required = true) String hospital) {
        try {
            return doctorMessageService.getHealthMonitoringListTwo(page,size,hospital);
        } catch (Exception e) {
            return failedPageEnvelopException2(e);
        }
    }
}
}

+ 41 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java

@ -2,7 +2,9 @@ package com.yihu.jw.care.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.care.service.message.PatientMessageService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -21,10 +23,12 @@ import org.springframework.web.bind.annotation.*;
public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private DoctorMessageService doctorMessageService;
    private DoctorMessageService doctorMessageService;
    @Autowired
    private PatientMessageService patientMessageService;
    @GetMapping(value = "messages")
    @GetMapping(value = "messages")
    @ApiOperation("应用消息")
    @ApiOperation("应用消息")
    public ObjEnvelop messages(@ApiParam(name = "type", value = "消息类型 10床位申请,11安全监护,12紧急救助,13体征异常消息")
    public ObjEnvelop messages(@ApiParam(name = "type", value = "消息类型 10床位申请,11安全监护,12紧急救助,13体征异常消息,14设备离线通知")
                               @RequestParam(value = "type", required = false) String type,
                               @RequestParam(value = "type", required = false) String type,
                               @ApiParam(name = "doctor", value = "doctor")
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor", required = false) String doctor){
                               @RequestParam(value = "doctor", required = false) String doctor){
@ -84,4 +88,40 @@ public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @GetMapping(value = "getDeviceLostMessageList")
    @ApiOperation("获取设备离线通知列表")
    public ObjEnvelop getDeviceLostMessageList(@ApiParam(name="doctor",value = "医生ID,当前查看列表医生",required = true)
                                          @RequestParam(value = "doctor")String doctor){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.getDeviceLostMessageList(doctor));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "/updateMessageRead")
    @ApiOperation("已读消息")
    public Envelop updateMessageRead(@ApiParam(name = "messageId",required = true)
                                     @RequestParam(value = "messageId")String messageId){
        try {
            patientMessageService.updateMessageRead(messageId);
            return Envelop.getSuccess("修改成功");
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @PostMapping(value = "/delMessageRead")
    @ApiOperation("删除消息")
    public Envelop delMessageRead(@ApiParam(name = "messageId",required = true)
                                     @RequestParam(value = "messageId")String messageId){
        try {
            patientMessageService.delMessageRead(messageId);
            return Envelop.getSuccess("修改成功");
        }catch (Exception e){
            return failedException2(e);
        }
    }
}
}

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/OnlineContactEndpoint.java

@ -36,4 +36,15 @@ public class OnlineContactEndpoint extends EnvelopRestEndpoint {
    }
    }
    @GetMapping(value = "getContactFirst")
    @ApiOperation(value = "pad首页获取在线联系()")
    public Envelop getContactFirst(
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient) {
        try{
            return success("获取成功",service.getContactFirst(patient));
        }catch (Exception e){
            return failedException2(e);
        }
    }
}
}

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -306,6 +306,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name="mobile")@RequestParam(value = "mobile")String mobile
            @ApiParam(name="mobile")@RequestParam(value = "mobile")String mobile
            ){
            ){
        try {
        try {
            JSONObject result = patientService.registerForFamily(archiveType,idcard,mobile,name,sex);
            JSONObject result = patientService.registerForFamily(archiveType,idcard,mobile,name,sex);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/admin/AdminDoorCoachOrderService.java

@ -213,6 +213,10 @@ public class AdminDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOrde
            baseAdminServiceDynamic.setValue("创建了上门辅导申请");
            baseAdminServiceDynamic.setValue("创建了上门辅导申请");
            baseAdminServiceDynamic.setCreateTime(new Date());
            baseAdminServiceDynamic.setCreateTime(new Date());
            baseAdminServiceDynamic.setName(orderDO.getNumber());
            baseAdminServiceDynamic.setName(orderDO.getNumber());
            BasePatientDO patientDO = patientDao.findById(orderDO.getPatient());
            if (StringUtils.isNotBlank(patientDO.getPhoto())) {
                baseAdminServiceDynamic.setPhoto(patientDO.getPhoto());
            }
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
        }catch (Exception e) {
        }catch (Exception e) {
            logger.info(e.getMessage());
            logger.info(e.getMessage());

+ 30 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -16,14 +16,18 @@ import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.doctor.DoctorServicePermissionsService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.CountDistance;
import com.yihu.jw.care.util.CountDistance;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
import com.yihu.jw.entity.care.contacts.PatientSosContactsDO;
import com.yihu.jw.entity.care.contacts.PatientSosContactsDO;
@ -37,6 +41,7 @@ import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
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.org.dao.BaseOrgDao;
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.restmodel.emergency.EmergencyOrderVO;
import com.yihu.jw.restmodel.emergency.EmergencyOrderVO;
@ -113,6 +118,12 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    private MessageUtil messageUtil;
    private MessageUtil messageUtil;
    @Autowired
    @Autowired
    private BaseYxDeviceIndexDao yxDeviceIndexDao;
    private BaseYxDeviceIndexDao yxDeviceIndexDao;
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private BaseOrgDao orgDao;
    /**
    /**
     * 获取百度天气
     * 获取百度天气
@ -465,7 +476,16 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            noticePersons.add(noticeObj);
            noticePersons.add(noticeObj);
            if (StringUtils.isBlank(doctorDO.getDoctorLat()) || StringUtils.isBlank(doctorDO.getDoctorLon())) {
            if (StringUtils.isBlank(doctorDO.getDoctorLat()) || StringUtils.isBlank(doctorDO.getDoctorLon())) {
                continue;
                List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
                if (doctorHospitalDOS.size()>0){
                    BaseDoctorHospitalDO hospitalDO = doctorHospitalDOS.get(0);
                    BaseOrgDO orgDO = orgDao.findByCode(hospitalDO.getOrgCode());
                    doctorDO.setDoctorLocateAddress(orgDO.getAddress());
                    doctorDO.setDoctorLat(orgDO.getLatitude());
                    doctorDO.setDoctorLon(orgDO.getLongitude());
                }else {
                    continue;
                }
            }
            }
//            double distanceTmp = countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(doctorDO.getDoctorLat()),Double.parseDouble(doctorDO.getDoctorLon()));
//            double distanceTmp = countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(doctorDO.getDoctorLat()),Double.parseDouble(doctorDO.getDoctorLon()));
            otherDoctorDistanceObj = new JSONObject();
            otherDoctorDistanceObj = new JSONObject();
@ -680,6 +700,12 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    }
    }
    public List<EmergencyAssistanceDO> doctorGetOrderList(String patient,String doctor,String status,Integer page,Integer pageSize,String sort){
    public List<EmergencyAssistanceDO> doctorGetOrderList(String patient,String doctor,String status,Integer page,Integer pageSize,String sort){
        List<EmergencyAssistanceDO> resultList = new ArrayList<>();
        //服务权限
        if(doctorServicePermissionsService.isPermission(doctor,8)==0){
            return resultList;
        }
        StringBuilder sql = new StringBuilder(" select ord.* from base_emergency_assistance_order ord where 1=1 ");
        StringBuilder sql = new StringBuilder(" select ord.* from base_emergency_assistance_order ord where 1=1 ");
        if (StringUtils.isNotBlank(doctor)){
        if (StringUtils.isNotBlank(doctor)){
            sql.append(" AND EXISTS (" +
            sql.append(" AND EXISTS (" +
@ -694,7 +720,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        sql.append(" and ord.status in ( '").append(status.replace(",","','")).append("') ");
        sql.append(" and ord.status in ( '").append(status.replace(",","','")).append("') ");
        sql.append(" order by ord.create_time "+sort+" limit "+page*pageSize+","+pageSize);
        sql.append(" order by ord.create_time "+sort+" limit "+page*pageSize+","+pageSize);
        List<EmergencyAssistanceDO> resultList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(EmergencyAssistanceDO.class));
        resultList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(EmergencyAssistanceDO.class));
        for (EmergencyAssistanceDO obj:resultList){
        for (EmergencyAssistanceDO obj:resultList){
            BasePatientDO patientDO = patientDao.findById(obj.getPatient());
            BasePatientDO patientDO = patientDao.findById(obj.getPatient());
            obj.setPatientPhoto(patientDO.getPhoto());
            obj.setPatientPhoto(patientDO.getPhoto());
@ -869,6 +895,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
            return result;
        }
        }
        patientDO.setLatLon(patientLat+","+patientLon);
        patientDao.save(patientDO);
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByPatientAndStatus(patient,1);
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByPatientAndStatus(patient,1);
        if (assistanceDO.size()>0){
        if (assistanceDO.size()>0){
            for (EmergencyAssistanceDO tmp:assistanceDO){
            for (EmergencyAssistanceDO tmp:assistanceDO){

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

@ -172,6 +172,11 @@ public class DeviceDetailService extends BaseJpaService<DeviceDetail, DeviceDeta
		return deviceDetailDao.save(deviceDetail);
		return deviceDetailDao.save(deviceDetail);
	}
	}
	public void updateContactStatus(String deviceSn) throws Exception {
		String sql = "update wlyy_devices dd set dd.contact_status=? where dd.device_code=?";
		jdbcTemplate.update(sql,new Object[]{-1,deviceSn});
	}
	/**
	/**
	 * 全部解绑后设备表更新为未绑定
	 * 全部解绑后设备表更新为未绑定
	 * @param deviceSn
	 * @param deviceSn
@ -209,7 +214,7 @@ public class DeviceDetailService extends BaseJpaService<DeviceDetail, DeviceDeta
			String url = "http://www.cityihealth.com:43210/deviceManage/register";
			String url = "http://www.cityihealth.com:43210/deviceManage/register";
			List<NameValuePair> params = new ArrayList<>();
			List<NameValuePair> params = new ArrayList<>();
			params.add(new BasicNameValuePair("deviceSN", device.getDeviceSn()));
			params.add(new BasicNameValuePair("deviceSN", device.getDeviceSn()));
			params.add(new BasicNameValuePair("pushAddress", cloudDeviceUrl+"/"+deviceDO.getNeedRegister()));
			params.add(new BasicNameValuePair("pushAddress", cloudDeviceUrl+deviceDO.getNeedRegister()));
			String response = httpClientUtil.post(url, params,"UTF-8");
			String response = httpClientUtil.post(url, params,"UTF-8");
			//注册日志
			//注册日志
		}
		}

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

@ -1280,16 +1280,68 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            }else {
            }else {
                sql = sql.replace("{{patient}}"," ");
                sql = sql.replace("{{patient}}"," ");
            }
            }
            String sqlCount = " select count(*) from ("+sql+")A ";
            sql  = "  SELECT GROUP_CONCAT(OrderType) as OrderType,SUM(total) total,create_time FROM ("+sql+")A GROUP BY create_time " +
            sql  = "  SELECT GROUP_CONCAT(OrderType) as OrderType,SUM(total) total,create_time FROM ("+sql+")A GROUP BY create_time " +
                    "order by create_time desc limit "+page*pageSize+","+pageSize;
            long count = jdbcTemplate.queryForObject(sqlCount,long.class);
                    "order by create_time desc";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            List<String> warnDays = list.stream().map(item->(item).get("create_time").toString()).collect(Collectors.toList());
            //获取无预警时间列表
            Date dateBegin = DateUtil.strToDate("2021-09-01");
            Date dateNow = new Date();
            Date dateNow1 = DateUtil.strToDate(DateUtil.getStringDateShort()+" 08:00:00");
            Date dateNow2 = DateUtil.strToDate(DateUtil.getStringDateShort()+" 20:00:00");
            List<String> noWarnDays = new ArrayList<>();
            String dateTmp = "";
            if (dateNow.after(dateNow1)){
                dateTmp = DateUtil.dateToStr(dateNow1,DateUtil.yyyy_MM_dd_HH_mm_ss);
                if (!warnDays.contains(dateTmp)){
                    noWarnDays.add(dateTmp);
                }
            }
            if (dateNow.after(dateNow2)){
                dateTmp = DateUtil.dateToStr(dateNow2,DateUtil.yyyy_MM_dd_HH_mm_ss);
                if (!warnDays.contains(dateTmp)){
                    noWarnDays.add(dateTmp);
                }
            }
            for (;dateNow.after(dateBegin);){
                dateNow = DateUtil.getPreDays(dateNow,-1);
                dateTmp = DateUtil.dateToStrShort(dateNow)+" 08:00:00";
                if (!warnDays.contains(dateTmp)){
                    noWarnDays.add(dateTmp);
                }
                dateTmp = DateUtil.dateToStrShort(dateNow)+" 20:00:00";
                if (!warnDays.contains(dateTmp)){
                    noWarnDays.add(dateTmp);
                }
            }
            Integer count = noWarnDays.size();
            if (count>0) {
                Integer pageCount = 0;
                if (count % pageSize == 0) {
                    pageCount = count / pageSize;
                } else {
                    pageCount = count / pageSize + 1;
                }
                int fromIndex = 0;
                int toIndex = 0;
                if (page <= pageCount) {
                    fromIndex = (page) * pageSize;
                    toIndex = fromIndex + pageSize;
                }
                if(fromIndex>count){
                    fromIndex= count;
                }
                if (toIndex > count) {
                    toIndex = count;
                }
                result.put("dailyDataList", noWarnDays.subList(fromIndex,toIndex));
            }else {
                result.put("dailyDataList", new ArrayList<>());
            }
            result.put("dailyTotal",count);
            result.put("dailyTotal",count);
            result.put("dailyPage",page+1);
            result.put("dailyPage",page+1);
            result.put("dailyPageSize",pageSize);
            result.put("dailyPageSize",pageSize);
            result.put("dailyDataList", list);
        }
        }
        return result;
        return result;

+ 62 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/DoctorServicePermissionsService.java

@ -29,6 +29,68 @@ public class DoctorServicePermissionsService extends BaseJpaService<DoctorServic
    @Autowired
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    /**
     * 判断是否有权限
     * @param doctor
     * @param type
     * @return
     */
    public int isPermission(String doctor,int type){
        DoctorServicePermissionsDO permissionsDO = doctorServicePermissionsDao.findByDoctor(doctor);
        if(permissionsDO==null){
            return 1;
        }
        if(type==1){
            return permissionsDO.getService1();
        }
        if(type==2){
            return permissionsDO.getService2();
        }
        if(type==3){
            return permissionsDO.getService3();
        }
        if(type==4){
            return permissionsDO.getService4();
        }
        if(type==5){
            return permissionsDO.getService5();
        }
        if(type==6){
            return permissionsDO.getService6();
        }
        if(type==7){
            return permissionsDO.getService7();
        }
        if(type==8){
            return permissionsDO.getService8();
        }
        if(type==9){
            return permissionsDO.getService9();
        }
        if(type==10){
            return permissionsDO.getService10();
        }
        if(type==11){
            return permissionsDO.getService11();
        }
        if(type==12){
            return permissionsDO.getService12();
        }
        if(type==13){
            return permissionsDO.getService13();
        }
        if(type==14){
            return permissionsDO.getService14();
        }
        if(type==15){
            return permissionsDO.getService15();
        }
        if(type==16){
            return permissionsDO.getService16();
        }
        return 0;
    }
    /**
    /**
     * 查找服务权限
     * 查找服务权限

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -414,6 +414,10 @@ public class DoctorDoorCoachOrderService {
            adminServiceDynamic.setNumber(doorServiceOrder.getNumber());
            adminServiceDynamic.setNumber(doorServiceOrder.getNumber());
            adminServiceDynamic.setType(1);
            adminServiceDynamic.setType(1);
            adminServiceDynamic.setValue("已接单,工单编号:");
            adminServiceDynamic.setValue("已接单,工单编号:");
            BasePatientDO patientDO = patientInfoService.findById(doorServiceOrder.getPatient());
            if (org.apache.commons.lang3.StringUtils.isNotBlank(patientDO.getPhoto())) {
                adminServiceDynamic.setPhoto(patientDO.getPhoto());
            }
            baseAdminServiceDynamicDao.save(adminServiceDynamic);
            baseAdminServiceDynamicDao.save(adminServiceDynamic);
        }catch (Exception e) {
        }catch (Exception e) {
            logger.info(e.getMessage());
            logger.info(e.getMessage());
@ -519,6 +523,10 @@ public class DoctorDoorCoachOrderService {
            baseAdminServiceDynamic.setNumber(doorServiceOrder.getNumber());
            baseAdminServiceDynamic.setNumber(doorServiceOrder.getNumber());
            baseAdminServiceDynamic.setType(1);
            baseAdminServiceDynamic.setType(1);
            baseAdminServiceDynamic.setValue("已拒单,工单编号:");
            baseAdminServiceDynamic.setValue("已拒单,工单编号:");
            BasePatientDO patientDO = patientInfoService.findById(doorServiceOrder.getPatient());
            if (org.apache.commons.lang3.StringUtils.isNotBlank(patientDO.getPhoto())) {
                baseAdminServiceDynamic.setPhoto(patientDO.getPhoto());
            }
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
        }catch (Exception e) {
        }catch (Exception e) {
            logger.info(e.getMessage());
            logger.info(e.getMessage());
@ -643,6 +651,10 @@ public class DoctorDoorCoachOrderService {
            baseAdminServiceDynamic.setPatient(one.getPatient());
            baseAdminServiceDynamic.setPatient(one.getPatient());
            baseAdminServiceDynamic.setName(one.getPatientName());
            baseAdminServiceDynamic.setName(one.getPatientName());
            baseAdminServiceDynamic.setCreateTime(new Date());
            baseAdminServiceDynamic.setCreateTime(new Date());
            BasePatientDO patientDO = patientInfoService.findById(one.getPatient());
            if (org.apache.commons.lang3.StringUtils.isNotBlank(patientDO.getPhoto())) {
                baseAdminServiceDynamic.setPhoto(patientDO.getPhoto());
            }
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
        }catch (Exception e){
        }catch (Exception e){
            logger.info(e.getMessage());
            logger.info(e.getMessage());

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -205,6 +205,10 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            baseAdminServiceDynamic.setValue("创建了上门辅导申请");
            baseAdminServiceDynamic.setValue("创建了上门辅导申请");
            baseAdminServiceDynamic.setCreateTime(new Date());
            baseAdminServiceDynamic.setCreateTime(new Date());
            baseAdminServiceDynamic.setName(orderDO.getNumber());
            baseAdminServiceDynamic.setName(orderDO.getNumber());
            BasePatientDO patientDO = patientDao.findById(orderDO.getPatient());
            if (StringUtils.isNotBlank(patientDO.getPhoto())) {
                baseAdminServiceDynamic.setPhoto(patientDO.getPhoto());
            }
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
        }catch (Exception e) {
        }catch (Exception e) {
            logger.info(e.getMessage());
            logger.info(e.getMessage());

+ 27 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.lifeCare.*;
import com.yihu.jw.care.dao.lifeCare.*;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
import com.yihu.jw.care.service.common.OrderNoService;
import com.yihu.jw.care.service.common.OrderNoService;
import com.yihu.jw.care.service.doctor.DoctorServicePermissionsService;
import com.yihu.jw.care.service.message.BaseServiceNewsService;
import com.yihu.jw.care.service.message.BaseServiceNewsService;
import com.yihu.jw.care.service.pay.PayService;
import com.yihu.jw.care.service.pay.PayService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.MessageUtil;
@ -22,11 +23,13 @@ import com.yihu.jw.entity.care.lifeCare.LifeCareItemDictDO;
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
import com.yihu.jw.entity.door.BaseAdminServiceDynamic;
import com.yihu.jw.entity.door.BaseAdminServiceDynamic;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.org.dao.BaseOrgDao;
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.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.util.entity.EntityUtils;
@ -91,6 +94,10 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    private BaseTeamMemberDao baseTeamMemberDao;
    private BaseTeamMemberDao baseTeamMemberDao;
    @Autowired
    @Autowired
    private BaseAdminServiceDynamicDao baseAdminServiceDynamicDao;
    private BaseAdminServiceDynamicDao baseAdminServiceDynamicDao;
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    /**
    /**
     * 记录完成情况
     * 记录完成情况
     * @param orderId
     * @param orderId
@ -145,6 +152,10 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
            baseAdminServiceDynamic.setName(lifeCareOrderDO.getPatientName());
            baseAdminServiceDynamic.setName(lifeCareOrderDO.getPatientName());
            baseAdminServiceDynamic.setDoctor(lifeCareOrderDO.getDoctor());
            baseAdminServiceDynamic.setDoctor(lifeCareOrderDO.getDoctor());
            baseAdminServiceDynamic.setDoctorName(lifeCareOrderDO.getDoctorName());
            baseAdminServiceDynamic.setDoctorName(lifeCareOrderDO.getDoctorName());
            BasePatientDO patientDO = patientDao.findById(lifeCareOrderDO.getPatient());
            if (StringUtils.isNotBlank(patientDO.getPhoto())) {
                baseAdminServiceDynamic.setPhoto(patientDO.getPhoto());
            }
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
        }catch (Exception e) {
        }catch (Exception e) {
            logger.info(e.getMessage());
            logger.info(e.getMessage());
@ -231,6 +242,17 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
     */
     */
    public JSONObject queryBriefList(String doctorCode,String name,String phone,Integer status,int page, int size) {
    public JSONObject queryBriefList(String doctorCode,String name,String phone,Integer status,int page, int size) {
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        List<Map<String,Object>> sqlResultlist = new ArrayList<>();
        //服务权限
        if(doctorServicePermissionsService.isPermission(doctorCode,7)==0){
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg, sqlResultlist);
            JSONObject countItem = new JSONObject();
            countItem.put("count", 0);
            result.putAll(countItem);
            return result;
        }
        List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctorCode);
        List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctorCode);
        String hospital = doctorHospitalDOs.get(0).getOrgCode();
        String hospital = doctorHospitalDOs.get(0).getOrgCode();
        name = null == name ? "" : name;
        name = null == name ? "" : name;
@ -291,7 +313,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        String finqlCountSql = countSql.replace("{hospital}", hospital)
        String finqlCountSql = countSql.replace("{hospital}", hospital)
                .replace("{status}", String.valueOf(status));
                .replace("{status}", String.valueOf(status));
        List<Map<String,Object>> sqlResultlist;
        try {
        try {
            sqlResultlist = jdbcTemplate.queryForList(finalSql);
            sqlResultlist = jdbcTemplate.queryForList(finalSql);
            for (Map<String,Object> orderDO:sqlResultlist){
            for (Map<String,Object> orderDO:sqlResultlist){
@ -587,6 +609,10 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
            baseAdminServiceDynamic.setPatient(orderDO.getPatient());
            baseAdminServiceDynamic.setPatient(orderDO.getPatient());
            baseAdminServiceDynamic.setName(orderDO.getPatientName());
            baseAdminServiceDynamic.setName(orderDO.getPatientName());
            baseAdminServiceDynamic.setCreateTime(new Date());
            baseAdminServiceDynamic.setCreateTime(new Date());
            BasePatientDO patientDO = patientDao.findById(orderDO.getPatient());
            if (StringUtils.isNotBlank(patientDO.getPhoto())) {
                baseAdminServiceDynamic.setPhoto(patientDO.getPhoto());
            }
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
            baseAdminServiceDynamicDao.save(baseAdminServiceDynamic);
        } catch (Exception e) {
        } catch (Exception e) {
            logger.info(e.getMessage());
            logger.info(e.getMessage());

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

@ -13,6 +13,8 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.restmodel.ResponseContant;
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;
@ -43,11 +45,13 @@ public class DoctorMessageService {
    private OrgNoticeDao orgNoticeDao;
    private OrgNoticeDao orgNoticeDao;
    @Autowired
    @Autowired
    private UserNoticeDao userNoticeDao;
    private UserNoticeDao userNoticeDao;
    @Autowired
    private SystemMessageDao messageDao;
    /**
    /**
     *
     *
     * @param doctor
     * @param doctor
     * @param type  11床位申请,11安全监护 ,12紧急救助,13体征异常消息
     * @param type  11床位申请,11安全监护 ,12紧急救助,13体征异常消息,14设备离线通知
     * @return
     * @return
     */
     */
    public JSONObject findDoctorAllMessage(String doctor,String type){
    public JSONObject findDoctorAllMessage(String doctor,String type){
@ -57,7 +61,7 @@ public class DoctorMessageService {
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorDO==null){
        if (doctorDO==null){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"患者今年已做过能力评估报告,不可重复操作");
            result.put(ResponseContant.resultMsg,"用户不存在");
        }
        }
        List<BaseDoctorHospitalDO> hospitalDO = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctor);
        List<BaseDoctorHospitalDO> hospitalDO = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctor);
        Integer count;
        Integer count;
@ -142,9 +146,31 @@ public class DoctorMessageService {
            tmpObj = jdbcTemplate.queryForMap(sql);
            tmpObj = jdbcTemplate.queryForMap(sql);
            result.put("errorHealthIndex",tmpObj);
            result.put("errorHealthIndex",tmpObj);
        }
        }
        if (typeNull||type.equals("14")){//设备离线通知
            String sql = " select count(1) as 'all',type,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time from base_system_message " +
                    " where type='43' and del=1 and receiver='"+doctor+"' order by create_time desc ";
            Map<String,Object> tmpObj = new HashMap<>();
            tmpObj = jdbcTemplate.queryForMap(sql);
            result.put("deviceLost",tmpObj);
        }
        return result;
        return result;
    }
    }
    public PageEnvelop getHealthMonitoringListTwo(Integer page, Integer pageSize, String hospital){
        page = page>0?page-1:0;
        String sql = "SELECT pd.id,pd.device_sn deviceSn,pd.`user`,p.`name`,d.contact_status_time contactStatusTime,CASE pd.category_code WHEN '1' THEN '血糖仪离线' WHEN '2' THEN '血压计离线' WHEN '13' THEN '睡眠带离线'\n" +
                "WHEN '17' THEN '随身WiFi离线' WHEN '7' THEN '居家安全报警器离线' WHEN '12' THEN '监控器离线' WHEN '14' THEN '气感报警器离线' WHEN '15' THEN '烟感报警器离线' WHEN '16' THEN '智能拐杖离线' WHEN '4' THEN '智能手表离线'\n" +
                "ELSE '未知' END categoryCode,pd.category_code categoryNum,pd.device_name devName \n" +
                "FROM wlyy_devices d,wlyy_patient_device pd,base_patient p,base_service_package_sign_record spsr,base_service_package_record spr,base_service_package sp\n" +
                "WHERE d.contact_status = 0 AND pd.del = 0 AND pd.device_sn = d.device_code AND pd.`user` = p.id \n" +
                "AND spsr.patient = pd.`user` AND spsr.id = spr.sign_id AND spr.service_package_id = sp.id AND sp.org_code = '"+hospital+"'\n" +
                "GROUP BY pd.device_sn ORDER BY d.contact_status_time DESC";
        String countSql = "select count(id) from ("+sql+")A ";
        long count = jdbcTemplate.queryForObject(countSql,long.class);
        sql +=" limit "+page*pageSize+","+pageSize;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }
    public JSONObject getPreventLost(String doctor,String id,String type){
    public JSONObject getPreventLost(String doctor,String id,String type){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
@ -286,4 +312,9 @@ public class DoctorMessageService {
        return orgNoticeDao.findOne(noticeId);
        return orgNoticeDao.findOne(noticeId);
    }
    }
    public List<SystemMessageDO> getDeviceLostMessageList(String doctor){
        List<SystemMessageDO> systemMessageDOS = messageDao.getByReceiverAndType(doctor,"43");
        return systemMessageDOS;
    }
}
}

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

@ -147,4 +147,12 @@ public class PatientMessageService {
            }
            }
        }
        }
    }
    }
    public void delMessageRead(String msgId){
        SystemMessageDO systemMessageDO = systemMessageDao.findOne(msgId);
        if (systemMessageDO!=null){
            systemMessageDO.setDel("0");
            systemMessageDao.save(systemMessageDO);
        }
    }
}
}

+ 92 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/OnlineContactService.java

@ -1,12 +1,15 @@
package com.yihu.jw.care.service.patient;
package com.yihu.jw.care.service.patient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
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.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
@ -14,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.stream.Collectors;
/***
/***
 * @ClassName: OnlineContactService
 * @ClassName: OnlineContactService
@ -28,6 +32,10 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    @Autowired
    private ImUtil imUtil;
    private ImUtil imUtil;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private ServicePackageService servicePackageService;
    public JSONObject getOnLineObj(String patient){
    public JSONObject getOnLineObj(String patient){
        JSONObject obj = new JSONObject();
        JSONObject obj = new JSONObject();
@ -121,4 +129,87 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
        return obj;
        return obj;
    }
    }
    public JSONObject getContactFirst(String patient){
        JSONObject result = new JSONObject();
        JSONArray doctorResult = new JSONArray();
        JSONArray patientResult = new JSONArray();
        String doctors = imUtil.getSessionListByType(patient,"0","1","2",null,null,"1");
        String patients = imUtil.getSessionListByType(patient,"0","100","2",null,null,"2");
        JSONArray doctorArr = JSON.parseArray(doctors);
        JSONArray patientArr = JSON.parseArray(patients);
        if (doctorArr.size()==0){//取签约医生其中一个
          List<Map<String,Object>> signDoctors =  servicePackageService.getServerDoctorAll(patient,null);
          if (signDoctors.size()>0){
              Map<String,Object> tmp = signDoctors.get(0);
              JSONObject tmpObj = new JSONObject();
              tmpObj.put("name",tmp.get("doctorName"));
              tmpObj.put("unread_count","0");
              tmpObj.put("avatar",tmp.get("photo"));
              tmpObj.put("userType","1");
              tmpObj.put("doctorId",tmp.get("doctor"));
              tmpObj.put("relationName","助老员");
              doctorResult.add(tmpObj);
          }
        }else {
            JSONObject tmp = doctorArr.getJSONObject(0);
            JSONArray participantsTimeArray = tmp.getJSONArray("participantsTimeArray");
            for (int i=0;i<participantsTimeArray.size();i++){
                JSONObject tmpObj = participantsTimeArray.getJSONObject(i);
                String id =  tmpObj.getString("id");
                if (!id.equals(patient)){
                    tmp.put("avatar",tmp.getString("photo"));
                    tmp.put("doctorId",id);
                    tmp.put("relationName","助老员");
                    break;
                }
            }
            doctorResult.add(tmp);
        }
        JSONArray families = familyMemberService.membersWithOnLineFlag(patient);
        if (families.size()>0){
            List<String> familyIds = families.stream().map(item->((JSONObject)item).getString("id")).collect(Collectors.toList());
            if(patientArr.size()>0){
                JSONObject tmp = patientArr.getJSONObject(0);
                JSONArray participantsTimeArray = tmp.getJSONArray("participantsTimeArray");
                for (int i=0;i<participantsTimeArray.size();i++){
                    JSONObject tmpObj = participantsTimeArray.getJSONObject(i);
                    String id =  tmpObj.getString("id");
                    if (!id.equals(patient)&&familyIds.contains(id)){
                        tmp.put("avatar",tmp.getString("photo"));
                        tmp.put("patientId",id);
                        String sql = " select family_relation from base_patient_family_member where " +
                                " patient = '"+patient+"' and family_member='"+id+"' " +
                                " and (del=1 or del is null) ";
                        List<Integer> relations = jdbcTemplate.queryForList(sql,Integer.class);
                        if(relations.size()>0){
                            tmp.put("relationName",familyMemberService.relations.get(relations.get(0)));
                        }else {
                            tmp.put("relationName","其他");
                        }
                        patientResult.add(tmp);
                        break;
                    }
                }
            }
            if (patientResult.size()==0){
                if (families.size()>0){
                    JSONObject tmp = families.getJSONObject(0);
                    JSONObject tmpObj = new JSONObject();
                    tmpObj.put("name",tmp.getString("name"));
                    tmpObj.put("unread_count","0");
                    tmpObj.put("avatar",tmp.getString("photo"));
                    tmpObj.put("userType","2");
                    tmpObj.put("patientId",tmp.get("id"));
                    tmpObj.put("relationName",tmp.get("familyRelationName"));
                    patientResult.add(tmpObj);
                }
            }
        }
        result.put("doctors",doctorResult);
        result.put("patients",patientResult);
        return result;
    }
}
}

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

@ -13,6 +13,7 @@ import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.YsDeviceService;
import com.yihu.jw.care.service.device.YsDeviceService;
import com.yihu.jw.care.service.doctor.DoctorServicePermissionsService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.ConstantUtil;
@ -21,8 +22,10 @@ import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.contacts.PatientSosContactsDO;
import com.yihu.jw.entity.care.contacts.PatientSosContactsDO;
import com.yihu.jw.entity.care.device.*;
import com.yihu.jw.entity.care.device.*;
@ -32,10 +35,12 @@ import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
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.org.dao.BaseOrgDao;
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.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;
@ -126,6 +131,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    private BaseSleepNightRecordDao nightRecordDao;
    private BaseSleepNightRecordDao nightRecordDao;
    @Autowired
    @Autowired
    private PatientSafeAreaDao safeAreaDao;
    private PatientSafeAreaDao safeAreaDao;
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    @Autowired
    private BaseOrgDao orgDao;
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
@ -485,7 +494,16 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                noticePersons.add(noticeObj);
                noticePersons.add(noticeObj);
                if (StringUtils.isBlank(doc.getDoctorLat()) || StringUtils.isBlank(doc.getDoctorLon())) {
                if (StringUtils.isBlank(doc.getDoctorLat()) || StringUtils.isBlank(doc.getDoctorLon())) {
                    continue;
                    List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(doc.getId());
                    if (doctorHospitalDOS.size()>0){
                        BaseDoctorHospitalDO hospitalDO = doctorHospitalDOS.get(0);
                        BaseOrgDO orgDO = orgDao.findByCode(hospitalDO.getOrgCode());
                        doc.setDoctorLocateAddress(orgDO.getAddress());
                        doc.setDoctorLat(orgDO.getLatitude());
                        doc.setDoctorLon(orgDO.getLongitude());
                    }else {
                        continue;
                    }
                }
                }
                //double distanceTmp = countDistance.getDistance(Double.parseDouble(orderDO.getServeLat()),Double.parseDouble(orderDO.getServeLon()),Double.parseDouble(doc.getDoctorLat()),Double.parseDouble(doc.getDoctorLon()));
                //double distanceTmp = countDistance.getDistance(Double.parseDouble(orderDO.getServeLat()),Double.parseDouble(orderDO.getServeLon()),Double.parseDouble(doc.getDoctorLat()),Double.parseDouble(doc.getDoctorLon()));
                otherDoctorDistanceObj = new JSONObject();
                otherDoctorDistanceObj = new JSONObject();
@ -572,6 +590,12 @@ 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){
        JSONArray result = new JSONArray();
        //服务权限
        if(doctorServicePermissionsService.isPermission(doctor,10)==0){
            return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,0L);
        }
        String sqlCount = "select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
        String sqlCount = "select count(ord.id) 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 = "  ";
@ -606,7 +630,6 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        fliter+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
        fliter+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
        JSONArray result = new JSONArray();
        for (Map<String,Object>one:sqlResult){
        for (Map<String,Object>one:sqlResult){
            JSONObject tmp = new JSONObject();
            JSONObject tmp = new JSONObject();
            tmp.put("patientCode",one.get("patientCode"));
            tmp.put("patientCode",one.get("patientCode"));
@ -1663,8 +1686,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            result.put(ResponseContant.resultMsg,failMsg);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
            return result;
        }
        }
        patientDO.setLatLon(patientLat+","+patientLon);
        basePatientDao.save(patientDO);
        List<SecurityMonitoringOrderDO> monitoringOrderDO = securityMonitoringOrderDao.findByPatientAndStatus(patient,1);
        List<SecurityMonitoringOrderDO> monitoringOrderDO = securityMonitoringOrderDao.findByPatientAndStatus(patient,1);
        if (monitoringOrderDO.size()>0){
        if (monitoringOrderDO.size()>0){
            for (SecurityMonitoringOrderDO tmp:monitoringOrderDO){
            for (SecurityMonitoringOrderDO tmp:monitoringOrderDO){
                tmp.setServeAddress(patientAddress);
                tmp.setServeAddress(patientAddress);

+ 31 - 13
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/DetectionPlatformService.java

@ -7,9 +7,12 @@ import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
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.es.util.ElasticsearchUtil;
import com.yihu.jw.es.util.SaveModel;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
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.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.StringUtil;
import io.swagger.models.auth.In;
import io.swagger.models.auth.In;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.StringUtils;
@ -44,6 +47,9 @@ public class DetectionPlatformService  {
    private PatientDeviceDao patientDeviceDao;
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    @Autowired
    private BasePatientDao patientDao;
    private BasePatientDao patientDao;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    private static final String defalutArea = "330100";
    /**
    /**
     * 体征监测 安防监护
     * 体征监测 安防监护
@ -73,7 +79,7 @@ public class DetectionPlatformService  {
        } else {
        } else {
            String sql = " SELECT pd.id,pd.device_sn deviceSn,pd.`user`,p.`name`,d.contact_status_time contactStatusTime,CASE pd.category_code WHEN '1' THEN '血糖仪离线' WHEN '2' THEN '血压计离线' WHEN '13' THEN '睡眠带离线'\n" +
            String sql = " SELECT pd.id,pd.device_sn deviceSn,pd.`user`,p.`name`,d.contact_status_time contactStatusTime,CASE pd.category_code WHEN '1' THEN '血糖仪离线' WHEN '2' THEN '血压计离线' WHEN '13' THEN '睡眠带离线'\n" +
                    "WHEN '17' THEN '随身WiFi离线' WHEN '7' THEN '居家安全报警器离线' WHEN '12' THEN '监控器离线' WHEN '14' THEN '气感报警器离线' WHEN '15' THEN '烟感报警器离线' WHEN '16' THEN '智能拐杖离线' WHEN '4' THEN '智能手表离线' \n" +
                    "WHEN '17' THEN '随身WiFi离线' WHEN '7' THEN '居家安全报警器离线' WHEN '12' THEN '监控器离线' WHEN '14' THEN '气感报警器离线' WHEN '15' THEN '烟感报警器离线' WHEN '16' THEN '智能拐杖离线' WHEN '4' THEN '智能手表离线' \n" +
                    "ELSE '未知' END categoryCode FROM wlyy_devices d,wlyy_patient_device pd,base_patient p\n" +
                    "ELSE '未知' END categoryCode,pd.category_code categoryNum,pd.device_name devName FROM wlyy_devices d,wlyy_patient_device pd,base_patient p\n" +
                    "WHERE d.contact_status = 0 AND pd.del = 0 AND pd.device_sn = d.device_code AND pd.`user` = p.id ORDER BY d.contact_status_time DESC ";
                    "WHERE d.contact_status = 0 AND pd.del = 0 AND pd.device_sn = d.device_code AND pd.`user` = p.id ORDER BY d.contact_status_time DESC ";
            String countSql = "select count(id) from ("+sql+")A ";
            String countSql = "select count(id) from ("+sql+")A ";
            long count = jdbcTemplate.queryForObject(countSql,long.class);
            long count = jdbcTemplate.queryForObject(countSql,long.class);
@ -335,35 +341,47 @@ public class DetectionPlatformService  {
        return nightRecordList;  //起夜记录
        return nightRecordList;  //起夜记录
    }
    }
    public JSONObject getDistributionOfWarningTypes(){
    public JSONObject getDistributionOfWarningTypes() throws Exception {
        JSONObject object = new JSONObject();
        JSONObject object = new JSONObject();
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
        String filter="";
        if(listtmp.size()>0){
            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",","','");
            filter = " and hospital not in ('"+orgCodes+"') ";
        }
        /****预警类型分布****/
        /****预警类型分布****/
        String sql = "SELECT hsd.`value`,aa.count FROM base_system_dict_entry hsd LEFT JOIN \n" +
        String sql = "SELECT hsd.`value`,aa.count FROM base_system_dict_entry hsd LEFT JOIN \n" +
                "(SELECT topic_item,COUNT(1) count FROM base_security_monitoring_order GROUP BY topic_item)aa \n" +
                "(SELECT topic_item,COUNT(1) count FROM base_security_monitoring_order where 1=1 "+filter+" GROUP BY topic_item)aa \n" +
                "ON CONVERT(hsd.`code` USING utf8) COLLATE utf8_unicode_ci = aa.topic_item  WHERE hsd.remark = 'security'";
                "ON CONVERT(hsd.`code` USING utf8) COLLATE utf8_unicode_ci = aa.topic_item  WHERE hsd.remark = 'security'";
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        /****工单总量****/
        /****工单总量****/
        String sqlAll = "SELECT COUNT(1) count FROM base_security_monitoring_order";
        Integer countAll = jdbcTemplate.queryForObject(sqlAll,Integer.class);
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(DateUtil.getStringDateShort(),DateUtil.getStringDateShort(),defalutArea,2,"46","2","4");
        long countAll = saveModel.getResult2().longValue();
        /****误报警数量****/
        /****误报警数量****/
        String sql1 = "SELECT COUNT(1) count FROM base_security_monitoring_order WHERE emergency_cancel IS NOT NULL OR emergency_cancel != ''";
        Integer falseAlarmCount = jdbcTemplate.queryForObject(sql1,Integer.class);
        //安防误报警
        saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(DateUtil.getStringDateShort(),defalutArea,2,"46","2","-2","4");
        long falseAlarmCount = saveModel.getResult2().longValue();
        /****响应数量****/
        String responseCountSql = "SELECT COUNT(1) count FROM base_security_monitoring_order WHERE (emergency_cancel IS NOT NULL OR emergency_cancel != '') OR `status` = 0 GROUP BY id";
        List<Map<String,Object>> responseList = jdbcTemplate.queryForList(responseCountSql);
        Integer responseCount = responseList.size();
        /****响应数量**误报警+完成**/
        saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(DateUtil.getStringDateShort(),defalutArea,2,"46","2","-2","4");
        long responseCount = saveModel.getResult2().longValue();
        saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(DateUtil.getStringDateShort(),defalutArea,2,"46","2","0","4");
        responseCount += saveModel.getResult2().longValue();
        object.put("distributionOfWarning",list);
        object.put("distributionOfWarning",list);
        object.put("countAll",countAll);
        object.put("countAll",countAll);
        object.put("falseAlarmCount",falseAlarmCount);
        object.put("falseAlarmCount",falseAlarmCount);
        object.put("responseCount",responseCount);
        object.put("responseCount",responseCount);
        /****误报警率****/
        /****误报警率****/
        object.put("falseAlarmLaw",getRange(falseAlarmCount,countAll));
        object.put("falseAlarmLaw",getRange(Integer.parseInt(falseAlarmCount+""),Integer.parseInt(countAll+"")));
        /****响应率****/
        /****响应率****/
        object.put("responseLaw",getRange(responseCount,countAll));
        object.put("responseLaw",getRange(Integer.parseInt(responseCount+"") ,Integer.parseInt(countAll+"")));
        return object;
        return object;
    }
    }

+ 51 - 19
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -81,12 +81,22 @@ public class StatisticsService {
            res.put("index_"+ind,saveModel.getResult2().longValue());
            res.put("index_"+ind,saveModel.getResult2().longValue());
        }
        }
        //41紧急预警43安防要与实时一样,查sql
        //41紧急预警43安防要与实时一样,查sql
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0";
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
        String filter="";
        String filter2="";
        if(listtmp.size()>0){
            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",","','");
            filter = " and hospital not in ('"+orgCodes+"') ";
            filter2 = " and org_code not in ('"+orgCodes+"') ";
        }
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 "+filter2;
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order";
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter;
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
        res.put("index_"+41,emergencyCallNum+securityMonitoringNum);
        res.put("index_"+41,emergencyCallNum);
        res.put("index_"+43,securityMonitoringNum);
        res.put("index_"+43,securityMonitoringNum);
        //评估类型
        //评估类型
@ -177,13 +187,25 @@ public class StatisticsService {
                childTotal = num;
                childTotal = num;
            }
            }
        }
        }
        String healthEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND (category_code = 1 OR category_code = 2)";
        String healthEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND (category_code = 1 OR category_code = 2)";
        Integer healthEquipmentNum = jdbcTemplate.queryForObject(healthEquipmentSql,Integer.class);
        Integer healthEquipmentNum = jdbcTemplate.queryForObject(healthEquipmentSql,Integer.class);
        String securityEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND category_code > 2";
        String securityEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND category_code > 2";
        Integer securityEquipmentNum = jdbcTemplate.queryForObject(securityEquipmentSql,Integer.class);
        Integer securityEquipmentNum = jdbcTemplate.queryForObject(securityEquipmentSql,Integer.class);
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0";
        sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        listtmp =  jdbcTemplate.queryForList(sqltmp);
        filter="";
        String filter2="";
        if(listtmp.size()>0){
            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",","','");
            filter = " and hospital not in ('"+orgCodes+"') ";
            filter2 = " and org_code not in ('"+orgCodes+"') ";
        }
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0"+filter2;
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order";
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter;
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
        res.put("olderTotal",olderTotal);   //老人注册人数
        res.put("olderTotal",olderTotal);   //老人注册人数
        res.put("childTotal",childTotal);   //儿童注册人数
        res.put("childTotal",childTotal);   //儿童注册人数
@ -408,7 +430,7 @@ public class StatisticsService {
        }
        }
        String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type,IFNULL(on_line,0) online from base_patient WHERE archive_type is  not null" +
        String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type,IFNULL(on_line,0) online from base_patient WHERE archive_type is  not null" +
                " and del='1' "+pateintFilter+" GROUP BY archive_type";
                " and del='1' "+pateintFilter+" GROUP BY archive_type,on_line";
        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
        for(Map<String,Object> map:list1){
        for(Map<String,Object> map:list1){
            String archive_type = map.get("archive_type").toString();
            String archive_type = map.get("archive_type").toString();
@ -416,17 +438,17 @@ public class StatisticsService {
            Integer online = Integer.valueOf(map.get("online").toString());
            Integer online = Integer.valueOf(map.get("online").toString());
            if("1".equals(archive_type)){
            if("1".equals(archive_type)){
                if(online == 1){
                if(online == 1){
                    olderOn = num;
                    olderOn += num;
                }else{
                }else{
                    olderOff = num;
                    olderOff += num;
                }
                }
                continue;
                continue;
            }
            }
            if("2".equals(archive_type)){
            if("2".equals(archive_type)){
                if(online == 1){
                if(online == 1){
                    childOn = num;
                    childOn += num;
                }else{
                }else{
                    childOff = num;
                    childOff += num;
                }
                }
            }
            }
        }
        }
@ -437,7 +459,7 @@ public class StatisticsService {
        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
                "and a.doctor_level is not null and h.org_code not in ( " +
                "and a.doctor_level is not null and h.org_code not in ( " +
                "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
                "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
                ") GROUP BY a.doctor_level";
                ") GROUP BY a.doctor_level,on_line";
        List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2);
        List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2);
        for(Map<String,Object> map:list2){
        for(Map<String,Object> map:list2){
            String archive_type = map.get("doctor_level").toString();
            String archive_type = map.get("doctor_level").toString();
@ -445,17 +467,17 @@ public class StatisticsService {
            Integer online = Integer.valueOf(map.get("online").toString());
            Integer online = Integer.valueOf(map.get("online").toString());
            if("2".equals(archive_type)){
            if("2".equals(archive_type)){
                if(online == 1){
                if(online == 1){
                    helperOn = num;
                    helperOn += num;
                }else{
                }else{
                    helperOff = num;
                    helperOff += num;
                }
                }
                continue;
                continue;
            }
            }
            if("3".equals(archive_type)){
            if("3".equals(archive_type)){
                if(online == 1){
                if(online == 1){
                    teacherOn = num;
                    teacherOn += num;
                }else{
                }else{
                    teacherOff = num;
                    teacherOff += num;
                }
                }
            }
            }
        }
        }
@ -478,6 +500,7 @@ public class StatisticsService {
        result.put("childOn",childOn);
        result.put("childOn",childOn);
        result.put("olderWxOn",olderWxOn);
        result.put("olderWxOn",olderWxOn);
        result.put("olderPadOn",olderPadOn);
        result.put("olderPadOn",olderPadOn);
        result.put("olderOn",olderOn);
        result.put("childOff",childOff);
        result.put("childOff",childOff);
        result.put("helperOff",helperOff);
        result.put("helperOff",helperOff);
@ -661,10 +684,13 @@ public class StatisticsService {
            //年龄分布 50
            //年龄分布 50
//            ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL,null,null,"2");
//            ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL,null,null,"2");
            List<SaveModel>  ageList = statisticsUtilService.findDateAllQuotaLevel1Sort2(endDate,endDate,area,level,"50",SaveModel.timeLevel_DDL,null,null,"2");
            List<SaveModel>  ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,"50",SaveModel.timeLevel_DDL,null,null,"2");
            JSONArray ageArray = new JSONArray();
            JSONArray ageArray = new JSONArray();
            for(int i=0;i<ageList.size();i++){
            for(int i=0;i<ageList.size();i++){
                SaveModel saveModel = ageList.get(i);
                SaveModel saveModel = ageList.get(i);
                if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人
                    continue;
                }
                JSONObject json = new JSONObject();
                JSONObject json = new JSONObject();
                json.put("num",saveModel.getResult2().longValue());
                json.put("num",saveModel.getResult2().longValue());
                json.put("code",saveModel.getSlaveKey1());
                json.put("code",saveModel.getSlaveKey1());
@ -868,9 +894,12 @@ public class StatisticsService {
            //安防总数
            //安防总数
            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate,defalutArea,2,"46","2","4");
            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate,defalutArea,2,"46","2","4");
            res.put("index_"+46+"_total",saveModel.getResult2().longValue());
            res.put("index_"+46+"_total",saveModel.getResult2().longValue());
            //安防完成
            //安防响应 误报警+完成
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","-2","4");
            long finish = saveModel.getResult2().longValue();
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","0","4");
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","0","4");
            res.put("index_"+46+"_finish",saveModel.getResult2().longValue());
            finish += saveModel.getResult2().longValue();
            res.put("index_"+46+"_finish",finish);
            //安防误报警
            //安防误报警
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","-2","4");
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","-2","4");
            res.put("index_"+46+"_error",saveModel.getResult2().longValue());
            res.put("index_"+46+"_error",saveModel.getResult2().longValue());
@ -899,13 +928,16 @@ public class StatisticsService {
            JSONArray jsonArray = new JSONArray();
            JSONArray jsonArray = new JSONArray();
            long total = 0l;
            long total = 0l;
            //总量
            //总量
            List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort2(endDate,endDate,defalutArea,level,ind,SaveModel.timeLevel_DDL,null,null,areaLevel);
            List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,defalutArea,level,ind,SaveModel.timeLevel_DDL,null,null,areaLevel);
            for(int i=0;i<list.size();i++){
            for(int i=0;i<list.size();i++){
                SaveModel saveModel = list.get(i);
                SaveModel saveModel = list.get(i);
                JSONObject json = new JSONObject();
                JSONObject json = new JSONObject();
                if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){
                if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){
                    continue;
                    continue;
                }
                }
                if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人
                    continue;
                }
                json.put("num",saveModel.getResult2().longValue());
                json.put("num",saveModel.getResult2().longValue());
                json.put("code",saveModel.getSlaveKey1());
                json.put("code",saveModel.getSlaveKey1());
                json.put("name",saveModel.getSlaveKey1Name());
                json.put("name",saveModel.getSlaveKey1Name());

+ 3 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/yunxin/YunxinService.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.service.yunxin;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.util.common.StringUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.GenerateUserSig;
import com.yihu.jw.utils.GenerateUserSig;
@ -21,7 +22,6 @@ import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import static com.yihu.jw.util.common.StringUtil.randomInt;
/**
/**
 * Created with IntelliJ IDEA.
 * Created with IntelliJ IDEA.
@ -55,7 +55,7 @@ public class YunxinService {
        }
        }
        String appKey = sysDictDO.getDictValue();
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce = randomInt(10);
        String nonce = StringUtil.randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/create.action";
        String url = "https://api.netease.im/nimserver/user/create.action";
@ -109,7 +109,7 @@ public class YunxinService {
        }
        }
        String appKey = sysDictDO.getDictValue();
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String nonce =  StringUtil.randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/refreshToken.action";
        String url = "https://api.netease.im/nimserver/user/refreshToken.action";

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

@ -171,6 +171,7 @@ public class MessageUtil {
        }
        }
    }
    }
    @Async
    public String sendTXYSJson(String templateCode,String mobile,String ...params){
    public String sendTXYSJson(String templateCode,String mobile,String ...params){
        JSONObject sendObj = new JSONObject();
        JSONObject sendObj = new JSONObject();
        sendObj.put("templateCode",templateCode);
        sendObj.put("templateCode",templateCode);

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

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.dao.device.*;
import com.yihu.jw.care.dao.device.*;
import com.yihu.jw.care.util.DeviceLostMessageUtil;
import com.yihu.jw.care.util.SecurityOrderUtil;
import com.yihu.jw.care.util.SecurityOrderUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.*;
import com.yihu.jw.entity.care.device.*;
@ -87,6 +88,10 @@ public class DeviceService {
    private BaseSleepPlanDao sleepPlanDao;
    private BaseSleepPlanDao sleepPlanDao;
    @Autowired
    @Autowired
    private SecurityOrderUtil orderUtil;
    private SecurityOrderUtil orderUtil;
    @Autowired
    private DeviceLostMessageUtil deviceLostMessageUtil;
    @Autowired
    private DeviceDetailDao deviceDetailDao;
    /**
    /**
     * 获取爱牵挂管理员cookie
     * 获取爱牵挂管理员cookie
@ -844,6 +849,7 @@ public class DeviceService {
                    report.setPatient(patient);
                    report.setPatient(patient);
                    Date date = DateUtil.strToDate(dateStr,DateUtil.YYYYMMDD);
                    Date date = DateUtil.strToDate(dateStr,DateUtil.YYYYMMDD);
                    report.setCreateTime(date);
                    report.setCreateTime(date);
                    report.setDeviceSn(device);
                    report.setFallaSleep(fallasleep);
                    report.setFallaSleep(fallasleep);
                    report.setSleepTime(sleepTime);
                    report.setSleepTime(sleepTime);
                    report.setRestTime(restTime);
                    report.setRestTime(restTime);
@ -879,6 +885,16 @@ public class DeviceService {
                    patientDeviceDao.save(tmp);
                    patientDeviceDao.save(tmp);
                }
                }
            }
            }
            DeviceDetail deviceDetail = deviceDetailDao.findBySn(device);
            if(deviceDetail!=null){
                deviceDetail.setContactStatus(Integer.parseInt(onlinestatu));
                if ("0".equals(onlinestatu)){
                    List<String> sns = new ArrayList<>();
                    sns.add(device);
                    deviceLostMessageUtil.deviceLostMessage(sns);
                }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();

+ 11 - 13
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -93,7 +93,6 @@ public class DeviceUploadService {
            String userType = map.get("button").toString();//按键号 即 userType
            String userType = map.get("button").toString();//按键号 即 userType
            String measurementType=null==map.get("measurementType")?"":map.get("measurementType").toString(); //单个设备的测量类型,deviceType=4智能手表:1心率,2血压
            String measurementType=null==map.get("measurementType")?"":map.get("measurementType").toString(); //单个设备的测量类型,deviceType=4智能手表:1心率,2血压
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            dataPushLogUtil.savePushLog(deviceSn,paraString,"体征数据接收");
            JSONObject json = new JSONObject();
            JSONObject json = new JSONObject();
            json.put("deviceSn", deviceSn);
            json.put("deviceSn", deviceSn);
@ -136,6 +135,7 @@ public class DeviceUploadService {
                logger.info("This device is not relate patient!:====="+dataJson);
                logger.info("This device is not relate patient!:====="+dataJson);
                throw new Exception("This device is not relate patient!");
                throw new Exception("This device is not relate patient!");
            }
            }
            dataPushLogUtil.savePushLog(deviceSn,paraString,"体征数据接收");
            //保存消息
            //保存消息
            BasePatientDO patientDO = patientDao.findById(result.getUser());
            BasePatientDO patientDO = patientDao.findById(result.getUser());
            if (null != patientDO){
            if (null != patientDO){
@ -243,7 +243,13 @@ public class DeviceUploadService {
                    }
                    }
                }
                }
            }else {
            }else {
                device = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn, type, userType);
//                device = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn, type, userType);
                List<DevicePatientDevice> devices = patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
                if (devices.size()>0){
                    device = devices.get(0);
                }else {
                    device=null;
                }
            }
            }
        }
        }
        if (device != null) {
        if (device != null) {
@ -478,7 +484,6 @@ public class DeviceUploadService {
                        if("A".equals(tmp1[4])){
                        if("A".equals(tmp1[4])){
                            lat = tmp1[5];
                            lat = tmp1[5];
                            lon = tmp1[7];
                            lon = tmp1[7];
                            //判断是否超出围栏,
                        }else{
                        }else{
                            lat = tmp1[4];
                            lat = tmp1[4];
                            lon = tmp1[6];
                            lon = tmp1[6];
@ -493,14 +498,8 @@ public class DeviceUploadService {
                            DevicePatientDevice patientDevice = null;
                            DevicePatientDevice patientDevice = null;
                            if (patientDeviceList.size()>0){
                            if (patientDeviceList.size()>0){
                                patientDevice = patientDeviceList.get(0);
                                patientDevice = patientDeviceList.get(0);
//                                for (DevicePatientDevice pd2:patientDeviceList){
//                                    if (StringUtils.isNotBlank(pd2.getSafeAreaGz())){
//                                        patientDevice = pd2;
//                                        break;
//                                    }
//                                }
                            }
                            }
                            if (null!=patientDevice){//存在围栏地址
                            if (null!=patientDevice){//存在围栏地址 判断是否超出围栏,
                                List<PatientSafeAreaDO> safeAreaDOS = safeAreaDao.findByPatient(patientDevice.getUser());
                                List<PatientSafeAreaDO> safeAreaDOS = safeAreaDao.findByPatient(patientDevice.getUser());
                                String safeArea=null;
                                String safeArea=null;
                                if (safeAreaDOS.size()>0){
                                if (safeAreaDOS.size()>0){
@ -537,12 +536,11 @@ public class DeviceUploadService {
                        yxDeviceIndexDao.save(deviceIndex);
                        yxDeviceIndexDao.save(deviceIndex);
                        hvDeviceService.updContactStatus(sn,1);
                        hvDeviceService.updContactStatus(sn,1);
                    }
                    }
                    if ("AL".equals(tmp1[0])){//触发报警
                    if ("AL".equals(tmp1[0])){//触发报警 SOS
                        String lat,lon;
                        String lat,lon;
                        if("A".equals(tmp1[4])){
                        if("A".equals(tmp1[4])){
                            lat = tmp1[5];
                            lat = tmp1[5];
                            lon = tmp1[7];
                            lon = tmp1[7];
                            //判断是否超出围栏,
                        }else{
                        }else{
                            lat = tmp1[4];
                            lat = tmp1[4];
                            lon = tmp1[6];
                            lon = tmp1[6];
@ -577,7 +575,7 @@ public class DeviceUploadService {
                                            dulat = Double.parseDouble(pointss[0]);
                                            dulat = Double.parseDouble(pointss[0]);
                                        }
                                        }
                                        if (StringUtils.isNotBlank(pointss[1])){
                                        if (StringUtils.isNotBlank(pointss[1])){
                                            dulat = Double.parseDouble(pointss[1]);
                                            dulon = Double.parseDouble(pointss[1]);
                                        }
                                        }
                                    }
                                    }
                                }else {
                                }else {

+ 13 - 5
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/HvDeviceService.java

@ -10,6 +10,7 @@ import com.yihu.jw.care.dao.device.HvDeviceRecordDao;
import com.yihu.jw.care.dao.device.HvDeviceSosLogDao;
import com.yihu.jw.care.dao.device.HvDeviceSosLogDao;
import com.yihu.jw.care.util.ArtemisPostTest;
import com.yihu.jw.care.util.ArtemisPostTest;
import com.yihu.jw.care.util.DeviceDataPushLogUtil;
import com.yihu.jw.care.util.DeviceDataPushLogUtil;
import com.yihu.jw.care.util.DeviceLostMessageUtil;
import com.yihu.jw.care.util.SecurityOrderUtil;
import com.yihu.jw.care.util.SecurityOrderUtil;
import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.entity.care.device.DeviceHealthIndex;
import com.yihu.jw.entity.care.device.DeviceHealthIndex;
@ -49,6 +50,8 @@ public class HvDeviceService {
    private DeviceDetailDao deviceDetailDao;
    private DeviceDetailDao deviceDetailDao;
    @Autowired
    @Autowired
    private DeviceDataPushLogUtil dataPushLogUtil;
    private DeviceDataPushLogUtil dataPushLogUtil;
    @Autowired
    private DeviceLostMessageUtil deviceLostMessageUtil;
    /**
    /**
     * 消息通知接收
     * 消息通知接收
@ -115,7 +118,7 @@ public class HvDeviceService {
                JSONObject tmp = new JSONObject();
                JSONObject tmp = new JSONObject();
                tmp.put("gas",monitorValue);
                tmp.put("gas",monitorValue);
                orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(SerializerFeature.WriteMapNullValue),"可燃气体探测器报警信息接收");
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器报警信息接收");
            }
            }
            if("600002".equals(deviceType)){
            if("600002".equals(deviceType)){
@ -123,7 +126,7 @@ public class HvDeviceService {
                JSONObject tmp = new JSONObject();
                JSONObject tmp = new JSONObject();
                tmp.put("smoke",monitorValue);
                tmp.put("smoke",monitorValue);
                orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(SerializerFeature.WriteMapNullValue),"烟感探测器报警信息接收");
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"烟感探测器报警信息接收");
            }
            }
        }
        }
        if(list.size()>0){
        if(list.size()>0){
@ -154,14 +157,14 @@ public class HvDeviceService {
                //独立式可燃气体探测器(NB)
                //独立式可燃气体探测器(NB)
                index.setDeviceType("1");
                index.setDeviceType("1");
                list.add(index);
                list.add(index);
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
            }
            }
            if("600002".equals(resourceType)&&"400013".equals(monitorType)){
            if("600002".equals(resourceType)&&"400013".equals(monitorType)){
                //独立式光电感烟探测器(NB)
                //独立式光电感烟探测器(NB)
                index.setDeviceType("2");
                index.setDeviceType("2");
                list.add(index);
                list.add(index);
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(SerializerFeature.WriteMapNullValue),"烟探测器监测信息接收");
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"烟探测器监测信息接收");
            }
            }
            updContactStatus(resourceSerial,1);
            updContactStatus(resourceSerial,1);
        }
        }
@ -180,7 +183,7 @@ public class HvDeviceService {
            String deviceID = jsonObject.getString("deviceID");
            String deviceID = jsonObject.getString("deviceID");
            String deviceStatus = jsonObject.getString("deviceStatus");
            String deviceStatus = jsonObject.getString("deviceStatus");
            List<HvDeviceRecord> list = hvdeviceRecordDao.findByDeviceId(deviceID);
            List<HvDeviceRecord> list = hvdeviceRecordDao.findByDeviceId(deviceID);
            dataPushLogUtil.savePushLog(deviceID,jsonObject.toJSONString(SerializerFeature.WriteMapNullValue),"气感烟感探测器监测信息接收");
            dataPushLogUtil.savePushLog(deviceID,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"气感烟感探测器监测信息接收");
            if(list.size()>0){
            if(list.size()>0){
                updContactStatus(list.get(0).getDeviceSn(),Integer.valueOf(deviceStatus));
                updContactStatus(list.get(0).getDeviceSn(),Integer.valueOf(deviceStatus));
            }
            }
@ -196,6 +199,11 @@ public class HvDeviceService {
        DeviceDetail deviceDetail = deviceDetailDao.findBySn(sn);
        DeviceDetail deviceDetail = deviceDetailDao.findBySn(sn);
        if(deviceDetail!=null){
        if(deviceDetail!=null){
            deviceDetail.setContactStatus(status);
            deviceDetail.setContactStatus(status);
            if(0==status){
               List<String> sns =  new ArrayList<String>();
               sns.add(sn);
               deviceLostMessageUtil.deviceLostMessage(sns);
            }
            deviceDetail.setContactStatusTime(new Date());
            deviceDetail.setContactStatusTime(new Date());
            deviceDetailDao.save(deviceDetail);
            deviceDetailDao.save(deviceDetail);
        }
        }

+ 1 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java

@ -209,7 +209,7 @@ public class YsDeviceService {
                                if ("tumble_detection".equals(alarmType)){//tumble_detection跌倒类型    //有人出现SmartHumanDet
                                if ("tumble_detection".equals(alarmType)){//tumble_detection跌倒类型    //有人出现SmartHumanDet
                                    fallFlag = true;
                                    fallFlag = true;
                                    deviceSN = bodyJsonObj2.getString("devSerial");//设备SN
                                    deviceSN = bodyJsonObj2.getString("devSerial");//设备SN
                                    dataPushLogUtil.savePushLog(deviceSN,bodyJsonObj.toJSONString(SerializerFeature.WriteMapNullValue),"萤石监控跌倒数据接收");
                                    dataPushLogUtil.savePushLog(deviceSN,bodyJsonObj.toJSONString(bodyJsonObj,SerializerFeature.WriteMapNullValue),"萤石监控跌倒数据接收");
                                    if (bodyJsonObj2.containsKey("pictureList")&&bodyJsonObj2.getJSONArray("pictureList")!=null){
                                    if (bodyJsonObj2.containsKey("pictureList")&&bodyJsonObj2.getJSONArray("pictureList")!=null){
                                        JSONArray pictureList = bodyJsonObj2.getJSONArray("pictureList");
                                        JSONArray pictureList = bodyJsonObj2.getJSONArray("pictureList");
                                        if (pictureList.size()>0){
                                        if (pictureList.size()>0){

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

@ -0,0 +1,103 @@
package com.yihu.jw.care.util;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/9/13.
 */
@Component
public class DeviceLostMessageUtil {
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BasePatientDao patientDao;
    /**
     * 设备离线通知
     * @param devices
     */
    public void deviceLostMessage(List<String> devices){
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        for (String id:devices){
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            if (pds.size()>0){
                DevicePatientDevice deviceDO = pds.get(0);
                String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor d  " +
                        "               WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id and m.doctor_code = d.id " +
                        "               and m.del = '1' and sr.patient = '"+deviceDO.getUser()+"' " ;
                List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
                String deviceName="";
                for (Map<String,Object> docTmp:doctors){
                    switch (deviceDO.getCategoryCode()){
                        case "1":
                            deviceName="血糖仪离线";
                            break;
                        case "2":
                            deviceName="血压计离线";
                            break;
                        case "4":
                            deviceName="智能手表离线";
                            break;
                        case "7":
                            deviceName="居家安全报警器离线";
                            break;
                        case "12":
                            deviceName="监控器离线";
                            break;
                        case "13":
                            deviceName="睡眠带离线";
                            break;
                        case "14":
                            deviceName="气感报警器离线";
                            break;
                        case "15":
                            deviceName="烟感报警器离线";
                            break;
                        case "16":
                            deviceName="智能拐杖离线";
                            break;
                        case "17":
                            deviceName="随身WiFi离线";
                            break;
                    }
                    BasePatientDO patientDO = patientDao.findById(deviceDO.getUser());
                    SystemMessageDO messageDO = new SystemMessageDO();
                    messageDO.setTitle("设备离线通知");
                    messageDO.setType("43");
                    messageDO.setSender(deviceDO.getUser());
                    messageDO.setSenderName(patientDO.getName());
                    messageDO.setRelationCode(id);
                    messageDO.setReceiver(docTmp.get("id").toString());
                    messageDO.setReceiverName(docTmp.get("name").toString());
                    messageDO.setOver("1");
                    messageDO.setData(deviceName);
                    messageDO.setDel("1");
                    messageDO.setCreateTime(new Date());
                    messageDO.setSenderPhoto(patientDO.getPhoto());
                    messageDOS.add(messageDO);
                }
            }
        }
        if (messageDOS.size()>0){
            systemMessageDao.save(messageDOS);
        }
    }
}

+ 5 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/dao/device/WlyyDeviceDao.java

@ -7,7 +7,9 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.io.Serializable;
import java.util.Date;
import java.util.Date;
import java.util.List;
/***
/***
 * @ClassName: WlyyDeviceDao
 * @ClassName: WlyyDeviceDao
@ -25,4 +27,7 @@ public interface WlyyDeviceDao extends PagingAndSortingRepository<DeviceDetail,
    @Query("update DeviceDetail o set o.contactStatus = 1 , o.contactStatusTime = ?1 where o.deviceCode = ?2")
    @Query("update DeviceDetail o set o.contactStatus = 1 , o.contactStatusTime = ?1 where o.deviceCode = ?2")
    void updateContactStatus1(Date contactStatusTime, String orderId);
    void updateContactStatus1(Date contactStatusTime, String orderId);
    @Modifying
    @Query("update DeviceDetail o set o.contactStatus = ?1 , o.contactStatusTime = ?2 where o.deviceCode in (?3)")
    void updateByContactStatus(Integer contactStatus,Date contactStatusTime, List<String> ids );
}
}

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PatientSosContactsJob.java

@ -64,7 +64,7 @@ public class PatientSosContactsJob implements Job {
                }
                }
                if(null!=sosContactsDO){
                if(null!=sosContactsDO){
                    if (StringUtils.isNotBlank(sim)){
                    if (StringUtils.isNotBlank(sim)){
                        JSONObject response = cardService.setPatientContacts(sim, null, null, "1", sos_phone, null);//移动白名单
                        JSONObject response = cardService.setPatientContacts(null, sim, null, "1", sos_phone, null);//移动白名单
                        //0成功 12102名单重复
                        //0成功 12102名单重复
                        if (response.getInteger("status")==0||response.getInteger("status")==12108){
                        if (response.getInteger("status")==0||response.getInteger("status")==12108){
                            if (1==sosContactsDO.getSuccessFlag()||0==sosContactsDO.getSuccessFlag()){
                            if (1==sosContactsDO.getSuccessFlag()||0==sosContactsDO.getSuccessFlag()){
@ -93,7 +93,7 @@ public class PatientSosContactsJob implements Job {
                            sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":"+-1+"}");
                            sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":"+-1+"}");
                        }
                        }
                    }else if ("16".equals(category_code)){
                    }else if ("16".equals(category_code)){
                        sql =" select sos_phone from base_patient_sos_contacts where patient='"+patient+"' order by phone_seqid asc ";
                        sql =" select sos_phone from base_patient_sos_contacts where patient='"+patient+"' and del=1 order by phone_seqid asc ";
                        List<String> nums = jdbcTemplate.queryForList(sql,String.class);
                        List<String> nums = jdbcTemplate.queryForList(sql,String.class);
                        String phone1 = null;
                        String phone1 = null;
                        String phone2 = null;
                        String phone2 = null;

+ 43 - 64
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -5,10 +5,9 @@ import com.yihu.jw.care.config.AqgConfig;
import com.yihu.jw.care.dao.device.DeviceDao;
import com.yihu.jw.care.dao.device.DeviceDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.device.WlyyDeviceDao;
import com.yihu.jw.care.dao.device.WlyyDeviceDao;
import com.yihu.jw.care.util.DeviceLostMessageUtil;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.restmodel.iot.device.WlyyDeviceVO;
import com.yihu.jw.restmodel.iot.device.WlyyPatientDeviceVO;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
@ -50,7 +49,8 @@ public class PatientDeviceService {
    private WlyyDeviceDao wlyyDeviceDao;
    private WlyyDeviceDao wlyyDeviceDao;
    @Autowired
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DeviceLostMessageUtil deviceLostMessageUtil;
    Map<Integer, String> relations = new HashMap<>();
    Map<Integer, String> relations = new HashMap<>();
    @PostConstruct
    @PostConstruct
@ -229,6 +229,7 @@ public class PatientDeviceService {
    /**************************************物联网检测大屏失联率start************************************************/
    /**************************************物联网检测大屏失联率start************************************************/
    @Transactional
    public void selectAndUpdate(){
    public void selectAndUpdate(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String endTime = sdf.format(new Date());
        String endTime = sdf.format(new Date());
@ -244,77 +245,55 @@ public class PatientDeviceService {
        Date nowDate2 = device2.getTime();
        Date nowDate2 = device2.getTime();
        String startTimeDevice2 = sdf.format(nowDate2);
        String startTimeDevice2 = sdf.format(nowDate2);
        try {
        try {
            /**血糖仪,血压计。30天内有数据上传,则改为未失联**/
            String sql = "SELECT bb.device_sn  FROM (\n" +
                    "SELECT pd.device_sn FROM base.wlyy_patient_device pd  LEFT JOIN wlyy_patient_health_index phi ON pd.device_sn = phi.device_sn WHERE\n" +
                    "phi.record_date BETWEEN '"+startTimeDevice1+"' AND '"+endTime+"' AND phi.del = 1 AND pd.category_code IN (1,2) GROUP BY phi.device_sn\n" +
                    ") aa RIGHT JOIN (SELECT device_sn FROM wlyy_patient_device WHERE category_code IN (1,2)) bb ON aa.device_sn =  bb.device_sn\n" +
                    "WHERE aa.device_sn IS NOT NULL OR aa.device_sn != ''";
            List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
            if (list.size() > 0) {
                for (int i=0;i<list.size();i++) {
                    wlyyDeviceDao.updateContactStatus1(new Date(), (String) list.get(i).get("device_sn"));
                }
            }
            /**智能拐杖、智能手表。2天内有数据上传,则改为未失联**/
            sql = "SELECT bb.device_sn  FROM (\n" +
                    "SELECT pd.device_sn FROM base.wlyy_patient_device pd  LEFT JOIN wlyy_patient_health_index phi ON pd.device_sn = phi.device_sn WHERE\n" +
                    "phi.record_date BETWEEN '"+startTimeDevice2+"' AND '"+endTime+"' AND phi.del = 1 AND pd.category_code IN (16) GROUP BY phi.device_sn\n" +
                    ") aa RIGHT JOIN (SELECT device_sn FROM wlyy_patient_device WHERE category_code IN (16)) bb ON aa.device_sn =  bb.device_sn\n" +
                    "WHERE aa.device_sn IS NOT NULL OR aa.device_sn != ''";
            list = jdbcTemplate.queryForList(sql);
            if (list.size() > 0) {
                for (int i=0;i<list.size();i++) {
                    wlyyDeviceDao.updateContactStatus1(new Date(), (String) list.get(i).get("device_sn"));
                }
            List<String> lostSN = new ArrayList<>();
            List<String> onContact = new ArrayList<>();
            /*******************未失联**/
            //血糖仪,血压计。30天内有数据上传,则改为未失联
            String sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (1,2) and EXISTS ( " +
                    "select dp.device_sn from device_data_push_log dp where dp.device_sn = pd.device_sn and dp.create_time " +
                    " BETWEEN '"+startTimeDevice1+"' AND '"+endTime+"') ";
            List<String> devices = jdbcTemplate.queryForList(sql,String.class) ;
            if (devices.size() > 0) {
                onContact.addAll(devices);
            }
            }
            //智能拐杖。手表2天内有数据上传,则改为未失联**
            sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (4,16) and EXISTS ( " +
                    "select dp.device_sn from device_data_push_log dp where dp.device_sn = pd.device_sn and dp.create_time " +
                    " BETWEEN '"+startTimeDevice2+"' AND '"+endTime+"') ";
            /**血糖仪**/
            String sql1 = "SELECT bb.device_sn  FROM (\n" +
                    "SELECT pd.device_sn FROM base.wlyy_patient_device pd  LEFT JOIN wlyy_patient_health_index phi ON pd.device_sn = phi.device_sn WHERE\n" +
                    "phi.record_date BETWEEN '"+startTimeDevice1+"' AND '"+endTime+"' AND phi.del = 1 AND pd.category_code = 1 GROUP BY phi.device_sn\n" +
                    ") aa RIGHT JOIN (SELECT device_sn FROM wlyy_patient_device WHERE category_code = 1) bb ON aa.device_sn =  bb.device_sn\n" +
                    "WHERE aa.device_sn IS NULL OR aa.device_sn = ''";
            List<Map<String , Object>> list1 = jdbcTemplate.queryForList(sql1);
            if (list1.size() > 0) {
                for (int i=0;i<list1.size();i++) {
                    wlyyDeviceDao.updateContactStatus(new Date(), (String) list1.get(i).get("device_sn"));
                }
            devices = jdbcTemplate.queryForList(sql,String.class) ;
            if (devices.size() > 0) {
                onContact.addAll(devices);
            }
            }
            /**血压计**/
            String sql2 = "SELECT bb.device_sn  FROM (\n" +
                    "SELECT pd.device_sn FROM base.wlyy_patient_device pd  LEFT JOIN wlyy_patient_health_index phi ON pd.device_sn = phi.device_sn WHERE\n" +
                    "phi.record_date BETWEEN '"+startTimeDevice1+"' AND '"+endTime+"' AND phi.del = 1 AND pd.category_code = 2 GROUP BY phi.device_sn\n" +
                    ") aa RIGHT JOIN (SELECT device_sn FROM wlyy_patient_device WHERE category_code = 2) bb ON aa.device_sn =  bb.device_sn\n" +
                    "WHERE aa.device_sn IS NULL OR aa.device_sn = ''";
            List<Map<String , Object>> list2 = jdbcTemplate.queryForList(sql2);
            if (list2.size() > 0) {
                for (int i=0;i<list2.size();i++) {
                    wlyyDeviceDao.updateContactStatus(new Date(), (String) list2.get(i).get("device_sn"));
                }
            /***************失联**/
            //血糖仪、血压**/
            sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (1,2) and not EXISTS ( " +
                    "select dp.device_sn from device_data_push_log dp where dp.device_sn = pd.device_sn and dp.create_time " +
                    " BETWEEN '"+startTimeDevice1+"' AND '"+endTime+"') ";
            devices = jdbcTemplate.queryForList(sql,String.class) ;
            if (devices.size() > 0) {
                lostSN.addAll(devices);
            }
            }
            /**智能手表**/
            //startTimeDevice2   2天
            /**智能拐杖**/
            String sql3 = "SELECT bb.device_sn  FROM (\n" +
                    "SELECT pd.device_sn FROM base.wlyy_patient_device pd  LEFT JOIN wlyy_patient_health_index phi ON pd.device_sn = phi.device_sn WHERE\n" +
                    "phi.record_date BETWEEN '"+startTimeDevice2+"' AND '"+endTime+"' AND phi.del = 1 AND pd.category_code = 16 GROUP BY phi.device_sn\n" +
                    ") aa RIGHT JOIN (SELECT device_sn FROM wlyy_patient_device WHERE category_code = 16) bb ON aa.device_sn =  bb.device_sn\n" +
                    "WHERE aa.device_sn IS NULL OR aa.device_sn = ''";
            List<Map<String , Object>> list3 = jdbcTemplate.queryForList(sql3);
            if (list3.size() > 0) {
                for (int i=0;i<list3.size();i++) {
                    wlyyDeviceDao.updateContactStatus(new Date(), (String) list3.get(i).get("device_sn"));
                }
            //智能拐杖、手表 睡眠带
            sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (4,13,16) and not EXISTS ( " +
                    "select dp.device_sn from device_data_push_log dp where dp.device_sn = pd.device_sn and dp.create_time " +
                    " BETWEEN '"+startTimeDevice2+"' AND '"+endTime+"') ";
            devices = jdbcTemplate.queryForList(sql,String.class) ;
            if (devices.size() > 0) {
                lostSN.addAll(devices);
            }
            if (onContact.size()>0){
                wlyyDeviceDao.updateByContactStatus(1,new Date(),onContact);
            }
            if (lostSN.size()>0){
                wlyyDeviceDao.updateByContactStatus(0,new Date(),lostSN);
                deviceLostMessageUtil.deviceLostMessage(lostSN);
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            logger.info(e.getMessage());
            logger.info(e.getMessage());
        }
        }
    }
    }
}
}

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

@ -0,0 +1,104 @@
package com.yihu.jw.care.util;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/9/13.
 */
@Component
public class DeviceLostMessageUtil {
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BasePatientDao patientDao;
    /**
     * 设备离线通知
     * @param devices
     */
    public void deviceLostMessage(List<String> devices){
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        for (String id:devices){
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            if (pds.size()>0){
                DevicePatientDevice deviceDO = pds.get(0);
                String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor d  " +
                        "               WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id and m.doctor_code = d.id " +
                        "               and m.del = '1' and sr.patient = '"+deviceDO.getUser()+"' " ;
                List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
                        String deviceName="";
                for (Map<String,Object> docTmp:doctors){
                    switch (deviceDO.getCategoryCode()){
                        case "1":
                            deviceName="血糖仪离线";
                            break;
                        case "2":
                            deviceName="血压计离线";
                            break;
                        case "4":
                            deviceName="智能手表离线";
                            break;
                        case "7":
                            deviceName="居家安全报警器离线";
                            break;
                        case "12":
                            deviceName="监控器离线";
                            break;
                        case "13":
                            deviceName="睡眠带离线";
                            break;
                        case "14":
                            deviceName="气感报警器离线";
                            break;
                        case "15":
                            deviceName="烟感报警器离线";
                            break;
                        case "16":
                            deviceName="智能拐杖离线";
                            break;
                        case "17":
                            deviceName="随身WiFi离线";
                            break;
                    }
                    BasePatientDO patientDO = patientDao.findById(deviceDO.getUser());
                    SystemMessageDO messageDO = new SystemMessageDO();
                    messageDO.setTitle("设备离线通知");
                    messageDO.setType("43");
                    messageDO.setSender(deviceDO.getUser());
                    messageDO.setSenderName(patientDO.getName());
                    messageDO.setRelationCode(id);
                    messageDO.setReceiver(docTmp.get("id").toString());
                    messageDO.setReceiverName(docTmp.get("name").toString());
                    messageDO.setOver("1");
                    messageDO.setData(deviceName);
                    messageDO.setDel("1");
                    messageDO.setCreateTime(new Date());
                    messageDO.setSenderPhoto(patientDO.getPhoto());
                    messageDOS.add(messageDO);
                }
            }
        }
        if (messageDOS.size()>0){
            systemMessageDao.save(messageDOS);
        }
    }
}

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

@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
/**
/**
@ -126,6 +127,7 @@ public class MessageUtil {
        return wxTemplateConfigDO;
        return wxTemplateConfigDO;
    }
    }
    @Async
    public String sendTXYSJson(String templateCode,String mobile,String ...params)throws Exception{
    public String sendTXYSJson(String templateCode,String mobile,String ...params)throws Exception{
        if (sendTXMessageFlag){
        if (sendTXMessageFlag){
            JSONObject sendObj = new JSONObject();
            JSONObject sendObj = new JSONObject();

+ 41 - 26
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java

@ -39,28 +39,32 @@ public class ComputeHelper {
     * @param endTime
     * @param endTime
     * @return
     * @return
     */
     */
    public List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String wlyyJobCongId, String endTime, String timeLevel) {
    public List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String wlyyJobCongId, String endTime, String timeLevel,String areaLevel) {
        try {
        try {
            //得到机构类型
            //得到机构类型
            String orgType = findOrgType(wlyyJobCongId);
            String orgType = findOrgType(wlyyJobCongId);
            if (StringUtils.isBlank(areaLevel)){
                areaLevel="6";
            }
            //计算数据 返回map key 根据团队和维度拼凑在map中的key   1-2-1  如果维度是长度是0返回团队id 1
            //计算数据 返回map key 根据团队和维度拼凑在map中的key   1-2-1  如果维度是长度是0返回团队id 1
            Map<String, List<DataModel>> computeMap = computeDataModel(dimensionQuotas, dataModels,wlyyJobCongId);
            Map<String, List<DataModel>> computeMap = computeDataModel(dimensionQuotas, dataModels,wlyyJobCongId,areaLevel);
            List<SaveModel> savemodels = null;
            List<SaveModel> savemodels = null;
            if ("45".equals(wlyyJobCongId)||"47".equals(wlyyJobCongId)||"50".equals(wlyyJobCongId)){
                savemodels = initAndSetResultCity( dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
            }else if("42".equals(wlyyJobCongId)||"41".equals(wlyyJobCongId)||"43".equals(wlyyJobCongId)||"46".equals(wlyyJobCongId)||"48".equals(wlyyJobCongId)
            ||"49".equals(wlyyJobCongId)){
                //新生儿入学只到机构级别
                List<BaseOrgDO> orgDOs = findAllOrg(orgType);
                savemodels = initAndSetResultOrg(orgDOs, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
            }else{
                //得到全部团队
                List<BaseDoctorDO> doctors = findAllDoctor(orgType);
                //初始化map并且设置统计出来的数目
                savemodels = initAndSetResult(doctors, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
            switch (areaLevel){
                case "2":
                    savemodels = initAndSetResultCity( dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
                    break;
                case "4":
                    List<BaseOrgDO> orgDOs = findAllOrg(orgType);
                    savemodels = initAndSetResultOrg(orgDOs, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
                    break;
                default:
                    //得到全部团队
                    List<BaseDoctorDO> doctors = findAllDoctor(orgType);
                    //初始化map并且设置统计出来的数目
                    savemodels = initAndSetResult(doctors, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
                    break;
            }
            }
            return savemodels;
            return savemodels;
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -75,19 +79,30 @@ public class ComputeHelper {
     * @param dimensionQuotas 该指标的维度
     * @param dimensionQuotas 该指标的维度
     * @return
     * @return
     */
     */
    private Map<String, List<DataModel>> computeDataModel(List<BaseDimensionQuota> dimensionQuotas, List<DataModel> dataModels,String wlyyJobCongId) {
    private Map<String, List<DataModel>> computeDataModel(List<BaseDimensionQuota> dimensionQuotas, List<DataModel> dataModels,String wlyyJobCongId,String areaLevel) {
        Map<String, List<DataModel>> returnMap = new HashMap<>();
        Map<String, List<DataModel>> returnMap = new HashMap<>();
        dataModels.stream().forEach(one -> {
        dataModels.stream().forEach(one -> {
            String key;
            String key;
            if ("45".equals(wlyyJobCongId)||"47".equals(wlyyJobCongId)||"50".equals(wlyyJobCongId)){
                key = getCityKey(one,dimensionQuotas.size());
            }
            else if("42".equals(wlyyJobCongId)||"41".equals(wlyyJobCongId)||"43".equals(wlyyJobCongId)||"46".equals(wlyyJobCongId)||"48".equals(wlyyJobCongId)
            ||"49".equals(wlyyJobCongId)){
                key = getOrgKey(one, dimensionQuotas.size());
            }else{
                key = getKey(one, dimensionQuotas.size());
            switch (areaLevel){
                case "2":
                    key = getCityKey(one,dimensionQuotas.size());
                    break;
                case "4":
                    key = getOrgKey(one, dimensionQuotas.size());
                    break;
                default:
                    key = getKey(one, dimensionQuotas.size());
                    break;
            }
            }
//            if ("45".equals(wlyyJobCongId)||"47".equals(wlyyJobCongId)||"50".equals(wlyyJobCongId)){
//                key = getCityKey(one,dimensionQuotas.size());
//            }
//            else if("42".equals(wlyyJobCongId)||"41".equals(wlyyJobCongId)||"43".equals(wlyyJobCongId)||"46".equals(wlyyJobCongId)||"48".equals(wlyyJobCongId)
//            ||"49".equals(wlyyJobCongId)){
//                key = getOrgKey(one, dimensionQuotas.size());
//            }else{
//                key = getKey(one, dimensionQuotas.size());
//            }
            List<DataModel> sms = new ArrayList<DataModel>();
            List<DataModel> sms = new ArrayList<DataModel>();
            if (returnMap.containsKey(key)) {
            if (returnMap.containsKey(key)) {
                sms = returnMap.get(key);
                sms = returnMap.get(key);
@ -174,7 +189,7 @@ public class ComputeHelper {
                " FROM " +
                " FROM " +
                "base_org o" +
                "base_org o" +
                " WHERE "+
                " WHERE "+
                " o.del='1' and o.code not in('fxty')";
                " o.del='1' and o.code not in('fxty','lxyl')";
        if(StringUtils.isNotBlank(orgType)){
        if(StringUtils.isNotBlank(orgType)){
            sql += " and o.type = '"+orgType+"'";
            sql += " and o.type = '"+orgType+"'";
        }
        }
@ -205,7 +220,7 @@ public class ComputeHelper {
                " WHERE bdh.doctor_code = bd.id  " +
                " WHERE bdh.doctor_code = bd.id  " +
                "AND hd.code= bdh.dept_code " +
                "AND hd.code= bdh.dept_code " +
                "AND o.code = bdh.org_code " +
                "AND o.code = bdh.org_code " +
                "AND bdh.del=1 and o.del=1 and o.code not in('fxty')";
                "AND bdh.del=1 and o.del=1 and o.code not in('fxty','lxyl')";
        if(StringUtils.isNotBlank(orgType)){
        if(StringUtils.isNotBlank(orgType)){
            sql += " and o.type = '"+orgType+"'";
            sql += " and o.type = '"+orgType+"'";
        }
        }

+ 29 - 3
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java

@ -40,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.*;
@ -253,6 +254,26 @@ public class CurrentMysqlToEsQuotaJob implements Job {
    private boolean updateData(List<SaveModel> sms, Date quotaDate, String quotaCode, String timeLevel) {
    private boolean updateData(List<SaveModel> sms, Date quotaDate, String quotaCode, String timeLevel) {
        JestClient jestClient = null;
        JestClient jestClient = null;
        try {
        try {
            //执行指标对象
            QuartzJobConfig quartzJobConfigTarget = quartzJobConfigDao.findById(quotaCode);
            //获取指标统计最小单位
            String areaLevel = quartzJobConfigTarget.getAreaLevel();
            String methodName="";
            if (org.apache.commons.lang3.StringUtils.isBlank(areaLevel)){
                areaLevel="6";
            }
            switch (areaLevel) {
                case "2":
                    methodName = "getCity";
                    break;
                case "4":
                    methodName = "getHospital";
                    break;
                default:
                    methodName = "getDoctor";
                    break;
            }
            jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -273,14 +294,19 @@ public class CurrentMysqlToEsQuotaJob implements Job {
                List<SaveModel> saveModels = new ArrayList<>();
                List<SaveModel> saveModels = new ArrayList<>();
                //把新的值赋值给ES查询出来的值
                //把新的值赋值给ES查询出来的值
                Map<String, SaveModel> newSaveModelMaps = new HashMap<>();
                Map<String, SaveModel> newSaveModelMaps = new HashMap<>();
                String unitKey="";
                //list转map
                //list转map
                for (SaveModel newSaveModel : sms) {
                for (SaveModel newSaveModel : sms) {
                    StringBuffer key = new StringBuffer(newSaveModel.getDoctor() + "-" + newSaveModel.getSlaveKey1() + "-" + newSaveModel.getSlaveKey2() + "-" + newSaveModel.getSlaveKey3() + "-" + newSaveModel.getSlaveKey4());
                    Method method = newSaveModel.getClass().getMethod(methodName);
                    unitKey = (String) method.invoke(newSaveModel);
                    StringBuffer key = new StringBuffer(unitKey + "-" + newSaveModel.getSlaveKey1() + "-" + newSaveModel.getSlaveKey2() + "-" + newSaveModel.getSlaveKey3() + "-" + newSaveModel.getSlaveKey4());
                    newSaveModelMaps.put(key.toString(), newSaveModel);
                    newSaveModelMaps.put(key.toString(), newSaveModel);
                }
                }
                for (SaveModel esSavemodel : quarySaveModels) {
                for (SaveModel esSavemodel : quarySaveModels) {
                    StringBuffer key = new StringBuffer(esSavemodel.getDoctor() + "-" + esSavemodel.getSlaveKey1() + "-" + esSavemodel.getSlaveKey2() + "-" + esSavemodel.getSlaveKey3() + "-" + esSavemodel.getSlaveKey4());
                    Method method = esSavemodel.getClass().getMethod(methodName);
                    unitKey = (String) method.invoke(esSavemodel);
                    StringBuffer key = new StringBuffer(unitKey + "-" + esSavemodel.getSlaveKey1() + "-" + esSavemodel.getSlaveKey2() + "-" + esSavemodel.getSlaveKey3() + "-" + esSavemodel.getSlaveKey4());
                    SaveModel newSaveMode = newSaveModelMaps.get(key.toString());
                    SaveModel newSaveMode = newSaveModelMaps.get(key.toString());
                    if (newSaveMode != null) {
                    if (newSaveMode != null) {
                        esSavemodel.setResult1(newSaveMode.getResult1());
                        esSavemodel.setResult1(newSaveMode.getResult1());
@ -347,7 +373,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel, QuartzJobConfig quartzJobConfig) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel, QuartzJobConfig quartzJobConfig) {
        try {
        try {
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, quartzJobConfig.getId(), endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, quartzJobConfig.getId(), endTime, timeLevel, quartzJobConfig.getAreaLevel());
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }

+ 1 - 1
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/EsToEsQuotaJob.java

@ -242,7 +242,7 @@ public class EsToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
        try {
        try {
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel,quartzJobConfig.getAreaLevel());
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }

+ 2 - 1
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java

@ -60,6 +60,7 @@ public class MysqlToEsQuotaJob implements Job {
    private Date quotaDate;//统计的时间
    private Date quotaDate;//统计的时间
    private String timeLevel;//1 日 2年
    private String timeLevel;//1 日 2年
    private String incrementInterval;//增量的时间间隔(天)
    private String incrementInterval;//增量的时间间隔(天)
    private String areaLevel;//1省2市3区县4机构5团队6医生
    @Autowired
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
@ -258,7 +259,7 @@ public class MysqlToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<BaseDimensionQuota> dimensionQuotas, String timeLevel) {
        try {
        try {
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel,quartzJobConfig.getAreaLevel());
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }