Browse Source

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

liubing 2 years ago
parent
commit
099a14b422

+ 132 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DoctorDeviceController.java

@ -9,6 +9,7 @@ import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.care.service.device.DeviceManageService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientHealthIndexService;
import com.yihu.jw.care.useragent.UserAgent;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.patient.BaseDeviceRepairEntity;
@ -17,15 +18,13 @@ import com.yihu.jw.restmodel.web.PageEnvelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -51,6 +50,8 @@ public class DoctorDeviceController extends BaseController {
	private ContactsService contactsService;
	@Autowired
	UserAgent userAgent;
	@Autowired
	private PatientHealthIndexService healthIndexService;
	private ObjectMapper  objectMapper=new ObjectMapper();
@ -314,4 +315,131 @@ public class DoctorDeviceController extends BaseController {
		}
	}
	@GetMapping(value = "getHealthIndexInfoWithAvg")
	@ApiOperation("获取居民心率波动和呼吸频率--带平均值(医生端)")
	public String getHealthIndexInfoWithAvg(@ApiParam(name="patient",value="患者代码",defaultValue = "eb0b478fbe9245428ecf63cd7517206f")
											@RequestParam(value="patient",required = false) String patient,
											@ApiParam(name="type",value="健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率,6体温,7呼吸)",defaultValue = "1")
											@RequestParam(value="type",required = true) Integer type,
											@ApiParam(name="gi_type",value="就餐类型",defaultValue = "0")
											@RequestParam(value = "gi_type",required = false,defaultValue = "0") Integer gi_type,
											@ApiParam(name="begin",value="开始时间",defaultValue = "2021-10-20 00:00:00")
											@RequestParam(value="begin",required = true) String begin,
											@ApiParam(name="end",value="结束时间",defaultValue = "2021-10-21 00:00:00")
											@RequestParam(value="end",required = true) String end,
											@ApiParam(name = "deviceSn",required = false)
											@RequestParam(value = "deviceSn",required = false) String deviceSn){
		try {
			//医生端登录鉴权
			JSONObject jsonObject = new JSONObject();
			jsonObject.put("doctorId",permissionService.getUID());
			if (permissionService.noPermission(1, jsonObject)) {
				return error(-1,"该操作没有权限");
			}
			return write(200,"查询成功","data",healthIndexService.findChartByPatientWithAvg(patient,type,gi_type,begin,end,deviceSn));
		}catch (Exception e){
			return errorResult(e);
		}
	}
	@ApiOperation("获取睡眠带睡眠报告")
	@RequestMapping(value ="getSleepReport",method = RequestMethod.GET)
	public String getSleepReport(@ApiParam(name="patient")@RequestParam(value = "patient",required = false)String patient,
								 @ApiParam(name="deviceSn")@RequestParam(value = "deviceSn",required = false)String deviceSn,
								 @ApiParam(name="day")@RequestParam(value = "day",required = false)String day){
		try {
			//医生端登录鉴权
			JSONObject jsonObject = new JSONObject();
			jsonObject.put("doctorId",permissionService.getUID());
			if (permissionService.noPermission(1, jsonObject)) {
				return error(-1,"该操作没有权限");
			}
			if (StringUtils.isBlank(patient)&&StringUtils.isBlank(deviceSn)){
				return error(-1,"请求参数");
			}
			org.json.JSONObject result = patientDeviceService.getSleepReport(patient,deviceSn,day);
			if (ResponseContant.success==result.getInt(ResponseContant.resultFlag)){
				return write(200,"获取成功","data",result.get(ResponseContant.resultMsg));
			}else {
				return error(-1,result.getString(ResponseContant.resultMsg));
			}
		}catch (Exception e){
			return errorResult(e);
		}
	}
	@ApiOperation("获取患者手表睡眠质量(医生端)")
	@RequestMapping(value = "getX1SleepInfo", method = RequestMethod.GET)
	public String getX1SleepInfo(@ApiParam(name = "patient") @RequestParam(value = "patient", required = false) String patient,
								 @ApiParam(name = "deviceSn") @RequestParam(value = "deviceSn", required = false) String deviceSn,
								 @ApiParam(name = "day") @RequestParam(value = "day", required = false) String day) {
		try {
			//医生端登录鉴权
			JSONObject jsonObject = new JSONObject();
			jsonObject.put("doctorId",permissionService.getUID());
			if (permissionService.noPermission(1, jsonObject)) {
				return error(-1,"该操作没有权限");
			}
			if (StringUtils.isBlank(patient) && StringUtils.isBlank(deviceSn)) {
				return write(-1,"请求参数");
			}
			org.json.JSONObject result = patientDeviceService.getX1SleepInfo(patient, deviceSn, day);
			if (ResponseContant.success == result.getInt(ResponseContant.resultFlag)) {
				return write(200,"获取成功","data", result.get(ResponseContant.resultMsg));
			} else {
				return write(-1,result.getString(ResponseContant.resultMsg));
			}
		} catch (Exception e) {
			return errorResult(e);
		}
	}
	@ApiOperation("获取患者手表步数数据(医生端)")
	@RequestMapping(value = "getPatientStep", method = RequestMethod.GET)
	public String getPatientStep(@ApiParam(name = "patient") @RequestParam(value = "patient", required = false) String patient,
								 @ApiParam(name = "deviceSn") @RequestParam(value = "deviceSn", required = false) String deviceSn,
								 @ApiParam(name = "day") @RequestParam(value = "day", required = false) String day) {
		try {
			//医生端登录鉴权
			JSONObject jsonObject = new JSONObject();
			jsonObject.put("doctorId",permissionService.getUID());
			if (permissionService.noPermission(1, jsonObject)) {
				return error(-1,"该操作没有权限");
			}
			if (StringUtils.isBlank(patient) && StringUtils.isBlank(deviceSn)) {
				return write(-1,"请求参数");
			}
			org.json.JSONObject result = patientDeviceService.getPatientStep(patient, deviceSn, day);
			if (ResponseContant.success == result.getInt(ResponseContant.resultFlag)) {
				return write(200,"获取成功","data", result.get(ResponseContant.resultMsg));
			} else {
				return write(-1,result.getString(ResponseContant.resultMsg));
			}
		} catch (Exception e) {
			return errorResult(e);
		}
	}
	@ApiOperation("获取烟雾/燃气浓度列表(医生端)")
	@RequestMapping(value = "getSmokeOrGasList", method = RequestMethod.GET)
	public String getSmokeOrGasList(@ApiParam(name = "deviceSn") @RequestParam(value = "deviceSn", required = true) String deviceSn,
										 @ApiParam(name = "day", value = "yyyy-MM-dd") @RequestParam(value = "day", required = false) String day) {
		try {
			//医生端登录鉴权
			JSONObject jsonObject = new JSONObject();
			jsonObject.put("doctorId",permissionService.getUID());
			if (permissionService.noPermission(1, jsonObject)) {
				return error(-1,"该操作没有权限");
			}
			return write(200,"获取成功","list", patientDeviceService.getSmokeOrGasList(deviceSn, day));
		} catch (Exception e) {
			return errorResult(e);
		}
	}
}

+ 110 - 7
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java

@ -15,9 +15,7 @@ import com.yihu.jw.entity.care.device.BaseSleepPlan;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.entity.ServiceException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -27,10 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashMap;
@ -62,6 +57,8 @@ public class PatientDeviceController extends BaseController {
    DeviceManageService deviceManageService;
    @Autowired
    PermissionService permissionService;
    @Autowired
    private PatientHealthIndexService healthIndexService;
@ -466,9 +463,15 @@ public class PatientDeviceController extends BaseController {
            if (StringUtils.isBlank(patient)&&StringUtils.isBlank(deviceSn)){
                return error(-1,"请求参数");
            }
            //居民端登录鉴权
            com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
            jsonObject.put("patient",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return write(-1,"该操作没有权限");
            }
            JSONObject result = patientDeviceService.getSleepReport(patient,deviceSn,day);
            if (ResponseContant.success==result.getInt(ResponseContant.resultFlag)){
                return write(200,"获取成功","data",result.getJSONObject(ResponseContant.resultMsg));
                return write(200,"获取成功","data",result.get(ResponseContant.resultMsg));
            }else {
                return error(-1,result.getString(ResponseContant.resultMsg));
            }
@ -522,4 +525,104 @@ public class PatientDeviceController extends BaseController {
        }
    }
    @GetMapping(value = "getHealthIndexInfoWithAvg")
    @ApiOperation("获取居民心率波动和呼吸频率--带平均值(居民端)")
    public String getHealthIndexInfoWithAvg(@ApiParam(name="patient",value="患者代码",defaultValue = "eb0b478fbe9245428ecf63cd7517206f")
                                            @RequestParam(value="patient",required = false) String patient,
                                            @ApiParam(name="type",value="健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率,6体温,7呼吸)",defaultValue = "1")
                                            @RequestParam(value="type",required = true) Integer type,
                                            @ApiParam(name="gi_type",value="就餐类型",defaultValue = "0")
                                            @RequestParam(value = "gi_type",required = false,defaultValue = "0") Integer gi_type,
                                            @ApiParam(name="begin",value="开始时间",defaultValue = "2021-10-20 00:00:00")
                                            @RequestParam(value="begin",required = true) String begin,
                                            @ApiParam(name="end",value="结束时间",defaultValue = "2021-10-21 00:00:00")
                                            @RequestParam(value="end",required = true) String end,
                                            @ApiParam(name = "deviceSn",required = false)
                                            @RequestParam(value = "deviceSn",required = false) String deviceSn){
        try {
            //居民端登录鉴权
            com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
            jsonObject.put("patient",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return write(-1,"该操作没有权限");
            }
            return write(200,"查询成功","data",healthIndexService.findChartByPatientWithAvg(patient,type,gi_type,begin,end,deviceSn));
        }catch (Exception e){
            return errorResult(e);
        }
    }
    @ApiOperation("获取患者手表睡眠质量(居民端)")
    @RequestMapping(value = "getX1SleepInfo", method = RequestMethod.GET)
    public String getX1SleepInfo(@ApiParam(name = "patient") @RequestParam(value = "patient", required = false) String patient,
                                     @ApiParam(name = "deviceSn") @RequestParam(value = "deviceSn", required = false) String deviceSn,
                                     @ApiParam(name = "day") @RequestParam(value = "day", required = false) String day) {
        try {
            //居民端登录鉴权
            com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
            jsonObject.put("patient",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return write(-1,"该操作没有权限");
            }
            if (StringUtils.isBlank(patient) && StringUtils.isBlank(deviceSn)) {
                return write(-1,"请求参数");
            }
            org.json.JSONObject result = patientDeviceService.getX1SleepInfo(patient, deviceSn, day);
            if (ResponseContant.success == result.getInt(ResponseContant.resultFlag)) {
                return write(200,"获取成功","data", result.get(ResponseContant.resultMsg));
            } else {
                return write(-1,result.getString(ResponseContant.resultMsg));
            }
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @ApiOperation("获取患者手表步数数据(居民端)")
    @RequestMapping(value = "getPatientStep", method = RequestMethod.GET)
    public String getPatientStep(@ApiParam(name = "patient") @RequestParam(value = "patient", required = false) String patient,
                                     @ApiParam(name = "deviceSn") @RequestParam(value = "deviceSn", required = false) String deviceSn,
                                     @ApiParam(name = "day") @RequestParam(value = "day", required = false) String day) {
        try {
            //居民端登录鉴权
            com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
            jsonObject.put("patient",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return write(-1,"该操作没有权限");
            }
            if (StringUtils.isBlank(patient) && StringUtils.isBlank(deviceSn)) {
                return write(-1,"请求参数");
            }
            org.json.JSONObject result = patientDeviceService.getPatientStep(patient, deviceSn, day);
            if (ResponseContant.success == result.getInt(ResponseContant.resultFlag)) {
                return write(200,"获取成功","data", result.get(ResponseContant.resultMsg));
            } else {
                return write(-1,result.getString(ResponseContant.resultMsg));
            }
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @ApiOperation("获取烟雾/燃气浓度列表(居民端)")
    @RequestMapping(value = "getSmokeOrGasList", method = RequestMethod.GET)
    public String getSmokeOrGasList(@ApiParam(name = "deviceSn") @RequestParam(value = "deviceSn", required = true) String deviceSn,
                                    @ApiParam(name = "day", value = "yyyy-MM-dd") @RequestParam(value = "day", required = false) String day) {
        try {
            //居民端登录鉴权
            com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
            jsonObject.put("patient",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return write(-1,"该操作没有权限");
            }
            return write(200,"获取成功","list", patientDeviceService.getSmokeOrGasList(deviceSn, day));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
}