|
@ -14,13 +14,10 @@ import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
|
import com.yihu.jw.hospital.module.health.controller.Result;
|
|
|
import com.yihu.jw.hospital.utils.CountDistance;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
|
|
|
import com.yihu.jw.hospital.utils.DeviceDataPushLogUtil;
|
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.util.common.GpsUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -57,17 +54,11 @@ public class DeviceUploadService {
|
|
|
@Autowired
|
|
|
private SystemMessageDao systemMessageDao;
|
|
|
@Autowired
|
|
|
private HealthIndexUtil healthIndexUtil;
|
|
|
@Autowired
|
|
|
private ImUtil imUtil;
|
|
|
@Autowired
|
|
|
private CountDistance countDistance;
|
|
|
@Autowired
|
|
|
private GpsUtil gpsUtil;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private DeviceDataPushLogUtil dataPushLogUtil;
|
|
|
@Autowired
|
|
|
private DsyyEntranceService dsyyEntranceService;
|
|
|
|
|
|
public Result uploadDevicesData(String dataJson, HttpServletRequest request)throws Exception {
|
|
|
try {
|
|
@ -129,6 +120,7 @@ public class DeviceUploadService {
|
|
|
}
|
|
|
dataPushLogUtil.savePushLog(deviceSn,paraString,"体征数据接收");
|
|
|
dataPushLogUtil.updContactStatus(deviceSn,1,false);
|
|
|
dsyyEntranceService.pushIotDeviceDataInfo(result.getId());
|
|
|
//保存消息
|
|
|
BasePatientDO patientDO = patientDao.findById(result.getUser()).orElse(null);
|
|
|
if (null != patientDO){
|
|
@ -144,61 +136,7 @@ public class DeviceUploadService {
|
|
|
break;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(typeName)){
|
|
|
/* String adminSql = "SELECT py_code FROM wlyy_hospital_sys_dict WHERE dict_name = 'pushOnOff' AND dict_code ='"+6+"' ";
|
|
|
String onOff= jdbcTemplate.queryForObject(adminSql,String.class);
|
|
|
Boolean kg = Boolean.parseBoolean(onOff);
|
|
|
String patientOnOffSql = "select on_off from base_patient_pad_pushonoff where patient = '" + patientDO.getId() + "' and type = 3";
|
|
|
Integer integer = jdbcTemplate.queryForObject(patientOnOffSql,Integer.class);
|
|
|
if (kg&&integer==0?false:true) {
|
|
|
messageDO.setTitle(typeName);
|
|
|
messageDO.setType("42");//42体征设备测量
|
|
|
messageDO.setSender("system");
|
|
|
messageDO.setSenderName("养护助手");
|
|
|
messageDO.setRelationCode(result.getId() + "");
|
|
|
messageDO.setReceiver(patientDO.getId());
|
|
|
messageDO.setReceiverName(patientDO.getName());
|
|
|
// messageDO.setUserType(1);
|
|
|
messageDO.setOver("1");
|
|
|
|
|
|
|
|
|
messageDO.setCode(type);//与体征类型对应
|
|
|
JSONArray errorIndex = healthIndexUtil.verifyHealthIndex(Integer.parseInt(type), result.getValue1(), result.getValue2(),
|
|
|
result.getValue3(), result.getValue4(), result.getValue5(), result.getValue6(),
|
|
|
result.getValue7());
|
|
|
messageDO.setData(JSON.toJSONString(errorIndex, SerializerFeature.WriteNullStringAsEmpty));
|
|
|
messageDO.setDel("1");
|
|
|
messageDO.setCreateTime(new Date());
|
|
|
//推送socket
|
|
|
com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
|
|
|
message.put("title", typeName);
|
|
|
message.put("code", messageDO.getCode());
|
|
|
message.put("content", messageDO.getData());
|
|
|
message.put("relation_code", messageDO.getRelationCode());
|
|
|
message.put("content_type", 42);
|
|
|
message.put("content_notice", "");
|
|
|
// message.put("audioUrl", url);
|
|
|
String content_notice = "";
|
|
|
for (int i = 0; i < errorIndex.size(); i++) {
|
|
|
com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
|
|
|
if (0 != tmp.getInteger("error")) {
|
|
|
result.setStatus(1);
|
|
|
}
|
|
|
if (1 == tmp.getInteger("error")) {
|
|
|
content_notice += tmp.getString("indexName") + "、";
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(content_notice)) {
|
|
|
content_notice = content_notice.substring(0, content_notice.length() - 1);
|
|
|
message.put("content_notice", "您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1", content_notice));
|
|
|
messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1", content_notice));
|
|
|
dataPushLogUtil.updContactStatus(deviceSn, 1, true);
|
|
|
} else {
|
|
|
dataPushLogUtil.updContactStatus(deviceSn, 1, false);
|
|
|
}
|
|
|
patientHealthIndexDao.save(result);
|
|
|
systemMessageDao.save(messageDO);
|
|
|
imUtil.sendPatientSystemMessage(messageDO.getReceiver(), JSON.toJSONString(message, SerializerFeature.WriteMapNullValue));
|
|
|
}*/
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|