| 
					
				 | 
			
			
				@ -11,6 +11,7 @@ import com.yihu.jw.care.dao.security.SecurityMonitoringOrderDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.course.CourseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.device.PatientDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.device.PatientHealthIndexService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.device.YsDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.lifeCare.LifeCareOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.security.SecurityMonitoringOrderService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -27,7 +28,9 @@ import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.securitymonitoring.SecurityMonitoringOrderDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.ResponseContant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.PageEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.GpsUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang.StringUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -79,6 +82,10 @@ public class PatientInfoPlatFormService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientSafeAreaDao patientSafeAreaDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private CountDistance countDistance; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private YsDeviceService ysDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private GpsUtil gpsUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -700,10 +707,10 @@ public class PatientInfoPlatFormService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 手表4:电量、佩戴状态、是否预警、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 报警器7:电量  是否报警、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 床带13:是否压床、是否预警、心率和呼吸频率、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 监控12:是否预警、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 烟雾15:浓度、是否预警、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 监控12:是否预警、在线状态、播放地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 烟雾15:浓度、是否预警、在线状态 、最近一次温度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 燃气14 :浓度、是否预警、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 拐杖16:是否预警、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 拐杖16:是否预警、在线状态、定位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 血压2:最近一次收缩压,舒张压、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 血糖1:最近一次血糖、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -772,6 +779,36 @@ public class PatientInfoPlatFormService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("contact_status",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql = "select * from base_patient_step where 1=1  and device_sn='"+deviceSn+"' order by create_time desc limit 1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlResult = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (sqlResult.size()>0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("steps",sqlResult.get(0).get("steps")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("steps","无步数数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql ="SELECT * FROM wlyy_patient_health_index WHERE type = 5 and device_sn = '"+deviceSn+"' AND del = 1 ORDER BY record_date DESC LIMIT 1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlResult = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (sqlResult.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("heartRate",sqlResult.get(0).get("value1")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("heartRate","无心率数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //获取手表定位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject dw = patientDeviceService.getAqgDeviceInfo2(deviceSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (dw != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //定位信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (dw.containsKey("last_location") && dw.get("last_location") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        JSONObject locationTmp = dw.getJSONObject("last_location"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Double lon = locationTmp.getJSONArray("coordinates").getDouble(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Double lat = locationTmp.getJSONArray("coordinates").getDouble(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        JSONObject tmp = gpsUtil.gcj02_To_Bd09(lat, lon); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        tmp.put("city", dw.getString("last_city")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        tmp.put("province", dw.getString("last_province")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        tmp.put("address", dw.getString("last_address")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        detailInfo.put("location", tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            case "7"://报警器 电量  是否报警、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql = "  select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc,  " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -808,6 +845,15 @@ public class PatientInfoPlatFormService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("warnStatus",false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                com.alibaba.fastjson.JSONObject tmp = ysDeviceService.getDeviceLiveAddress(patient, deviceSn, 1, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                detailInfo.put("monitorInfoStatus", tmp.getIntValue(ResponseContant.resultFlag)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (tmp.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("monitorInfo", tmp.getString(ResponseContant.resultMsg)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("monitorInfo", tmp.getJSONObject(ResponseContant.resultMsg)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            case "13"://床带 是否压床、 心率和呼吸频率、在线状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc,  " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -904,13 +950,15 @@ public class PatientInfoPlatFormService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("warnStatus",false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql = " select value,record_time from base_device_health_index where device_sn='"+deviceSn+"' ORDER BY record_time desc limit 1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql = "SELECT * FROM base_yxdevice_index  WHERE sn = '" + deviceSn + "' AND lon != 0 AND lat != 0 ORDER BY create_time DESC limit 1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlResult = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (sqlResult.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.putAll(sqlResult.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("newlonlat",sqlResult.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject dz =  gpsUtil.gcj02_To_Bd09(Double.parseDouble(sqlResult.get(0).get("lat").toString()),Double.parseDouble(sqlResult.get(0).get("lon").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("location", dz); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("value",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("record_time",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("newlonlat",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    detailInfo.put("location", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 |