zd_123 преди 7 години
родител
ревизия
03ad2cbad0

+ 237 - 0
common/common-entity/src/main/java/com/yihu/es/entity/HealthEduArticlePatientDTO.java

@ -0,0 +1,237 @@
package com.yihu.es.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * 患者健康教育文章
 *
 * @author George
 */
public class HealthEduArticlePatientDTO {
    private String id;
    // 患者标识
    private String patient;
    // 文章标识
    private String article;
    // 医生标识
    private String doctor;
    // 医生姓名
    private String doctorName;
    // 文章标题
    private String title;
    // 文章链接
    private String url;
    // 文章内容
    private String content;
    // 是否已读:0已读,1未读
    private Integer read;
    // 发布时间
    private Date czrq;
    // 签约类型 1三师 2家庭
    private Integer signType;
    // 行政团队
    private Long adminTeamCode;
    // 简介
    private String summary;
    //附加内容
    private String attachedContent;
    //批次号记录发送所属批次
    private String batchNo;
    //文章标题
    private String attachedTitle;
    //文章封面
    private String attachedPic;
    //推送类型
    private Integer sendType; //1或者为空 i健康后台推送  2PC端推送
    //签约表code
    private String signCode;
    private Integer articleId;
    private String patientName;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getBatchNo() {
        return batchNo;
    }
    public void setBatchNo(String batchNo) {
        this.batchNo = batchNo;
    }
    public String getAttachedContent() {
        return attachedContent;
    }
    public void setAttachedContent(String attachedContent) {
        this.attachedContent = attachedContent;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getArticle() {
        return article;
    }
    public void setArticle(String article) {
        this.article = article;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Transient
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Transient
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Transient
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "is_read")
    public Integer getRead() {
        return read;
    }
    public void setRead(Integer read) {
        this.read = read;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public Integer getSignType() {
        return signType;
    }
    public void setSignType(Integer signType) {
        this.signType = signType;
    }
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    @Transient
    public String getSummary() {
        return summary;
    }
    public void setSummary(String summary) {
        this.summary = summary;
    }
    public String getSignCode() {
        return signCode;
    }
    public void setSignCode(String signCode) {
        this.signCode = signCode;
    }
    @Transient
    public Integer getArticleId() {
        return articleId;
    }
    public void setArticleId(Integer articleId) {
        this.articleId = articleId;
    }
    public String getAttachedTitle() {
        return attachedTitle;
    }
    public void setAttachedTitle(String attachedTitle) {
        this.attachedTitle = attachedTitle;
    }
    public String getAttachedPic() {
        return attachedPic;
    }
    public void setAttachedPic(String attachedPic) {
        this.attachedPic = attachedPic;
    }
    public Integer getSendType() {
        return sendType;
    }
    public void setSendType(Integer sendType) {
        this.sendType = sendType;
    }
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/es/ElasticFactory.java

@ -57,10 +57,10 @@ public class ElasticFactory {
                .Builder(Arrays.asList(hostArray))
                .multiThreaded(true)
                .maxTotalConnection(50)// 最大链接
                .maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
                .connTimeout(60 * 1000)
                .maxConnectionIdleTime(10, TimeUnit.MINUTES)//链接等待时间
                .connTimeout(60 * 1000*10)
                // .discoveryEnabled(true)
                .readTimeout(60 * 1000)//60秒
                .readTimeout(60 * 1000*10)//60秒
                .build();

+ 27 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/service/EduArticleService.java

@ -5,11 +5,13 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.edu.entity.dataClean.*;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.es.entity.HealthEduArticleESResult;
import com.yihu.es.entity.HealthEduArticlePatientDTO;
import com.yihu.wlyy.config.es.ElasticFactory;
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.education.HealthEduArticlePatient;
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.JkeduCategoryDao;
@ -761,7 +763,7 @@ public class EduArticleService {
            for (Map<String, Object> obj : returnList) {
                if (obj.containsKey("_id")) {
                    i++;
                    Delete index = new Delete.Builder(obj.get("id").toString()).build();
                    Delete index = new Delete.Builder(obj.get("_id").toString()).build();
                    bulk.addAction(index);
                }
            }
@ -921,13 +923,13 @@ public class EduArticleService {
            Integer i = 0;
            //先根据条件查找出来
            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);
            //根据id批量删除
            for (Map<String, Object> obj : returnList) {
                if (obj.containsKey("_id")) {
                    i++;
                    Delete index = new Delete.Builder(obj.get("id").toString()).build();
                    Delete index = new Delete.Builder(obj.get("_id").toString()).build();
                    bulk.addAction(index);
                }
            }
@ -980,15 +982,20 @@ public class EduArticleService {
        }
        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.获取医生的推送记录
        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 -> {
            List<HealthEduArticlePatient> healthEduArticlePatientTemp = healthEduArticlePatientMap.get(one.getBatchNo());
            List<HealthEduArticlePatientDTO> healthEduArticlePatientTemp = healthEduArticlePatientMap.get(one.getBatchNo());
            if (healthEduArticlePatientTemp == null) {
                healthEduArticlePatientTemp = new ArrayList<HealthEduArticlePatient>();
                healthEduArticlePatientTemp = new ArrayList<HealthEduArticlePatientDTO>();
            }
            healthEduArticlePatientTemp.add(one);
            healthEduArticlePatientMap.put(one.getBatchNo(), healthEduArticlePatientTemp);
@ -1000,8 +1007,8 @@ public class EduArticleService {
        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 -> {
                //3,1 保存userType=1的
@ -1029,7 +1036,16 @@ public class EduArticleService {
                healthEduArticleES.setBatchNo(healthEduArticlePatient.getBatchNo());
                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());
                healthEduArticleES.setArticleId(healthEduArticle.getCode());