|
@ -400,7 +400,6 @@ public class DeviceService {
|
|
|
|
|
|
|
|
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
|
|
|
|
|
|
String patientCode = result.getUser();
|
|
String patientCode = result.getUser();
|
|
//患者信息
|
|
//患者信息
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
@ -411,19 +410,16 @@ public class DeviceService {
|
|
Sort sort = new Sort(Sort.Direction.DESC, "recordDate");
|
|
Sort sort = new Sort(Sort.Direction.DESC, "recordDate");
|
|
// 分页信息
|
|
// 分页信息
|
|
Pageable pageRequest = new PageRequest(0, 5, sort);
|
|
Pageable pageRequest = new PageRequest(0, 5, sort);
|
|
|
|
|
|
Pageable pageable = new PageRequest(1, 5);
|
|
Pageable pageable = new PageRequest(1, 5);
|
|
|
|
|
|
List<PatientHealthIndex> bloodPressurepatientHealthIndices = new ArrayList<>();
|
|
List<PatientHealthIndex> bloodPressurepatientHealthIndices = new ArrayList<>();
|
|
List<PatientHealthIndex> bloodSuggurpatientHealthIndices = new ArrayList<>();
|
|
List<PatientHealthIndex> bloodSuggurpatientHealthIndices = new ArrayList<>();
|
|
|
|
|
|
if( 1 == patient.getDisease()){
|
|
if( 1 == patient.getDisease()){
|
|
bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"2",pageable);
|
|
|
|
|
|
bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,2,pageable);
|
|
} else if( 2 == patient.getDisease()){
|
|
} else if( 2 == patient.getDisease()){
|
|
bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"1",pageable);
|
|
|
|
|
|
bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,1,pageable);
|
|
} else {
|
|
} else {
|
|
bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"2",pageable);
|
|
|
|
bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,"1",pageable);
|
|
|
|
|
|
bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,2,pageable);
|
|
|
|
bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,1,pageable);
|
|
}
|
|
}
|
|
|
|
|
|
for (PatientHealthIndex patientHealthIndex : bloodPressurepatientHealthIndices) {
|
|
for (PatientHealthIndex patientHealthIndex : bloodPressurepatientHealthIndices) {
|
|
@ -439,9 +435,17 @@ public class DeviceService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//连续5次异常,修改用户为预警状态
|
|
|
|
if( (5 == bloodPressureBbnormalCount || 5 == bloodSuggurBbnormalCount) && 0 == patient.getStandardStatus()){
|
|
|
|
|
|
//连续3次异常,修改用户为预警状态
|
|
|
|
if( (3 == bloodPressureBbnormalCount || 3 == bloodSuggurBbnormalCount) && 0 == patient.getStandardStatus()){
|
|
patient.setStandardStatus(1);
|
|
patient.setStandardStatus(1);
|
|
|
|
}else{
|
|
|
|
Date end = new Date();
|
|
|
|
Date start = DateUtil.setDateTime(end,-7);
|
|
|
|
//计算血糖或者血压一周内的异常记录数量
|
|
|
|
int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start,end,1);
|
|
|
|
if(errorCount >= 5){//超过5次,记为预警状态
|
|
|
|
patient.setStandardStatus(1);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//连续5次正常,修改用户为非预警状态
|
|
//连续5次正常,修改用户为非预警状态
|
|
@ -449,6 +453,7 @@ public class DeviceService {
|
|
patient.setStandardStatus(0);
|
|
patient.setStandardStatus(0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
patientDao.save(patient);
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|