LAPTOP-KB9HII50\70708 2 years ago
parent
commit
39fa73b0fc

+ 4 - 4
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientHealthIndex.java

@ -21,11 +21,11 @@ public class DevicePatientHealthIndex extends IdEntity {
	private String user;
	// 干预标志
	private String intervene;
	// 血糖/收缩压/体重/腰围/早餐前空腹
	// 血糖/收缩压/体重/腰围/早餐前空腹/血氧百分比
	private String value1;
	// 舒张压/早餐后空腹/身高
	// 舒张压/早餐后空腹/身高/血氧报警上限
	private String value2;
	// 午餐空腹/BMI
	// 午餐空腹/BMI/血氧报警下限
	private String value3;
	// 午餐后/偏胖-1/正常0/偏瘦1
	private String value4;
@ -36,7 +36,7 @@ public class DevicePatientHealthIndex extends IdEntity {
	// 睡前
	private String value7;
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率,6体温,7呼吸)
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率,6体温,7呼吸,8血氧)
	private Integer type;
	// 记录时间
	private Date recordDate;

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

@ -1,29 +1,22 @@
package com.yihu.jw.care.endpoint;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.device.DeviceDetailDao;
import com.yihu.jw.care.service.DeviceService;
import com.yihu.jw.care.service.YsDeviceService;
import com.yihu.jw.care.util.DeviceDataPushLogUtil;
import com.yihu.jw.entity.care.device.DeviceDetail;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jxl.Sheet;
import jxl.Workbook;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
/**
 * Created with IntelliJ IDEA.
@ -277,6 +270,37 @@ public class DeviceController {
        }
    }
    @ApiOperation("设备血氧接收")
    @RequestMapping(value = "byBloodoxygen",  method = {RequestMethod.POST,RequestMethod.GET})
    public String byBloodoxygen(
            @ApiParam(name="device_type",required = false,value="设备型号",defaultValue = "")
            @RequestParam(value = "device_type",required = true) String device_type,
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
            @ApiParam(name="time_begin_str",required = false,value="时间YYYYmmDDHHMMSS显示(将time_begin按YYYYmmDDHHMMSS格式化,字符串,长度固定14 )",defaultValue = "")
            @RequestParam(value = "time_begin_str",required = true) String time_begin_str,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS",defaultValue = "")
            @RequestParam(value = "time_begin",required = true) String time_begin,
            @ApiParam(name="bloodoxygen",required = false,value="血氧百分比",defaultValue = "")
            @RequestParam(value = "bloodoxygen",required = true) Integer bloodoxygen,
            @ApiParam(name="bloodoxygen_h",required = false,value="血氧报警上限")
            @RequestParam(value = "bloodoxygen_h",required = false) Integer bloodoxygen_h,
            @ApiParam(name="bloodoxygen_l",required = false,value="血氧报警下限")
            @RequestParam(value = "bloodoxygen_l",required = false) Integer bloodoxygen_l,
            HttpServletRequest request) {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂血氧接收,请求参数:\n"+paraString);
            dataPushLogUtil.savePushLog(imei,paraString,"爱牵挂设备血氧数据接收");
            deviceService.byBloodoxygen(device_type, imei, time_begin_str, time_begin, bloodoxygen, bloodoxygen_h, bloodoxygen_l);
            dataPushLogUtil.updContactStatus(imei,1,false);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    /*******************************************睡眠带begin****************************************************************/
    @ApiOperation("爱牵挂-睡眠带睡眠接收")
    @RequestMapping(value = "bySleep",  method = {RequestMethod.POST,RequestMethod.GET})

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

@ -10,7 +10,6 @@ import com.yihu.jw.care.util.*;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.*;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -29,7 +28,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -37,7 +35,6 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import javax.servlet.http.HttpServletRequest;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -766,6 +763,40 @@ public class DeviceService {
        }
    }
    //设备血氧接收
    @Async
    public void byBloodoxygen(String device_type,String imei,String time_begin_str,String time_begin
            ,Integer bloodoxygen,Integer bloodoxygen_h,Integer bloodoxygen_l) {
        try {
            if(StringUtils.isNotBlank(imei)) {
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(imei);
                if (devicePatientDeviceDos.size() > 0) {
                    DevicePatientDevice devicePatientDevice = devicePatientDeviceDos.get(0);
                    BasePatientDO patientDO = patientDao.findById(devicePatientDevice.getUser());
                    DevicePatientHealthIndex patientHealthIndex = new DevicePatientHealthIndex();
                    patientHealthIndex.setName(patientDO.getName());
                    patientHealthIndex.setDeviceSn(imei);
                    patientHealthIndex.setUser(devicePatientDevice.getUser());
                    patientHealthIndex.setIdcard(devicePatientDevice.getUserIdcard());
                    patientHealthIndex.setValue1(bloodoxygen + "");
                    patientHealthIndex.setValue2(bloodoxygen_h + "");
                    patientHealthIndex.setValue3(bloodoxygen_l + "");
                    patientHealthIndex.setType(8);
                    Date recordDate = DateUtil.strToDate(time_begin);
                    patientHealthIndex.setRecordDate(recordDate);
                    patientHealthIndex.setSortDate(recordDate);
                    patientHealthIndex.setCzrq(new Date());
                    patientHealthIndex.setStatus(0);
                    patientHealthIndex.setDel("1");
                    healthIndexDao.save(patientHealthIndex);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     *
     * @param device

+ 32 - 0
svr/svr-cloud-transfor/src/main/java/com/yihu/jw/care/controller/TransforController.java

@ -256,6 +256,38 @@ public class TransforController {
        }
    }
    @ApiOperation("设备血氧接收")
    @RequestMapping(value = "byBloodoxygen",  method = {RequestMethod.POST,RequestMethod.GET})
    public String byBloodoxygen(
            @ApiParam(name="device_type",required = false,value="设备型号",defaultValue = "")
            @RequestParam(value = "device_type",required = true) String device_type,
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
            @ApiParam(name="time_begin_str",required = false,value="时间YYYYmmDDHHMMSS显示(将time_begin按YYYYmmDDHHMMSS格式化,字符串,长度固定14 )",defaultValue = "")
            @RequestParam(value = "time_begin_str",required = true) String time_begin_str,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS",defaultValue = "")
            @RequestParam(value = "time_begin",required = true) String time_begin,
            @ApiParam(name="bloodoxygen",required = false,value="血氧百分比",defaultValue = "")
            @RequestParam(value = "bloodoxygen",required = true) Integer bloodoxygen,
            @ApiParam(name="bloodoxygen_h",required = false,value="血氧报警上限")
            @RequestParam(value = "bloodoxygen_h",required = false) Integer bloodoxygen_h,
            @ApiParam(name="bloodoxygen_l",required = false,value="血氧报警下限")
            @RequestParam(value = "bloodoxygen_l",required = false) Integer bloodoxygen_l,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = RequestParamUtil.getParamUrl(request);
            String result = aqgService.aqgForward(url,imei);
            long endTime=System.currentTimeMillis();
            logger.info("设备血氧接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    /*******************************************睡眠带begin****************************************************************/
    @ApiOperation("爱牵挂-睡眠带睡眠接收")
    @RequestMapping(value = "bySleep",  method = {RequestMethod.POST,RequestMethod.GET})