|
@ -2736,32 +2736,42 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
tmp.put("eCall", 0);
|
|
|
tmp.put("orderId", "");
|
|
|
}
|
|
|
BasePatientDO patientDO = basePatientDao.findById(id);
|
|
|
if (null != patientDO) {
|
|
|
if (StringUtils.isNotBlank(patientDO.getLatLon())) {
|
|
|
String[] latLon = patientDO.getLatLon().toString().split(",");
|
|
|
if (StringUtils.isNotBlank(patientDO.getHomeLatLon())&&latLon.length==2) {
|
|
|
String homeLatLon = patientDO.getHomeLatLon();
|
|
|
double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
|
|
|
double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
|
|
|
double homeDistance = countDistance.getDistance(Double.parseDouble(latLon[0]), Double.parseDouble(latLon[1]),
|
|
|
homeLat, homeLon);
|
|
|
if (homeDistance * 1000 > 50) {
|
|
|
tmp.put("atHome", false);
|
|
|
sql = "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 =4 ";
|
|
|
List<String> deviceSns = jdbcTemplate.queryForList(sql, String.class);
|
|
|
if (deviceSns.size() > 0) {
|
|
|
JSONObject objectTmp = patientMonitoringInfo(patientTmp.get("id").toString(), "preventLost", deviceSns.get(0),false);
|
|
|
tmp.put("atHome", objectTmp.get("atHome"));
|
|
|
tmp.put("address", objectTmp.get("address"));
|
|
|
}else {
|
|
|
BasePatientDO patientDO = basePatientDao.findById(id);
|
|
|
if (null != patientDO) {
|
|
|
if (StringUtils.isNotBlank(patientDO.getLatLon())) {
|
|
|
String[] latLon = patientDO.getLatLon().toString().split(",");
|
|
|
if (StringUtils.isNotBlank(patientDO.getHomeLatLon())&&latLon.length==2) {
|
|
|
String homeLatLon = patientDO.getHomeLatLon();
|
|
|
double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
|
|
|
double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
|
|
|
double homeDistance = countDistance.getDistance(Double.parseDouble(latLon[0]), Double.parseDouble(latLon[1]),
|
|
|
homeLat, homeLon);
|
|
|
if (homeDistance * 1000 > 50) {
|
|
|
tmp.put("atHome", false);
|
|
|
} else {
|
|
|
tmp.put("atHome", true);
|
|
|
}
|
|
|
} else {
|
|
|
tmp.put("atHome", true);
|
|
|
}
|
|
|
String locationAddress = LatitudeUtils.getLocationAddress(latLon[0], latLon[1]);
|
|
|
tmp.put("address", locationAddress);
|
|
|
} else {
|
|
|
tmp.put("atHome", true);
|
|
|
tmp.put("address", "");
|
|
|
}
|
|
|
String locationAddress = LatitudeUtils.getLocationAddress(latLon[0], latLon[1]);
|
|
|
tmp.put("address", locationAddress);
|
|
|
} else {
|
|
|
tmp.put("atHome", true);
|
|
|
tmp.put("address", "");
|
|
|
}
|
|
|
}
|
|
|
object.put("info", tmp);
|
|
|
|
|
|
break;
|
|
|
default:
|
|
|
String patientId = (String) list.get(i).get("id");
|