Browse Source

血糖 血压判断

吴世龙 3 years ago
parent
commit
f2fcbe7fae

+ 30 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -46,6 +46,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import com.yihu.mysql.query.BaseJpaService;
import jdk.nashorn.internal.runtime.FindProperty;
import org.apache.commons.lang3.StringUtils;
@ -139,6 +140,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    private BaseOrgDao orgDao;
    @Autowired
    private DeviceDetailDao deviceDetailDao;
    @Autowired
    private HealthIndexUtil healthIndexUtil;
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
@ -1649,7 +1652,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        patientSignTopicInfo(result, patient, "preventFall", null, true);
        String healthXYSql ="SELECT value1,value2,value3,value4 FROM wlyy_patient_health_index WHERE `user` = '"+patient+"' AND type = 2  ORDER BY record_date DESC LIMIT 1";
        String healthXYSql ="SELECT value1,value2,value3 FROM wlyy_patient_health_index WHERE `user` = '"+patient+"' AND type = 2  ORDER BY record_date DESC LIMIT 1";
        List<Map<String, Object>> XY = jdbcTemplate.queryForList(healthXYSql);
        String healthXTSql ="SELECT value1,value2,value3,value4 FROM wlyy_patient_health_index WHERE `user` = '"+patient+"' AND type = 1  ORDER BY record_date DESC LIMIT 1";
@ -1657,6 +1660,20 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if (XY.size()!= 0) {
            for (Map<String, Object> map : XY) {
                //HealthIndexUtil.verifyHealthIndex
                JSONArray jsonArray = healthIndexUtil.verifyHealthIndex(2, map.get("value1").toString(), map.get("value2").toString(), map.get("value3").toString());
                if(jsonArray.size()==0){
                    map.put("value1Index","");
                    map.put("value2Index","");
                    //map.put("value3Index","");
                }else {
                    //收缩压
                    map.put("value1Index",jsonArray.getJSONObject(0).get("error"));
                    //舒张压
                    map.put("value2Index",jsonArray.getJSONObject(1).get("error"));
                    //脉搏
                    //map.put("value3Index",jsonArray.getJSONObject(2).get("error"));
                }
                result.put("xy",map);
            }
        }else {
@ -1665,6 +1682,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if (XT.size()!= 0) {
            for (Map<String, Object> map : XT) {
                JSONArray jsonArray = healthIndexUtil.verifyHealthIndex(1, map.get("value1").toString(), map.get("value2").toString());
                if(jsonArray.size()==0){
                    map.put("value1Index","");
                }else {
                    //血糖
                    map.put("value1Index",jsonArray.getJSONObject(0).get("error"));
                }
                result.put("xt",map);
            }
        }else {
@ -1674,9 +1698,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    }
    //行动轨迹
    public org.json.JSONArray getX1Locations(String patient,String date){
    public JSONArray getX1Locations(String patient, String date){
        List<DevicePatientDevice> byUserAndCategoryCode = patientDeviceDao.findByUserAndCategoryCode(patient, "4");//手表
        org.json.JSONArray x1Locations = patientDeviceService.getX1Locations(byUserAndCategoryCode.get(0).getDeviceSn(), date);
        if (byUserAndCategoryCode.size()==0){
            return null;
        }
        JSONArray x1Locations = JSON.parseArray(JSON.toJSONString(patientDeviceService.getX1Locations(byUserAndCategoryCode.get(0).getDeviceSn(), date), SerializerFeature.WriteMapNullValue));
        return x1Locations;
    }