|
@ -4,16 +4,10 @@ import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.jw.care.dao.device.DeviceDetailDao;
|
|
|
|
import com.yihu.jw.care.dao.device.DeviceInfoDao;
|
|
|
|
import com.yihu.jw.care.dao.device.DevicePatientHealthIndexDao;
|
|
|
|
import com.yihu.jw.care.dao.device.PatientDeviceDao;
|
|
|
|
|
|
import com.yihu.jw.care.dao.device.*;
|
|
import com.yihu.jw.care.endpoint.Result;
|
|
import com.yihu.jw.care.endpoint.Result;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.care.device.DeviceDetail;
|
|
|
|
import com.yihu.jw.entity.care.device.DeviceInfo;
|
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientDevice;
|
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
|
|
|
|
|
|
import com.yihu.jw.entity.care.device.*;
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
@ -21,7 +15,6 @@ import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
|
|
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import jdk.management.resource.internal.inst.FileOutputStreamRMHooks;
|
|
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@ -58,6 +51,10 @@ public class DeviceUploadService {
|
|
private HealthIndexUtil healthIndexUtil;
|
|
private HealthIndexUtil healthIndexUtil;
|
|
@Autowired
|
|
@Autowired
|
|
private ImUtil imUtil;
|
|
private ImUtil imUtil;
|
|
|
|
@Autowired
|
|
|
|
private BaseYxDeviceIndexDao yxDeviceIndexDao;
|
|
|
|
@Autowired
|
|
|
|
private HvDeviceService hvDeviceService;
|
|
|
|
|
|
public Result uploadDevicesData(String dataJson)throws Exception {
|
|
public Result uploadDevicesData(String dataJson)throws Exception {
|
|
try {
|
|
try {
|
|
@ -425,10 +422,49 @@ public class DeviceUploadService {
|
|
if (StringUtils.isBlank(message)){
|
|
if (StringUtils.isBlank(message)){
|
|
return Result.error("message is null");
|
|
return Result.error("message is null");
|
|
}else {
|
|
}else {
|
|
String[] messages = message.split(",");
|
|
|
|
|
|
parsingInstruction(message);
|
|
}
|
|
}
|
|
return Result.success("success");
|
|
return Result.success("success");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 处理指令
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public void parsingInstruction(String instructions){
|
|
|
|
if(StringUtils.isBlank(instructions)){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String res = "";
|
|
|
|
//位置[434036bb95761faaf8771d10029ae8eaIC*860314001160427*0113*UD,210826,093829,V,0.000000,N,0.000000,E,0.00,0.0,100.0,0,62,31,0,0,00000000,1,1,460,0,22831,259001902,62,6,wifi0,20:6b:e7:67:bf:1f,-63,wifi1,d4:9e:05:a7:60:a6,-65,wifi2,e0:d4:62:2d:67:9c,-71,wifi3,54:75:95:b9:4f:8e,-73,wifi4,e4:72:e2:aa:73:0c,-73,wifi5,e0:d4:62:2d:67:a1,-73]
|
|
|
|
String instruct[] = instructions.split("]");
|
|
|
|
for (int i=0;i<instruct.length;i++){
|
|
|
|
String inst = instruct[i];
|
|
|
|
String tmp[] = inst.split("\\*");
|
|
|
|
String sn = tmp[1];
|
|
|
|
String order = tmp[3];
|
|
|
|
if(order.contains(",")){
|
|
|
|
String tmp1[] = order.split(",");
|
|
|
|
if("UD".equals(tmp1[0])){
|
|
|
|
//处理位置信息
|
|
|
|
String lat,lon;
|
|
|
|
if("A".equals(tmp1[4])){
|
|
|
|
lat = tmp1[5];
|
|
|
|
lon = tmp1[7];
|
|
|
|
}else{
|
|
|
|
lat = tmp1[4];
|
|
|
|
lon = tmp1[6];
|
|
|
|
}
|
|
|
|
BaseYxDeviceIndex deviceIndex = new BaseYxDeviceIndex();
|
|
|
|
deviceIndex.setSn(sn);
|
|
|
|
deviceIndex.setLat(lat);
|
|
|
|
deviceIndex.setLon(lon);
|
|
|
|
yxDeviceIndexDao.save(deviceIndex);
|
|
|
|
hvDeviceService.updContactStatus(sn,1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|