|
@ -64,22 +64,28 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
|
|
|
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
User loginUser = (User) request.getSession().getAttribute("userInfo");
|
|
|
|
|
|
// HttpServletRequest request = ServletActionContext.getRequest();
|
|
|
// HttpSession session = request.getSession();
|
|
|
|
|
|
|
|
|
Pageable pageRequest = new PageRequest(page-1,pageSize);
|
|
|
StringBuilder filter = new StringBuilder();
|
|
|
String sql = "SELECT a.patient FROM wlyy.wlyy_sign_family a, wlyy.wlyy_patient b WHERE a.status > 0 AND a.patient = b.code ";
|
|
|
|
|
|
//1、管理员 2、医生 0、其他
|
|
|
if(loginUser.getType()==2){
|
|
|
Doctor doctor = doctorDao.findByCode(loginUser.getCode());
|
|
|
String[] codes =signFamilyDao.findByHospital(doctor.getHospital());
|
|
|
if(codes != null && codes.length >0){
|
|
|
filter.append("user="+StringUtils.join(codes, ","));
|
|
|
}else {
|
|
|
return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
|
|
|
if(doctor!=null &&StringUtils.isNotEmpty(doctor.getHospital())){
|
|
|
|
|
|
sql += " AND a.hospital = '"+doctor.getHospital()+"' ";
|
|
|
}
|
|
|
}
|
|
|
//根据患者名称过滤
|
|
|
if(!StringUtils.isEmpty(userName)){
|
|
|
sql +=" AND b.NAME LIKE '%"+userName+"%'";
|
|
|
}
|
|
|
//根据健管师或医生名称过滤
|
|
|
if(!StringUtils.isEmpty(doctorName)){
|
|
|
sql += " and (a.doctor_name like '%"+doctorName+"%' or a.doctor_health_name like '%"+doctorName+"%') ";
|
|
|
}
|
|
|
List<String> patientList = jdbcTemplate.queryForList(sql,String.class);
|
|
|
|
|
|
if(!StringUtils.isEmpty(deviceSn)){
|
|
|
filter.append("deviceSn="+deviceSn+";");
|
|
|
}
|
|
@ -98,22 +104,12 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
|
|
|
filter.append("czrq>=" + DateTimeUtil.utcDateTimeFormat(startTimeTemp)+ ";");
|
|
|
filter.append("czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp)+ ";");
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(userName)){
|
|
|
String[] codes = patientDao.findByName(userName);
|
|
|
if(codes != null && codes.length >0){
|
|
|
filter.append("user="+StringUtils.join(codes, ","));
|
|
|
}else {
|
|
|
return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
|
|
|
}
|
|
|
}
|
|
|
//根据医生名称过滤居民
|
|
|
if(!StringUtils.isEmpty(doctorName)){
|
|
|
String[] codes = signFamilyDao.findByDoctorName("%"+doctorName+"%");
|
|
|
if(codes != null && codes.length >0){
|
|
|
filter.append("user="+StringUtils.join(codes, ","));
|
|
|
}else {
|
|
|
return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
|
|
|
}
|
|
|
if(patientList != null && patientList.size() >0){
|
|
|
String temp = StringUtils.join(patientList, ",");
|
|
|
// temp = temp.substring(0,temp.length()-1);
|
|
|
filter.append("user="+temp+";");
|
|
|
}else {
|
|
|
return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
|
|
|
}
|
|
|
|
|
|
if(!StringUtils.isEmpty(indexType)){
|
|
@ -191,8 +187,8 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
|
|
|
filter.append("czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp)+ ";");
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(userName)){
|
|
|
String[] codes = patientDao.findByName(userName);
|
|
|
if(codes != null && codes.length >0){
|
|
|
List<String> codes = patientDao.findByName(userName);
|
|
|
if(codes != null && codes.size() >0){
|
|
|
filter.append("user="+StringUtils.join(codes, ","));
|
|
|
}
|
|
|
}
|