|  | @ -18,32 +18,31 @@ import com.yihu.jw.care.service.family.PatientFamilyMemberService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.sign.ServicePackageService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.util.ConstantUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.util.CountDistance;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.util.MessageUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.im.ConsultDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.im.ConsultTeamDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.contacts.PatientSosContactsDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.BasePatientOutBed;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.DevicePatientDevice;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.securitymonitoring.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.message.dao.SystemMessageDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultTeamDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.util.ImUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.ResponseContant;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.emergency.EmergencyOrderVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.PageEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.GpsUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.util.MessageUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.DevicePatientDevice;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.securitymonitoring.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.message.dao.SystemMessageDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.ResponseContant;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.entity.EntityUtils;
 | 
	
		
			
				|  |  | import com.yihu.mysql.query.BaseJpaService;
 | 
	
		
			
				|  |  | import jdk.management.resource.internal.inst.FileOutputStreamRMHooks;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
	
		
			
				|  | @ -1217,145 +1216,170 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject patientSignTopicInfo(JSONObject result,String patient,String topicItem){
 | 
	
		
			
				|  |  |         if (null==result){
 | 
	
		
			
				|  |  |             result = new JSONObject();
 | 
	
		
			
				|  |  |     public void preventLost(JSONObject result,String patient){
 | 
	
		
			
				|  |  |         List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"4");
 | 
	
		
			
				|  |  |         if (devicePatientDeviceDos.size()==0){
 | 
	
		
			
				|  |  |             return;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventLost".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"4");
 | 
	
		
			
				|  |  |             if (devicePatientDeviceDos.size()==0){}
 | 
	
		
			
				|  |  |             else {
 | 
	
		
			
				|  |  |                 DevicePatientDevice device = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  |                 result.put("deviceSn",device.getDeviceSn());
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     JSONObject response= patientDeviceService.getAqgDeviceInfo(device.getDeviceSn());
 | 
	
		
			
				|  |  |                     if (response!=null){
 | 
	
		
			
				|  |  |                         //定位信息
 | 
	
		
			
				|  |  |                         if (response.containsKey("last_location")&&response.get("last_location")!=null){
 | 
	
		
			
				|  |  |                             JSONObject locationTmp = response.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",response.getString("last_city"));
 | 
	
		
			
				|  |  |                             tmp.put("province",response.getString("last_province"));
 | 
	
		
			
				|  |  |                             tmp.put("address",response.getString("last_address"));
 | 
	
		
			
				|  |  |                             result.put("location",tmp);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         //围栏信息
 | 
	
		
			
				|  |  |                         if (response.containsKey("fences")&&response.get("fences")!=null){
 | 
	
		
			
				|  |  |                             JSONArray fencesArr = response.getJSONArray("fences");
 | 
	
		
			
				|  |  |                             JSONArray fencesEnables = new JSONArray();
 | 
	
		
			
				|  |  |                             for (int i=0;i<fencesArr.size();i++){
 | 
	
		
			
				|  |  |                                 JSONObject tmp = fencesArr.getJSONObject(i);
 | 
	
		
			
				|  |  |                                 if (tmp.getBooleanValue("enable")){//围栏生效
 | 
	
		
			
				|  |  |                                     JSONObject fenceTmp = new JSONObject();
 | 
	
		
			
				|  |  |                                     fenceTmp.put("fenceNO",tmp.getInteger("seqid").toString());
 | 
	
		
			
				|  |  |                                     fenceTmp.put("name",tmp.getString("name"));
 | 
	
		
			
				|  |  |                                     JSONArray fenceLocationTmp = tmp.getJSONObject("safe_area").getJSONArray("coordinates").getJSONArray(0);
 | 
	
		
			
				|  |  |                                     JSONArray fenceLocation = new JSONArray();
 | 
	
		
			
				|  |  |                                     for (int j=0;j<fenceLocationTmp.size();j++){
 | 
	
		
			
				|  |  |                                         Double lon = fenceLocationTmp.getJSONArray(j).getDouble(0);
 | 
	
		
			
				|  |  |                                         Double lat = fenceLocationTmp.getJSONArray(j).getDouble(1);
 | 
	
		
			
				|  |  |                                         JSONObject positionTmp = gpsUtil.gcj02_To_Bd09(lat,lon);
 | 
	
		
			
				|  |  |                                         fenceLocation.add(positionTmp);
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                     fenceTmp.put("location",fenceLocation);
 | 
	
		
			
				|  |  |                                     fenceTmp.put("inFenceStatus",countDistance.isInPolygon(result.getJSONObject("location").getDouble("lon"),result.getJSONObject("location").getDouble("lat"),fenceLocation));
 | 
	
		
			
				|  |  |                                     fencesEnables.add(fenceTmp);
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             if (fencesEnables.size()>0){
 | 
	
		
			
				|  |  |                                 result.put("fences",fencesEnables);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         DevicePatientDevice device = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  |         result.put("deviceSn",device.getDeviceSn());
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONObject response= patientDeviceService.getAqgDeviceInfo(device.getDeviceSn());
 | 
	
		
			
				|  |  |             if (response!=null){
 | 
	
		
			
				|  |  |                 //定位信息
 | 
	
		
			
				|  |  |                 if (response.containsKey("last_location")&&response.get("last_location")!=null){
 | 
	
		
			
				|  |  |                     JSONObject locationTmp = response.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",response.getString("last_city"));
 | 
	
		
			
				|  |  |                     tmp.put("province",response.getString("last_province"));
 | 
	
		
			
				|  |  |                     tmp.put("address",response.getString("last_address"));
 | 
	
		
			
				|  |  |                     result.put("location",tmp);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //围栏信息
 | 
	
		
			
				|  |  |                 if (response.containsKey("fences")&&response.get("fences")!=null){
 | 
	
		
			
				|  |  |                     JSONArray fencesArr = response.getJSONArray("fences");
 | 
	
		
			
				|  |  |                     JSONArray fencesEnables = new JSONArray();
 | 
	
		
			
				|  |  |                     for (int i=0;i<fencesArr.size();i++){
 | 
	
		
			
				|  |  |                         JSONObject tmp = fencesArr.getJSONObject(i);
 | 
	
		
			
				|  |  |                         if (tmp.getBooleanValue("enable")){//围栏生效
 | 
	
		
			
				|  |  |                             JSONObject fenceTmp = new JSONObject();
 | 
	
		
			
				|  |  |                             fenceTmp.put("fenceNO",tmp.getInteger("seqid").toString());
 | 
	
		
			
				|  |  |                             fenceTmp.put("name",tmp.getString("name"));
 | 
	
		
			
				|  |  |                             JSONArray fenceLocationTmp = tmp.getJSONObject("safe_area").getJSONArray("coordinates").getJSONArray(0);
 | 
	
		
			
				|  |  |                             JSONArray fenceLocation = new JSONArray();
 | 
	
		
			
				|  |  |                             for (int j=0;j<fenceLocationTmp.size();j++){
 | 
	
		
			
				|  |  |                                 Double lon = fenceLocationTmp.getJSONArray(j).getDouble(0);
 | 
	
		
			
				|  |  |                                 Double lat = fenceLocationTmp.getJSONArray(j).getDouble(1);
 | 
	
		
			
				|  |  |                                 JSONObject positionTmp = gpsUtil.gcj02_To_Bd09(lat,lon);
 | 
	
		
			
				|  |  |                                 fenceLocation.add(positionTmp);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             fenceTmp.put("location",fenceLocation);
 | 
	
		
			
				|  |  |                             fenceTmp.put("inFenceStatus",countDistance.isInPolygon(result.getJSONObject("location").getDouble("lon"),result.getJSONObject("location").getDouble("lat"),fenceLocation));
 | 
	
		
			
				|  |  |                             fencesEnables.add(fenceTmp);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }catch (Exception e){
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                     result.put("location",null);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventFall".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
 | 
	
		
			
				|  |  |             if (devicePatientDeviceDos.size()==0){}
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  |                     JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,deviceDo.getDeviceSn(),1,null);
 | 
	
		
			
				|  |  |                     result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
 | 
	
		
			
				|  |  |                     result.put("patientAddress",deviceDo.getSosAddress());
 | 
	
		
			
				|  |  |                     if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
 | 
	
		
			
				|  |  |                         result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     else {
 | 
	
		
			
				|  |  |                         result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |                     if (fencesEnables.size()>0){
 | 
	
		
			
				|  |  |                         result.put("fences",fencesEnables);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }catch (Exception e){
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             result.put("location",null);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventOutOfBed".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"13");
 | 
	
		
			
				|  |  |             if (devicePatientDeviceDos.size()==0){}
 | 
	
		
			
				|  |  |             else {
 | 
	
		
			
				|  |  |                 DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  |                 JSONObject deviceInfo =  patientDeviceService.getSleepDeviceInfo(deviceDo.getDeviceSn());
 | 
	
		
			
				|  |  |                 if(deviceInfo.getBooleanValue("success")){
 | 
	
		
			
				|  |  |                     result.put("patientAddress",deviceDo.getSosAddress());
 | 
	
		
			
				|  |  |                     JSONArray objInfo = deviceInfo.getJSONArray("objs");
 | 
	
		
			
				|  |  |                     if (objInfo.size()>0){
 | 
	
		
			
				|  |  |                         result.put("sleepStatus",true);
 | 
	
		
			
				|  |  |                         JSONObject tmp = objInfo.getJSONObject(0);
 | 
	
		
			
				|  |  |                         JSONObject sleepInfo = new JSONObject();
 | 
	
		
			
				|  |  |                         sleepInfo.put("online",tmp.getBooleanValue("online"));
 | 
	
		
			
				|  |  |                         sleepInfo.put("onbed",tmp.getBooleanValue("onbed"));
 | 
	
		
			
				|  |  |                         sleepInfo.put("heartrate",tmp.getString("heartrate"));
 | 
	
		
			
				|  |  |                         sleepInfo.put("breathrate",tmp.getString("breathrate"));
 | 
	
		
			
				|  |  |                         BasePatientOutBed outBed = outBedDao.findByPatientAndDeviceSnAndStatus(patient,deviceDo.getDeviceSn(),0);
 | 
	
		
			
				|  |  |                         if (null!=outBed){
 | 
	
		
			
				|  |  |                             String outBedTime = "";
 | 
	
		
			
				|  |  |                             Date date = new Date();
 | 
	
		
			
				|  |  |                             long millisecondsDiff = date.getTime() - outBed.getCreateTime().getTime();
 | 
	
		
			
				|  |  |                             long minutesDiff = millisecondsDiff / TimeUnit.MINUTES.toMillis(1L);
 | 
	
		
			
				|  |  |                             long hoursDiff = millisecondsDiff / TimeUnit.HOURS.toMillis(1L);
 | 
	
		
			
				|  |  |                             long minuteFieldDiff = minutesDiff - TimeUnit.HOURS.toMinutes(hoursDiff);
 | 
	
		
			
				|  |  |                             if (hoursDiff > 0L) {
 | 
	
		
			
				|  |  |                                 outBedTime += String.format("%d小时", hoursDiff);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             if (minuteFieldDiff>0){
 | 
	
		
			
				|  |  |                                 outBedTime +=String.format("%d分钟", minuteFieldDiff);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             sleepInfo.put("outBedTime",outBedTime);
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                             sleepInfo.put("outBedTime","无");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void preventOutOfBed(JSONObject result,String patient){
 | 
	
		
			
				|  |  |         List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"13");
 | 
	
		
			
				|  |  |         if (devicePatientDeviceDos.size()==0){}
 | 
	
		
			
				|  |  |         else {
 | 
	
		
			
				|  |  |             DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  |             JSONObject deviceInfo =  patientDeviceService.getSleepDeviceInfo(deviceDo.getDeviceSn());
 | 
	
		
			
				|  |  |             if(deviceInfo.getBooleanValue("success")){
 | 
	
		
			
				|  |  |                 result.put("patientAddress",deviceDo.getSosAddress());
 | 
	
		
			
				|  |  |                 JSONArray objInfo = deviceInfo.getJSONArray("objs");
 | 
	
		
			
				|  |  |                 if (objInfo.size()>0){
 | 
	
		
			
				|  |  |                     result.put("sleepStatus",true);
 | 
	
		
			
				|  |  |                     JSONObject tmp = objInfo.getJSONObject(0);
 | 
	
		
			
				|  |  |                     JSONObject sleepInfo = new JSONObject();
 | 
	
		
			
				|  |  |                     sleepInfo.put("online",tmp.getBooleanValue("online"));
 | 
	
		
			
				|  |  |                     sleepInfo.put("onbed",tmp.getBooleanValue("onbed"));
 | 
	
		
			
				|  |  |                     sleepInfo.put("heartrate",tmp.getString("heartrate"));
 | 
	
		
			
				|  |  |                     sleepInfo.put("breathrate",tmp.getString("breathrate"));
 | 
	
		
			
				|  |  |                     BasePatientOutBed outBed = outBedDao.findByPatientAndDeviceSnAndStatus(patient,deviceDo.getDeviceSn(),0);
 | 
	
		
			
				|  |  |                     if (null!=outBed){
 | 
	
		
			
				|  |  |                         String outBedTime = "";
 | 
	
		
			
				|  |  |                         Date date = new Date();
 | 
	
		
			
				|  |  |                         long millisecondsDiff = date.getTime() - outBed.getCreateTime().getTime();
 | 
	
		
			
				|  |  |                         long minutesDiff = millisecondsDiff / TimeUnit.MINUTES.toMillis(1L);
 | 
	
		
			
				|  |  |                         long hoursDiff = millisecondsDiff / TimeUnit.HOURS.toMillis(1L);
 | 
	
		
			
				|  |  |                         long minuteFieldDiff = minutesDiff - TimeUnit.HOURS.toMinutes(hoursDiff);
 | 
	
		
			
				|  |  |                         if (hoursDiff > 0L) {
 | 
	
		
			
				|  |  |                             outBedTime += String.format("%d小时", hoursDiff);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         if (minuteFieldDiff>0){
 | 
	
		
			
				|  |  |                             outBedTime +=String.format("%d分钟", minuteFieldDiff);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         result.put("sleepInfo",sleepInfo);
 | 
	
		
			
				|  |  |                         sleepInfo.put("outBedTime",outBedTime);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         sleepInfo.put("outBedTime","无");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     result.put("sleepStatus",false);
 | 
	
		
			
				|  |  |                     result.put("sleepInfo","获取睡眠带数据失败");
 | 
	
		
			
				|  |  |                     result.put("sleepInfo",sleepInfo);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 result.put("sleepStatus",false);
 | 
	
		
			
				|  |  |                 result.put("sleepInfo","获取睡眠带数据失败");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //监控
 | 
	
		
			
				|  |  |             devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
 | 
	
		
			
				|  |  |             if (devicePatientDeviceDos.size()==0){}
 | 
	
		
			
				|  |  |             else{
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  |                     JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,deviceDo.getDeviceSn(),1,null);
 | 
	
		
			
				|  |  |                     result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
 | 
	
		
			
				|  |  |                     result.put("patientAddress",deviceDo.getSosAddress());
 | 
	
		
			
				|  |  |                     if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
 | 
	
		
			
				|  |  |                         result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     else {
 | 
	
		
			
				|  |  |                         result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }catch (Exception e){
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         monitorInfo(result, patient);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void preventFire(JSONObject result,String patient){
 | 
	
		
			
				|  |  |         List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"15");
 | 
	
		
			
				|  |  |         if (devicePatientDeviceDos.size()==0){}
 | 
	
		
			
				|  |  |         else {
 | 
	
		
			
				|  |  |             DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         monitorInfo(result, patient);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void preventGasLeakage(JSONObject result,String patient){
 | 
	
		
			
				|  |  |         List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"14");
 | 
	
		
			
				|  |  |         if (devicePatientDeviceDos.size()==0){}
 | 
	
		
			
				|  |  |         else {
 | 
	
		
			
				|  |  |             DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         monitorInfo(result, patient);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void monitorInfo(JSONObject result,String patient){
 | 
	
		
			
				|  |  |         //监控
 | 
	
		
			
				|  |  |         List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
 | 
	
		
			
				|  |  |         if (devicePatientDeviceDos.size()==0){
 | 
	
		
			
				|  |  |             return;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             DevicePatientDevice deviceDo = devicePatientDeviceDos.get(0);
 | 
	
		
			
				|  |  |             JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,deviceDo.getDeviceSn(),1,null);
 | 
	
		
			
				|  |  |             result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
 | 
	
		
			
				|  |  |             result.put("patientAddress",deviceDo.getSosAddress());
 | 
	
		
			
				|  |  |             if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
 | 
	
		
			
				|  |  |                 result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else {
 | 
	
		
			
				|  |  |                 result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject patientSignTopicInfo(JSONObject result,String patient,String topicItem){
 | 
	
		
			
				|  |  |         if (null==result){
 | 
	
		
			
				|  |  |             result = new JSONObject();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventLost".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             preventLost(result, patient);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventFall".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             monitorInfo(result, patient);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventOutOfBed".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             preventOutOfBed(result, patient);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventFire".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             preventFire(result, patient);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("preventGasLeakage".equals(topicItem)||StringUtils.isBlank(topicItem)){
 | 
	
		
			
				|  |  |             preventGasLeakage(result, patient);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 |