Commit 363119cd2db229f65e7ced26a3c114b8a0eb9270

Authored by liquanyu
1 parent 0e04f5a703

威海体重

Showing 2 changed files with 50 additions and 9 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java View file @ 363119c
... ... @@ -126,6 +126,28 @@
126 126 //异常次数
127 127 private Integer exceptionCount;
128 128  
  129 + //0 未推送 1已经推送
  130 + private Integer exceptionSend;
  131 +
  132 + //0 未推送 1已经推送
  133 + private Integer sevenSend;
  134 +
  135 + public Integer getExceptionSend() {
  136 + return exceptionSend;
  137 + }
  138 +
  139 + public void setExceptionSend(Integer exceptionSend) {
  140 + this.exceptionSend = exceptionSend;
  141 + }
  142 +
  143 + public Integer getSevenSend() {
  144 + return sevenSend;
  145 + }
  146 +
  147 + public void setSevenSend(Integer sevenSend) {
  148 + this.sevenSend = sevenSend;
  149 + }
  150 +
129 151 public Integer getExceptionCount() {
130 152 return exceptionCount;
131 153 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ 363119c
... ... @@ -1769,8 +1769,8 @@
1769 1769 {
1770 1770 Date currentDate = new Date();
1771 1771 DateUtil.formatYmd(currentDate);
1772   - if (!(patientWeight.getModified().getTime() < new Date().getTime()
1773   - && patientWeight.getModified().getTime() > currentDate.getTime()))
  1772 + if (patientWeight.getModified().getTime() < new Date().getTime()
  1773 + && patientWeight.getModified().getTime() > currentDate.getTime())
1774 1774 {
1775 1775 continue;
1776 1776 }
1777 1777  
1778 1778  
1779 1779  
... ... @@ -1797,11 +1797,15 @@
1797 1797 }
1798 1798 else if (type == 2)
1799 1799 {
  1800 + patientWeight.setSevenSend(1);
1800 1801 content = "亲爱的准妈妈您好,我是您的私人体重管理医生,您目前已经很久没有记录您的体重值了,为了您和您孩子的健康,请您务必每天记录一下自己的体重,好让我们能随时关注到您和宝宝的健康状况,谢谢!";
  1802 + patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight);
1801 1803 }
1802 1804 else if (type == 3)
1803 1805 {
  1806 + patientWeight.setExceptionSend(1);
1804 1807 content = "亲爱的准妈妈您好,我是您的私人体重管理医生,您目前的体重数据十分不理想,请您迅速与我联系或来院进行复查身体情况。";
  1808 + patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight);
1805 1809 }
1806 1810 mr.setFirst("【" + messagePrefix + "】" + content);
1807 1811 mr.setObjType(ServiceObjEnums.YUNOBJ.getId());
... ... @@ -1845,11 +1849,6 @@
1845 1849 smsConfigFacade.saveMsg(messages, patient.getHospitalId());
1846 1850 }
1847 1851  
1848   - if (patientWeight != null)
1849   - {
1850   - patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight);
1851   - }
1852   -
1853 1852 }
1854 1853 }
1855 1854 }
... ... @@ -1877,7 +1876,26 @@
1877 1876  
1878 1877 if (CollectionUtils.isNotEmpty(patientIds))
1879 1878 {
1880   - List<PatientWeight> weights = mongoTemplate.find(Query.query(Criteria.where("patientId").in(patientIds).and("modified").lte(DateUtil.addDay(new Date(),-7))), PatientWeight.class);
  1879 + Criteria cr = Criteria.where("patientId").in(patientIds);
  1880 +
  1881 + if (type == 2)
  1882 + {
  1883 + cr.and("modified").lte(DateUtil.addDay(new Date(),-7));
  1884 + if (status != null && status == 1)
  1885 + {
  1886 + cr.and("sevenSend").is(status);
  1887 + }
  1888 + }
  1889 + else if (type == 3)
  1890 + {
  1891 + cr.and("exceptionCount").gte(2);
  1892 + if (status != null && status == 1)
  1893 + {
  1894 + cr.and("exceptionSend").is(status);
  1895 + }
  1896 + }
  1897 +
  1898 + List<PatientWeight> weights = mongoTemplate.find(Query.query(cr), PatientWeight.class);
1881 1899 if (CollectionUtils.isNotEmpty(weights))
1882 1900 {
1883 1901 for (PatientWeight weight : weights)
... ... @@ -1890,7 +1908,8 @@
1890 1908 map.put("nowWeight",weight.getNowWeight());
1891 1909 map.put("days",DateUtil.getDays(weight.getModified(), new Date()));
1892 1910 map.put("phone",patients.getPhone());
1893   - map.put("cumulWeight",getDiff(weight.getBeforeWeight(),weight.getNowWeight()));
  1911 + map.put("cumulWeight",getDiff(weight.getBeforeWeight(), weight.getNowWeight()));
  1912 + datas.add(map);
1894 1913 }
1895 1914 }
1896 1915 }