|
@ -6,10 +6,12 @@ import com.yihu.device.entity.DevicePatientHealthIndex;
|
|
|
import com.yihu.wlyy.entity.device.DeviceHealthyInfoMapping;
|
|
|
import com.yihu.wlyy.entity.device.PatientDevice;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.repository.deviece.DeviceHealthyInfoMappingDao;
|
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
@ -64,6 +66,8 @@ public class IotDeviceService {
|
|
|
@Autowired
|
|
|
private PatientDao patientDao;
|
|
|
@Autowired
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
@Autowired
|
|
|
private SystemDictDao systemDictDao;
|
|
|
@Autowired
|
|
|
private DeviceHealthyInfoMappingDao deviceHealthyInfoMappingDao;
|
|
@ -409,10 +413,22 @@ public class IotDeviceService {
|
|
|
List<PatientDevice> list = patientDeviceDao.findAll();
|
|
|
list.forEach(patientDevice -> {
|
|
|
Patient patient = patientDao.findByCode(patientDevice.getUser());
|
|
|
String response = saveDevice(patientDevice,patient.getAddress(),patient.getName(),patient.getDiseaseCondition());
|
|
|
JSONObject re = JSONObject.parseObject(response);
|
|
|
if(re.getInteger("status")!=200){
|
|
|
logger.error("id:"+patientDevice.getId()+" "+re.getString("errorMsg"));
|
|
|
if(patient!=null){
|
|
|
String address = patient.getAddress();
|
|
|
if(StringUtils.isBlank(address)){
|
|
|
//居民地址为空,默认取居民的社区,如果社区为空默认填写签约的社区医院
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patientDevice.getUser());
|
|
|
if(signFamily!=null){
|
|
|
address = StringUtils.isBlank(signFamily.getSickVillageName())?signFamily.getHospitalName():signFamily.getSickVillageName();
|
|
|
}
|
|
|
}
|
|
|
String response = saveDevice(patientDevice,address,patient.getName(),patient.getDiseaseCondition());
|
|
|
if(StringUtils.isNotBlank(response)){
|
|
|
JSONObject re = JSONObject.parseObject(response);
|
|
|
if(re.getInteger("status")!=200){
|
|
|
logger.error("id:"+patientDevice.getId()+" "+re.getString("errorMsg"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|