| 
					
				 | 
			
			
				@ -2,21 +2,32 @@ package com.yihu.wlyy.web.third.jkedu.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.edu.entity.dataClean.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.es.entity.HealthEduArticlePatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.es.entity.HealthEduArticleES; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.es.entity.HealthEduArticleESResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.config.es.ElastricSearchSave; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.doctor.profile.Doctor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.education.HealthEduArticle; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.patient.Patient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.jkedu.repository.JkeduArticleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.jkedu.repository.JkeduBehaviorArticleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.jkedu.repository.JkeduCollectionArticleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.doctor.DoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.education.HealthEduArticleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.patient.PatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.ElasticsearchUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.MapListUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.SpringUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.web.third.jkedu.vo.save.SaveEduArticleHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.axis.utils.Admin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.BeanUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.hateoas.alps.Doc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -35,7 +46,9 @@ public class EduArticleService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorDao doctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ElastricSearchSave elastricSearchSave; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientDao patientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorAdminTeamDao doctorAdminTeamDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HealthEduArticleDao healthEduArticleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -44,6 +57,8 @@ public class EduArticleService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private JkeduCollectionArticleDao jkeduCollectionArticleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private JkeduBehaviorArticleDao jkeduBehaviorArticleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ElasticsearchUtil elasticsearchUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${es.type.HealthEduArticlePatient}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String esType; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -270,27 +285,84 @@ public class EduArticleService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "select code AS wjwCode from wlyy_role WHERE  name LIKE '%厦门市卫生与计划生育委员会%' and LENGTH(code)=6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> result = jdbcTemplate.queryForMap(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String wjwCode = result.get("wjwCode") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //转移到数据库的时候按照批次来聚合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "SELECT batch_no ,article,doctor,doctor_name,admin_team_code,czrq " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " FROM wlyy_health_edu_article_patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE  batch_no IS NOT NULL GROUP BY batch_no"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (CollectionUtils.isEmpty(resultList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询es最大的时间记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String timeSql ="select createTime from "+esType+" order by createTime desc limit 0,1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HealthEduArticleESResult healthEduArticleESResult = (HealthEduArticleESResult)elasticsearchUtil.excuteOneObject(timeSql,HealthEduArticleESResult.class,esType,esIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String startTimeForSql = DateUtil.dateToStr(healthEduArticleESResult.getCreateTime(),"yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询出所有的医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Doctor> doctorList = doctorDao.findAllCertifiedDoctors(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Doctor> doctorMap = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (doctorList!=null && doctorList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Doctor doctor: doctorList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    doctorMap.put(doctor.getCode(),doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询出所有的文章列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<HealthEduArticle> healthEduArticleList = healthEduArticleDao.findAllArticle(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,HealthEduArticle> articleMap = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (healthEduArticleList!=null && healthEduArticleList.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (HealthEduArticle healthEduArticle: healthEduArticleList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    articleMap.put(healthEduArticle.getCode(),healthEduArticle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //获取所有的健康教育发送记录数量,分页 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String countSql = "SELECT COUNT(id) AS num from wlyy_health_edu_article_patient WHERE admin_team_code IS NOT NULL"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(startTimeForSql)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                countSql += " AND czrq > '"+startTimeForSql+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> countMap = jdbcTemplate.queryForMap(countSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (countMap!=null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                int count = Integer.valueOf(String.valueOf(countMap.get("num"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                double pageCount = Math.ceil(Double.valueOf(count) / Double.valueOf(pageSize*20)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (pageCount > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String resultSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.patient AS patientCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.article AS articleId, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.doctor AS doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.is_read AS isRead, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.czrq AS createTime, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.admin_team_code AS adminTeamCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.batch_no AS batchNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " p.name AS patientName,"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " t.name AS adminTeamName"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " wlyy_health_edu_article_patient ap " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " LEFT JOIN wlyy_patient p ON ap.patient = p.code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " LEFT JOIN wlyy_admin_team t ON ap.admin_team_code = t.id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " ap.admin_team_code IS NOT NULL "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (StringUtils.isNotBlank(startTimeForSql)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        resultSql += " AND ap.czrq > '"+startTimeForSql+"'ORDER BY ap.czrq ASC limit ?,?"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        resultSql += " ORDER BY ap.czrq ASC limit ?,?"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> map: resultList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<Map<String,Object>> articleList = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String batchNo = map.get("batch_no")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String article = map.get("article")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String doctorCode = map.get("doctor")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String adminTeamId = map.get("admin_team_code")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String  czrq =  map.get("czrq")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //同一个批次号只会有一篇文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String batchSql = "select * from wlyy_health_edu_article_patient where batch_no = '"+batchNo+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthEduArticlePatient healthEduArticlePatient = setDateToObj(batchSql,doctorCode,adminTeamId,wjwCode,batchNo,article,czrq); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //保存到Es中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                elastricSearchSave.save(healthEduArticlePatient, esIndex, esType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    for (int i = 1; i <= pageCount; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        int start = (i - 1) * (pageSize*20); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(resultSql,new Object[]{start,pageSize*20}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (CollectionUtils.isEmpty(resultList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            flag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            return flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        List<HealthEduArticleES> esList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        for (Map<String, Object> map : resultList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            HealthEduArticleES healthEduArticleES = new HealthEduArticleES(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            //Map转对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            healthEduArticleES = MapListUtils.convertMap2Bean(map,HealthEduArticleES.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            healthEduArticleES = setDateToObj(healthEduArticleES,doctorMap,articleMap,wjwCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if (StringUtils.isEmpty(healthEduArticleES.getDoctorName())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                healthEduArticleES.setDoctorCode(wjwCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                healthEduArticleES.setSendCode(wjwCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                healthEduArticleES.setSendName("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                healthEduArticleES.setDoctorName("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            esList.add(healthEduArticleES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //保存到Es中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        saveDate(esList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -299,56 +371,109 @@ public class EduArticleService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return flag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public HealthEduArticlePatient setDateToObj(String batchSql,String doctorCode,String adminTeamId,String wjwCode,String batchNo,String article,String czrq)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //创建对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> articleList= jdbcTemplate.queryForList(batchSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //放置患者集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!CollectionUtils.isEmpty(articleList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Patient> patientList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String,Object> sendMap: articleList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientList.add(new Patient(sendMap.get("patient")+"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public HealthEduArticleES setDateToObj(HealthEduArticleES healthEduArticleES,Map<String,Doctor> doctorMap,Map<String,HealthEduArticle> articleMap,String wjwCode)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //遍历医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Set<Map.Entry<String,Doctor>> doctorSet=doctorMap.entrySet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map.Entry<String, Doctor> doctorEntry:doctorSet){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (doctorEntry.getKey().equals(healthEduArticleES.getDoctorCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Doctor doctor = doctorEntry.getValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setDoctorCode(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setDoctorName(doctor.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setSendCode(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setSendName(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setSendPic(doctor.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setHospital(doctor.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setHospitalName(doctor.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setTown(doctor.getTown()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setTownName(doctor.getTownName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setSendType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setSendLevel(doctor.getLevel() != null ? String.valueOf(doctor.getLevel()) : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //遍历文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Set<Map.Entry<String,HealthEduArticle>> articleSet=articleMap.entrySet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map.Entry<String, HealthEduArticle> articleEntry:articleSet){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (articleEntry.getKey().equals(healthEduArticleES.getArticleId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                HealthEduArticle healthEduArticle = articleEntry.getValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setArticleId(healthEduArticle.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setArticleTitle(healthEduArticle.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                healthEduArticleES.setArticleContent(healthEduArticle.getSummary()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setPatients(patientList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setSendType(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setOperatorId(wjwCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setArticleSource("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  healthEduArticleES; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public HealthEduArticleES setDateToObj1(Map<String,Object> map, String wjwCode)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthEduArticleES healthEduArticleES = new HealthEduArticleES(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String article = map.get("article")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctorCode = map.get("doctor")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String adminTeamId = map.get("admin_team_code")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String  czrq =  map.get("czrq")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patient = map.get("patient")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //数据放入对象中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (map.get("batch_no")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setBatchNo(map.get("batch_no")+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setPatientCode(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Patient patientObj = patientDao.findByCode(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientObj!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setPatientName(patientObj.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Doctor doctor = doctorDao.findByCode(doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setAdminTeamCode(Long.valueOf(adminTeamId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doctor!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setDoctorCode(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setSendName(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setDoctorName(doctor.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setSendType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setHospital(doctor.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setHospitalName(doctor.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setTown(doctor.getTown()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setTownName(doctor.getTownName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setSendLevel(doctor.getLevel() != null ? String.valueOf(doctor.getLevel()) : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setSendPic(doctor.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setDoctorCode(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setDoctorName(doctor.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendCode(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendName(doctor.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendPic(doctor.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setHospital(doctor.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setHospitalName(doctor.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setTown(doctor.getTown()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setTownName(doctor.getTownName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendLevel(doctor.getLevel() != null ? String.valueOf(doctor.getLevel()) : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setDoctorCode(wjwCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setSendName("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setDoctorName("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticlePatient.setSendType(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setDoctorCode(wjwCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendName("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setDoctorName("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendType(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setBatchNo(batchNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date czrqDate = DateUtil.strToDate(czrq); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setCreateTime(czrqDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setAdminTeamCode(Long.valueOf(adminTeamId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        AdminTeam adminTeam = doctorAdminTeamDao.findOne(Long.valueOf(adminTeamId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (adminTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setAdminTeamName(adminTeam.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date czrqDate = DateUtil.strToDate(czrq.substring(0,czrq.lastIndexOf("."))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setCreateTime(czrqDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取文章详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HealthEduArticle healthEduArticle = healthEduArticleDao.findByCode(article); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setArticleId(healthEduArticle.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setAttachedTitle(healthEduArticle.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setAttachedContent(healthEduArticle.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setArticleType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setLevel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticlePatient.setType("1");//文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //healthEduArticlePatient.setAttachedPic(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //healthEduArticlePatient.setAttachedMessage(sendMessage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //healthEduArticlePatient.setLevel1Type(article.get("firstLevelCategoryId") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //healthEduArticlePatient.setLevel2Type(article.get("secondLevelCategoryId") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  healthEduArticlePatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setArticleId(healthEduArticle.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setArticleTitle(healthEduArticle.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setArticleContent(healthEduArticle.getSummary()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //healthEduArticleES.setArticleContent("abc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setOperatorId(wjwCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setIsRead(Integer.valueOf(map.get("is_read")+"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        healthEduArticleES.setArticleSource("厦门市卫生与计划生育委员会"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (map.get("send_type")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthEduArticleES.setSendSource(Integer.valueOf(map.get("send_type")+"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  healthEduArticleES; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 保存数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private Boolean saveDate(List<HealthEduArticleES> sms)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return SpringUtil.getBean(SaveEduArticleHelper.class).save(sms); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void save(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        NewArticleModel newArticleModel = new NewArticleModel(); 
			 |