Browse Source

代码修改

LAPTOP-KB9HII50\70708 1 year ago
parent
commit
c18726a5a0

+ 0 - 15
common/common-entity/src/db/2023.sql

@ -339,21 +339,6 @@ CREATE TABLE `wlyy_patient_health_standard` (
  UNIQUE KEY `idx_wlyy_patient_health_standard_1` (`patient`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=134944 DEFAULT CHARSET=utf8mb4 COMMENT='患者健康指标预警值';
CREATE TABLE `hm_token` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '业务无关主键',
  `patient` varchar(50) NOT NULL COMMENT 'i健康patient',
  `access_token` varchar(255) DEFAULT NULL COMMENT '华米token',
  `refresh_token` varchar(255) DEFAULT NULL,
  `token_type` varchar(50) DEFAULT NULL COMMENT 'token类型',
  `expires_in` varchar(50) DEFAULT NULL COMMENT 'token有效期',
  `create_time` varchar(50) DEFAULT NULL,
  `user_id` varchar(255) DEFAULT NULL COMMENT '华米端id',
  `gender` int(2) DEFAULT NULL COMMENT '华米端性别',
  `nick_name` varchar(255) DEFAULT NULL COMMENT '华米端用户昵称',
  `avatar` varchar(255) DEFAULT NULL COMMENT '头像地址',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COMMENT='华米token信息表';
CREATE TABLE `dm_device_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '业务无关主键',

+ 4 - 66
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/DeviceUploadService.java

@ -14,13 +14,10 @@ import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.module.health.controller.Result;
import com.yihu.jw.hospital.utils.CountDistance;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.utils.DeviceDataPushLogUtil;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import com.yihu.jw.utils.StringUtil;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
@ -57,17 +54,11 @@ public class DeviceUploadService {
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private HealthIndexUtil healthIndexUtil;
    @Autowired
    private ImUtil imUtil;
    @Autowired
    private CountDistance countDistance;
    @Autowired
    private GpsUtil gpsUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DeviceDataPushLogUtil dataPushLogUtil;
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    public Result uploadDevicesData(String dataJson, HttpServletRequest request)throws Exception {
        try {
@ -129,6 +120,7 @@ public class DeviceUploadService {
            }
            dataPushLogUtil.savePushLog(deviceSn,paraString,"体征数据接收");
            dataPushLogUtil.updContactStatus(deviceSn,1,false);
            dsyyEntranceService.pushIotDeviceDataInfo(result.getId());
            //保存消息
            BasePatientDO patientDO = patientDao.findById(result.getUser()).orElse(null);
            if (null != patientDO){
@ -144,61 +136,7 @@ public class DeviceUploadService {
                        break;
                }
                if (StringUtils.isNotBlank(typeName)){
/*                    String adminSql = "SELECT py_code FROM wlyy_hospital_sys_dict WHERE dict_name = 'pushOnOff' AND dict_code ='"+6+"' ";
                    String onOff= jdbcTemplate.queryForObject(adminSql,String.class);
                    Boolean kg = Boolean.parseBoolean(onOff);
                    String patientOnOffSql = "select on_off from base_patient_pad_pushonoff where patient = '" + patientDO.getId() + "' and type = 3";
                    Integer integer = jdbcTemplate.queryForObject(patientOnOffSql,Integer.class);
                    if (kg&&integer==0?false:true) {
                        messageDO.setTitle(typeName);
                        messageDO.setType("42");//42体征设备测量
                        messageDO.setSender("system");
                        messageDO.setSenderName("养护助手");
                        messageDO.setRelationCode(result.getId() + "");
                        messageDO.setReceiver(patientDO.getId());
                        messageDO.setReceiverName(patientDO.getName());
//                        messageDO.setUserType(1);
                        messageDO.setOver("1");
                        messageDO.setCode(type);//与体征类型对应
                        JSONArray errorIndex = healthIndexUtil.verifyHealthIndex(Integer.parseInt(type), result.getValue1(), result.getValue2(),
                                result.getValue3(), result.getValue4(), result.getValue5(), result.getValue6(),
                                result.getValue7());
                        messageDO.setData(JSON.toJSONString(errorIndex, SerializerFeature.WriteNullStringAsEmpty));
                        messageDO.setDel("1");
                        messageDO.setCreateTime(new Date());
                        //推送socket
                        com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
                        message.put("title", typeName);
                        message.put("code", messageDO.getCode());
                        message.put("content", messageDO.getData());
                        message.put("relation_code", messageDO.getRelationCode());
                        message.put("content_type", 42);
                        message.put("content_notice", "");
//                        message.put("audioUrl", url);
                        String content_notice = "";
                        for (int i = 0; i < errorIndex.size(); i++) {
                            com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                            if (0 != tmp.getInteger("error")) {
                                result.setStatus(1);
                            }
                            if (1 == tmp.getInteger("error")) {
                                content_notice += tmp.getString("indexName") + "、";
                            }
                        }
                        if (StringUtils.isNotBlank(content_notice)) {
                            content_notice = content_notice.substring(0, content_notice.length() - 1);
                            message.put("content_notice", "您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1", content_notice));
                            messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1", content_notice));
                            dataPushLogUtil.updContactStatus(deviceSn, 1, true);
                        } else {
                            dataPushLogUtil.updContactStatus(deviceSn, 1, false);
                        }
                        patientHealthIndexDao.save(result);
                        systemMessageDao.save(messageDO);
                        imUtil.sendPatientSystemMessage(messageDO.getReceiver(), JSON.toJSONString(message, SerializerFeature.WriteMapNullValue));
                    }*/
                }
            }
        } catch (Exception e) {