| 
					
				 | 
			
			
				@ -19,7 +19,9 @@ import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.survey.dao.SurveyUserDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.im.util.ImUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientBusinessDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ObjEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.EntityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.hibernate.HibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -57,6 +59,8 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private SurveyUserDao surveyUserDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private SurveyTemplateDao surveyTemplateDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HibenateUtils hibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 删除,支持批量 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -327,8 +331,26 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public KnowledgeArticleDO selectById(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return knowledgeArticleDao.findByIdAndDel(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					//根据分类查询文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public ObjEnvelop findArticleByCategoryAndName(String categoryFirst,String categorySecond, String keyWords,Integer page,Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						ObjEnvelop objEnvelop = new ObjEnvelop(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						String sql = "select t.id as \"id\",t.title as \"title\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 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\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "b.job_title_name as \"jobTitleName\",b.visit_hospital_name as \"visitHospitalName\" from wlyy_knowledge_article t left join wlyy_knowledge_article_dept a " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " on a.article_id = t.id left join base_doctor b on b.id = t.create_user where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if (StringUtils.isNotBlank(categoryFirst)&&StringUtils.isNotBlank(categorySecond)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						    sql+=" and t.category_first = '"+categoryFirst+"' 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 ,t.content ,t.image ,t.create_user_name ,b.job_title_name ,b.visit_hospital_name"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        objEnvelop.setObj(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return objEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |