|
@ -4,9 +4,13 @@ import com.yihu.wlyy.device.entity.DeviceHealthIndex;
|
|
import com.yihu.wlyy.device.entity.DeviceHealthIndexExportVO;
|
|
import com.yihu.wlyy.device.entity.DeviceHealthIndexExportVO;
|
|
import com.yihu.wlyy.device.entity.DeviceHealthIndexVO;
|
|
import com.yihu.wlyy.device.entity.DeviceHealthIndexVO;
|
|
import com.yihu.wlyy.device.repository.DeviceHealthIndexDao;
|
|
import com.yihu.wlyy.device.repository.DeviceHealthIndexDao;
|
|
|
|
import com.yihu.wlyy.entity.Doctor;
|
|
import com.yihu.wlyy.entity.Patient;
|
|
import com.yihu.wlyy.entity.Patient;
|
|
|
|
import com.yihu.wlyy.entity.User;
|
|
import com.yihu.wlyy.entity.device.PatientHealthStandard;
|
|
import com.yihu.wlyy.entity.device.PatientHealthStandard;
|
|
|
|
import com.yihu.wlyy.repository.DoctorDao;
|
|
import com.yihu.wlyy.repository.PatientDao;
|
|
import com.yihu.wlyy.repository.PatientDao;
|
|
|
|
import com.yihu.wlyy.repository.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
|
|
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
|
|
import com.yihu.wlyy.util.DateTimeUtil;
|
|
import com.yihu.wlyy.util.DateTimeUtil;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
@ -19,6 +23,11 @@ import org.springframework.data.domain.*;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -37,20 +46,40 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
|
|
private WlyyPatientDeviceDao wlyyPatientDeviceDao;
|
|
private WlyyPatientDeviceDao wlyyPatientDeviceDao;
|
|
@Autowired
|
|
@Autowired
|
|
private DeviceHealthIndexDao deviceHealthIndexDao;
|
|
private DeviceHealthIndexDao deviceHealthIndexDao;
|
|
|
|
@Autowired
|
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
|
@Autowired
|
|
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Page<DeviceHealthIndexVO> searchList(String deviceSn,String date,String idcard,String userName,String indexType,Integer page,Integer pageSize,
|
|
public Page<DeviceHealthIndexVO> searchList(String deviceSn,String date,String idcard,String userName,String indexType,Integer page,Integer pageSize,
|
|
Integer indexTypeMin1,Integer indexTypeMax1,Integer indexTypeMin2,Integer indexTypeMax2)throws Exception{
|
|
|
|
|
|
Integer indexTypeMin1,Integer indexTypeMax1,Integer indexTypeMin2,Integer indexTypeMax2,String doctorName)throws Exception{
|
|
if (page == null){
|
|
if (page == null){
|
|
page = 1;
|
|
page = 1;
|
|
}
|
|
}
|
|
if(pageSize == null){
|
|
if(pageSize == null){
|
|
pageSize = 15;
|
|
pageSize = 15;
|
|
}
|
|
}
|
|
|
|
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);
|
|
Pageable pageRequest = new PageRequest(page-1,pageSize);
|
|
StringBuilder filter = new StringBuilder();
|
|
StringBuilder filter = new StringBuilder();
|
|
|
|
//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(!StringUtils.isEmpty(deviceSn)){
|
|
if(!StringUtils.isEmpty(deviceSn)){
|
|
filter.append("deviceSn="+deviceSn+";");
|
|
filter.append("deviceSn="+deviceSn+";");
|
|
}
|
|
}
|
|
@ -77,6 +106,16 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
|
|
return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
|
|
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(!StringUtils.isEmpty(indexType)){
|
|
if(!StringUtils.isEmpty(indexType)){
|
|
filter.append("type="+indexType+";");
|
|
filter.append("type="+indexType+";");
|
|
}
|
|
}
|