|
@ -37,7 +37,6 @@ import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@ -956,13 +955,13 @@ public class PatientHealthIndexService extends BaseService {
|
|
|
public void handlePatientStandarStatus(DevicePatientHealthIndex obj) {
|
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
|
|
|
String patientCode = obj.getUser();
|
|
|
//患者信息
|
|
|
Patient p = patientDao.findByCode(patientCode);
|
|
|
|
|
|
PatientVO patient = new PatientVO();
|
|
|
String patientsql = "select group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 and (label = 1 or label = 2) and patient = '"+p.getCode()+"' GROUP BY patient";
|
|
|
|
|
|
String patientdisease = jdbcTemplate.queryForObject(patientsql,String.class);
|
|
|
//患者信息
|
|
|
Patient p = patientDao.findByCode(patientCode);
|
|
|
|
|
|
PatientVO patient = new PatientVO();
|
|
|
String patientsql = "select group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 and (label = 1 or label = 2) and patient = '"+p.getCode()+"' GROUP BY patient";
|
|
|
|
|
|
String patientdisease = jdbcTemplate.queryForObject(patientsql,String.class);
|
|
|
|
|
|
int bloodPressureBbnormalCount = 0;//血压异常次数
|
|
|
int bloodSuggurBbnormalCount = 0;//血糖异常次数
|
|
@ -984,42 +983,42 @@ public class PatientHealthIndexService extends BaseService {
|
|
|
bloodSuggurBbnormalCount++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//连续3次异常,修改用户为预警状态
|
|
|
if ((bloodPressureBbnormalCount >= 3 || bloodSuggurBbnormalCount >= 3) && (patient.getStandardStatus() == null || 0 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(1);
|
|
|
} else {
|
|
|
Date end = new Date();
|
|
|
Date start = DateUtil.setDateTime(end, -7);
|
|
|
//计算血糖或者血压一周内的异常记录数量
|
|
|
int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1, patientCode);
|
|
|
if (errorCount >= 5) {//超过5次,记为预警状态
|
|
|
p.setStandardStatus(1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//连续5次正常,修改用户为非预警状态
|
|
|
if (StringUtils.isNotBlank(patientdisease)) {
|
|
|
if ("1".equals(patientdisease)) {
|
|
|
if (0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
} else if ("2".equals(patientdisease)) {
|
|
|
if (0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
} else if ("1,2".equals(patientdisease) || "2,1".equals(patientdisease)) {
|
|
|
if (0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
|
|
|
patientDao.save(p);
|
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
|
|
|
|
|
|
|
|
|
//连续3次异常,修改用户为预警状态
|
|
|
if ((bloodPressureBbnormalCount >= 3 || bloodSuggurBbnormalCount >= 3) && (patient.getStandardStatus() == null || 0 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(1);
|
|
|
} else {
|
|
|
Date end = new Date();
|
|
|
Date start = DateUtil.setDateTime(end, -7);
|
|
|
//计算血糖或者血压一周内的异常记录数量
|
|
|
int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1, patientCode);
|
|
|
if (errorCount >= 5) {//超过5次,记为预警状态
|
|
|
p.setStandardStatus(1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//连续5次正常,修改用户为非预警状态
|
|
|
if (StringUtils.isNotBlank(patientdisease)) {
|
|
|
if ("1".equals(patientdisease)) {
|
|
|
if (0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
} else if ("2".equals(patientdisease)) {
|
|
|
if (0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
} else if ("1,2".equals(patientdisease) || "2,1".equals(patientdisease)) {
|
|
|
if (0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
p.setStandardStatus(0);
|
|
|
}
|
|
|
|
|
|
patientDao.save(p);
|
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
|
|
|
}
|
|
|
|
|
|
|