|
@ -16,8 +16,8 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@ -60,38 +60,28 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
|
|
@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
|
|
@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
|
|
@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
|
|
@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
|
|
@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
|
|
@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
|
|
|
|
|
|
try {
|
|
try {
|
|
String sql = "select * ";
|
|
|
|
String countSql = "select count(*) ";
|
|
|
|
String filter = " from wlyy_knowledge_article_dict where type=2 and del=1 ";
|
|
|
|
|
|
|
|
String userId=getUID();
|
|
String userId=getUID();
|
|
BaseDoctorRoleDO roleDO = doctorRoleDao.findByDoctorCodeAndRoleCode(userId, CommonContant.DR_ARTICLEREVIEWER);
|
|
BaseDoctorRoleDO roleDO = doctorRoleDao.findByDoctorCodeAndRoleCode(userId, CommonContant.DR_ARTICLEREVIEWER);
|
|
boolean queryAll=false;
|
|
boolean queryAll=false;
|
|
if (roleDO!=null){
|
|
if (roleDO!=null){
|
|
queryAll=true;
|
|
queryAll=true;
|
|
}
|
|
}
|
|
if (!queryAll){
|
|
|
|
filter += " and create_user='"+userId+"'";
|
|
|
|
}
|
|
|
|
//title?1111;categoryFirst=402803e879a2699d0179a27f3fa10001;categorySecond=402803e879a2699d0179a28c64d50007
|
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(filters)){
|
|
|
|
String fil[] = fields.split(";");
|
|
|
|
for (String fi:fil){
|
|
|
|
if(fi.contains("title?")){
|
|
|
|
filter += " and title like '%"+fi.split("\\?")[1]+"%'";
|
|
|
|
}
|
|
|
|
if(fi.contains("categoryFirst=")){
|
|
|
|
filter += " and category_first='"+fi.split("=")[1]+"'";
|
|
|
|
}
|
|
|
|
if(fi.contains("categorySecond=")){
|
|
|
|
filter += " and category_second='"+fi.split("=")[1]+"'";
|
|
|
|
}
|
|
|
|
|
|
if (queryAll){
|
|
|
|
if(StringUtils.isBlank(filters)){
|
|
|
|
filters=filters+"del=1";
|
|
|
|
}else{
|
|
|
|
filters=filters+";del=1";
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
if(StringUtils.isBlank(filters)){
|
|
|
|
filters=filters+"del=1"+";createUser="+userId+"";
|
|
|
|
}else{
|
|
|
|
filters=filters+";del=1"+";createUser="+userId+"";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
String orderBy = " order by create_time desc limit "+(page-1)*pageSize+","+pageSize;
|
|
|
|
List<KnowledgeArticleDictDO> list = jdbcTemplate.query(sql+filter+orderBy,new BeanPropertyRowMapper<>(KnowledgeArticleDictDO.class));
|
|
|
|
|
|
filters += ";type=2";
|
|
|
|
List<KnowledgeArticleDictDO> list = knowledgeArticleDictService.search(fields,filters,sorts,page,pageSize);
|
|
for (KnowledgeArticleDictDO articleDictDO:list){
|
|
for (KnowledgeArticleDictDO articleDictDO:list){
|
|
JSONObject object = menuManageService.findArticleStaticsByArticleId(articleDictDO.getId());
|
|
JSONObject object = menuManageService.findArticleStaticsByArticleId(articleDictDO.getId());
|
|
if (object!=null){
|
|
if (object!=null){
|
|
@ -100,10 +90,10 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
|
|
articleDictDO.setFabulous(Integer.parseInt(object.getString("eulogyTotal")));
|
|
articleDictDO.setFabulous(Integer.parseInt(object.getString("eulogyTotal")));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
long total = jdbcTemplate.queryForObject(countSql+filter,Long.class);
|
|
|
|
|
|
List<KnowledgeArticleDictDO> totals = knowledgeArticleDictService.search(fields,filters,sorts);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
result.put("total",total);
|
|
|
|
|
|
result.put("total",totals.size());
|
|
result.put("detailModelList",list);
|
|
result.put("detailModelList",list);
|
|
|
|
|
|
return success(result);
|
|
return success(result);
|
|
@ -234,29 +224,16 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
|
|
@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
|
|
@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
|
|
|
|
|
|
try {
|
|
try {
|
|
String sql = "select * ";
|
|
|
|
String countSql = "select count(*) ";
|
|
|
|
String filter = " from wlyy_knowledge_article_dict where type=2 and del=1 and status=1 ";
|
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(filters)){
|
|
|
|
String fil[] = fields.split(";");
|
|
|
|
for (String fi:fil){
|
|
|
|
if(fi.contains("title?")){
|
|
|
|
filter += " and title like '%"+fi.split("\\?")[1]+"%'";
|
|
|
|
}
|
|
|
|
if(fi.contains("categoryFirst=")){
|
|
|
|
filter += " and category_first='"+fi.split("=")[1]+"'";
|
|
|
|
}
|
|
|
|
if(fi.contains("categorySecond=")){
|
|
|
|
filter += " and category_second='"+fi.split("=")[1]+"'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isBlank(filters)){
|
|
|
|
filters=filters+"del=1;type=2;status=1";
|
|
|
|
}else{
|
|
|
|
filters=filters+";del=1;type=2;status=1";
|
|
}
|
|
}
|
|
String orderBy = " order by create_time desc limit "+(page-1)*pageSize+","+pageSize;
|
|
|
|
List<KnowledgeArticleDictDO> list = jdbcTemplate.query(sql+filter+orderBy,new BeanPropertyRowMapper<>(KnowledgeArticleDictDO.class));
|
|
|
|
long total = jdbcTemplate.queryForObject(countSql+filter,Long.class);
|
|
|
|
|
|
List<KnowledgeArticleDictDO> list = knowledgeArticleDictService.search(fields,filters,sorts,page,pageSize);
|
|
|
|
List<KnowledgeArticleDictDO> totals = knowledgeArticleDictService.search(fields,filters,sorts);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
result.put("total",total);
|
|
|
|
|
|
result.put("total",totals.size());
|
|
result.put("detailModelList",list);
|
|
result.put("detailModelList",list);
|
|
|
|
|
|
return success(result);
|
|
return success(result);
|