Kaynağa Gözat

Merge branch 'dev' of chinawu123/wlyy2.0 into dev

chinawu123 1 yıl önce
ebeveyn
işleme
be9e34c63a
25 değiştirilmiş dosya ile 1011 ekleme ve 14 silme
  1. 11 0
      common/common-entity/sql/sql记录
  2. 58 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseCheckOrgDO.java
  3. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  4. 1 1
      server/svr-authentication/src/main/resources/bootstrap.yml
  5. 11 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseCheckOrgDao.java
  6. 81 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/music/MusicController.java
  7. 61 4
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java
  8. 101 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/music/MusicService.java
  9. 54 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  10. 1 1
      svr/svr-base/src/main/resources/bootstrap.yml
  11. 13 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  12. 30 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java
  13. 11 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  14. 20 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  15. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java
  16. 1 1
      svr/svr-cloud-care/src/main/resources/bootstrap.yml
  17. 2 1
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/event/ApplicationEvent.java
  18. 12 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/DeviceSyncJob.java
  19. 213 3
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/DeviceSyncService.java
  20. 1 1
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/hz/HzInterfaceService.java
  21. 11 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/dao/ZhAlarmDealSyncDao.java
  22. 12 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/dao/ZhDataBatchSyncDao.java
  23. 121 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/entity/ZhAlarmDealSyncDO.java
  24. 144 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/entity/ZhDataBatchSyncDO.java
  25. 14 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhylyjkglxt/sql记录.sql

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

@ -2411,3 +2411,14 @@ CREATE TABLE `base_copywriting` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='基础文案表';
-- 2022-12-08   wsl
alter table base_patient add column well int(2) DEFAULT NULL comment '好评度';
CREATE TABLE `base_check_org` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `orgCode` varchar(50) DEFAULT NULL COMMENT '机构code',
  `check_Date` varchar(50) DEFAULT NULL COMMENT '考核时间',
  `check_file` varchar(255) DEFAULT NULL COMMENT '考核文件',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构考核';

+ 58 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseCheckOrgDO.java

@ -0,0 +1,58 @@
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by wsl on 2022/12/8
 */
@Entity
@Table(name = "base_check_org")
public class BaseCheckOrgDO extends IdEntity {
    /**
     * 机构code
     */
    private String orgcode;
    /**
     * 考核时间
     */
    private String checkDate;
    /**
     * 考核文件
     */
    private String checkFile;
    public String getOrgcode() {
        return orgcode;
    }
    public void setOrgcode(String orgcode) {
        this.orgcode = orgcode;
    }
    public String getCheckDate() {
        return checkDate;
    }
    public void setCheckDate(String checkDate) {
        this.checkDate = checkDate;
    }
    public String getCheckFile() {
        return checkFile;
    }
    public void setCheckFile(String checkFile) {
        this.checkFile = checkFile;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -303,6 +303,16 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String verifyCode;//眼科token
    private Integer well;//好评度
    public Integer getWell() {
        return well;
    }
    public void setWell(Integer well) {
        this.well = well;
    }
    @Column(name = "medical_state")
    public String getMedicalState() {

+ 1 - 1
server/svr-authentication/src/main/resources/bootstrap.yml

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

+ 11 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseCheckOrgDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.base.dao.org;
import com.yihu.jw.entity.base.org.BaseCheckOrgDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wsl on 2022/12/8
 */
public interface BaseCheckOrgDao extends PagingAndSortingRepository<BaseCheckOrgDO, String>, JpaSpecificationExecutor<BaseCheckOrgDO> {
}

+ 81 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/music/MusicController.java

@ -0,0 +1,81 @@
package com.yihu.jw.base.endpoint.music;
import com.yihu.jw.base.service.music.MusicService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * Created by wsl on 2022/12/8
 */
@RestController
@RequestMapping(value = "/musicManage", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(value = "音乐管理", description = "音乐管理接口", tags = {"wlyy基础服务 - 音乐管理接口"})
public class MusicController extends EnvelopRestEndpoint {
    @Autowired
    public MusicService musicService;
    @PostMapping(value = "/saveMusic")
    @ApiOperation(value = "保存音乐")
    public Envelop saveMusic(@RequestParam(value = "url", required = true ) String url,
                             @RequestParam(value = "title", required = true )String title,
                             @RequestParam(value = "author", required = true )String author){
        try {
            musicService.saveMusic(url, title, author);
            return success("保存成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "/getMusic")
    @ApiOperation(value = "获取音乐")
    public ObjEnvelop getMusic(@RequestParam(value = "id", required = false )String id,
                               @RequestParam(value = "musicName", required = false )String musicName,
                               @RequestParam(value = "page", required = true )Integer page,
                               @RequestParam(value = "size", required = true )Integer size){
        try {
            return success("success",200,musicService.getMusic(id, musicName, page, size));
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "/delMusic")
    public Envelop delMusic(String id){
        try {
            musicService.delMusic(id);
            return success("删除成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }
}

+ 61 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java

@ -6,10 +6,7 @@ import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.hospital.drugstore.service.BaseDrugStoreService;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
@ -22,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
 * 机构信息控制器
@ -204,6 +202,61 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
        return success(baseOrgService.findOrgListBySaasId(""));
    }
    @PostMapping(value = "/delCheckOrg")
    @ApiOperation(value = "删除机构考核")
    public Envelop delCheckOrg (
            @ApiParam(name = "id", value = "考核id")
            @RequestParam(value = "id", required = false) String id) throws Exception {
        try {
            baseOrgService.delCheckOrg(id);
            return success("操作成功");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "/getOrgCheckList")
    @ApiOperation(value = "获取机构考核")
    public ObjEnvelop getOrgCheckList(@ApiParam(name = "orgCode", value = "机构code")
                                       @RequestParam(value = "orgCode", required = false) String orgCode,
                                      @ApiParam(name = "id", value = "考核id")
                                       @RequestParam(value = "id", required = false) String id,
                                      @ApiParam(name = "page" )
                                       @RequestParam(value = "page", required = true) Integer page,
                                      @ApiParam(name = "size")
                                       @RequestParam(value = "size", required = true) Integer size) {
        try {
            JSONObject orgCheckList = baseOrgService.getOrgCheckList(orgCode, id, page, size);
            return success("获取成功!",200,orgCheckList);
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "/saveOrgCheck")
    @ApiOperation(value = "保存修改机构考核")
    public Envelop saveOrgCheck(@ApiParam(name = "id", value = "考核id")
                                @RequestParam(value = "id", required = false) String id,
                                @ApiParam(name = "orgCode", value = "机构code")
                                @RequestParam(value = "orgCode", required = true) String orgCode,
                                @ApiParam(name = "checkDate", value = "考核时间")
                                @RequestParam(value = "checkDate", required = true) String checkDate,
                                @ApiParam(name = "file", value = "考核文件")
                                @RequestParam(value = "file", required = true) String file){
        try {
            baseOrgService.saveOrgCheck(id, orgCode, checkDate, file);
            return success("保存成功");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.BaseOrg.queryDrugStore)
    @ApiOperation(value = "查询药房")
    public MixEnvelop queryDrugStore (
@ -267,4 +320,8 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
        return success("操作成功");
    }
}

+ 101 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/music/MusicService.java

@ -0,0 +1,101 @@
package com.yihu.jw.base.service.music;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.dao.video.BaseVideoDao;
import com.yihu.jw.entity.care.video.BaseVideoDO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * Created by wsl on 2022/12/8
 */
@Service
public class MusicService {
    @Autowired
    private BaseVideoDao baseVideoDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    //url 地址   title  音乐名称  author  作者
    @Transactional(rollbackFor = Exception.class)
    public void saveMusic(String url,String title,String author){
        BaseVideoDO baseVideoDO = new BaseVideoDO();
        baseVideoDO.setUrl(url);
        baseVideoDO.setTitle(title);
        baseVideoDO.setIntroduction(author);
        baseVideoDO.setType("13");
        baseVideoDao.save(baseVideoDO);
    }
    public JSONObject getMusic(String id,String musicName,Integer page,Integer size){
        if (page == null) {
            page = 0;
        } else if (page > 0) {
            page = page - 1;
        }
        if (size <= 0) {
            size = 10;
        }
        JSONObject jsonObject= new JSONObject();
        String sql = "select * from base_video where type = 13";
        String totalSql = "select count(id) from base_video where type = 13";
        if (StringUtils.isNotBlank(id)){
            sql += " and id = '"+id+"'";
        }
        if (StringUtils.isNotBlank(musicName)){
            sql += " and musicName like '%"+musicName+"%' ";
            totalSql += " and musicName like '%"+musicName+"%' ";
        }
        sql += " limit "+page+","+size;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Integer total = jdbcTemplate.queryForObject(totalSql, Integer.class);
        jsonObject.put("total",total);
        jsonObject.put("list",list);
        return jsonObject;
    }
    @Transactional(rollbackFor = Exception.class)
    public void delMusic(String id){
        String sql = "delete from base_video where id='"+id+"'";
        jdbcTemplate.execute(sql);
    }
}

+ 54 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.org.BaseCheckOrgDao;
import com.yihu.jw.base.dao.org.BaseOrgUserDao;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
@ -11,6 +12,7 @@ import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.service.user.UserService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.org.BaseCheckOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
@ -80,6 +82,9 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private BaseCheckOrgDao baseCheckOrgDao;
    @Value("${wechat.flag}")
    private boolean flag;
@ -407,5 +412,54 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        return baseOrgDao.findOrgListBySaasId();
    }
    // 保存修改机构考核
    public void saveOrgCheck(String id ,String orgCode,String checkDate,String file){
        BaseCheckOrgDO baseCheckOrgDO = new BaseCheckOrgDO();
        if (org.apache.commons.lang3.StringUtils.isNotBlank(id)) {
            baseCheckOrgDO.setId(Long.parseLong(id));
        }
        baseCheckOrgDO.setCheckFile(file);
        baseCheckOrgDO.setOrgcode(orgCode);
        baseCheckOrgDO.setCheckDate(checkDate);
        baseCheckOrgDao.save(baseCheckOrgDO);
    }
    //获取机构考核
    public JSONObject getOrgCheckList(String orgCode,String id,Integer page,Integer size){
        JSONObject resultObj =new JSONObject();
        if (page == null) {
            page = 0;
        } else if (page > 0) {
            page = page - 1;
        }
        if (size <= 0) {
            size = 10;
        }
        String sql = "select * from base_check_org where orgCode = '"+orgCode+"'";
        String totalSql = "select count(id) from base_check_org where orgCode = '"+orgCode+"'";
        if (org.apache.commons.lang3.StringUtils.isNotBlank(id)){
            sql += " and id = '"+id+"'";
        }
        sql += " limit "+page+","+size;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Integer total = jdbcTemplate.queryForObject(totalSql, Integer.class);
        resultObj.put("total",total);
        resultObj.put("list",list);
        return resultObj;
    }
    public void delCheckOrg(String id){
        String sql = "delete from base_check_org where id='"+id+"'";
        jdbcTemplate.execute(sql);
    }
}

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

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

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

@ -291,6 +291,19 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "/getPatientPadMusic")
    @ApiOperation(value = "pad 获取音乐")
    public ListEnvelop getPatientPadMusic(){
        try {
            return success("成功!",200,patientMessageService.getPatientPadMusic());
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "/getSystemMessageListNew")
    @ApiOperation(value = "获取系统消息")
    public ListEnvelop getSystemMessageListNew(@ApiParam(name = "type", required = false)

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

@ -372,4 +372,34 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "savePatientWellReceived")
    @ApiOperation("保存居民好评度")
    public Envelop patientWellReceived(@ApiParam(name="patient" ,required = true)@RequestParam(value = "patient",required = true)String patient,
                                     @ApiParam(name="num",required = false)@RequestParam(value = "num",required = false)Integer num){
        try {
            patientService.savePatientWellReceived(patient,num);
            return success("success");
        } catch (Exception e) {
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "getPatientWellReceived")
    @ApiOperation("获取居民好评数")
    public ObjEnvelop getPatientWellReceived(@ApiParam(name="patient" ,required = true)@RequestParam(value = "patient",required = true)String patient){
        try {
            return success("success",200,patientService.getPatientWellReceived(patient));
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException2(e);
        }
    }
}

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

@ -11,6 +11,7 @@ import com.yihu.jw.care.dao.log.BaseFamilyPushOnOffDao;
import com.yihu.jw.care.dao.log.BasePatientPadPushOnOffDao;
import com.yihu.jw.care.dao.message.*;
import com.yihu.jw.care.dao.security.BaseEmergencyWarnLogDao;
import com.yihu.jw.care.dao.video.BaseVideoDao;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.YsDeviceService;
@ -89,6 +90,8 @@ public class PatientMessageService {
    private PadUseTimeDao padUseTimeDao;
    @Autowired
    private ZhaohuifireGasSecDao zhaohuifireGasSecDao;
    @Autowired
    private BaseVideoDao baseVideoDao;
@ -688,4 +691,12 @@ public class PatientMessageService {
    }
    //pad获取音乐
    public  List<Map<String, Object>> getPatientPadMusic(){
        String sql = "select id,title,url,introduction from base_video where type =13 ";
         return jdbcTemplate.queryForList(sql);
    }
}

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -1364,4 +1364,24 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        }
        return result;
    }
    public void savePatientWellReceived(String patient, Integer num) {
        JSONObject result = new JSONObject();
        String sql = "select * from base_patient where id = '" + patient + "'";
        BasePatientDO patientDO = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(BasePatientDO.class));
        patientDO.setWell(num);
        patientDao.save(patientDO);
    }
    public JSONObject getPatientWellReceived(String patient){
        JSONObject jsonObject = new JSONObject();
        String sql = "select * from base_patient where id = '"+patient+"'";
        BasePatientDO patientDO = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(BasePatientDO.class));
        jsonObject.put("status",0);
        if (patientDO.getWell()!=null) {
            jsonObject.put("status",1);
            jsonObject.put("well",patientDO.getWell());
        }
        return jsonObject;
    }
}

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

@ -1408,6 +1408,12 @@ public class StatisticsService {
            jsonArray.add(json);
        }
        res.put("items", jsonArray);
        String sql = " SELECT count(id) from base_life_care_order WHERE  `status` = 2 and  TIMESTAMPDIFF(SECOND,create_time,conclusion_time) < 43200";
        Integer integer = jdbcTemplate.queryForObject(sql, Integer.class);
        res.put("serviceRate",integer/saveModel2.getResult2().longValue()*100);
        return res;
    }
@ -2343,6 +2349,17 @@ public class StatisticsService {
        res.put("emeWarnTotal", saveModel.getResult2().longValue());
        saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, area, level, "67", SaveModel.timeLevel_DDL,"1");
        res.put("emeWarnNotDeal", saveModel.getResult2().longValue());
        String sql = " SELECT SUM(a.total) FROM (\n" +
                " SELECT count(id) total FROM base_emergency_assistance_order WHERE `status` = 0 AND TIMESTAMPDIFF(SECOND,create_time,complete_time) < 43200\n" +
                " UNION ALL\n" +
                " SELECT count(id) total FROM base_security_monitoring_order WHERE `status` = 0 AND TIMESTAMPDIFF(SECOND,create_time,doctor_confirm_finish_time) < 43200\n" +
                " )a";
        Integer integer = jdbcTemplate.queryForObject(sql, Integer.class);
        res.put("serviceRate",integer/saveModel.getResult2().longValue()*100);
        return res;
    }

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

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

+ 2 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/event/ApplicationEvent.java

@ -270,7 +270,7 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            //删除天气预报:每天晚上12点删除
            if (!quartzHelper.isExistJob("DEL_PUSH_MESSAGE_WEATHER_FORECAST_JOB")){
                String trigger =  SystemConf.getInstance().getSystemProperties().getProperty("DEL_PUSH_MESSAGE_WEATHER_FORECAST_JOB");
                quartzHelper.addJob(PushWeatherForecastJob.class,trigger,"DEL_PUSH_MESSAGE_WEATHER_FORECAST_JOB",new HashMap<String,Object>());
                quartzHelper.addJob(DelPushWeatherForecastJob.class,trigger,"DEL_PUSH_MESSAGE_WEATHER_FORECAST_JOB",new HashMap<String,Object>());
                logger.info("DEL_PUSH_MESSAGE_WEATHER_FORECAST_JOB success");
            }else {
                logger.info("DEL_PUSH_MESSAGE_WEATHER_FORECAST_JOB exist");
@ -291,6 +291,7 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            }else {
                logger.info("FAMILY_WECHAT_PUSH_DEVICE_JOB exist");
            }
            //物联设备
            if (!quartzHelper.isExistJob("DEVICE_SYNC_JOB")){
                String trigger =  SystemConf.getInstance().getSystemProperties().getProperty("DEVICE_SYNC_JOB");
                quartzHelper.addJob(DeviceSyncJob.class,trigger,"DEVICE_SYNC_JOB",new HashMap<String,Object>());

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

@ -21,10 +21,20 @@ public class DeviceSyncJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("DeviceSyncJob start");
        try {
            logger.info("设备 start");
            deviceSyncService.deviceSync();
            logger.info("DeviceSyncJob end");
            logger.info("设备 end");
            logger.info("设备运行数据 start");
            deviceSyncService.dataBatchSync();
            logger.info("设备运行数据 end");
            logger.info("事件处置同步 start");
            deviceSyncService.alarmDealSync();
            logger.info("事件处置同步 end");
        } catch (Exception e) {
            logger.info("DeviceSyncJob --ERROR MSG:"+e.getMessage());
            e.printStackTrace();

+ 213 - 3
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/DeviceSyncService.java

@ -1,8 +1,15 @@
package com.yihu.jw.care.service.device;
import com.yihu.jw.care.util.DateUtil;
import com.yihu.jw.care.zhDevice.dao.ZhAlarmDealSyncDao;
import com.yihu.jw.care.zhDevice.dao.ZhDataBatchSyncDao;
import com.yihu.jw.care.zhDevice.dao.ZhDeviceSyncDao;
import com.yihu.jw.care.zhDevice.entity.ZhAlarmDealSyncDO;
import com.yihu.jw.care.zhDevice.entity.ZhDataBatchSyncDO;
import com.yihu.jw.care.zhDevice.entity.ZhDeviceSyncDO;
import com.yihu.jw.entity.care.device.DeviceDataPushLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -18,8 +25,6 @@ import java.util.Map;
public class DeviceSyncService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
@ -126,7 +131,7 @@ public class DeviceSyncService {
            zhDeviceSyncDO.setLng(lng);//经
            zhDeviceSyncDO.setState(1);  //1-新增/修改,-1-删除
            zhDeviceSyncDO.setStatus(1);//0-离线,1-在线,3-停用(长期离线)
            if (1!=Integer.parseInt(deviceS.get("contact_status").toString())){
            if (1 != Integer.parseInt(deviceS.get("contact_status").toString())) {
                zhDeviceSyncDO.setStatus(0);
                zhDeviceSyncDO.setDisabledType(4);
                zhDeviceSyncDO.setReason("长时间未连接网络获取最新状态!默认判定离线状态");
@ -143,7 +148,212 @@ public class DeviceSyncService {
    }
    @Autowired
    ZhDataBatchSyncDao zhDataBatchSyncDao;
    public void dataBatchSync() {
        String date = DateUtil.getStringDateShort();
        String startDate = date+" 00:00:00";
        String endDate = date+" 23:59:59";
        String sql = "";
        List<ZhDataBatchSyncDO> result = new ArrayList<>();
        String devicePushLogSql = "select * from device_data_push_log where create_time = '" + startDate + "' and create_time <= '" + endDate + "' ";
        List<DeviceDataPushLog> deviceDataPushLogList = jdbcTemplate.query(devicePushLogSql, new BeanPropertyRowMapper<>(DeviceDataPushLog.class));
        for (DeviceDataPushLog deviceDataPushLog : deviceDataPushLogList) {
            ZhDataBatchSyncDO zhDataBatchSyncDO =new ZhDataBatchSyncDO();
            String deviceSN = deviceDataPushLog.getDeviceSn();
            List<Map<String, Object>> list = new ArrayList<>();
            switch (Integer.parseInt(deviceDataPushLog.getDeviceCategory())) {
                case 14:  //气感
                    sql = "select * from base.base_security_monitoring_order where device_sn = '" + deviceSN + "' and topic_item ='preventGasLeakage' and create_time >= '"+startDate+"' and create_time <= '"+endDate+"' ";
                    list = jdbcTemplate.queryForList(sql);
                    zhDataBatchSyncDO.setReporttime(deviceDataPushLog.getCreateTime().toString());
                    zhDataBatchSyncDO.setDevicecode(deviceSN);
                    if (list.size()>0) {
                        zhDataBatchSyncDO.setAlarmCode(list.get(0).get("id").toString());
                        zhDataBatchSyncDO.setMessagetype("2");
                        zhDataBatchSyncDO.setAlarmtype("1");
                        zhDataBatchSyncDO.setAlarmlevel("4");
                        zhDataBatchSyncDO.setName(list.get(0).get("serve_desc").toString());
                    }else {
                        zhDataBatchSyncDO.setMessagetype("1");
                        zhDataBatchSyncDO.setName(deviceDataPushLog.getApiName());
                        zhDataBatchSyncDO.setDataType("2");
                        zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                    }
                    result.add(zhDataBatchSyncDO);
                    break;
                case 15:  //烟感
                    sql = "select * from base.base_security_monitoring_order where device_sn = '" + deviceSN + "' and topic_item ='preventFire' and create_time >= '"+startDate+"' and create_time <= '"+endDate+"' ";
                    list = jdbcTemplate.queryForList(sql);
                    if (list.size()>0) {
                        zhDataBatchSyncDO.setAlarmCode(list.get(0).get("id").toString());
                        zhDataBatchSyncDO.setMessagetype("2");
                        zhDataBatchSyncDO.setAlarmtype("1");
                        zhDataBatchSyncDO.setAlarmlevel("3");
                        zhDataBatchSyncDO.setName(list.get(0).get("serve_desc").toString());
                    }else {
                        zhDataBatchSyncDO.setMessagetype("1");
                        zhDataBatchSyncDO.setName(deviceDataPushLog.getApiName());
                        zhDataBatchSyncDO.setDataType("2");
                        zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                    }
                    result.add(zhDataBatchSyncDO);
                    break;
                case 12: //防跌倒
                    sql = "select * from base.base_security_monitoring_order where device_sn = '" + deviceSN + "' and topic_item ='preventFire' and create_time >= '"+startDate+"' and create_time <= '"+endDate+"' ";
                    list = jdbcTemplate.queryForList(sql);
                    if (list.size()>0) {
                        zhDataBatchSyncDO.setAlarmCode(list.get(0).get("id").toString());
                        zhDataBatchSyncDO.setMessagetype("2");
                        zhDataBatchSyncDO.setAlarmtype("1");
                        zhDataBatchSyncDO.setAlarmlevel("2");
                        zhDataBatchSyncDO.setName(list.get(0).get("serve_desc").toString());
                    }else {
                        zhDataBatchSyncDO.setMessagetype("1");
                        zhDataBatchSyncDO.setName(deviceDataPushLog.getApiName());
                        zhDataBatchSyncDO.setDataType("2");
                        zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                    }
                    result.add(zhDataBatchSyncDO);
                    break;
                case 2:   //血压
                    zhDataBatchSyncDO.setMessagetype("1");
                    zhDataBatchSyncDO.setReporttime(deviceDataPushLog.getCreateTime().toString());
                    zhDataBatchSyncDO.setDataType("2");
                    zhDataBatchSyncDO.setDevicecode(deviceSN);
                    zhDataBatchSyncDO.setName("血压监测");
                    zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                    result.add(zhDataBatchSyncDO);
                    break;
                case 1:   //血糖
                    zhDataBatchSyncDO.setMessagetype("1");
                    zhDataBatchSyncDO.setReporttime(deviceDataPushLog.getCreateTime().toString());
                    zhDataBatchSyncDO.setDataType("2");
                    zhDataBatchSyncDO.setDevicecode(deviceSN);
                    zhDataBatchSyncDO.setName("血糖检测");
                    zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                    result.add(zhDataBatchSyncDO);
                    break;
                case 13:  //睡眠带
                    sql = "";
                    break;
                case 16: //云芯防走失拐杖
                    sql = "select * from base_security_monitoring_order where device_sn = '"+deviceSN+"' and topic_item ='preventLost' and create_time >= '"+startDate+"' and create_time ='"+endDate+"'";
                    list = jdbcTemplate.queryForList(sql);
                    zhDataBatchSyncDO.setDevicecode(deviceSN);
                    zhDataBatchSyncDO.setReporttime(DateUtil.dateToStrLong(deviceDataPushLog.getCreateTime()));
                    if (0<list.size()){
                        zhDataBatchSyncDO.setAlarmCode(list.get(0).get("id").toString());
                        //JSONObject gzObj = JSONObject.parseObject(JSON.toJSONString(list.get(0)));
                        zhDataBatchSyncDO.setMessagetype("2");
                        zhDataBatchSyncDO.setAlarmtype("1");
                        zhDataBatchSyncDO.setAlarmlevel("4");
                        zhDataBatchSyncDO.setName(list.get(0).get("serve_desc").toString());
                    }else {
                        zhDataBatchSyncDO.setMessagetype("1");
                        zhDataBatchSyncDO.setName(deviceDataPushLog.getApiName());
                        zhDataBatchSyncDO.setDataType("2");
                        zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                    }
                    result.add(zhDataBatchSyncDO);
                    break;
                case 4: // 智能手表
                    zhDataBatchSyncDO.setDevicecode(deviceSN);
                    zhDataBatchSyncDO.setReporttime(deviceDataPushLog.getCreateTime().toString());
                    zhDataBatchSyncDO.setAlarmlevel("1");
                    zhDataBatchSyncDO.setMessagetype("1");
                    zhDataBatchSyncDO.setName(deviceDataPushLog.getApiName());
                    zhDataBatchSyncDO.setDataType("2");
                    zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                    result.add(zhDataBatchSyncDO);
                    break;
                case 7: //SOS紧急呼叫器
                    sql = "select * from base_emergency_assistance_order where device_sn = '"+deviceSN+"' and topic_item ='preventLost' and create_time >= '"+startDate+"' and create_time ='"+endDate+"'";
                    list = jdbcTemplate.queryForList(sql);
                    zhDataBatchSyncDO.setDevicecode(deviceSN);
                    zhDataBatchSyncDO.setReporttime(deviceDataPushLog.getCreateTime().toString());
                    if (list.size() > 0) {
                        zhDataBatchSyncDO.setAlarmCode(list.get(0).get("id").toString());
                        zhDataBatchSyncDO.setMessagetype("2");
                        zhDataBatchSyncDO.setName("紧急呼叫");
                        zhDataBatchSyncDO.setAlarmlevel("1");
                        zhDataBatchSyncDO.setAlarmtype("4");
                    }else {
                        zhDataBatchSyncDO.setDataType("2");
                        zhDataBatchSyncDO.setUpdateValue(deviceDataPushLog.getData());
                        zhDataBatchSyncDO.setMessagetype("1");
                    }
                    result.add(zhDataBatchSyncDO);
                    break;
                default:
                    break;
            }
        }
        zhDataBatchSyncDao.save(result);
    }
    @Autowired
    ZhAlarmDealSyncDao zhAlarmDealSyncDao;
    public void alarmDealSync() {
        String date = DateUtil.getStringDateShort();
        String startDate = date + " 00:00:00";
        String endDate = date + " 23:59:59";
        List<ZhAlarmDealSyncDO> result = new ArrayList<>();
        String sql = "SELECT id,status,complete_time,doctor_name,'杭州市拱墅区朝晖街道' AS org_name,serve_desc FROM base_security_monitoring_order WHERE create_time >= '"+startDate+"' AND create_time <= '"+endDate+"' AND device_sn IS NOT NULL \n" +
                "UNION \n" +
                "SELECT id,status,complete_time,doctor_name,org_name,'紧急预警' AS serve_desc FROM base_emergency_assistance_order WHERE create_time >= '"+startDate+"' AND create_time <= '"+endDate+"' AND device_sn IS NOT NULL";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> map : list) {
            ZhAlarmDealSyncDO zhAlarmDealSyncDO = new ZhAlarmDealSyncDO();
            zhAlarmDealSyncDO.setAlarmcode(map.get("id").toString());
            zhAlarmDealSyncDO.setAlarmname("紧急预警");
            switch (Integer.parseInt(map.get("status").toString())) {
                case 0:  //已完成      2 已完成
                    zhAlarmDealSyncDO.setAlarmstatus(2);
                    zhAlarmDealSyncDO.setDealtime(map.get("complete_time").toString());
                    zhAlarmDealSyncDO.setHandler(map.get("doctor_name").toString());
                    zhAlarmDealSyncDO.setDept(map.get("org_name").toString());
                    break;
                case 1:  //预警中      1 处理中
                    zhAlarmDealSyncDO.setAlarmstatus(1);
                    break;
                default:  //3 已关闭
                    zhAlarmDealSyncDO.setAlarmstatus(3);
                    zhAlarmDealSyncDO.setHandler(map.get("doctor_name").toString());
                    zhAlarmDealSyncDO.setDealtime(map.get("update_time").toString());
                    zhAlarmDealSyncDO.setDept(map.get("org_name").toString());
                    zhAlarmDealSyncDO.setExplanation("误报警");
                    break;
            }
            result.add(zhAlarmDealSyncDO);
        }
        zhAlarmDealSyncDao.save(result);
    }
}

+ 1 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/hz/HzInterfaceService.java

@ -74,7 +74,7 @@ public class HzInterfaceService {
                    map.put(consNo,0);
                    BaseDeviceElectricRecordDO recordDO = new BaseDeviceElectricRecordDO();
                    recordDO.setAddress(json.getString("address"));
                    recordDO.setConsNo(json.getString("consNo"));
                    recordDO.setConsNo("330"+json.getString("consNo"));
                    recordDO.setHome(json.getString("home"));
                    recordDO.setLowerLimit(json.getString("lowerLimit"));
                    recordDO.setStatDate(json.getString("statDate"));

+ 11 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/dao/ZhAlarmDealSyncDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.care.zhDevice.dao;
import com.yihu.jw.care.zhDevice.entity.ZhAlarmDealSyncDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wsl on 2022/12/7
 */
public interface ZhAlarmDealSyncDao extends PagingAndSortingRepository<ZhAlarmDealSyncDO, String>, JpaSpecificationExecutor<ZhAlarmDealSyncDO> {
}

+ 12 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/dao/ZhDataBatchSyncDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.care.zhDevice.dao;
import com.yihu.jw.care.zhDevice.entity.ZhDataBatchSyncDO;
import com.yihu.jw.care.zhDevice.entity.ZhDeviceSyncDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wsl on 2022/12/6
 */
public interface ZhDataBatchSyncDao extends PagingAndSortingRepository<ZhDataBatchSyncDO, String>, JpaSpecificationExecutor<ZhDataBatchSyncDO> {
}

+ 121 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/entity/ZhAlarmDealSyncDO.java

@ -0,0 +1,121 @@
package com.yihu.jw.care.zhDevice.entity;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by wsl on 2022/12/7
 */
@Entity
@Table(name = "alarm_deal_sync")
public class ZhAlarmDealSyncDO extends IdEntity {
    /**
     * 告警事件编码
     */
    private String alarmcode;
    /**
     * 告警事件名称
     */
    private String alarmname;
    /**
     * 处置状态 1-处理中,2-已完成(指告警正常处理完成),3-已关闭(指告警因误报等原因不需要后续处理),9-无需处理
     */
    private Integer alarmstatus;
    /**
     * 处置时间
     */
    private String dealtime;
    /**
     * 处置人
     */
    private String handler;
    /**
     * 所属部门
     */
    private String dept;
    /**
     * 修改人
     */
    private String updateUserName;
    /**
     * 处置说明
     */
    private String explanation;
    public String getAlarmcode() {
        return alarmcode;
    }
    public void setAlarmcode(String alarmcode) {
        this.alarmcode = alarmcode;
    }
    public String getAlarmname() {
        return alarmname;
    }
    public void setAlarmname(String alarmname) {
        this.alarmname = alarmname;
    }
    public Integer getAlarmstatus() {
        return alarmstatus;
    }
    public void setAlarmstatus(Integer alarmstatus) {
        this.alarmstatus = alarmstatus;
    }
    public String getDealtime() {
        return dealtime;
    }
    public void setDealtime(String dealtime) {
        this.dealtime = dealtime;
    }
    public String getHandler() {
        return handler;
    }
    public void setHandler(String handler) {
        this.handler = handler;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getExplanation() {
        return explanation;
    }
    public void setExplanation(String explanation) {
        this.explanation = explanation;
    }
}

+ 144 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/entity/ZhDataBatchSyncDO.java

@ -0,0 +1,144 @@
package com.yihu.jw.care.zhDevice.entity;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by wsl on 2022/12/6
 */
@Entity
@Table(name = "data_batch_sync")
public class ZhDataBatchSyncDO extends IdEntity {
    /**
     * devicecode
     */
    private String devicecode;
    /**
     * 1-信息,2-告警
     */
    private String messagetype;
    /**
     * 上报时间 格式:yyyy-mm-dd hh:mm:ss
     */
    private String reporttime;
    /**
     * 标识
     */
    private String topic;
    /**
     * 名称
     */
    private String name;
    /**
     * 告警类型,messagetype=2,3时必填,1-事件告警,2-设备告警,3-其他告警
     */
    private String alarmtype;
    /**
     * 居家状态 messagetype=2,3时必填,1-非 常严重,2-严重,3-较重,4-一般,5-轻微
     */
    private String alarmlevel;
    //messageType=1时必填,0-数值 int,1-布尔boolean,2-字符串 string, 3-数组list,4-时间 date, 6-浮点float,7-枚举 enum
    private String dataType;
    //messageType=2,3时必填。用于区分每一次告警事件和同步告警处理
    private String alarmCode;
    //更新值
    private String updateValue;
    public String getAlarmCode() {
        return alarmCode;
    }
    public void setAlarmCode(String alarmCode) {
        this.alarmCode = alarmCode;
    }
    public String getDataType() {
        return dataType;
    }
    public void setDataType(String dataType) {
        this.dataType = dataType;
    }
    public String getUpdateValue() {
        return updateValue;
    }
    public void setUpdateValue(String updateValue) {
        this.updateValue = updateValue;
    }
    public String getDevicecode() {
        return devicecode;
    }
    public void setDevicecode(String devicecode) {
        this.devicecode = devicecode;
    }
    public String getMessagetype() {
        return messagetype;
    }
    public void setMessagetype(String messagetype) {
        this.messagetype = messagetype;
    }
    public String getReporttime() {
        return reporttime;
    }
    public void setReporttime(String reporttime) {
        this.reporttime = reporttime;
    }
    public String getTopic() {
        return topic;
    }
    public void setTopic(String topic) {
        this.topic = topic;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAlarmtype() {
        return alarmtype;
    }
    public void setAlarmtype(String alarmtype) {
        this.alarmtype = alarmtype;
    }
    public String getAlarmlevel() {
        return alarmlevel;
    }
    public void setAlarmlevel(String alarmlevel) {
        this.alarmlevel = alarmlevel;
    }
}

+ 14 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhylyjkglxt/sql记录.sql

@ -717,3 +717,17 @@ CREATE TABLE `device_sync` (
                               `unified_address_code` varchar(20) NOT NULL COMMENT '政法委统一地 址库编码',
                               PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备基础信息同步';
CREATE TABLE `alarm_deal_sync` (
                                   `id` INT(50) NOT NULL AUTO_INCREMENT,
                                   `alarmCode` varchar(50) NOT NULL COMMENT '告警事件编码',
                                   `alarmName` varchar(50) NOT NULL COMMENT '告警事件名称',
                                   `alarmStatus` INT(2) DEFAULT '' COMMENT '处置状态 1-处理中,2-已完成(指告警正常处理完成),3-已关闭(指告警因误报等原因不需要后续处理),9-无需处理',
                                   `dealTime` varchar(50) DEFAULT NULL COMMENT '处置时间',
                                   `handler` VARCHAR(50) DEFAULT NULL COMMENT '处置人',
                                   `dept` varchar(50) DEFAULT NULL COMMENT '所属部门',
                                   `update_user_name` varchar(50) DEFAULT NULL COMMENT '修改人',
                                   `explanation` VARCHAR DEFAULT NULL COMMENT '处置说明',
                                   PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件处置同步';