|
@ -5,11 +5,13 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.yihu.edu.entity.dataClean.*;
|
|
import com.yihu.edu.entity.dataClean.*;
|
|
import com.yihu.es.entity.HealthEduArticleES;
|
|
import com.yihu.es.entity.HealthEduArticleES;
|
|
import com.yihu.es.entity.HealthEduArticleESResult;
|
|
import com.yihu.es.entity.HealthEduArticleESResult;
|
|
|
|
import com.yihu.es.entity.HealthEduArticlePatientDTO;
|
|
import com.yihu.wlyy.config.es.ElasticFactory;
|
|
import com.yihu.wlyy.config.es.ElasticFactory;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
|
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.jkedu.repository.JkeduArticleDao;
|
|
import com.yihu.wlyy.jkedu.repository.JkeduArticleDao;
|
|
import com.yihu.wlyy.jkedu.repository.JkeduBehaviorArticleDao;
|
|
import com.yihu.wlyy.jkedu.repository.JkeduBehaviorArticleDao;
|
|
import com.yihu.wlyy.jkedu.repository.JkeduCategoryDao;
|
|
import com.yihu.wlyy.jkedu.repository.JkeduCategoryDao;
|
|
@ -624,7 +626,7 @@ public class EduArticleService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 保存数据
|
|
|
|
|
|
* 保存数据.
|
|
*
|
|
*
|
|
* @param
|
|
* @param
|
|
*/
|
|
*/
|
|
@ -761,7 +763,7 @@ public class EduArticleService {
|
|
for (Map<String, Object> obj : returnList) {
|
|
for (Map<String, Object> obj : returnList) {
|
|
if (obj.containsKey("_id")) {
|
|
if (obj.containsKey("_id")) {
|
|
i++;
|
|
i++;
|
|
Delete index = new Delete.Builder(obj.get("id").toString()).build();
|
|
|
|
|
|
Delete index = new Delete.Builder(obj.get("_id").toString()).build();
|
|
bulk.addAction(index);
|
|
bulk.addAction(index);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -921,13 +923,13 @@ public class EduArticleService {
|
|
Integer i = 0;
|
|
Integer i = 0;
|
|
//先根据条件查找出来
|
|
//先根据条件查找出来
|
|
Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
|
|
Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
|
|
String sql = "select id from " + esIndex + " where doctorCode='" + doctorCode + "'";
|
|
|
|
|
|
String sql = "select id from " + esIndex + " where doctorCode='" + doctorCode + "' limit 0,50000";
|
|
List<Map<String, Object>> returnList = elasticsearchUtil.excuteDataModel(sql);
|
|
List<Map<String, Object>> returnList = elasticsearchUtil.excuteDataModel(sql);
|
|
//根据id批量删除
|
|
//根据id批量删除
|
|
for (Map<String, Object> obj : returnList) {
|
|
for (Map<String, Object> obj : returnList) {
|
|
if (obj.containsKey("_id")) {
|
|
if (obj.containsKey("_id")) {
|
|
i++;
|
|
i++;
|
|
Delete index = new Delete.Builder(obj.get("id").toString()).build();
|
|
|
|
|
|
Delete index = new Delete.Builder(obj.get("_id").toString()).build();
|
|
bulk.addAction(index);
|
|
bulk.addAction(index);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -980,15 +982,20 @@ public class EduArticleService {
|
|
}
|
|
}
|
|
final String firstId = firstIdStr;
|
|
final String firstId = firstIdStr;
|
|
|
|
|
|
|
|
//查询所有患者list
|
|
|
|
String patientSql = "SELECT code,name FROM wlyy_patient WHERE status=1";
|
|
|
|
List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
|
|
|
|
|
|
//4.获取医生的推送记录
|
|
//4.获取医生的推送记录
|
|
String sql = "select * from wlyy_health_edu_article_patient_copy where admin_team_code IS NOT NULL AND batch_no IS NOT NULL AND doctor='" + doctorCode + "'";
|
|
|
|
List<HealthEduArticlePatient> healthEduArticlePatients = jdbcTemplate.query(sql, new BeanPropertyRowMapper(HealthEduArticlePatient.class));
|
|
|
|
|
|
//String sql = "select * from wlyy_health_edu_article_patient_copy where admin_team_code IS NOT NULL AND batch_no IS NOT NULL AND doctor='" + doctorCode + "'";
|
|
|
|
String sql = "select ap.*,p.name AS patienName from wlyy_health_edu_article_patient_copy ap LEFT JOIN wlyy_patient p ON ap.patient = p.code where ap.admin_team_code IS NOT NULL AND ap.batch_no IS NOT NULL AND ap.doctor='"+doctorCode+"'";
|
|
|
|
List<HealthEduArticlePatientDTO> healthEduArticlePatients = jdbcTemplate.query(sql, new BeanPropertyRowMapper(HealthEduArticlePatientDTO.class));
|
|
//推送记录按照批次号分组
|
|
//推送记录按照批次号分组
|
|
Map<String, List<HealthEduArticlePatient>> healthEduArticlePatientMap = new HashMap<>();
|
|
|
|
|
|
Map<String, List<HealthEduArticlePatientDTO>> healthEduArticlePatientMap = new HashMap<>();
|
|
healthEduArticlePatients.stream().forEach(one -> {
|
|
healthEduArticlePatients.stream().forEach(one -> {
|
|
List<HealthEduArticlePatient> healthEduArticlePatientTemp = healthEduArticlePatientMap.get(one.getBatchNo());
|
|
|
|
|
|
List<HealthEduArticlePatientDTO> healthEduArticlePatientTemp = healthEduArticlePatientMap.get(one.getBatchNo());
|
|
if (healthEduArticlePatientTemp == null) {
|
|
if (healthEduArticlePatientTemp == null) {
|
|
healthEduArticlePatientTemp = new ArrayList<HealthEduArticlePatient>();
|
|
|
|
|
|
healthEduArticlePatientTemp = new ArrayList<HealthEduArticlePatientDTO>();
|
|
}
|
|
}
|
|
healthEduArticlePatientTemp.add(one);
|
|
healthEduArticlePatientTemp.add(one);
|
|
healthEduArticlePatientMap.put(one.getBatchNo(), healthEduArticlePatientTemp);
|
|
healthEduArticlePatientMap.put(one.getBatchNo(), healthEduArticlePatientTemp);
|
|
@ -1000,8 +1007,8 @@ public class EduArticleService {
|
|
|
|
|
|
healthEduArticlePatientMap.keySet().stream().forEach(one -> {
|
|
healthEduArticlePatientMap.keySet().stream().forEach(one -> {
|
|
//获取患者数据
|
|
//获取患者数据
|
|
List<HealthEduArticlePatient> healthEduArticlePatientTemps = healthEduArticlePatientMap.get(one);
|
|
|
|
AdminTeam adminTeam = doctorAdminTeamDao.findOne(healthEduArticlePatientTemps.get(0).getId());
|
|
|
|
|
|
List<HealthEduArticlePatientDTO> healthEduArticlePatientTemps = healthEduArticlePatientMap.get(one);
|
|
|
|
AdminTeam adminTeam = doctorAdminTeamDao.findOne(healthEduArticlePatientTemps.get(0).getAdminTeamCode());
|
|
//遍历数据
|
|
//遍历数据
|
|
healthEduArticlePatientTemps.stream().forEach(healthEduArticlePatient -> {
|
|
healthEduArticlePatientTemps.stream().forEach(healthEduArticlePatient -> {
|
|
//3,1 保存userType=1的
|
|
//3,1 保存userType=1的
|
|
@ -1029,7 +1036,16 @@ public class EduArticleService {
|
|
|
|
|
|
healthEduArticleES.setBatchNo(healthEduArticlePatient.getBatchNo());
|
|
healthEduArticleES.setBatchNo(healthEduArticlePatient.getBatchNo());
|
|
healthEduArticleES.setPatientCode(healthEduArticlePatient.getPatient());
|
|
healthEduArticleES.setPatientCode(healthEduArticlePatient.getPatient());
|
|
healthEduArticleES.setPatientName(patientDao.findByCode(healthEduArticlePatient.getPatient()).getName());
|
|
|
|
|
|
healthEduArticleES.setPatientName(healthEduArticlePatient.getPatientName());
|
|
|
|
/*for (Map<String,Object> map1 : patientList){
|
|
|
|
if (map1.containsKey("code") && String.valueOf(map1.get("code")).equals(healthEduArticlePatient.getPatient())){
|
|
|
|
healthEduArticleES.setPatientName(String.valueOf(map1.get("name")));
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
/*Patient patient = patientDao.findByCode(healthEduArticlePatient.getPatient());
|
|
|
|
if (patient!=null){
|
|
|
|
healthEduArticleES.setPatientName(patient.getName());
|
|
|
|
}*/
|
|
|
|
|
|
HealthEduArticle healthEduArticle = articleMap.get(healthEduArticlePatient.getArticle());
|
|
HealthEduArticle healthEduArticle = articleMap.get(healthEduArticlePatient.getArticle());
|
|
healthEduArticleES.setArticleId(healthEduArticle.getCode());
|
|
healthEduArticleES.setArticleId(healthEduArticle.getCode());
|