Prechádzať zdrojové kódy

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/jw2.0 into dev

Conflicts:
	svr/svr-iot/src/main/resources/application.yml
yeshijie 7 rokov pred
rodič
commit
5a1d46c726

+ 1 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/third/wlyy/MonitoringHealthPlatformController.java

@ -11,8 +11,6 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 远程监测健康平台-访问wlyy
 * @author yeshijie on 2018/2/11.
@ -38,7 +36,7 @@ public class MonitoringHealthPlatformController extends BaseController{
    @GetMapping(value = IotRequestMapping.PatientDevice.findLocationByIdCard)
    @ApiOperation(value = "根据idCard查询设备地址", notes = "根据idCard查询设备地址")
    public Envelop<List<LocationDataVO>> findDeviceLocationsByIdCard(
    public Envelop<LocationDataVO> findDeviceLocationsByIdCard(
            @ApiParam(name = "diseaseCondition", value = "病情:0绿标,1黄标,2红标,-1没有标注的居民", defaultValue = "")
            @RequestParam(value = "diseaseCondition",required = false) Integer diseaseCondition,
            @ApiParam(name = "type", value = "1高血压 2糖尿病", defaultValue = "")

+ 2 - 2
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/product/ProductService.java

@ -28,7 +28,7 @@ import java.util.Map;
public class ProductService extends BaseService {
//    @Value("ehr.metadata.domain")
    private String version = "5a6feb15fb05";//版本
    private String version = "59083976eebd";//版本
    private String reference = "000000065a965615966b3a40c86ceba7";//标准来源
    /**
@ -130,7 +130,7 @@ public class ProductService extends BaseService {
    public Envelop<IotProductVO> findByCode(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Product.FindProductById, params,getLoginHeader());
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Product.FindProductById, params);
        Envelop<IotProductVO> envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }

+ 25 - 16
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/third/wlyy/MonitoringHealthService.java

@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -45,8 +44,9 @@ public class MonitoringHealthService extends BaseService{
     * @param diseaseCondition
     * @return
     */
    public Envelop<List<LocationDataVO>> findDeviceLocations(Integer diseaseCondition,Integer page,Integer size,String type) throws IOException {
        Envelop<List<LocationDataVO>> envelop = null;
    public Envelop<LocationDataVO> findDeviceLocations(Integer diseaseCondition,Integer page,Integer size,String type) throws IOException {
        Envelop<LocationDataVO> envelop = new Envelop<>();
        Envelop<LocationDataVO> envelopTmp = null;
        JSONArray jsonArray = new JSONArray();
        Integer total = 0;
        if(StringUtils.isNotBlank(type)){
@ -57,14 +57,26 @@ public class MonitoringHealthService extends BaseService{
                total = data.getInteger("total");
                JSONArray list = data.getJSONArray("list");
                for(int i=0;i<list.size();i++){
                    JSONArray jsonArrayTemp = new JSONArray();
                    JSONObject deviceSn = new JSONObject();
                    deviceSn.put("andOr","or");
                    deviceSn.put("field","deviceSn");
                    deviceSn.put("condition","=");
                    deviceSn.put("value",list.getString(i));
                    jsonArray.add(deviceSn);
                    jsonArrayTemp.add(deviceSn);
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("filter",jsonArray);
                    jsonObject.put("page",page);
                    jsonObject.put("size",size);
                    Map<String, Object> params = new HashMap<>();
                    params.put("jsonData", jsonObject.toString());
                    HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.PatientDevice.findLocationByIdCard, params);
                    envelopTmp = objectMapper.readValue(response.getBody(),Envelop.class);
                    envelop.getDetailModelList().addAll(envelopTmp.getDetailModelList());
                }
            }
            envelop.setTotalCount(total);
            return envelop;
        }else {
            //查找全部
            if(diseaseCondition!=null){
@ -75,19 +87,16 @@ public class MonitoringHealthService extends BaseService{
                json.put("value",diseaseCondition);
                jsonArray.add(json);
            }
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("filter",jsonArray);
            jsonObject.put("page",page);
            jsonObject.put("size",size);
            Map<String, Object> params = new HashMap<>();
            params.put("jsonData", jsonObject.toString());
            HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.PatientDevice.findLocationByIdCard, params);
            envelop = objectMapper.readValue(response.getBody(),Envelop.class);
            return envelop;
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("filter",jsonArray);
        jsonObject.put("page",page);
        jsonObject.put("size",size);
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonObject.toString());
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.PatientDevice.findLocationByIdCard, params);
        envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        if(envelop.getTotalCount()==0){
            envelop.setTotalCount(total);
        }
        return envelop;
    }
    /**

+ 1 - 3
common/common-fegin/src/main/java/com/yihu/jw/fegin/fallbackfactory/iot/device/IotPatientDeviceFallbackFactory.java

@ -11,8 +11,6 @@ import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
 * @author yeshijie on 2018/2/8.
 */
@ -113,7 +111,7 @@ public class IotPatientDeviceFallbackFactory implements FallbackFactory<IotPatie
            }
            @Override
            public Envelop<List<LocationDataVO>> findDeviceLocationsByIdCard(
            public Envelop<LocationDataVO> findDeviceLocationsByIdCard(
                    @RequestParam(value = "jsonData",required = true) String jsonData) {
                tracer.getCurrentSpan().logEvent("查询设备地址失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);

+ 1 - 3
common/common-fegin/src/main/java/com/yihu/jw/fegin/iot/device/IotPatientDeviceFeign.java

@ -13,8 +13,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
 * @author yeshijie on 2018/2/8.
 */
@ -68,5 +66,5 @@ public interface IotPatientDeviceFeign{
            @RequestParam(value = "sim",required = true) String sim);
    @GetMapping(value = IotRequestMapping.PatientDevice.findLocationByIdCard)
    public Envelop<List<LocationDataVO>> findDeviceLocationsByIdCard(@RequestParam(value = "jsonData",required = true) String jsonData);
    public Envelop<LocationDataVO> findDeviceLocationsByIdCard(@RequestParam(value = "jsonData",required = true) String jsonData);
}

+ 9 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/Envelop.java

@ -154,4 +154,13 @@ public class Envelop<T> extends BaseEnvelop implements Serializable {
        envelop.setStatus(200);
        return envelop;
    }
    public static Envelop getSuccessList(String message, List objList,Integer total) {
        Envelop envelop = new Envelop();
        envelop.setSuccessMsg(message);
        envelop.setDetailModelList(objList);
        envelop.setTotalCount(total);
        envelop.setStatus(200);
        return envelop;
    }
}

+ 11 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/LocationDataVO.java

@ -29,6 +29,9 @@ public class LocationDataVO extends SaveModel {
    @ApiModelProperty("设备绑定时间")
    private String deviceTime;
    @ApiModelProperty("疾病标签:0无,1高血压,2糖尿病,3高血压糖尿病都有")
    private String label;
    @ApiModelProperty("病情:0绿标,1黄标,2红标")
    private Integer diseaseCondition;
@ -95,5 +98,13 @@ public class LocationDataVO extends SaveModel {
        GeoPoint geoPoint = new GeoPoint(lat, lng);
        this.location = geoPoint;
    }
    public String getLabel() {
        return label;
    }
    public void setLabel(String label) {
        this.label = label;
    }
}

+ 7 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java

@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
 * @author yeshijie on 2018/2/8.
@ -92,7 +93,7 @@ public class IotPatientDeviceController extends EnvelopRestController{
            List<IotPatientDeviceDO> list = iotPatientDeviceService.findByPatientAndDeviceSn(patient,deviceSn);
            //DO转VO
            List<IotPatientDeviceVO> iotPatientDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotPatientDeviceVO.class);
            return Envelop.getSuccess(IotRequestMapping.Device.message_success_create,iotPatientDeviceVOList);
            return Envelop.getSuccessList(IotRequestMapping.Device.message_success_create,iotPatientDeviceVOList);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
@ -201,7 +202,11 @@ public class IotPatientDeviceController extends EnvelopRestController{
                                                                     @RequestParam(value = "jsonData",required = true) String jsonData) {
        try {
            List<LocationDataVO> list = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonData);
            return Envelop.getSuccess(IotRequestMapping.Device.message_success_create,list,iotPatientDeviceService.getESCount(jsonData));
            Random random = new Random();
            list.forEach(one->{
                one.setLabel(random.nextInt(4)+"");
            });
            return Envelop.getSuccessList(IotRequestMapping.Device.message_success_create,list,iotPatientDeviceService.getESCount(jsonData));
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -105,7 +105,7 @@ public class IotProductController extends EnvelopRestController {
                size = 10;
            }
//            String filters = "supplierId="+companyId+";productClassify=1;del=1";
            String filters = "supplierId="+companyId+";del=1";
            String filters = "companyId="+companyId+";del=1";
            String semicolon = ";";
            if(StringUtils.isNotBlank(name)){
                filters += semicolon + "name?"+name;

+ 6 - 9
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java

@ -176,7 +176,7 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
     */
    public Envelop<IotDeviceVO> queryPage(String sn,String hospital,String orderId,String purcharseId,Integer page,Integer size) throws Exception{
        String filters = "";
        String semicolon = "";
        String semicolon = "del=1;";
        if(StringUtils.isNotBlank(orderId)){
            filters += semicolon +"orderId="+orderId;
            semicolon = ";";
@ -190,12 +190,9 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
            semicolon = ";";
        }
        if(StringUtils.isNotBlank(sn)){
            filters = "deviceSn?"+sn+" g1;name?"+sn+" g1";
            filters += semicolon + "deviceSn?"+sn+" g1;name?"+sn+" g1";
            semicolon = ";";
        }
        if(StringUtils.isBlank(filters)){
            filters+= semicolon + "del=1";
        }
        String sorts = "-updateTime";
        //得到list数据
        List<IotDeviceDO> list = search(null, filters, sorts, page, size);
@ -240,8 +237,8 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
            args.add(orderId);
        }
        if(StringUtils.isNotBlank(purcharseId)){
            sql.append(" and c.purcharse_id = ? ");
            sqlCount.append(" and c.purcharse_id = '").append(purcharseId).append("'");
            sql.append(" and c.purchase_id = ? ");
            sqlCount.append(" and c.purchase_id = '").append(purcharseId).append("'");
            args.add(purcharseId);
        }
        if(StringUtils.isNotBlank(hospital)){
@ -334,8 +331,8 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(purcharseId)){
            sql.append(" and c.purcharse_id=? ");
            sqlCount.append(" and c.purcharse_id='").append(purcharseId).append("' ");
            sql.append(" and c.purchase_id=? ");
            sqlCount.append(" and c.purchase_id='").append(purcharseId).append("' ");
            args.add(purcharseId);
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);

+ 1 - 3
web-gateway/src/main/java/com/yihu/jw/controller/iot/device/IotPatientDeviceController.java

@ -14,8 +14,6 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author yeshijie on 2018/2/8.
 */
@ -116,7 +114,7 @@ public class IotPatientDeviceController extends EnvelopRestController{
    @GetMapping(value = IotRequestMapping.PatientDevice.findLocationByIdCard)
    @ApiOperation(value = "根据idCard查询设备地址", notes = "根据idCard查询设备地址")
    public Envelop<List<LocationDataVO>> findDeviceLocationsByIdCard(@ApiParam(name = "jsonData", value = "jsonData", defaultValue = "")
    public Envelop<LocationDataVO> findDeviceLocationsByIdCard(@ApiParam(name = "jsonData", value = "jsonData", defaultValue = "")
                                                                     @RequestParam(value = "jsonData",required = true) String jsonData) {
        return iotPatientDeviceFeign.findDeviceLocationsByIdCard(jsonData);
    }