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

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

chinawu123 2 éve
szülő
commit
ee621ca637

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

@ -2129,3 +2129,20 @@ CREATE TABLE `base_daily_report_verify` (
  `del` tinyint(2) DEFAULT NULL COMMENT '1有效0无效',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='员工日报核实人指定表';
CREATE TABLE `base_yujing_dict` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `dict_name` varchar(50) DEFAULT NULL COMMENT '所属字典',
  `dict_code` varchar(300) DEFAULT NULL COMMENT '字典项代码',
  `dict_value` text COMMENT '字典项所属值',
  `sort` int(11) DEFAULT NULL COMMENT '排序',
  `del` int(2) DEFAULT NULL COMMENT '是否可用',
  `hospital` varchar(50) DEFAULT NULL COMMENT '归属社区CODE',
  `create_time` date DEFAULT NULL,
  `model_name` varchar(50) DEFAULT NULL COMMENT '模块名称',
  PRIMARY KEY (`id`),
  KEY `dict_name` (`dict_name`),
  KEY `hospital` (`hospital`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='预警状态字典';

+ 133 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseYujingDict.java

@ -0,0 +1,133 @@
package com.yihu.jw.entity.base.dict;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by wsl on 2022/8/12
 */
@Entity
@Table(name = "base_yujing_dict")
public class BaseYujingDict extends IdEntity {
    /**
     * 所属字典
     */
    private String dictName;
    /**
     * 字典项代码
     */
    private String dictCode;
    /**
     * 字典项所属值
     */
    private String dictValue;
    /**
     * 排序
     */
    private Integer sort;
    /**
     * 是否可用
     */
    private Integer del;
    /**
     * 归属社区code
     */
    private String hospital;
    /**
     * create_time
     */
    private Date createTime;
    /**
     * 模块名称
     */
    private String modelName;
    @Column(name = "dict_name")
    public String getDictName() {
        return dictName;
    }
    public void setDictName(String dictName) {
        this.dictName = dictName;
    }
    @Column(name = "dict_code")
    public String getDictCode() {
        return dictCode;
    }
    public void setDictCode(String dictCode) {
        this.dictCode = dictCode;
    }
    @Column(name = "dict_value")
    public String getDictValue() {
        return dictValue;
    }
    public void setDictValue(String dictValue) {
        this.dictValue = dictValue;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "model_name")
    public String getModelName() {
        return modelName;
    }
    public void setModelName(String modelName) {
        this.modelName = modelName;
    }
}

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

@ -19,6 +19,7 @@ import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.util.CountDistance;
import com.yihu.jw.care.util.Point;
import com.yihu.jw.entity.base.dict.BaseYujingDict;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.BaseSleepPlan;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
@ -39,6 +40,7 @@ import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@ -734,6 +736,13 @@ public class PatientInfoPlatFormService {
        return list;
    }
    private String dict(List<BaseYujingDict> dictList,String code){
        for (BaseYujingDict yujingDict : dictList) {
            if (code.equals(yujingDict.getDictCode())) return yujingDict.getDictValue();
        }
        return null;
    }
    /**
     * 获取设备关联数据
     * 手表4:电量、佩戴状态、是否预警、在线状态
@ -747,6 +756,11 @@ public class PatientInfoPlatFormService {
     * 血糖1:最近一次血糖、在线状态
     */
    public Map<String,Object> getDeviceIndexAndOrder(String category_code,String deviceSn,String patient,String filterTime){
        String dictSql = "SELECT * from base_yujing_dict where del =1";
        List<BaseYujingDict> dictList = jdbcTemplate.query(dictSql, new BeanPropertyRowMapper<>(BaseYujingDict.class));
        String zwsj = dict(dictList, "ty2");
        String dictCode = "";
        String beforeTime = "";
        String afterTime = "";
        boolean bl = false;//是否进行时间范围查询
@ -860,9 +874,19 @@ public class PatientInfoPlatFormService {
                pageSql =bl?" and record_date >= '"+beforeTime+"' and record_date <= '"+afterTime+"'  ORDER BY sort_date DESC limit 1 ": " ORDER BY sort_date DESC LIMIT 1 ";
                sqlResult = jdbcTemplate.queryForList(sql+pageSql);
                if (sqlResult.size()>0){
                    Integer xl = Integer.parseInt(sqlResult.get(0).get("value1").toString());
                    if (xl>=50&&xl<=100) {
                        dictCode= "xl1";
                    }else if (xl<50){
                        dictCode="xl2";
                    }else if (xl>100){
                        dictCode="xl3";
                    }
                    sqlResult.get(0).put("value1_status",dict(dictList,dictCode));
                    detailInfo.put("heartRate",sqlResult.get(0));
                }else {
                    detailInfo.put("heartRate","无心率数据");
                    detailInfo.put("heartRate",zwsj);
                }
                //获取手表定位
                JSONObject dw = patientDeviceService.getAqgDeviceInfo2(deviceSn);
@ -887,12 +911,12 @@ public class PatientInfoPlatFormService {
                            double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
                            double homeDistance = countDistance.getDistance(homeLat,homeLon,lat,lon);
                            if (homeDistance * 1000 > 50) {
                                detailInfo.put("isAtHome","离家");
                                detailInfo.put("isAtHome",dict(dictList,"ty1"));
                            }else {
                                detailInfo.put("isAtHome","居家");
                                detailInfo.put("isAtHome",dict(dictList,"ty4"));
                            }
                        }else {
                            detailInfo.put("isAtHome","");
                            detailInfo.put("isAtHome",zwsj);
                        }
                        detailInfo.put("location", tmp);
                    }
@ -991,12 +1015,32 @@ public class PatientInfoPlatFormService {
                            }
                            if (response.getBooleanValue("onbed")) {//当前在床状态
                                detailInfo.put("bedStatus", 1);
                                detailInfo.put("heartRate", response.getString("heartrate"));
                                detailInfo.put("breath", response.getString("breathrate"));
                                Integer heartRate = response.getInteger("heartrate");
                                Integer breath = response.getInteger("breathrate");
                                dictCode = "";
                                if (heartRate > 100) {
                                    dictCode = "xl3";
                                } else if (heartRate < 50) {
                                    dictCode = "xl2";
                                } else if (heartRate >= 50 && heartRate <= 100) {
                                    dictCode = "xl1";
                                }
                                detailInfo.put("heartRate", heartRate);
                                detailInfo.put("breath", breath);
                                detailInfo.put("heartRate_status",dict(dictList,dictCode));
                                if (breath > 100) {
                                    dictCode = "xl3";
                                } else if (breath < 50) {
                                    dictCode = "xl2";
                                } else if (breath >= 50 && breath <= 100) {
                                    dictCode = "xl1";
                                }
                                detailInfo.put("breath_status",dict(dictList,dictCode));
                            } else {
                                detailInfo.put("bedStatus", 0);
                                detailInfo.put("heartRate", null);
                                detailInfo.put("breath", null);
                                detailInfo.put("heartRate", zwsj);
                                detailInfo.put("breath", zwsj);
                            }
                        }
                    }
@ -1035,10 +1079,11 @@ public class PatientInfoPlatFormService {
                pageSql =bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc  limit 1  ": " ORDER BY create_time desc limit 1  ";
                sqlResult = jdbcTemplate.queryForList(sql+pageSql);
                if (sqlResult.size()>0){
                    detailInfo.put("warnStatus",true);
                    //烟雾浓度
                    detailInfo.put("value1_Status",dict(dictList,"yg1"));
                    detailInfo.put("orderInfo",sqlResult.get(0));
                }else {
                    detailInfo.put("warnStatus",false);
                    detailInfo.put("value1_Status",dict(dictList,"yg2"));
                }
                //获取最新一次烟雾浓度
                if(bl){
@ -1060,11 +1105,18 @@ public class PatientInfoPlatFormService {
                    sql = " select temperature_value ,record_time as temperature_value_record_time  from base_device_health_index where device_sn='"+deviceSn+"' and temperature_value is not null  ORDER BY record_time desc limit 1 ";
                }
                sqlResult = jdbcTemplate.queryForList(sql);
                dictCode ="";
                if (sqlResult.size()>0){
                    if (Integer.parseInt(sqlResult.get(0).get("temperature_value").toString())<50) {
                        dictCode = "yg4";
                    }else {
                        dictCode = "yg3";
                    }
                    detailInfo.putAll(sqlResult.get(0));
                }
                else {
                    detailInfo.put("temperature_status",dict(dictList,dictCode));
                } else {
                    detailInfo.put("temperature_value",0);
                    detailInfo.put("temperature_status",zwsj);
                    detailInfo.put("temperature_value_record_time",null);
                }

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

@ -220,7 +220,7 @@ public class DeviceLostMessageUtil {
                messageDO.setDel("1");
                messageDO.setCreateTime(new Date());
                messageDO.setSenderPhoto(patient.get("photo").toString());
                messageDO.setAudioUrl(audioUrl(content));
                messageDO.setAudioUrl(audioUrl(sContent));
                messageDOS.add(messageDO);
                //socket推送