فهرست منبع

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java
wangjun 4 سال پیش
والد
کامیت
5f87986e9c

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

@ -1702,7 +1702,7 @@ public class ImService {
							bannerDoctorDO.setDoctor(baseUserMessageDO.getReceiver());
							bannerDoctorDO.setDoctorName(baseUserMessageDO.getReceiverName());
							bannerDoctorDO.setBannerId(str[i]);
							bannerDoctorDO.setRelationCode(baseEvaluateDO.getRelationCode());
							bannerDoctorDO.setRelationCode(consult);
							if(consultTeamDo.getType()==1||15==consultTeamDo.getType()){
								bannerDoctorDO.setRelationType(3);
								bannerDoctorDO.setRelationName("专家咨询");
@ -1723,7 +1723,7 @@ public class ImService {
			consultTeamDao.save(consultTeamDo);
			
			ConsultDo consultDo = consultDao.findOne(consult);
			
			//如果是复诊咨询,或者协同门诊,则修改成已评价
			if(9 == consultDo.getType() || 12 == consultDo.getType() || 16 == consultDo.getType() ){
				WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(consultTeamDo.getRelationCode());
@ -1780,7 +1780,7 @@ public class ImService {
			return null;
		}else{
			Map<String,Object> map = new HashMap<>();
			String sql = "select b.name AS \"name\",b.img AS \"img\" from base_banner_doctor a LEFT JOIN base_banner b on a.banner_id= b.id where a.relation_code = '"+consult+"'";
			String sql = "select b.id AS \"id\", b.name AS \"name\",b.img AS \"img\" from base_banner_doctor a LEFT JOIN base_banner b on a.banner_id= b.id where a.relation_code = '"+consult+"'";
			List<Map<String,Object>> bannerlist=hibenateUtils.createSQLQuery(sql);
			map.put("bannerList",bannerlist);
			scoreList.add(map);

+ 7 - 3
svr/svr-iot/src/main/java/com/yihu/iot/controller/equipment/IotEquipmentController.java

@ -64,9 +64,13 @@ public class IotEquipmentController extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.IotEquipmentManage.getEquipmentAndCount)
    @ApiOperation(value = "查询设备和数量")
    public Envelop getCountAndEquipment(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception{
        JSONObject jsonObject =iotEqtDetailService.showJKXW();
            @ApiParam(name = "startTime", value = "startTime", required = false)
            @RequestParam(value = "startTime", required = false)String startTime,
            @ApiParam(name = "endTime", value = "endTime", required = false)
            @RequestParam(value = "endTime", required = false)String endTime,
    @ApiParam(name = "area", value = "area", required = false)
            @RequestParam(value = "area", required = false)String area) throws Exception{
        JSONObject jsonObject =iotEqtDetailService.showJKXW(startTime,endTime,area);
        return success(jsonObject);
    }
}

+ 0 - 4
svr/svr-iot/src/main/java/com/yihu/iot/dao/equipment/IotEquipmentDetailDao.java

@ -13,9 +13,5 @@ import java.util.Map;
public interface IotEquipmentDetailDao extends PagingAndSortingRepository<IotEquipmentDetailDO, String>, JpaSpecificationExecutor<IotEquipmentDetailDO> {
    @Query(value = "select * from iot_equipment_detail t",nativeQuery = true)
    List<IotEquipmentDetailDO> getAllEquipment();
    @Query(value = "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 ",nativeQuery = true)
    List<Map<String, Object>> getAllEquipmentCountByAre();
    @Query(value = "select count(1) AS \"total\" from iot_equipment_detail t ",nativeQuery = true)
    List<Map<String, Object>> getAllEquipmentTotalCount();
}

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

@ -61,32 +61,43 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
        }
    }
    public JSONObject showJKXW(String startTime,String endTime,String area,String sn){
    public JSONObject showJKXW(String startTime,String endTime,String area){
        JSONObject result = new JSONObject();
        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 ";
                ",t.create_time as \"create_time\" from iot_equipmet_detail t where 1=1 ";
        StringBuffer areCountSql = new StringBuffer();
        StringBuffer totalCount = new StringBuffer();
        totalCount.append("select count(1) AS \"total\" from iot_equipmet_detail t where 1=1");
        areCountSql.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 where 1=1");
        if (StringUtils.isNoneBlank(startTime)){
            sql+=" AND t.create_time >=:startTime";
            areCountSql.append(" AND t.create_time >=:startTime");
            totalCount.append(" 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";
            areCountSql.append(" AND t.create_time <=:endTime");
            totalCount.append(" 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";
            areCountSql.append(" AND t.belong_are_code =:area");
            totalCount.append(" 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();
        List<Map<String, Object>> areCount = hibenateUtils.createSQLQuery(areCountSql.toString(),params);
        if (areCount.size()>=0){
            result.put("areEquipmentCount",areCount);
        }
        List<Map<String, Object>> countTotal=  iotEquipmentDetailDao.getAllEquipmentTotalCount();
        List<Map<String, Object>> countTotal=  hibenateUtils.createSQLQuery(totalCount.toString(),params);
        if (countTotal.size()>=0){
            result.put("equipmentTotalCount",countTotal);
        }

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

@ -9,7 +9,8 @@ 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.iot.util.excel.hibernate.HibenateUtils;
import com.yihu.iot.util.excel.HibenateUtils;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.http.HttpClientUtil;
import io.swagger.annotations.ApiOperation;
@ -44,8 +45,6 @@ public class MonitorPlatformService  {
    private String appSecret;
    @Value("${wechat.id}")
    private String wxId;
    @Value("${wechat.flag}")
    private boolean flag;
    public static Map<String,String> tokenMap = new HashMap<>();
@ -151,12 +150,19 @@ 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();
        }else {
            JSONObject jsonObject = JSONObject.parseObject(anotherResult);
        if(StringUtils.isEmpty(deviceType)){
            deviceType = "";
        }
        String[] str =deviceType.split(",");
        List<String> list = new ArrayList<>();
        for (int i=0;i<str.length;i++){
            list.add(str[i]);
        }
        JSONObject jsonObject = JSONObject.parseObject(anotherResult);
        IotSystemDictDO iotSystemDictDO = iotSystemDictDao.findByDictNameAndValueAndDel("DEVICE_TYPE","健康小屋",1);
        if (null!=iotSystemDictDO&&list.size()>1&&list.contains(iotSystemDictDO.getCode())){
            if("200".equals(jsonObject.get("status").toString())){
                JSONArray dataresult= jsonObject.getJSONArray("data");
                JSONArray resultArray = new JSONArray();
@ -180,14 +186,19 @@ public class MonitorPlatformService  {
            }
            return jsonObject.toString();
        }else if (list.size()==1&&list.contains(iotSystemDictDO.getCode())){
            jsonObject.replace("data",iotEquip.toString());
            return jsonObject.toString();
        }else {
           return anotherResult;
        }
    }
    private String dealSql(Map<String, Object> params){
        StringBuffer sql = new StringBuffer();
        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("select count(1) AS \"num\",t.belong_are AS \"name\",t.belong_are_code AS \"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()+"'");
            sql.append(" and t.belong_are_code = '"+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")