|
@ -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);
|
|
@ -749,16 +760,14 @@ public class PatientInfoPlatFormService {
|
|
|
if (contact_status.size()>0){
|
|
|
detailInfo.put("contact_status",contact_status.get(0));
|
|
|
}
|
|
|
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
|
|
|
switch (category_code){
|
|
|
case "1"://血糖 最近一次血糖、在线状态
|
|
|
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 limit 1 ": " 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));
|
|
|
}else {
|
|
@ -769,8 +778,9 @@ 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 limit 1 ": " ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("healthIndex",sqlResult.get(0));
|
|
|
}else {
|
|
@ -786,6 +796,18 @@ 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 limit 1 ";
|
|
|
}
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
@ -815,19 +837,23 @@ 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 limit 1 ": " order by create_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0) {
|
|
|
detailInfo.put("steps",sqlResult.get(0));
|
|
|
}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 limit 1 ": " ORDER BY sort_date DESC LIMIT 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("heartRate",sqlResult.get(0));
|
|
|
}else {
|
|
@ -846,6 +872,23 @@ public class PatientInfoPlatFormService {
|
|
|
tmp.put("city", dw.getString("last_city"));
|
|
|
tmp.put("province", dw.getString("last_province"));
|
|
|
tmp.put("address", dw.getString("last_address"));
|
|
|
Long aLong = dw.getJSONObject("created_at").getLong("$date");
|
|
|
tmp.put("createTime",aLong==null?"":DateUtil.dateToStrLong(new Date(aLong)));
|
|
|
//获取居民家庭定位
|
|
|
BasePatientDO p = patientDao.findById(patient);
|
|
|
if(p != null && StringUtils.isNotBlank(p.getHomeLatLon())){
|
|
|
String homeLatLon = p.getHomeLatLon();
|
|
|
double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
|
|
|
double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
|
|
|
double homeDistance = countDistance.getDistance(homeLat,homeLon,lat,lon);
|
|
|
if (homeDistance * 1000 > 50) {
|
|
|
detailInfo.put("isAtHome","离家");
|
|
|
}else {
|
|
|
detailInfo.put("isAtHome","居家");
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("isAtHome","");
|
|
|
}
|
|
|
detailInfo.put("location", tmp);
|
|
|
}
|
|
|
}
|
|
@ -853,8 +896,9 @@ 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 limit 1 ": " 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));
|
|
@ -878,9 +922,9 @@ 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 limit 1 ": " 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));
|
|
@ -900,9 +944,9 @@ 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 limit 1 ": " 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));
|
|
@ -936,9 +980,9 @@ 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 limit 1 ": " 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));
|
|
@ -958,9 +1002,9 @@ 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 limit 1 ": " 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));
|
|
@ -997,6 +1041,18 @@ 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 limit 1 ";
|
|
|
}
|
|
|
sqlResult = jdbcTemplate.queryForList(sql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("warnStatus",true);
|
|
@ -1004,24 +1060,43 @@ public class PatientInfoPlatFormService {
|
|
|
}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 limit 1 ": " ORDER BY create_time DESC limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if (sqlResult.size()>0){
|
|
|
detailInfo.put("newlonlat",sqlResult.get(0));
|
|
|
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);
|
|
|
|
|
|
//判断是否居家
|
|
|
BasePatientDO p = patientDao.findById(patient);
|
|
|
if(p != null && StringUtils.isNotBlank(p.getHomeLatLon())){
|
|
|
String homeLatLon = p.getHomeLatLon();
|
|
|
double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
|
|
|
double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
|
|
|
double homeDistance = countDistance.getDistance(homeLat,homeLon,Double.parseDouble(sqlResult.get(0).get("lat").toString()),(Double.parseDouble(sqlResult.get(0).get("lon").toString())));
|
|
|
if (homeDistance * 1000 > 50) {
|
|
|
detailInfo.put("isAtHome","离家");
|
|
|
}else {
|
|
|
detailInfo.put("isAtHome","居家");
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("isAtHome","");
|
|
|
}
|
|
|
}else {
|
|
|
detailInfo.put("newlonlat",null);
|
|
|
detailInfo.put("location", null);
|
|
|
detailInfo.put("isAtHome","");
|
|
|
}
|
|
|
break;
|
|
|
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 limit 1 " : " 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));
|
|
@ -1032,22 +1107,36 @@ public class PatientInfoPlatFormService {
|
|
|
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));
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
|
//门禁数据
|
|
|
sql = " SELECT f.img,CAST(DATE_FORMAT(f.pass_time,'%Y-%m-%d %H:%i:%S') as char) passTime,p.name,f.patient from base_device_face_record f " +
|
|
|
" inner join base_patient p on f.patient = p.id " +
|
|
|
" where f.patient = '"+patient+"' ";
|
|
|
pageSql = bl?" and f.pass_time >= '"+beforeTime+"' and f.pass_time <= '"+afterTime+"' ORDER BY f.pass_time desc limit 1 ":" ORDER BY f.pass_time desc limit 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if(sqlResult.size()>0){
|
|
|
detailInfo.putAll(sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("img","");
|
|
|
detailInfo.put("passTime","");
|
|
|
detailInfo.put("name","");
|
|
|
detailInfo.put("patient","");
|
|
|
}
|
|
|
break;
|
|
|
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 limit 1 ":" 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));
|
|
@ -1055,12 +1144,29 @@ public class PatientInfoPlatFormService {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}
|
|
|
break;
|
|
|
case "21"://电表监测
|
|
|
if(patientDO!=null){
|
|
|
String idcard = patientDO.getIdcard();
|
|
|
sql = "SELECT syndyqzl,syndfy,lszyql from hz.gsq_hzrqjmyhglxtrqgrxx WHERE yhsfzh =? ORDER BY tongid desc LIMIT 1 " ;
|
|
|
sqlResult = jdbcTemplate.queryForList(sql,new Object[]{idcard});
|
|
|
detailInfo.put("naturalGasRecord",sqlResult);
|
|
|
case "21"://todo 天然气
|
|
|
/*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 ";
|
|
|
pageSql = bl?" and o.create_time >= '"+beforeTime+"' and o.create_time <= '"+afterTime+"' ORDER BY create_time desc limit 1 ":" 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));
|
|
|
}else {
|
|
|
detailInfo.put("warnStatus",false);
|
|
|
}*/
|
|
|
sql = " SELECT g.syndyqzl,g.syndfy,g.lszyql,CAST(DATE_FORMAT(g.tong_time,'%Y-%m-%d %H:%i:%S') as char) as createTime from hz.gsq_hzrqjmyhglxtrqgrxx g " +
|
|
|
" inner join base.base_patient p on g.yhsfzh = p.idcard " +
|
|
|
" where p.id = '"+patient+"' ";
|
|
|
pageSql = bl?" and g.tong_time >= '"+beforeTime+"' and g.tong_time <= '"+afterTime+"' ORDER BY g.tongid desc LIMIT 1 ":" ORDER BY g.tongid desc LIMIT 1 ";
|
|
|
sqlResult = jdbcTemplate.queryForList(sql+pageSql);
|
|
|
if(sqlResult.size() >0 ){
|
|
|
detailInfo.putAll(sqlResult.get(0));
|
|
|
}else {
|
|
|
detailInfo.put("syndyqzl","");
|
|
|
detailInfo.put("syndfy","");
|
|
|
detailInfo.put("lszyql","");
|
|
|
}
|
|
|
}
|
|
|
return detailInfo;
|