Commit 3f18a1f373ad33a4f47bea516a161b9f4db9bfb5

Authored by shiyang
1 parent 98efd46cb1
Exists in master

推送文章新逻辑

Showing 7 changed files with 376 additions and 23 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/PatientInfo.java View file @ 3f18a1f
... ... @@ -68,7 +68,7 @@
68 68 private Integer createdby;
69 69  
70 70 /**
71   - *
  71 + * 病例id
72 72 */
73 73 @TableField(value = "cid")
74 74 private Integer cid;
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/PushArticle.java View file @ 3f18a1f
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import java.io.Serializable;
  8 +import java.util.Date;
  9 +import lombok.Data;
  10 +
  11 +/**
  12 + * 推送文章视图
  13 + * @TableName push_article
  14 + */
  15 +@TableName(value ="push_article")
  16 +@Data
  17 +public class PushArticle implements Serializable {
  18 + /**
  19 + * 患者id
  20 + */
  21 + @TableField(value = "id")
  22 + private Integer id;
  23 +
  24 + /**
  25 + * 患者姓名
  26 + */
  27 + @TableField(value = "pname")
  28 + private String pname;
  29 +
  30 + /**
  31 + * 身份证号
  32 + */
  33 + @TableField(value = "idno")
  34 + private String idno;
  35 +
  36 + /**
  37 + * 登录密码
  38 + */
  39 + @TableField(value = "ppasswd")
  40 + private String ppasswd;
  41 +
  42 + /**
  43 + * 性别
  44 + */
  45 + @TableField(value = "sex")
  46 + private Integer sex;
  47 +
  48 + /**
  49 + * 问诊卡数量
  50 + */
  51 + @TableField(value = "ccnt")
  52 + private Integer ccnt;
  53 +
  54 + /**
  55 + * 环信对应标识
  56 + */
  57 + @TableField(value = "hxid")
  58 + private String hxid;
  59 +
  60 + /**
  61 + * 出生日期
  62 + */
  63 + @TableField(value = "birth")
  64 + private String birth;
  65 +
  66 + /**
  67 + * 创建人
  68 + */
  69 + @TableField(value = "createdby")
  70 + private Integer createdby;
  71 +
  72 + /**
  73 + * 患者头像
  74 + */
  75 + @TableField(value = "headimg")
  76 + private String headimg;
  77 +
  78 + /**
  79 + * 病例id
  80 + */
  81 + @TableField(value = "cid")
  82 + private Integer cid;
  83 +
  84 + /**
  85 + * 手机号
  86 + */
  87 + @TableField(value = "mobile")
  88 + private String mobile;
  89 +
  90 + /**
  91 + * 填写医院id
  92 + */
  93 + @TableField(value = "hid")
  94 + private Integer hid;
  95 +
  96 + /**
  97 + * 就诊医院名称
  98 + */
  99 + @TableField(value = "hname")
  100 + private String hname;
  101 +
  102 + /**
  103 + * 填写科室id
  104 + */
  105 + @TableField(value = "did")
  106 + private Integer did;
  107 +
  108 + /**
  109 + * 科室名称
  110 + */
  111 + @TableField(value = "dname")
  112 + private String dname;
  113 +
  114 + /**
  115 + * 就诊医生id
  116 + */
  117 + @TableField(value = "dtid")
  118 + private Integer dtid;
  119 +
  120 + /**
  121 + * 就诊医生姓名
  122 + */
  123 + @TableField(value = "dtname")
  124 + private String dtname;
  125 +
  126 + /**
  127 + * 病例创建时间
  128 + */
  129 + @TableField(value = "createdtime")
  130 + private Date createdtime;
  131 +
  132 + /**
  133 + * 疾病ID
  134 + */
  135 + @TableField(value = "iid")
  136 + private Integer iid;
  137 +
  138 + /**
  139 + * 疾病名称
  140 + */
  141 + @TableField(value = "iname")
  142 + private String iname;
  143 +
  144 + /**
  145 + * 疾病行ID
  146 + */
  147 + @TableField(value = "ilid")
  148 + private Integer ilid;
  149 +
  150 + /**
  151 + * 文章id
  152 + */
  153 + @TableField(value = "aid")
  154 + private Integer aid;
  155 +
  156 + @TableField(exist = false)
  157 + private static final long serialVersionUID = 1L;
  158 +
  159 + @Override
  160 + public boolean equals(Object that) {
  161 + if (this == that) {
  162 + return true;
  163 + }
  164 + if (that == null) {
  165 + return false;
  166 + }
  167 + if (getClass() != that.getClass()) {
  168 + return false;
  169 + }
  170 + PushArticle other = (PushArticle) that;
  171 + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
  172 + && (this.getPname() == null ? other.getPname() == null : this.getPname().equals(other.getPname()))
  173 + && (this.getIdno() == null ? other.getIdno() == null : this.getIdno().equals(other.getIdno()))
  174 + && (this.getPpasswd() == null ? other.getPpasswd() == null : this.getPpasswd().equals(other.getPpasswd()))
  175 + && (this.getSex() == null ? other.getSex() == null : this.getSex().equals(other.getSex()))
  176 + && (this.getCcnt() == null ? other.getCcnt() == null : this.getCcnt().equals(other.getCcnt()))
  177 + && (this.getHxid() == null ? other.getHxid() == null : this.getHxid().equals(other.getHxid()))
  178 + && (this.getBirth() == null ? other.getBirth() == null : this.getBirth().equals(other.getBirth()))
  179 + && (this.getCreatedby() == null ? other.getCreatedby() == null : this.getCreatedby().equals(other.getCreatedby()))
  180 + && (this.getHeadimg() == null ? other.getHeadimg() == null : this.getHeadimg().equals(other.getHeadimg()))
  181 + && (this.getCid() == null ? other.getCid() == null : this.getCid().equals(other.getCid()))
  182 + && (this.getMobile() == null ? other.getMobile() == null : this.getMobile().equals(other.getMobile()))
  183 + && (this.getHid() == null ? other.getHid() == null : this.getHid().equals(other.getHid()))
  184 + && (this.getHname() == null ? other.getHname() == null : this.getHname().equals(other.getHname()))
  185 + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid()))
  186 + && (this.getDname() == null ? other.getDname() == null : this.getDname().equals(other.getDname()))
  187 + && (this.getDtid() == null ? other.getDtid() == null : this.getDtid().equals(other.getDtid()))
  188 + && (this.getDtname() == null ? other.getDtname() == null : this.getDtname().equals(other.getDtname()))
  189 + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime()))
  190 + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid()))
  191 + && (this.getIname() == null ? other.getIname() == null : this.getIname().equals(other.getIname()))
  192 + && (this.getIlid() == null ? other.getIlid() == null : this.getIlid().equals(other.getIlid()))
  193 + && (this.getAid() == null ? other.getAid() == null : this.getAid().equals(other.getAid()));
  194 + }
  195 +
  196 + @Override
  197 + public int hashCode() {
  198 + final int prime = 31;
  199 + int result = 1;
  200 + result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
  201 + result = prime * result + ((getPname() == null) ? 0 : getPname().hashCode());
  202 + result = prime * result + ((getIdno() == null) ? 0 : getIdno().hashCode());
  203 + result = prime * result + ((getPpasswd() == null) ? 0 : getPpasswd().hashCode());
  204 + result = prime * result + ((getSex() == null) ? 0 : getSex().hashCode());
  205 + result = prime * result + ((getCcnt() == null) ? 0 : getCcnt().hashCode());
  206 + result = prime * result + ((getHxid() == null) ? 0 : getHxid().hashCode());
  207 + result = prime * result + ((getBirth() == null) ? 0 : getBirth().hashCode());
  208 + result = prime * result + ((getCreatedby() == null) ? 0 : getCreatedby().hashCode());
  209 + result = prime * result + ((getHeadimg() == null) ? 0 : getHeadimg().hashCode());
  210 + result = prime * result + ((getCid() == null) ? 0 : getCid().hashCode());
  211 + result = prime * result + ((getMobile() == null) ? 0 : getMobile().hashCode());
  212 + result = prime * result + ((getHid() == null) ? 0 : getHid().hashCode());
  213 + result = prime * result + ((getHname() == null) ? 0 : getHname().hashCode());
  214 + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode());
  215 + result = prime * result + ((getDname() == null) ? 0 : getDname().hashCode());
  216 + result = prime * result + ((getDtid() == null) ? 0 : getDtid().hashCode());
  217 + result = prime * result + ((getDtname() == null) ? 0 : getDtname().hashCode());
  218 + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode());
  219 + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode());
  220 + result = prime * result + ((getIname() == null) ? 0 : getIname().hashCode());
  221 + result = prime * result + ((getIlid() == null) ? 0 : getIlid().hashCode());
  222 + result = prime * result + ((getAid() == null) ? 0 : getAid().hashCode());
  223 + return result;
  224 + }
  225 +
  226 + @Override
  227 + public String toString() {
  228 + StringBuilder sb = new StringBuilder();
  229 + sb.append(getClass().getSimpleName());
  230 + sb.append(" [");
  231 + sb.append("Hash = ").append(hashCode());
  232 + sb.append(", id=").append(id);
  233 + sb.append(", pname=").append(pname);
  234 + sb.append(", idno=").append(idno);
  235 + sb.append(", ppasswd=").append(ppasswd);
  236 + sb.append(", sex=").append(sex);
  237 + sb.append(", ccnt=").append(ccnt);
  238 + sb.append(", hxid=").append(hxid);
  239 + sb.append(", birth=").append(birth);
  240 + sb.append(", createdby=").append(createdby);
  241 + sb.append(", headimg=").append(headimg);
  242 + sb.append(", cid=").append(cid);
  243 + sb.append(", mobile=").append(mobile);
  244 + sb.append(", hid=").append(hid);
  245 + sb.append(", hname=").append(hname);
  246 + sb.append(", did=").append(did);
  247 + sb.append(", dname=").append(dname);
  248 + sb.append(", dtid=").append(dtid);
  249 + sb.append(", dtname=").append(dtname);
  250 + sb.append(", createdtime=").append(createdtime);
  251 + sb.append(", iid=").append(iid);
  252 + sb.append(", iname=").append(iname);
  253 + sb.append(", ilid=").append(ilid);
  254 + sb.append(", aid=").append(aid);
  255 + sb.append(", serialVersionUID=").append(serialVersionUID);
  256 + sb.append("]");
  257 + return sb.toString();
  258 + }
  259 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/PushArticleMapper.java View file @ 3f18a1f
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.lyms.talkonlineweb.domain.PushArticle;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +
  6 +/**
  7 + * @Entity com.lyms.talkonlineweb.domain.PushArticle
  8 + */
  9 +public interface PushArticleMapper extends BaseMapper<PushArticle> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/PushArticleService.java View file @ 3f18a1f
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.lyms.talkonlineweb.domain.PushArticle;
  4 +import com.baomidou.mybatisplus.extension.service.IService;
  5 +
  6 +/**
  7 + *
  8 + */
  9 +public interface PushArticleService extends IService<PushArticle> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/PushArticleServiceImpl.java View file @ 3f18a1f
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.PushArticle;
  5 +import com.lyms.talkonlineweb.service.PushArticleService;
  6 +import com.lyms.talkonlineweb.mapper.PushArticleMapper;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + *
  11 + */
  12 +@Service
  13 +public class PushArticleServiceImpl extends ServiceImpl<PushArticleMapper, PushArticle>
  14 + implements PushArticleService{
  15 +
  16 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java View file @ 3f18a1f
1 1 package com.lyms.talkonlineweb.task;
2 2  
3 3 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
4   -import com.lyms.talkonlineweb.domain.LymsArticle;
5   -import com.lyms.talkonlineweb.domain.LymsDict;
6   -import com.lyms.talkonlineweb.domain.LymsPushedart;
7   -import com.lyms.talkonlineweb.domain.PatientInfo;
8   -import com.lyms.talkonlineweb.service.LymsArticleService;
9   -import com.lyms.talkonlineweb.service.LymsDictService;
10   -import com.lyms.talkonlineweb.service.LymsPushedartService;
11   -import com.lyms.talkonlineweb.service.PatientInfoService;
  4 +import com.lyms.talkonlineweb.domain.*;
  5 +import com.lyms.talkonlineweb.service.*;
12 6 import lombok.extern.log4j.Log4j2;
13 7 import org.springframework.beans.factory.annotation.Autowired;
14 8 import org.springframework.scheduling.annotation.Scheduled;
... ... @@ -33,6 +27,8 @@
33 27 private PatientInfoService patientInfoService;
34 28 @Autowired
35 29 private LymsPushedartService lymsPushedartService;//推送的历史记录
  30 + @Autowired
  31 + private PushArticleService pushArticleService;//推送文章新逻辑shiy改
36 32  
37 33 @Autowired
38 34 private LymsDictService lymsDictService;
39 35  
... ... @@ -47,23 +43,32 @@
47 43 List<LymsDict> dcLst=lymsDictService.listByMap(param);
48 44 if (dcLst.size()>0 && dcLst.get(0).getCode()==1){
49 45 log.debug("开始给患者推送文章>>>>>>");
50   - List<LymsArticle> aLst=lymsArticleService.sltNeedPush();//获取待推送文章
51   -
52   - aLst.forEach(e->{
53   - PatientInfo patientInfo=new PatientInfo();
54   - patientInfo.setIid(e.getIid());//针对特定疾病人群推送文章
55   - List<PatientInfo> pLst=patientInfoService.list(Wrappers.query(patientInfo));
56   -
57   - pLst.forEach(p->{
58   - LymsPushedart pushedart=new LymsPushedart();
59   - pushedart.setPid(p.getId());
60   - pushedart.setAid(e.getAid());
  46 + List<PushArticle> pushArticle=pushArticleService.list();
  47 + for (PushArticle article : pushArticle) {
  48 + LymsPushedart pushedart=new LymsPushedart();
  49 + pushedart.setPid(article.getId());
  50 + pushedart.setAid(article.getAid());
61 51 pushedart.setCreatedtime(new Date());
62 52 pushedart.setIsread((byte) 0);
63 53 lymsPushedartService.save(pushedart);//插入到提送记录
64   - });
65   -
66   - });
  54 + }
  55 +// List<LymsArticle> aLst=lymsArticleService.sltNeedPush();//获取待推送文章
  56 +//
  57 +// aLst.forEach(e->{
  58 +// PatientInfo patientInfo=new PatientInfo();
  59 +// patientInfo.setIid(e.getIid());//针对特定疾病人群推送文章
  60 +// List<PatientInfo> pLst=patientInfoService.list(Wrappers.query(patientInfo));
  61 +//
  62 +// pLst.forEach(p->{
  63 +// LymsPushedart pushedart=new LymsPushedart();
  64 +// pushedart.setPid(p.getId());
  65 +// pushedart.setAid(e.getAid());
  66 +// pushedart.setCreatedtime(new Date());
  67 +// pushedart.setIsread((byte) 0);
  68 +// lymsPushedartService.save(pushedart);//插入到提送记录
  69 +// });
  70 +//
  71 +// });
67 72 }
68 73  
69 74 }
talkonlineweb/src/main/resources/mapper/PushArticleMapper.xml View file @ 3f18a1f
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper
  3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.lyms.talkonlineweb.mapper.PushArticleMapper">
  6 +
  7 + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.PushArticle">
  8 + <result property="id" column="id" jdbcType="INTEGER"/>
  9 + <result property="pname" column="pname" jdbcType="VARCHAR"/>
  10 + <result property="idno" column="idno" jdbcType="VARCHAR"/>
  11 + <result property="ppasswd" column="ppasswd" jdbcType="VARCHAR"/>
  12 + <result property="sex" column="sex" jdbcType="INTEGER"/>
  13 + <result property="ccnt" column="ccnt" jdbcType="INTEGER"/>
  14 + <result property="hxid" column="hxid" jdbcType="VARCHAR"/>
  15 + <result property="birth" column="birth" jdbcType="VARCHAR"/>
  16 + <result property="createdby" column="createdby" jdbcType="INTEGER"/>
  17 + <result property="headimg" column="headimg" jdbcType="VARCHAR"/>
  18 + <result property="cid" column="cid" jdbcType="INTEGER"/>
  19 + <result property="mobile" column="mobile" jdbcType="VARCHAR"/>
  20 + <result property="hid" column="hid" jdbcType="INTEGER"/>
  21 + <result property="hname" column="hname" jdbcType="VARCHAR"/>
  22 + <result property="did" column="did" jdbcType="INTEGER"/>
  23 + <result property="dname" column="dname" jdbcType="VARCHAR"/>
  24 + <result property="dtid" column="dtid" jdbcType="INTEGER"/>
  25 + <result property="dtname" column="dtname" jdbcType="VARCHAR"/>
  26 + <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/>
  27 + <result property="iid" column="iid" jdbcType="INTEGER"/>
  28 + <result property="iname" column="iname" jdbcType="VARCHAR"/>
  29 + <result property="ilid" column="ilid" jdbcType="INTEGER"/>
  30 + <result property="aid" column="aid" jdbcType="INTEGER"/>
  31 + </resultMap>
  32 +
  33 + <sql id="Base_Column_List">
  34 + id,pname,idno,
  35 + ppasswd,sex,ccnt,
  36 + hxid,birth,createdby,
  37 + headimg,cid,mobile,
  38 + hid,hname,did,
  39 + dname,dtid,dtname,
  40 + createdtime,iid,iname,
  41 + ilid,aid
  42 + </sql>
  43 +</mapper>