|
@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.device.dao.DevicePatientHealthIndexDao;
|
|
|
import com.yihu.jw.device.dao.PatientDeviceDao;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientDevice;
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.iot.gateway.GcToken;
|
|
@ -20,10 +22,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@ -47,6 +46,10 @@ public class IotDeviceService {
|
|
|
private DevicePatientHealthIndexDao patientHealthIndexDao;
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
private static String iotHospital = "350211A1004";
|
|
|
private static String iotHospitalName = "厦门市第三医院";
|
|
|
@Autowired
|
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
|
|
|
/**
|
|
|
* 获取accesstoken,i健康写法暂时不能用
|
|
@ -125,13 +128,31 @@ public class IotDeviceService {
|
|
|
String response = sdkRunnerService.post("wlw/uploadDeviceData","设备业务数据信息上传",params,header,true,true);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
|
|
|
//设备相关基础信息注册
|
|
|
@Transactional
|
|
|
public String deviceRegistration(){
|
|
|
public String deviceRegistration(Long id){
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
String jsonData = "{\"deviceSn\":\"xty_test\",\"deviceModel\":\"测试\",\"name\":\"血糖仪TEST\",\"hospital\":\"350211A1004\",\"hospitalName\":\"厦门市第三医院\",\"categoryCode\":\"2\",\"categoryName\":\" 血糖仪\",\"commonName\":\" 血糖仪\",\"combinationMethod\":\"1\",\"networkTransmission\":\" 11\",\"deviceUse\":\"2\",\"dropLocation\":\"2\",\"dataAcquisition\":\"IoT_equipment_blood_glucose_mete\",\"companyName\":\"血糖仪厂商名称\",\"companyType\":\"3\"}";
|
|
|
JSONObject json = new JSONObject();
|
|
|
DevicePatientDevice device = patientDeviceDao.findById(id).orElse(null);
|
|
|
json.put("deviceSn",device.getDeviceSn());
|
|
|
json.put("deviceModel",device.getDeviceName());
|
|
|
json.put("name",device.getDeviceName());
|
|
|
json.put("hospital",iotHospital);
|
|
|
json.put("hospitalName",iotHospitalName);
|
|
|
json.put("categoryCode",device.getCategoryCode());
|
|
|
json.put("categoryName","1".equals(device.getCategoryCode())?"血糖仪":"血压仪");
|
|
|
json.put("commonName",device.getDeviceName());
|
|
|
json.put("combinationMethod","1");
|
|
|
json.put("networkTransmission","11");
|
|
|
json.put("deviceUse","1");
|
|
|
json.put("dropLocation","2");
|
|
|
json.put("dataAcquisition","IoT_equipment_blood_glucose_mete");
|
|
|
json.put("companyName","厂商名称");
|
|
|
json.put("companyType","3");
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
params.put("jsonData",jsonData);
|
|
|
params.put("jsonData",json.toJSONString());
|
|
|
header.put("accesstoken",getAccessToken());
|
|
|
String response = sdkRunnerService.post("wlw/deviceRegistration","设备相关基础信息注册",params,header,true,true);
|
|
|
return response;
|
|
@ -181,4 +202,6 @@ public class IotDeviceService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|