|
@ -41,7 +41,6 @@ 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.rm.base.BaseRequestMapping;
|
|
|
import com.yihu.jw.util.common.GpsUtil;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
@ -2074,9 +2073,11 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
" and m.doctor_code = '"+doctor+"' and m.del = '1' ";
|
|
|
String filter = "";
|
|
|
String categoryCode ="";
|
|
|
String topicItemTmp = topicItem;
|
|
|
switch (topicItem){
|
|
|
case "actionTrack":
|
|
|
categoryCode="'4'";
|
|
|
topicItemTmp="preventLost";
|
|
|
break;
|
|
|
case "preventLost":
|
|
|
categoryCode="'4'";
|
|
@ -2095,14 +2096,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if ("actionTrack".equals(topicItem)){//行动轨迹
|
|
|
filter =" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
|
|
|
" where pd.user = sr.patient and pd.del=0 and pd.category_code in ("+categoryCode+") and FIND_IN_SET('preventLost',dd.service_topic)) ";
|
|
|
}
|
|
|
else{
|
|
|
filter =" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
|
|
|
" where pd.user = sr.patient and pd.del=0 and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
|
|
|
}
|
|
|
filter =" and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
|
|
|
" where pd.user = sr.patient and pd.del=0 and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItemTmp+"',dd.service_topic)) ";
|
|
|
|
|
|
if ("preventLost".equals(topicItem)){//有绑定围栏的居民
|
|
|
filter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
|
|
@ -2124,11 +2119,11 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
result.put("currentPage",page+1);
|
|
|
for (int i=currentIndexFrom;i<list.size()&&i<currentIndexEnd;i++){
|
|
|
Map<String,Object> patientTmp = list.get(i);
|
|
|
JSONObject object = new JSONObject();
|
|
|
com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
|
String deviceSn ="";
|
|
|
List<String> deviceSns = jdbcTemplate.queryForList("select pd.device_sn from wlyy_patient_device pd INNER JOIN dm_device dd " +
|
|
|
" on pd.device_id = dd.id where pd.user = '"+patientTmp.get("id").toString()+"' and pd.del=0 and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItem+"',dd.service_topic)",String.class);
|
|
|
" on pd.device_id = dd.id where pd.user = '"+patientTmp.get("id").toString()+"' and pd.del=0 and pd.category_code in ("+categoryCode+") and FIND_IN_SET('"+topicItemTmp+"',dd.service_topic)",String.class);
|
|
|
if (deviceSns.size()>0){
|
|
|
deviceSn = deviceSns.get(0);
|
|
|
}
|
|
@ -2139,9 +2134,28 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
|
|
|
switch (topicItem){
|
|
|
case "actionTrack":
|
|
|
org.json.JSONArray locations = patientDeviceService.getX1Locations(deviceSn, day);
|
|
|
JSONArray locations = JSON.parseArray(JSON.toJSONString(patientDeviceService.getX1Locations(deviceSn, day), SerializerFeature.WriteMapNullValue));
|
|
|
object.put("routes", locations);
|
|
|
object.put("actionTrack",locations);
|
|
|
//获取手表定位
|
|
|
JSONObject response= patientDeviceService.getAqgDeviceInfo2(deviceSn);
|
|
|
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);
|
|
|
if (!response.getBoolean("online")) {//设备离线 取居民表定位
|
|
|
object.put("X1online", false);
|
|
|
} else {
|
|
|
object.put("X1online", true);
|
|
|
}
|
|
|
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"));
|
|
|
object.put("location", tmp);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
object = patientMonitoringInfo(patientTmp.get("id").toString(),topicItem,false);
|