Commit d13f1a35f440a0c8c5fdf721dba980111aaef85c

Authored by changpengfei
1 parent e1f846e2e3
Exists in master and in 1 other branch dev

患者接口、上传文件、知识库

Showing 22 changed files with 1028 additions and 1 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/TalkonlinewebApplication.java View file @ d13f1a3
... ... @@ -3,9 +3,11 @@
3 3 import org.mybatis.spring.annotation.MapperScan;
4 4 import org.springframework.boot.SpringApplication;
5 5 import org.springframework.boot.autoconfigure.SpringBootApplication;
  6 +import org.springframework.scheduling.annotation.EnableScheduling;
6 7  
7 8 @SpringBootApplication
8 9 @MapperScan("com.lyms.talkonlineweb.mapper")
  10 +@EnableScheduling
9 11 public class TalkonlinewebApplication {
10 12  
11 13 public static void main(String[] args) {
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.controller;
  2 +
  3 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  4 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5 +import com.lyms.talkonlineweb.domain.LymsArticle;
  6 +import com.lyms.talkonlineweb.domain.LymsDoctor;
  7 +import com.lyms.talkonlineweb.domain.LymsPushedart;
  8 +import com.lyms.talkonlineweb.result.BaseResponse;
  9 +import com.lyms.talkonlineweb.service.LymsArticleService;
  10 +import com.lyms.talkonlineweb.service.LymsPushedartService;
  11 +import lombok.extern.log4j.Log4j2;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.beans.factory.annotation.Value;
  14 +import org.springframework.http.codec.multipart.Part;
  15 +import org.springframework.web.bind.annotation.GetMapping;
  16 +import org.springframework.web.bind.annotation.PostMapping;
  17 +import org.springframework.web.bind.annotation.RequestMapping;
  18 +import org.springframework.web.bind.annotation.RestController;
  19 +import org.springframework.web.multipart.MultipartFile;
  20 +
  21 +import java.io.File;
  22 +import java.util.ArrayList;
  23 +import java.util.Date;
  24 +import java.util.List;
  25 +import java.util.Objects;
  26 +
  27 +@RestController
  28 +@RequestMapping("art")
  29 +@Log4j2
  30 +public class ArticleController {
  31 +
  32 + @Value("${uploadPath}")
  33 + private String uploadPath;//上传路径
  34 +
  35 + @Value("${imgUrlPre}")
  36 + private String imgUrlPre;//图片查看路径
  37 +
  38 + @Autowired
  39 + private LymsArticleService lymsArticleService;
  40 +
  41 + @Autowired
  42 + private LymsPushedartService lymsPushedartService;//推送记录
  43 +
  44 + /**
  45 + * 上传文件
  46 + * @return
  47 + */
  48 + @PostMapping("upFile")
  49 + public String upFile(MultipartFile imgFile){
  50 + String furl="";
  51 + if(Objects.nonNull(imgFile)){
  52 + try {
  53 + File file=new File(uploadPath+File.separator+System.currentTimeMillis()+imgFile.getOriginalFilename());
  54 + imgFile.transferTo(file);
  55 + furl=file.getAbsolutePath();
  56 + log.info("上传文件:"+furl);
  57 + furl=imgUrlPre+file.getName();
  58 + }catch (Exception e){
  59 + log.error(e.getMessage());
  60 + e.printStackTrace();
  61 + }
  62 + }
  63 +
  64 + return furl;
  65 + }
  66 +
  67 + /**
  68 + * 更新或插入文章文章
  69 + * @param article
  70 + * @return
  71 + */
  72 + @PostMapping("saveArticle")
  73 + public BaseResponse saveArticle(LymsArticle article){
  74 + BaseResponse baseResponse=new BaseResponse();
  75 + if(article.getAid()==null){
  76 + article.setCreatedtime(new Date());
  77 + }else{
  78 + article.setUpdatedTime(new Date());
  79 + }
  80 + boolean f=lymsArticleService.saveOrUpdate(article);
  81 + return baseResponse;
  82 + }
  83 + /**
  84 + * 获取文章列表
  85 + * @param article
  86 + * @param current
  87 + * @param size
  88 + * @return
  89 + */
  90 + @GetMapping("sltArticleLst")
  91 + public BaseResponse sltArticleLst(LymsArticle article, int current, int size){
  92 + BaseResponse baseResponse=new BaseResponse();
  93 + Page<LymsArticle> page=new Page<>(current,size);
  94 + Page<LymsArticle> articlePagePage=lymsArticleService.page(page, Wrappers.query(article).orderByDesc("updated_time","createdtime"));
  95 +
  96 + baseResponse.setObject(articlePagePage);
  97 +
  98 + return baseResponse;
  99 + }
  100 +
  101 + /**
  102 + * 删除文章
  103 + * @param aid
  104 + * @return
  105 + */
  106 + @GetMapping("delArticle")
  107 + public BaseResponse delArticle(int aid){
  108 + BaseResponse baseResponse=new BaseResponse();
  109 + boolean f=lymsArticleService.removeById(aid);
  110 + baseResponse.setErrorcode(f==true?0:1);
  111 + return baseResponse;
  112 + }
  113 +
  114 + /**
  115 + * 根据患者获取推送的文章
  116 + */
  117 +
  118 + @GetMapping("getPushArt")
  119 + public BaseResponse getPushArt(LymsPushedart pushedart){
  120 + BaseResponse baseResponse=new BaseResponse();
  121 + List<LymsPushedart> pLst=lymsPushedartService.list(Wrappers.query(pushedart));
  122 + List idLst=new ArrayList();
  123 + pLst.forEach(e->{
  124 + idLst.add(e.getAid());
  125 + });
  126 + if(idLst.size()>0){
  127 + List<LymsArticle> aLst=lymsArticleService.listByIds(idLst);
  128 + baseResponse.setObject(aLst);
  129 +
  130 + }
  131 + return baseResponse;
  132 + }
  133 +
  134 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/FavorController.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.controller;
  2 +
  3 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  4 +import com.lyms.talkonlineweb.domain.LymsFavor;
  5 +import com.lyms.talkonlineweb.result.BaseResponse;
  6 +import com.lyms.talkonlineweb.service.LymsFavorService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.PostMapping;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +/**
  14 + * 患者感兴趣内容管理
  15 + */
  16 +@RestController
  17 +@RequestMapping("fav")
  18 +public class FavorController {
  19 +
  20 + @Autowired
  21 + private LymsFavorService lymsFavorService;//感兴趣的科室
  22 + /**
  23 + * 保存患者感兴趣的科室
  24 + * @param favor
  25 + * @return
  26 + */
  27 + @PostMapping("saveFavor")
  28 + public BaseResponse saveFavor(LymsFavor favor){
  29 + BaseResponse baseResponse=new BaseResponse();
  30 + boolean f=lymsFavorService.saveOrUpdate(favor);
  31 + baseResponse.setErrorcode(f==true?0:1);
  32 + return baseResponse;
  33 + }
  34 +
  35 + /**
  36 + * 查询感兴趣的科室
  37 + * @param favor
  38 + * @return
  39 + */
  40 + @GetMapping("getFavor")
  41 + public BaseResponse getFavor(LymsFavor favor){
  42 + BaseResponse baseResponse=new BaseResponse();
  43 + favor=lymsFavorService.getOne(Wrappers.query(favor));
  44 + baseResponse.setObject(favor);
  45 + return baseResponse;
  46 + }
  47 +
  48 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.controller;
  2 +
  3 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  4 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5 +import com.lyms.talkonlineweb.domain.*;
  6 +import com.lyms.talkonlineweb.result.BaseResponse;
  7 +import com.lyms.talkonlineweb.service.*;
  8 +import com.lyms.talkonlineweb.util.Constant;
  9 +import com.lyms.talkonlineweb.util.JwtUtils;
  10 +import lombok.extern.log4j.Log4j2;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.validation.BindingResult;
  13 +import org.springframework.validation.annotation.Validated;
  14 +import org.springframework.web.bind.annotation.GetMapping;
  15 +import org.springframework.web.bind.annotation.PostMapping;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +
  19 +import java.util.Date;
  20 +import java.util.HashMap;
  21 +import java.util.List;
  22 +import java.util.Map;
  23 +
  24 +/**
  25 + * 患者管理
  26 + */
  27 +@RestController
  28 +@RequestMapping("pat")
  29 +@Log4j2
  30 +public class PatientController {
  31 +
  32 + @Autowired
  33 + private LymsPatientService lymsPatientService;//患者
  34 +
  35 + @Autowired
  36 + private LymsPcaseService lymsPcaseService;//病例
  37 +
  38 + @Autowired
  39 + private LymsIllnessService lymsIllnessService;//疾病
  40 +
  41 + @Autowired
  42 + private PatientInfoService patientInfoService;//患者视图
  43 +
  44 + @Autowired
  45 + private LymsTcardService lymsTcardService;//问诊卡信息
  46 +
  47 +
  48 + /**
  49 + * 获取患者列表
  50 + * @param patientInfo
  51 + * @param current
  52 + * @param size
  53 + * @return
  54 + */
  55 + @GetMapping("sltPatientLst")
  56 + public BaseResponse sltPatientLst(PatientInfo patientInfo, int current, int size){
  57 + BaseResponse baseResponse=new BaseResponse();
  58 + Page<PatientInfo> page=new Page<>(current,size);
  59 + Page<PatientInfo> patientPagePage=patientInfoService.page(page, Wrappers.query(patientInfo));
  60 +
  61 + baseResponse.setObject(patientPagePage);
  62 +
  63 + return baseResponse;
  64 + }
  65 +
  66 + /**
  67 + * 保存或更新患者信息
  68 + * @param patient
  69 + * @return
  70 + */
  71 + @PostMapping("savePatient")
  72 + public BaseResponse savePatient(@Validated LymsPatient patient, BindingResult result, LymsPcase pcase, String illness){
  73 + BaseResponse baseResponse=new BaseResponse();
  74 + log.info(">>>>>>>>>>>>>>>登记病例");
  75 + baseResponse.setErrormsg("");
  76 + LymsPatient patient2=lymsPatientService.getOne(Wrappers.query(patient).eq("idno",patient.getIdno()));
  77 + if(patient2==null){
  78 + patient.setCreatedtime(new Date());
  79 + }else{
  80 + patient.setId(patient2.getId());
  81 + patient.setUpdatedtime(new Date());
  82 + }
  83 +
  84 + if(result.hasErrors()){
  85 + baseResponse.setErrorcode(1);
  86 + result.getAllErrors().forEach(e->{
  87 + baseResponse.setErrormsg(baseResponse.getErrormsg()+e.getDefaultMessage());
  88 + });
  89 + baseResponse.setErrorcode(1);
  90 + return baseResponse;
  91 + }
  92 +
  93 + boolean f=lymsPatientService.saveOrUpdate(patient);
  94 +
  95 +// 添加病例
  96 + pcase.setCreatedby(patient.getCreatedby());
  97 + pcase.setPid(patient.getId());
  98 + pcase.setCreatedtime(new Date());
  99 + f=lymsPcaseService.save(pcase);
  100 + String[] iArr=illness.split(",");
  101 +
  102 + log.info(patient);
  103 + log.info(pcase);
  104 +
  105 +
  106 + for (int i = 0; i < iArr.length; i++) {
  107 + LymsIllness ness=new LymsIllness();
  108 + ness.setCreatedby(patient.getCreatedby());
  109 + ness.setPcid(pcase.getId());
  110 + ness.setIid(Integer.parseInt(iArr[i]));
  111 + ness.setCreatedtime(new Date());
  112 + f=lymsIllnessService.save(ness);
  113 + log.info(ness);
  114 + }
  115 +
  116 + //需要添加医院购买卡记录
  117 + LymsTcard tcard=new LymsTcard();
  118 + tcard.setCnt(patient.getCcnt());
  119 + tcard.setPcid(pcase.getId());
  120 + tcard.setPid(patient.getId());
  121 + tcard.setFid(2);
  122 +
  123 + lymsTcardService.saveOrUpdate(tcard);
  124 +
  125 + baseResponse.setErrorcode(f==true?0:1);
  126 + return baseResponse;
  127 + }
  128 +
  129 + /**
  130 + * 删除患者
  131 + * @param id
  132 + * @return
  133 + */
  134 + @GetMapping("delPatient")
  135 + public BaseResponse delPatient(int id){
  136 + BaseResponse baseResponse=new BaseResponse();
  137 + boolean f=lymsPatientService.removeById(id);
  138 + baseResponse.setErrorcode(f==true?0:1);
  139 + return baseResponse;
  140 + }
  141 +
  142 + /**
  143 + * 患者登录
  144 + * @param patient
  145 + * @return
  146 + */
  147 + @PostMapping("loginPatient")
  148 + public BaseResponse loginPatient(LymsPatient patient){
  149 + BaseResponse baseResponse=new BaseResponse();
  150 + List<LymsPatient> dLst=lymsPatientService.list(Wrappers.query(patient));
  151 + baseResponse.setErrorcode(1);
  152 + if (dLst.size()>0) {
  153 + patient=dLst.get(0);
  154 + patient.setPpasswd(null);
  155 + baseResponse.setObject(patient);
  156 + String jwt = JwtUtils.createJWT("1", patient.getIdno(), Constant.JWT_TTL);
  157 + Map<String,Object> map=new HashMap<>();
  158 + map.put("patient",patient);
  159 + map.put("token",jwt);
  160 + patient.setIslogin(1);
  161 + lymsPatientService.update().update(patient);
  162 + baseResponse.setErrorcode(0);
  163 + baseResponse.setObject(map);
  164 + }
  165 + return baseResponse;
  166 + }
  167 +
  168 +
  169 +
  170 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsArticle.java View file @ d13f1a3
  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 lyms_article
  14 + */
  15 +@TableName(value ="lyms_article")
  16 +@Data
  17 +public class LymsArticle implements Serializable {
  18 + /**
  19 + *
  20 + */
  21 + @TableId(value = "aid", type = IdType.AUTO)
  22 + private Integer aid;
  23 +
  24 + /**
  25 + * 科室id
  26 + */
  27 + @TableField(value = "did")
  28 + private Integer did;
  29 +
  30 + /**
  31 + * 疾病id
  32 + */
  33 + @TableField(value = "iid")
  34 + private Integer iid;
  35 +
  36 + /**
  37 + * 文章标题
  38 + */
  39 + @TableField(value = "title")
  40 + private String title;
  41 +
  42 + /**
  43 + * 文章内容
  44 + */
  45 + @TableField(value = "content")
  46 + private String content;
  47 +
  48 + /**
  49 + * 是否发布. 0,否;1是
  50 + */
  51 + @TableField(value = "stat")
  52 + private Byte stat;
  53 +
  54 + /**
  55 + * 创建人
  56 + */
  57 + @TableField(value = "createdby")
  58 + private Integer createdby;
  59 +
  60 + /**
  61 + * 创建时间
  62 + */
  63 + @TableField(value = "createdtime")
  64 + private Date createdtime;
  65 +
  66 + /**
  67 + * 更新人
  68 + */
  69 + @TableField(value = "updatedby")
  70 + private Integer updatedby;
  71 +
  72 + /**
  73 + * 更新时间
  74 + */
  75 + @TableField(value = "updated_time")
  76 + private Date updatedTime;
  77 +
  78 + @TableField(value = "cname")
  79 + private String cname;//创建人姓名
  80 + @TableField(value = "uname")
  81 + private String uname;//更新人姓名
  82 +
  83 + @TableField(exist = false)
  84 + private static final long serialVersionUID = 1L;
  85 +
  86 + @Override
  87 + public boolean equals(Object that) {
  88 + if (this == that) {
  89 + return true;
  90 + }
  91 + if (that == null) {
  92 + return false;
  93 + }
  94 + if (getClass() != that.getClass()) {
  95 + return false;
  96 + }
  97 + LymsArticle other = (LymsArticle) that;
  98 + return (this.getAid() == null ? other.getAid() == null : this.getAid().equals(other.getAid()))
  99 + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid()))
  100 + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid()))
  101 + && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
  102 + && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
  103 + && (this.getStat() == null ? other.getStat() == null : this.getStat().equals(other.getStat()))
  104 + && (this.getCreatedby() == null ? other.getCreatedby() == null : this.getCreatedby().equals(other.getCreatedby()))
  105 + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime()))
  106 + && (this.getUpdatedby() == null ? other.getUpdatedby() == null : this.getUpdatedby().equals(other.getUpdatedby()))
  107 + && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime()));
  108 + }
  109 +
  110 + @Override
  111 + public int hashCode() {
  112 + final int prime = 31;
  113 + int result = 1;
  114 + result = prime * result + ((getAid() == null) ? 0 : getAid().hashCode());
  115 + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode());
  116 + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode());
  117 + result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
  118 + result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
  119 + result = prime * result + ((getStat() == null) ? 0 : getStat().hashCode());
  120 + result = prime * result + ((getCreatedby() == null) ? 0 : getCreatedby().hashCode());
  121 + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode());
  122 + result = prime * result + ((getUpdatedby() == null) ? 0 : getUpdatedby().hashCode());
  123 + result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode());
  124 + return result;
  125 + }
  126 +
  127 + @Override
  128 + public String toString() {
  129 + StringBuilder sb = new StringBuilder();
  130 + sb.append(getClass().getSimpleName());
  131 + sb.append(" [");
  132 + sb.append("Hash = ").append(hashCode());
  133 + sb.append(", aid=").append(aid);
  134 + sb.append(", did=").append(did);
  135 + sb.append(", iid=").append(iid);
  136 + sb.append(", title=").append(title);
  137 + sb.append(", content=").append(content);
  138 + sb.append(", stat=").append(stat);
  139 + sb.append(", createdby=").append(createdby);
  140 + sb.append(", createdtime=").append(createdtime);
  141 + sb.append(", updatedby=").append(updatedby);
  142 + sb.append(", updatedTime=").append(updatedTime);
  143 + sb.append(", serialVersionUID=").append(serialVersionUID);
  144 + sb.append("]");
  145 + return sb.toString();
  146 + }
  147 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsFavor.java View file @ d13f1a3
  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 lyms_favor
  14 + */
  15 +@TableName(value ="lyms_favor")
  16 +@Data
  17 +public class LymsFavor implements Serializable {
  18 + /**
  19 + *
  20 + */
  21 + @TableId(value = "fid", type = IdType.AUTO)
  22 + private Integer fid;
  23 +
  24 + /**
  25 + * 患者id
  26 + */
  27 + @TableField(value = "iid")
  28 + private Integer iid;
  29 +
  30 + /**
  31 + * 医院ID
  32 + */
  33 + @TableField(value = "hid")
  34 + private Integer hid;
  35 +
  36 + /**
  37 + * 医院名称
  38 + */
  39 + @TableField(value = "hname")
  40 + private String hname;
  41 +
  42 + /**
  43 + * 科室名称
  44 + */
  45 + @TableField(value = "did")
  46 + private Integer did;
  47 +
  48 + /**
  49 + * 科室名称
  50 + */
  51 + @TableField(value = "dname")
  52 + private String dname;
  53 +
  54 + /**
  55 + * 创建人
  56 + */
  57 + @TableField(value = "createdby")
  58 + private Integer createdby;
  59 +
  60 + /**
  61 + * 创建时间
  62 + */
  63 + @TableField(value = "createdtime")
  64 + private Date createdtime;
  65 +
  66 + /**
  67 + * 更新人
  68 + */
  69 + @TableField(value = "updatedby")
  70 + private Integer updatedby;
  71 +
  72 + /**
  73 + * 更新时间
  74 + */
  75 + @TableField(value = "updated_time")
  76 + private Date updatedTime;
  77 +
  78 + @TableField(exist = false)
  79 + private static final long serialVersionUID = 1L;
  80 +
  81 + @Override
  82 + public boolean equals(Object that) {
  83 + if (this == that) {
  84 + return true;
  85 + }
  86 + if (that == null) {
  87 + return false;
  88 + }
  89 + if (getClass() != that.getClass()) {
  90 + return false;
  91 + }
  92 + LymsFavor other = (LymsFavor) that;
  93 + return (this.getFid() == null ? other.getFid() == null : this.getFid().equals(other.getFid()))
  94 + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid()))
  95 + && (this.getHid() == null ? other.getHid() == null : this.getHid().equals(other.getHid()))
  96 + && (this.getHname() == null ? other.getHname() == null : this.getHname().equals(other.getHname()))
  97 + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid()))
  98 + && (this.getDname() == null ? other.getDname() == null : this.getDname().equals(other.getDname()))
  99 + && (this.getCreatedby() == null ? other.getCreatedby() == null : this.getCreatedby().equals(other.getCreatedby()))
  100 + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime()))
  101 + && (this.getUpdatedby() == null ? other.getUpdatedby() == null : this.getUpdatedby().equals(other.getUpdatedby()))
  102 + && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime()));
  103 + }
  104 +
  105 + @Override
  106 + public int hashCode() {
  107 + final int prime = 31;
  108 + int result = 1;
  109 + result = prime * result + ((getFid() == null) ? 0 : getFid().hashCode());
  110 + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode());
  111 + result = prime * result + ((getHid() == null) ? 0 : getHid().hashCode());
  112 + result = prime * result + ((getHname() == null) ? 0 : getHname().hashCode());
  113 + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode());
  114 + result = prime * result + ((getDname() == null) ? 0 : getDname().hashCode());
  115 + result = prime * result + ((getCreatedby() == null) ? 0 : getCreatedby().hashCode());
  116 + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode());
  117 + result = prime * result + ((getUpdatedby() == null) ? 0 : getUpdatedby().hashCode());
  118 + result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode());
  119 + return result;
  120 + }
  121 +
  122 + @Override
  123 + public String toString() {
  124 + StringBuilder sb = new StringBuilder();
  125 + sb.append(getClass().getSimpleName());
  126 + sb.append(" [");
  127 + sb.append("Hash = ").append(hashCode());
  128 + sb.append(", fid=").append(fid);
  129 + sb.append(", iid=").append(iid);
  130 + sb.append(", hid=").append(hid);
  131 + sb.append(", hname=").append(hname);
  132 + sb.append(", did=").append(did);
  133 + sb.append(", dname=").append(dname);
  134 + sb.append(", createdby=").append(createdby);
  135 + sb.append(", createdtime=").append(createdtime);
  136 + sb.append(", updatedby=").append(updatedby);
  137 + sb.append(", updatedTime=").append(updatedTime);
  138 + sb.append(", serialVersionUID=").append(serialVersionUID);
  139 + sb.append("]");
  140 + return sb.toString();
  141 + }
  142 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java View file @ d13f1a3
... ... @@ -57,6 +57,9 @@
57 57 @TableField(value = "hxid")
58 58 private String hxid;
59 59  
  60 + @TableField(value = "islogin")
  61 + private int islogin;//是否登录过
  62 +
60 63 /**
61 64 * 创建人
62 65 */
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushedart.java View file @ d13f1a3
  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 lyms_pushedart
  14 + */
  15 +@TableName(value ="lyms_pushedart")
  16 +@Data
  17 +public class LymsPushedart implements Serializable {
  18 + /**
  19 + *
  20 + */
  21 + @TableId(value = "id", type = IdType.AUTO)
  22 + private Integer id;
  23 +
  24 + /**
  25 + * 患者ID
  26 + */
  27 + @TableField(value = "pid")
  28 + private Integer pid;
  29 +
  30 + /**
  31 + * 文章ID
  32 + */
  33 + @TableField(value = "aid")
  34 + private Integer aid;
  35 +
  36 + /**
  37 + * 是否已读。0否,1是
  38 + */
  39 + @TableField(value = "isread")
  40 + private Byte isread;
  41 +
  42 + /**
  43 + * 提送时间
  44 + */
  45 + @TableField(value = "createdtime")
  46 + private Date createdtime;
  47 +
  48 + @TableField(exist = false)
  49 + private static final long serialVersionUID = 1L;
  50 +
  51 + @Override
  52 + public boolean equals(Object that) {
  53 + if (this == that) {
  54 + return true;
  55 + }
  56 + if (that == null) {
  57 + return false;
  58 + }
  59 + if (getClass() != that.getClass()) {
  60 + return false;
  61 + }
  62 + LymsPushedart other = (LymsPushedart) that;
  63 + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
  64 + && (this.getPid() == null ? other.getPid() == null : this.getPid().equals(other.getPid()))
  65 + && (this.getAid() == null ? other.getAid() == null : this.getAid().equals(other.getAid()))
  66 + && (this.getIsread() == null ? other.getIsread() == null : this.getIsread().equals(other.getIsread()))
  67 + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime()));
  68 + }
  69 +
  70 + @Override
  71 + public int hashCode() {
  72 + final int prime = 31;
  73 + int result = 1;
  74 + result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
  75 + result = prime * result + ((getPid() == null) ? 0 : getPid().hashCode());
  76 + result = prime * result + ((getAid() == null) ? 0 : getAid().hashCode());
  77 + result = prime * result + ((getIsread() == null) ? 0 : getIsread().hashCode());
  78 + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode());
  79 + return result;
  80 + }
  81 +
  82 + @Override
  83 + public String toString() {
  84 + StringBuilder sb = new StringBuilder();
  85 + sb.append(getClass().getSimpleName());
  86 + sb.append(" [");
  87 + sb.append("Hash = ").append(hashCode());
  88 + sb.append(", id=").append(id);
  89 + sb.append(", pid=").append(pid);
  90 + sb.append(", aid=").append(aid);
  91 + sb.append(", isread=").append(isread);
  92 + sb.append(", createdtime=").append(createdtime);
  93 + sb.append(", serialVersionUID=").append(serialVersionUID);
  94 + sb.append("]");
  95 + return sb.toString();
  96 + }
  97 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsArticle;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +import org.apache.ibatis.annotations.Select;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * @Entity com.lyms.talkonlineweb.domain.LymsArticle
  11 + */
  12 +public interface LymsArticleMapper extends BaseMapper<LymsArticle> {
  13 +
  14 + @Select("SELECT * FROM lyms_article a WHERE a.`stat`=1 AND a.`aid` NOT IN (SELECT aid FROM lyms_pushedart)")
  15 + List<LymsArticle> sltNeedPush();
  16 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsFavorMapper.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsFavor;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +
  6 +/**
  7 + * @Entity com.lyms.talkonlineweb.domain.LymsFavor
  8 + */
  9 +public interface LymsFavorMapper extends BaseMapper<LymsFavor> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushedartMapper.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsPushedart;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +
  6 +/**
  7 + * @Entity com.lyms.talkonlineweb.domain.LymsPushedart
  8 + */
  9 +public interface LymsPushedartMapper extends BaseMapper<LymsPushedart> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsArticle;
  4 +import com.baomidou.mybatisplus.extension.service.IService;
  5 +import com.lyms.talkonlineweb.mapper.LymsArticleMapper;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + *
  12 + */
  13 +public interface LymsArticleService extends IService<LymsArticle> {
  14 + List<LymsArticle> sltNeedPush();
  15 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsFavorService.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsFavor;
  4 +import com.baomidou.mybatisplus.extension.service.IService;
  5 +
  6 +/**
  7 + *
  8 + */
  9 +public interface LymsFavorService extends IService<LymsFavor> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushedartService.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsPushedart;
  4 +import com.baomidou.mybatisplus.extension.service.IService;
  5 +
  6 +/**
  7 + *
  8 + */
  9 +public interface LymsPushedartService extends IService<LymsPushedart> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.LymsArticle;
  5 +import com.lyms.talkonlineweb.service.LymsArticleService;
  6 +import com.lyms.talkonlineweb.mapper.LymsArticleMapper;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + *
  14 + */
  15 +@Service
  16 +public class LymsArticleServiceImpl extends ServiceImpl<LymsArticleMapper, LymsArticle>
  17 + implements LymsArticleService{
  18 +
  19 + @Autowired
  20 + private LymsArticleMapper lymsArticleMapper;
  21 +
  22 + @Override
  23 + public List<LymsArticle> sltNeedPush() {
  24 + return lymsArticleMapper.sltNeedPush();
  25 + }
  26 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsFavorServiceImpl.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.LymsFavor;
  5 +import com.lyms.talkonlineweb.service.LymsFavorService;
  6 +import com.lyms.talkonlineweb.mapper.LymsFavorMapper;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + *
  11 + */
  12 +@Service
  13 +public class LymsFavorServiceImpl extends ServiceImpl<LymsFavorMapper, LymsFavor>
  14 + implements LymsFavorService{
  15 +
  16 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushedartServiceImpl.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.LymsPushedart;
  5 +import com.lyms.talkonlineweb.service.LymsPushedartService;
  6 +import com.lyms.talkonlineweb.mapper.LymsPushedartMapper;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + *
  11 + */
  12 +@Service
  13 +public class LymsPushedartServiceImpl extends ServiceImpl<LymsPushedartMapper, LymsPushedart>
  14 + implements LymsPushedartService{
  15 +
  16 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java View file @ d13f1a3
  1 +package com.lyms.talkonlineweb.task;
  2 +
  3 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  4 +import com.lyms.talkonlineweb.domain.LymsArticle;
  5 +import com.lyms.talkonlineweb.domain.LymsPushedart;
  6 +import com.lyms.talkonlineweb.domain.PatientInfo;
  7 +import com.lyms.talkonlineweb.service.LymsArticleService;
  8 +import com.lyms.talkonlineweb.service.LymsPushedartService;
  9 +import com.lyms.talkonlineweb.service.PatientInfoService;
  10 +import lombok.extern.log4j.Log4j2;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.scheduling.annotation.Scheduled;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import java.util.Date;
  16 +import java.util.List;
  17 +
  18 +/**
  19 + * 推送文章任务
  20 + */
  21 +
  22 +@Component
  23 +@Log4j2
  24 +public class PushArticleTask {
  25 +
  26 + @Autowired
  27 + private LymsArticleService lymsArticleService;
  28 + @Autowired
  29 + private PatientInfoService patientInfoService;
  30 + @Autowired
  31 + private LymsPushedartService lymsPushedartService;//推送的历史记录
  32 +
  33 +// @Scheduled(initialDelay=1000, fixedRate=5000)
  34 + public void pushArtcle(){
  35 + log.info("开始给患者推送文章>>>>>>");
  36 + List<LymsArticle> aLst=lymsArticleService.sltNeedPush();//获取待推送文章
  37 +
  38 + aLst.forEach(e->{
  39 + PatientInfo patientInfo=new PatientInfo();
  40 + patientInfo.setIid(e.getIid());//针对特定疾病人群推送文章
  41 + List<PatientInfo> pLst=patientInfoService.list(Wrappers.query(patientInfo));
  42 +
  43 + pLst.forEach(p->{
  44 + LymsPushedart pushedart=new LymsPushedart();
  45 + pushedart.setPid(p.getId());
  46 + pushedart.setAid(e.getAid());
  47 + pushedart.setCreatedtime(new Date());
  48 + pushedart.setIsread((byte) 0);
  49 + lymsPushedartService.save(pushedart);//插入到提送记录
  50 + });
  51 +
  52 + });
  53 + }
  54 +}
talkonlineweb/src/main/resources/application.yml View file @ d13f1a3
... ... @@ -17,4 +17,6 @@
17 17 config: classpath:logback-spring.xml
18 18  
19 19 excludePath: login,test1,test2
  20 +uploadPath: /data/talkonline/upload/
  21 +imgUrlPre: https://dev-talk.healthbaby.com.cn/upload/
talkonlineweb/src/main/resources/mapper/LymsArticleMapper.xml View file @ d13f1a3
  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.LymsArticleMapper">
  6 +
  7 + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsArticle">
  8 + <id property="aid" column="aid" jdbcType="INTEGER"/>
  9 + <result property="did" column="did" jdbcType="INTEGER"/>
  10 + <result property="iid" column="iid" jdbcType="INTEGER"/>
  11 + <result property="title" column="title" jdbcType="VARCHAR"/>
  12 + <result property="content" column="content" jdbcType="VARCHAR"/>
  13 + <result property="stat" column="stat" jdbcType="TINYINT"/>
  14 + <result property="createdby" column="createdby" jdbcType="INTEGER"/>
  15 + <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/>
  16 + <result property="updatedby" column="updatedby" jdbcType="INTEGER"/>
  17 + <result property="updatedTime" column="updated_time" jdbcType="TIMESTAMP"/>
  18 + </resultMap>
  19 +
  20 + <sql id="Base_Column_List">
  21 + aid,did,iid,
  22 + title,content,stat,
  23 + createdby,createdtime,updatedby,
  24 + updated_time
  25 + </sql>
  26 +</mapper>
talkonlineweb/src/main/resources/mapper/LymsFavorMapper.xml View file @ d13f1a3
  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.LymsFavorMapper">
  6 +
  7 + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsFavor">
  8 + <id property="fid" column="fid" jdbcType="INTEGER"/>
  9 + <result property="iid" column="iid" jdbcType="INTEGER"/>
  10 + <result property="hid" column="hid" jdbcType="INTEGER"/>
  11 + <result property="hname" column="hname" jdbcType="VARCHAR"/>
  12 + <result property="did" column="did" jdbcType="INTEGER"/>
  13 + <result property="dname" column="dname" jdbcType="VARCHAR"/>
  14 + <result property="createdby" column="createdby" jdbcType="INTEGER"/>
  15 + <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/>
  16 + <result property="updatedby" column="updatedby" jdbcType="INTEGER"/>
  17 + <result property="updatedTime" column="updated_time" jdbcType="TIMESTAMP"/>
  18 + </resultMap>
  19 +
  20 + <sql id="Base_Column_List">
  21 + fid,iid,hid,
  22 + hname,did,dname,
  23 + createdby,createdtime,updatedby,
  24 + updated_time
  25 + </sql>
  26 +</mapper>
talkonlineweb/src/main/resources/mapper/LymsPushedartMapper.xml View file @ d13f1a3
  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.LymsPushedartMapper">
  6 +
  7 + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsPushedart">
  8 + <id property="id" column="id" jdbcType="INTEGER"/>
  9 + <result property="pid" column="pid" jdbcType="INTEGER"/>
  10 + <result property="aid" column="aid" jdbcType="INTEGER"/>
  11 + <result property="isread" column="isread" jdbcType="TINYINT"/>
  12 + <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/>
  13 + </resultMap>
  14 +
  15 + <sql id="Base_Column_List">
  16 + id,pid,aid,
  17 + isread,createdtime
  18 + </sql>
  19 +</mapper>