|  | @ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONArray;
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONObject;
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | import com.alibaba.fastjson.serializer.SerializerFeature;
 |  | import com.alibaba.fastjson.serializer.SerializerFeature;
 | 
												
													
														
															|  | import com.yihu.jw.care.config.AqgConfig;
 |  | import com.yihu.jw.care.config.AqgConfig;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.care.dao.device.BaseSleepDeviceReportDao;
 | 
												
													
														
															|  | import com.yihu.jw.care.dao.device.DevicePatientHealthIndexDao;
 |  | import com.yihu.jw.care.dao.device.DevicePatientHealthIndexDao;
 | 
												
													
														
															|  | import com.yihu.jw.care.dao.device.DeviceSosLogDao;
 |  | import com.yihu.jw.care.dao.device.DeviceSosLogDao;
 | 
												
													
														
															|  | import com.yihu.jw.care.dao.device.PatientDeviceDao;
 |  | import com.yihu.jw.care.dao.device.PatientDeviceDao;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.care.device.BaseSleepDeviceReport;
 | 
												
													
														
															|  | import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
 |  | import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
 | 
												
													
														
															|  | import com.yihu.jw.entity.care.device.DevicePatientDevice;
 |  | import com.yihu.jw.entity.care.device.DevicePatientDevice;
 | 
												
													
														
															|  | import com.yihu.jw.entity.care.device.DeviceSosLogDO;
 |  | import com.yihu.jw.entity.care.device.DeviceSosLogDO;
 | 
												
											
												
													
														
															|  | @ -76,6 +78,8 @@ public class DeviceService {
 | 
												
													
														
															|  |     private HealthIndexUtil healthIndexUtil;
 |  |     private HealthIndexUtil healthIndexUtil;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private ImUtil imUtil;
 |  |     private ImUtil imUtil;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private BaseSleepDeviceReportDao sleepDeviceReportDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 获取爱牵挂管理员cookie
 |  |      * 获取爱牵挂管理员cookie
 | 
												
											
												
													
														
															|  | @ -551,7 +555,12 @@ public class DeviceService {
 | 
												
													
														
															|  |     public void bySleep(String device,String time_begin,String heartrate,String breath,String turn_over,String is_warn) {
 |  |     public void bySleep(String device,String time_begin,String heartrate,String breath,String turn_over,String is_warn) {
 | 
												
													
														
															|  |         try {
 |  |         try {
 | 
												
													
														
															|  |             if(StringUtils.isNotBlank(device)){
 |  |             if(StringUtils.isNotBlank(device)){
 | 
												
													
														
															|  | 
 |  |                 List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
 | 
												
													
														
															|  | 
 |  |                 if (devicePatientDeviceDos.size()>0){
 | 
												
													
														
															|  | 
 |  |                     if ("1".equals(is_warn)){//触发工单
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         } catch (Exception e) {
 |  |         } catch (Exception e) {
 | 
												
											
												
													
														
															|  | @ -561,12 +570,52 @@ public class DeviceService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Async
 |  |     @Async
 | 
												
													
														
															|  |     public void bySleepReport(String device,String date,String fallasleep,String sleepTime,String restTime,String awakeTime,String lightTime,
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void bySleepReport(String device,String dateStr,String fallasleep,String sleepTime,String restTime,String awakeTime,String lightTime,
 | 
												
													
														
															|  |                               String remTime,String deepTime,String[] bucket,String avghr,String avgbr,String awakePer,String remPer,String lightPer,
 |  |                               String remTime,String deepTime,String[] bucket,String avghr,String avgbr,String awakePer,String remPer,String lightPer,
 | 
												
													
														
															|  |                               String efficiency,String score) {
 |  |                               String efficiency,String score) {
 | 
												
													
														
															|  |         try {
 |  |         try {
 | 
												
													
														
															|  |             if(StringUtils.isNotBlank(device)){
 |  |             if(StringUtils.isNotBlank(device)){
 | 
												
													
														
															|  | 
 |  |                 List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
 | 
												
													
														
															|  | 
 |  |                 if (devicePatientDeviceDos.size()>0){
 | 
												
													
														
															|  | 
 |  |                     String patient = devicePatientDeviceDos.get(0).getUser();
 | 
												
													
														
															|  | 
 |  |                     BaseSleepDeviceReport report = new BaseSleepDeviceReport();
 | 
												
													
														
															|  | 
 |  |                     report.setPatient(patient);
 | 
												
													
														
															|  | 
 |  |                     Date date = DateUtil.strToDate(dateStr,DateUtil.YYYYMMDD);
 | 
												
													
														
															|  | 
 |  |                     report.setCreateTime(date);
 | 
												
													
														
															|  | 
 |  |                     report.setFallaSleep(fallasleep);
 | 
												
													
														
															|  | 
 |  |                     report.setSleepTime(sleepTime);
 | 
												
													
														
															|  | 
 |  |                     report.setRestTime(restTime);
 | 
												
													
														
															|  | 
 |  |                     report.setAwakeTime(awakeTime);
 | 
												
													
														
															|  | 
 |  |                     report.setLightTime(lightTime);
 | 
												
													
														
															|  | 
 |  |                     report.setRemTime(remTime);
 | 
												
													
														
															|  | 
 |  |                     report.setDeepTime(deepTime);
 | 
												
													
														
															|  | 
 |  |                     String buckets =JSON.toJSONString(bucket);
 | 
												
													
														
															|  | 
 |  |                     report.setBucket(buckets);
 | 
												
													
														
															|  | 
 |  |                     report.setAvghr(avghr);
 | 
												
													
														
															|  | 
 |  |                     report.setAvgbr(avgbr);
 | 
												
													
														
															|  | 
 |  |                     report.setAwakePer(awakePer);
 | 
												
													
														
															|  | 
 |  |                     report.setRemPer(remPer);
 | 
												
													
														
															|  | 
 |  |                     report.setLightPer(lightPer);
 | 
												
													
														
															|  | 
 |  |                     report.setEfficiency(efficiency);
 | 
												
													
														
															|  | 
 |  |                     report.setScore(score);
 | 
												
													
														
															|  | 
 |  |                     sleepDeviceReportDao.save(report);
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |             e.printStackTrace();
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Async
 | 
												
													
														
															|  | 
 |  |     public void byOnlineStatus(String device,String onlinestatu,String time_begin){
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             if(StringUtils.isNotBlank(device)){
 | 
												
													
														
															|  | 
 |  |                 List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
 | 
												
													
														
															|  | 
 |  |                 if (devicePatientDeviceDos.size()>0){
 | 
												
													
														
															|  | 
 |  |                     DevicePatientDevice tmp = devicePatientDeviceDos.get(0);
 | 
												
													
														
															|  | 
 |  |                     tmp.setOnlineStatus(Integer.parseInt(onlinestatu));
 | 
												
													
														
															|  | 
 |  |                     patientDeviceDao.save(tmp);
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         } catch (Exception e) {
 |  |         } catch (Exception e) {
 |