|
@ -1,12 +1,11 @@
|
|
|
package com.yihu.wlyy.service.manager.device;
|
|
|
|
|
|
import com.yihu.wlyy.device.entity.PatientDeviceVO;
|
|
|
import com.yihu.wlyy.device.entity.PatientDeviceExportVO;
|
|
|
import com.yihu.wlyy.device.entity.WlyyPatientDeviceVO;
|
|
|
import com.yihu.wlyy.entity.Patient;
|
|
|
import com.yihu.wlyy.entity.WlyyPatientDevice;
|
|
|
import com.yihu.wlyy.entity.wechat.WechatTotalVO;
|
|
|
import com.yihu.wlyy.repository.PatientDao;
|
|
|
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.query.BaseJpaService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -18,7 +17,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@ -89,8 +87,8 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
|
|
|
* @param hospital
|
|
|
* @return
|
|
|
*/
|
|
|
public List<PatientDeviceVO> exportPatientDeviceList(String town, String hospital) {
|
|
|
List<PatientDeviceVO> list = new ArrayList<>();
|
|
|
public List<PatientDeviceExportVO> exportPatientDeviceList(String town, String hospital) {
|
|
|
List<PatientDeviceExportVO> list = new ArrayList<>();
|
|
|
String sql = "SELECT s.patient," +
|
|
|
"s.`name`," +
|
|
|
"s.mobile," +
|
|
@ -103,7 +101,132 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
|
|
|
"CASE WHEN p.openid IS NULL THEN '未绑定' ELSE '已绑定' END isopenid " +
|
|
|
"FROM wlyy_sign_family s,wlyy_patient_device d,wlyy_patient p " +
|
|
|
"WHERE s.patient=d.`user` AND s.hospital='"+hospital+"' AND s.`status`> 0 AND s.patient=p.CODE ORDER BY patient";
|
|
|
list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientDeviceVO.class));
|
|
|
list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientDeviceExportVO.class));
|
|
|
return list ;
|
|
|
}
|
|
|
|
|
|
/*=
|
|
|
* 根据社区或者医生名称查找居民设备绑定详情
|
|
|
*
|
|
|
* @param deviceName
|
|
|
* @param categoryCode
|
|
|
* @param deviceSn
|
|
|
* @param userName
|
|
|
* @param doctorName
|
|
|
* @param hospital
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public List<WlyyPatientDeviceVO> searchListNew(String deviceName,
|
|
|
String categoryCode,
|
|
|
String deviceSn,
|
|
|
String userName,
|
|
|
String doctorName,
|
|
|
String hospitalName,
|
|
|
String hospitalCode,
|
|
|
Integer page, Integer pageSize) throws Exception{
|
|
|
|
|
|
List<WlyyPatientDeviceVO> list = new ArrayList<>();
|
|
|
String sql = "SELECT s.patient," +
|
|
|
"d.id as id," +
|
|
|
"d.device_id as deviceId," +
|
|
|
"d.user as user," +
|
|
|
"p.name as userName," +
|
|
|
"d.category_code as categoryCode," +
|
|
|
"d.device_name as deviceName," +
|
|
|
"d.device_sn as deviceSn," +
|
|
|
"d.sim as sim," +
|
|
|
"d.user_type as userType," +
|
|
|
"s.mobile," +
|
|
|
"CONCAT(LEFT (s.idcard,6),'**********',RIGHT (s.idcard,2)) userIdcard," +
|
|
|
"s.doctor_name as doctorName," +
|
|
|
"s.doctor as doctor," +
|
|
|
"d.czrq as czrq," +
|
|
|
"s.hospital_name as hospitalName," +
|
|
|
"s.hospital as hospital " +
|
|
|
"FROM " +
|
|
|
"wlyy_sign_family s," +
|
|
|
"wlyy_patient_device d," +
|
|
|
"wlyy_patient p " +
|
|
|
"WHERE s.patient=d.`user` ";
|
|
|
if(StringUtils.isNotBlank(hospitalName)){
|
|
|
sql = sql + "AND s.hospital_name like '%"+hospitalName+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(hospitalCode)){
|
|
|
sql = sql + "AND s.hospital = '"+hospitalCode+"' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(doctorName)){
|
|
|
sql = sql + "AND s.doctor_name like '%"+doctorName+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(userName)){
|
|
|
sql = sql + "AND p.name like '%"+userName+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(deviceSn)){
|
|
|
sql = sql + "AND d.device_sn like '%"+deviceSn+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(categoryCode)){
|
|
|
sql = sql + "AND d.category_code like '%"+categoryCode+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(deviceName)){
|
|
|
sql = sql + "AND d.device_name like '%"+deviceName+"%' ";
|
|
|
}
|
|
|
|
|
|
sql = sql +"AND s.`status`> 0 AND s.patient=p.CODE " +
|
|
|
"ORDER BY czrq DESC ";
|
|
|
|
|
|
sql = sql+" limit " + (page-1)*pageSize+", "+pageSize;
|
|
|
list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(WlyyPatientDeviceVO.class));
|
|
|
return list ;
|
|
|
}
|
|
|
|
|
|
public Long getCountSearchListNew(String deviceName, String categoryCode, String deviceSn, String userName, String doctorName, String hospitalName,String hospitalCode) {
|
|
|
|
|
|
String sql = "SELECT count(d.id)" +
|
|
|
"FROM " +
|
|
|
"wlyy_sign_family s," +
|
|
|
"wlyy_patient_device d," +
|
|
|
"wlyy_patient p " +
|
|
|
"WHERE s.patient=d.`user` ";
|
|
|
if(StringUtils.isNotBlank(hospitalName)){
|
|
|
sql = sql + "AND s.hospital like '%"+hospitalName+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(hospitalCode)){
|
|
|
sql = sql + "AND s.hospital = '"+hospitalCode+"' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(doctorName)){
|
|
|
sql = sql + "AND s.doctor_name like '%"+userName+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(userName)){
|
|
|
sql = sql + "AND p.name like '%"+doctorName+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(deviceSn)){
|
|
|
sql = sql + "AND d.device_sn like '%"+deviceSn+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(categoryCode)){
|
|
|
sql = sql + "AND d.category_code like '%"+categoryCode+"%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(deviceName)){
|
|
|
sql = sql + "AND d.device_name like '%"+deviceName+"%' ";
|
|
|
}
|
|
|
|
|
|
sql = sql +"AND s.`status`> 0 AND s.patient=p.CODE ";
|
|
|
|
|
|
Long total = jdbcTemplate.queryForObject(sql, Long.class);
|
|
|
|
|
|
return total ;
|
|
|
}
|
|
|
}
|