LAPTOP-KB9HII50\70708 2 rokov pred
rodič
commit
b51ba96f45

+ 26 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.service.third;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.device.BaseSleepPlanDao;
import com.yihu.jw.care.dao.device.DeviceDao;
import com.yihu.jw.care.dao.device.PatientSafeAreaDao;
import com.yihu.jw.care.dao.label.BaseCapacityLabelDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
@ -22,6 +23,7 @@ import com.yihu.jw.care.util.Point;
import com.yihu.jw.entity.base.dict.BaseYujingDict;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.BaseSleepPlan;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.PatientSafeAreaDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
@ -40,6 +42,7 @@ import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -94,6 +97,10 @@ public class PatientInfoPlatFormService {
    private GpsUtil gpsUtil;
    @Autowired
    private HealthIndexUtil healthIndexUtil;
    @Autowired
    private DeviceDao deviceDao;
    @Value("${spring.profiles.active}")
    private String profiles;
    /**
@ -714,6 +721,7 @@ public class PatientInfoPlatFormService {
     *获取设备详情
     */
    public List<Map<String,Object>> getPatientDeviceInfoWithDetail(String patient,String deviceSn,String warnTime,Integer isShow){
        //已绑定设备
        List<Map<String,Object>>  list = new ArrayList<>();
        String sql = "select dd.photo,pd.device_sn,dd.brands,dd.category_code,dd.model,pd.device_name,date_format(pd.czrq,'%Y-%m-%d %H:%i:%S' ) deviceTime,dd.device_type as deviceType " +
                "from dm_device dd INNER JOIN wlyy_patient_device pd on dd.category_code = pd.category_code INNER JOIN wlyy_devices wd on dd.model = wd.device_model and pd.device_sn = wd.device_code \n" +
@ -727,7 +735,9 @@ public class PatientInfoPlatFormService {
        sql+=" order by dd.device_type desc,pd.czrq asc ";
        list =  jdbcTemplate.queryForList(sql);
        Map<String,String> map = new HashMap<>();
        for (Map<String,Object> tmp :list){
            map.put(tmp.get("device_name")+"","");
            String category_code = tmp.get("category_code").toString();
            String deviceSN = tmp.get("device_sn").toString();
            Map<String,Object> detailInfo =  getDeviceIndexAndOrder(category_code,deviceSN,patient,warnTime);
@ -739,6 +749,22 @@ public class PatientInfoPlatFormService {
            list.add(resultMap);
        }
        //查找所有设备
        if("hzkxtest".equals(profiles)){
            List<Device> deviceList = deviceDao.findAll();
            Map<String,List<Device>>  deviceMap = deviceList.stream().collect(Collectors.groupingBy(Device::getName));
            for (String deviceName:deviceMap.keySet()){
                if(map.get(deviceName)==null){
                    Map<String,Object> devicetmp=new HashMap<>();
                    devicetmp.put("photo",deviceMap.get(deviceName).get(0).getPhoto());
                    devicetmp.put("category_code",deviceMap.get(deviceName).get(0).getCategoryCode());
                    devicetmp.put("deviceType",deviceMap.get(deviceName).get(0).getDeviceType());
                    devicetmp.put("device_name",deviceName);
                    devicetmp.put("detailInfo",new JSONObject());
                    list.add(devicetmp);
                }
            }
        }
        return list;
    }