Browse Source

锦旗查询修改

wangjun 4 years ago
parent
commit
7fcbfbfde3

+ 7 - 4
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -45,6 +45,7 @@ import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.slf4j.LoggerFactory;
@ -1688,14 +1689,16 @@ public class ImService {
					baseUserMessageDO.setUpdateTime(new Date());
					baseUserMessageDO.setIsRead(0);
					userMessageDao.save(baseUserMessageDO);
					if (org.apache.commons.lang3.StringUtils.isNoneBlank(bannerList)){
						String str[]=bannerList.split(",");
						for (int i=0;i<bannerList.length();i++){
					if (!StringUtils.isEmpty(bannerList)){
						System.out.println("-------");
						System.out.println(bannerList);
						String[] str=bannerList.split(",");
						for (int i=0;i<str.length;i++){
							BaseBannerDoctorDO bannerDoctorDO = new BaseBannerDoctorDO();
							bannerDoctorDO.setCreateTime(new Date());
							bannerDoctorDO.setUpdateTime(new Date());
							bannerDoctorDO.setPatientId(baseUserMessageDO.getSender());
							bannerDoctorDO.setRelationName(baseUserMessageDO.getSenderName());
							bannerDoctorDO.setPatientName(baseUserMessageDO.getSenderName());
							bannerDoctorDO.setDoctor(baseUserMessageDO.getReceiver());
							bannerDoctorDO.setDoctorName(baseUserMessageDO.getReceiverName());
							bannerDoctorDO.setBannerId(str[i]);

+ 31 - 21
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -3,6 +3,7 @@ package com.yihu.iot.service.monitorPlatform;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.equipment.IotEquipmentDetailDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.iot.service.device.IotPatientDeviceService;
@ -57,6 +58,8 @@ public class MonitorPlatformService  {
    private IotEquipmentDetailDao iotEquipmentDetailDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    /**
     * 获取位置信息
@ -142,34 +145,41 @@ public class MonitorPlatformService  {
        params.put("area",area);
        params.put("hospital",hospital);
        String anotherResult = sendGet(url,params);
        JSONObject jsonObject = JSONObject.parseObject(anotherResult);
        if("200".equals(jsonObject.get("status").toString())){
            JSONArray dataresult= jsonObject.getJSONArray("data");
            JSONArray resultArray = new JSONArray();
            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 ";
            List<Map<String, Object>> iotEquip = hibenateUtils.createSQLQuery(sqlAre);
            if (dataresult.size()>0){
                for(int i=0;i<dataresult.size();i++){
                    JSONObject item= JSONObject.parseObject(dataresult.get(i).toString());
                    if(null!=item.get("num")){
                        Integer itemCount = Integer.parseInt(item.get("num").toString());
                        for(Map<String, Object> map:iotEquip){
                            if (item.get("code").toString().equals(map.get("belong_are_code"))){
                                itemCount = Integer.parseInt(map.get("total").toString())+itemCount;
                                item.put("num",itemCount);
        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 ";
        List<Map<String, Object>> iotEquip = hibenateUtils.createSQLQuery(sqlAre);
        if("8"==deviceType){
           return iotEquip.toString();
        }else {
            JSONObject jsonObject = JSONObject.parseObject(anotherResult);
            if("200".equals(jsonObject.get("status").toString())){
                JSONArray dataresult= jsonObject.getJSONArray("data");
                JSONArray resultArray = new JSONArray();
                if (dataresult.size()>0){
                    for(int i=0;i<dataresult.size();i++){
                        JSONObject item= JSONObject.parseObject(dataresult.get(i).toString());
                        if(null!=item.get("num")){
                            Integer itemCount = Integer.parseInt(item.get("num").toString());
                            for(Map<String, Object> map:iotEquip){
                                if (item.get("code").toString().equals(map.get("belong_are_code"))){
                                    itemCount = Integer.parseInt(map.get("total").toString())+itemCount;
                                    item.put("num",itemCount);
                                }
                            }
                        }
                        resultArray.add(item);
                    }
                    resultArray.add(item);
                }
                jsonObject.replace("data",resultArray);
                System.out.println(jsonObject.toString());
            }
            jsonObject.replace("data",resultArray);
            System.out.println(jsonObject.toString());
            return jsonObject.toString();
        }
        return jsonObject.toString();
    }
    /*private String dealSql(Map<String, Object> params){
        StringBuffer sql = new StringBuffer();
        sql.append()
    }*/
    /**
     * 慢病患者情况-统计