瀏覽代碼

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

shikejing 3 年之前
父節點
當前提交
9870efc4b4

+ 7 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java

@ -135,7 +135,7 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
    }
    @ApiOperation("获取设备详情数据 --设备可多人绑定查询数据时与patient无关")
    @RequestMapping(value = "getPatientDeviceData",method = RequestMethod.GET)
    @GetMapping(value = "getPatientDeviceData")
    public Envelop getPatientDeviceData(@ApiParam(name="patient")
                                       @RequestParam(value = "patient")String patient,
                                       @ApiParam(name="deviceSN")
@ -146,7 +146,12 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "pageSize")Integer pageSize){
        try {
            return success(patientDeviceService.getPatientDeviceData(patient,deviceSn,page,pageSize));
            org.json.JSONObject result = patientDeviceService.getPatientDeviceData(patient,deviceSn,page,pageSize);
            if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
                return success(JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            }else {
                return success(result.getString(ResponseContant.resultMsg), -1);
            }
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }

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

@ -945,11 +945,21 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    dataSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(dataSql);
                    devInfoObj.put("data", dataList);
                    String ssql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1 AND status = 1 ";
                    String bloodPressureSql = ssql + " AND type = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(bloodPressureSql);
                    devInfoObj.put("bloodPressure",dataList); //血压
                    break;
                case "2"://血糖设备
                    dataSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1 ";
                    dataSql += " ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(dataSql);
                    devInfoObj.put("data", dataList);
                    devInfoObj.put("data", dataList);    //血糖数据
                    recordSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1  AND status = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(recordSql);
                    devInfoObj.put("bloodSugar", dataList);          //血糖异常数据
                    break;
                case "4"://手表 围栏与轨迹
                    if (StringUtils.isBlank(day)) {
@ -1012,9 +1022,9 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        List<DevicePatientDevice> devices = patientDeviceDao.findByDeviceSn(deviceSn);
        if (devices.size()>0){
            DevicePatientDevice device = devices.get(0);
            if (!patient.equals(device.getUser())){
                throw new Exception("居民未绑定该设备");
            }else{
//            if (!patient.equals(device.getUser())){
//                throw new Exception("居民未绑定该设备");
//            }else{
                switch (device.getCategoryCode()){
                    case "1"://血压设备
                        result = getHealthIndex(result,1,deviceSn,patient,page,pageSize);
@ -1026,10 +1036,12 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                        result  = getEmeWarn(result,deviceSn,null,page,pageSize);
                        break;
                }
            }
//            }
        }else {
            throw new Exception("设备未被绑定");
        }
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,JSON.toJSONString(result,SerializerFeature.WriteMapNullValue));
        return result;
    }