|
@ -42,6 +42,7 @@ import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
import org.springframework.jdbc.core.ResultSetExtractor;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springside.modules.persistence.DynamicSpecifications;
|
|
import org.springside.modules.persistence.DynamicSpecifications;
|
|
@ -1100,4 +1101,39 @@ public class PatientDeviceService extends BaseService {
|
|
}
|
|
}
|
|
return name;
|
|
return name;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据病种类型,搜索已绑定设备的居民设备SN码
|
|
|
|
* @param type 1高血压 2糖尿病
|
|
|
|
*/
|
|
|
|
public com.alibaba.fastjson.JSONObject iotSearchPatientDeviceSN(String type,Integer page,Integer pageSize){
|
|
|
|
|
|
|
|
if(page != 0){
|
|
|
|
page = page - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuffer sql = new StringBuffer("select t.device_sn from");
|
|
|
|
sql.append(" ( SELECT DISTINCT d.* FROM wlyy_patient_device d, wlyy_sign_family f WHERE f.`status` > 0 AND f.patient = d.`user` ) t, ");
|
|
|
|
sql.append(" wlyy_patient p " );
|
|
|
|
sql.append(" LEFT JOIN wlyy_sign_patient_label_info l on p. CODE = l.patient");
|
|
|
|
sql.append(" and l.`status`=1 AND l.label_type = 3 and l.label='"+type+"'");
|
|
|
|
sql.append(" WHERE t.user = p. CODE limit "+page+","+pageSize);
|
|
|
|
List<String> list = jdbcTemplate.queryForList(sql.toString(),String.class);
|
|
|
|
|
|
|
|
Integer count = 0;
|
|
|
|
|
|
|
|
StringBuffer countsql = new StringBuffer("select count(t.device_sn) total from");
|
|
|
|
countsql.append(" ( SELECT DISTINCT d.* FROM wlyy_patient_device d, wlyy_sign_family f WHERE f.`status` > 0 AND f.patient = d.`user` ) t, ");
|
|
|
|
countsql.append(" wlyy_patient p " );
|
|
|
|
countsql.append(" LEFT JOIN wlyy_sign_patient_label_info l on p. CODE = l.patient");
|
|
|
|
countsql.append(" and l.`status`=1 AND l.label_type = 3 and l.label='"+type+"'");
|
|
|
|
countsql.append(" WHERE t.user = p. CODE ");
|
|
|
|
|
|
|
|
count = jdbcTemplate.queryForObject(countsql.toString(),Integer.class);
|
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject();
|
|
|
|
result.put("total",count);
|
|
|
|
result.put("list",list);
|
|
|
|
return result;
|
|
|
|
}
|
|
}
|
|
}
|