|
@ -29,6 +29,7 @@ import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
@ -599,10 +600,15 @@ public class PatientHealthIndexService extends BaseService {
|
|
|
if (index % 2 == 0) {
|
|
|
if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore)) {
|
|
|
msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L)";
|
|
|
//体征异常,更新体征数据状态
|
|
|
data.setStatus(1);
|
|
|
patientHealthIndexDao.save(data);
|
|
|
}
|
|
|
} else { //餐前
|
|
|
if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter)) {
|
|
|
msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L)";
|
|
|
data.setStatus(1);
|
|
|
patientHealthIndexDao.save(data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -633,6 +639,8 @@ public class PatientHealthIndexService extends BaseService {
|
|
|
// 收缩压/舒张压校验
|
|
|
if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY) || !checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)) {
|
|
|
msgContent = patient.getName() + "血压异常(舒张压 " + value2 + "mmHg、收缩压 " + value1 + "mmHg)";
|
|
|
data.setStatus(1);
|
|
|
patientHealthIndexDao.save(data);
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -783,6 +791,69 @@ public class PatientHealthIndexService extends BaseService {
|
|
|
return obj;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 判断居民的体征预警状态
|
|
|
* @param obj
|
|
|
*/
|
|
|
public void handlePatientStandarStatus(DevicePatientHealthIndex obj){
|
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
|
|
|
String patientCode = obj.getUser();
|
|
|
//患者信息
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
|
int bloodPressureBbnormalCount = 0;//血压异常次数
|
|
|
int bloodSuggurBbnormalCount = 0;//血糖异常次数
|
|
|
|
|
|
// 排序
|
|
|
Sort sort = new Sort(Sort.Direction.DESC, "recordDate");
|
|
|
// 分页信息
|
|
|
Pageable pageRequest = new PageRequest(0, 5, sort);
|
|
|
Pageable pageable = new PageRequest(1, 5);
|
|
|
List<DevicePatientHealthIndex> bloodPressurepatientHealthIndices = new ArrayList<>();
|
|
|
List<DevicePatientHealthIndex> bloodSuggurpatientHealthIndices = new ArrayList<>();
|
|
|
if( 1 == patient.getDisease()){
|
|
|
bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,2,pageable);
|
|
|
} else if( 2 == patient.getDisease()){
|
|
|
bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,1,pageable);
|
|
|
} else {
|
|
|
bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,2,pageable);
|
|
|
bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndType(patientCode,1,pageable);
|
|
|
}
|
|
|
|
|
|
for (DevicePatientHealthIndex patientHealthIndex : bloodPressurepatientHealthIndices) {
|
|
|
if(1 == patientHealthIndex.getStatus()){
|
|
|
bloodPressureBbnormalCount++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (DevicePatientHealthIndex patientHealthIndex : bloodSuggurpatientHealthIndices) {
|
|
|
if(1 == patientHealthIndex.getStatus()){
|
|
|
bloodSuggurBbnormalCount++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//连续3次异常,修改用户为预警状态
|
|
|
if( (3 == bloodPressureBbnormalCount || 3 == bloodSuggurBbnormalCount) && 0 == patient.getStandardStatus()){
|
|
|
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次正常,修改用户为非预警状态
|
|
|
if((0 == bloodPressureBbnormalCount && 0 == bloodSuggurBbnormalCount) && 1 == patient.getStandardStatus()){
|
|
|
patient.setStandardStatus(0);
|
|
|
}
|
|
|
|
|
|
patientDao.save(patient);
|
|
|
//连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 按录入时间和患者标识查询健康记录
|