From d13f1a35f440a0c8c5fdf721dba980111aaef85c Mon Sep 17 00:00:00 2001 From: changpengfei Date: Fri, 3 Sep 2021 13:40:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=82=A3=E8=80=85=E6=8E=A5=E5=8F=A3=E3=80=81?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E3=80=81=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talkonlineweb/TalkonlinewebApplication.java | 2 + .../controller/ArticleController.java | 134 ++++++++++++++++ .../talkonlineweb/controller/FavorController.java | 48 ++++++ .../controller/PatientController.java | 170 +++++++++++++++++++++ .../com/lyms/talkonlineweb/domain/LymsArticle.java | 147 ++++++++++++++++++ .../com/lyms/talkonlineweb/domain/LymsFavor.java | 142 +++++++++++++++++ .../com/lyms/talkonlineweb/domain/LymsPatient.java | 3 + .../lyms/talkonlineweb/domain/LymsPushedart.java | 97 ++++++++++++ .../talkonlineweb/mapper/LymsArticleMapper.java | 20 +++ .../lyms/talkonlineweb/mapper/LymsFavorMapper.java | 15 ++ .../talkonlineweb/mapper/LymsPushedartMapper.java | 15 ++ .../talkonlineweb/service/LymsArticleService.java | 15 ++ .../talkonlineweb/service/LymsFavorService.java | 11 ++ .../service/LymsPushedartService.java | 11 ++ .../service/impl/LymsArticleServiceImpl.java | 30 ++++ .../service/impl/LymsFavorServiceImpl.java | 20 +++ .../service/impl/LymsPushedartServiceImpl.java | 20 +++ .../lyms/talkonlineweb/task/PushArticleTask.java | 54 +++++++ talkonlineweb/src/main/resources/application.yml | 4 +- .../main/resources/mapper/LymsArticleMapper.xml | 26 ++++ .../src/main/resources/mapper/LymsFavorMapper.xml | 26 ++++ .../main/resources/mapper/LymsPushedartMapper.xml | 19 +++ 22 files changed, 1028 insertions(+), 1 deletion(-) create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/FavorController.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsArticle.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsFavor.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushedart.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsFavorMapper.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushedartMapper.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsFavorService.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushedartService.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsFavorServiceImpl.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushedartServiceImpl.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java create mode 100644 talkonlineweb/src/main/resources/mapper/LymsArticleMapper.xml create mode 100644 talkonlineweb/src/main/resources/mapper/LymsFavorMapper.xml create mode 100644 talkonlineweb/src/main/resources/mapper/LymsPushedartMapper.xml diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/TalkonlinewebApplication.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/TalkonlinewebApplication.java index 0f067a2..c322f34 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/TalkonlinewebApplication.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/TalkonlinewebApplication.java @@ -3,9 +3,11 @@ package com.lyms.talkonlineweb; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @MapperScan("com.lyms.talkonlineweb.mapper") +@EnableScheduling public class TalkonlinewebApplication { public static void main(String[] args) { diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java new file mode 100644 index 0000000..991fff0 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java @@ -0,0 +1,134 @@ +package com.lyms.talkonlineweb.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lyms.talkonlineweb.domain.LymsArticle; +import com.lyms.talkonlineweb.domain.LymsDoctor; +import com.lyms.talkonlineweb.domain.LymsPushedart; +import com.lyms.talkonlineweb.result.BaseResponse; +import com.lyms.talkonlineweb.service.LymsArticleService; +import com.lyms.talkonlineweb.service.LymsPushedartService; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.codec.multipart.Part; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@RestController +@RequestMapping("art") +@Log4j2 +public class ArticleController { + + @Value("${uploadPath}") + private String uploadPath;//上传路径 + + @Value("${imgUrlPre}") + private String imgUrlPre;//图片查看路径 + + @Autowired + private LymsArticleService lymsArticleService; + + @Autowired + private LymsPushedartService lymsPushedartService;//推送记录 + + /** + * 上传文件 + * @return + */ + @PostMapping("upFile") + public String upFile(MultipartFile imgFile){ + String furl=""; + if(Objects.nonNull(imgFile)){ + try { + File file=new File(uploadPath+File.separator+System.currentTimeMillis()+imgFile.getOriginalFilename()); + imgFile.transferTo(file); + furl=file.getAbsolutePath(); + log.info("上传文件:"+furl); + furl=imgUrlPre+file.getName(); + }catch (Exception e){ + log.error(e.getMessage()); + e.printStackTrace(); + } + } + + return furl; + } + + /** + * 更新或插入文章文章 + * @param article + * @return + */ + @PostMapping("saveArticle") + public BaseResponse saveArticle(LymsArticle article){ + BaseResponse baseResponse=new BaseResponse(); + if(article.getAid()==null){ + article.setCreatedtime(new Date()); + }else{ + article.setUpdatedTime(new Date()); + } + boolean f=lymsArticleService.saveOrUpdate(article); + return baseResponse; + } + /** + * 获取文章列表 + * @param article + * @param current + * @param size + * @return + */ + @GetMapping("sltArticleLst") + public BaseResponse sltArticleLst(LymsArticle article, int current, int size){ + BaseResponse baseResponse=new BaseResponse(); + Page page=new Page<>(current,size); + Page articlePagePage=lymsArticleService.page(page, Wrappers.query(article).orderByDesc("updated_time","createdtime")); + + baseResponse.setObject(articlePagePage); + + return baseResponse; + } + + /** + * 删除文章 + * @param aid + * @return + */ + @GetMapping("delArticle") + public BaseResponse delArticle(int aid){ + BaseResponse baseResponse=new BaseResponse(); + boolean f=lymsArticleService.removeById(aid); + baseResponse.setErrorcode(f==true?0:1); + return baseResponse; + } + + /** + * 根据患者获取推送的文章 + */ + + @GetMapping("getPushArt") + public BaseResponse getPushArt(LymsPushedart pushedart){ + BaseResponse baseResponse=new BaseResponse(); + List pLst=lymsPushedartService.list(Wrappers.query(pushedart)); + List idLst=new ArrayList(); + pLst.forEach(e->{ + idLst.add(e.getAid()); + }); + if(idLst.size()>0){ + List aLst=lymsArticleService.listByIds(idLst); + baseResponse.setObject(aLst); + + } + return baseResponse; + } + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/FavorController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/FavorController.java new file mode 100644 index 0000000..429ffb9 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/FavorController.java @@ -0,0 +1,48 @@ +package com.lyms.talkonlineweb.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lyms.talkonlineweb.domain.LymsFavor; +import com.lyms.talkonlineweb.result.BaseResponse; +import com.lyms.talkonlineweb.service.LymsFavorService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 患者感兴趣内容管理 + */ +@RestController +@RequestMapping("fav") +public class FavorController { + + @Autowired + private LymsFavorService lymsFavorService;//感兴趣的科室 + /** + * 保存患者感兴趣的科室 + * @param favor + * @return + */ + @PostMapping("saveFavor") + public BaseResponse saveFavor(LymsFavor favor){ + BaseResponse baseResponse=new BaseResponse(); + boolean f=lymsFavorService.saveOrUpdate(favor); + baseResponse.setErrorcode(f==true?0:1); + return baseResponse; + } + + /** + * 查询感兴趣的科室 + * @param favor + * @return + */ + @GetMapping("getFavor") + public BaseResponse getFavor(LymsFavor favor){ + BaseResponse baseResponse=new BaseResponse(); + favor=lymsFavorService.getOne(Wrappers.query(favor)); + baseResponse.setObject(favor); + return baseResponse; + } + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java new file mode 100644 index 0000000..3317497 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -0,0 +1,170 @@ +package com.lyms.talkonlineweb.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lyms.talkonlineweb.domain.*; +import com.lyms.talkonlineweb.result.BaseResponse; +import com.lyms.talkonlineweb.service.*; +import com.lyms.talkonlineweb.util.Constant; +import com.lyms.talkonlineweb.util.JwtUtils; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 患者管理 + */ +@RestController +@RequestMapping("pat") +@Log4j2 +public class PatientController { + + @Autowired + private LymsPatientService lymsPatientService;//患者 + + @Autowired + private LymsPcaseService lymsPcaseService;//病例 + + @Autowired + private LymsIllnessService lymsIllnessService;//疾病 + + @Autowired + private PatientInfoService patientInfoService;//患者视图 + + @Autowired + private LymsTcardService lymsTcardService;//问诊卡信息 + + + /** + * 获取患者列表 + * @param patientInfo + * @param current + * @param size + * @return + */ + @GetMapping("sltPatientLst") + public BaseResponse sltPatientLst(PatientInfo patientInfo, int current, int size){ + BaseResponse baseResponse=new BaseResponse(); + Page page=new Page<>(current,size); + Page patientPagePage=patientInfoService.page(page, Wrappers.query(patientInfo)); + + baseResponse.setObject(patientPagePage); + + return baseResponse; + } + + /** + * 保存或更新患者信息 + * @param patient + * @return + */ + @PostMapping("savePatient") + public BaseResponse savePatient(@Validated LymsPatient patient, BindingResult result, LymsPcase pcase, String illness){ + BaseResponse baseResponse=new BaseResponse(); + log.info(">>>>>>>>>>>>>>>登记病例"); + baseResponse.setErrormsg(""); + LymsPatient patient2=lymsPatientService.getOne(Wrappers.query(patient).eq("idno",patient.getIdno())); + if(patient2==null){ + patient.setCreatedtime(new Date()); + }else{ + patient.setId(patient2.getId()); + patient.setUpdatedtime(new Date()); + } + + if(result.hasErrors()){ + baseResponse.setErrorcode(1); + result.getAllErrors().forEach(e->{ + baseResponse.setErrormsg(baseResponse.getErrormsg()+e.getDefaultMessage()); + }); + baseResponse.setErrorcode(1); + return baseResponse; + } + + boolean f=lymsPatientService.saveOrUpdate(patient); + +// 添加病例 + pcase.setCreatedby(patient.getCreatedby()); + pcase.setPid(patient.getId()); + pcase.setCreatedtime(new Date()); + f=lymsPcaseService.save(pcase); + String[] iArr=illness.split(","); + + log.info(patient); + log.info(pcase); + + + for (int i = 0; i < iArr.length; i++) { + LymsIllness ness=new LymsIllness(); + ness.setCreatedby(patient.getCreatedby()); + ness.setPcid(pcase.getId()); + ness.setIid(Integer.parseInt(iArr[i])); + ness.setCreatedtime(new Date()); + f=lymsIllnessService.save(ness); + log.info(ness); + } + + //需要添加医院购买卡记录 + LymsTcard tcard=new LymsTcard(); + tcard.setCnt(patient.getCcnt()); + tcard.setPcid(pcase.getId()); + tcard.setPid(patient.getId()); + tcard.setFid(2); + + lymsTcardService.saveOrUpdate(tcard); + + baseResponse.setErrorcode(f==true?0:1); + return baseResponse; + } + + /** + * 删除患者 + * @param id + * @return + */ + @GetMapping("delPatient") + public BaseResponse delPatient(int id){ + BaseResponse baseResponse=new BaseResponse(); + boolean f=lymsPatientService.removeById(id); + baseResponse.setErrorcode(f==true?0:1); + return baseResponse; + } + + /** + * 患者登录 + * @param patient + * @return + */ + @PostMapping("loginPatient") + public BaseResponse loginPatient(LymsPatient patient){ + BaseResponse baseResponse=new BaseResponse(); + List dLst=lymsPatientService.list(Wrappers.query(patient)); + baseResponse.setErrorcode(1); + if (dLst.size()>0) { + patient=dLst.get(0); + patient.setPpasswd(null); + baseResponse.setObject(patient); + String jwt = JwtUtils.createJWT("1", patient.getIdno(), Constant.JWT_TTL); + Map map=new HashMap<>(); + map.put("patient",patient); + map.put("token",jwt); + patient.setIslogin(1); + lymsPatientService.update().update(patient); + baseResponse.setErrorcode(0); + baseResponse.setObject(map); + } + return baseResponse; + } + + + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsArticle.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsArticle.java new file mode 100644 index 0000000..38ac08b --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsArticle.java @@ -0,0 +1,147 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 文章 + * @TableName lyms_article + */ +@TableName(value ="lyms_article") +@Data +public class LymsArticle implements Serializable { + /** + * + */ + @TableId(value = "aid", type = IdType.AUTO) + private Integer aid; + + /** + * 科室id + */ + @TableField(value = "did") + private Integer did; + + /** + * 疾病id + */ + @TableField(value = "iid") + private Integer iid; + + /** + * 文章标题 + */ + @TableField(value = "title") + private String title; + + /** + * 文章内容 + */ + @TableField(value = "content") + private String content; + + /** + * 是否发布. 0,否;1是 + */ + @TableField(value = "stat") + private Byte stat; + + /** + * 创建人 + */ + @TableField(value = "createdby") + private Integer createdby; + + /** + * 创建时间 + */ + @TableField(value = "createdtime") + private Date createdtime; + + /** + * 更新人 + */ + @TableField(value = "updatedby") + private Integer updatedby; + + /** + * 更新时间 + */ + @TableField(value = "updated_time") + private Date updatedTime; + + @TableField(value = "cname") + private String cname;//创建人姓名 + @TableField(value = "uname") + private String uname;//更新人姓名 + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + LymsArticle other = (LymsArticle) that; + return (this.getAid() == null ? other.getAid() == null : this.getAid().equals(other.getAid())) + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid())) + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid())) + && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle())) + && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent())) + && (this.getStat() == null ? other.getStat() == null : this.getStat().equals(other.getStat())) + && (this.getCreatedby() == null ? other.getCreatedby() == null : this.getCreatedby().equals(other.getCreatedby())) + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime())) + && (this.getUpdatedby() == null ? other.getUpdatedby() == null : this.getUpdatedby().equals(other.getUpdatedby())) + && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getAid() == null) ? 0 : getAid().hashCode()); + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode()); + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode()); + result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode()); + result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode()); + result = prime * result + ((getStat() == null) ? 0 : getStat().hashCode()); + result = prime * result + ((getCreatedby() == null) ? 0 : getCreatedby().hashCode()); + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode()); + result = prime * result + ((getUpdatedby() == null) ? 0 : getUpdatedby().hashCode()); + result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", aid=").append(aid); + sb.append(", did=").append(did); + sb.append(", iid=").append(iid); + sb.append(", title=").append(title); + sb.append(", content=").append(content); + sb.append(", stat=").append(stat); + sb.append(", createdby=").append(createdby); + sb.append(", createdtime=").append(createdtime); + sb.append(", updatedby=").append(updatedby); + sb.append(", updatedTime=").append(updatedTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsFavor.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsFavor.java new file mode 100644 index 0000000..9fd7b07 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsFavor.java @@ -0,0 +1,142 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 感兴趣的科室 + * @TableName lyms_favor + */ +@TableName(value ="lyms_favor") +@Data +public class LymsFavor implements Serializable { + /** + * + */ + @TableId(value = "fid", type = IdType.AUTO) + private Integer fid; + + /** + * 患者id + */ + @TableField(value = "iid") + private Integer iid; + + /** + * 医院ID + */ + @TableField(value = "hid") + private Integer hid; + + /** + * 医院名称 + */ + @TableField(value = "hname") + private String hname; + + /** + * 科室名称 + */ + @TableField(value = "did") + private Integer did; + + /** + * 科室名称 + */ + @TableField(value = "dname") + private String dname; + + /** + * 创建人 + */ + @TableField(value = "createdby") + private Integer createdby; + + /** + * 创建时间 + */ + @TableField(value = "createdtime") + private Date createdtime; + + /** + * 更新人 + */ + @TableField(value = "updatedby") + private Integer updatedby; + + /** + * 更新时间 + */ + @TableField(value = "updated_time") + private Date updatedTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + LymsFavor other = (LymsFavor) that; + return (this.getFid() == null ? other.getFid() == null : this.getFid().equals(other.getFid())) + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid())) + && (this.getHid() == null ? other.getHid() == null : this.getHid().equals(other.getHid())) + && (this.getHname() == null ? other.getHname() == null : this.getHname().equals(other.getHname())) + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid())) + && (this.getDname() == null ? other.getDname() == null : this.getDname().equals(other.getDname())) + && (this.getCreatedby() == null ? other.getCreatedby() == null : this.getCreatedby().equals(other.getCreatedby())) + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime())) + && (this.getUpdatedby() == null ? other.getUpdatedby() == null : this.getUpdatedby().equals(other.getUpdatedby())) + && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getFid() == null) ? 0 : getFid().hashCode()); + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode()); + result = prime * result + ((getHid() == null) ? 0 : getHid().hashCode()); + result = prime * result + ((getHname() == null) ? 0 : getHname().hashCode()); + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode()); + result = prime * result + ((getDname() == null) ? 0 : getDname().hashCode()); + result = prime * result + ((getCreatedby() == null) ? 0 : getCreatedby().hashCode()); + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode()); + result = prime * result + ((getUpdatedby() == null) ? 0 : getUpdatedby().hashCode()); + result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", fid=").append(fid); + sb.append(", iid=").append(iid); + sb.append(", hid=").append(hid); + sb.append(", hname=").append(hname); + sb.append(", did=").append(did); + sb.append(", dname=").append(dname); + sb.append(", createdby=").append(createdby); + sb.append(", createdtime=").append(createdtime); + sb.append(", updatedby=").append(updatedby); + sb.append(", updatedTime=").append(updatedTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java index f61cc40..cce1ff2 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java @@ -57,6 +57,9 @@ public class LymsPatient implements Serializable { @TableField(value = "hxid") private String hxid; + @TableField(value = "islogin") + private int islogin;//是否登录过 + /** * 创建人 */ diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushedart.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushedart.java new file mode 100644 index 0000000..12d07ff --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushedart.java @@ -0,0 +1,97 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * + * @TableName lyms_pushedart + */ +@TableName(value ="lyms_pushedart") +@Data +public class LymsPushedart implements Serializable { + /** + * + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 患者ID + */ + @TableField(value = "pid") + private Integer pid; + + /** + * 文章ID + */ + @TableField(value = "aid") + private Integer aid; + + /** + * 是否已读。0否,1是 + */ + @TableField(value = "isread") + private Byte isread; + + /** + * 提送时间 + */ + @TableField(value = "createdtime") + private Date createdtime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + LymsPushedart other = (LymsPushedart) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getPid() == null ? other.getPid() == null : this.getPid().equals(other.getPid())) + && (this.getAid() == null ? other.getAid() == null : this.getAid().equals(other.getAid())) + && (this.getIsread() == null ? other.getIsread() == null : this.getIsread().equals(other.getIsread())) + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getPid() == null) ? 0 : getPid().hashCode()); + result = prime * result + ((getAid() == null) ? 0 : getAid().hashCode()); + result = prime * result + ((getIsread() == null) ? 0 : getIsread().hashCode()); + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", pid=").append(pid); + sb.append(", aid=").append(aid); + sb.append(", isread=").append(isread); + sb.append(", createdtime=").append(createdtime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java new file mode 100644 index 0000000..656d9e0 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java @@ -0,0 +1,20 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsArticle; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * @Entity com.lyms.talkonlineweb.domain.LymsArticle + */ +public interface LymsArticleMapper extends BaseMapper { + + @Select("SELECT * FROM lyms_article a WHERE a.`stat`=1 AND a.`aid` NOT IN (SELECT aid FROM lyms_pushedart)") + List sltNeedPush(); +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsFavorMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsFavorMapper.java new file mode 100644 index 0000000..f095869 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsFavorMapper.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsFavor; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Entity com.lyms.talkonlineweb.domain.LymsFavor + */ +public interface LymsFavorMapper extends BaseMapper { + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushedartMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushedartMapper.java new file mode 100644 index 0000000..c82456f --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushedartMapper.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsPushedart; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Entity com.lyms.talkonlineweb.domain.LymsPushedart + */ +public interface LymsPushedartMapper extends BaseMapper { + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java new file mode 100644 index 0000000..0196053 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsArticle; +import com.baomidou.mybatisplus.extension.service.IService; +import com.lyms.talkonlineweb.mapper.LymsArticleMapper; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +/** + * + */ +public interface LymsArticleService extends IService { + List sltNeedPush(); +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsFavorService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsFavorService.java new file mode 100644 index 0000000..f8e47de --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsFavorService.java @@ -0,0 +1,11 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsFavor; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * + */ +public interface LymsFavorService extends IService { + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushedartService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushedartService.java new file mode 100644 index 0000000..6c1d569 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushedartService.java @@ -0,0 +1,11 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsPushedart; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * + */ +public interface LymsPushedartService extends IService { + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java new file mode 100644 index 0000000..03ba24d --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java @@ -0,0 +1,30 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsArticle; +import com.lyms.talkonlineweb.service.LymsArticleService; +import com.lyms.talkonlineweb.mapper.LymsArticleMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * + */ +@Service +public class LymsArticleServiceImpl extends ServiceImpl + implements LymsArticleService{ + + @Autowired + private LymsArticleMapper lymsArticleMapper; + + @Override + public List sltNeedPush() { + return lymsArticleMapper.sltNeedPush(); + } +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsFavorServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsFavorServiceImpl.java new file mode 100644 index 0000000..a6802e0 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsFavorServiceImpl.java @@ -0,0 +1,20 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsFavor; +import com.lyms.talkonlineweb.service.LymsFavorService; +import com.lyms.talkonlineweb.mapper.LymsFavorMapper; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class LymsFavorServiceImpl extends ServiceImpl + implements LymsFavorService{ + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushedartServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushedartServiceImpl.java new file mode 100644 index 0000000..709fbfc --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushedartServiceImpl.java @@ -0,0 +1,20 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsPushedart; +import com.lyms.talkonlineweb.service.LymsPushedartService; +import com.lyms.talkonlineweb.mapper.LymsPushedartMapper; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class LymsPushedartServiceImpl extends ServiceImpl + implements LymsPushedartService{ + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java new file mode 100644 index 0000000..39db58a --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java @@ -0,0 +1,54 @@ +package com.lyms.talkonlineweb.task; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lyms.talkonlineweb.domain.LymsArticle; +import com.lyms.talkonlineweb.domain.LymsPushedart; +import com.lyms.talkonlineweb.domain.PatientInfo; +import com.lyms.talkonlineweb.service.LymsArticleService; +import com.lyms.talkonlineweb.service.LymsPushedartService; +import com.lyms.talkonlineweb.service.PatientInfoService; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + +/** + * 推送文章任务 + */ + +@Component +@Log4j2 +public class PushArticleTask { + + @Autowired + private LymsArticleService lymsArticleService; + @Autowired + private PatientInfoService patientInfoService; + @Autowired + private LymsPushedartService lymsPushedartService;//推送的历史记录 + +// @Scheduled(initialDelay=1000, fixedRate=5000) + public void pushArtcle(){ + log.info("开始给患者推送文章>>>>>>"); + List aLst=lymsArticleService.sltNeedPush();//获取待推送文章 + + aLst.forEach(e->{ + PatientInfo patientInfo=new PatientInfo(); + patientInfo.setIid(e.getIid());//针对特定疾病人群推送文章 + List pLst=patientInfoService.list(Wrappers.query(patientInfo)); + + pLst.forEach(p->{ + LymsPushedart pushedart=new LymsPushedart(); + pushedart.setPid(p.getId()); + pushedart.setAid(e.getAid()); + pushedart.setCreatedtime(new Date()); + pushedart.setIsread((byte) 0); + lymsPushedartService.save(pushedart);//插入到提送记录 + }); + + }); + } +} diff --git a/talkonlineweb/src/main/resources/application.yml b/talkonlineweb/src/main/resources/application.yml index 3dc0a1d..a267f54 100644 --- a/talkonlineweb/src/main/resources/application.yml +++ b/talkonlineweb/src/main/resources/application.yml @@ -16,4 +16,6 @@ spring: logging: config: classpath:logback-spring.xml -excludePath: login,test1,test2 \ No newline at end of file +excludePath: login,test1,test2 +uploadPath: /data/talkonline/upload/ +imgUrlPre: https://dev-talk.healthbaby.com.cn/upload/ \ No newline at end of file diff --git a/talkonlineweb/src/main/resources/mapper/LymsArticleMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsArticleMapper.xml new file mode 100644 index 0000000..33b95b0 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsArticleMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + aid,did,iid, + title,content,stat, + createdby,createdtime,updatedby, + updated_time + + diff --git a/talkonlineweb/src/main/resources/mapper/LymsFavorMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsFavorMapper.xml new file mode 100644 index 0000000..2e180c1 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsFavorMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + fid,iid,hid, + hname,did,dname, + createdby,createdtime,updatedby, + updated_time + + diff --git a/talkonlineweb/src/main/resources/mapper/LymsPushedartMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsPushedartMapper.xml new file mode 100644 index 0000000..49e24d1 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsPushedartMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + id,pid,aid, + isread,createdtime + + -- 1.8.3.1