|
@ -10,6 +10,11 @@ import com.yihu.hos.device.common.http.HttpResponse;
|
|
|
import com.yihu.hos.device.common.util.*;
|
|
|
import com.yihu.hos.device.model.*;
|
|
|
import com.yihu.hos.device.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.entity.patient.PatientAimBloodPressure;
|
|
|
import com.yihu.wlyy.entity.patient.PatientAimBloodSugger;
|
|
|
import com.yihu.wlyy.repository.doctor.PatientAimBloodPressureDao;
|
|
|
import com.yihu.wlyy.repository.doctor.PatientAimBloodSuggerDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
@ -27,7 +32,7 @@ import java.util.*;
|
|
|
* Created by lingfeng on 2016/8/19.
|
|
|
*/
|
|
|
@Service("DeviceService")
|
|
|
public class DeviceService {
|
|
|
public class DeviceService extends BaseService{
|
|
|
public static final String BEAN_ID = "DeviceService";
|
|
|
@Autowired
|
|
|
DeviceInfoDao deviceInfoDao;
|
|
@ -75,6 +80,10 @@ public class DeviceService {
|
|
|
private TrackPatientDao trackPatientDao;
|
|
|
@Value("${systemConfig.server_url}")
|
|
|
private String wlyyService;
|
|
|
@Autowired
|
|
|
private PatientAimBloodSuggerDao patientAimBloodSuggerDao;
|
|
|
@Autowired
|
|
|
private PatientAimBloodPressureDao patientAimBloodPressureDao;
|
|
|
|
|
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
|
private Integer aStart;
|
|
@ -576,6 +585,40 @@ public class DeviceService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置默认监控方案
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public String setDefaultAim(String patient){
|
|
|
PatientAimBloodSugger patientAimBloodSugger = patientAimBloodSuggerDao.findByPatientcode(patient);
|
|
|
PatientAimBloodPressure patientAimBloodPressure = patientAimBloodPressureDao.findByPatientcode(patient);
|
|
|
if(patientAimBloodSugger==null){
|
|
|
PatientAimBloodSugger pa = new PatientAimBloodSugger();
|
|
|
pa.setPatientcode(patient);
|
|
|
pa.setCode(getCode());
|
|
|
pa.setCreateTime(new Date());
|
|
|
pa.setUnit("mmol/L");
|
|
|
pa.setFbg("7.0");
|
|
|
pa.setHpg("11.1");
|
|
|
pa.setFbgMin("4.0");
|
|
|
pa.setHpgMin("4.0");
|
|
|
patientAimBloodSuggerDao.save(pa);
|
|
|
}
|
|
|
if(patientAimBloodPressure==null){
|
|
|
PatientAimBloodPressure pa = new PatientAimBloodPressure();
|
|
|
pa.setPatientcode(patient);
|
|
|
pa.setCode(getCode());
|
|
|
pa.setCreateTime(new Date());
|
|
|
pa.setSbp("140");
|
|
|
pa.setSbpMin("90");
|
|
|
pa.setDbp("90");
|
|
|
pa.setDbpMin("60");
|
|
|
pa.setUnit("mmHg");
|
|
|
patientAimBloodPressureDao.save(pa);
|
|
|
}
|
|
|
return "1";
|
|
|
}
|
|
|
/**
|
|
|
* 设置
|
|
|
* @param patient
|
|
@ -673,6 +716,8 @@ public class DeviceService {
|
|
|
t.setPatientName(p.getName());
|
|
|
t.setDel("0");
|
|
|
trackPatientDao.save(t);
|
|
|
//设置默认控制目标
|
|
|
setDefaultAim(patient);
|
|
|
}else{
|
|
|
trackPatient.setDel("0");
|
|
|
trackPatientDao.save(trackPatient);
|
|
@ -696,6 +741,8 @@ public class DeviceService {
|
|
|
t.setPatientName(p.getName());
|
|
|
t.setDel("0");
|
|
|
trackPatientDao.save(t);
|
|
|
//设置默认控制目标
|
|
|
setDefaultAim(patient);
|
|
|
}else{
|
|
|
trackPatient.setDel("0");
|
|
|
trackPatientDao.save(trackPatient);
|