Explorar el Código

Merge branch 'dev' of yeshijie/patient-co-management into dev

yeshijie hace 7 años
padre
commit
7018e04fbd

+ 18 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/iot/IotDeviceService.java

@ -152,14 +152,17 @@ public class IotDeviceService {
     * 设备绑定
     * @param patientDevice
     * @param address
     * @param name
     * @param diseaseCondition 病情:0绿标,1黄标,2红标
     * @return
     */
    public String saveDevice(PatientDevice patientDevice,String address,String name){
    public String saveDevice(PatientDevice patientDevice,String address,String name,Integer diseaseCondition){
        JSONObject json = new JSONObject();
        json.put("categoryCode",patientDevice.getCategoryCode());
        json.put("address",address);
        json.put("patient",patientDevice.getUser());
        json.put("patientName",name);
        json.put("diseaseCondition",diseaseCondition);
        json.put("idcard",patientDevice.getUserIdcard());
        json.put("deviceId",patientDevice.getDeviceId());
        json.put("deviceName",patientDevice.getDeviceName());
@ -169,7 +172,7 @@ public class IotDeviceService {
        json.put("agent",patientDevice.getAgent());
        json.put("doctor",patientDevice.getDoctor());
        String url = baseUrl+"/patientDevice/addPatientDevice";
        String url = baseUrl+"wg/patientDevice/addPatientDevice";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("jsonData",json.toString()));
        String response = httpClientUtil.post(url, params, "UTF-8");
@ -404,7 +407,7 @@ public class IotDeviceService {
        List<PatientDevice> list = patientDeviceDao.findAll();
        list.forEach(patientDevice -> {
            Patient patient = patientDao.findByCode(patientDevice.getUser());
            String response = saveDevice(patientDevice,patient.getAddress(),patient.getName());
            String response = saveDevice(patientDevice,patient.getAddress(),patient.getName(),patient.getDiseaseCondition());
            JSONObject re = JSONObject.parseObject(response);
            if(re.getInteger("status")!=200){
                logger.error("id:"+patientDevice.getId()+" "+re.getString("errorMsg"));
@ -412,6 +415,18 @@ public class IotDeviceService {
        });
    }
    /**
     * 测试设备绑定
     * @return
     */
    public String testSaveDevice(){
        List<PatientDevice> list = patientDeviceDao.findAll();
        PatientDevice patientDevice = list.get(0);
        Patient patient = patientDao.findByCode(patientDevice.getUser());
        String response = saveDevice(patientDevice,patient.getAddress(),patient.getName(),patient.getDiseaseCondition());
        return response;
    }
    /**
     * 初始化迁移数据
     * @return

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/iot/IotDeviceController.java

@ -112,6 +112,18 @@ public class IotDeviceController extends BaseController{
        }
    }
    @RequestMapping(value = "/testSaveDevice",method = RequestMethod.POST)
    @ApiOperation("测试设备绑定数据")
    public String testSaveDevice(){
        try {
            return iotDeviceService.testSaveDevice();
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    @RequestMapping(value = "/findById",method = RequestMethod.GET)
    @ApiOperation("按id查询")
    public String findById(@ApiParam(name = "id",value = "id",defaultValue = "LggM5iaSi6u18TUmeDoaeSnyFxntPMA2NPGXBRyPTwFsg+oRn3bHgg==")