|
@ -11,6 +11,7 @@ import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
|
|
import com.yihu.jw.care.service.common.DictService;
|
|
import com.yihu.jw.care.service.common.DictService;
|
|
import com.yihu.jw.care.service.consult.ConsultTeamService;
|
|
import com.yihu.jw.care.service.consult.ConsultTeamService;
|
|
import com.yihu.jw.care.service.contacts.ContactsService;
|
|
import com.yihu.jw.care.service.contacts.ContactsService;
|
|
|
|
import com.yihu.jw.care.service.device.DeviceService;
|
|
import com.yihu.jw.care.service.device.PatientDeviceService;
|
|
import com.yihu.jw.care.service.device.PatientDeviceService;
|
|
import com.yihu.jw.care.service.device.YsDeviceService;
|
|
import com.yihu.jw.care.service.device.YsDeviceService;
|
|
import com.yihu.jw.care.service.doctor.DoctorServicePermissionsService;
|
|
import com.yihu.jw.care.service.doctor.DoctorServicePermissionsService;
|
|
@ -46,6 +47,7 @@ import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.entity.EntityUtils;
|
|
import com.yihu.jw.util.entity.EntityUtils;
|
|
|
|
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import jdk.nashorn.internal.runtime.FindProperty;
|
|
import jdk.nashorn.internal.runtime.FindProperty;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -139,6 +141,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
private BaseOrgDao orgDao;
|
|
private BaseOrgDao orgDao;
|
|
@Autowired
|
|
@Autowired
|
|
private DeviceDetailDao deviceDetailDao;
|
|
private DeviceDetailDao deviceDetailDao;
|
|
|
|
@Autowired
|
|
|
|
private HealthIndexUtil healthIndexUtil;
|
|
|
|
@Autowired
|
|
|
|
private DeviceService deviceService;
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
|
|
private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
|
|
|
|
|
|
@ -583,7 +589,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
//获取咨询
|
|
//获取咨询
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderID);
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderID);
|
|
if (null != consult) {
|
|
if (null != consult) {
|
|
String sessionId = orderDO.getPatient() + "_" + consult.getId() + "_" + consult.getType();
|
|
|
|
|
|
String sessionId = orderDO.getPatient() + "_" + consult.getType();
|
|
jsonObject.put("sessionId", sessionId);
|
|
jsonObject.put("sessionId", sessionId);
|
|
if (1 == orderDO.getStatus() && StringUtils.isNotBlank(doctor)) {//查询未读数量
|
|
if (1 == orderDO.getStatus() && StringUtils.isNotBlank(doctor)) {//查询未读数量
|
|
try {
|
|
try {
|
|
@ -709,10 +715,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
|
|
if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
|
|
fliter += " and EXISTS( SELECT DISTINCT p.id,p.name,p.residential_area residentialArea,p.photo,p.idcard,p.mobile, " +
|
|
|
|
" p.openid,p.sex,p.pad_imei padImei " +
|
|
|
|
" from base_patient p , base_service_package_sign_record sr,base_service_package_record r,base_team_member m " +
|
|
|
|
" WHERE p.id = sr.patient and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id " +
|
|
|
|
|
|
fliter += " and EXISTS( SELECT 1 " +
|
|
|
|
" from base_service_package_sign_record sr,base_service_package_record r,base_team_member m " +
|
|
|
|
" WHERE ord.patient = CONVERT(sr.patient USING utf8) and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id " +
|
|
" and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
|
|
" and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
|
|
|
|
|
|
fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
|
|
fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
|
|
@ -861,10 +866,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
|
|
if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
|
|
fliter += " and EXISTS( SELECT DISTINCT p.id,p.name,p.residential_area residentialArea,p.photo,p.idcard,p.mobile, " +
|
|
|
|
" p.openid,p.sex,p.pad_imei padImei " +
|
|
|
|
" from base_patient p , base_service_package_sign_record sr,base_service_package_record r,base_team_member m " +
|
|
|
|
" WHERE p.id = sr.patient and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id " +
|
|
|
|
|
|
fliter += " and EXISTS( SELECT 1" +
|
|
|
|
" from base_service_package_sign_record sr,base_service_package_record r,base_team_member m " +
|
|
|
|
" WHERE ord.patient = CONVERT(sr.patient USING utf8) and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id " +
|
|
" and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
|
|
" and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
|
|
|
|
|
|
fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
|
|
fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
|
|
@ -978,7 +982,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
// consultTeam.setDoctorName(doorServiceOrder.getDoctorName());
|
|
// consultTeam.setDoctorName(doorServiceOrder.getDoctorName());
|
|
// consultTeamDao.save(consultTeam);
|
|
// consultTeamDao.save(consultTeam);
|
|
//
|
|
//
|
|
// String sessionId = doorServiceOrder.getPatient() + "_" + consultTeam.getConsult() + "_" + doorServiceOrder.getNumber() + "_" + consultTeam.getType();
|
|
|
|
|
|
// String sessionId = doorServiceOrder.getPatient() + "_" + consultTeam.getType();
|
|
// //成功创建服务工单后,居民所在机构调度员向居民发起一条通知服务消息
|
|
// //成功创建服务工单后,居民所在机构调度员向居民发起一条通知服务消息
|
|
//
|
|
//
|
|
// // 发送IM消息通知患者医生已接单
|
|
// // 发送IM消息通知患者医生已接单
|
|
@ -1575,6 +1579,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
/**
|
|
/**
|
|
* 老人家属首页实时监护信息
|
|
* 老人家属首页实时监护信息
|
|
* 居家状态取手表 无手表缺省
|
|
* 居家状态取手表 无手表缺省
|
|
|
|
* 最近 血糖 血压记录
|
|
* 监控
|
|
* 监控
|
|
*/
|
|
*/
|
|
public JSONObject patientMonitoringInfo2(String patient) {
|
|
public JSONObject patientMonitoringInfo2(String patient) {
|
|
@ -1642,14 +1647,82 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
result.put("emeAssistance", true);
|
|
result.put("emeAssistance", true);
|
|
}
|
|
}
|
|
List<DevicePatientDevice> devices4 = patientDeviceDao.findByUserAndCategoryCode(patient, "4");//手表
|
|
List<DevicePatientDevice> devices4 = patientDeviceDao.findByUserAndCategoryCode(patient, "4");//手表
|
|
|
|
|
|
|
|
//手表佩戴
|
|
|
|
result.put("wear_flag","");
|
|
|
|
result.put("wear_flagName","");
|
|
|
|
|
|
|
|
|
|
if (devices4.size() > 0) {
|
|
if (devices4.size() > 0) {
|
|
result = patientSignTopicInfo(result, patient, "preventLost", devices4.get(0).getDeviceSn(), true);
|
|
result = patientSignTopicInfo(result, patient, "preventLost", devices4.get(0).getDeviceSn(), true);
|
|
|
|
JSONObject response = patientDeviceService.getAqgDeviceInfo2(devices4.get(0).getDeviceSn());
|
|
|
|
//手表佩戴状态
|
|
|
|
if (response.containsKey("wear_flag") && response.get("wear_flag") != null) {
|
|
|
|
result.put("wear_flag", response.get("wear_flag"));
|
|
|
|
result.put("wear_flagName", 1==response.getInteger("wear_flag")?"未佩戴":"已佩戴");
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
patientSignTopicInfo(result, patient, "preventFall", null, true);
|
|
patientSignTopicInfo(result, patient, "preventFall", null, true);
|
|
|
|
|
|
|
|
|
|
|
|
String healthXYSql ="SELECT value1,value2,value3 FROM wlyy_patient_health_index WHERE `user` = '"+patient+"' AND type = 2 ORDER BY record_date DESC LIMIT 1";
|
|
|
|
List<Map<String, Object>> XY = jdbcTemplate.queryForList(healthXYSql);
|
|
|
|
|
|
|
|
String healthXTSql ="SELECT value1,value2,value3,value4 FROM wlyy_patient_health_index WHERE `user` = '"+patient+"' AND type = 1 ORDER BY record_date DESC LIMIT 1";
|
|
|
|
List<Map<String, Object>> XT = jdbcTemplate.queryForList(healthXTSql);
|
|
|
|
|
|
|
|
if (XY.size()!= 0) {
|
|
|
|
for (Map<String, Object> map : XY) {
|
|
|
|
//HealthIndexUtil.verifyHealthIndex
|
|
|
|
JSONArray jsonArray = healthIndexUtil.verifyHealthIndex(2, null==map.get("value1")?"":map.get("value1").toString(), null==map.get("value2")?"":map.get("value2").toString(), null==map.get("value3")?"":map.get("value3").toString());
|
|
|
|
if(jsonArray.size()==0){
|
|
|
|
map.put("value1Index","");
|
|
|
|
map.put("value2Index","");
|
|
|
|
//map.put("value3Index","");
|
|
|
|
}else {
|
|
|
|
//收缩压
|
|
|
|
map.put("value1Index",jsonArray.getJSONObject(0).get("error"));
|
|
|
|
//舒张压
|
|
|
|
map.put("value2Index",jsonArray.getJSONObject(1).get("error"));
|
|
|
|
//脉搏
|
|
|
|
//map.put("value3Index",jsonArray.getJSONObject(2).get("error"));
|
|
|
|
}
|
|
|
|
result.put("xy",map);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
result.put("xy",null);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (XT.size()!= 0) {
|
|
|
|
for (Map<String, Object> map : XT) {
|
|
|
|
JSONArray jsonArray = healthIndexUtil.verifyHealthIndex(1, null==map.get("value1")?"":map.get("value1").toString(), null==map.get("value2")?"":map.get("value2").toString());
|
|
|
|
if(jsonArray.size()==0){
|
|
|
|
map.put("value1Index","");
|
|
|
|
}else {
|
|
|
|
//血糖
|
|
|
|
map.put("value1Index",jsonArray.getJSONObject(0).get("error"));
|
|
|
|
}
|
|
|
|
result.put("xt",map);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
result.put("xt",null);
|
|
|
|
}
|
|
|
|
String patientDeviceCategoryCode = deviceService.getPatientDeviceCategoryCode(patient);
|
|
|
|
result.put("deviceShowInfo",patientDeviceCategoryCode);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//行动轨迹
|
|
|
|
public JSONArray getX1Locations(String patient, String date){
|
|
|
|
List<DevicePatientDevice> byUserAndCategoryCode = patientDeviceDao.findByUserAndCategoryCode(patient, "4");//手表
|
|
|
|
if (byUserAndCategoryCode.size()==0){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
JSONArray x1Locations = JSON.parseArray(JSON.toJSONString(patientDeviceService.getX1Locations(byUserAndCategoryCode.get(0).getDeviceSn(), date), SerializerFeature.WriteMapNullValue));
|
|
|
|
return x1Locations;
|
|
|
|
}
|
|
|
|
|
|
public void preventLost(JSONObject result, String patient, String deviceSn) {
|
|
public void preventLost(JSONObject result, String patient, String deviceSn) {
|
|
//手表与拐杖同时绑定时优先手表,围栏状态其中一个超出围栏即为超出围栏
|
|
//手表与拐杖同时绑定时优先手表,围栏状态其中一个超出围栏即为超出围栏
|
|
try {
|
|
try {
|
|
@ -2086,6 +2159,23 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 我已知悉
|
|
|
|
*/
|
|
|
|
public void know(String doctor,String orderId){
|
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
|
|
|
|
if (null != doctorDO) {
|
|
|
|
BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
|
|
|
|
logDO.setUserCode(doctor);
|
|
|
|
logDO.setUserName(doctorDO.getName());
|
|
|
|
logDO.setOrderId(orderId);
|
|
|
|
logDO.setUserType(2);
|
|
|
|
logDO.setCreateTime(new Date());
|
|
|
|
logDO.setContent("社工" + doctorDO.getName() + "已知悉");
|
|
|
|
logDao.save(logDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取居民睡眠计划
|
|
* 获取居民睡眠计划
|
|
*/
|
|
*/
|