|
@ -0,0 +1,1599 @@
|
|
|
package com.yihu.jw.care.service.device;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.care.dao.device.DeviceDetailDao;
|
|
|
import com.yihu.jw.care.dao.device.DevicePatientHealthIndexDao;
|
|
|
import com.yihu.jw.care.dao.device.PatientDeviceDao;
|
|
|
import com.yihu.jw.care.util.CommonUtil;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.device.DeviceDetail;
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
|
|
|
import com.yihu.jw.entity.care.device.PatientDevice;
|
|
|
import com.yihu.jw.message.dao.MessageDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Component
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealthIndex, DevicePatientHealthIndexDao> {
|
|
|
private Logger logger = LoggerFactory.getLogger(PatientHealthIndexService.class);
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
private DevicePatientHealthIndexDao patientHealthIndexDao;
|
|
|
@Autowired
|
|
|
private MessageDao messageDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
@Autowired
|
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
@Autowired
|
|
|
private CommonUtil commonUtil;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private DeviceDetailDao deviceDetailDao;
|
|
|
|
|
|
// 血糖餐前最小值
|
|
|
public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4;
|
|
|
// 血糖餐前最大值
|
|
|
public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7;
|
|
|
// 血糖餐后最小值
|
|
|
public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4;
|
|
|
// 血糖餐后最大值
|
|
|
public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1;
|
|
|
|
|
|
// 舒张压最小值
|
|
|
public static final double HEALTH_STANDARD_SZY_MIN = 60;
|
|
|
// 舒张压最大值
|
|
|
public static final double HEALTH_STANDARD_SZY_MAX = 90;
|
|
|
// 收缩压最小值
|
|
|
public static final double HEALTH_STANDARD_SSY_MIN = 90;
|
|
|
// 收缩压最大值
|
|
|
public static final double HEALTH_STANDARD_SSY_MAX = 140;
|
|
|
|
|
|
/**
|
|
|
* 获取居民标准预警值
|
|
|
*
|
|
|
* @param type
|
|
|
* @param patientCode
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getealthStandard(Integer type, String patientCode) {
|
|
|
//血糖校验
|
|
|
JSONObject json = new JSONObject();
|
|
|
if (type == 1) {
|
|
|
// 血糖记录,查询患者血糖预警值
|
|
|
Double maxValueBefore = HEALTH_STANDARD_ST_MAX_BEFORE;
|
|
|
Double minValueBefore = HEALTH_STANDARD_ST_MIN_BEFORE;
|
|
|
Double maxValueAfter = HEALTH_STANDARD_ST_MAX_AFTER;
|
|
|
Double minValueAfter = HEALTH_STANDARD_ST_MIN_AFTER;
|
|
|
json.put("maxValueAfter", maxValueAfter);
|
|
|
json.put("maxValueBefore", maxValueBefore);
|
|
|
json.put("minValueBefore", minValueBefore);
|
|
|
json.put("minValueAfter", minValueAfter);
|
|
|
}
|
|
|
//血压校验
|
|
|
else if (type == 2) {
|
|
|
// 血压记录,查询患者血压预警值
|
|
|
Double maxValueSSY = HEALTH_STANDARD_SSY_MAX;
|
|
|
Double minValueSSY = HEALTH_STANDARD_SSY_MIN;
|
|
|
Double maxValueSZY = HEALTH_STANDARD_SZY_MAX;
|
|
|
Double minValueSZY = HEALTH_STANDARD_SZY_MIN;
|
|
|
json.put("minValueSZY", minValueSZY);
|
|
|
json.put("maxValueSZY", maxValueSZY);
|
|
|
json.put("minValueSSY", minValueSSY);
|
|
|
json.put("maxValueSSY", maxValueSSY);
|
|
|
|
|
|
}
|
|
|
return json;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
//更改接口(包括手动记录的修改和所有的删除)
|
|
|
public void modify(long id, String recordDate, String value1, String value2, String value3, String value4) throws Exception {
|
|
|
|
|
|
DevicePatientHealthIndex result = patientHealthIndexDao.findOne(id);
|
|
|
if (result != null) {
|
|
|
//字段值均为空为删除
|
|
|
if (StringUtils.isEmpty(value1) && StringUtils.isEmpty(value2) && StringUtils.isEmpty(value3) && StringUtils.isEmpty(value4)) {
|
|
|
result.setDel("0");
|
|
|
} else {
|
|
|
if (StringUtils.isNotEmpty(recordDate)) {
|
|
|
result.setRecordDate(DateUtil.strToDate(recordDate));
|
|
|
} else {
|
|
|
throw new Exception("Record date can not be null!");
|
|
|
}
|
|
|
|
|
|
result.setDel("1");
|
|
|
if (StringUtils.isNotEmpty(value1)) {
|
|
|
result.setValue1(value1);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value2)) {
|
|
|
result.setValue2(value2);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value3)) {
|
|
|
result.setValue3(value3);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value4)) {
|
|
|
result.setValue4(value4);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
patientHealthIndexDao.save(result);
|
|
|
if ("1".equals(result.getType()) || "2".equals(result.getType())) {
|
|
|
verifyHealthIndex(result.getId());
|
|
|
}
|
|
|
} else {
|
|
|
throw new Exception("Result not exit!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取居民最新各类健康记录
|
|
|
*/
|
|
|
public Map findDataByPatient(String patient, int type) throws Exception {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String sql = "SELECT " +
|
|
|
" * " +
|
|
|
" FROM " +
|
|
|
" device.wlyy_patient_health_index a " +
|
|
|
" WHERE " +
|
|
|
" a. USER = ? " +
|
|
|
" AND a.type = ? " +
|
|
|
" AND a.del = 1 " +
|
|
|
" ORDER BY " +
|
|
|
" a.record_date DESC " +
|
|
|
"LIMIT 0,1 ";
|
|
|
List<Map<String, Object>> devicePatient = findDataByPatient(sql, patient, type);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
for (Map<String, Object> device : devicePatient) {
|
|
|
String time = device.get("record_date") == null ? null : device.get("record_date").toString();
|
|
|
String deviceSN = device.get("device_sn") == null ? "0" : "1";
|
|
|
String value1 = device.get("value1") == null ? null : device.get("value1").toString();
|
|
|
String value2 = device.get("value2") == null ? null : device.get("value2").toString();
|
|
|
String value3 = device.get("value3") == null ? null : device.get("value3").toString();
|
|
|
String value4 = device.get("value4") == null ? null : device.get("value4").toString();
|
|
|
String value5 = device.get("value5") == null ? null : device.get("value5").toString();
|
|
|
String value6 = device.get("value6") == null ? null : device.get("value6").toString();
|
|
|
String value7 = device.get("value7") == null ? null : device.get("value7").toString();
|
|
|
map.put("isDevice", deviceSN);
|
|
|
if (StringUtils.isNotEmpty(time)) {
|
|
|
Date date = sdf.parse(time);
|
|
|
time = sdf.format(date);
|
|
|
map.put("time", time);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value1)) {
|
|
|
map.put("value1", value1);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value2)) {
|
|
|
map.put("value2", value2);
|
|
|
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value3)) {
|
|
|
map.put("value3", value3);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value4)) {
|
|
|
map.put("value4", value4);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value5)) {
|
|
|
map.put("value5", value5);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value6)) {
|
|
|
map.put("value6", value6);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(value7)) {
|
|
|
map.put("value7", value7);
|
|
|
}
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 判断当前值是否在区间内
|
|
|
*/
|
|
|
private boolean checkHealthIndex(Double current, Double max, Double min) {
|
|
|
if (current > max || current < min || current < 0) {
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
/**
|
|
|
* 判断当前指标偏高或偏低
|
|
|
*/
|
|
|
private int checkHealthIndexDetail(Double current, Double max, Double min) {
|
|
|
if (current > max ) {
|
|
|
return 1;
|
|
|
}else if(current < min || current < 0){
|
|
|
return 2;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取患者某天血糖值
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
private com.alibaba.fastjson.JSONObject getPatientXT_Json(String patient, String dateString) {
|
|
|
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 " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",record_date" +
|
|
|
",sort_date" +
|
|
|
",czrq as createDate" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type = 1" +
|
|
|
" and DATE_FORMAT(record_date,'%Y-%m-%d') = '" + dateString + "'" +
|
|
|
" and del = '1' " +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date,id desc ";
|
|
|
// List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = getPatientXT_JsonIot(sql,patient,dateString);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
obj.put("type", 1);
|
|
|
obj.put("czrq", date);
|
|
|
obj.put("recordDate", date);
|
|
|
obj.put("sortDate", date);
|
|
|
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();
|
|
|
Date recordDate = (Date)item.get("record_date");
|
|
|
Long id = Long.parseLong(item.get("id") + "");
|
|
|
Date createDate = (Date)item.get("createDate");
|
|
|
|
|
|
String recordTime = DateUtil.dateToStr(recordDate,DateUtil.YYYY_MM_DD);
|
|
|
String createTime = DateUtil.dateToStr(createDate,DateUtil.YYYY_MM_DD);
|
|
|
|
|
|
if (data != null && dataType != null) {
|
|
|
if (dataType.equals("1")) {
|
|
|
obj.put("value1", data);
|
|
|
obj.put("time1", recordDate);
|
|
|
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("id2", id);
|
|
|
obj.put("deviceSn2", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("3")) {
|
|
|
obj.put("value3", data);
|
|
|
obj.put("time3", recordDate);
|
|
|
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("id4", id);
|
|
|
obj.put("deviceSn4", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("5")) {
|
|
|
obj.put("value5", data);
|
|
|
obj.put("time5", recordDate);
|
|
|
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("id6", id);
|
|
|
obj.put("deviceSn6", deviceSn);
|
|
|
hadData = true;
|
|
|
} else if (dataType.equals("7")) {
|
|
|
obj.put("value7", data);
|
|
|
obj.put("time7", recordDate);
|
|
|
obj.put("id7", id);
|
|
|
obj.put("deviceSn7", deviceSn);
|
|
|
hadData = true;
|
|
|
}
|
|
|
|
|
|
//是否为补传数据(设备上传且测量时间和创建时间不匹配)
|
|
|
judgeIsSupplement(obj,recordTime,createTime,deviceSn,dataType);
|
|
|
|
|
|
obj.put("healthindexid", id);
|
|
|
obj.put("valuedata", data);
|
|
|
obj.put("dataType",dataType);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (hadData) {
|
|
|
return obj;
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 是否为补传数据(设备上传且测量时间和创建时间不匹配)
|
|
|
* @param obj
|
|
|
* @param recordDate
|
|
|
* @param createDate
|
|
|
* @param deviceSn
|
|
|
* @param num
|
|
|
*/
|
|
|
private void judgeIsSupplement(com.alibaba.fastjson.JSONObject obj,String recordDate,String createDate,String deviceSn,String num){
|
|
|
if ("".equals(deviceSn)){
|
|
|
obj.put("isSupplement"+num,0);
|
|
|
}else {
|
|
|
if (recordDate.compareTo(createDate)==0){
|
|
|
obj.put("isSupplement"+num,0);
|
|
|
}else {
|
|
|
obj.put("isSupplement"+num,1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private com.alibaba.fastjson.JSONArray getPatientXT_Json1(String patient,Integer page,Integer pageSize) {
|
|
|
com.alibaba.fastjson.JSONObject obj = new com.alibaba.fastjson.JSONObject();
|
|
|
obj.put("user", patient);
|
|
|
boolean hadData = false;
|
|
|
/***************** 按时间排序 ***************************/
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",DATE_FORMAT(record_date,'%Y-%m-%d') as record_date " +
|
|
|
",sort_date" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type = 1" +
|
|
|
" and del = '1' " +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date,id desc limit "+page+","+pageSize;
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (Map<String, Object> item : list) {
|
|
|
obj.put("type", 1);
|
|
|
obj.put("czrq", item.get("czrq"));
|
|
|
obj.put("recordDate", item.get("record_date"));
|
|
|
obj.put("sortDate", item.get("sort_date"));
|
|
|
String data = item.get("value1").toString();
|
|
|
String dataType = item.get("value2").toString();
|
|
|
String deviceSn = item.get("device_sn") == null ? "" : item.get("device_sn").toString();
|
|
|
String recordDate = item.get("record_date").toString();
|
|
|
Long id = Long.parseLong(item.get("id") + "");
|
|
|
if (data != null && dataType != null) {
|
|
|
if (dataType.equals("1")) {
|
|
|
obj.put("value1", data);
|
|
|
obj.put("time1", recordDate);
|
|
|
obj.put("id1", id);
|
|
|
obj.put("deviceSn1", deviceSn);
|
|
|
} else if (dataType.equals("2")) {
|
|
|
obj.put("value2", data);
|
|
|
obj.put("time2", recordDate);
|
|
|
obj.put("id2", id);
|
|
|
obj.put("deviceSn2", deviceSn);
|
|
|
|
|
|
} else if (dataType.equals("3")) {
|
|
|
obj.put("value3", data);
|
|
|
obj.put("time3", recordDate);
|
|
|
obj.put("id3", id);
|
|
|
obj.put("deviceSn3", deviceSn);
|
|
|
|
|
|
} else if (dataType.equals("4")) {
|
|
|
obj.put("value4", data);
|
|
|
obj.put("time4", recordDate);
|
|
|
obj.put("id4", id);
|
|
|
obj.put("deviceSn4", deviceSn);
|
|
|
} else if (dataType.equals("5")) {
|
|
|
obj.put("value5", data);
|
|
|
obj.put("time5", recordDate);
|
|
|
obj.put("id5", id);
|
|
|
obj.put("deviceSn5", deviceSn);
|
|
|
} else if (dataType.equals("6")) {
|
|
|
obj.put("value6", data);
|
|
|
obj.put("time6", recordDate);
|
|
|
obj.put("id6", id);
|
|
|
obj.put("deviceSn6", deviceSn);
|
|
|
} else if (dataType.equals("7")) {
|
|
|
obj.put("value7", data);
|
|
|
obj.put("time7", recordDate);
|
|
|
obj.put("id7", id);
|
|
|
obj.put("deviceSn7", deviceSn);
|
|
|
}
|
|
|
obj.put("healthindexid", id);
|
|
|
obj.put("valuedata", data);
|
|
|
obj.put("dataType",dataType);
|
|
|
array.add(obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 校验指标是否超标,发送消息
|
|
|
*/
|
|
|
public void verifyHealthIndex(Long id) {
|
|
|
//指标信息
|
|
|
DevicePatientHealthIndex data = patientHealthIndexDao.findOne(id);
|
|
|
String patientCode = data.getUser();
|
|
|
//患者信息
|
|
|
BasePatientDO patient = patientDao.findById(patientCode);
|
|
|
|
|
|
int type = data.getType();
|
|
|
String msgContent = "";
|
|
|
String oldMsgContent = "";
|
|
|
//血糖校验
|
|
|
if (type == 1) {
|
|
|
// 血糖记录,查询患者血糖预警值
|
|
|
Double maxValueBefore = HEALTH_STANDARD_ST_MAX_BEFORE;
|
|
|
Double minValueBefore = HEALTH_STANDARD_ST_MIN_BEFORE;
|
|
|
Double maxValueAfter = HEALTH_STANDARD_ST_MAX_AFTER;
|
|
|
Double minValueAfter = HEALTH_STANDARD_ST_MIN_AFTER;
|
|
|
|
|
|
int index = Integer.valueOf(data.getValue2());
|
|
|
String value1 = data.getValue1();
|
|
|
// 餐后
|
|
|
if (index % 2 == 0) {
|
|
|
if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter)) {
|
|
|
oldMsgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L)";
|
|
|
if(checkHealthIndexDetail(NumberUtils.toDouble(value1), maxValueAfter ,minValueAfter)==1){
|
|
|
msgContent = "<a>"+patient.getName()+"</a><span style=\"color: #FF4C4C;\">血糖偏高</span>";
|
|
|
}else if(checkHealthIndexDetail(NumberUtils.toDouble(value1), maxValueAfter ,minValueAfter)==2){
|
|
|
msgContent = "<a>"+patient.getName()+"</a><span style=\"color: #FF4C4C;\">血糖偏低</span>";
|
|
|
}
|
|
|
//体征异常,更新体征数据状态
|
|
|
updateStatus(data);
|
|
|
}
|
|
|
} else { //餐前
|
|
|
if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore)) {
|
|
|
oldMsgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L)";
|
|
|
if(checkHealthIndexDetail(NumberUtils.toDouble(value1), maxValueBefore ,minValueBefore)==1){
|
|
|
msgContent = "<a>"+patient.getName()+"</a><span style=\"color: #FF4C4C;\">血糖偏高</span>";
|
|
|
}else if(checkHealthIndexDetail(NumberUtils.toDouble(value1), maxValueBefore ,minValueBefore)==2){
|
|
|
msgContent = "<a>"+patient.getName()+"</a><span style=\"color: #FF4C4C;\">血糖偏低</span>";
|
|
|
}
|
|
|
updateStatus(data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//血压校验
|
|
|
else if (type == 2) {
|
|
|
String value1 = data.getValue1();
|
|
|
String value2 = data.getValue2();
|
|
|
// 血压记录,查询患者血压预警值
|
|
|
Double maxValueSSY = HEALTH_STANDARD_SSY_MAX;
|
|
|
Double minValueSSY = HEALTH_STANDARD_SSY_MIN;
|
|
|
Double maxValueSZY = HEALTH_STANDARD_SZY_MAX;
|
|
|
Double minValueSZY = HEALTH_STANDARD_SZY_MIN;
|
|
|
// 收缩压/舒张压校验
|
|
|
if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY) || !checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)) {
|
|
|
oldMsgContent = patient.getName() + "血压异常(舒张压 " + value2 + "mmHg、收缩压 " + value1 + "mmHg)";
|
|
|
if(checkHealthIndexDetail(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY)==1||checkHealthIndexDetail(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)==1){
|
|
|
msgContent = "<a>"+patient.getName()+"</a><span style=\"color: #FF4C4C;\">血压偏高</span>";
|
|
|
}else if(checkHealthIndexDetail(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY)==2||checkHealthIndexDetail(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)==2){
|
|
|
msgContent = "<a>"+patient.getName()+"</a><span style=\"color: #FF4C4C;\">血压偏低</span>";
|
|
|
}
|
|
|
updateStatus(data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改体征异常状态
|
|
|
* @param data
|
|
|
*/
|
|
|
public void updateStatus(DevicePatientHealthIndex data){
|
|
|
data.setStatus(1);
|
|
|
patientHealthIndexDao.save(data);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询最近的一条体征数据
|
|
|
* @param sql
|
|
|
* @param patient
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> findDataByPatient(String sql,String patient,Integer type){
|
|
|
return jdbcTemplate.queryForList(sql, patient, type);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 患者最近填写的健康指标
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public List<DevicePatientHealthIndex> findRecentByPatientIterable(String patient){
|
|
|
return patientHealthIndexDao.findRecentByPatient(patient);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据患者标志获取健康指标
|
|
|
* @param patient
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
public DevicePatientHealthIndex findLastByPatienIot(String patient,Integer type){
|
|
|
return findLastByPatien(patient,type);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询指标记录
|
|
|
* @param patient
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
public List<String> findDateListIot(String patient,int type,Date startDate,Date endDate, Integer page, Integer size,String start, String end){
|
|
|
return patientHealthIndexDao.findDateList(patient,type,startDate,endDate,page,size);
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<String> findDateListIot1(String patient,Date startDate,Date endDate, Integer page, Integer size,String start, String end){
|
|
|
|
|
|
return patientHealthIndexDao.findDateList(patient,startDate,endDate,page,size);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 按时间查找
|
|
|
* @param sql
|
|
|
* @param patient
|
|
|
* @param type
|
|
|
* @param size
|
|
|
* @param gi_type
|
|
|
* @param begin
|
|
|
* @param end
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> findByPatientAndTime(String sql,String patient,Integer type,Integer size,Integer gi_type, String begin, String end){
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 按时间查找
|
|
|
* @param sql
|
|
|
* @param patient
|
|
|
* @param date
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientXT_JsonIot(String sql,String patient, String date){
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 按时间查找
|
|
|
* @param sql
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientXT_JsonIot(String sql,String patient,Integer type,Integer page,Integer size, String begin,String end){
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************物联网 end***********************************************************/
|
|
|
|
|
|
/**
|
|
|
* 新增患者指标
|
|
|
* 【血糖】{"time":"2016-09-09 17:00:00","gi":"血糖值(mmol/L)"}
|
|
|
* 【血压】{"time":"2016-09-09 17:00:00","sys":"收缩压(mmHg)","dia":"舒张压(mmHg)","pul":"脉搏(次/分)","ano":"有无心率不齐0否 1是","user":"身份标识"}
|
|
|
* 【体重/身高】{"time":"2016-09-09 17:00:00","weight":"体重值(kg)","height":"身高(cm)"}
|
|
|
* 【腰围】{"time":"2016-09-09 17:00:00","waistline":"腰围值(cm)"}
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public DevicePatientHealthIndex addPatientHealthIndex(String data, String type, String patientCode, String deviceSn) throws Exception {
|
|
|
Map<String, String> map = (Map<String, String>) objectMapper.readValue(data, Map.class);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
DevicePatientHealthIndex obj = new DevicePatientHealthIndex();
|
|
|
Date currentTime = new Date();
|
|
|
obj.setCzrq(currentTime);
|
|
|
obj.setDel("1");
|
|
|
obj.setStatus(0);
|
|
|
Date time = currentTime;
|
|
|
if (map.containsKey("time")) {
|
|
|
String da = map.get("time");
|
|
|
// time = DateUtil.strToDate(da);
|
|
|
time = sdf.parse(da);
|
|
|
}
|
|
|
obj.setRecordDate(time); //记录时间
|
|
|
obj.setSortDate(time); //排序时间
|
|
|
|
|
|
String idcard = "";
|
|
|
BasePatientDO patient = null;
|
|
|
if (deviceSn != null && deviceSn.length() > 0) //设备数据
|
|
|
{
|
|
|
obj.setDeviceSn(deviceSn);
|
|
|
String userType = "-1";
|
|
|
if (map.containsKey("user")) { //存在身份标识 ,多用户
|
|
|
userType = map.get("user");
|
|
|
}
|
|
|
//根据设备获取患者(不同厂家sn码一样的问题未解决!!)
|
|
|
PatientDevice device = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn, type, userType);
|
|
|
if (device != null) {
|
|
|
patientCode = device.getUser();
|
|
|
patient = patientDao.findById(patientCode);
|
|
|
idcard = device.getUserIdcard();
|
|
|
}
|
|
|
|
|
|
DeviceDetail deviceDetail = deviceDetailDao.findBySn(deviceSn);
|
|
|
if(deviceDetail!=null){
|
|
|
obj.setHospital(deviceDetail.getGrantOrgCode());
|
|
|
obj.setHospitalName(deviceDetail.getOrgName());
|
|
|
}
|
|
|
}
|
|
|
//自输数据
|
|
|
else {
|
|
|
patient = patientDao.findById(patientCode);
|
|
|
if (patient != null) {
|
|
|
idcard = patient.getIdcard();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//身份证不为空
|
|
|
if (patient != null) {
|
|
|
obj.setUser(patientCode);
|
|
|
obj.setName(patient.getName());
|
|
|
obj.setIdcard(idcard);
|
|
|
|
|
|
String msgContent = "";
|
|
|
// 1血糖 2血压 3体重 4腰围
|
|
|
switch (type) {
|
|
|
case "1": {
|
|
|
obj.setType(1);
|
|
|
String value1 = map.get("gi"); //血糖值
|
|
|
String gi_type = map.get("gi_type"); //血糖值类型对应1到7
|
|
|
String recordDate = map.get("recordDate");
|
|
|
obj.setValue1(value1);
|
|
|
obj.setValue2(gi_type);
|
|
|
if (StringUtils.isNotBlank(recordDate)) {
|
|
|
obj.setRecordDate(DateUtil.strToDateAppendNowTime(recordDate, DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case "2": {
|
|
|
obj.setType(2);
|
|
|
String value1 = map.get("sys"); //收缩压
|
|
|
String value2 = map.get("dia"); //舒张压
|
|
|
obj.setValue1(value1);
|
|
|
obj.setValue2(value2);
|
|
|
obj.setValue3(map.get("pul")); //脉搏
|
|
|
obj.setValue4(map.get("ano")); //有无心率不齐
|
|
|
break;
|
|
|
}
|
|
|
case "3": {
|
|
|
obj.setType(3);
|
|
|
|
|
|
String weight = map.get("weight");
|
|
|
String height = map.get("height");
|
|
|
|
|
|
obj.setValue1(weight); //体重
|
|
|
obj.setValue2(height); //身高
|
|
|
|
|
|
double bmi = commonUtil.getBMIByWeightAndHeight(map.get("weight"), map.get("height"));
|
|
|
DecimalFormat df1 = new DecimalFormat("###.00");
|
|
|
obj.setValue3(df1.format(bmi));
|
|
|
|
|
|
double bmiMin = new Double("18.5");
|
|
|
double bmiMax = new Double("23.9");
|
|
|
|
|
|
//设置BMI值
|
|
|
if (bmi < bmiMin) {
|
|
|
obj.setValue4("1");
|
|
|
} else if (bmi > bmiMax) {
|
|
|
obj.setValue4("-1");
|
|
|
} else {
|
|
|
obj.setValue4("0");
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case "4": {
|
|
|
obj.setType(4);
|
|
|
obj.setValue1(map.get("waistline")); //腰围
|
|
|
obj.setValue2(map.get("hipline"));
|
|
|
break;
|
|
|
}
|
|
|
default: {
|
|
|
throw new Exception("暂不支持该指标!");
|
|
|
}
|
|
|
}
|
|
|
patientHealthIndexDao.save(obj);
|
|
|
} else {
|
|
|
throw new Exception("不存在该患者!");
|
|
|
}
|
|
|
|
|
|
|
|
|
return obj;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 按录入时间和患者标识查询健康记录
|
|
|
*
|
|
|
* @param patientCode
|
|
|
* @param date
|
|
|
* @return
|
|
|
*/
|
|
|
public Iterable<DevicePatientHealthIndex> findByPatienDate(String patientCode, int type, Date date) {
|
|
|
return patientHealthIndexDao.findByPatienDate(patientCode, type, date);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 按时间段查询患者健康指标
|
|
|
*
|
|
|
* @param type 健康指标类型(1血糖,2血压,3体重,4腰围)
|
|
|
* @param gi_type 血糖就餐时间段(早餐前,早餐后等)
|
|
|
* @param begin 开始时间
|
|
|
* @param end 结束时间
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray findChartByPatient(String patient, int type, int gi_type, String begin, String end) {
|
|
|
JSONArray re = new JSONArray();
|
|
|
String sql = "SELECT " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",record_date" +
|
|
|
",sort_date" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type =" + type +
|
|
|
" and record_date >= '" + begin + "'" +
|
|
|
" and record_date <= '" + end + "' " +
|
|
|
" and del = '1' ";
|
|
|
String conditionApp = "";
|
|
|
if (gi_type != 0) {
|
|
|
conditionApp = " and value2 = '" + gi_type + "' ";
|
|
|
}
|
|
|
sql = sql + conditionApp +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date desc ,sort_date desc limit " + 0 + " ," + 1000 + " ";
|
|
|
// List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = findByPatientAndTime(sql,patient,type,1000,gi_type,begin,end);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", map.get("id"));
|
|
|
json.put("patient", map.get("user"));
|
|
|
json.put("value1", map.get("value1"));
|
|
|
json.put("value2", map.get("value2"));
|
|
|
json.put("value3", map.get("value3"));
|
|
|
json.put("value4", map.get("value4"));
|
|
|
json.put("value5", map.get("value5"));
|
|
|
json.put("value6", map.get("value6"));
|
|
|
json.put("value7", map.get("value7"));
|
|
|
json.put("deviceSn", map.get("device_sn") == null ? "" : map.get("device_sn"));
|
|
|
json.put("type", map.get("type"));
|
|
|
|
|
|
Date date = (Date) map.get("record_date");
|
|
|
if (type == 2) {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
} else {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD));
|
|
|
}
|
|
|
json.put("sortDate", map.get("sort_date"));
|
|
|
json.put("czrq", map.get("czrq"));
|
|
|
|
|
|
re.put(json);
|
|
|
}
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 按时间段查询患者健康指标
|
|
|
*
|
|
|
* @param type 健康指标类型(1血糖,2血压,3体重,4腰围)
|
|
|
* @param gi_type 血糖就餐时间段(早餐前,早餐后等)
|
|
|
* @param begin 开始时间
|
|
|
* @param end 结束时间
|
|
|
* @return
|
|
|
*/
|
|
|
public com.alibaba.fastjson.JSONObject findChartByPatientIot(String patient, int type, int gi_type, String begin, String end,String time) {
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
|
|
com.alibaba.fastjson.JSONArray re = new com.alibaba.fastjson.JSONArray();
|
|
|
int high = 0;//偏高
|
|
|
int normal = 0;//正常
|
|
|
int low = 0;//偏低
|
|
|
boolean flag = false;//高危标志 true高危。
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",record_date" +
|
|
|
",sort_date" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type =" + type +
|
|
|
" and record_date >= '" + begin + "'" +
|
|
|
" and record_date <= '" + end + "' " +
|
|
|
" and del = '1' ";
|
|
|
String conditionApp = "";
|
|
|
if (gi_type != 0) {
|
|
|
conditionApp = " and value2 = '" + gi_type + "' ";
|
|
|
}
|
|
|
sql = sql + conditionApp +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date desc ,sort_date desc limit " + 0 + " ," + 1000 + " ";
|
|
|
// List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = findByPatientAndTime(sql,patient,type,1000,gi_type,begin,end);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
String value1 = map.get("value1").toString();
|
|
|
String value2 = map.get("value2").toString();
|
|
|
com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
|
|
|
json.put("id", map.get("id"));
|
|
|
json.put("patient", map.get("user"));
|
|
|
json.put("value1", value1);
|
|
|
json.put("value2", value2);
|
|
|
json.put("value3", map.get("value3"));
|
|
|
json.put("value4", map.get("value4"));
|
|
|
json.put("value5", map.get("value5"));
|
|
|
json.put("value6", map.get("value6"));
|
|
|
json.put("value7", map.get("value7"));
|
|
|
json.put("deviceSn", map.get("device_sn") == null ? "" : map.get("device_sn"));
|
|
|
json.put("type", map.get("type"));
|
|
|
|
|
|
Date date = (Date) map.get("record_date");
|
|
|
if (type == 2) {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
} else {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD));
|
|
|
}
|
|
|
json.put("sortDate", map.get("sort_date"));
|
|
|
json.put("czrq", map.get("czrq"));
|
|
|
|
|
|
|
|
|
//统计加指标分析
|
|
|
int returnInt = 0;
|
|
|
if(type==1){
|
|
|
//血糖
|
|
|
Double maxValueBefore = HEALTH_STANDARD_ST_MAX_BEFORE;
|
|
|
Double minValueBefore = HEALTH_STANDARD_ST_MIN_BEFORE;
|
|
|
Double maxValueAfter = HEALTH_STANDARD_ST_MAX_AFTER;
|
|
|
Double minValueAfter = HEALTH_STANDARD_ST_MIN_AFTER;
|
|
|
int index = Integer.parseInt(value2);
|
|
|
Double intVlue1 = NumberUtils.toDouble(value1);
|
|
|
if(index % 2 == 0){
|
|
|
//餐后
|
|
|
returnInt = checkHealth(maxValueAfter,minValueAfter,intVlue1);
|
|
|
switch (returnInt){
|
|
|
case 0:
|
|
|
normal++;
|
|
|
break;
|
|
|
case 1:
|
|
|
high++;
|
|
|
break;
|
|
|
default:
|
|
|
low++;
|
|
|
break;
|
|
|
}
|
|
|
if(intVlue1>=maxValueAfter){
|
|
|
flag = true;
|
|
|
}
|
|
|
}else {
|
|
|
//餐前
|
|
|
returnInt = checkHealth(maxValueBefore,minValueBefore,intVlue1);
|
|
|
switch (returnInt){
|
|
|
case 0:
|
|
|
normal++;
|
|
|
break;
|
|
|
case 1:
|
|
|
high++;
|
|
|
break;
|
|
|
default:
|
|
|
low++;
|
|
|
break;
|
|
|
}
|
|
|
if(intVlue1>=maxValueBefore){
|
|
|
flag = true;
|
|
|
}
|
|
|
}
|
|
|
}else if(type==2){
|
|
|
//血压
|
|
|
Double intVlue1 = NumberUtils.toDouble(value1);
|
|
|
Double intVlue2 = NumberUtils.toDouble(value2);
|
|
|
Double maxValueSSY = HEALTH_STANDARD_SSY_MAX;
|
|
|
Double minValueSSY = HEALTH_STANDARD_SSY_MIN;
|
|
|
Double maxValueSZY = HEALTH_STANDARD_SZY_MAX;
|
|
|
Double minValueSZY = HEALTH_STANDARD_SZY_MIN;
|
|
|
|
|
|
returnInt = checkHealth(maxValueSSY,minValueSSY,intVlue1);
|
|
|
switch (returnInt){
|
|
|
case 0:
|
|
|
normal++;
|
|
|
break;
|
|
|
case 1:
|
|
|
high++;
|
|
|
if(intVlue1>=maxValueSSY){
|
|
|
flag = true;
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
low++;
|
|
|
break;
|
|
|
}
|
|
|
returnInt = checkHealth(maxValueSZY,minValueSZY,intVlue2);
|
|
|
switch (returnInt){
|
|
|
case 0:
|
|
|
normal++;
|
|
|
break;
|
|
|
case 1:
|
|
|
high++;
|
|
|
if(intVlue2>=maxValueSSY){
|
|
|
flag = true;
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
low++;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
re.add(json);
|
|
|
}
|
|
|
jsonObject.put("list",re);
|
|
|
com.alibaba.fastjson.JSONObject total = new com.alibaba.fastjson.JSONObject();
|
|
|
total.put("high",high);
|
|
|
total.put("normal",normal);
|
|
|
total.put("low",low);
|
|
|
jsonObject.put("total",total);
|
|
|
String content = "";
|
|
|
if(high>0){
|
|
|
content = "居民"+time+"内有"+high+"次指标偏高";
|
|
|
if(low>0){
|
|
|
content+=",有"+low+"次指标偏低";
|
|
|
}else {
|
|
|
content+="。";
|
|
|
}
|
|
|
if(flag){
|
|
|
content+="居民"+time+"内控制不理想,可能伴有靶器官损害或其他并发症。建议由健管师进行电话随访不少于每月4次,至少每2周面对面随访一次,建议动员居民至医院全科医生就诊,特殊情况建议入户诊疗。病情严重建议转诊专科医师进行进一步治疗。";
|
|
|
}else {
|
|
|
content+="居民"+time+"内控制不理想但低于急危值,建议至少每2周面对面随访一次,建议动员居民至医院全科医生就诊,特殊情况建议入户诊疗。病情严重建议转诊专科医师进行进一步治疗。";
|
|
|
}
|
|
|
}else if(low>0){
|
|
|
content = "居民"+time+"内有"+low+"次指标偏低。";
|
|
|
content+="居民"+time+"内控制不理想但低于急危值,建议至少每2周面对面随访一次,建议动员居民至医院全科医生就诊,特殊情况建议入户诊疗。病情严重建议转诊专科医师进行进一步治疗。";
|
|
|
}else {
|
|
|
content = "居民"+time+"内指标没有异常。居民"+time+"内相对稳定,建议至少每周面对面随访一次,全科医生根据居民情况安排预约转诊专科医师,并跟踪治疗情况。";
|
|
|
}
|
|
|
jsonObject.put("content",content);
|
|
|
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 指标验证
|
|
|
* @param max
|
|
|
* @param min
|
|
|
* @param value
|
|
|
* @return -1偏低,0正常,1偏高
|
|
|
*/
|
|
|
private Integer checkHealth(Double max,Double min,Double value){
|
|
|
if(max<value){
|
|
|
return 1;
|
|
|
}else if(min>value){
|
|
|
return -1;
|
|
|
}else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询指标记录
|
|
|
*
|
|
|
* @param patient
|
|
|
* @param type
|
|
|
* @param start
|
|
|
* @param end
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray findIndexByPatient(String patient, int type, String start, String end, int page, int pageSize) {
|
|
|
JSONArray re = new JSONArray();
|
|
|
if (page > 0) {
|
|
|
page = page - 1;
|
|
|
}
|
|
|
if (type == 1) //血糖特殊处理
|
|
|
{
|
|
|
|
|
|
} else {
|
|
|
// 排序
|
|
|
Sort sort = new Sort(Direction.DESC, "recordDate");
|
|
|
PageRequest pageRequest = new PageRequest(page, pageSize, sort);
|
|
|
String sql = "SELECT " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",record_date" +
|
|
|
",sort_date" +
|
|
|
",czrq as createDate" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type =" + type +
|
|
|
" and record_date >= '" + start + "'" +
|
|
|
" and record_date <= '" + end + "' " +
|
|
|
" and del = '1' " +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date desc ,sort_date desc limit " + pageRequest.getOffset() + " ," + pageRequest.getPageSize() + " ";
|
|
|
// List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = getPatientXT_JsonIot(sql,patient,type,pageRequest.getOffset(),pageRequest.getPageSize(),start,end);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", map.get("id"));
|
|
|
json.put("healthindexid", map.get("id"));
|
|
|
json.put("patient", map.get("user"));
|
|
|
json.put("value1", map.get("value1"));
|
|
|
json.put("value2", map.get("value2"));
|
|
|
json.put("value3", map.get("value3"));
|
|
|
json.put("value4", map.get("value4"));
|
|
|
json.put("value5", map.get("value5"));
|
|
|
json.put("value6", map.get("value6"));
|
|
|
json.put("value7", map.get("value7"));
|
|
|
json.put("deviceSn", map.get("device_sn") == null ? "" : map.get("device_sn"));
|
|
|
json.put("type", map.get("type"));
|
|
|
|
|
|
Date date = (Date) map.get("record_date");
|
|
|
if (type == 2) {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
} else {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD));
|
|
|
}
|
|
|
json.put("sortDate", map.get("sort_date"));
|
|
|
json.put("czrq", map.get("czrq"));
|
|
|
|
|
|
//是否为补传数据(设备上传且测量时间和创建时间不匹配)
|
|
|
Date recordDate = (Date)map.get("record_date");
|
|
|
Date createDate = (Date) map.get("createDate");
|
|
|
String recordTime = DateUtil.dateToStr(recordDate,DateUtil.YYYY_MM_DD);
|
|
|
String createTime = DateUtil.dateToStr(createDate,DateUtil.YYYY_MM_DD);
|
|
|
if (map.get("device_sn") == null){
|
|
|
json.put("isSupplement",0);
|
|
|
}else {
|
|
|
if (recordTime.compareToIgnoreCase(createTime)==0){
|
|
|
json.put("isSupplement",0);
|
|
|
}else {
|
|
|
json.put("isSupplement",1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
re.put(json);
|
|
|
}
|
|
|
}
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
public JSONObject findIndexByPatient1(String patient, int type,int page, int pageSize) {
|
|
|
JSONArray re = new JSONArray();
|
|
|
JSONObject object = new JSONObject();
|
|
|
if (page > 0) {
|
|
|
page = page - 1;
|
|
|
}
|
|
|
if (type == 1) //血糖特殊处理
|
|
|
{
|
|
|
|
|
|
} else {
|
|
|
// 排序
|
|
|
Sort sort = new Sort(Direction.DESC, "recordDate");
|
|
|
PageRequest pageRequest = new PageRequest(page, pageSize, sort);
|
|
|
String sql = "SELECT " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",record_date" +
|
|
|
",sort_date" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type =" + type +
|
|
|
" and del = '1' " +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date desc ,sort_date desc limit " + pageRequest.getOffset() + " ," + pageRequest.getPageSize() + " ";
|
|
|
String sqlCount = "select count(1) as total from (SELECT " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",record_date" +
|
|
|
",sort_date" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type =" + type +
|
|
|
" and del = '1' " +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date desc ,sort_date desc) phi ";
|
|
|
// List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String,Object>> rstotal2 = jdbcTemplate.queryForList(sqlCount);
|
|
|
Long taskCount = 0L;
|
|
|
if(rstotal2!=null&&rstotal2.size()>0){
|
|
|
Object object1 = rstotal2.get(0).get("total");
|
|
|
if (object1 != null ){
|
|
|
taskCount = Long.parseLong(object1.toString());
|
|
|
}
|
|
|
}
|
|
|
object.put("totalCount",taskCount);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", map.get("id"));
|
|
|
json.put("healthindexid", map.get("id"));
|
|
|
json.put("patient", map.get("user"));
|
|
|
json.put("value1", map.get("value1"));
|
|
|
json.put("value2", map.get("value2"));
|
|
|
json.put("value3", map.get("value3"));
|
|
|
json.put("value4", map.get("value4"));
|
|
|
json.put("value5", map.get("value5"));
|
|
|
json.put("value6", map.get("value6"));
|
|
|
json.put("value7", map.get("value7"));
|
|
|
json.put("deviceSn", map.get("device_sn") == null ? "" : map.get("device_sn"));
|
|
|
json.put("type", map.get("type"));
|
|
|
|
|
|
Date date = (Date) map.get("record_date");
|
|
|
if (type == 2) {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
} else {
|
|
|
json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD));
|
|
|
}
|
|
|
json.put("sortDate", map.get("sort_date"));
|
|
|
json.put("czrq", map.get("czrq"));
|
|
|
|
|
|
re.put(json);
|
|
|
}
|
|
|
}
|
|
|
object.put("pageSize",pageSize);
|
|
|
object.put("currPage",page+1);
|
|
|
object.put("detailModelList",re);
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询指标记录
|
|
|
*
|
|
|
* @param patient
|
|
|
* @param type
|
|
|
* @param start
|
|
|
* @param end
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Object> findIndexByPatient2(String patient, int type, String start, String end, int page, int pageSize) {
|
|
|
List<Object> re = new ArrayList<>();
|
|
|
if (page > 0) {
|
|
|
page = page - 1;
|
|
|
}
|
|
|
|
|
|
Date startDate = DateUtil.strToDate(start, DateUtil.YYYY_MM_DD_HH_MM_SS);
|
|
|
Date endDate = DateUtil.strToDate(end, DateUtil.YYYY_MM_DD_HH_MM_SS);
|
|
|
if (type == 1) //血糖特殊处理
|
|
|
{
|
|
|
PageRequest pageRequest = new PageRequest(page, pageSize);
|
|
|
//根据时间过滤排序
|
|
|
// List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest.getOffset(), pageRequest.getPageSize());
|
|
|
List<String> dateList = findDateListIot(patient,type, startDate, endDate, pageRequest.getOffset(), pageRequest.getPageSize(), start, end);
|
|
|
if (dateList != null && dateList.size() > 0) {
|
|
|
for (String dateString : dateList) {
|
|
|
com.alibaba.fastjson.JSONObject obj = getPatientXT_Json(patient, dateString);
|
|
|
if (obj != null) {
|
|
|
re.add(obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
// 排序
|
|
|
|
|
|
}
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject findIndexByPatient3(String patient, int type,int page, int pageSize) {
|
|
|
List<Object> re = new ArrayList<>();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (page > 0) {
|
|
|
page = page - 1;
|
|
|
}
|
|
|
|
|
|
if (type == 1) //血糖特殊处理
|
|
|
{
|
|
|
PageRequest pageRequest = new PageRequest(page, pageSize);
|
|
|
jsonObject.put("currPage",page+1);
|
|
|
com.alibaba.fastjson.JSONArray array = getPatientXT_Json1(patient, pageRequest.getOffset(), pageRequest.getPageSize());
|
|
|
jsonObject.put("detailModelList",array);
|
|
|
//根据时间过滤排序
|
|
|
// List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest.getOffset(), pageRequest.getPageSize());
|
|
|
String sql = "select count(1) as total from (SELECT " +
|
|
|
"MIN(id) id" +
|
|
|
", user" +
|
|
|
",value1" +
|
|
|
",value2" +
|
|
|
",value3" +
|
|
|
",value4" +
|
|
|
",value5" +
|
|
|
",value6" +
|
|
|
",value7" +
|
|
|
",device_sn" +
|
|
|
",type" +
|
|
|
",record_date" +
|
|
|
",sort_date" +
|
|
|
",min(czrq) czrq " +
|
|
|
" from device.wlyy_patient_health_index " +
|
|
|
" WHERE `user` = '" + patient + "' " +
|
|
|
" and type = 1" +
|
|
|
" and del = '1' " +
|
|
|
" GROUP BY user,value1,value2,value3,value4,value5,value6,value7,type,record_date,sort_date " +
|
|
|
" order by record_date,id desc ) phi";
|
|
|
List<Map<String,Object>> rstotal2 = jdbcTemplate.queryForList(sql);
|
|
|
Long taskCount = 0L;
|
|
|
if(rstotal2!=null&&rstotal2.size()>0){
|
|
|
Object object1 = rstotal2.get(0).get("total");
|
|
|
if (object1 != null ){
|
|
|
taskCount = Long.parseLong(object1.toString());
|
|
|
}
|
|
|
}
|
|
|
jsonObject.put("totalCount",taskCount);
|
|
|
|
|
|
} else {
|
|
|
// 排序
|
|
|
|
|
|
}
|
|
|
|
|
|
jsonObject.put("pageSize",pageSize);
|
|
|
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询患者最近填写的血糖、血压等记录
|
|
|
*
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray findRecentByPatient(String patient) {
|
|
|
JSONArray array = new JSONArray();
|
|
|
List<DevicePatientHealthIndex> iterable = patientHealthIndexDao.findRecentByPatient(patient);
|
|
|
if (iterable != null) {
|
|
|
Iterator<DevicePatientHealthIndex> iterator = iterable.iterator();
|
|
|
while (iterator != null && iterator.hasNext()) {
|
|
|
DevicePatientHealthIndex phi = iterator.next();
|
|
|
if (phi == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
// 设置健康指标类型(1血糖,2血压,3体重,4腰围)
|
|
|
json.put("type", phi.getType());
|
|
|
if (1 == phi.getType() && StringUtils.isNotBlank(phi.getValue2())) {
|
|
|
int gi_type = Integer.parseInt(phi.getValue2());
|
|
|
switch (gi_type) {
|
|
|
case 1:
|
|
|
// 设置血糖/收缩压/体重/腰围/早餐前空腹
|
|
|
json.put("value1", phi.getValue1());
|
|
|
json.put("time1", phi.getRecordDate());
|
|
|
break;
|
|
|
case 2:
|
|
|
// 设置舒张压/早餐后血糖
|
|
|
json.put("value2", phi.getValue2());
|
|
|
json.put("time2", phi.getRecordDate());
|
|
|
break;
|
|
|
case 3:
|
|
|
// 设置午餐前血糖
|
|
|
json.put("value3", phi.getValue3());
|
|
|
json.put("time3", phi.getRecordDate());
|
|
|
break;
|
|
|
case 4:
|
|
|
// 设置午餐后血糖
|
|
|
json.put("value4", phi.getValue4());
|
|
|
json.put("time4", phi.getRecordDate());
|
|
|
break;
|
|
|
case 5:
|
|
|
// 设置晚餐前血糖
|
|
|
json.put("value5", phi.getValue5());
|
|
|
json.put("time5", phi.getRecordDate());
|
|
|
break;
|
|
|
case 6:
|
|
|
// 设置晚餐后血糖
|
|
|
json.put("value6", phi.getValue6());
|
|
|
json.put("time6", phi.getRecordDate());
|
|
|
break;
|
|
|
case 7:
|
|
|
// 设置睡前血糖
|
|
|
json.put("value7", phi.getValue7());
|
|
|
json.put("time7", phi.getRecordDate());
|
|
|
break;
|
|
|
}
|
|
|
} else {
|
|
|
json.put("value1", phi.getValue1());
|
|
|
json.put("value2", phi.getValue2());
|
|
|
// 设置午餐前血糖
|
|
|
json.put("value3", phi.getValue3());
|
|
|
// 设置午餐后血糖
|
|
|
json.put("value4", phi.getValue4());
|
|
|
// 设置晚餐前血糖
|
|
|
json.put("value5", phi.getValue5());
|
|
|
// 设置晚餐后血糖
|
|
|
json.put("value6", phi.getValue6());
|
|
|
// 设置睡前血糖
|
|
|
json.put("value7", phi.getValue7());
|
|
|
}
|
|
|
|
|
|
|
|
|
json.put("date", DateUtil.dateToStrShort(phi.getRecordDate()));
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据患者标志获取健康指标
|
|
|
*
|
|
|
* @param patientCode 患者标志
|
|
|
* @return 健康指标列表
|
|
|
*/
|
|
|
public DevicePatientHealthIndex findLastByPatien(String patientCode, int type) {
|
|
|
//最新血糖指标
|
|
|
if (type == 1) {
|
|
|
DevicePatientHealthIndex obj = patientHealthIndexDao.findLastData(patientCode, 1);
|
|
|
return obj;
|
|
|
} else if (type == 2) { //其他指标
|
|
|
return patientHealthIndexDao.findLastData(patientCode, 2);
|
|
|
} else {
|
|
|
return patientHealthIndexDao.findLastData(patientCode, type);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取患者健康指标历史记录
|
|
|
* 1血糖,2血压,3体重,4腰围
|
|
|
*/
|
|
|
public List<Map<String, String>> getHealthIndexHistory(String patientCode, int type, int page, int pagesize) throws Exception {
|
|
|
List<Map<String, String>> re = new ArrayList<>();
|
|
|
|
|
|
// 排序
|
|
|
Sort sort = new Sort(Direction.DESC, "recordDate");
|
|
|
PageRequest pageRequest = new PageRequest(page, pagesize, sort);
|
|
|
List<DevicePatientHealthIndex> list = patientHealthIndexDao.findIndexByPatient(patientCode, type, pageRequest);
|
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (DevicePatientHealthIndex item : list) {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
if (type == 1) //血糖
|
|
|
{
|
|
|
String gi = item.getValue1();
|
|
|
String giType = item.getValue2();
|
|
|
map.put("time", DateUtil.dateToStrLong(item.getRecordDate()));
|
|
|
map.put("gi", gi); // 血糖值
|
|
|
map.put("gi_type", giType); // 血糖值类型
|
|
|
String text = gi + " mmol/L";
|
|
|
if ("1".equals(giType)) {
|
|
|
text += "(早餐前)";
|
|
|
} else if ("2".equals(giType)) {
|
|
|
text += "(早餐后)";
|
|
|
} else if ("3".equals(giType)) {
|
|
|
text += "(午餐前)";
|
|
|
} else if ("4".equals(giType)) {
|
|
|
text += "(午餐后)";
|
|
|
} else if ("5".equals(giType)) {
|
|
|
text += "(晚饭前)";
|
|
|
} else if ("6".equals(giType)) {
|
|
|
text += "(晚饭后)";
|
|
|
} else if ("7".equals(giType)) {
|
|
|
text += "(睡前)";
|
|
|
}
|
|
|
map.put("text", text); // 展示
|
|
|
re.add(map);
|
|
|
} else if (type == 2) //血压
|
|
|
{
|
|
|
String sys = item.getValue1(); //收缩压
|
|
|
String dia = item.getValue2(); //舒张压
|
|
|
String pul = item.getValue3(); //脉搏
|
|
|
map.put("time", DateUtil.dateToStrLong(item.getRecordDate()));
|
|
|
map.put("sys", sys);
|
|
|
map.put("dia", dia);
|
|
|
map.put("pul", pul);
|
|
|
re.add(map);
|
|
|
} else if (type == 3) //体重
|
|
|
{
|
|
|
String weight = item.getValue1(); //体重
|
|
|
String height = item.getValue2(); //身高
|
|
|
String bmi = item.getValue3(); //BMI
|
|
|
map.put("time", DateUtil.dateToStrShort(item.getRecordDate()));
|
|
|
map.put("weight", weight);
|
|
|
map.put("height", height);
|
|
|
map.put("bmi", bmi);
|
|
|
map.put("text", weight + " kg");
|
|
|
re.add(map);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Map<String, String>> getHealthIndexByPatientAndDate(String patientCode, String deviceSn, String choseDate,int type) throws Exception {
|
|
|
List<Map<String, String>> re = new ArrayList<>();
|
|
|
|
|
|
// 排序
|
|
|
Sort sort = new Sort(Direction.DESC, "recordDate");
|
|
|
List<DevicePatientHealthIndex> list = new ArrayList<>();
|
|
|
|
|
|
if(choseDate.length() == 7){
|
|
|
list = patientHealthIndexDao.findByDateMonthAndType(type,patientCode,choseDate,deviceSn);
|
|
|
}else{
|
|
|
list = patientHealthIndexDao.findByDateAndType(type,patientCode,choseDate,deviceSn);
|
|
|
}
|
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (DevicePatientHealthIndex item : list) {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
if (type == 1) //血糖
|
|
|
{
|
|
|
String gi = item.getValue1();
|
|
|
String giType = item.getValue2();
|
|
|
map.put("time", DateUtil.dateToStrLong(item.getRecordDate()));
|
|
|
map.put("gi", gi); // 血糖值
|
|
|
map.put("gi_type", giType); // 血糖值类型
|
|
|
String text = gi + " mmol/L";
|
|
|
if ("1".equals(giType)) {
|
|
|
text += "(早餐前)";
|
|
|
} else if ("2".equals(giType)) {
|
|
|
text += "(早餐后)";
|
|
|
} else if ("3".equals(giType)) {
|
|
|
text += "(午餐前)";
|
|
|
} else if ("4".equals(giType)) {
|
|
|
text += "(午餐后)";
|
|
|
} else if ("5".equals(giType)) {
|
|
|
text += "(晚饭前)";
|
|
|
} else if ("6".equals(giType)) {
|
|
|
text += "(晚饭后)";
|
|
|
} else if ("7".equals(giType)) {
|
|
|
text += "(睡前)";
|
|
|
}
|
|
|
map.put("text", text); // 展示
|
|
|
// re.add(map);
|
|
|
} else if (type == 2) //血压
|
|
|
{
|
|
|
String sys = item.getValue1(); //收缩压
|
|
|
String dia = item.getValue2(); //舒张压
|
|
|
String pul = item.getValue3(); //脉搏
|
|
|
map.put("time", DateUtil.dateToStrLong(item.getRecordDate()));
|
|
|
map.put("sys", sys);
|
|
|
map.put("dia", dia);
|
|
|
map.put("pul", pul);
|
|
|
// re.add(map);
|
|
|
} else if (type == 3) //体重
|
|
|
{
|
|
|
String weight = item.getValue1(); //体重
|
|
|
String height = item.getValue2(); //身高
|
|
|
String bmi = item.getValue3(); //BMI
|
|
|
map.put("time", DateUtil.dateToStrShort(item.getRecordDate()));
|
|
|
map.put("weight", weight);
|
|
|
map.put("height", height);
|
|
|
map.put("bmi", bmi);
|
|
|
map.put("text", weight + " kg");
|
|
|
// re.add(map);
|
|
|
}else if(type == 4){
|
|
|
map.put("time", DateUtil.dateToStrLong(item.getRecordDate()));
|
|
|
map.put("value1", item.getValue1());
|
|
|
map.put("value2", item.getValue2());
|
|
|
}
|
|
|
map.put("type", item.getType().toString());
|
|
|
re.add(map);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
|
|
|
public DevicePatientHealthIndex getHealthIndexById(Long id) {
|
|
|
return patientHealthIndexDao.findOne(id);
|
|
|
}
|
|
|
}
|