|
@ -305,7 +305,8 @@ public class EduArticleService {
|
|
|
articleMap.put(healthEduArticle.getCode(),healthEduArticle);
|
|
|
}
|
|
|
}
|
|
|
//获取所有的健康教育发送记录数量,分页
|
|
|
String BartchNoSql ="";
|
|
|
//获取所有的健康教育发送记录数量,分页,userType=1
|
|
|
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+"'";
|
|
@ -323,6 +324,7 @@ public class EduArticleService {
|
|
|
" ap.czrq AS createTime, " +
|
|
|
" ap.admin_team_code AS adminTeamCode, " +
|
|
|
" ap.batch_no AS batchNo, " +
|
|
|
" ap.send_type AS sendSource,"+
|
|
|
" p.name AS patientName,"+
|
|
|
" t.name AS adminTeamName"+
|
|
|
" FROM " +
|
|
@ -331,13 +333,13 @@ public class EduArticleService {
|
|
|
" LEFT JOIN wlyy_admin_team t ON ap.admin_team_code = t.id" +
|
|
|
" WHERE " +
|
|
|
" ap.admin_team_code IS NOT NULL ";
|
|
|
BartchNoSql = resultSql;
|
|
|
if (StringUtils.isNotBlank(startTimeForSql)){
|
|
|
resultSql += " AND ap.czrq > '"+startTimeForSql+"'ORDER BY ap.czrq ASC limit ?,?";
|
|
|
}else {
|
|
|
resultSql += " ORDER BY ap.czrq ASC limit ?,?";
|
|
|
}
|
|
|
|
|
|
|
|
|
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});
|
|
@ -350,10 +352,11 @@ public class EduArticleService {
|
|
|
HealthEduArticleES healthEduArticleES = new HealthEduArticleES();
|
|
|
//Map转对象
|
|
|
healthEduArticleES = MapListUtils.convertMap2Bean(map,HealthEduArticleES.class);
|
|
|
healthEduArticleES = setDateToObj(healthEduArticleES,doctorMap,articleMap,wjwCode);
|
|
|
healthEduArticleES = setDateToObj(healthEduArticleES,doctorMap,articleMap,wjwCode,1);
|
|
|
if (StringUtils.isEmpty(healthEduArticleES.getDoctorName())){
|
|
|
healthEduArticleES.setDoctorCode(wjwCode);
|
|
|
//healthEduArticleES.setSendCode(wjwCode);
|
|
|
//卫计委发送
|
|
|
healthEduArticleES.setSendType(2);
|
|
|
healthEduArticleES.setSendName("厦门市卫生与计划生育委员会");
|
|
|
healthEduArticleES.setDoctorName("厦门市卫生与计划生育委员会");
|
|
|
}
|
|
@ -363,6 +366,29 @@ public class EduArticleService {
|
|
|
saveDate(esList);
|
|
|
}
|
|
|
}
|
|
|
//按批次查询文章信息。userType=2
|
|
|
//每次执行前把之前的
|
|
|
BartchNoSql +=" GROUP BY ap.batch_no ORDER BY ap.czrq ASC";
|
|
|
List<Map<String,Object>> batchList = jdbcTemplate.queryForList(BartchNoSql);
|
|
|
List<HealthEduArticleES> batchEsList = new ArrayList<>();
|
|
|
if (batchList!=null && batchList.size()>0){
|
|
|
for (Map<String, Object> map : batchList) {
|
|
|
HealthEduArticleES healthEduArticleES = new HealthEduArticleES();
|
|
|
//Map转对象
|
|
|
healthEduArticleES = MapListUtils.convertMap2Bean(map,HealthEduArticleES.class);
|
|
|
healthEduArticleES = setDateToObj(healthEduArticleES,doctorMap,articleMap,wjwCode,2);
|
|
|
if (StringUtils.isEmpty(healthEduArticleES.getDoctorName())){
|
|
|
healthEduArticleES.setDoctorCode(wjwCode);
|
|
|
//卫计委发送
|
|
|
healthEduArticleES.setSendType(2);
|
|
|
healthEduArticleES.setSendName("厦门市卫生与计划生育委员会");
|
|
|
healthEduArticleES.setDoctorName("厦门市卫生与计划生育委员会");
|
|
|
}
|
|
|
batchEsList.add(healthEduArticleES);
|
|
|
}
|
|
|
//保存到Es中
|
|
|
saveDate(batchEsList);
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
@ -371,7 +397,7 @@ public class EduArticleService {
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
public HealthEduArticleES setDateToObj(HealthEduArticleES healthEduArticleES,Map<String,Doctor> doctorMap,Map<String,HealthEduArticle> articleMap,String wjwCode)throws Exception{
|
|
|
public HealthEduArticleES setDateToObj(HealthEduArticleES healthEduArticleES,Map<String,Doctor> doctorMap,Map<String,HealthEduArticle> articleMap,String wjwCode,int userType)throws Exception{
|
|
|
//遍历医生
|
|
|
Set<Map.Entry<String,Doctor>> doctorSet=doctorMap.entrySet();
|
|
|
for(Map.Entry<String, Doctor> doctorEntry:doctorSet){
|
|
@ -380,6 +406,8 @@ public class EduArticleService {
|
|
|
healthEduArticleES.setDoctorCode(doctor.getCode());
|
|
|
healthEduArticleES.setDoctorName(doctor.getName());
|
|
|
//healthEduArticleES.setSendCode(doctor.getCode());
|
|
|
//医生发送
|
|
|
healthEduArticleES.setSendType(1);
|
|
|
healthEduArticleES.setSendName(doctor.getCode());
|
|
|
healthEduArticleES.setSendPic(doctor.getPhoto());
|
|
|
healthEduArticleES.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : "");
|
|
@ -401,8 +429,7 @@ public class EduArticleService {
|
|
|
healthEduArticleES.setArticleContent(healthEduArticle.getSummary());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
healthEduArticleES.setSendType(2);
|
|
|
healthEduArticleES.setUserType(userType);
|
|
|
healthEduArticleES.setOperatorId(wjwCode);
|
|
|
healthEduArticleES.setArticleSource("厦门市卫生与计划生育委员会");
|
|
|
return healthEduArticleES;
|