|  | @ -169,6 +169,8 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |             tmp.put("address",patientDO.getAddress());
 |  |             tmp.put("address",patientDO.getAddress());
 | 
												
													
														
															|  |             tmp.put("patient",patientDO.getId());
 |  |             tmp.put("patient",patientDO.getId());
 | 
												
													
														
															|  |             tmp.put("pad_imei",patientDO.getPadImei());
 |  |             tmp.put("pad_imei",patientDO.getPadImei());
 | 
												
													
														
															|  | 
 |  |             tmp.put("mobile",patientDO.getMobile());
 | 
												
													
														
															|  | 
 |  |             tmp.put("photo",patientDO.getPhoto());
 | 
												
													
														
															|  |             String idcard = patientDO.getIdcard();
 |  |             String idcard = patientDO.getIdcard();
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(idcard)){
 |  |             if (StringUtils.isNotBlank(idcard)){
 | 
												
													
														
															|  |                 Integer age = IdCardUtil.getAgeForIdcard(idcard);
 |  |                 Integer age = IdCardUtil.getAgeForIdcard(idcard);
 | 
												
											
												
													
														
															|  | @ -250,11 +252,13 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |         emeWarn.put("unfinish",unfinish);
 |  |         emeWarn.put("unfinish",unfinish);
 | 
												
													
														
															|  |         emeWarn.put("finish",finish);
 |  |         emeWarn.put("finish",finish);
 | 
												
													
														
															|  |         //获取最近一次工单
 |  |         //获取最近一次工单
 | 
												
													
														
															|  |         sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc, " +
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc,TIMESTAMPDIFF(YEAR,p.birthday,NOW()) AS age," +
 | 
												
													
														
															|  | 
 |  |                 " CASE sex WHEN 1 THEN '男' WHEN 2 THEN '女' ELSE sex END AS sex, " +
 | 
												
													
														
															|  |                 " 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 " +
 |  |                 " 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 o.patient='"+patient+"' and o.`status` <>-1 " +
 |  |                 " where o.patient='"+patient+"' and o.`status` <>-1 " +
 | 
												
													
														
															|  |                 " UNION " +
 |  |                 " UNION " +
 | 
												
													
														
															|  |                 "select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 "select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc,TIMESTAMPDIFF(YEAR,p.birthday,NOW()) AS age, " +
 | 
												
													
														
															|  | 
 |  |                 " CASE sex WHEN 1 THEN '男' WHEN 2 THEN '女' ELSE sex END AS sex, " +
 | 
												
													
														
															|  |                 " 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 " +
 |  |                 " 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 o.patient='"+patient+"' and o.`status` <>-1 " +
 |  |                 " where o.patient='"+patient+"' and o.`status` <>-1 " +
 | 
												
													
														
															|  |                 "ORDER BY create_time desc limit 1 ";
 |  |                 "ORDER BY create_time desc limit 1 ";
 | 
												
											
												
													
														
															|  | @ -280,7 +284,8 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |         olderService.put("unfinish",unfinish);
 |  |         olderService.put("unfinish",unfinish);
 | 
												
													
														
															|  |         olderService.put("finish",finish);
 |  |         olderService.put("finish",finish);
 | 
												
													
														
															|  |         //最近一次记录
 |  |         //最近一次记录
 | 
												
													
														
															|  |         sql = " select o.id,p.name,p.id as patient,o.status,o.hospital_name hospitalName,p.idcard,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time,GROUP_CONCAT(DISTINCT fed.name SEPARATOR '、' ) serveItems " +
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = " select o.id,p.name,p.id as patient,o.status,o.hospital_name hospitalName,p.idcard,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time,GROUP_CONCAT(DISTINCT fed.name SEPARATOR '、' ) serveItems,TIMESTAMPDIFF(YEAR,p.birthday,NOW()) AS age," +
 | 
												
													
														
															|  | 
 |  |                 " CASE sex WHEN 1 THEN '男' WHEN 2 THEN '女' ELSE sex END AS sex " +
 | 
												
													
														
															|  |                 " from base_life_care_order o INNER JOIN base_patient p on o.patient = p.id INNER JOIN base_life_care_fee_detail fed on o.id = fed.order_id " +
 |  |                 " from base_life_care_order o INNER JOIN base_patient p on o.patient = p.id INNER JOIN base_life_care_fee_detail fed on o.id = fed.order_id " +
 | 
												
													
														
															|  |                 " and fed.status<>3 where o.patient='"+patient+"' and o.`status`<>-1 and o.`status`<>0  " +
 |  |                 " and fed.status<>3 where o.patient='"+patient+"' and o.`status`<>-1 and o.`status`<>0  " +
 | 
												
													
														
															|  |                 "GROUP BY o.id ORDER BY create_time desc limit 1; ";
 |  |                 "GROUP BY o.id ORDER BY create_time desc limit 1; ";
 | 
												
											
												
													
														
															|  | @ -706,7 +711,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<>();
 |  |         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 " +
 |  |         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" +
 |  |                 "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 +728,7 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |         for (Map<String,Object> tmp :list){
 |  |         for (Map<String,Object> tmp :list){
 | 
												
													
														
															|  |             String category_code = tmp.get("category_code").toString();
 |  |             String category_code = tmp.get("category_code").toString();
 | 
												
													
														
															|  |             String deviceSN = tmp.get("device_sn").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);
 |  |             tmp.put("detailInfo",detailInfo);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return list;
 |  |         return list;
 | 
												
											
												
													
														
															|  | @ -741,7 +746,18 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |      * 血压2:最近一次收缩压,舒张压、在线状态
 |  |      * 血压2:最近一次收缩压,舒张压、在线状态
 | 
												
													
														
															|  |      * 血糖1:最近一次血糖、在线状态
 |  |      * 血糖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<>();
 |  |         Map<String,Object> detailInfo = new HashMap<>();
 | 
												
													
														
															|  |         String sql = " select IFNULL(contact_status,0) contact_status from wlyy_devices where device_code='"+deviceSn+"' ";
 |  |         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);
 |  |         List<String> contact_status = jdbcTemplate.queryForList(sql,String.class);
 | 
												
											
												
													
														
															|  | @ -754,8 +770,9 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |                 sql = " select *,CAST(DATE_FORMAT(record_date,'%Y-%m-%d %H:%i:%S') as char) record_date,  " +
 |  |                 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(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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("healthIndex",sqlResult.get(0));
 |  |                     detailInfo.put("healthIndex",sqlResult.get(0));
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
											
												
													
														
															|  | @ -766,8 +783,9 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |                 sql = " select *,CAST(DATE_FORMAT(record_date,'%Y-%m-%d %H:%i:%S') as char) record_date,  " +
 |  |                 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(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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("healthIndex",sqlResult.get(0));
 |  |                     detailInfo.put("healthIndex",sqlResult.get(0));
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
											
												
													
														
															|  | @ -783,6 +801,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 " +
 |  |                         " 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 " +
 |  |                         " 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 ";
 |  |                         "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);
 |  |                 sqlResult = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  |                 if (sqlResult.size()>0){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
											
												
													
														
															|  | @ -812,19 +842,23 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |                     detailInfo.put("wear_flagName", null);
 |  |                     detailInfo.put("wear_flagName", null);
 | 
												
													
														
															|  |                     detailInfo.put("remaining_power",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) {
 |  |                 if (sqlResult.size()>0) {
 | 
												
													
														
															|  |                     detailInfo.put("steps",sqlResult.get(0));
 |  |                     detailInfo.put("steps",sqlResult.get(0));
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
													
														
															|  |                     detailInfo.put("steps","无步数数据");
 |  |                     detailInfo.put("steps","无步数数据");
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 //手表心率数据
 | 
												
													
														
															|  |                 sql = " select *,CAST(DATE_FORMAT(record_date,'%Y-%m-%d %H:%i:%S') as char) record_date,  " +
 |  |                 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(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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("heartRate",sqlResult.get(0));
 |  |                     detailInfo.put("heartRate",sqlResult.get(0));
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
											
												
													
														
															|  | @ -843,6 +877,23 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |                         tmp.put("city", dw.getString("last_city"));
 |  |                         tmp.put("city", dw.getString("last_city"));
 | 
												
													
														
															|  |                         tmp.put("province", dw.getString("last_province"));
 |  |                         tmp.put("province", dw.getString("last_province"));
 | 
												
													
														
															|  |                         tmp.put("address", dw.getString("last_address"));
 |  |                         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);
 |  |                         detailInfo.put("location", tmp);
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
											
												
													
														
															|  | @ -850,8 +901,9 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |             case "7"://报警器 电量  是否报警、在线状态
 |  |             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,  " +
 |  |                 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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
											
												
													
														
															|  | @ -875,9 +927,9 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |             case "12"://监控
 |  |             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,  " +
 |  |                 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 " +
 |  |                      " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
											
												
													
														
															|  | @ -897,9 +949,9 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |             case "13"://床带 是否压床、 心率和呼吸频率、在线状态
 |  |             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,  " +
 |  |                 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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
											
												
													
														
															|  | @ -933,9 +985,9 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |             case "14"://燃气
 |  |             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,  " +
 |  |                 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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
											
												
													
														
															|  | @ -955,9 +1007,9 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |             case "15"://烟感
 |  |             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,  " +
 |  |                 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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
											
												
													
														
															|  | @ -994,6 +1046,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 " +
 |  |                         " 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  " +
 |  |                         " 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 ";
 |  |                         "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);
 |  |                 sqlResult = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  |                 if (sqlResult.size()>0){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
											
												
													
														
															|  | @ -1001,54 +1065,114 @@ public class PatientInfoPlatFormService {
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",false);
 |  |                     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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("newlonlat",sqlResult.get(0));
 |  |                     detailInfo.put("newlonlat",sqlResult.get(0));
 | 
												
													
														
															|  |                     String address = LatitudeUtils.getLocationAddress(sqlResult.get(0).get("lat").toString(), sqlResult.get(0).get("lon").toString());
 |  |                     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()));
 |  | //                    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);
 |  |                     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 {
 |  |                 }else {
 | 
												
													
														
															|  |                     detailInfo.put("newlonlat",null);
 |  |                     detailInfo.put("newlonlat",null);
 | 
												
													
														
															|  |                     detailInfo.put("location", null);
 |  |                     detailInfo.put("location", null);
 | 
												
													
														
															|  | 
 |  |                     detailInfo.put("isAtHome","");
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 break;
 |  |                 break;
 | 
												
													
														
															|  |             case "18"://日常用水监测
 |  |             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,  " +
 |  |                 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 " +
 |  |                       " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",false);
 |  |                     detailInfo.put("warnStatus",false);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  |             case "19"://门禁监测
 |  |             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,  " +
 |  |                 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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",false);
 |  |                     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"://电表监测
 |  |             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,  " +
 |  |                 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 " +
 |  |                         " 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){
 |  |                 if (sqlResult.size()>0){
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",true);
 |  |                     detailInfo.put("warnStatus",true);
 | 
												
													
														
															|  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 |  |                     detailInfo.put("orderInfo",sqlResult.get(0));
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
													
														
															|  |                     detailInfo.put("warnStatus",false);
 |  |                     detailInfo.put("warnStatus",false);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  | 
 |  |             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;
 |  |         return detailInfo;
 | 
												
													
														
															|  |     }
 |  |     }
 |