Browse Source

代码修改

liubing 3 years ago
parent
commit
874663bd94

+ 23 - 7
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -32,6 +32,7 @@ import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
@ -727,7 +728,7 @@ 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+"' ORDER BY sort_date DESC LIMIT 1  ";
                        " where device_sn='"+deviceSn+"' and del=1 ORDER BY sort_date DESC LIMIT 1  ";
                List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
                if (sqlResult.size()>0){
                    detailInfo.put("healthIndex",sqlResult.get(0));
@ -739,7 +740,7 @@ 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+"' ORDER BY sort_date DESC LIMIT 1  ";
                        " where device_sn='"+deviceSn+"' and del=1 ORDER BY sort_date DESC LIMIT 1  ";
                sqlResult = jdbcTemplate.queryForList(sql);
                if (sqlResult.size()>0){
                    detailInfo.put("healthIndex",sqlResult.get(0));
@ -779,14 +780,18 @@ public class PatientInfoPlatFormService {
                } else {
                    detailInfo.put("contact_status",1);
                }
                sql = "select * from base_patient_step where 1=1  and device_sn='"+deviceSn+"' order by create_time desc limit 1";
                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);
                if (sqlResult.size()>0) {
                    detailInfo.put("steps",sqlResult.get(0));
                }else {
                    detailInfo.put("steps","无步数数据");
                }
                sql ="SELECT * FROM wlyy_patient_health_index WHERE type = 5 and device_sn = '"+deviceSn+"' AND del = 1 ORDER BY record_date DESC LIMIT 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 type=5 and device_sn='"+deviceSn+"' and del=1 ORDER BY sort_date DESC LIMIT 1  ";
                sqlResult = jdbcTemplate.queryForList(sql);
                if (sqlResult.size()>0){
                    detailInfo.put("heartRate",sqlResult.get(0));
@ -933,6 +938,16 @@ public class PatientInfoPlatFormService {
                    detailInfo.put("value",null);
                    detailInfo.put("record_time",null);
                }
                sql = " select temperature_value ,record_time as temperature_value_record_time  from base_device_health_index where device_sn='"+deviceSn+"' and temperature_value is not null  ORDER BY record_time desc limit 1 ";
                sqlResult = jdbcTemplate.queryForList(sql);
                if (sqlResult.size()>0){
                    detailInfo.putAll(sqlResult.get(0));
                }
                else {
                    detailInfo.put("temperature_value",null);
                    detailInfo.put("temperature_value_record_time",null);
                }
                break;
            case "16"://拐杖 是否预警
                sql = "  select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc,  " +
@ -950,12 +965,13 @@ public class PatientInfoPlatFormService {
                }else {
                    detailInfo.put("warnStatus",false);
                }
                sql = "SELECT * FROM base_yxdevice_index  WHERE sn = '" + deviceSn + "' AND lon != 0 AND lat != 0 ORDER BY create_time DESC limit 1";
                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);
                if (sqlResult.size()>0){
                    detailInfo.put("newlonlat",sqlResult.get(0));
                    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", dz);
                    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);
                }else {
                    detailInfo.put("newlonlat",null);
                    detailInfo.put("location", null);