Commit ecdb88a117461d4facc024269fbd3404a0e836da

Authored by liquanyu
1 parent bc8e67d8c1

血糖

Showing 3 changed files with 141 additions and 2 deletions

platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java View file @ ecdb88a
... ... @@ -64,6 +64,7 @@
64 64 DoctorUserMap("DoctorUserMap", 97531222111L),
65 65 BloodPressure("BloodPressure", 97531333111L),
66 66 BloodSugar("BloodSugar", 97111333111L),
  67 + BloodSugarException("BloodSugarException", 97111233111L),
67 68 TempModel("TempModel", 97111333112L),
68 69 TrackDown("TrackDown", 97222333112L),
69 70 last("last", 97531009990L),
platform-dal/src/main/java/com/lyms/platform/pojo/BloodSugarException.java View file @ ecdb88a
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.common.result.BaseModel;
  5 +import org.springframework.data.mongodb.core.mapping.Document;
  6 +
  7 +import java.util.Date;
  8 +
  9 +/**
  10 + * 血糖异常记录
  11 + */
  12 +@Document(collection="lyms_blood_sugar_exc")
  13 +public class BloodSugarException extends BaseModel {
  14 +
  15 + private static final long serialVersionUID = SerialIdEnum.BloodSugar.getCid();
  16 +
  17 + private String id;
  18 +
  19 + private String parentId;
  20 +
  21 + private String pid;
  22 +
  23 + private Date created;
  24 +
  25 + private String creatYmdDate;
  26 +
  27 + private Integer yn;
  28 +
  29 + private String hospitalId;
  30 +
  31 + private Date modified;
  32 +
  33 + //异常次数
  34 + private Integer exceptionCount;
  35 +
  36 + //0 未推送 1已经推送
  37 + private Integer exceptionSend;
  38 +
  39 + //0 未推送 1已经推送
  40 + private Integer sevenSend;
  41 +
  42 + public String getId() {
  43 + return id;
  44 + }
  45 +
  46 + public void setId(String id) {
  47 + this.id = id;
  48 + }
  49 +
  50 + public String getParentId() {
  51 + return parentId;
  52 + }
  53 +
  54 + public void setParentId(String parentId) {
  55 + this.parentId = parentId;
  56 + }
  57 +
  58 + public String getPid() {
  59 + return pid;
  60 + }
  61 +
  62 + public void setPid(String pid) {
  63 + this.pid = pid;
  64 + }
  65 +
  66 + public Date getCreated() {
  67 + return created;
  68 + }
  69 +
  70 + public void setCreated(Date created) {
  71 + this.created = created;
  72 + }
  73 +
  74 + public String getCreatYmdDate() {
  75 + return creatYmdDate;
  76 + }
  77 +
  78 + public void setCreatYmdDate(String creatYmdDate) {
  79 + this.creatYmdDate = creatYmdDate;
  80 + }
  81 +
  82 + public Integer getYn() {
  83 + return yn;
  84 + }
  85 +
  86 + public void setYn(Integer yn) {
  87 + this.yn = yn;
  88 + }
  89 +
  90 + public String getHospitalId() {
  91 + return hospitalId;
  92 + }
  93 +
  94 + public void setHospitalId(String hospitalId) {
  95 + this.hospitalId = hospitalId;
  96 + }
  97 +
  98 + public Date getModified() {
  99 + return modified;
  100 + }
  101 +
  102 + public void setModified(Date modified) {
  103 + this.modified = modified;
  104 + }
  105 +
  106 + public Integer getExceptionCount() {
  107 + return exceptionCount;
  108 + }
  109 +
  110 + public void setExceptionCount(Integer exceptionCount) {
  111 + this.exceptionCount = exceptionCount;
  112 + }
  113 +
  114 + public Integer getExceptionSend() {
  115 + return exceptionSend;
  116 + }
  117 +
  118 + public void setExceptionSend(Integer exceptionSend) {
  119 + this.exceptionSend = exceptionSend;
  120 + }
  121 +
  122 + public Integer getSevenSend() {
  123 + return sevenSend;
  124 + }
  125 +
  126 + public void setSevenSend(Integer sevenSend) {
  127 + this.sevenSend = sevenSend;
  128 + }
  129 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java View file @ ecdb88a
... ... @@ -36,6 +36,7 @@
36 36 import org.springframework.data.mongodb.core.MongoTemplate;
37 37 import org.springframework.data.mongodb.core.query.Criteria;
38 38 import org.springframework.data.mongodb.core.query.Query;
  39 +import org.springframework.data.mongodb.core.query.Update;
39 40 import org.springframework.stereotype.Service;
40 41  
41 42 import java.math.BigDecimal;
... ... @@ -96,8 +97,8 @@
96 97 private UsersService usersService;
97 98  
98 99 public BaseResponse add(Integer userId, BloodSugar bloodSugar) {
99   -// BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(bloodSugar.getParentId()).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class);
100   - BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(mongoUtil.getPid(bloodSugar.getParentId())).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class);
  100 + String pid = mongoUtil.getPid(bloodSugar.getParentId());
  101 + BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class);
101 102 if(one != null) {
102 103 one.setModified(new Date());
103 104 one.setBloodSugar(bloodSugar.getBloodSugar());
... ... @@ -113,6 +114,10 @@
113 114 bloodSugar.setCreatYmdDate(DateUtil.getyyyy_MM_dd(new Date()));
114 115 bloodSugar.setPid(mongoUtil.getPid(bloodSugar.getParentId()));
115 116 bloodSugarService.add(bloodSugar);
  117 +
  118 + Update up = new Update();
  119 + up.set("exceptionSend", 0);
  120 + mongoTemplate.updateMulti(Query.query(Criteria.where("pid").is(pid)), up, BloodSugar.class);
116 121 return RespBuilder.buildSuccess(bloodSugar.getId());
117 122 }
118 123  
... ... @@ -297,6 +302,10 @@
297 302 } else {
298 303 mongoTemplate.save(one);
299 304 }
  305 +
  306 + Update up = new Update();
  307 + up.set("exceptionSend", 0);
  308 + mongoTemplate.updateMulti(Query.query(Criteria.where("pid").is(pid)), up, BloodSugar.class);
300 309 return RespBuilder.buildSuccess(one.getId());
301 310 }
302 311