|
@ -706,7 +706,7 @@ public class PatientInfoPlatFormService {
|
|
|
/**
|
|
|
*获取设备详情
|
|
|
*/
|
|
|
public List<Map<String,Object>> getPatientDeviceInfoWithDetail(String patient,String deviceSn){
|
|
|
public List<Map<String,Object>> getPatientDeviceInfoWithDetail(String patient,String deviceSn,String warnTime){
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
String sql = "select dd.photo,pd.device_sn,dd.brands,dd.category_code,dd.model,pd.device_name,date_format(pd.czrq,'%Y-%m-%d %H:%i:%S' ) deviceTime,dd.device_type as deviceType " +
|
|
|
"from dm_device dd INNER JOIN wlyy_patient_device pd on dd.category_code = pd.category_code INNER JOIN wlyy_devices wd on dd.model = wd.device_model and pd.device_sn = wd.device_code \n" +
|
|
@ -723,7 +723,7 @@ public class PatientInfoPlatFormService {
|
|
|
for (Map<String,Object> tmp :list){
|
|
|
String category_code = tmp.get("category_code").toString();
|
|
|
String deviceSN = tmp.get("device_sn").toString();
|
|
|
Map<String,Object> detailInfo = getDeviceIndexAndOrder(category_code,deviceSN,patient);
|
|
|
Map<String,Object> detailInfo = getDeviceIndexAndOrder(category_code,deviceSN,patient,warnTime);
|
|
|
tmp.put("detailInfo",detailInfo);
|
|
|
}
|
|
|
return list;
|
|
@ -741,7 +741,18 @@ public class PatientInfoPlatFormService {
|
|
|
* 血压2:最近一次收缩压,舒张压、在线状态
|
|
|
* 血糖1:最近一次血糖、在线状态
|
|
|
*/
|
|
|
public Map<String,Object> getDeviceIndexAndOrder(String category_code,String deviceSn,String patient){
|
|
|
public Map<String,Object> getDeviceIndexAndOrder(String category_code,String deviceSn,String patient,String filterTime){
|
|
|
String beforeTime = "";
|
|
|
String afterTime = "";
|
|
|
boolean bl = false;//是否进行时间范围查询
|
|
|
String pageSql = "";
|
|
|
if(StringUtils.isNotBlank(filterTime)){
|
|
|
//获取前后三十分钟的时间
|
|
|
List<String> timeList = DateUtil.getTimeByBeforeAndAfterTime(filterTime, 30 * 60 * 1000);
|
|
|
beforeTime = timeList.get(0);
|
|
|
afterTime = timeList.get(1);
|
|
|
bl = true;
|
|
|
}
|
|
|
Map<String,Object> detailInfo = new HashMap<>();
|
|
|
String sql = " select IFNULL(contact_status,0) contact_status from wlyy_devices where device_code='"+deviceSn+"' ";
|
|
|
List<String> contact_status = jdbcTemplate.queryForList(sql,String.class);
|
|
@ -754,10 +765,15 @@ public class PatientInfoPlatFormService {
|
|
|
sql = " select *,CAST(DATE_FORMAT(record_date,'%Y-%m-%d %H:%i:%S') as char) record_date, " +
|
|
|
" CAST(DATE_FORMAT(sort_date,'%Y-%m-%d %H:%i:%S') as char) sort_date, " +
|
|
|
" CAST(DATE_FORMAT(czrq,'%Y-%m-%d %H:%i:%S') as char) czrq from wlyy_patient_health_index " +
|
|
|
" where device_sn='"+deviceSn+"' and del=1 ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" where device_sn='"+deviceSn+"' and del=1 ";
|
|
|
pageSql =bl?" and record_date >= '"+beforeTime+"' and record_date <= '"+afterTime+"' ORDER BY sort_date DESC ": " ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("healthIndex",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("healthIndex",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("healthIndexList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("healthIndex",null);
|
|
|
}
|
|
@ -766,10 +782,15 @@ public class PatientInfoPlatFormService {
|
|
|
sql = " select *,CAST(DATE_FORMAT(record_date,'%Y-%m-%d %H:%i:%S') as char) record_date, " +
|
|
|
" CAST(DATE_FORMAT(sort_date,'%Y-%m-%d %H:%i:%S') as char) sort_date, " +
|
|
|
" CAST(DATE_FORMAT(czrq,'%Y-%m-%d %H:%i:%S') as char) czrq from wlyy_patient_health_index " +
|
|
|
" where device_sn='"+deviceSn+"' and del=1 ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" where device_sn='"+deviceSn+"' and del=1 ";
|
|
|
pageSql =bl?" and record_date >= '"+beforeTime+"' and record_date <= '"+afterTime+"' ORDER BY sort_date DESC ": " ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("healthIndex",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("healthIndex",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("healthIndexList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("healthIndex",null);
|
|
|
}
|
|
@ -783,10 +804,26 @@ public class PatientInfoPlatFormService {
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
if(bl){
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_emergency_assistance_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' " +
|
|
|
" UNION " +
|
|
|
" select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' " +
|
|
|
" ORDER BY create_time desc ";
|
|
|
}
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfo",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
@ -812,19 +849,27 @@ public class PatientInfoPlatFormService {
|
|
|
detailInfo.put("wear_flagName", null);
|
|
|
detailInfo.put("remaining_power",null);
|
|
|
}
|
|
|
sql = "select *,CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) create_time from base_patient_step where 1=1 and device_sn='"+deviceSn+"' order by create_time desc limit 1";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
//手表步数数据
|
|
|
sql = "select *,CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) create_time " +
|
|
|
" from base_patient_step where 1=1 and device_sn='"+deviceSn+"' ";
|
|
|
pageSql =bl?" and create_time >= '"+beforeTime+"' and create_time <= '"+afterTime+"' order by create_time desc ": " order by create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0) {
|
|
|
detailInfo.put("steps",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("steps",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("stepsList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("steps","无步数数据");
|
|
|
}
|
|
|
//手表心率数据
|
|
|
sql = " select *,CAST(DATE_FORMAT(record_date,'%Y-%m-%d %H:%i:%S') as char) record_date, " +
|
|
|
" CAST(DATE_FORMAT(sort_date,'%Y-%m-%d %H:%i:%S') as char) sort_date, " +
|
|
|
" CAST(DATE_FORMAT(czrq,'%Y-%m-%d %H:%i:%S') as char) czrq from wlyy_patient_health_index " +
|
|
|
" where type=5 and device_sn='"+deviceSn+"' and del=1 ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" where type=5 and device_sn='"+deviceSn+"' and del=1 ";
|
|
|
pageSql =bl?" and record_date >= '"+beforeTime+"' and record_date <= '"+afterTime+"' ORDER BY sort_date DESC ": " ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("heartRate",sqlResult.get(0));
|
|
|
}else {
|
|
@ -850,11 +895,16 @@ public class PatientInfoPlatFormService {
|
|
|
case "7"://报警器 电量 是否报警、在线状态
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_emergency_assistance_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql =bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc ": " ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
@ -875,12 +925,16 @@ public class PatientInfoPlatFormService {
|
|
|
case "12"://监控
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql =bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc ": " ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
@ -897,12 +951,16 @@ public class PatientInfoPlatFormService {
|
|
|
case "13"://床带 是否压床、 心率和呼吸频率、在线状态
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql =bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc ": " ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else{
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
@ -933,12 +991,16 @@ public class PatientInfoPlatFormService {
|
|
|
case "14"://燃气
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql =bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc ": " ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
@ -955,12 +1017,16 @@ public class PatientInfoPlatFormService {
|
|
|
case "15"://烟感
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql =bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc ": " ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
@ -994,17 +1060,39 @@ public class PatientInfoPlatFormService {
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
if(bl){
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_emergency_assistance_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' " +
|
|
|
" UNION " +
|
|
|
" select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' " +
|
|
|
"ORDER BY create_time desc ";
|
|
|
}
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
|
sql = "SELECT *,CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) create_time FROM base_yxdevice_index WHERE sn = '" + deviceSn + "' AND lon != 0 AND lat != 0 ORDER BY create_time DESC limit 1";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
sql = "SELECT *,CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) create_time FROM base_yxdevice_index " +
|
|
|
" WHERE sn = '" + deviceSn + "' AND lon != 0 AND lat != 0 ";
|
|
|
pageSql =bl?" and create_time >= '"+beforeTime+"' and create_time <= '"+afterTime+"' ORDER BY create_time ": " ORDER BY create_time DESC limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("newlonlat",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("newlonlat",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("newlonlatList",sqlResult);
|
|
|
}
|
|
|
String address = LatitudeUtils.getLocationAddress(sqlResult.get(0).get("lat").toString(), sqlResult.get(0).get("lon").toString());
|
|
|
// JSONObject dz = gpsUtil.gcj02_To_Bd09(Double.parseDouble(sqlResult.get(0).get("lat").toString()),Double.parseDouble(sqlResult.get(0).get("lon").toString()));
|
|
|
detailInfo.put("location", address);
|
|
@ -1016,36 +1104,49 @@ public class PatientInfoPlatFormService {
|
|
|
case "18"://日常用水监测
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql =bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc " : " ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
|
case "19"://门禁监测
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql = bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc ":" ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
|
case "20"://电表监测
|
|
|
sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
|
|
|
" o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o " +
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 " +
|
|
|
"ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
" INNER JOIN base_patient p on p.id = o.patient where device_sn='"+deviceSn+"' and o.status=1 ";
|
|
|
pageSql = bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc ":" ORDER BY create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
if(!bl){
|
|
|
detailInfo.put("orderInfo",sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("orderInfoList",sqlResult);
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|