|  | @ -15,6 +15,8 @@ import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.consult.ConsultTeamDao;
 |  | import com.yihu.wlyy.repository.consult.ConsultTeamDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.doctor.DoctorDao;
 |  | import com.yihu.wlyy.repository.doctor.DoctorDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.doctor.DoctorSwitchDao;
 |  | import com.yihu.wlyy.repository.doctor.DoctorSwitchDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.wlyy.repository.doctor.PatientAimBloodPressureDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.wlyy.repository.doctor.PatientAimBloodSuggerDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.doctor.health.DoctorHealthStandardDao;
 |  | import com.yihu.wlyy.repository.doctor.health.DoctorHealthStandardDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.message.MessageDao;
 |  | import com.yihu.wlyy.repository.message.MessageDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.patient.*;
 |  | import com.yihu.wlyy.repository.patient.*;
 | 
												
											
												
													
														
															|  | @ -96,6 +98,10 @@ public class PatientHealthIndexService extends BaseService {
 | 
												
													
														
															|  |     private TrackPatientDao trackPatientDao;
 |  |     private TrackPatientDao trackPatientDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private IotDeviceService iotDeviceService;
 |  |     private IotDeviceService iotDeviceService;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private PatientAimBloodSuggerDao patientAimBloodSuggerDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private PatientAimBloodPressureDao patientAimBloodPressureDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 获取居民标准预警值
 |  |      * 获取居民标准预警值
 | 
												
											
												
													
														
															|  | @ -915,6 +921,41 @@ public class PatientHealthIndexService extends BaseService {
 | 
												
													
														
															|  | 	    //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
 |  | 	    //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 设置默认监控方案
 | 
												
													
														
															|  | 
 |  |      * @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
 |  |      * @param patient
 | 
												
											
												
													
														
															|  | @ -950,6 +991,8 @@ public class PatientHealthIndexService extends BaseService {
 | 
												
													
														
															|  |                     t.setPatientName(p.getName());
 |  |                     t.setPatientName(p.getName());
 | 
												
													
														
															|  |                     t.setDel("1");
 |  |                     t.setDel("1");
 | 
												
													
														
															|  |                     trackPatientDao.save(t);
 |  |                     trackPatientDao.save(t);
 | 
												
													
														
															|  | 
 |  |                     //设置默认控制目标
 | 
												
													
														
															|  | 
 |  |                     setDefaultAim(patient);
 | 
												
													
														
															|  |                 }else{
 |  |                 }else{
 | 
												
													
														
															|  |                     trackPatient.setDel("1");
 |  |                     trackPatient.setDel("1");
 | 
												
													
														
															|  |                     trackPatientDao.save(trackPatient);
 |  |                     trackPatientDao.save(trackPatient);
 | 
												
											
												
													
														
															|  | @ -973,6 +1016,8 @@ public class PatientHealthIndexService extends BaseService {
 | 
												
													
														
															|  |                     t.setPatientName(p.getName());
 |  |                     t.setPatientName(p.getName());
 | 
												
													
														
															|  |                     t.setDel("1");
 |  |                     t.setDel("1");
 | 
												
													
														
															|  |                     trackPatientDao.save(t);
 |  |                     trackPatientDao.save(t);
 | 
												
													
														
															|  | 
 |  |                     //设置默认控制目标
 | 
												
													
														
															|  | 
 |  |                     setDefaultAim(patient);
 | 
												
													
														
															|  |                 }else{
 |  |                 }else{
 | 
												
													
														
															|  |                     trackPatient.setDel("1");
 |  |                     trackPatient.setDel("1");
 | 
												
													
														
															|  |                     trackPatientDao.save(trackPatient);
 |  |                     trackPatientDao.save(trackPatient);
 |