|
@ -291,7 +291,7 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询文章下科室
|
|
* 查询文章下科室
|
|
* @param articleId
|
|
* @param articleId
|
|
@ -311,6 +311,45 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询文章下科室
|
|
|
|
* @param articleId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public List<Map<String,Object>> findDeptByArticle2(String articleId)throws Exception{
|
|
|
|
String sql ="SELECT " +
|
|
|
|
" d.article_id AS \"articleId\"," +
|
|
|
|
" d.dept as \"dept\", " +
|
|
|
|
" d.dept_name AS \"deptName\" " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_knowledge_article_dict t " +
|
|
|
|
" JOIN wlyy_knowledge_article_dept d ON t.id = d.article_id " +
|
|
|
|
" WHERE " +
|
|
|
|
" t.id = '"+articleId+"'";
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询部门下的文章
|
|
|
|
* @param dept
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public List<Map<String,Object>> findArticleByDept2(String dept)throws Exception{
|
|
|
|
String sql = "SELECT " +
|
|
|
|
" t.id as \"id\", " +
|
|
|
|
" t.title as \"title\", " +
|
|
|
|
" t.create_time AS \"create_time\" ," +
|
|
|
|
" t.image AS \"image\" " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_knowledge_article_dict t " +
|
|
|
|
" JOIN wlyy_knowledge_article_dept d ON t.id = d.article_id " +
|
|
|
|
" WHERE " +
|
|
|
|
" d.dept = '"+dept+"'";
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询部门下的文章
|
|
* 查询部门下的文章
|
|
* @param dept
|
|
* @param dept
|
|
@ -512,6 +551,78 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
|
|
objEnvelop.setCurrPage(page);
|
|
objEnvelop.setCurrPage(page);
|
|
return objEnvelop;
|
|
return objEnvelop;
|
|
}
|
|
}
|
|
|
|
//根据分类查询文章
|
|
|
|
public MixEnvelop findArticleByCategoryAndName2(String categoryFirst, String categorySecond, String keyWords, Integer page, Integer pageSize){
|
|
|
|
MixEnvelop objEnvelop = new MixEnvelop();
|
|
|
|
String sql = "select t.id as \"id\",t.title as \"title\",t.read_count as \"readCount\"," +
|
|
|
|
"t.collection as \"collection\",t.fabulous as \"fabulous\",t.is_share as \"share\"," +
|
|
|
|
" t.intro as \"intro\",t.category_first_name as \"categoryFirstName\"," +
|
|
|
|
" t.category_second_name as \"categorySecondName\" ," +
|
|
|
|
"t.content as \"content\",t.image as \"image\",t.create_user_name as \"createUserName\",c.job_title_name as \"jobTitleName\"," +
|
|
|
|
"b.dept_name as \"deptName\",b.org_name as \"hospitalName\"," +
|
|
|
|
"t.create_time as \"createTime\" " +
|
|
|
|
" from wlyy_knowledge_article_dict t left join wlyy_knowledge_article_dept a " +
|
|
|
|
" on a.article_id = t.id left join base_doctor_hospital b on b.doctor_code = t.create_user" +
|
|
|
|
" left join base_doctor c on c.id = t.create_user where 1=1 and t.del = 1 and t.status = 1";
|
|
|
|
if (StringUtils.isNotBlank(categoryFirst)){
|
|
|
|
sql+=" and t.category_first = '"+categoryFirst+"'";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(categorySecond)){
|
|
|
|
sql+=" and t.category_second ='"+categorySecond+"'";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(keyWords)){
|
|
|
|
sql+=" and (t.create_user_name like '%"+keyWords+"%' or t.title like '%"+keyWords+"%' or t.content like '%"+keyWords+"%' or a.dept_name like '%"+keyWords+"%' )";
|
|
|
|
}
|
|
|
|
sql+=" group by t.id ,t.title ,t.intro,t.category_first_name ,t.category_second_name ,c.job_title_name," +
|
|
|
|
"t.read_count,t.collection,t.fabulous,t.is_share,t.content ,t.image ,t.create_user_name ,b.dept_name ,b.org_name,t.create_time " +
|
|
|
|
" order by t.create_time desc";
|
|
|
|
List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
|
List<Map<String,Object>> countList = hibenateUtils.createSQLQuery(sql);
|
|
|
|
objEnvelop.setObj(result);
|
|
|
|
objEnvelop.setTotalCount(countList.size());
|
|
|
|
objEnvelop.setPageSize(pageSize);
|
|
|
|
objEnvelop.setCurrPage(page);
|
|
|
|
return objEnvelop;
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询患者收藏的文章列表
|
|
|
|
public JSONObject findPatientFavorite2(String patient,Integer page,Integer pageSize){
|
|
|
|
String sql = "select t.id as \"id\",t.user_code as \"user\",t.user_name as \"userName\"," +
|
|
|
|
"t.relation_code as \"relationCode\"," +
|
|
|
|
"t.relation_type as \"relationType\"," +
|
|
|
|
"t.relation_name as \"relationName\"," +
|
|
|
|
"t.is_read as \"isRead\",t.fabulous as \"fabulous\"," +
|
|
|
|
"t.is_share as \"share\"," +
|
|
|
|
"t.collection as \"collection\",t.used as \"used\",t.del as \"del\"";
|
|
|
|
sql+=" from wlyy_knowledge_article_user t left join wlyy_knowledge_article_dict a" +
|
|
|
|
" on t.relation_code = a.id where 1=1 and a.del=1 and a.collection=1 ";
|
|
|
|
if (StringUtils.isNotEmpty(patient)){
|
|
|
|
sql+=" and t.user_code = '"+patient+"'";
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
|
if(list!=null&&list.size()>0){
|
|
|
|
for (Map<String,Object> map:list){
|
|
|
|
String relationCode = map.get("relationCode").toString();
|
|
|
|
String type = map.get("relationType").toString();
|
|
|
|
if ("1".equalsIgnoreCase(type)){
|
|
|
|
KnowledgeArticleDictDO knowledgeArticleDO = this.selectById(relationCode);
|
|
|
|
if (knowledgeArticleDO!=null){
|
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
|
|
|
|
if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
|
|
|
|
knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
|
|
|
|
knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
map.put("KnowledgeArticleUserDO",knowledgeArticleDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Map<String,Object>> listCount = hibenateUtils.createSQLQuery(sql);
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
result.put("total",listCount.size());
|
|
|
|
result.put("detailModelList",list);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
//查询患者收藏的文章列表
|
|
//查询患者收藏的文章列表
|
|
public JSONObject findPatientFavorite(String patient,Integer page,Integer pageSize){
|
|
public JSONObject findPatientFavorite(String patient,Integer page,Integer pageSize){
|
|
@ -552,5 +663,4 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|