|
@ -315,6 +315,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(orderDO.getPatient(),devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
|
|
|
map.put("patientAddress",devicePatientDeviceDos.get(0).getSosAddress());
|
|
|
if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
|
|
|
map.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
|
|
|
}
|
|
@ -479,7 +480,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
"where 1=1 ";
|
|
|
String fliter = " ";
|
|
|
String sql = " select p.id patientCode,p.name,p.sex,p.photo,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," +
|
|
|
"ord.doctor_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
|
|
|
"ord.doctor_name,ord.update_user,ord.update_user_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
|
|
|
"where 1=1 ";
|
|
|
if (StringUtils.isNotBlank(doctor)){
|
|
|
fliter+=" and EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
|
|
@ -532,6 +533,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
}
|
|
|
tmp.put("conclusionStatusName",conclusionStatusName);
|
|
|
Integer statustemp = Integer.valueOf(one.get("status")+"");
|
|
|
if (-2==statustemp||-1==statustemp){
|
|
|
tmp.put("doctor",one.get("update_user"));
|
|
|
tmp.put("doctorName",one.get("update_user_name"));
|
|
|
}
|
|
|
String statusName = "";
|
|
|
switch (statustemp){
|
|
|
case -2:statusName="误警报";break;
|
|
@ -540,7 +545,6 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
case 1:statusName="申请中";break;
|
|
|
}
|
|
|
tmp.put("statusName",statusName);
|
|
|
result.add(tmp);
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(tmp.getString("idcard"));
|
|
|
tmp.put("age",age);
|
|
|
//患者设备
|
|
@ -551,6 +555,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
else {
|
|
|
tmp.put("deviceFlag","0");
|
|
|
}
|
|
|
result.add(tmp);
|
|
|
}
|
|
|
return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
|
|
|
}
|
|
@ -1094,7 +1099,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public JSONObject patientMonitoringInfo(String patient){
|
|
|
public JSONObject patientMonitoringInfo(String patient,String topicItem){
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("location",null);
|
|
|
result.put("fences",null);
|
|
@ -1102,74 +1107,79 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
|
result.put("fire",null);
|
|
|
result.put("deviceSn",null);
|
|
|
result.put("monitorInfo",null);
|
|
|
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);
|
|
|
if ((StringUtils.isNotBlank(topicItem)&&"preventLost".equals(topicItem))||null==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);
|
|
|
}
|
|
|
}
|
|
|
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);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
result.put("location",null);
|
|
|
if (fencesEnables.size()>0){
|
|
|
result.put("fences",fencesEnables);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
result.put("location",null);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
|
|
|
if (devicePatientDeviceDos.size()==0){
|
|
|
}
|
|
|
else{
|
|
|
try {
|
|
|
JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
|
|
|
result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
|
|
|
if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
|
|
|
result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
|
|
|
}
|
|
|
else {
|
|
|
result.put("monitorInfo",monitorUrl.getJSONObject(ResponseContant.resultMsg));
|
|
|
if ((StringUtils.isNotBlank(topicItem)&&"preventFall".equals(topicItem))||null==topicItem){
|
|
|
List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"12");
|
|
|
if (devicePatientDeviceDos.size()==0){
|
|
|
}
|
|
|
else{
|
|
|
try {
|
|
|
JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
|
|
|
result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
|
|
|
result.put("patientAddress",devicePatientDeviceDos.get(0).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();
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|