|
@ -6,10 +6,12 @@ import com.yihu.wlyy.service.third.iot.IotDeviceService;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
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.RestController;
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -34,7 +36,7 @@ public class IotDeviceController extends BaseController{
|
|
js.put("device_name","血压计-康为A206G");
|
|
js.put("device_name","血压计-康为A206G");
|
|
js.put("device_model","血压计-康为A206G");
|
|
js.put("device_model","血压计-康为A206G");
|
|
js.put("idcard","350429198905194016");
|
|
js.put("idcard","350429198905194016");
|
|
js.put("username","邹林");
|
|
|
|
|
|
js.put("username","小李");
|
|
js.put("manufacture_code","");
|
|
js.put("manufacture_code","");
|
|
js.put("manufacture_name","");
|
|
js.put("manufacture_name","");
|
|
js.put("owner_org_code","");
|
|
js.put("owner_org_code","");
|
|
@ -55,6 +57,20 @@ public class IotDeviceController extends BaseController{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "/upload",method = RequestMethod.POST)
|
|
|
|
@ApiOperation("体征数据上传")
|
|
|
|
public String upload(@ApiParam(name = "jsonStr",value = "jsonStr",defaultValue = "")
|
|
|
|
@RequestParam(value = "jsonStr",required = true) String jsonStr){
|
|
|
|
try {
|
|
|
|
JSONObject json = JSONObject.parseObject(jsonStr);
|
|
|
|
String re = iotDeviceService.upload(json);
|
|
|
|
return write(200, "体征数据上传成功!", "data", re);
|
|
|
|
}catch (Exception e){
|
|
|
|
error(e);
|
|
|
|
return error(-1, e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upload1",method = RequestMethod.POST)
|
|
@RequestMapping(value = "/upload1",method = RequestMethod.POST)
|
|
@ApiOperation("不含居民身份的数据上传协议")
|
|
@ApiOperation("不含居民身份的数据上传协议")
|
|
public String upload1(){
|
|
public String upload1(){
|
|
@ -64,8 +80,13 @@ public class IotDeviceController extends BaseController{
|
|
|
|
|
|
js.put("measure_time","2018-01-01 01:01:01");
|
|
js.put("measure_time","2018-01-01 01:01:01");
|
|
js.put("systolic","111");
|
|
js.put("systolic","111");
|
|
|
|
js.put("systolic_unit","mmHg");
|
|
js.put("diastolic","60");
|
|
js.put("diastolic","60");
|
|
|
|
js.put("diastolic_unit","mmHg");
|
|
js.put("pulse","66");
|
|
js.put("pulse","66");
|
|
|
|
js.put("pulse_unit","bpm");
|
|
|
|
js.put("del","1");
|
|
|
|
js.put("status","0");
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
JSONArray jsonArray = new JSONArray();
|
|
jsonArray.add(js);
|
|
jsonArray.add(js);
|
|
@ -77,7 +98,7 @@ public class IotDeviceController extends BaseController{
|
|
|
|
|
|
|
|
|
|
String re = iotDeviceService.upload(json);
|
|
String re = iotDeviceService.upload(json);
|
|
return write(200, "注册设备成功!", "data", re);
|
|
|
|
|
|
return write(200, "上传成功!", "data", re);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
return error(-1, e.getMessage());
|
|
return error(-1, e.getMessage());
|
|
@ -85,25 +106,27 @@ public class IotDeviceController extends BaseController{
|
|
}
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upload2",method = RequestMethod.POST)
|
|
@RequestMapping(value = "/upload2",method = RequestMethod.POST)
|
|
@ApiOperation("不含居民身份的数据上传协议")
|
|
|
|
|
|
@ApiOperation("含居民身份的数据上传协议")
|
|
public String upload2(){
|
|
public String upload2(){
|
|
try {
|
|
try {
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
JSONObject js = new JSONObject();
|
|
JSONObject js = new JSONObject();
|
|
js.put("measure_time","2018-01-01 11:01:01");
|
|
js.put("measure_time","2018-01-01 11:01:01");
|
|
js.put("blood_sugar","6.7");
|
|
js.put("blood_sugar","6.7");
|
|
|
|
js.put("blood_sugar_unit","mmol/L");
|
|
|
|
js.put("del","1");
|
|
|
|
js.put("status","0");
|
|
JSONArray jsonArray = new JSONArray();
|
|
JSONArray jsonArray = new JSONArray();
|
|
jsonArray.add(js);
|
|
jsonArray.add(js);
|
|
json.put("data",jsonArray);
|
|
json.put("data",jsonArray);
|
|
json.put("data",jsonArray);
|
|
|
|
json.put("sn","2638234828");
|
|
json.put("sn","2638234828");
|
|
json.put("ext_code","1");
|
|
json.put("ext_code","1");
|
|
json.put("device_name","血压计-康为A206G");
|
|
json.put("device_name","血压计-康为A206G");
|
|
json.put("device_model","血压计-康为A206G");
|
|
json.put("device_model","血压计-康为A206G");
|
|
json.put("idcard","350429198905194016");
|
|
json.put("idcard","350429198905194016");
|
|
json.put("username","邹林");
|
|
|
|
|
|
json.put("username","小李");
|
|
String re = iotDeviceService.upload(json);
|
|
String re = iotDeviceService.upload(json);
|
|
return write(200, "注册设备成功!", "data", re);
|
|
|
|
|
|
return write(200, "上传成功!", "data", re);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
return error(-1, e.getMessage());
|
|
return error(-1, e.getMessage());
|