|
@ -2,6 +2,7 @@ package com.yihu.wlyy.service.app.device;
|
|
|
|
|
|
import com.yihu.device.entity.DeviceDetail;
|
|
import com.yihu.device.entity.DeviceDetail;
|
|
import com.yihu.wlyy.entity.device.*;
|
|
import com.yihu.wlyy.entity.device.*;
|
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
|
|
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
|
|
@ -13,6 +14,7 @@ import com.yihu.wlyy.repository.deviece.DeviceDao;
|
|
import com.yihu.wlyy.repository.deviece.PatientBloodSuggerDao;
|
|
import com.yihu.wlyy.repository.deviece.PatientBloodSuggerDao;
|
|
import com.yihu.wlyy.repository.deviece.PatientHealthTimeDao;
|
|
import com.yihu.wlyy.repository.deviece.PatientHealthTimeDao;
|
|
import com.yihu.wlyy.repository.dict.Icd10DictDao;
|
|
import com.yihu.wlyy.repository.dict.Icd10DictDao;
|
|
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
|
|
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
|
|
@ -110,6 +112,10 @@ public class PatientDeviceService extends BaseService {
|
|
private Icd10DictDao icd10DictDao;
|
|
private Icd10DictDao icd10DictDao;
|
|
@Autowired
|
|
@Autowired
|
|
private PatientDeviceLogDao patientDeviceLogDao;
|
|
private PatientDeviceLogDao patientDeviceLogDao;
|
|
|
|
@Autowired
|
|
|
|
private DeviceDetailService deviceDetailService;
|
|
|
|
@Autowired
|
|
|
|
private SystemDictDao systemDictDao;
|
|
//健康问题 高血压
|
|
//健康问题 高血压
|
|
private static final String gxy = "HP0093";
|
|
private static final String gxy = "HP0093";
|
|
//健康问题 糖尿病
|
|
//健康问题 糖尿病
|
|
@ -1202,6 +1208,24 @@ public class PatientDeviceService extends BaseService {
|
|
keyType = "2";
|
|
keyType = "2";
|
|
}
|
|
}
|
|
DeviceDetail deviceDetail = deviceDetailDao.findBySn(deviceSn);
|
|
DeviceDetail deviceDetail = deviceDetailDao.findBySn(deviceSn);
|
|
|
|
if(deviceDetail==null){
|
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patientDevice.getUser());
|
|
|
|
Long adminTeam=0L;
|
|
|
|
String orgCode ="";
|
|
|
|
String orgName="";
|
|
|
|
String bingCount="";
|
|
|
|
if (Integer.valueOf(userType)>0){
|
|
|
|
bingCount="{\"1\":\"0\",\"2\":\"0\"}";
|
|
|
|
}else {
|
|
|
|
bingCount="{\"1\":\"0\"}";
|
|
|
|
}
|
|
|
|
if (signFamily!=null){
|
|
|
|
adminTeam = signFamily.getAdminTeamId();
|
|
|
|
orgCode = signFamily.getHospital();
|
|
|
|
orgName=signFamily.getHospitalName();
|
|
|
|
}
|
|
|
|
deviceDetailService.insertDevice(patientDevice,String.valueOf(adminTeam),orgName,orgCode,bingCount,0);
|
|
|
|
}
|
|
if (deviceDetail!=null && StringUtils.isNotEmpty(deviceDetail.getBindingCount())){
|
|
if (deviceDetail!=null && StringUtils.isNotEmpty(deviceDetail.getBindingCount())){
|
|
JSONObject jsonObject =new JSONObject(String.valueOf(deviceDetail.getBindingCount()));
|
|
JSONObject jsonObject =new JSONObject(String.valueOf(deviceDetail.getBindingCount()));
|
|
if (jsonObject.getInt(keyType)>0){
|
|
if (jsonObject.getInt(keyType)>0){
|
|
@ -1209,10 +1233,6 @@ public class PatientDeviceService extends BaseService {
|
|
msg="设备不是首次绑定";
|
|
msg="设备不是首次绑定";
|
|
code = -20000;
|
|
code = -20000;
|
|
}
|
|
}
|
|
}else {
|
|
|
|
flag=false;
|
|
|
|
msg="数据有问题!";
|
|
|
|
code= -30000;
|
|
|
|
}
|
|
}
|
|
resultMap.put("flag",flag);
|
|
resultMap.put("flag",flag);
|
|
resultMap.put("msg",msg);
|
|
resultMap.put("msg",msg);
|
|
@ -1228,7 +1248,7 @@ public class PatientDeviceService extends BaseService {
|
|
*/
|
|
*/
|
|
public Map<String,Object> checkBindingDeviceSn(String deviceSn) throws Exception{
|
|
public Map<String,Object> checkBindingDeviceSn(String deviceSn) throws Exception{
|
|
Boolean flag = false;
|
|
Boolean flag = false;
|
|
String message = "";
|
|
|
|
|
|
String message = "设备不存在!";
|
|
Integer resultCode = 200;
|
|
Integer resultCode = 200;
|
|
Map<String, String> params = new HashMap<>();
|
|
Map<String, String> params = new HashMap<>();
|
|
params.put("deviceSn", deviceSn);
|
|
params.put("deviceSn", deviceSn);
|
|
@ -1244,13 +1264,17 @@ public class PatientDeviceService extends BaseService {
|
|
if ("10000".equals(code) || "10001".equals(code)) {
|
|
if ("10000".equals(code) || "10001".equals(code)) {
|
|
flag = true;
|
|
flag = true;
|
|
}else {
|
|
}else {
|
|
String sql ="select count(*) num from device.wlyy_devices where device_code = '"+deviceSn+"'";
|
|
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (Integer.valueOf(String.valueOf(map.get("num")))>0){
|
|
|
|
flag = true ;
|
|
|
|
}else {
|
|
|
|
resultCode = -10001;
|
|
|
|
message="没有该设备!";
|
|
|
|
|
|
String systemValue = systemDictDao.findByDictNameAndCode("ACTIVITY_RANGE","2");
|
|
|
|
if (StringUtils.isNotEmpty(systemValue) && "350205".equals(systemValue)){
|
|
|
|
//活动范围在海沧区
|
|
|
|
String sql ="select count(*) num from device.wlyy_devices where device_code = '"+deviceSn+"'";
|
|
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (Integer.valueOf(String.valueOf(map.get("num")))>0){
|
|
|
|
flag = true ;
|
|
|
|
}else {
|
|
|
|
resultCode = -10001;
|
|
|
|
message="没有该设备!";
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
@ -1259,14 +1283,14 @@ public class PatientDeviceService extends BaseService {
|
|
flag = false;
|
|
flag = false;
|
|
}
|
|
}
|
|
|
|
|
|
String sql ="select count(*) num from device.wlyy_devices where device_code = '"+deviceSn+"'";
|
|
|
|
|
|
/*String sql ="select count(*) num from device.wlyy_devices where device_code = '"+deviceSn+"'";
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(sql);
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(sql);
|
|
if (Integer.valueOf(String.valueOf(map.get("num")))>0){
|
|
if (Integer.valueOf(String.valueOf(map.get("num")))>0){
|
|
flag = true ;
|
|
flag = true ;
|
|
}else {
|
|
}else {
|
|
resultCode = -10001;
|
|
resultCode = -10001;
|
|
message="没有该设备!";
|
|
message="没有该设备!";
|
|
}
|
|
|
|
|
|
}*/
|
|
|
|
|
|
Map<String,Object> map1 = new HashedMap();
|
|
Map<String,Object> map1 = new HashedMap();
|
|
map1.put("code",resultCode);
|
|
map1.put("code",resultCode);
|