|  | @ -19,7 +19,10 @@ import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.survey.dao.SurveyUserDao;
 |  | import com.yihu.jw.hospital.survey.dao.SurveyUserDao;
 | 
												
													
														
															|  | import com.yihu.jw.im.util.ImUtil;
 |  | import com.yihu.jw.im.util.ImUtil;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.BasePatientBusinessDao;
 |  | import com.yihu.jw.patient.dao.BasePatientBusinessDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
												
													
														
															|  | import com.yihu.jw.utils.EntityUtils;
 |  | import com.yihu.jw.utils.EntityUtils;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
												
													
														
															|  | import com.yihu.mysql.query.BaseJpaService;
 |  | import com.yihu.mysql.query.BaseJpaService;
 | 
												
													
														
															|  | import org.apache.commons.lang.StringUtils;
 |  | import org.apache.commons.lang.StringUtils;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
											
												
													
														
															|  | @ -57,6 +60,8 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
 | 
												
													
														
															|  | 	private SurveyUserDao surveyUserDao;
 |  | 	private SurveyUserDao surveyUserDao;
 | 
												
													
														
															|  | 	@Autowired
 |  | 	@Autowired
 | 
												
													
														
															|  | 	private SurveyTemplateDao surveyTemplateDao;
 |  | 	private SurveyTemplateDao surveyTemplateDao;
 | 
												
													
														
															|  | 
 |  | 	@Autowired
 | 
												
													
														
															|  | 
 |  |     private HibenateUtils hibenateUtils;
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
													
														
															|  | 	/**
 |  | 	/**
 | 
												
													
														
															|  | 	 * 删除,支持批量
 |  | 	 * 删除,支持批量
 | 
												
											
												
													
														
															|  | @ -327,8 +332,29 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
 | 
												
													
														
															|  | 	public KnowledgeArticleDO selectById(String id){
 |  | 	public KnowledgeArticleDO selectById(String id){
 | 
												
													
														
															|  | 		return knowledgeArticleDao.findByIdAndDel(id);
 |  | 		return knowledgeArticleDao.findByIdAndDel(id);
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 	//根据分类查询文章
 | 
												
													
														
															|  | 
 |  | 	public MixEnvelop findArticleByCategoryAndName(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.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);
 | 
												
													
														
															|  | 
 |  |         objEnvelop.setTotalCount(result.size());
 | 
												
													
														
															|  | 
 |  |         objEnvelop.setPageSize(pageSize);
 | 
												
													
														
															|  | 
 |  |         objEnvelop.setCurrPage(page);
 | 
												
													
														
															|  | 
 |  |         return objEnvelop;
 | 
												
													
														
															|  | 
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |