Explorar o código

锦旗查询修改

wangjun %!s(int64=4) %!d(string=hai) anos
pai
achega
63239dccb5

+ 3 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java

@ -174,12 +174,12 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
            //sql.append(" and t.update_time > '" + beginTime+"'");//DateUtil.stringToDate(beginTime,"yyyy-MM-dd HH:mm:ss")
            if ("xm_ykyy_wx".equals(wxId)) {
                if (flag){
                    sql.append( " and t.create_time >= str_to_date('" + beginTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                    sql.append( " and t.update_time >= str_to_date('" + beginTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                }else {
                    sql.append(  " and t.create_time >= to_date('" + beginTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                    sql.append(  " and t.update_time >= to_date('" + beginTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                }
            } else {
                sql.append( " AND t.create_time >='" + beginTime + " 00:00:00'");
                sql.append( " AND t.update_time >='" + beginTime + " 00:00:00'");
            }
        }

+ 19 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/equipment/IotEqtDetailService.java

@ -61,12 +61,27 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
        }
    }
    public JSONObject showJKXW(){
    public JSONObject showJKXW(String startTime,String endTime,String area,String sn){
        JSONObject result = new JSONObject();
        List<IotEquipmentDetailDO> equipmentList= iotEquipmentDetailDao.getAllEquipment();
        if (equipmentList.size()>=0){
            result.put("equipmentList",equipmentList);
        Map<String,Object> params = new HashedMap();
        String sql = "select t.id as \"id\",t.device_name as \"device_name\"" +
                ",t.device_code as \"device_code\",t.longitude as \"longitude\",t.latitude as \"latitude\"" +
                ",t.create_time as \"create_time\" from iot_equipmet_detail where 1=1 ";
        if (StringUtils.isNoneBlank(startTime)){
            sql+=" AND t.create_time >=:startTime";
            params.put("startTime", DateUtil.stringToDate(startTime,"yyyy-MM-dd HH:mm:ss"));
        }
        if (StringUtils.isNoneBlank(startTime)){
            sql+=" AND t.create_time <=:endTime";
            params.put("endTime", DateUtil.stringToDate(endTime,"yyyy-MM-dd HH:mm:ss"));
        }
        if (StringUtils.isNoneBlank(area)){
            sql+=" AND t.belong_are_code =:area";
            params.put("area", area);
        }
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sql,params);
        result.put("equipmentDetails",total);
        List<Map<String, Object>> areCount = iotEquipmentDetailDao.getAllEquipmentCountByAre();
        if (areCount.size()>=0){
            result.put("areEquipmentCount",areCount);

+ 60 - 87
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -9,7 +9,6 @@ import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.iot.service.device.IotPatientDeviceService;
import com.yihu.iot.service.equipment.IotEqtDetailService;
import com.yihu.iot.service.label.FigureLabelSerachService;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.iot.util.excel.hibernate.HibenateUtils;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.http.HttpClientUtil;
@ -43,6 +42,12 @@ public class MonitorPlatformService  {
    private String appid;
    @Value("${spring.wlyy.appsecret}")
    private String appSecret;
    @Value("${wechat.id}")
    private String wxId;
    @Value("${wechat.flag}")
    private boolean flag;
    public static Map<String,String> tokenMap = new HashMap<>();
    @Autowired
@ -54,13 +59,13 @@ public class MonitorPlatformService  {
    @Autowired
    private FigureLabelSerachService figureLabelSerachService;
    @Autowired
    private IotEqtDetailService iotEqtDetailService;
    @Autowired
    private IotEquipmentDetailDao iotEquipmentDetailDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @Autowired
    private IotEqtDetailService iotEqtDetailService;
    /**
     * 获取位置信息
@ -146,10 +151,10 @@ public class MonitorPlatformService  {
        params.put("area",area);
        params.put("hospital",hospital);
        String anotherResult = sendGet(url,params);
        String sqlAre = "select count(1) AS \"total\",t.belong_are AS \"belong_are\",t.belong_are_code AS \"belong_are_code\" from iot_equipmet_detail t group by t.belong_are_code order by \"total\" desc ";
        String sqlAre = dealSql(params);
        List<Map<String, Object>> iotEquip = hibenateUtils.createSQLQuery(sqlAre);
        if("8"==deviceType){
           return iotEquip.toString();
            return iotEquip.toString();
        }else {
            JSONObject jsonObject = JSONObject.parseObject(anotherResult);
            if("200".equals(jsonObject.get("status").toString())){
@ -177,10 +182,40 @@ public class MonitorPlatformService  {
            return jsonObject.toString();
        }
    }
    /*private String dealSql(Map<String, Object> params){
    private String dealSql(Map<String, Object> params){
        StringBuffer sql = new StringBuffer();
        sql.append()
    }*/
        sql.append("select count(1) AS \"total\",t.belong_are AS \"belong_are\",t.belong_are_code AS \"belong_are_code\" from iot_equipmet_detail t ");
        sql.append(" where 1=1 ");
        if (null!=params.get("area")){
            sql.append(" and t.belong_are = '"+params.get("area").toString()+"'");
        }
        if (null!=params.get("startTime")) {
            //sql.append(" and t.update_time > '" + beginTime+"'");//DateUtil.stringToDate(beginTime,"yyyy-MM-dd HH:mm:ss")
            if ("xm_ykyy_wx".equals(wxId)) {
                if (flag){
                    sql.append( " and t.create_time >= str_to_date('" + params.get("startTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                }else {
                    sql.append(  " and t.create_time >= to_date('" + params.get("startTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                }
            } else {
                sql.append( " AND t.create_time >='" + params.get("startTime").toString() + " 00:00:00'");
            }
        }
        if (null!=params.get("endTime")) {
            //sql.append(" and t.update_time < '" + endTime+"'");//DateUtil.stringToDate(endTime,"yyyy-MM-dd HH:mm:ss")
            if ("xm_ykyy_wx".equals(wxId)) {
                if (flag){
                    sql.append( " and t.create_time <= str_to_date('" + params.get("endTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                }else {
                    sql.append(  " and t.create_time <= to_date('" + params.get("endTime").toString() + " 00:00:00','YYYY-MM-DD HH24:MI:SS')");
                }
            } else {
                sql.append( " AND t.create_time <='" + params.get("endTime").toString() + " 00:00:00'");
            }
        }
        sql.append(" group by t.belong_are_code order by \"total\" desc ");
        return sql.toString();
    }
    /**
     * 慢病患者情况-统计
@ -474,80 +509,18 @@ public class MonitorPlatformService  {
        String response = sendGet(url,params);
        JSONObject json = JSONObject.parseObject(response);
        if(json.getInteger("status")==200){
            IotSystemDictDO iotSystemDictDO = iotSystemDictDao.findByDictNameAndValueAndDel("DEVICE_TYPE","健康小屋",1);
            JSONArray jsonArray = json.getJSONArray("data");
            String[] str =deviceType.split(",");
            List<String> list = new ArrayList<>();
            for (int i=0;i<str.length;i++){
                list.add(str[i]);
            }
            if (iotSystemDictDO!=null){
                if (!list.contains(iotSystemDictDO.getCode())){
                    for (int i=0;i<jsonArray.size();i++){
                        JSONObject jo = jsonArray.getJSONObject(i);
                        String tmp = jo.getString("type");
                        if("1".equals(tmp)){
                            jo.put("typeName","血糖仪");
                        }else if("2".equals(tmp)){
                            jo.put("typeName","血压计");
                        }else if("3".equals(tmp)){
                            jo.put("typeName","智能药盒");
                        }else if("4".equals(tmp)){
                            jo.put("typeName","智能手表");
                        }
                    }
                }else {
                    if (jsonArray!=null&&jsonArray.size()!=0){
                        for (int i=0;i<jsonArray.size();i++){
                            JSONObject jo = jsonArray.getJSONObject(i);
                            String tmp = jo.getString("type");
                            if("1".equals(tmp)){
                                jo.put("typeName","血糖仪");
                            }else if("2".equals(tmp)){
                                jo.put("typeName","血压计");
                            }else if("3".equals(tmp)){
                                jo.put("typeName","智能药盒");
                            }else if("4".equals(tmp)){
                                jo.put("typeName","智能手表");
                            }
                        }
                        if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)){
                            JSONObject jsonObject= new JSONObject();
                            jsonObject.put("type",iotSystemDictDO.getCode());
                            jsonObject.put("typeName",iotSystemDictDO.getValue());
                            jsonObject.put("signNum",0);
                            jsonObject.put("unSignNum",0);
                            jsonArray.add(jsonObject);
                        }else {
                            Long count = iotEqtDetailService.findCountByHealthHourse(startTime,endTime,area);
                            JSONObject jsonObject= new JSONObject();
                            jsonObject.put("type",iotSystemDictDO.getCode());
                            jsonObject.put("typeName",iotSystemDictDO.getValue());
                            jsonObject.put("signNum",count);
                            jsonObject.put("unSignNum",0);
                            jsonArray.add(jsonObject);
                        }
                    }else {
                        if (org.apache.commons.lang3.StringUtils.isNoneBlank(hospital)){
                            jsonArray = new JSONArray();
                            JSONObject jsonObject= new JSONObject();
                            jsonObject.put("type",iotSystemDictDO.getCode());
                            jsonObject.put("typeName",iotSystemDictDO.getValue());
                            jsonObject.put("signNum",0);
                            jsonObject.put("unSignNum",0);
                            jsonArray.add(jsonObject);
                        }else {
                            Long count = iotEqtDetailService.findCountByHealthHourse(startTime,endTime,area);
                            jsonArray = new JSONArray();
                            JSONObject jsonObject= new JSONObject();
                            jsonObject.put("type",iotSystemDictDO.getCode());
                            jsonObject.put("typeName",iotSystemDictDO.getValue());
                            jsonObject.put("signNum",count);
                            jsonObject.put("unSignNum",0);
                            jsonArray.add(jsonObject);
                        }
                    }
            for (int i=0;i<jsonArray.size();i++){
                JSONObject jo = jsonArray.getJSONObject(i);
                String tmp = jo.getString("type");
                if("1".equals(tmp)){
                    jo.put("typeName","血糖仪");
                }else if("2".equals(tmp)){
                    jo.put("typeName","血压计");
                }else if("3".equals(tmp)){
                    jo.put("typeName","智能药盒");
                }else if("4".equals(tmp)){
                    jo.put("typeName","智能手表");
                }
            }
@ -647,7 +620,7 @@ public class MonitorPlatformService  {
     * @return
     */
    public JSONObject totalRange(String startTime,String endTime,
                                                 String deviceType,String area,String hospital,String quotaCode){
                                 String deviceType,String area,String hospital,String quotaCode){
        String url = "/wlyygc/iot_monitoring/totalRange";
        Map<String, Object> params = new HashMap<>();
        params.put("startTime",startTime);
@ -674,7 +647,7 @@ public class MonitorPlatformService  {
     * @return
     */
    public JSONObject diseaseUseRange(String startTime,String endTime,
                                String deviceType,String area,String hospital){
                                      String deviceType,String area,String hospital){
        String url = "/wlyygc/iot_monitoring/diseaseUseRange";
        Map<String, Object> params = new HashMap<>();
        params.put("startTime",startTime);
@ -700,7 +673,7 @@ public class MonitorPlatformService  {
     * @return
     */
    public JSONObject diseaseRange(String startTime,String endTime,
                                     String deviceType,String area,String hospital){
                                   String deviceType,String area,String hospital){
        String url = "/wlyygc/iot_monitoring/diseaseRange";
        Map<String, Object> params = new HashMap<>();
        params.put("startTime",startTime);
@ -727,7 +700,7 @@ public class MonitorPlatformService  {
     * @return
     */
    public JSONObject yellowOrRedRange(String startTime,String endTime,
                                  String deviceType,String area,String hospital,Integer diseaseCondition){
                                       String deviceType,String area,String hospital,Integer diseaseCondition){
        String url = "/wlyygc/iot_monitoring/yellowOrRedRange";
        Map<String, Object> params = new HashMap<>();
        params.put("startTime",startTime);
@ -756,7 +729,7 @@ public class MonitorPlatformService  {
     * @return
     */
    public JSONArray warningInformationAlarm_new(Integer page,Integer pageSize,String startTime,String endTime,
                                                  String deviceType,String area,String hospital){
                                                 String deviceType,String area,String hospital){
        String url = "/wlyygc/iot_monitoring/warningInformationAlarm_new";
        Map<String, Object> params = new HashMap<>();
        params.put("page",page);
@ -785,7 +758,7 @@ public class MonitorPlatformService  {
     * @return
     */
    public JSONObject yellowAndRedRange(String startTime,String endTime,
                                                 String deviceType,String area,String hospital){
                                        String deviceType,String area,String hospital){
        String url = "/wlyygc/iot_monitoring/yellowAndRedRange";
        Map<String, Object> params = new HashMap<>();
        params.put("startTime",startTime);