|
@ -32,12 +32,9 @@ import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.core.RowMapper;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
import java.sql.SQLException;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@ -377,7 +374,6 @@ public class PatientHealthIndexService {
|
|
|
com.alibaba.fastjson.JSONObject obj = new com.alibaba.fastjson.JSONObject();
|
|
|
obj.put("user", patient);
|
|
|
boolean hadData = false;
|
|
|
Date date = DateUtil.strToDateShort(dateString);
|
|
|
/***************** 按时间排序 ***************************/
|
|
|
|
|
|
String sql = "SELECT " +
|
|
@ -405,17 +401,15 @@ public class PatientHealthIndexService {
|
|
|
" order by record_date,id desc ";
|
|
|
List<Map<String, Object>> list = getPatientXT_JsonIot(sql,patient,dateString);
|
|
|
SimpleDateFormat dateFormat6 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
if (list != null && list.size() > 0) {
|
|
|
obj.put("type", 1);
|
|
|
obj.put("czrq", date);
|
|
|
obj.put("recordDate", date);
|
|
|
obj.put("sortDate", date);
|
|
|
obj.put("czrq", dateString);
|
|
|
obj.put("recordDate", dateString);
|
|
|
obj.put("sortDate", dateString);
|
|
|
for (Map<String, Object> item : list) {
|
|
|
String data = item.get("value1").toString();
|
|
|
String dataType = item.get("value2").toString();
|
|
|
String deviceSn = item.get("device_sn") == null ? "" : item.get("device_sn").toString();
|
|
|
System.out.println(item.get("record_date").toString());
|
|
|
Date recordDate = dateFormat6.parse(item.get("record_date").toString());
|
|
|
Long id = Long.parseLong(item.get("id") + "");
|
|
|
Date createDate = (Date)item.get("createDate");
|
|
@ -426,43 +420,43 @@ public class PatientHealthIndexService {
|
|
|
if (data != null && dataType != null) {
|
|
|
if (dataType.equals("1")) {
|
|
|
obj.put("value1", data);
|
|
|
obj.put("time1", recordDate);
|
|
|
obj.put("time1", recordTime);
|
|
|
obj.put("id1", id);
|
|
|
obj.put("deviceSn1", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("2")) {
|
|
|
obj.put("value2", data);
|
|
|
obj.put("time2", recordDate);
|
|
|
obj.put("time2", recordTime);
|
|
|
obj.put("id2", id);
|
|
|
obj.put("deviceSn2", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("3")) {
|
|
|
obj.put("value3", data);
|
|
|
obj.put("time3", recordDate);
|
|
|
obj.put("time3", recordTime);
|
|
|
obj.put("id3", id);
|
|
|
obj.put("deviceSn3", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("4")) {
|
|
|
obj.put("value4", data);
|
|
|
obj.put("time4", recordDate);
|
|
|
obj.put("time4", recordTime);
|
|
|
obj.put("id4", id);
|
|
|
obj.put("deviceSn4", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("5")) {
|
|
|
obj.put("value5", data);
|
|
|
obj.put("time5", recordDate);
|
|
|
obj.put("time5", recordTime);
|
|
|
obj.put("id5", id);
|
|
|
obj.put("deviceSn5", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("6")) {
|
|
|
obj.put("value6", data);
|
|
|
obj.put("time6", recordDate);
|
|
|
obj.put("time6", recordTime);
|
|
|
obj.put("id6", id);
|
|
|
obj.put("deviceSn6", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("7")) {
|
|
|
obj.put("value7", data);
|
|
|
obj.put("time7", recordDate);
|
|
|
obj.put("time7", recordTime);
|
|
|
obj.put("id7", id);
|
|
|
obj.put("deviceSn7", deviceSn);
|
|
|
hadData = true;
|
|
@ -781,12 +775,7 @@ public class PatientHealthIndexService {
|
|
|
" and a.type="+type+" and a.record_date >= '"+DateUtil.dateToStrLong(startDate)+"' and a.record_date <= '"+DateUtil.dateToStrLong(endDate)+"' " +
|
|
|
"and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d')" +
|
|
|
" order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit "+page+" ,"+size;
|
|
|
return jdbcTemplate.query(sql, new RowMapper<String>() {
|
|
|
@Override
|
|
|
public String mapRow(ResultSet resultSet, int i) throws SQLException {
|
|
|
return null;
|
|
|
}
|
|
|
});
|
|
|
return jdbcTemplate.queryForList(sql, String.class);
|
|
|
}
|
|
|
|
|
|
|
|
@ -1413,9 +1402,7 @@ public class PatientHealthIndexService {
|
|
|
json.put("value7", map.get("value7"));
|
|
|
json.put("deviceSn", map.get("device_sn") == null ? "" : map.get("device_sn"));
|
|
|
json.put("type", map.get("type"));
|
|
|
System.out.println(map.get("record_date"));
|
|
|
SimpleDateFormat dateFormat6 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date date = dateFormat6.parse(map.get("record_date").toString()) ;
|
|
|
if (type == 2) {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
@ -1762,7 +1749,7 @@ public class PatientHealthIndexService {
|
|
|
}
|
|
|
|
|
|
public DevicePatientHealthIndex findLastData(String patientCode, int type) {
|
|
|
String sql = "select a.* from wlyy_patient_health_index a where a.user=?1 and a.type=?2 and a.del='1' order by a.record_date desc limit 0,1";
|
|
|
String sql = "select a.* from wlyy_patient_health_index a where a.user='"+patientCode+"' and a.type="+type+" and a.del='1' order by a.record_date desc limit 0,1";
|
|
|
List<DevicePatientHealthIndex> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(DevicePatientHealthIndex.class));
|
|
|
if(list.size()>0){
|
|
|
return list.get(0);
|